Converting FLAC audio files: Difference between revisions

From Littledamien Wiki
Jump to navigation Jump to search
Tag: wikieditor
Tag: wikieditor
Line 32: Line 32:


<pre>
<pre>
$ for i in *.flac; do ffmpeg -i "$i" -c:a libfdk_aac -vbr 3 -c:v copy "${i%.*}.m4a"; done
# using mac os's built-in aac library
$ for i in *.flac; do ffmpeg -i "$i" -c:a aac_at -vbr 3 -c:v copy "${i%.*}.m4a"; done
# using libfdk_aac
$ for i in *.flac; do ffmpeg -i "$i" -c:a libfdk_aac -vbr 3 -c:v copy "${i%.*}.m4a"; done
</pre>
</pre>



Revision as of 13:24, 4 November 2023

Mac OS

Recommended software:

ffmpeg

This is a command line utility which relies on the libfdk_aac library, which is a separate install. See troubleshooting.

AAC encoding documentation

Variable bit rate AAC files seem to come out smaller in size than constant bit rate files.

Constant bit rate

With AAC, 128k is supposedly indistinguishable from CD quality.

$ ffmpeg -i input.flac -c:a libfdk_aac -b:a 128k output.m4a

Variable bit rate

A variable bit rate setting of 3 is supposedly indistinguishable from CD quality.

$ ffmpeg -i input.flac -c:a libfdk_aac -vbr 3 output.m4a

Batch conversion

Wrap the ffmpeg command in a loop:

# using mac os's built-in aac library
$ for i in *.flac; do ffmpeg -i "$i" -c:a aac_at -vbr 3 -c:v copy "${i%.*}.m4a"; done
# using libfdk_aac
$ for i in *.flac; do ffmpeg -i "$i" -c:a libfdk_aac -vbr 3 -c:v copy "${i%.*}.m4a"; done

Troubleshooting

"Could not find tag for codec h264 in stream #0"

AAC output files are 0 bytes after an error to the effect of Could not find tag for codec h264 in stream #0.

Adding -c:v copy as a parameter to the ffmpeg command fixed this.

"Unknown encoder 'libfdk_aac'" with Mac OS

Use Mac OS's built in codec (aac_at) instead:

$ ffmpeg -i input.flac -c:a aac_at -vbr 3 output.m4a

Audacity

  • File > Chains > Apply Chain
  • Select MP3 Conversion
  • Click Apply to Files... button
  • Navigate to directory containing FLAC files.
  • Select FLAC files to convert.
  • Conversion process will start automatically (default conversion rate is 320kps)
  • mp3 files are deposited in a directory in the source directory named cleaned

Other software options

  • XLD - (X Lossless Decoder) This gets mentioned and recommended a lot
  • xACT (does converting and splitting)
  • dBpoweramp
  • ffmpeg (command line)

Windows

  • AVS Audio Converter
  • Drag the .flac files into the files pane.
  • Settings
    • Codec: mp3
    • Channels: stereo
    • Bitrate: 192kps
    • Sample Rate: 44100 Hz
    • Sample Size: 16 bit