[FFmpeg-devel] [PATCH] ffmpeg: prevent premature EOF in sub2video with nullptr AVSubtitles
Jan Ekström
jeebjp at gmail.com
Thu Mar 29 02:30:26 EEST 2018
On Thu, Mar 29, 2018 at 12:53 AM, Jan Ekström <jeebjp at gmail.com> wrote:
> From: Jan Ekström <jan.ekstrom at aminocom.com>
>
> With some streams multiple nullptr AVSubtitles can get pushed
> into sub2video_update() in a row.
>
> This causes end_pts, and on the next round pts, to become
> INT64_MAX, latter of which signals EOF in framesync, leading to
> complete loss of subtitles from that point on.
>
> Thus, utilize the previous sub2video.end_pts as both the pts and
> end_pts in case a nullptr AVSubtitle is received. This lets further
> incoming subtitle packets be properly processed, as EOF is not hit
> in framesync.
For context, this seems to mostly be happening at commercial breaks
with some TV channels where a filter chain re-configuration happens at
the beginning and the end due to input format changes (usually with
audio, main programme having 5.1 and advertisements having stereo for
example). Filter chain re-configuration seems related as this does not
seem to happen when the audio filter is removed from the chain.
For example:
- Without audio ("[0:v:0][0:s:0]overlay=eof_action=pass[overlay_out]")
[dvbsub] normal AVSubtitle: utilized values: pts=10949137,
end_pts=13649137, num_rects=0
[dvbsub] nullptr AVSubtitle: utilized values: pts=13649137,
end_pts=9223372036854775807
<no reconfig>
[dvbsub] normal AVSubtitle: utilized values: pts=18783049,
end_pts=21483049, num_rects=2
- With audio ("[0:v:0][0:s:0]overlay=eof_action=pass[overlay_out];[0:a:0]aresample=48000[a_out]")
[dvbsub] normal AVSubtitle: utilized values: pts=10949137,
end_pts=13649137, num_rects=0
[dvbsub] nullptr AVSubtitle: utilized values: pts=13649137,
end_pts=9223372036854775807
<audio reconfig to stereo>
[graph_0_in_0_1] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:0x3
[Parsed_aresample_4] ch:2 chl:stereo fmt:fltp r:48000Hz -> ch:2
chl:stereo fmt:fltp r:48000Hz
[auto_scaler_0] w:720 h:576 fmt:bgra sar:0/1 -> w:720 h:576
fmt:yuva420p sar:0/1 flags:0x2
[dvbsub] nullptr AVSubtitle: utilized values: pts=9223372036854775807,
end_pts=9223372036854775807
<audio reconfig to 5.1>
[graph_0_in_0_1] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:0x60f
[Parsed_aresample_4] ch:6 chl:5.1(side) fmt:fltp r:48000Hz -> ch:2
chl:stereo fmt:fltp r:48000Hz
[dvbsub] nullptr AVSubtitle: utilized values: pts=9223372036854775807,
end_pts=9223372036854775807
[dvbsub] normal AVSubtitle: utilized values: pts=18783049,
end_pts=21483049, num_rects=2
Best regards,
Jan
More information about the ffmpeg-devel
mailing list