When preparing a compilation for a rehearsal, after you have decided on one of the audio formats supported by Replayer, you might need convert all those files to the target audio format. Here's how to do that.

Using FFmpeg as converter

FFmpeg is a multi-purpose conversion tool, which is available as packages or binaries on all major operating systems (Windows/Linux/Mac). It does have a CLI (Command Line Interface), which offers all the relevant options for the conversion.

For Windows, download one of the pre-built packages (e.g. the version 4.4 Win64/LGPL/shared variant (ffmpeg-n4.4.4-1-hash-win64-lgpl-shared-4.4.zip) from https://github.com/BtbN/FFmpeg-Builds/releases by BtbN, then unpack it. You will need to extend the Windows PATH variable to include the location of the binary for the FFMPEG library you just downloded.

E.g.

SET PATH=%PATH%;%USERPROFILE%\Downloads\ffmpeg-n4.4.4-1-ga66ee3abd2-win64-lgpl-shared-4.4\ffmpeg-n4.4.4-1-ga66ee3abd2-win64-lgpl-shared-4.4\bin

The following example scripts scans all folders for WAV files, recursively, and converts each file into an MP3 file (or other format), using the compression options given. If you have another source file format just replace the search filter with the matching extension.

In the scripts, you can manually enable the compression variant(s) that best fit your playback scenario.

Windows (cmd) script, for WAV to MP3

echo off
rem Convert all .wav files in this and all sub directories to .mp3
rem See https://trac.ffmpeg.org/wiki/Encode/MP3 for bitrate options
rem Enable the bitrate(s) that suits your need
rem Optional: Delete .wav files after conversion
rem NOTE: The Windows PATH variable must include the binary for the FFMPEG library
FOR %%s in (*.wav) DO (
  echo echo %%~ns
  ffmpeg -i %%s -b:a 320k "%%~ns-320k-CBR.mp3"
  ffmpeg -i %%s -q:a 0 "%%~ns-220-260k-VBR.mp3"
  ffmpeg -i %%s -q:a 6 "%%~ns-100-130k-VBR.mp3"
  ffmpeg -i %%s -q:a 9 "%%~ns-45-85k-VBR.mp3"    
  rem -i - input file
  rem -b:a - Target audio bitrate. See ffmpeg docs for details
  rem -q:a - Target quality. See ffmpeg docs for details
  rem uncomment the next line to delete .wav after conversion.
  rem del %%s;  
)
rem done.

Listing: Windows command line (cmd) script for bulk converting WAV files to MP3 files

Windows (cmd) script, for WAV to AAC (.m4a)

echo off
rem Convert all .wav files in this and all sub directories to AAC (.m4a)
rem See https://trac.ffmpeg.org/wiki/Encode/AAC for bitrate options
rem Enable the bitrate(s) that suits your need
rem Optional: Delete .wav files after conversion
rem NOTE: The Windows PATH variable must include the binary for the FFMPEG library
FOR %%s in (*.wav) DO (
  echo echo %%~ns
  ffmpeg -i %%s -c:a aac -b:a 320k "%%~ns-320k-CBR.m4a"
  ffmpeg -i %%s -c:a aac -q:a 0 "%%~ns-220-260k-VBR.m4a"
  ffmpeg -i %%s -c:a aac -q:a 6 "%%~ns-100-130k-VBR.m4a"
  ffmpeg -i %%s -c:a aac -q:a 9 "%%~ns-45-85k-VBR.m4a"    
  rem -i - input file
  rem -b:a - Target audio bitrate. See ffmpeg docs for details
  rem -q:a - Target quality. See ffmpeg docs for details
  rem uncomment the next line to delete .wav after conversion.
  rem del %%s;  
)
rem done.

Listing: Windows command line (cmd) script for bulk converting WAV files to AAC files

Previous Post Next Post