[FFmpeg-trac] #9911(avcodec:open): block align not set

FFmpeg trac at avcodec.org
Mon Sep 12 19:41:42 EEST 2022


#9911: block align not set
------------------------------------+-----------------------------------
             Reporter:  Mia Sia     |                    Owner:  (none)
                 Type:  defect      |                   Status:  open
             Priority:  normal      |                Component:  avcodec
              Version:  git-master  |               Resolution:
             Keywords:  AIFF        |               Blocked By:
             Blocking:              |  Reproduced by developer:  0
Analyzed by developer:  0           |
------------------------------------+-----------------------------------
Changes (by Mia Sia):

 * cc: Mia Sia (added)


Old description:

> Summary of the bug:
>
> libavcodec/utils.c
> In "av_get_exact_bits_per_sample" function,
>
> case AV_CODEC_ID_ADPCM_G722
> ...
>     return 4;
>
> and
>
> libavformat/aiffdec.c
> In "get_aiff_header" function,
>
> if (!par->block_align)
>     par->block_align = (av_get_bits_per_sample(par->codec_id) * channels)
> >> 3
>
> which output 0, causes
>
> C:\Users\user\Downloads>ffmpeg -i in.wav -c:a g722 out.afc -hide_banner
> Guessed Channel Layout for Input Stream #0.0 : stereo
> Input #0, wav, from 'in.wav':
>   Metadata:
>     encoder         : Lavf59.23.100
>   Duration: 00:00:10.00, bitrate: 1536 kb/s
>   Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz,
> stereo, s16, 1536 kb/s
> Stream mapping:
>   Stream #0:0 -> #0:0 (pcm_s16le (native) -> adpcm_g722 (g722))
> Press [q] to stop, [?] for help
> [aiff @ 00000229e62ef440] block align not set
> Could not write header for output file #0 (incorrect codec parameters ?):
> Invalid argument
> Error initializing output stream 0:0 --
> Conversion failed!

New description:

 Summary of the bug:

 libavcodec/utils.c
 In "av_get_exact_bits_per_sample" function,

 case AV_CODEC_ID_ADPCM_G722
 ...
     return 4;

 and

 libavformat/aiffdec.c
 In "get_aiff_header" function,

 if (!par->block_align)
     par->block_align = (av_get_bits_per_sample(par->codec_id) * channels)
 >> 3

 which output 0, causes

 ~/downloads ffmpeg -i in.wav -c:a g722 out.fc
 ffmpeg version 5.1.1 Copyright (c) 2000-2022 the FFmpeg developers
   built with Apple clang version 13.1.6 (clang-1316.0.21.2.5)
   configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/5.1.1 --enable-
 shared --enable-pthreads --enable-version3 --cc=clang --host-cflags=
 --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-
 libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-
 libopus --enable-librav1e --enable-librist --enable-librubberband
 --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-
 libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis
 --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265
 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig
 --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-
 amrnb --enable-libopencore-amtwb --enable-libopenjpeg --enable-libspeex
 --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack
 --disable-indev=jack --enable-videotoolbox --enable-neon
   libavutil      57. 28.100 / 57. 28.100
   libavcodec     59. 37.100 / 59. 37.100
   libavformat    59. 27.100 / 59. 27.100
   libavdevice    59.  7.100 / 59.  7.100
   libavfilter     8. 44.100 /  8. 44.100
   libswscale      6.  7.100 /  6.  7.100
   libswresample   4.  7.100 /  4.  7.100
   libpostproc    56.  6.100 / 56.  6.100
 Guessed Channel Layout for Input Stream #0.0 : stereo
 Input #0, wav, from 'in.wav':
   Metadata:
     encoder         : Lavf59.16.100
   Duration: 00:00:20.00, bitrate: 1411 kb/s
   Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo,
 s16, 1411 kb/s
 Stream mapping:
   Stream #0:0 -> #0:0 (pcm_s16le (native) -> adpcm_g722 (g722))
 Press [q] to stop, [?] for help
 [aiff @ 0x12df052e0] block align not set
 Could not write header for output file #0 (incorrect codec parameters ?):
 Invalid argument
 Error initializing output stream 0:0 --
 Conversion failed!

--
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/9911#comment:5>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list