I have a video file that lasts 9.3s and was recorded at FPS=10. I would like to use FFMPEG in order to extract frames from this video at arbitrary FPS (e.g. FPS=3). Example command:

ffmpeg -i input.mp4 -filter:v "fps=3" image_index_timestamp.jpg

But, I need to know which frame from original video FFMPEG has extracted. What I mean by that is, I would like to include in file name a timestamp (e.g. image_00_00:00:00.1.jpg, where 00 is index generated by FFMPEG and 00:00:00.1 is timestamp from which frame was extracted.).

I want to be able to SEEK to that specific timestamp and extract the same frame FFMPEG has generated for me.

By using following command I am able to draw timestamp (pts) on each frame. But, what I need is that timestamp inside filename and I dont know how to get it.

ffmpeg -i input.mp4 -filter:v "drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf: text='%{pts\:hms}': x=(w-tw)/2: y=h-(2*lh): fontcolor=red: box=1: boxcolor=0x00000000@1,fps=3" -start_number 0 image_%03d.jpg

1 Answer 1


ffmpeg docs suggests this to timestamp ALL frames- ffmpeg -i input.mp4 -f image2 -frame_pts true %d.jpg

If you check out https://ffmpeg.org/ffmpeg-all.html and search for "expand the filename with pts"

but I dont think its the true Presentation Time Stamp, rather its an index.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy