fix: improve accuracy of package framerate detection #653
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
bug fix
Sofie sometimes detects the framerate of video packages incorrectly, particularly in the case of progressive scan files. This is because
buildPackageFormatString
looks atcodec_time_base
to determine a video's framerate. In certain video formats (such as XAVC MXF and H.264 MP4),codec_time_base
is often double that of the video's actual framerate. Both ffmpeg and DaVinci Resolve export files which have this same characteristic. At first glance, it might seem thatcodec_time_base
is counting fields instead of frames, but this also happens with progressive scan files. Beyond that, there are some progressive scan files I've encountered which havecodec_time_base
values like499/50000
, despite having anr_frame_rate
of50/1
.This discrepancy can result in false warnings in the rundown view where Sofie says that a package has the wrong media format, even though the package is actually of the correct format (or vice versa).
In this PR,
buildPackageFormatString
has been changed to look atr_frame_rate
instead ofcodec_time_base
when determining a package's framerate.buildFormatString
has not been changed, as it doesn't seem to have access tor_frame_rate
data. I'm not sure how much we care about this, seeing asbuildFormatString
seems to be for the older Media Manager and doesn't seem to be part of the Package Manager data flow.Also of note is that this will cause interlaced packages to report their frames per second instead of their fields per second. If this is not desired, a conditional statement that checks
deepScan.field_order
could be added which retains the existing behavior for interlaced content. Such a change might look like this instead: