gpt4 book ai didi

FFMPEG : How to swap audio tracks and output the same file

转载 作者:行者123 更新时间:2023-12-04 23:18:51 25 4
gpt4 key购买 nike

我有一个包含 4 个音频轨道的视频文件。我需要将音轨 1:2 与音轨 3:4 交换
这是我想要实现的目标

Input file: 1:2:3:4
Outputfile: 3:4:2:1
所以只需交换音轨,这是我尝试过的:
ffmpeg -i "test.mxf" -filter_complex "[a:0]amerge=inputs=1[ch1] ;[a:1]amerge=inputs=1[ch2];[a:2]amerge=inputs=1[ch3];[a:3]amerge=inputs=1[ch4]" -map 1:v -map [ch3] -map [ch4] -map [ch1] -map [ch2] -c:v copy -c:a aac -b:a 128k -ar 48000 -ac 2 "out.mxf"
将它们提取为单独的 channel ,然后将它们映射回输出。
我收到错误: 输入文件索引无效:1
这是ffmpeg的输出日志
ffmpeg -i "test.mxf" -filter_complex "[a:0]amerge=inputs=1[ch1] ;[a:1]amerge=inputs=1[ch2];[a:2]amerge=inputs=1[ch3];[a:3]amerge=inputs=1[ch4]" -map 1:v -map [ch3] -map [ch4] -map [ch1] -map [ch2] -c:v copy -c:a aac -b:a 128k -ar 48000 -ac 2 "out.mxf"
ffmpeg version 4.3.1-2020-10-01-full_build-www.gyan.dev Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 10.2.0 (Rev3, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Guessed Channel Layout for Input Stream #0.1 : mono
Guessed Channel Layout for Input Stream #0.2 : mono
Guessed Channel Layout for Input Stream #0.3 : mono
Guessed Channel Layout for Input Stream #0.4 : mono
Input #0, mxf, from 'test.mxf':
Metadata:
operational_pattern_ul: 060e2b34.04010101.0d010201.01010900
uid : 50a83ad4-88be-11ec-9d91-d0817add6884
generation_uid : 50a83ad5-88be-11ec-be21-d0817add6884
company_name : Adobe Inc.
product_name : Premiere Pro
product_version : 22.1.2
application_platform: Mac OS X
product_uid : 0c3919fe-46e8-11e5-a151-feff819cdc9f
modification_date: 2022-02-08T09:05:52.000000Z
material_package_umid: 0x060A2B340101010501010D111300000050C9F301189605A21036D0817ADD6884
timecode : 10:00:00:00
Duration: 00:01:41.04, start: 0.000000, bitrate: 55052 kb/s
Stream #0:0: Video: mpeg2video (4:2:2), yuv422p(tv, unknown/bt709/bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 50000 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
Metadata:
file_package_umid: 0x060A2B340101010501010D12131248EF50C9F301189605A2B55DD0817ADD6884
file_package_name: Source Package
track_name : Track 1
Side data:
cpb: bitrate max/min/avg: 50000000/0/0 buffer size: 17825792 vbv_delay: N/A
Stream #0:1: Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s
Metadata:
file_package_umid: 0x060A2B340101010501010D12131248EF50C9F301189605A2B55DD0817ADD6884
file_package_name: Source Package
track_name : Track 2
Stream #0:2: Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s
Metadata:
file_package_umid: 0x060A2B340101010501010D12131248EF50C9F301189605A2B55DD0817ADD6884
file_package_name: Source Package
track_name : Track 3
Stream #0:3: Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s
Metadata:
file_package_umid: 0x060A2B340101010501010D12131248EF50C9F301189605A2B55DD0817ADD6884
file_package_name: Source Package
track_name : Track 4
Stream #0:4: Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s
Metadata:
file_package_umid: 0x060A2B340101010501010D12131248EF50C9F301189605A2B55DD0817ADD6884
file_package_name: Source Package
track_name : Track 5
Invalid input file index: 1.

最佳答案

想通了,我为视频使用了错误的索引,还在下面的解决方案中添加了音频编解码器。

ffmpeg -i "test.mxf" -filter_complex "[a:0]amerge=inputs=1[ch1] ;[a:1]amerge=inputs=1[ch2];[a:2]amerge=inputs=1[ch3];[a:3]amerge=inputs=1[ch4]" -map 0:v -map [ch3] -map [ch4] -map [ch1] -map [ch2] -c:v copy -c:a pcm_s24le "out.mxf"
这对我有用,如果有人有更好的解决方案,请分享

关于FFMPEG : How to swap audio tracks and output the same file,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71032782/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com