[FFmpeg-user] filter pipeline 'PTS' -- int64_t?

Jim DeLaHunt list+ffmpeg-user at jdlh.com
Tue Mar 2 21:47:38 EET 2021

On 2021-03-01 16:43, Mark Filipak (ffmpeg) wrote:
> The ffmpeg filter pipeline assigns a 'PTS' to each frame, frame by 
> frame. Is *that* 'PTS' an int64_t?

I don't know how to answer this question. I don't know of a single piece 
of code which is the "ffmpeg filter pipeline". I understand that term to 
refer to a collection of design parameters which organises the 
interaction of code modules. It is the code modules which store 
Presentation Timestamps (PTSs).

It is meaningful, I believe, to ask if the code modules store PTS values 
as int64_t types. I believe the answer is generally "yes".

The C++ standards define int64_t as a "signed integer type with width of 
exactly… 64 bits… with no padding bits and using 2's complement for 
negative values". Source: 
https://en.cppreference.com/w/cpp/types/integer . Thus data values of 
type int64_t are capable of storing negative integer values.

> Things I have found.
> https://ffmpeg.org/ffmpeg-filters.html#fps-1
>   "...trim any frames with a negative PTS."
> That implies that PTS can be negative (ergo, is a signed integer).

Yes, I believe that FFmpeg will accept and generate streams which have 
negative values for PTS.

> http://svn.ffmpeg.org/doxygen/1.0/structAVFrame.html
> Is AVFrame the structure of frames in the filter pipeline? If so, then
> "int64_t     pts
> "     presentation timestamp in time_base units (time when frame 
> should be shown to user) If "AV_NOPTS_VALUE then frame_rate = 
> 1/time_base will be assumed."
> appears to answer my question, unless it's a different 'frame'...
> ...What exactly is 'AVFrame'?

I am not sure. I won't try to answer this question.

> http://svn.ffmpeg.org/doxygen/1.0/avformat_8h-source.html
>   "00320 typedef struct AVFrac {
>   "00321     int64_t val, num, den;
>   "00322 } AVFrac;"
> http://svn.ffmpeg.org/doxygen/1.0/structAVFrac.html#_details
>   "The exact value of the fractional number is: 'val + num / den'."
> That appears to be a definition of something called "PTS" but seems to 
> not be what's assigned to a frame in the filter pipeline.

That code looks to me like it defines a data type for storing rational 
numbers. The copyright notice on that module says year 2001, and 
"Fabrice Bellard", the original developer of FFmpeg. That hints that 
this module is old code. A mention of PTS there is perhaps a statement 
of 20-year-old intentions, rather than a claim about what the current 
code does. The fact that the code defines a data type does not say 
whether the code actually uses that data type.

> The label (name) of what is actually assigned to frames in the filter 
> pipeline as 'PTS' is unknown to me.

I don't know how to answer this question. See above about the concept of 
a "filter pipeline".

Best regards,
       —Jim DeLaHunt

More information about the ffmpeg-user mailing list