0

I am trying to extract the timestamps of mp4 video using ffmpeg.

With ffprobe it is like following.

command: ffprobe -v quiet -f lavfi -print_format json -i "movie=test.mp4" -show_frames -show_entries frame=pkt_pts_time

Following is the output with ffprobe but same I need using ffmpeg: { "frames": [ { "pkt_pts_time": "0.000000" }, { "pkt_pts_time": "0.033367" }, { "pkt_pts_time": "0.066733" } ] }

I need using ffmpeg because I have to use ffmpeg.js(https://github.com/Kagami/ffmpeg.js) lib at browser side where requirement is to extract timestamp of frames.

1
  • Note that this project is very outdated.
    – slhck
    Aug 1, 2019 at 12:21

1 Answer 1

4

You can use the showinfo filter which prints a line for each frame:

[Parsed_showinfo_0 @ 0x7ff710000000] n:   1 pts:      1 pts_time:0.04    pos:       -1 fmt:rgb24 sar:1/1 s:320x240 i:P iskey:1 type:I checksum:C4740AD1 plane_checksum:[C4740AD1] mean:[127] stdev:[125.7]

Here, the pts_time is the presentation timestamp of the frame. Run it, for example, like so:

ffmpeg -hide_banner -f lavfi -i testsrc -filter:v showinfo -f null /dev/null
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .