Re: how to convert a ma4 file to other format??

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 27 Jan 2018 18:26:48 -0500
Todd Zullinger <tmz@xxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux