[FFmpeg-user] Fixing bad DTS/PTS without reencode

Massimo Battistel battistel at gmail.com
Thu Jan 17 11:20:09 CET 2013


2013/1/17 Carl Eugen Hoyos <cehoyos at ag.or.at>

> Massimo Battistel <battistel <at> gmail.com> writes:
>
> > http://www.datafilehost.com/download-527e92a0.html
> >
> > Discontinuty is around 4.8 seconds.
>
> I can reproduce the discontinuity with ffmpeg -debug_ts
> (433800 -> 441000).
> Is there a problem when FFmpeg converts the file?
>

No problems.
If I *transcode* the video (ffmpeg -i sample.mpg -vcodec mpeg2video
out.mpg), ffmpeg fixes the discont by duplicating the frame at the
discontinuity point. Infact the transcoded file has 1 frame more (253
instead of 252).


> Iirc, discontinuities in mpeg streams are allowed,
>

what's "lirc"?


> or am I wrong?
>

You are right, but the original question was a bit different.
Discontinuities in timecode can cause wrong duration detection.

I have used some directshow demuxers calculating video duration like that:
lastTimeCode - firstTimeCode + avgFrameDuration.
This method would give wrong result if files contains discontinuities. btw,
I have other samples with bigger discontinuities.

Is it possible someway to play the frame at discont point for 80ms instead
of 40ms?

Could I manage this (programmatically at this point) changing
AVpacket.duration?

thanks


More information about the ffmpeg-user mailing list