geo-freak
geo-freak

Reputation: 367

Extract the 0th frame of every second on a live video

I have a command to extract the zero-th frame of every second. I got the command from here.

ffmpeg -i input.ts -vf "select=between(mod(n\, 25)\, 0\, 0), setpts=N/24/TB" output-%04d.png

But when I run the above command on live feed, it is extracting more than 100000 frames. The above command is not working on a live recording. Can anyone suggest or help me to extract the very first frame on a live recording? Thanks in advance.

P.S: For my testing I am running the above command on a tcr video.

Upvotes: 1

Views: 1212

Answers (1)

Gyan
Gyan

Reputation: 93369

Use

ffmpeg -i input.ts -vf "select='if(eq(n\,0),1,floor(t)-floor(prev_selected_t))'" -vsync 0 output-%04d.png

This will output the first frame of each second, if it exists.

Upvotes: 2

Related Questions