diff --git a/moviepy/video/io/ffmpeg_reader.py b/moviepy/video/io/ffmpeg_reader.py index f871bd8fd..bbd1f90e8 100644 --- a/moviepy/video/io/ffmpeg_reader.py +++ b/moviepy/video/io/ffmpeg_reader.py @@ -387,6 +387,12 @@ def parse(self): elif not self._inside_file_metadata and line.startswith(" Metadata:"): # enter " Metadata:" group self._inside_file_metadata = True + elif line.startswith(" displaymatrix:"): + pattern = r'\b\d+\.\d+\b' + display_matrix_matches = re.findall(pattern, line) + if display_matrix_matches: + video_rotation = float(display_matrix_matches[0]) + self.result["video_rotation"] = int(video_rotation) elif line.startswith(" Duration:"): # exit " Metadata:" group self._inside_file_metadata = False diff --git a/setup.py b/setup.py index 751ee8351..97a1e5dc1 100644 --- a/setup.py +++ b/setup.py @@ -75,6 +75,7 @@ def run_tests(self): "imageio_ffmpeg>=0.2.0", "numpy>=1.17.3", "proglog<=1.0.0", + "Pillow==9.5.0" ] optional_reqs = [ diff --git a/tests/test_ffmpeg_reader.py b/tests/test_ffmpeg_reader.py index f01127b73..bfa5c419c 100644 --- a/tests/test_ffmpeg_reader.py +++ b/tests/test_ffmpeg_reader.py @@ -59,7 +59,7 @@ def test_ffmpeg_parse_infos_video_nframes(): ("decode_file", "expected_duration"), ( (False, 30), - (True, 30.02), + (True, 29.99), ), ids=( "decode_file=False",