0

This article describes how you can use ffmpeg to export a frame of a video file as a PNG image using the following command:

ffmpeg.exe -i input.mkv -vf select=gte(n\,360) -vframes 1 output.png

My question is what -vf select=gte(n\,360) really does and how it works. I could not find any documentation on this, neither in the official documentation or elsewhere on the internet.

From the context I know this tells FFmpeg to use the 360th frame, but I would like some further documentation on how to use this. What does gte mean and what is n\,?

0

In

-vf select=gte(n\,360),

-vf declares a video filterchain i.e. a sequence of one or more filters to be applied to the video stream.

The select filter allows the user to keep or discard individual frames, based on the result of the expression presented to it. For each frame, the expression is evaluated. If the result is zero, the frame is discarded, else kept. Here, the expression is gte(n\,360) which checks if the index i.e. presentation serial number, of the current frame is equal to or greater than 360. So, this expr will result in all frames with index 0 to 359 to be discarded, and all frames with a higher index to be selected.

See https://ffmpeg.org/ffmpeg-utils.html#Expression-Evaluation for a list of functions available.

See the docs for the select filter to see the list of variables which can be tested.

Since -vframes 1 is present, ffmpeg will stop after one frame has been received from the select filter.

  • "Expression Evaluation" that was the name I was looking for 😅 – Arete Dec 28 '18 at 15:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.