我有一个 8 音轨 mov 文件,我想使用 ffmpeg 将其编码为 mp4,但要取出 7+8 音轨并将其作为 320k 和 48KHz 的立体声放入该 mp4。我的代码如下:
ffmpeg -i %source% -map 0:0 -map 0:7 -map 0:8 -c:a:0 aac -ab:1 320k -ar:1 48000 -ac:1 2
-disposition:a:0 default -c:a:1 aac -ab:2 320k -ar:2 48000 -ac:2 1 -disposition:a:1 0
-strict -2 -async 1 -c:v libx264 -b:v 9300k -minrate 9300k -maxrate 9300k -bufsize 2325k
-r 24 -force_fps -s 1920x1080 -aspect 1:1 -pix_fmt yuv420p -profile:v high -preset medium
-level 40 -partitions partb8x8+partp4x4+partp8x8+parti8x8 -b-pyramid 2 -weightb 1 -8x8dct 1
-fast-pskip 1 -direct-pred 1 -x264-params force-cfr=1 -coder ac -trellis 1 -me_method hex
-flags +loop -sc_threshold 40 -keyint_min 24 -g 240 -qmin 3 -qmax 51 -threads 12
-metadata creation_time=now -sn -y %source%_FINAL.mp4
我需要做哪些更改才能将其变成立体声而不是 2 个单声道?我-filter_complex "[0:7][0:8] amerge=inputs=2" c:a aac -ab 320k
一开始尝试添加但没有成功。我做错了什么?谢谢。
以下是整个日志:
R:\tests>ffmpeg -probesize 50M -analyzeduration 100M -i "8chIN.mov" -map 0:0 -an -c:v libx264 -b:v 9300k -minrate 9300k -maxrate 9300k -bufsize 2325k -r 24 -force_fps -vf "setsar=1/1,scale=1920:-1,pad=1920:1080:(1920-iw)/2:(1080-ih)/2" -deblock -1:-1 -pix_fmt yuv420p -profile:v high -preset medium -level 40 -partitions all -b-pyramid 1 -weightb 1 -8x8dct 1 -fast-pskip 1 -direct-pred 1 -x264-params force-cfr=1 -coder 0 -trellis 1 -me_method hex -flags +loop -sc_threshold 40 -keyint_min 24 -g 240 -qmin 3 -qmax 51 -threads 12 -metadata creation_time=now -filter_complex "[0:7][0:8] amerge=inputs=2" -c:a aac -ab 320k -sn -y "OUT.MP4"
ffmpeg version N-91245-g550372d0c4 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7.3.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
libavutil 56. 18.102 / 56. 18.102
libavcodec 58. 19.105 / 58. 19.105
libavformat 58. 17.100 / 58. 17.100
libavdevice 58. 4.100 / 58. 4.100
libavfilter 7. 25.100 / 7. 25.100
libswscale 5. 2.100 / 5. 2.100
libswresample 3. 2.100 / 3. 2.100
libpostproc 55. 2.100 / 55. 2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '8chIN.mov':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
creation_time : 2020-03-13T13:01:13.000000Z
com.apple.quicktime.player.movie.audio.gain: 1.000000
com.apple.quicktime.player.movie.audio.treble: 0.000000
com.apple.quicktime.player.movie.audio.bass: 0.000000
com.apple.quicktime.player.movie.audio.balance: 0.000000
com.apple.quicktime.player.movie.audio.pitchshift: 0.000000
com.apple.quicktime.player.movie.audio.mute:
com.apple.quicktime.player.movie.visual.brightness: 0.000000
com.apple.quicktime.player.movie.visual.color: 1.000000
com.apple.quicktime.player.movie.visual.tint: 0.000000
com.apple.quicktime.player.movie.visual.contrast: 1.000000
com.apple.quicktime.player.version: 7.6.6 (7.6.6)
com.apple.quicktime.version: 7.7.3 (2978.8) 0x7738000 (Mac OS X, 10.12.6, 16G2136)
Duration: 00:01:39.63, start: 0.000000, bitrate: 166832 kb/s
Stream #0:0(eng): Video: prores (apch / 0x68637061), yuv422p10le(tv, bt709, progressive), 1920x1080, 157532 kb/s, SAR 1:1 DAR 16:9, 24 fps, 24 tbr, 24 tbn, 24 tbc (default)
Metadata:
creation_time : 2020-03-13T13:01:13.000000Z
handler_name : Apple Alias Data Handler
encoder : Apple ProRes 422 HQ
timecode : 00:00:00:00
Stream #0:1(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels (FL), s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2020-03-13T13:01:13.000000Z
handler_name : Apple Alias Data Handler
timecode : 00:00:00:00
Stream #0:2(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels (FR), s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2020-03-13T13:01:13.000000Z
handler_name : Apple Alias Data Handler
timecode : 00:00:00:00
Stream #0:3(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2020-03-13T13:01:13.000000Z
handler_name : Apple Alias Data Handler
timecode : 00:00:00:00
Stream #0:4(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels (LFE), s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2020-03-13T13:01:13.000000Z
handler_name : Apple Alias Data Handler
timecode : 00:00:00:00
Stream #0:5(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels (BL), s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2020-03-13T13:01:13.000000Z
handler_name : Apple Alias Data Handler
timecode : 00:00:00:00
Stream #0:6(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels (BR), s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2020-03-13T13:01:13.000000Z
handler_name : Apple Alias Data Handler
timecode : 00:00:00:00
Stream #0:7(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels (DL), s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2020-03-13T13:01:13.000000Z
handler_name : Apple Alias Data Handler
timecode : 00:00:00:00
Stream #0:8(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels (DR), s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2020-03-13T13:01:13.000000Z
handler_name : Apple Alias Data Handler
timecode : 00:00:00:00
Stream #0:9(eng): Data: none (tmcd / 0x64636D74) (default)
Metadata:
creation_time : 2020-03-13T13:01:13.000000Z
handler_name : Apple Alias Data Handler
timecode : 00:00:00:00
Stream mapping:
Stream #0:7 (pcm_s24le) -> amerge:in0 (graph 0)
Stream #0:8 (pcm_s24le) -> amerge:in1 (graph 0)
amerge (graph 0) -> Stream #0:0 (aac)
Stream #0:0 -> #0:1 (prores (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 000001ed540d3cc0] using SAR=1/1
[libx264 @ 000001ed540d3cc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 000001ed540d3cc0] profile High, level 4.0
[libx264 @ 000001ed540d3cc0] 264 - core 155 r2901 7d0ff22 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=0 ref=3 deblock=1:-1:-1 analyse=0x3:0x133 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=1 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=240 keyint_min=24 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=cbr mbtree=1 bitrate=9300 ratetol=1.0 qcomp=0.60 qpmin=3 qpmax=51 qpstep=4 vbv_maxrate=9300 vbv_bufsize=2325 nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00
[Parsed_amerge_0 @ 000001ed530fdc00] No channel layout for input 1
[aac @ 000001ed540d0a80] Unsupported channel layout
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!
答案1
添加-ac 2
输出选项
您的输入通道被标记为 DL(左混音)和 DR(右混音)。当它们组合在一起时,它们会创建下混频道布局。请参阅ffmpeg -layouts
频道名称和布局列表。
FFmpeg AAC 编码器(-c:a aac
)不支持下混通道布局,因此-ac 2
将其重新分配为立体声。或者,您也可以通过aresample 过滤器,但这更加复杂。