[FFmpeg-devel] [PATCH 2/4] ffmpeg: never output subtitles with zero duration

Marton Balint cus at passwd.hu
Sun Nov 17 17:38:11 CET 2013


On Sun, 17 Nov 2013, wm4 wrote:

> On Sun, 17 Nov 2013 15:15:00 +0100
> Marton Balint <cus at passwd.hu> wrote:
>
>> Signed-off-by: Marton Balint <cus at passwd.hu>
>> ---
>>  ffmpeg.c               | 2 +-
>>  tests/ref/fate/sub-srt | 2 +-
>>  2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/ffmpeg.c b/ffmpeg.c
>> index b2cebb8..6aafdea 100644
>> --- a/ffmpeg.c
>> +++ b/ffmpeg.c
>> @@ -1808,7 +1808,7 @@ static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output)
>>
>>      sub2video_update(ist, &subtitle);
>>
>> -    if (!*got_output || !subtitle.num_rects)
>> +    if (!*got_output || !subtitle.num_rects || !(subtitle.end_display_time - subtitle.start_display_time))
>>          return ret;
>>
>>      for (i = 0; i < nb_output_streams; i++) {
>> diff --git a/tests/ref/fate/sub-srt b/tests/ref/fate/sub-srt
>> index ba5e50a..012d475 100644
>> --- a/tests/ref/fate/sub-srt
>> +++ b/tests/ref/fate/sub-srt
>> @@ -1 +1 @@
>> -a246a00ed72655cb8db3eaf64a522e0d
>> +73d62f84a94c148014c97363efd4e0f8
>
> This is probably wrong. At least vobsub can have subtitles with unknown
> duration, and then the duration is set to zero.

Is this something that we would like to enforce (and document :)) across 
the API, or VobSub is just a special case? How do the renderer know when 
to stop displaying a subtitle with zero duration? Or using 
time-overlapping subtitles and zero duration subtitles should be mutually 
exclusive?

Regards,
Marton


More information about the ffmpeg-devel mailing list