[FFmpeg-devel] [PATCH]lavf/matroskaenc: Do not write 0 duration for subtitles

Jerome Martinez jerome at mediaarea.net
Thu Nov 23 13:04:31 EET 2017


On 12/11/2017 03:12, Carl Eugen Hoyos wrote:
> The matroska spec says blockduration == 0 means the frame is not a
> keyframe.  Since all subtitles are "keyframes", 0 blockduration should
> not be written.

As I understand from discussion on CELLAR mailing-list:
- if is not expected to have a frame with block duration of 0, in a 
perfect world the previous frame should have the right duration and the 
player should hide the previous frame after blockduration of the 
previous frame.
- as a workaround, it would make sense to put an empty frame with 
"unlimited" duration, so no blockduration, as implemented in the patch.

The only issue is in the case someone puts a "not empty" frame with a 
duration of 0, this patch would change the behavior (from nothing 
displayed to the frame displayed) but as it is not expected to have a 
duration of 0 when something is displayed, this is not a real use case IMO.

Suggestion of changes for this patch:
- Remove the outdated part about specs. A duration of 0 is not coherent, 
that's all.
- Add a comment (in the code?) stipulating that duration of 0 is a 
special case which means "up to the next frame".



More information about the ffmpeg-devel mailing list