Stills extraction naming - Time code help

Questions and answers on how to get the most out of FFAStrans
Post Reply
RichD387
Posts: 2
Joined: Tue Oct 08, 2019 8:56 am

Stills extraction naming - Time code help

Post 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.
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: Stills extraction naming - Time code help

Post 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.
emcodem, wrapping since 2009 you got the rhyme?
RichD387
Posts: 2
Joined: Tue Oct 08, 2019 8:56 am

Re: Stills extraction naming - Time code help

Post 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.
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: Stills extraction naming - Time code help

Post 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/
emcodem, wrapping since 2009 you got the rhyme?
Post Reply