Batch extracting frames from multiple videos

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Batch extracting frames from multiple videos

Joseph Zaki
Hi everyone,

I'm new to ffmpeg and having some issues batching a process. I have several
dozen videos that I need to extract images every 2 seconds from.

I tried this script: for %%a in ("*.mp4") do ffmpeg -i %%a -vf fps=2
"%%~na.%%06d.png

But kept getting an error: Output file is empty, nothing was encoded (check
-ss / -t / -frames parameters if used)

Can anyone point me in the right direction on how to fix this?

Cheers,
JZ
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Batch extracting frames from multiple videos

JackDesBwa
It seems to be Windows batch, so I personally cannot help a lot here, but I
can give some indications.
You probably can (as I usually do to check my own scripts before execution)
replace the ffmpeg command by echo (or equivalent in windows) to check if
the generated command arguments are exactly what you want and correct in
consequence.
Also, notice that fps=2 gives two images per seconds. One image every 2
seconds is fps=0.5

ffmpeg -i countdown.mp4 -vf fps=0.5 countdown-%06d.png works as you would
expect on my Linux machine, so it is probably an error in variable
manipulation in batch script, with which I am not competent to help.

JackDesBwa

Le mar. 17 sept. 2019 à 12:22, Joseph Zaki <[hidden email]> a écrit :

> Hi everyone,
>
> I'm new to ffmpeg and having some issues batching a process. I have several
> dozen videos that I need to extract images every 2 seconds from.
>
> I tried this script: for %%a in ("*.mp4") do ffmpeg -i %%a -vf fps=2
> "%%~na.%%06d.png
>
> But kept getting an error: Output file is empty, nothing was encoded (check
> -ss / -t / -frames parameters if used)
>
> Can anyone point me in the right direction on how to fix this?
>
> Cheers,
> JZ
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Batch extracting frames from multiple videos

Joseph Zaki
Thanks JackDesBwa. Yes I'm on a windows box, but of curiosity, how would
you go about batch converting multiple .mp4 files on linux?




On Tue, Sep 17, 2019, 3:58 AM JackDesBwa <[hidden email] wrote:

> It seems to be Windows batch, so I personally cannot help a lot here, but I
> can give some indications.
> You probably can (as I usually do to check my own scripts before execution)
> replace the ffmpeg command by echo (or equivalent in windows) to check if
> the generated command arguments are exactly what you want and correct in
> consequence.
> Also, notice that fps=2 gives two images per seconds. One image every 2
> seconds is fps=0.5
>
> ffmpeg -i countdown.mp4 -vf fps=0.5 countdown-%06d.png works as you would
> expect on my Linux machine, so it is probably an error in variable
> manipulation in batch script, with which I am not competent to help.
>
> JackDesBwa
>
> Le mar. 17 sept. 2019 à 12:22, Joseph Zaki <[hidden email]> a écrit :
>
> > Hi everyone,
> >
> > I'm new to ffmpeg and having some issues batching a process. I have
> several
> > dozen videos that I need to extract images every 2 seconds from.
> >
> > I tried this script: for %%a in ("*.mp4") do ffmpeg -i %%a -vf fps=2
> > "%%~na.%%06d.png
> >
> > But kept getting an error: Output file is empty, nothing was encoded
> (check
> > -ss / -t / -frames parameters if used)
> >
> > Can anyone point me in the right direction on how to fix this?
> >
> > Cheers,
> > JZ
> > _______________________________________________
> > ffmpeg-user mailing list
> > [hidden email]
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-user
> >
> > To unsubscribe, visit link above, or email
> > [hidden email] with subject "unsubscribe".
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Batch extracting frames from multiple videos

JackDesBwa
> Thanks JackDesBwa.
>

Does it mean that you found your error with the "echo" technique?

of curiosity, how would you go about batch converting multiple .mp4 files
> on linux?
>

For basic cases, like all files are in the same directory, I would do
something similar to what you did: let the shell interpretor list the
files, iterate on them and build the command line by substituting parts
with loop variable. I would probably add quotes to prevent from files with
space to break the command and a "basename" subcommand to remove the
extension of the iteration name.

For more complex cases, it is to study case by case, but I would probably
start by listing the file paths in a text file and iterate on the lines to
apply similar technique.

JackDesBwa
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".