[FFmpeg-user] ffmpeg whole directory file conversion question
Carl Zwanzig
cpz at tuunq.com
Fri Mar 1 07:36:06 EET 2019
On 2/28/2019 5:12 PM, Ashley Smiley wrote:
> If I use the code you sent:
> for f in *.mp4; do ffmpeg -i "$f" "$f_%03d.png"; done
>
> what I get is:
> 001.png
> 002.png
Try this--
for f in *.mp4; do ffmpeg -i "$f" "${f}_%03d.png"; done
(assuming bash shell)
without the {}, the second $f disappears because the underscore is
considered part of the variable name, i.e. variable "f_". If you used a
different separator character, this won't happen. (Always surround a var
name with {} when its used inside a string.)
The " also aren't needed unless there are spaces in the file names.
However.... you'll get filenames formed from "Sign_Off_clean.mp4_%03d.png"
with the ".mp4" in them.
If there aren't any spaces in the file names--
for f in `ls *.mp4 | sed -e 's/.mp4//'`; do ffmpeg -i "$f"
"${f}_%03d.png"; done
ought do Do The Right Thing.
Past that, it's a shell scripting problem, not an ffmpeg one.
(please don't top-post on this list)
Later,
z!
More information about the ffmpeg-user
mailing list