Opened 9 years ago

Closed 9 years ago

#4330 closed defect (invalid)

-ac and aresample/aformat conflict

Reported by: ChocolateArmpits Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

I'm trying to resample a stereo audio source and then save it to two outputs: one mono and one stereo. Resampling is done via filters (aresample or aformat) while downmixing to mono for the first output is done using "-ac 1" option.
However what I get are two mono outputs.
Shifting the "-ac 1" option to the second output also produces two mono outputs. Removing "-ac 1" produces two stereo outputs, as expected. If I remove any resampling filter I get one mono and one stereo output. Changing between aresample or aformat makes no difference in any case.

Command line used:

ffmpeg -v 9 -loglevel 99 -i mix_1_stereo_12_0.mkv -filter_complex [0:a]aresample=44100,asplit[32a][64a] -map [32a]:a -b:a 32k -ac 1 -acodec libvo_aacenc -y -f mp4 NUL -map [64a]:a -b:a 64k -acodec libvo_aacenc -y -f mp4 NUL

Console output:

ffmpeg version N-70223-g7296716 Copyright (c) 2000-2015 the FFmpeg developers

built with gcc 4.9.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --

enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib

libavutil 54. 19.100 / 54. 19.100
libavcodec 56. 26.100 / 56. 26.100
libavformat 56. 23.105 / 56. 23.105
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 11.101 / 5. 11.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100

Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'.
Reading option '-i' ... matched as input file with argument 'mix_1_stereo_12_0.mkv'.
Reading option '-filter_complex' ... matched as option 'filter_complex' (create a complex filtergraph) with argument '[0:a]aresample=44100,asplit[32a][64a]'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '[32a]:a'.
Reading option '-b:a' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '32k'.
Reading option '-ac' ... matched as option 'ac' (set number of audio channels) with argument '1'.
Reading option '-acodec' ... matched as option 'acodec' (force audio codec ('copy' to copy stream)) with argument 'libvo_aacenc'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'mp4'.
Reading option 'NUL' ... matched as output file.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '[64a]:a'.
Reading option '-b:a' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '64k'.
Reading option '-acodec' ... matched as option 'acodec' (force audio codec ('copy' to copy stream)) with argument 'libvo_aacenc'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'mp4'.
Reading option 'NUL' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Applying option filter_complex (create a complex filtergraph) with argument [0:a]aresample=44100,asplit[32a][64a].
Applying option y (overwrite output files) with argument 1.

Last message repeated 1 times

Successfully parsed a group of options.
Parsing a group of options: input file mix_1_stereo_12_0.mkv.
Successfully parsed a group of options.
Opening an input file: mix_1_stereo_12_0.mkv.
[matroska,webm @ 0000000000312a40] Format matroska,webm probed with size=2048 and score=100
st:0 removing common factor 1000000 from timebase
[matroska,webm @ 0000000000312a40] Before avformat_find_stream_info() pos: 587 bytes read:32768 seeks:0
[matroska,webm @ 0000000000312a40] parser not found for codec pcm_s16le, packets or times may be invalid.

Last message repeated 1 times

[matroska,webm @ 0000000000312a40] All info found
[matroska,webm @ 0000000000312a40] After avformat_find_stream_info() pos: 8797 bytes read:32768 seeks:0 frames:1
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, matroska,webm, from 'mix_1_stereo_12_0.mkv':

Metadata:

ENCODER : Lavf56.18.100

Duration: 00:00:30.00, start: 0.000000, bitrate: 1537 kb/s

Stream #0:0, 1, 1/1000: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s (default)
Metadata:

ENCODER : Lavc56.19.100 pcm_s16le

Successfully opened the file.
Parsing a group of options: output file NUL.
Applying option map (set input stream mapping) with argument [32a]:a.
Applying option b:a (video bitrate (please use -b:v)) with argument 32k.
Applying option ac (set number of audio channels) with argument 1.
Applying option acodec (force audio codec ('copy' to copy stream)) with argument libvo_aacenc.
Applying option f (force format) with argument mp4.
Successfully parsed a group of options.
Opening an output file: NUL.
detected 2 logical cores
[Parsed_aresample_0 @ 00000000002ee700] Setting 'sample_rate' to value '44100'
[graph 0 input from stream 0:0 @ 00000000002e9c40] Setting 'time_base' to value '1/48000'
[graph 0 input from stream 0:0 @ 00000000002e9c40] Setting 'sample_rate' to value '48000'
[graph 0 input from stream 0:0 @ 00000000002e9c40] Setting 'sample_fmt' to value 's16'
[graph 0 input from stream 0:0 @ 00000000002e9c40] Setting 'channel_layout' to value '0x3'
[graph 0 input from stream 0:0 @ 00000000002e9c40] tb:1/48000 samplefmt:s16 samplerate:48000 chlayout:0x3
[audio format for output stream 0:0 @ 00000000002eb7a0] Setting 'sample_fmts' to value 's16'
[audio format for output stream 0:0 @ 00000000002eb7a0] Setting 'sample_rates' to value '96000|88200|64000|48000|44100|32000|24000|22050|16000|12000|11025|8000|7350'
[audio format for output stream 0:0 @ 00000000002eb7a0] Setting 'channel_layouts' to value '0x4'
Successfully opened the file.
Parsing a group of options: output file NUL.
Applying option map (set input stream mapping) with argument [64a]:a.
Applying option b:a (video bitrate (please use -b:v)) with argument 64k.
Applying option acodec (force audio codec ('copy' to copy stream)) with argument libvo_aacenc.
Applying option f (force format) with argument mp4.
Successfully parsed a group of options.
Opening an output file: NUL.
[audio format for output stream 1:0 @ 0000000000317d60] Setting 'sample_fmts' to value 's16'
[audio format for output stream 1:0 @ 0000000000317d60] Setting 'sample_rates' to value '96000|88200|64000|48000|44100|32000|24000|22050|16000|12000|11025|8000|7350'
Successfully opened the file.
[AVFilterGraph @ 00000000002ed820] query_formats: 7 queried, 18 merged, 0 already done, 0 delayed
0.500000 0.500000
[Parsed_aresample_0 @ 00000000002ee700] ch:2 chl:stereo fmt:s16 r:48000Hz -> ch:1 chl:mono fmt:s16 r:44100Hz
Output #0, mp4, to 'NUL':

Metadata:

encoder : Lavf56.23.105
Stream #0:0, 0, 1/44100: Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040), 44100 Hz, mono, s16, 32 kb/s (default)
Metadata:

encoder : Lavc56.26.100 libvo_aacenc

Output #1, mp4, to 'NUL':

Metadata:

encoder : Lavf56.23.105
Stream #1:0, 0, 1/44100: Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040), 44100 Hz, mono, s16, 64 kb/s (default)
Metadata:

encoder : Lavc56.26.100 libvo_aacenc

Stream mapping:

Stream #0:0 (pcm_s16le) -> aresample
asplit:output0 -> Stream #0:0 (libvo_aacenc)
asplit:output1 -> Stream #1:0 (libvo_aacenc)

Press [q] to stop, ? for help
[output stream 0:0 @ 00000000002eb640] EOF on sink link output stream 0:0:default.
[output stream 1:0 @ 000000000032ef20] EOF on sink link output stream 1:0:default.
No more output streams to write to, finishing.
[libvo_aacenc @ 00000000002eb0c0] Trying to remove 456 more samples than there are in the queue
[libvo_aacenc @ 0000000000317840] Trying to remove 456 more samples than there are in the queue
size= 122kB time=00:00:30.01 bitrate= 33.3kbits/s
video:0kB audio:350kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Input file #0 (mix_1_stereo_12_0.mkv):

Input stream #0:0 (audio): 704 packets read (5760000 bytes); 704 frames decoded (1440000 samples);
Total: 704 packets (5760000 bytes) demuxed

Output file #0 (NUL):

Output stream #0:0 (audio): 1292 frames encoded (1323000 samples); 1294 packets muxed (119048 bytes);
Total: 1294 packets (119048 bytes) muxed

Output file #1 (NUL):

Output stream #1:0 (audio): 1292 frames encoded (1323000 samples); 1294 packets muxed (239390 bytes);
Total: 1294 packets (239390 bytes) muxed

704 frames successfully decoded, 0 decoding errors
[AVIOContext @ 00000000002ebbe0] Statistics: 30 seeks, 1317 writeouts
[AVIOContext @ 0000000000337020] Statistics: 30 seeks, 1317 writeouts
[AVIOContext @ 000000000031b300] Statistics: 5765622 bytes read, 0 seeks

Change History (1)

comment:1 by Michael Niedermayer, 9 years ago

Resolution: invalid
Status: newclosed

you have to specify -ac for both if you want them to differ

Note: See TracTickets for help on using tickets.