[FFmpeg-user] Using ffmpeg with youtube-dl: Non-monotonous DTS in output stream

Gyan ffmpeg at gyani.pro
Sat Dec 15 17:50:27 EET 2018


On 15-12-2018 07:44 PM, Paul B Mahol wrote:
> On 12/15/18, Gyan <ffmpeg at gyani.pro> wrote:
>> Some playlists contain a sequence of separately produced MPEG-TS files.
>> So, there's a timestamp reset when each new segment is received. At this
>> point, the timestamp code in libavformat's mux.c simply increments the
>> output timestamp by one when this happens. Unless the timebase
>> resolution is 1/fps, this produces an unsound file. Workaround is to
>> extract the individual streams and remux using mp4box.
>>
>>       ffmpeg -i downloaded.mp4 -c copy video.h264
>>
>>       ffmpeg -i downloaded.mp4 -c copy audio.aac
>>
>>       mp4box -add video.h264 -add audio.aac -new fixed.mp4
> Can't ffmpeg be used in last step too?

I avoid it due to PTS generation bug for H264 streams with B-frames, 
specifically hierarchical B-frames.

Gyan



More information about the ffmpeg-user mailing list