12
5
ffmpeg -i myvid.mp4 -r 25 -t 100 image-%d.jpeg
Is the command I'm using to extract frames and it's working just like I expected. However I'd also like to look at the timestamps of the frames. At whatever precision. 100 miliseconds is good enough for me. Can ffmpeg do this?
Providing additional details,
When I run the above command i get around 100 JPEGs, I guess there is a 1 to 1 (or many to 1) correspondence between these JPEGS and frames of the video. I would like to know the timestamp of the frame that was output as a JPEG image 'i'.
Additionally I tried ffprobe but I find it reports even the video duration inaccurately :(
As what? AFAIK jpeg has no such metadata. The EXIF timestamp is for
capture
time. – Rajib – 2014-11-18T19:04:35.527Sure the JPEG doesn't have the metadata, but the mp4 might. Can I direct ffmpeg to pull it along with the frames which it later encodes as JPEGS and dump the time stamps in a file? – Srini – 2014-11-18T19:06:30.390
Please include the complete
ffmpeg
console output from your command. – llogan – 2014-11-18T20:19:10.103ffprobe can give you the timestamp information from the mp4 video stream. Are you asking as if frames may be duplicated or dropped then what is the correspondence to the original mp4 timestamps? In that case I would explore increasing the verbosity settings to see if you can get the frame by frame during execution. Could you expand on what you mean by "timestamps associated with frames". – dstob – 2014-11-18T21:41:22.340
@dstob The timestamps associated with frames are the presentation timestamps of the input video, i.e. when each frame should be shown, relative to the start of the video. – slhck – 2014-11-19T20:19:57.547
@Srinivas Suresh Quite often stream information is incorrect. You can use -show_frames and do a little parsing yourself or use -count_frames and the native framerate to calculate the duration. Since the correspondence seems so flexible then you'll have to do any final extraction yourself. Fun question btw, you might look at increasing verbosity during the ffmpeg run to get timestamp values as ffmpeg is choosing to duplicate/drop frames. Maybe combine this with ffrobe -show_frames to make your desired correspondence? – dstob – 2014-11-21T04:18:22.940