[FFmpeg-user] Force target DTS == source DTS -- How?

Devin Heitmueller devin.heitmueller at ltnglobal.com
Wed Jan 10 20:55:13 EET 2024


On Wed, Jan 10, 2024 at 1:42 PM Mark Filipak <markfilipak.imdb at gmail.com> wrote:
>
> Correction...
>
> On 1/10/24 13:21, Devin Heitmueller wrote:
> > On Wed, Jan 10, 2024 at 12:50 PM Mark Filipak
> > <markfilipak.imdb at gmail.com> wrote:
> >>
> >> Question: How can I force the target's DTS to be the source's DTS?
> >
> > Add "-copyts" to the front of the command-line as a global option.
> > The ffmpeg application will automatically rebase timestamps to zero
> > after demuxing unless you specify this option (which is further up the
> > pipeline than your bsf, hence the bsf has no effect).
> >
> > Devin
>
> Thanks, Devin, but nope, they're a lot closer but they're still not the same.
>
> set FORCE=-bsf:v setts=dts=DTS:pts=PTS
> set SOURCE=h:\BDMV\STREAM\00305.m2ts
> :     IS: 0,    1044806,    1048560,     3753,   640646, 0x900a1a7a, S=1, 1
>
> ffmpeg -to 39.122 -copyts -i %SOURCE% -map 0 %FORCE% -c copy -sn -dn c:\target_2.m2ts
> : RESULT: 0,    1170806,    1174560,     3753,   640646, 0x900a1a7a, S=1, 1
>
> ffmpeg -to 39.122 -copyts -i %SOURCE% -map 0         -c copy -sn -dn c:\target_1.m2ts
> : RESULT: 0,    1170806,    1174560,     3753,   640646, 0x900a1a7a, S=1, 1
>
> Sorry I flubbed the command lines. These are correct.

While I'm not sure why you're not getting the expected output, you can
add "-debug_ts" to your ffmpeg command line as a global option and it
will show the timestamps for the packets at every stage (i.e.
demux/rebasing/decoding/encoding/muxing).  That should allow you to
track down where in the pipeline the timestamp is changing.

Devin

-- 
Devin Heitmueller, Senior Software Engineer
LTN Global Communications
o: +1 (301) 363-1001
w: https://ltnglobal.com  e: devin.heitmueller at ltnglobal.com


More information about the ffmpeg-user mailing list