Opened 6 months ago

Last modified 4 months ago

#9911 open defect

block align not set

Reported by: Mia Sia Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: AIF g722
Cc: Mia Sia Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by Mia Sia)

Summary of the bug:

In "av_get_exact_bits_per_sample" function,


return 4;


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.
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':


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!

Change History (6)

comment:1 by Carl Eugen Hoyos, 6 months ago

Component: ffmpegundetermined

Please provide the command line you tested together with the complete, uncut console output to make this a valid ticket.

comment:2 by Mia Sia, 6 months ago

Component: undeterminedavcodec
Description: modified (diff)

comment:3 by Carl Eugen Hoyos, 6 months ago

Please understand that using -hide_banner on this bug tracker makes every ticket invalid unless you want to report an issue regarding the option.

comment:4 by James, 6 months ago

Status: newopen

The problem is not in libavformat/aiffdec.c since you're encoding into adpcm_g722 and muxing into aiff, not demuxing the latter.

Either the adpcm_g722 encoder or something else further into the process before reaching the aiff muxer should set block_align.

comment:5 by Mia Sia, 6 months ago

Cc: Mia Sia added
Description: modified (diff)

comment:6 by Carl Eugen Hoyos, 4 months ago

Keywords: AIF g722 added; AIFF removed
Note: See TracTickets for help on using tickets.