On Sat, 27 Jan 2018 18:26:48 -0500
Todd Zullinger <t...@pobox.com> wrote:

> Samuel Sieb wrote:
> > Close, but that will give you output files like filename.m4a.mp3.
> > 
> > for f in *.m4a; do ffmpeg -i "$f" "${f%.m4a}.mp3"; done  
> 
> You can also use "${f/%m4a/mp3}" in bash and zsh (and
> possibly other shells, but I'm not familiar with pattern
> substitution in others).  The % at the beginning of the
> pattern achors the match to the end of the string.
> 
> (Not that it's important; I just like playing shell golf. :)
> 

Batch mode encoding all sorts of video and audio files in a folder, no
matter what sort (avi, wav, mp4, wav, au etc. ) to  mp3, with a single
command:

for f in *.*; do ffmpeg -i "$f" -codec:a libmp3lame -qscale:a 0 
"${f/%.*/.mp3}"; done

Caveats, notes: 
Tests were done in zsh and bash (system shell seems bash; zsh was
entered  with a simple 'zsh' at a bash prompt)

If input file names are identical before the suffixes (like
example.avi and example.wav) ffmpeg, while encoding, will ask whether to
overwrite the first example.mp3 it made. Should be doable by simply
renaming these input files ... or by writing better code than I
did .. ;)

I haven't done tests with input files with spaces in their names ...
so: careful!

I only do scripting casually; i.e. when I need it. I'm not a pro in
that. So if someone knows how to optimize the snippet: welcome ... ;)

Thanks to everyone in this thread. It helped lots. ... ;)

Wolfgang
_______________________________________________
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org

Reply via email to