Page MenuHome

Fix T68091: Adding a corrupt video crashes/confuses Blender
ClosedPublic

Authored by Sybren A. Stüvel (sybren) on Sep 19 2019, 2:04 PM.

Details

Summary

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).

This diff contains three commits that I intend to keep separated:

  • cleanup to make the following commits clearer
  • switch frame rate guessing from our own code to the appropriate FFmpeg function
  • add the above-described heuristic

F7758185 can be used to test, and will be part of the unit test suite once this patch is accepted.

Diff Detail

Repository
rB Blender

Event Timeline

Jeroen Bakker (jbakker) requested changes to this revision.Sep 19 2019, 2:48 PM

Small compiler changes.
Would be wise to revisit the code-style a bit (seems to be C89 :-)

source/blender/imbuf/intern/anim_movie.c
582

Possible integer overflow error?

anim->duration * av_q2d(framerate)

584

4.0 as both are already doubles.

This revision now requires changes to proceed.Sep 19 2019, 2:48 PM
Sybren A. Stüvel (sybren) marked 2 inline comments as done.
Sybren A. Stüvel (sybren) edited the summary of this revision. (Show Details)
  • added unit test
  • Addressed review comments
This revision is now accepted and ready to land.Sep 19 2019, 3:04 PM