[FFmpeg-user] Is there any approach to tell ffmpeg how to determine dts of fMP4 segment?

toya3329 toya3329 at protonmail.com
Thu Mar 1 09:06:58 EET 2018


Hi, Carl!

I have use under development streamlink mpegdash branch
(https://github.com/beardypig/streamlink/tree/mpegdash) to watch some
Youtube dash live stream[1] (with some custom hardcoded modification for YT
livestream). And mpegdash streamlink uses ffmpeg to mux video and audio
streams.

Uploaded fMP4 sample at https://ufile.io/swsr8.

In mov_read_trun(), the following snippet which give the first dts/pts

 frag_stream_info = get_current_frag_stream_info(&c->frag_index);
    if (frag_stream_info)
    {
        if (frag_stream_info->first_tfra_pts != AV_NOPTS_VALUE &&
            c->use_mfra_for == FF_MOV_FLAG_MFRA_PTS) {
            pts = frag_stream_info->first_tfra_pts;
            av_log(c->fc, AV_LOG_DEBUG, "found mfra time %"PRId64
                    ", using it for pts\n", pts);
        } else if (frag_stream_info->sidx_pts != AV_NOPTS_VALUE) {
            // FIXME: sidx earliest_presentation_time is *PTS*, s.b.
            // pts = frag_stream_info->sidx_pts;
            dts = frag_stream_info->sidx_pts - sc->time_offset;
            av_log(c->fc, AV_LOG_DEBUG, "found sidx time %"PRId64

In this failed case, sidx_pts is 0 and it will set the first dts to sidx_pts
(0).
And then start dts of every fMP4 segment is 0. After ffmpeg muxing, ffmpeg
log show "Non-monotonous DTS in output stream". But tfdt time of each
segment is good to be used as a ref timestampe. 

/toya

---

[1]Some fMP4 segment file produced by VideoHandler.(handler_name is
VideoHandler) always give six earliest presentation 0. (Some file produced
by "ISO Media file produced by Google Inc" has the correct
earliest_presentation_time). 




--
Sent from: http://www.ffmpeg-archive.org/


More information about the ffmpeg-user mailing list