[FFmpeg-devel] [PATCH 1/1] avformat/demux: Fix accurate probing of durations in mpegts/ps

Michael Niedermayer michael at niedermayer.cc
Fri Mar 15 00:41:16 EET 2024


On Thu, Mar 14, 2024 at 06:57:39PM +0100, Nicolas Gaullier wrote:
> Two issues affect accuracy of duration in estimate_timings_from_pts():
> - pkt->duration typically reports the duration of a single audio frame,
> whereas a pes often contain several audio frames
> - for video, compute_frame_duration() use r_frame_rate which is not
> reliable; typically, it is the duration of a single field for an
> interlaced video using two field pictures.
> 
> Packet splitting/parsing is required to get accurate durations, so this
> patch replaces ff_read_packet() calls by av_read_frame() calls.
> 
> Note that concatdec makes use of avformat_find_stream_info() to stitch
> correctly the files, so it benefits from this patch (typically, overlap
> is avoided).
> e.g. in fate/concat-demuxer-simple2-lavf-ts: the input audio stream
> duration is now longer than that of the video, which results in
> concatdec joining on audio after the patch instead of joining on video
> before that.
> 
> Signed-off-by: Nicolas Gaullier <nicolas.gaullier at cji.paris>
> ---
>  libavformat/demux.c                           |  30 +---
>  tests/ref/fate/concat-demuxer-simple2-lavf-ts | 170 +++++++++---------
>  tests/ref/fate/ts-opus-demux                  |   4 +-
>  3 files changed, 93 insertions(+), 111 deletions(-)

for some reason this seems to loose a resolution of some subtitle stream when probing:

make -j32 && ./ffprobe -v 99 -analyzeduration 2G -probesize 2G -i tickets/2471/part.ts 2>&1 | grep dvb_teletext
  Stream #0:2[0x240](eng), 1020, 1/90000: Subtitle: dvb_teletext (libzvbi_teletextdec) ([6][0][0][0] / 0x0006), 492x250
  Stream #0:4[0x247](eng), 1902, 1/90000: Subtitle: dvb_teletext (libzvbi_teletextdec) ([6][0][0][0] / 0x0006), 492x250
vs.
  Stream #0:2[0x240](eng), 1020, 1/90000: Subtitle: dvb_teletext (libzvbi_teletextdec) ([6][0][0][0] / 0x0006), 492x250
  Stream #0:4[0x247](eng), 1902, 1/90000: Subtitle: dvb_teletext (libzvbi_teletextdec) ([6][0][0][0] / 0x0006)

ive not looked at this so i have no idea this is a bug, just wanted to report it

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have often repented speaking, but never of holding my tongue.
-- Xenocrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20240314/fbdbcbf3/attachment.sig>


More information about the ffmpeg-devel mailing list