Opened 42 hours ago
Last modified 22 hours ago
#11434 open defect
Unable to set channel count for Alsa input since release 5.1.1
Reported by: | Brad Isbell | Owned by: | |
---|---|---|---|
Priority: | important | Component: | avdevice |
Version: | git-master | Keywords: | alsa |
Cc: | Brad Isbell | Blocked By: | |
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Ever since release v5.1.1, setting channel count for an Alsa input has no effect and seems to default to stereo. This worked on release v5.0.1. Using John van Sickle builds on a 64-bit Pi, with a Ravenna AES67 audio device.
Here you can see it working with v5.0.1. Note the number of channels received and output in the stream.
ffmpeg-5.0.1-arm64-static/ffmpeg -loglevel trace -f alsa -ac 8 -guess_layout_max 0 -acodec pcm_s24le -i "hw:CARD=RAVENNA" -codec copy -f null /dev/null ffmpeg version 5.0.1-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2022 the FFmpeg developers built with gcc 8 (Debian 8.3.0-6) configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzimg libavutil 57. 17.100 / 57. 17.100 libavcodec 59. 18.100 / 59. 18.100 libavformat 59. 16.100 / 59. 16.100 libavdevice 59. 4.100 / 59. 4.100 libavfilter 8. 24.100 / 8. 24.100 libswscale 6. 4.100 / 6. 4.100 libswresample 4. 3.100 / 4. 3.100 libpostproc 56. 3.100 / 56. 3.100 Splitting the commandline. Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'trace'. Reading option '-f' ... matched as option 'f' (force format) with argument 'alsa'. Reading option '-ac' ... matched as option 'ac' (set number of audio channels) with argument '8'. Reading option '-guess_layout_max' ... matched as option 'guess_layout_max' (set the maximum number of channels to try to guess the channel layout) with argument '0'. Reading option '-acodec' ... matched as option 'acodec' (force audio codec ('copy' to copy stream)) with argument 'pcm_s24le'. Reading option '-i' ... matched as input url with argument 'hw:CARD=RAVENNA'. Reading option '-codec' ... matched as option 'codec' (codec name) with argument 'copy'. Reading option '-f' ... matched as option 'f' (force format) with argument 'null'. Reading option '/dev/null' ... matched as output url. Finished splitting the commandline. Parsing a group of options: global . Applying option loglevel (set logging level) with argument trace. Successfully parsed a group of options. Parsing a group of options: input url hw:CARD=RAVENNA. Applying option f (force format) with argument alsa. Applying option ac (set number of audio channels) with argument 8. Applying option guess_layout_max (set the maximum number of channels to try to guess the channel layout) with argument 0. Applying option acodec (force audio codec ('copy' to copy stream)) with argument pcm_s24le. Successfully parsed a group of options. Opening an input file: hw:CARD=RAVENNA. [alsa @ 0x1cdef2d0] All info found [alsa @ 0x1cdef2d0] stream 0: start_time: 1.73802e+09 duration: NOPTS [alsa @ 0x1cdef2d0] format: start_time: 1.73802e+09 duration: NOPTS (estimate from bit rate) bitrate=9216 kb/s Input #0, alsa, from 'hw:CARD=RAVENNA': Duration: N/A, start: 1738023146.060336, bitrate: 9216 kb/s Stream #0:0, 1, 1/1000000: Audio: pcm_s24le, 48000 Hz, 8 channels, s32 (24 bit), 9216 kb/s Successfully opened the file. Parsing a group of options: output url /dev/null. Applying option codec (codec name) with argument copy. Applying option f (force format) with argument null. Successfully parsed a group of options. Opening an output file: /dev/null. Successfully opened the file. Output #0, null, to '/dev/null': Metadata: encoder : Lavf59.16.100 Stream #0:0, 0, 1/1000000: Audio: pcm_s24le, 48000 Hz, 8 channels, s32 (24 bit), 9216 kb/s Stream mapping: Stream #0:0 -> #0:0 (copy) Press [q] to stop, [?] for help cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream) size=N/A time=00:00:02.52 bitrate=N/A speed=0.998x [q] command received. Exiting. size=N/A time=00:00:02.78 bitrate=N/A speed=0.997x video:0kB audio:3128kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown Input file #0 (hw:CARD=RAVENNA): Input stream #0:0 (audio): 2085 packets read (3202560 bytes); Total: 2085 packets (3202560 bytes) demuxed Output file #0 (/dev/null): Output stream #0:0 (audio): 2085 packets muxed (3202560 bytes); Total: 2085 packets (3202560 bytes) muxed 0 frames successfully decoded, 0 decoding errors
Now, here's it broken in v5.1.1. Again, note the resulting channel counts, even though you can see in the trace that a channel count of 8
was set.
ffmpeg-5.1.1-arm64-static/ffmpeg -loglevel trace -f alsa -ac 8 -guess_layout_max 0 -acodec pcm_s24le -i "hw:CARD=RAVENNA" -codec copy -f null /dev/null ffmpeg version 5.1.1-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2022 the FFmpeg developers built with gcc 8 (Debian 8.3.0-6) configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzimg 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 Splitting the commandline. Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'trace'. Reading option '-f' ... matched as option 'f' (force format) with argument 'alsa'. Reading option '-ac' ... matched as option 'ac' (set number of audio channels) with argument '8'. Reading option '-guess_layout_max' ... matched as option 'guess_layout_max' (set the maximum number of channels to try to guess the channel layout) with argument '0'. Reading option '-acodec' ... matched as option 'acodec' (force audio codec ('copy' to copy stream)) with argument 'pcm_s24le'. Reading option '-i' ... matched as input url with argument 'hw:CARD=RAVENNA'. Reading option '-codec' ... matched as option 'codec' (codec name) with argument 'copy'. Reading option '-f' ... matched as option 'f' (force format) with argument 'null'. Reading option '/dev/null' ... matched as output url. Finished splitting the commandline. Parsing a group of options: global . Applying option loglevel (set logging level) with argument trace. Successfully parsed a group of options. Parsing a group of options: input url hw:CARD=RAVENNA. Applying option f (force format) with argument alsa. Applying option ac (set number of audio channels) with argument 8. Applying option guess_layout_max (set the maximum number of channels to try to guess the channel layout) with argument 0. Applying option acodec (force audio codec ('copy' to copy stream)) with argument pcm_s24le. Successfully parsed a group of options. Opening an input file: hw:CARD=RAVENNA. [alsa @ 0x2d8252d0] All info found [alsa @ 0x2d8252d0] stream 0: start_time: 1.73802e+09 duration: NOPTS [alsa @ 0x2d8252d0] format: start_time: 1.73802e+09 duration: NOPTS (estimate from bit rate) bitrate=2304 kb/s Input #0, alsa, from 'hw:CARD=RAVENNA': Duration: N/A, start: 1738023154.233247, bitrate: 2304 kb/s Stream #0:0, 1, 1/1000000: Audio: pcm_s24le, 48000 Hz, 2 channels, s32 (24 bit), 2304 kb/s Successfully opened the file. Parsing a group of options: output url /dev/null. Applying option codec (codec name) with argument copy. Applying option f (force format) with argument null. Successfully parsed a group of options. Opening an output file: /dev/null. Successfully opened the file. Output #0, null, to '/dev/null': Metadata: encoder : Lavf59.27.100 Stream #0:0, 0, 1/1000000: Audio: pcm_s24le, 48000 Hz, 2 channels, s32 (24 bit), 2304 kb/s Stream mapping: Stream #0:0 -> #0:0 (copy) Press [q] to stop, [?] for help cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream) size=N/A time=00:00:02.51 bitrate=N/A speed=0.998x [q] command received. Exiting. size=N/A time=00:00:02.66 bitrate=N/A speed=0.998x video:0kB audio:750kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown Input file #0 (hw:CARD=RAVENNA): Input stream #0:0 (audio): 1999 packets read (767616 bytes); Total: 1999 packets (767616 bytes) demuxed Output file #0 (/dev/null): Output stream #0:0 (audio): 1999 packets muxed (767616 bytes); Total: 1999 packets (767616 bytes) muxed 0 frames successfully decoded, 0 decoding errors
Change History (4)
comment:1 by , 42 hours ago
Component: | undetermined → avdevice |
---|
follow-up: 3 comment:2 by , 42 hours ago
follow-up: 4 comment:3 by , 41 hours ago
Keywords: | channels removed |
---|---|
Priority: | normal → important |
Status: | new → open |
Version: | 5.1.4 → git-master |
Replying to Brad Isbell:
I suspect this change is related:
https://github.com/FFmpeg/FFmpeg/commit/ffc4fd3cc2ccb2cadb71f19849842b18ca1281c6
Yes and no. That change is correct, but the problem is that e78173557da898f18a78241cc3525b76694164b5 changed the way the channel count is set in demuxers/devices.
Can you test https://github.com/jamrial/FFmpeg/tree/alsa to see if it fixes the issue?
comment:4 by , 22 hours ago
Replying to James:
Can you test https://github.com/jamrial/FFmpeg/tree/alsa to see if it fixes the issue?
This did not fix it for me. Though note, I did make a change to libavdevice/alsa_dec.c
to please the compiler:
{ "ch_layout", "", offsetof(AlsaData, ch_layout), AV_OPT_TYPE_CHLAYOUT, {.str = "2C"}, INT_MIN, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
I suspect this change is related:
https://github.com/FFmpeg/FFmpeg/commit/ffc4fd3cc2ccb2cadb71f19849842b18ca1281c6