[FFmpeg-user] To make a PTS, FFmpeg is truncating *up*

Mark Filipak markfilipak.imdb at gmail.com
Thu Feb 15 20:42:33 EET 2024


Here is my first finding.
Can someone who reads 'C' code locate the code and investigate?
It looks suspicious to me because everywhere else, timestamps appear to be truncated in the usual 
way. Here, to make a PTS, FFmpeg is truncating _up_.

If N*3753.75 is an integer, it's used as PTS. But
if N*3753.75 is a decimal, the PTS becomes int(N*3753.75 + 1).

Here's the proof:
133559*3753.75+2854113=504201209.25
                   ____////////////
                  /////////¯¯¯¯¯¯¯
0,  504201210,  504201210,     3753,      608, 0xdece0f07

Frame 133559 is a B-frame near where I've joined two sections that have both been trimmed on both 
ends. I chose that frame for no particular reason.

The joined video and audio packet streams appear to be perfectly timestamped, but there is 3 frames 
of flashing
...black-black-picture-black-picture-black-picture-black-picture-picture...
at the join preceded by a 1 second jump in MPV.

I'm crawling through the framecrc listings of three videos:
The 'prefix' video that has been trimmed.
The 'suffix' video that has been trimmed.
The 'join' video after 'prefix' & 'suffix' have been joined.
Everything looks beautiful. Even the audio packets appear to be smoothly joined. But I'm crawling 
thorough it all checking everything. I stopped to compose this message because the truncations 
bother me.

I really need some assistance. This is insanely meticulous work.

--Mark.


More information about the ffmpeg-user mailing list