[FFmpeg-trac] #6216(avcodec:closed): TrueHD encoder creates non bitexact files
FFmpeg
trac at avcodec.org
Wed Sep 1 06:50:34 EEST 2021
#6216: TrueHD encoder creates non bitexact files
------------------------------------+-----------------------------------
Reporter: James | Owner: (none)
Type: defect | Status: closed
Priority: normal | Component: avcodec
Version: git-master | Resolution: fixed
Keywords: thd | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
------------------------------------+-----------------------------------
Changes (by Balling):
* status: open => closed
* resolution: => fixed
Comment:
This is now fixed in 9f420163c6207b9c54badd30056974a6b3450bfd. MLP
bitstream reencode will not be bitperfect (amount of frames is now the
same), since shorten_by will be present now in bitstream (cannot be seen
in mediainfo, alas) after the commit, but old 16 bit in 24 package THD
will be reencoded losslessly (after decoding to wav both before and new
reencoded from that old mlp file after that commit will produce the same
bit-per-bit perfect wav). I did not test -c:a pcm_s24le in full, but at
least on my sample it also produces bit perfect result.
There is no 24/16 bit metadata in 0xba type (only in 0xbb), so as
mentioned by madshi above and now by mediainfo main dev:
https://github.com/MediaArea/MediaInfoLib/issues/1102#issuecomment-908614414
this cannot be and should not be fixed, because it is very much possible
to have 16 bit sound in 24 bit and yet some sequences of frames will have
out of 16-bit content. Of course, 20 bit in 24 bit encoding should be
done, but that will require implementing AV_SAMPLE_FMT_S20 (flac also
want to use it and alac and what not).
This sample is now bitperfect and this means it cannot be considered
-strict -2 anymore and 30 bit full support should be activated, even if
it may be not perfect yet:
{{{
PS C:\Users\xxxx> L:\5777\ffmpeg\bin\ffmpeg -i
C:\Users\xxxx\csdncvsdenvsw.thd -f md5 -
ffmpeg version N-103469-g034133a0df-20210901 Copyright (c) 2000-2021 the
FFmpeg developers
built with gcc 10-win32 (GCC) 20210408
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-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 --enable-libvmaf --enable-vulkan
--disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-
avisynth --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac
--enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libglslang
--enable-libgme --enable-libass --enable-libbluray --enable-libmp3lame
--enable-libopus --enable-libtheora --enable-libvpx --enable-libwebp
--enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-
libopencore-amrwb --enable-libopenjpeg --enable-librav1e --enable-
librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-
libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d
--disable-libdrm --disable-vaapi --enable-libvidstab --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=20210901
libavutil 57. 4.101 / 57. 4.101
libavcodec 59. 6.100 / 59. 6.100
libavformat 59. 4.102 / 59. 4.102
libavdevice 59. 0.101 / 59. 0.101
libavfilter 8. 7.100 / 8. 7.100
libswscale 6. 0.100 / 6. 0.100
libswresample 4. 0.100 / 4. 0.100
libpostproc 56. 0.100 / 56. 0.100
Input #0, truehd, from 'C:\Users\xxxx\csdncvsdenvsw.thd':
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Audio: truehd, 44100 Hz, stereo, s32 (24 bit)
Stream mapping:
Stream #0:0 -> #0:0 (truehd (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, md5, to 'pipe:':
Metadata:
encoder : Lavf59.4.102
Stream #0:0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
Metadata:
encoder : Lavc59.6.100 pcm_s16le
MD5='''d886c9feaf7dddcdff3a5adcfa4c57bc'''rate= 0.0kbits/s speed=N/A
size= 0kB time=00:00:02.00 bitrate= 0.1kbits/s speed= 91x
video:0kB audio:348kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: unknown
}}}
Moreover since -f md5 defaults to -c:a pcm_s16le, I also tested
ffmpeg -i truehd.wav -c:a pcm_s24le -f md5 -
ffmpeg -i truehd.thd -c:a pcm_s24le -f md5 -
Which both gave 4ded2127735c325bc2364a1c2e311f1d.
Congrats to Elon Mask for implementing this!
--
Ticket URL: <https://trac.ffmpeg.org/ticket/6216#comment:7>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list