使用 FFMpeg 对音频通道进行二进制复制

使用 FFMpeg 对音频通道进行二进制复制

我的情况有点奇怪,但我需要转换一些内容进行测试。基本上,我有一堆mkv带有视频流和立体声音频流的文件,我需要复制音频流,这样我就可以输出 5 个(用于 4.1)和 6 个(用于 5.1)音频流。

我现在有这个

#!/bin/bash

for media in $(ls $1/*.mkv); do
    echo $media

    ffmpeg -i $media -filter_complex \
       "[0:a]pan=5.1|c0=c0|c1=c0|c2=c0|c3=c0|c4=c0|c5=c0[a]" \
       -map 0:v -map "[a]" -c:v copy \
       -c:a $(echo $media | sed "s/.*sps\([A-Z0-9]\+\).*/\L\1/") \
       $2/${media##*/} & done
wait

sed 命令用于根据文件名确定音频格式,以及音频嵌入的位置

这确实创建了我想要的通道数量,但 FFMpeg 对它们进行了很多花哨的过滤。尤其是 LFE。

所以问题是:我可以在上混时禁用过滤吗,或者是否有其他我没有看到的方法来实现这一点?

编辑:添加了示例 ffmpeg 日志

ffmpeg -i input/syncvideo_1920w1080h24fpsH265vc3160kbrv_48000spsAC3ac128kbra_3600s.mkv -filter_complex "[0:a]pan=5.1|c0=c0|c1=c0|c2=c0|c3=c0|c4=c0|c5=c0[a]" -map 0:v -map "[a]" -c:v copy -c:a ac3 output/syncvideo_1920w1080h24fpsH265vc3160kbrv_48000spsAC3ac128kbra_3600s.mkv
ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
  configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, matroska,webm, from 'input/syncvideo_1920w1080h24fpsH265vc3160kbrv_48000spsAC3ac128kbra_3600s.mkv':
  Metadata:
    ENCODER         : Lavf57.83.100
  Duration: 01:00:00.01, start: 0.000000, bitrate: 679 kb/s
    Stream #0:0: Video: hevc (Main), yuv420p(tv, progressive), 1920x1080, 24 fps, 24 tbr, 1k tbn, 24 tbc (default)
    Metadata:
      ENCODER         : Lavc57.107.100 libx265
      DURATION        : 01:00:00.005000000
    Stream #0:1: Audio: ac3, 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      ENCODER         : Lavc57.107.100 ac3
      DURATION        : 01:00:00.000000000
File 'output/syncvideo_1920w1080h24fpsH265vc3160kbrv_48000spsAC3ac128kbra_3600s.mkv' already exists. Overwrite ? [y/N] y
Stream mapping:
  Stream #0:1 (ac3) -> pan
  Stream #0:0 -> #0:0 (copy)
  pan -> Stream #0:1 (ac3)
Press [q] to stop, [?] for help
[Parsed_pan_0 @ 0x55993a730f40] Pure channel mapping detected: 0 0 0 0 0 0
Output #0, matroska, to 'output/syncvideo_1920w1080h24fpsH265vc3160kbrv_48000spsAC3ac128kbra_3600s.mkv':
  Metadata:
    encoder         : Lavf57.83.100
    Stream #0:0: Video: hevc (Main), yuv420p(tv, progressive), 1920x1080, q=2-31, 24 fps, 24 tbr, 1k tbn, 1k tbc (default)
    Metadata:
      ENCODER         : Lavc57.107.100 libx265
      DURATION        : 01:00:00.005000000
    Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1, fltp, 448 kb/s (default)
    Metadata:
      encoder         : Lavc57.107.100 ac3
frame=86400 fps=2955 q=-1.0 Lsize=  439408kB time=00:59:59.99 bitrate= 999.9kbits/s speed= 123x    

相关内容