Page 1 of 1

Stills extraction naming - Time code help

Posted: Tue Oct 08, 2019 9:10 am
by RichD387
Hi All,

Relatively new to FfaStrans, I have a work flow that produces still images from video files to use in Photogrammetry. Currently I need to extract every 12th frame from a 60FPS video files. I have this working, however I would like to name them in a specific format and I am having difficulty getting this to work can any one help? The Format i am trying to achieve is Filename_FrameNumber_TimeinHHMMSS.png (the frame count is not so important and could just be an incremental umber to use as a unique identifier the time is though) e.g. If the still was taken from the video at 2 min 1 second i would like it to look like "video1_1_000201.png" as an example.

Thank you all in advance.

Re: Stills extraction naming - Time code help

Posted: Tue Oct 08, 2019 1:26 pm
by emcodem
Hi RichD,
welcome to the Forum!
A quick research on ffmpeg for me gives one easy option: We can have the extracted framenumber in the output filename. But not more than that (either framenumber or picture count).
Related options for a ffmpeg commandline:
ffmpeg -i %input% -vf "select=not(mod(n\,12))" -q:v 2 -f image2 -dpi 72 -vsync 0 -metadata "creation_time=now" -y -copyts -frame_pts 1 "C:\temp\Filename_%09d.jpg"

Is that of interest for you or do you really desperately need hhmmss in the filename? - i am afraid this would need some scripting at the best of my knowledge.

Re: Stills extraction naming - Time code help

Posted: Tue Oct 08, 2019 6:40 pm
by RichD387
hi emcodem,

thanks for the reply, that has put me a step in the right direction. Still dependent on the hhmmss time code as this is to reference another file in the process. Any ideas more than welcome. We have thought about doing this in python although still not created a nice way to get the Tcode in the file name.

Re: Stills extraction naming - Time code help

Posted: Wed Oct 09, 2019 7:20 am
by emcodem
Great if you are able to do some python scripting. You could easily store the framerate and start timecode in the filename, e.g.
filename_framerate_starttc_framenumber.jpg
Then just create a small renamer in python that calculates the current timecode from starttc and framenumber (considering framerate).
Just recently i needed to do some timecode stuff in python, there is a nice ready to use timecode class that should be able to ease your life a lot:
https://pypi.org/project/timecode/