Skip to content

Commit

Permalink
Fix ffmpeg_parse_infos silently hangs on Windows when file contains m…
Browse files Browse the repository at this point in the history
…any metadata (#926)

* Add failing test
* Fix #926 with fix from bertwagner
  • Loading branch information
Overdrivr authored Mar 27, 2019
1 parent 2937786 commit 350571a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
7 changes: 3 additions & 4 deletions moviepy/video/io/ffmpeg_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,9 @@ def ffmpeg_parse_infos(filename, print_infos=False, check_duration=True,
popen_params["creationflags"] = 0x08000000

proc = sp.Popen(cmd, **popen_params)

proc.stdout.readline()
proc.terminate()
infos = proc.stderr.read().decode('utf8')
(output, error) = proc.communicate()
infos = error.decode('utf8')

del proc

if print_infos:
Expand Down
Binary file added tests/resource/sintel_with_15_chapters.mp4
Binary file not shown.
3 changes: 3 additions & 0 deletions tests/test_ffmpeg_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ def test_ffmpeg_parse_infos():
assert d['audio_found']
assert d['audio_fps'] == 48000

def test_ffmpeg_parse_infos_for_i926():
d = ffmpeg_parse_infos("tests/resource/sintel_with_15_chapters.mp4")
assert d['audio_found']

if __name__ == '__main__':
pytest.main()

0 comments on commit 350571a

Please sign in to comment.