#1767(FFmpeg:new): 24bit audio in mov is flagged as 16bit in stsd atom
#1767: 24bit audio in mov is flagged as 16bit in stsd atom ----------------------------------+-------------------------------------- Reporter: nichot20 | Type: defect Status: new | Priority: normal Component: FFmpeg | Version: git-master Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | ----------------------------------+-------------------------------------- Summary of the bug: How to reproduce: {{{ ffmpeg -i 1stream-24.mov -c:a copy 1stream-copy.mov ffmpeg version N-44123-g5d55830-by_Tim Copyright (c) 2000-2012 the FFmpeg developers built on Sep 3 2012 11:18:50 with gcc 4.6 (SUSE Linux) configuration: --extra-version=by_Tim --enable-static --disable-shared --enable-gpl --enable-nonfree --enable-version3 --prefix=/mnt/msds- store-0/tim/ffmpeg-tux/usr/local --libdir=/mnt/msds-store-0/tim/ffmpeg- tux/usr/local/lib64 --samples=../fate-suite/ --enable-runtime-cpudetect --extra-cflags='-static -I/mnt/msds-store-0/tim/ffmpeg- tux/usr/local/include' --extra-ldflags='-static -L/mnt/msds-store-0/tim /ffmpeg-tux/usr/local/lib64' --progs-suffix=_Sep-03 --disable-ffserver --enable-libfaac --enable-libfdk-aac --enable-libx264 --enable-libfreetype --disable-ffplay libavutil 51. 70.100 / 51. 70.100 libavcodec 54. 55.100 / 54. 55.100 libavformat 54. 25.104 / 54. 25.104 libavdevice 54. 2.100 / 54. 2.100 libavfilter 3. 15.102 / 3. 15.102 libswscale 2. 1.101 / 2. 1.101 libswresample 0. 15.100 / 0. 15.100 libpostproc 52. 0.100 / 52. 0.100 Guessed Channel Layout for Input Stream #0.0 : mono Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '1stream-24.mov': Metadata: major_brand : qt minor_version : 537199360 compatible_brands: qt creation_time : 2012-09-27 15:53:44 Duration: 00:00:41.44, start: 0.000000, bitrate: 1152 kb/s Stream #0:0(eng): Audio: pcm_s24be (in24 / 0x34326E69), 48000 Hz, mono, s32, 1152 kb/s Metadata: creation_time : 2012-09-27 15:53:44 handler_name : Apple Alias Data Handler Output #0, mov, to '1stream-copy.mov': Metadata: major_brand : qt minor_version : 537199360 compatible_brands: qt encoder : Lavf54.25.104 Stream #0:0(eng): Audio: pcm_s24be (in24 / 0x34326E69), 48000 Hz, mono, 1152 kb/s Metadata: creation_time : 2012-09-27 15:53:44 handler_name : Apple Alias Data Handler Stream mapping: Stream #0:0 -> #0:0 (copy) Press [q] to stop, [?] for help size= 5828kB time=00:00:41.44 bitrate=1152.1kbits/s video:0kB audio:5828kB subtitle:0 global headers:0kB muxing overhead 0.012836% }}} But upon inspection moov->trak->mdia->minf->stbl atom declares that:- "sample size= 16" when it should be "sample size= 24" Same happens if you use {{{ ffmpeg -i 1stream-24.mov -c:a pcm_s24be 1stream-recode.mov }}} -- Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/1767> FFmpeg <http://ffmpeg.org> FFmpeg issue tracker
#1767: 24bit audio in mov is flagged as 16bit in stsd atom ------------------------------------+------------------------------------ Reporter: nichot20 | Owner: Type: defect | Status: new Priority: normal | Component: avformat Version: git-master | Resolution: Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | ------------------------------------+------------------------------------ Changes (by nichot20): * component: FFmpeg => avformat -- Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/1767#comment:1> FFmpeg <http://ffmpeg.org> FFmpeg issue tracker
#1767: 24bit audio in mov is flagged as 16bit in stsd atom ------------------------------------+------------------------------------ Reporter: nichot20 | Owner: Type: defect | Status: new Priority: normal | Component: avformat Version: git-master | Resolution: Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | ------------------------------------+------------------------------------ Comment (by nichot20): Replying to [ticket:1767 nichot20]:
[....]
But upon inspection moov->trak->mdia->minf->stbl atom declares that:- "sample size= 16"
when it should be
"sample size= 24"
Same happens if you use {{{ ffmpeg -i 1stream-24.mov -c:a pcm_s24be 1stream-recode.mov }}}
The problem looks to be in movenc.c around line 654 and on. Basically its either set to 8 or 16 -- Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/1767#comment:2> FFmpeg <http://ffmpeg.org> FFmpeg issue tracker
#1767: 24bit audio in mov is flagged as 16bit in stsd atom ------------------------------------+------------------------------------ Reporter: nichot20 | Owner: Type: defect | Status: new Priority: normal | Component: avformat Version: git-master | Resolution: Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | ------------------------------------+------------------------------------ Comment (by muken): According to qtff.pdf, when a sound sample description is version=1 or 2, sample size field shall be set to 16. So, it is not a bug. The actual sample size is placed more downward. Early sample size field shall be ignored by readers. -- Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/1767#comment:3> FFmpeg <http://ffmpeg.org> FFmpeg issue tracker
#1767: 24bit audio in mov is flagged as 16bit in stsd atom ------------------------------------+------------------------------------ Reporter: nichot20 | Owner: Type: defect | Status: new Priority: normal | Component: avformat Version: git-master | Resolution: Keywords: mov | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | ------------------------------------+------------------------------------ Changes (by cehoyos): * keywords: => mov -- Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/1767#comment:4> FFmpeg <http://ffmpeg.org> FFmpeg issue tracker
#1767: 24bit audio in mov is flagged as 16bit in stsd atom ------------------------------------+------------------------------------ Reporter: nichot20 | Owner: Type: defect | Status: new Priority: normal | Component: avformat Version: git-master | Resolution: Keywords: mov | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | ------------------------------------+------------------------------------ Comment (by nichot20): Replying to [comment:3 muken]:
According to qtff.pdf, when a sound sample description is version=1 or 2, sample size field shall be set to 16. So, it is not a bug. The actual sample size is placed more downward. Early sample size field shall be ignored by readers.
I note that both the original, and stream copied file have stsd version=0, not the 1 or 2 you mention. Looking at the code the value is set based upon the value of AV_CODEC_ID_* when (version != 2) and comparison with the original file shows that Quicktime Pro uses a value of 24. The only other differences to the original file seems to be that QT Pro adds in the extended version info which ffmpeg only adds for version 1 (line 672) -- Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/1767#comment:5> FFmpeg <http://ffmpeg.org> FFmpeg issue tracker
#1767: 24bit audio in mov is flagged as 16bit in stsd atom ------------------------------------+------------------------------------ Reporter: nichot20 | Owner: Type: defect | Status: new Priority: normal | Component: avformat Version: git-master | Resolution: Keywords: mov | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | ------------------------------------+------------------------------------ Comment (by nichot20): Replying to [comment:5 nichot20]:
Replying to [comment:3 muken]:
According to qtff.pdf, when a sound sample description is version=1 or 2, sample size field shall be set to 16. So, it is not a bug. The actual sample size is placed more downward. Early sample size field shall be ignored by readers.
I note that both the original, and stream copied file have stsd version=0, not the 1 or 2 you mention.
Looking at the code the value is set based upon the value of AV_CODEC_ID_* when (version != 2) and comparison with the original file shows that Quicktime Pro uses a value of 24.
The only other differences to the original file seems to be that QT Pro adds in the extended version info which ffmpeg only adds for version 1 (line 672)
I have now managed to obtain a later copy of qtff.pdf dated 2012-08-14. It would appear that the correct behavior is indeed for stsd->sample size to be only either 8 or 16 for ''all'' versions of stsd. '''But''' if the actual sample size is greater than 16 bits, then the version should be changed to version 1 and the "bytes per packet" set to reflect the actual value (pages 178-179). Unfortunately Quicktime Pro 7 does not seem to follow this convention, which misled me. However mov.c is also behaving incorrectly as it is not changing the version from 0 to 1, and adding in the "Sound Description V1 extended info" for bit depths greater than 16 in order to provide the correct value. This can lead to some applications trying to handle the sound as 16 bit. -- Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/1767#comment:6> FFmpeg <http://ffmpeg.org> FFmpeg issue tracker
#1767: 24bit audio in mov is flagged as 16bit in stsd atom ------------------------------------+------------------------------------ Reporter: nichot20 | Owner: Type: defect | Status: closed Priority: normal | Component: avformat Version: git-master | Resolution: fixed Keywords: mov | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | ------------------------------------+------------------------------------ Changes (by cehoyos): * status: new => closed * resolution: => fixed Comment: Fixed by Tim Nicholson. -- Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/1767#comment:7> FFmpeg <http://ffmpeg.org> FFmpeg issue tracker
participants (1)
-
FFmpeg