[FFmpeg-user] How to restrict ffprobe output to a certain number of frames?

Torsten Kaiser info at linux-rebellen.de
Sun Oct 29 23:06:29 EET 2023


On 29.10.23 20:28, Ulf Zibis wrote:
> Hi,
>
> when I use
> ffprobe -show_frames INPUT
> I get all frames.
> But I only want some frames e.g. the first 10 or frame 100 to 109.

ffprobe doesn't seem to provide anything like -ss -t or -frames. So I 
assume it always probes the whole thing.

I would suggest you cut the desired frames you need for probing to a 
temporary snippet.

In Korn this would look like this:

#EXAMPLE VALUES

SOURCE="Source.mp4"

START="10.00" #for 25fps frame-precise with a 0.01 seconds resolution

FRAMES="10" # for cutting  ten frames beginning with the one at 10.00 
seconds

PREVIEW="TEST.mp4"

# COMMANDS

ffmpeg -y -ss $START -i $SOURCE  -frames $FRAMES $PREVIEW # generate 
test clip

ffprobe -show_frames 
$PREVIEW                                                #probing the preview

rm $PREVIEW #to tidy up

in Korn I can catenate these lines with "&&" to a single line, so that 
following commands only get executed if their predecessor(s) didn't fail.

Hope it's readable enough to translate it to your preferred coding 
language.




More information about the ffmpeg-user mailing list