Question

Is it possible to set the -ss and -t flags in FFMPEG in frames?

I am building a simple video trimmer in PHP with FFMPEG and have been using PHP-FFMPEG to extract screen grabs etc and it works entirely in frames. Also my script requires that I add and subtract variable amounts of time to the start and end of the vid which is so much easier to do in FPS. PHP-FFMPEG tells me the fps of the vid, so I can accurately pinpoint frames as required.

Alternatively does anyone know of a nice little script for converting frames to HH:MM:SS.xx format at all? I can just use that instead. My Google attempts have been fruitless so far, and my attempt at it has got me rather stressed.

Was it helpful?

Solution

You don't need to convert to HH:MM:SS.xx format.

The -t and -ss flags for FFmpeg accept the number of seconds (including decimal) as well as HH:MM:SS.xx format. From the docs:

-ss position (input/output)
When used as an input option (before -i), seeks in this input file to position. When used as an output option (before an output filename), decodes but discards input until the timestamps reach position. This is slower, but more accurate.

position may be either in seconds or in hh:mm:ss[.xxx] form.

So just do frames/frames per second and you've got your input.

OTHER TIPS

I don't know about -ss but you can use -vframes instead of -t to specify exact number of video frames.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top