I am trying to trying to create an Audio file by merging multiple video inputs. The merged inputs may have an -itsoffset specified to determine when they start in the merge.
I am not certain why 3 inputs is not working. Nearly an identical command works with two inputs. When I have 3 inputs, I get the error:
[libmp3lame @ 0x2b55d60] Specified channel layout '2.1' is not supported
I believe the error means that more than 2 channel inputs are not supported. Am I reading that correctly? Do I need to merge them two inputs at a time? I thought about merging all three inputs as a video first and then converting the completed video file as a audio file. But I thought it would be smarter to avoid the video conversions, since I am ultimately wanting just an audio file.
Command with 2 inputs that works:
ffmpeg -itsoffset 0.5 -i 850_segment_0_remote_0.webm \
-i 850_segment_0_local_0.webm \
-filter_complex " [0:a][1:a]amerge=inputs=2[a]" \
-map "[a]" -ac 2 -ar 44100 -strict -2 \
-acodec libmp3lame 850_segment_0.mp3
Command with 3 Inputs that Fails:
ffmpeg -itsoffset 8.698 -i 850_segment_1_remote_0.webm -itsoffset 9.705 \
-i 850_segment_1_remote_1.webm -i 850_segment_1_local_0.webm \
-filter_complex " [0:a][1:a][2:a]amerge=inputs=3[a]" \
-map "[a]" -ac 3 -ar 44100 -strict -2 \
-acodec libmp3lame 850_segment_1.mp3
ffmpeg version 3.0.git Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.2) 20160609
configuration: --prefix=/home/daryl/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/daryl/ffmpeg_build/include --extra-ldflags=-L/home/daryl/ffmpeg_build/lib --bindir=/home/daryl/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
libavutil 55. 32.100 / 55. 32.100
libavcodec 57. 63.103 / 57. 63.103
libavformat 57. 52.100 / 57. 52.100
libavdevice 57. 0.102 / 57. 0.102
libavfilter 6. 64.100 / 6. 64.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 2.100 / 2. 2.100
libpostproc 54. 0.100 / 54. 0.100
Input #0, matroska,webm, from '850_segment_1_remote_0.webm':
Metadata:
encoder : Chrome
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
Stream #0:1(eng): Video: vp8, yuv420p, 640x480, SAR 1:1 DAR 4:3, 30 fps, 30 tbr, 1k tbn, 1k tbc (default)
Input #1, matroska,webm, from '850_segment_1_remote_1.webm':
Metadata:
encoder : Chrome
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #1:0(eng): Audio: opus, 48000 Hz, mono, fltp (default)
Stream #1:1(eng): Video: vp8, yuv420p, 480x640, SAR 1:1 DAR 3:4, 30 fps, 30 tbr, 1k tbn, 1k tbc (default)
Input #2, matroska,webm, from '850_segment_1_local_0.webm':
Metadata:
encoder : Chrome
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #2:0(eng): Audio: opus, 48000 Hz, mono, fltp (default)
Stream #2:1(eng): Video: vp8, yuv420p, 640x480, SAR 1:1 DAR 4:3, 29.97 fps, 29.97 tbr, 1k tbn, 1k tbc (default)
[Parsed_amerge_0 @ 0x2b56680] No channel layout for input 1
[Parsed_amerge_0 @ 0x2b56680] Input channel layouts overlap: output layout will be determined by the number of distinct input channels
[libmp3lame @ 0x2b55d60] Specified channel layout '2.1' is not supported
Stream mapping:
Stream #0:0 (opus) -> amerge:in0
Stream #1:0 (opus) -> amerge:in1
Stream #2:0 (opus) -> amerge:in2
amerge -> Stream #0:0 (libmp3lame)
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Thanks to @Mulvya!
Two versions of the command that work:
ffmpeg -itsoffset 8.698 -i 850_segment_1_remote_0.webm \
-itsoffset 9.705 -i 850_segment_1_remote_1.webm \
-i 850_segment_1_local_0.webm \
-filter_complex " [0:a][1:a][2:a]amerge=inputs=3[a]" \
-map "[a]" -ac 2 -ar 44100 -strict -2 \
-acodec libmp3lame 850_segment_1.mp3
ffmpeg -itsoffset 8.698 -i 850_segment_1_remote_0.webm \
-itsoffset 9.705 -i 850_segment_1_remote_1.webm \
-i 850_segment_1_local_0.webm \
-filter_complex " [0:a][1:a][2:a]amerge=inputs=3[a]" \
-map "[a]" -ac 3 -ar 44100 -strict -2 \
-acodec aac 850_segment_1.m4a