我有一些包含多轨 AAC 音频的 mkv 文件,需要将其转换为 PCM-S16-BE。以下命令有效,但会创建仅包含一个立体声音轨的视频:
ffmpeg -i input.mkv -c:v copy -c:a pcm_s16be output.mkv
为了转换所有三个音轨,我尝试了这个,运行时没有出现错误:
ffmpeg -i input.mkv -c:v copy -c:a:1 pcm_s16be -c:a:2 pcm_s16be -c:a:3 pcm_s16be output.mkv
但输出文件仅包含一个立体声音轨。
ffmpeg 给出了有关 input.mkv 文件以下信息:
ffmpeg version 4.4.1-3+b2 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 11 (Debian 11.2.0-18)
configuration: --prefix=/usr --extra-version=3+b2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
Input #0, matroska,webm, from 'input.mkv':
Metadata:
ENCODER : Lavf58.76.100
Duration: 00:00:50.42, start: 0.000000, bitrate: 2889 kb/s
Stream #0:0: Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 60 fps, 60 tbr, 1k tbn, 120 tbc (default)
Metadata:
DURATION : 00:00:50.417000000
Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp (default)
Metadata:
title : Track1
DURATION : 00:00:50.368000000
Stream #0:2: Audio: aac (LC), 48000 Hz, stereo, fltp
Metadata:
title : Track2
DURATION : 00:00:50.368000000
Stream #0:3: Audio: aac (LC), 48000 Hz, stereo, fltp
Metadata:
title : Track3
DURATION : 00:00:50.368000000
我究竟做错了什么?
答案1
解决方法如下,-map 0
这样使用:
ffmpeg -i input.mkv -map 0 -c:v copy -c:a:1 pcm_s16be -c:a:2 pcm_s16be -c:a:3 pcm_s16be output.mkv
感谢 Tom Yan!