[FFmpeg-user] Converting PTS to seconds

Moritz Barsnick barsnick at gmx.net
Wed May 17 23:01:06 EEST 2017


On Wed, May 17, 2017 at 18:04:48 +0530, tarun singhal wrote:
> I am able to extract PTS of each frame in a video using mkvtimestamp_v2.

Why use that muxer? How about ffprobe?

> Now since eventually i am trying to find timestamp in seconds of that
> frame. Can you please help me how to convert PTS into seconds?

ffprobe does that for you.

Something like:

$ ffprobe -show_entries packet=pts_time,duration_time -of default=noprint_wrappers=1 input.mp4

should be the kind of magic you need.

> I got to know that mkvtimestamp_v2 provides PTS in timebase of 1/1000 is it
> same for all formats of content. How to use this timebase to convert PTS
> value to seconds

As someone else wrote in the other thread: timestamp = PTS * timebase.

Moritz


More information about the ffmpeg-user mailing list