[FFmpeg-user] Bash Script for Batch Converting Audio in MKVs to FLAC

Moritz Barsnick barsnick at gmx.net
Sun Oct 21 00:26:29 EEST 2018

On Sat, Oct 20, 2018 at 14:09:07 -0400, Joshua Blagden wrote:
> Here's an example of one of those commands: ffmpeg -i '01x12 - The
> Flax.mkv' -c:v copy -c:s copy -c:a flac '01x12 - The Flax(flac).mkv'
> I just want to convert the audio track to FLAC and then add "(flac) to
> the file name so I can hang onto the originals temporarily to make sure
> everything went well or that I didn't miss some other conversion I had
> to do.

That's more of a shell scripting question than an ffmpeg question, but
here we go, using a subdirectory for the results (so they don't mix
with the originals):

$ mkdir flac
$ for infile in *.mkv; do outfile=flac/${infile%.mkv}'(flac)'.mkv; echo ffmpeg -i "$infile" -c:v copy -c:s copy -c:a flac "$outfile"; done



More information about the ffmpeg-user mailing list