[FFmpeg-user] Downmixing an audio stream while keeping a copy of the original stream
Kieran O Leary
kieran.o.leary at gmail.com
Sat Dec 23 12:24:22 EET 2017
Hi,
On Sat, Dec 23, 2017 at 8:20 AM, Adam Baxter <voltagex at voltagex.org> wrote:
> Hi all,
> I've got a file that I'd like to do the following to:
>
> Video stream: copy
> Audio stream 1: convert to AAC, downmix to stereo
> Audio stream 2: copy of original AC3 5.1 stream
>
> The below command *seems* like it should work, but only the downmixed
> stream ends up in output.mkv
>
> ffmpeg -i "input.mkv" -map 0:v -c:v copy -map 0:a -c:a:1 copy -map 0:a
> -c:a:0 aac -b:a:0 192k -ac:a:0 2 -filter_complex
> "[a:0]pan=stereo|FL=FC+0.30*FL+0.30*BL|FR=FC+0.30*FR+0.30*BR" -c:a:1 copy
> "output.mkv"
I don't have a 5.1 input to hand that would allow me to test your
exact instance, but doing something like this slightly augmented
command looks like it might do what you want
ffmpeg -i "out.mkv" -map 0:v -c:v copy -c:a:0 aac -b:a:0 192k -ac:a:0
2 -filter_complex
"[a:0]pan=stereo|FL=FC+0.30*FL+0.30*BL|FR=FC+0.30*FR+0.30*BR[a]" -map
[a] -map a:0:1 -c:a:1 copy "output.mkv"
ffmpeg version N-87317-g08ec828 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration: --prefix=/home/kieran110s/ffmpeg_build
--pkg-config-flags=--static
--extra-cflags=-I/home/kieran110s/ffmpeg_build/include
--extra-ldflags=-L/home/kieran110s/ffmpeg_build/lib
--bindir=/home/kieran110s/bin --enable-gpl --enable-libass
--enable-libfreetype --enable-libmp3lame --enable-libopus
--enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264
--enable-nonfree
libavutil 55. 75.100 / 55. 75.100
libavcodec 57.106.101 / 57.106.101
libavformat 57. 82.100 / 57. 82.100
libavdevice 57. 8.101 / 57. 8.101
libavfilter 6.105.100 / 6.105.100
libswscale 4. 7.103 / 4. 7.103
libswresample 2. 8.100 / 2. 8.100
libpostproc 54. 6.100 / 54. 6.100
Input #0, matroska,webm, from 'out.mkv':
Metadata:
ENCODER : Lavf57.82.100
Duration: 00:00:01.00, start: 0.000000, bitrate: 112 kb/s
Stream #0:0: Video: h264 (High 4:4:4 Predictive),
yuv444p(progressive), 320x240 [SAR 1:1 DAR 4:3], 25 fps, 25 tbr, 1k
tbn, 50 tbc (default)
Metadata:
ENCODER : Lavc57.106.101 libx264
DURATION : 00:00:01.003000000
Stream #0:1: Audio: vorbis, 44100 Hz, mono, fltp (default)
Metadata:
ENCODER : Lavc57.106.101 libvorbis
DURATION : 00:00:01.003000000
File 'output.mkv' already exists. Overwrite ? [y/N] y
Stream mapping:
Stream #0:1 (vorbis) -> pan
Stream #0:0 -> #0:0 (copy)
pan -> Stream #0:1 (aac)
Stream #0:1 -> #0:2 (copy)
Press [q] to stop, [?] for help
Output #0, matroska, to 'output.mkv':
Metadata:
encoder : Lavf57.82.100
Stream #0:0: Video: h264 (High 4:4:4 Predictive) (H264 /
0x34363248), yuv444p(progressive), 320x240 [SAR 1:1 DAR 4:3], q=2-31,
25 fps, 25 tbr, 1k tbn, 1k tbc (default)
Metadata:
ENCODER : Lavc57.106.101 libx264
DURATION : 00:00:01.003000000
Stream #0:1: Audio: aac (LC) ([255][0][0][0] / 0x00FF), 44100 Hz,
stereo, fltp, 192 kb/s (default)
Metadata:
encoder : Lavc57.106.101 aac
Stream #0:2: Audio: vorbis (oV[0][0] / 0x566F), 44100 Hz, mono,
fltp (default)
Metadata:
ENCODER : Lavc57.106.101 libvorbis
DURATION : 00:00:01.003000000
frame= 25 fps=0.0 q=-1.0 Lsize= 32kB time=00:00:01.02 bitrate=
252.4kbits/s speed=2.31x
video:7kB audio:19kB subtitle:0kB other streams:0kB global headers:3kB
muxing overhead: 19.431402%
[aac @ 0x262d580] Qavg: 55941.566
More information about the ffmpeg-user
mailing list