Video editing with Python
Removed Hz from audio_fps match in ffmpeg_parse_infos (#665)
Quinn McNamara956c46256cac
diff --git a/moviepy/video/io/ffmpeg_reader.py b/moviepy/video/io/ffmpeg_reader.pyindex 0a26a88a..1086fe54 100644--- a/moviepy/video/io/ffmpeg_reader.py+++ b/moviepy/video/io/ffmpeg_reader.py@@ -385,7 +385,8 @@ def ffmpeg_parse_infos(filename, print_infos=False, check_duration=True,line = lines_audio[0]try:match = re.search(" [0-9]* Hz", line)- result['audio_fps'] = int(line[match.start()+1:match.end()])+ hz_string = line[match.start()+1:match.end()-3] # Removes the 'hz' from the end+ result['audio_fps'] = int(hz_string)except:result['audio_fps'] = 'unknown'diff --git a/tests/test_ffmpeg_reader.py b/tests/test_ffmpeg_reader.pyindex 5f0d381e..a46fce96 100644--- a/tests/test_ffmpeg_reader.py+++ b/tests/test_ffmpeg_reader.py@@ -21,6 +21,15 @@ def test_ffmpeg_parse_infos():d=ffmpeg_parse_infos("media/pigs_in_a_polka.gif")assert d['video_size'] == [314, 273]assert d['duration'] == 3.0+ assert not d['audio_found']++ d=ffmpeg_parse_infos("media/video_with_failing_audio.mp4")+ assert d['audio_found']+ assert d['audio_fps'] == 44100++ d=ffmpeg_parse_infos("media/crunching.mp3")+ assert d['audio_found']+ assert d['audio_fps'] == 48000if __name__ == '__main__':