diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2019-09-19 14:55:44 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2019-09-19 16:12:53 +0300 |
commit | 71f2229b0d8241ba153abebcc1e0d0e92e877574 (patch) | |
tree | b6070a5d4d0a082d0839d8c3a88ded66f9db69c0 /tests | |
parent | fba35aa8c5cdedb3132b286874c5185c59af35a2 (diff) |
Fix T68091: Adding a corrupt video crashes/confuses Blender
The problematic video from T68091 clearly has an invalid stream duration
(it would be 55 centuries long if interpreted at 30 FPS, and given that
it was recorded with an Android 9 device, it's unlikely that recording
started that long ago). I've added a heuristic to check the stream
duration against the container duration; if the stream is more than 4x
longer than the container, Blender now falls back to the container
duration.
We could use MIN(stream duration, container duration), but there might
be video files out there where the container duration is less precise
than the stream duration; they are measured in different units of time
(microseconds for the container vs. frames for the stream).
Includes a unit test for the above heuristic.
Reviewed by: jbakker
Differential revision: https://developer.blender.org/D5853
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/python/ffmpeg_tests.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/python/ffmpeg_tests.py b/tests/python/ffmpeg_tests.py index d6e7127c35a..92734b5bc7d 100755 --- a/tests/python/ffmpeg_tests.py +++ b/tests/python/ffmpeg_tests.py @@ -86,6 +86,15 @@ class FPSDetectionTest(AbstractFFmpegSequencerTest): 1.0, places=2) + def test_T68091(self): + self.assertAlmostEqual( + self.get_movie_file_fps('T68091-invalid-nb_frames-at-10fps.mp4'), + 10.0, + places=2) + self.assertEqual( + self.get_movie_file_duration('T68091-invalid-nb_frames-at-10fps.mp4'), + 10) + def test_T54834(self): self.assertEqual( self.get_movie_file_duration('T54834.ogg'), |