Reputation: 357
I am trying to extract the first frame of a second from a video. I have tried different ways to achieve this, but I failed. Here the commands I tried.
ffmpeg -i input.ts -s 400x222 -q:v 3 -start_number 0 -vf fps=1 %d.jpg
Later, I am trying to extract the frames again using the below command of that particular second. Here I'm extracting the frames of 210th second.
ffmpeg -ss 210 -i input.ts -s 300x250 -t 1 -start_number 0 images.%d.jpg
I want to extract only the starting frame of the second. Let's say from 0.001 of that particular second.
When I compare the frame of 210 second extracted by my first command with the first frame extracted by second command are completely different.
For the later use, to prevent the conflicts I want to extract only the very first frame of the original input video. I tried using the command which was told by stackoverflow experts in the past here. But when I run it. It is only extracting the starting frame(only 1 frame).
How can I extract the very starting frame of the video per every second?
Upvotes: 2
Views: 4086
Reputation: 372
try this command :
ffmpeg -i input.mp4 -vf "select=between(mod(n\, 25)\, 0\, 0), setpts=N/24/TB" output-%04d.png
you have to pass your video framerate or fps
in between(mod(n\, 25)\, 0\, 0)
my video fps is 25
so i pass 25
if your fps 60 then you have to pass 60 in between(mod(n\, 60)\, 0\, 0)
also if you want 1st 5 frames of every second then use between(mod(n\, 25)\, 0\, 4)
it will give your 1st 5 frames of every second.
Upvotes: 2