Converting FLAC audio files: Difference between revisions

From Littledamien Wiki
Jump to navigation Jump to search
Tag: wikieditor
 
(4 intermediate revisions by the same user not shown)
Line 5: Line 5:
=== ffmpeg ===
=== ffmpeg ===


This is a command line utility which relies on the `libfdk_aac` library, which is a separate install.
This is a command line utility which relies on the `libfdk_aac` library, which is a separate install. See [[#Troubleshooting|troubleshooting]].


[https://trac.ffmpeg.org/wiki/Encode/AAC AAC encoding documentation]
[https://trac.ffmpeg.org/wiki/Encode/AAC AAC encoding documentation]
<p class="alert alert-info">I was getting errors where the output AAC files would be 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.</p>


Variable bit rate AAC files seem to come out smaller in size than constant bit rate files.
Variable bit rate AAC files seem to come out smaller in size than constant bit rate files.
Line 33: Line 31:
Wrap the `ffmpeg` command in a loop:
Wrap the `ffmpeg` command in a loop:


<pre>
<syntaxhighlight lang="bash">
$ 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
</pre>
$ 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
</syntaxhighlight>
 
==== 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:
 
<syntaxhighlight lang="bash">
$ ffmpeg -i input.flac -c:a aac_at -vbr 3 output.m4a
</syntaxhighlight>
 
===== Message that variable bitrate not supported =====
 
Running `ffmpeg` with `libfdx_aac` results in the following warning: <pre>Note, the VBR setting is unsupported and only works with some parameter combinations</pre>
 
Use Mac OS's built in codec (`aac_at`) instead:
 
<syntaxhighlight lang="bash">
$ ffmpeg -i input.flac -c:a aac_at -vbr 3 output.m4a
</syntaxhighlight>


=== Audacity ===
=== Audacity ===

Latest revision as of 13:28, 4 November 2023

Mac OS[edit]

Recommended software:

ffmpeg[edit]

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[edit]

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[edit]

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[edit]

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[edit]

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

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[edit]

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

$ ffmpeg -i input.flac -c:a aac_at -vbr 3 output.m4a
Message that variable bitrate not supported[edit]

Running ffmpeg with libfdx_aac results in the following warning:

Note, the VBR setting is unsupported and only works with some parameter combinations

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

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

Audacity[edit]

  • 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[edit]

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

Windows[edit]

  • 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