[FFmpeg-user] Convert audio FLAC to ALAC (apple lossless), 24bits 96kHz

Dagfinn Stangeland jodgipost at gmail.com
Wed Mar 16 11:04:07 CET 2011


I have been able to convert normal (16bits at 44,1kHz) FLAC audiofiles to ALAC
using ffmpeg. Searching around I found this little line that has worked
fine:

for i in *.flac; do ffmpeg -i "$i" -acodec alac -map_meta_data 0:0,s0
> "`basename "$i" .flac`.m4a"; done;
>

The above line converts all flac in a dir to alac and preserves tag info.

I was hoping to use ffmpeg to convert HQ FLAC files (24bits at 96kHz) to ALAC
preserving bitdepth and sampling rate.

Here's the output using the above "script":

FFmpeg version git-2611e52, Copyright (c) 2000-2011 the FFmpeg developers
>   built on Feb  6 2011 10:03:23 with gcc 4.5.2 20110127 (prerelease)
>   configuration: --prefix=/usr --enable-gpl --enable-libmp3lame
> --enable-libvorbis --enable-libfaac --enable-libxvid --enable-libx264
> --enable-libvpx --enable-libtheora --enable-postproc --enable-shared
> --enable-x11grab --enable-libopencore_amrnb --enable-libopencore_amrwb
> --enable-libschroedinger --enable-libopenjpeg --enable-version3
> --enable-nonfree --enable-runtime-cpudetect --disable-debug
>   libavutil    50. 36. 0 / 50. 36. 0
>   libavcore     0. 16. 1 /  0. 16. 1
>   libavcodec   52.108. 0 / 52.108. 0
>   libavformat  52. 94. 0 / 52. 94. 0
>   libavdevice  52.  2. 3 / 52.  2. 3
>   libavfilter   1. 74. 0 /  1. 74. 0
>   libswscale    0. 12. 0 /  0. 12. 0
>   libpostproc  51.  2. 0 / 51.  2. 0
> [flac @ 0xb98510] max_analyze_duration reached
> Input #0, flac, from '1-Nikolai RimskyKorsakov The S.flac':
>   Metadata:
>     ALBUM ARTIST    : Various Artists
>     ARTIST          : Minnesota Orchestra / Eiji Oue
>     ALBUM           : HDtracks Ultimate Download Experience
>     TITLE           : Nikolai Rimsky-Korsakov: The Snow Maiden - Dance of
> the Tumblers
>     track           : 1
>     GENRE           : Classical / Jazz
>     DATE            : 2009
>     HDTRACKS        : www.hdtracks.com
>   Duration: 00:03:54.64, bitrate: 2775 kb/s
>     Stream #0.0: Audio: flac, 96000 Hz, 2 channels, s32
> [ipod @ 0xb997d0] track 0: output format does not support sample rate
> 96000hz
> Output #0, ipod, to '1-Nikolai RimskyKorsakov The S.m4a':
>   Metadata:
>     encoder         : Lavf52.94.0
>     Stream #0.0: Audio: alac, 96000 Hz, 2 channels, s16, 64 kb/s
> Stream mapping:
>   Stream #0.0 -> #0.0
> Could not write header for output file #0 (incorrect codec parameters ?)
>

Is it so that the alac encoder really does not support such a high sample
rate? Or do I need to pass options to ffmpeg to enable this?
I notice that "ipod" is mentioned in the output stream info, I do not
understand the significance.

Sidenote: I'm not aware of any other tools that supports FLAC to ALAC
conversion. If anyone knows of better suited tools, please let me know.

Regards,

Dagfinn Stangeland


More information about the ffmpeg-user mailing list