-->

Time stamped video to time stamped images

2020-05-09 21:50发布

问题:

I have a time stamped AVI video file.

I want to create images from the frames of the video but I need them to also have a time associated with them as well.

I can create images from the video through FFmpeg using:

ffmpeg -i video.avi -r 0.1 image_%05.jpeg

However this images do not have a time embedded. Is it possible to also take the time associated with each frame in the video?

My end goal is to sync the time stamp with a GPS track to geotag the images (from the video frames.)

回答1:

Stackoverflow is related to programming - this question is more suited to superuser.

To answer you question though, if you are trying to include a timestamp overlay that is present in the original video files, then you can call that stream and maintain the overlay on your output files.

If instead you are trying to generate your own onscreen text relative to the PTS, try:

ffmpeg -i video.avi -vf "drawtext=fontfile='c\:\\windows\\fonts\\arialbd.ttf':'%{pts\:hms}':x=0:y=0:fontcolor=white:fontsize=10:box=1:boxcolor=black" /
-f image2 image_%05d.bmp

Chang the values at x=0 and y=0 to the pixel coordinates where you want the text to being. Also cahnge the value after fontsize= to change the size of the text.

.... sorry for any awkward formating in the ffmpeg command above. I'm still getting used to this myself.