ffmpeg 使用 -filter_complex channelsplit 进行输出流映射

ffmpeg 使用 -filter_complex channelsplit 进行输出流映射

目标是在输出文件中使用编解码器 s16_le 生成单声道音轨,独立于输入文件的音轨/通道布局。所有这些都无需动态创建 ffmpeg 命令行。这就是为什么我尝试在不明确访问输入音频通道的情况下完成这项工作。

在我看来,这应该可行:

ffmpeg -i F:\test.3gp  -filter_complex "[0:v]copy[vid];[0:a]channelsplit[aud]" -map [vid] -map [aud] -c:a pcm_s16le f:\splitted.mxf

但与 .mxf 多路复用器一起使用时会出现此错误:

ffmpeg version N-94423-ga0c1970781 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 9.1.1 (GCC) 20190716
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --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 --enable-libopenmpt
  libavutil      56. 32.100 / 56. 32.100
  libavcodec     58. 55.100 / 58. 55.100
  libavformat    58. 30.100 / 58. 30.100
  libavdevice    58.  9.100 / 58.  9.100
  libavfilter     7. 58.100 /  7. 58.100
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'F:\test.3gp':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf58.12.100
  Duration: 00:00:02.88, start: 0.000000, bitrate: 20219 kb/s
    Stream #0:0(und): Video: vp9 (Profile 0) (vp09 / 0x39307076), yuv420p(tv), 1080x1920, 25011 kb/s, SAR 64:27 DAR 4:3, 27.16 fps, 25 tbr, 12800 tbn, 12800 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: mp3 (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 64 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
File 'f:\splitted.mxf' already exists. Overwrite ? [y/N] y
Stream mapping:
  Stream #0:0 (vp9) -> copy
  Stream #0:1 (mp3float) -> channelsplit
  channelsplit:FR -> Stream #0:0 (pcm_s16le)
  copy -> Stream #0:1 (mpeg2video)
  channelsplit:FL -> Stream #0:2 (pcm_s16le)
Press [q] to stop, [?] for help
[mxf @ 000001d0f51a8800] there must be exactly one video stream and it must be the first one
Could not write header for output file #0 (incorrect codec parameters ?): Operation not permitted
Error initializing output stream 0:2 --
Conversion failed!

正如我们在“流映射:”部分中看到的,视频流被映射到输出轨道 0:1,而我的印象是,当我提供 -map 选项时,它应该重新映射到 0:0。

欢迎提供任何线索!

相关内容