talha131/bmtool

Batch convert audio files

Closed this issue · 0 comments

See code here

https://github.com/talha131/bm-utilities/blob/f8bbbd2726de8dd4390b4376dd2311ccbbe1213a/bm_convert_audio/bm_convert_audio.go#L22-L27

If file is audio, then convertFile method is immediately called. If you have 1000 files, convertFile will be called 1000 times. It is not necessary, because ffmpeg has support for multiple inputs and multiple outputs.

For example, this command converts two files.

ffmpeg -i "2017-12-15 130550.mp3" -i "2018-01-19 131624.mp3" -map 0:0 -ac 1 -ab 64k -ar 44100 "2017-12-15 130550.wav" -map 1:0 -ac 1 -ab 64k -ar 44100 "2018-01-19 131624.wav"

Or

ffmpeg -i "2017-12-15 130550.mp3" -i "2018-01-19 131624.mp3" -ac 1 -ab 64k -ar 44100  -map 0:0  "2017-12-15 130550.wav" -map 1:0  "2018-01-19 131624.wav"

This converts files simultaneously.

Documentation:

  1. https://trac.ffmpeg.org/wiki/Creating%20multiple%20outputs
  2. https://trac.ffmpeg.org/wiki/Map