Opened 6 years ago

Closed 5 years ago

#2768 closed defect (fixed)

ALAC encoder is not lossless with 24-bit samples

Reported by: pneuman Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: alac
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Hi,

When converting 24-bit audio to ALAC using ffmpeg git, the output is not lossless. Examining the decoded ALAC alongside the source file in Audacity shows that the ALAC is phase inverted; mixing the ALAC and the source together reveals some smaller errors, too.

I've tried with a few 24-bit files, and had the same happen in each case. As an example, this file (a 24-bit FLAC of audio from the Musopen project, in the public domain) exhibits the problem:

http://wootangent.net/~lsd/blah/figaro.flac

Encoder command line, output, and CRC comparisons with the source are as follows:

lsd@cletus:~/projects/alac/ffmpeg$ ./ffmpeg -i figaro.flac -acodec alac -f ipod figaro.m4a
ffmpeg version N-54600-g09f59d6 Copyright (c) 2000-2013 the FFmpeg developers
  built on Jul 10 2013 10:15:49 with gcc 4.7 (Ubuntu/Linaro 4.7.2-2ubuntu1)
  configuration: 
  libavutil      52. 38.100 / 52. 38.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 12.100 / 55. 12.100
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 79.101 /  3. 79.101
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
Input #0, flac, from 'figaro.flac':
  Metadata:
    MAJOR_BRAND     : M4A 
    MINOR_VERSION   : 0
    COMPATIBLE_BRANDS: M4A mp42isom
    CREATION_TIME   : 1904-01-22 23:03:39
    COMPOSER        : Wolfgang Amadeus Mozart
    GENRE           : Classical
    ARTIST          : Czech National Symphony Orchestra
    album_artist    : Czech National Symphony Orchestra
    ALBUM           : Musopen Kickstarter Project
    ENCODER         : Lavf54.20.0
  Duration: 00:04:01.00, bitrate: 1462 kb/s
    Stream #0:0: Audio: flac, 48000 Hz, stereo, s32
Output #0, ipod, to 'figaro.m4a':
  Metadata:
    MAJOR_BRAND     : M4A 
    MINOR_VERSION   : 0
    COMPATIBLE_BRANDS: M4A mp42isom
    ALBUM           : Musopen Kickstarter Project
    COMPOSER        : Wolfgang Amadeus Mozart
    GENRE           : Classical
    ARTIST          : Czech National Symphony Orchestra
    album_artist    : Czech National Symphony Orchestra
    encoder         : Lavf55.12.100
    Stream #0:0: Audio: alac (alac / 0x63616C61), 48000 Hz, stereo, s32p, 128 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (flac -> alac)
Press [q] to stop, [?] for help
size=   44225kB time=00:04:01.06 bitrate=1502.9kbits/s    
video:0kB audio:44213kB subtitle:0 global headers:0kB muxing overhead 0.028529%
lsd@cletus:~/projects/alac/ffmpeg$ ./ffmpeg -i figaro.flac -f crc - 2>/dev/null
CRC=0xe162a58b
lsd@cletus:~/projects/alac/ffmpeg$ ./ffmpeg -i figaro.m4a -f crc - 2>/dev/null
CRC=0x40b1090b

Change History (2)

comment:1 Changed 6 years ago by cehoyos

  • Reproduced by developer set
  • Status changed from new to open

Workaround is to use -compression_level 0
tiny_psnr reports a MAXDIFF of 1 for s16 and 1020 for f32.

comment:2 Changed 5 years ago by cehoyos

  • Resolution set to fixed
  • Status changed from open to closed

Fixed by Christophe Gisquet in 96d21783

Note: See TracTickets for help on using tickets.