Opened 2 years ago

Last modified 17 months ago

#9594 open enhancement

alac encoder does no support 20bits depth

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

Description

Summary of the bug:
alac decoder support 20 bits bit depth, but encoder does not.
seems fixed bit depth in code of encoder.
libavcodec\alacenc.c
---

if (avctx->sample_fmt == AV_SAMPLE_FMT_S32P) {

if (avctx->bits_per_raw_sample != 24)

av_log(avctx, AV_LOG_WARNING, "encoding as 24 bits-per-sample\n");

avctx->bits_per_raw_sample = 24;

} else {

avctx->bits_per_raw_sample = 16;
s->extra_bits = 0;

}

---
How to reproduce:

C:\Data\ffmpeg.exe  -i 009.caf -codec alac 009.m4a
ffmpeg version n4.4.1-14-g5a7763bdfa-20220108 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 11.2.0 (crosstool-NG 1.24.0.498_5075e1f)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-nonfree --enable-gpl --enable-version3 --disable-debug --enable-shared --disable-static --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-avisynth --enable-libdav1d --enable-libdavs2 --enable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --disable-frei0r --enable-libgme --enable-libass --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librist --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --disable-vaapi --enable-libvidstab --disable-vulkan --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-version=20220108
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Input #0, caf, from '009.caf':
  Duration: 00:01:35.02, start: 0.000000, bitrate: 793 kb/s
  Stream #0:0: Audio: alac (alac / 0x63616C61), 44100 Hz, stereo, s32p (20 bit), 705 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (alac (native) -> alac (native))
Press [q] to stop, [?] for help
[alac @ 000002e1e6d4f000] encoding as 24 bits-per-sample
Output #0, ipod, to '009.m4a':
  Metadata:
    encoder         : Lavf58.76.100
  Stream #0:0: Audio: alac (alac / 0x63616C61), 44100 Hz, stereo, s32p (24 bit), 128 kb/s
    Metadata:
      encoder         : Lavc58.134.100 alac
size=   13663kB time=00:01:34.92 bitrate=1179.2kbits/s speed= 162x
video:0kB audio:13658kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.035743%

Attachments (1)

009.caf (1.9 MB ) - added by Michael 2 years ago.
009.caf

Download all attachments as: .zip

Change History (5)

by Michael, 2 years ago

Attachment: 009.caf added

009.caf

comment:1 by Michael, 2 years ago

Cc: Michael added
Version: unspecified4.4.1

comment:2 by Balling, 2 years ago

LOL, actually 24 bit LAC in HW is not supported without this patch of mine (author is Davis). https://patchwork.ffmpeg.org/project/ffmpeg/patch/20210531150302.359628-1-val.zapod.vz@gmail.com/

in reply to:  2 comment:3 by Michael, 2 years ago

Replying to Balling:
thank you Balling, but how to solve 20 bits problem?

LOL, actually 24 bit LAC in HW is not supported without this patch of mine (author is Davis). https://patchwork.ffmpeg.org/project/ffmpeg/patch/20210531150302.359628-1-val.zapod.vz@gmail.com/

comment:4 by Carl Eugen Hoyos, 17 months ago

Keywords: alac added
Priority: normalwish
Reproduced by developer: set
Status: newopen
Type: defectenhancement
Version: 4.4.3git-master
Note: See TracTickets for help on using tickets.