ffmpeg使用dts-ma将视频转码为ac3

时间:2012-12-08 19:50:03

标签: ffmpeg

我正在尝试拍摄具有h264视频轨道和dts-ma音轨的视频,然后输出.m4v文件:

h264视频曲目 DTS-ma音轨 AC-3 5.1音轨

我正在尝试复制视频和dts-ma音轨,然后将其转换为AC-3音轨

我从此命令收到错误Unable to find a suitable output format for 'ac3'

ffmpeg -i "input.mkv" -map 0:0 -map 0:1 -map 0:1 -map 0:1 -c:v copy -c:a:0 copy -c:a:1 -acodec ac3 -ac 6 -ab 448k -c:a:2 -acodec ac3 -ac 6 -ab 256 -ar 48000 "output.m4v"

(这是由我的C#app生成的)

这对于已经安装了h264和ac3的其他文件可以正常工作:

ffmpeg -i "input.mkv" -map 0:0 -map 0:1 -c:v copy -c:a:0 copy "output.m4v"

显然它没有做转换。

以下是第一个命令的完整结果:

ffmpeg version N-46936-g8b6aeb1 Copyright (c) 2000-2012 the FFmpeg developers
  built on Nov 20 2012 19:34:37 with gcc 4.7.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-pthreads --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass -
-enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopenjpeg --enable-libo
pus --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-li
bvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52.  8.100 / 52.  8.100
  libavcodec     54. 74.100 / 54. 74.100
  libavformat    54. 37.100 / 54. 37.100
  libavdevice    54.  3.100 / 54.  3.100
  libavfilter     3. 23.101 /  3. 23.101
  libswscale      2.  1.102 /  2.  1.102
  libswresample   0. 17.101 /  0. 17.101
  libpostproc    52.  2.100 / 52.  2.100
Input #0, matroska,webm, from 'input.mkv':
  Metadata:
    creation_time   : 2012-12-07 22:11:56
  Duration: 01:41:23.38, start: 0.000000, bitrate: 33582 kb/s
    Chapter #0.0: start 0.000000, end 186.250000
    Metadata:
      title           : 00:00:00.000
    Chapter #0.1: start 186.250000, end 512.708000
    Metadata:
      title           : 00:03:06.250
    Chapter #0.2: start 512.708000, end 883.292000
    Metadata:
      title           : 00:08:32.708
    Chapter #0.3: start 883.292000, end 1354.000000
    Metadata:
      title           : 00:14:43.292
    Chapter #0.4: start 1354.000000, end 1865.458000
    Metadata:
      title           : 00:22:34.000
    Chapter #0.5: start 1865.458000, end 2122.500000
    Metadata:
      title           : 00:31:05.458
    Chapter #0.6: start 2122.500000, end 2386.125000
    Metadata:
      title           : 00:35:22.500
    Chapter #0.7: start 2386.125000, end 2801.167000
    Metadata:
      title           : 00:39:46.125
    Chapter #0.8: start 2801.167000, end 2923.000000
    Metadata:
      title           : 00:46:41.167
    Chapter #0.9: start 2923.000000, end 3388.500000
    Metadata:
      title           : 00:48:43.000
    Chapter #0.10: start 3388.500000, end 3808.167000
    Metadata:
      title           : 00:56:28.500
    Chapter #0.11: start 3808.167000, end 4071.375000
    Metadata:
      title           : 01:03:28.167
    Chapter #0.12: start 4071.375000, end 4378.750000
    Metadata:
      title           : 01:07:51.375
    Chapter #0.13: start 4378.750000, end 4681.583000
    Metadata:
      title           : 01:12:58.750
    Chapter #0.14: start 4681.583000, end 4989.792000
    Metadata:
      title           : 01:18:01.583
    Chapter #0.15: start 4989.792000, end 5311.667000
    Metadata:
      title           : 01:23:09.792
    Chapter #0.16: start 5311.667000, end 5629.083000
    Metadata:
      title           : 01:28:31.667
    Chapter #0.17: start 5629.083000, end 6083.382000
    Metadata:
      title           : 01:33:49.083
    Stream #0:0(eng): Video: h264 (High), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 24 fps, 24 tbr, 1k tbn, 48 tbc (default)
    Stream #0:1(eng): Audio: dts (DTS-HD MA), 48000 Hz, 5.1(side), fltp, 1536 kb/s (default)
[NULL @ 03f4b020] Unable to find a suitable output format for 'ac3'
ac3: Invalid argument

1 个答案:

答案 0 :(得分:7)

问题可能是因为添加了参数-acodec

-acodec-codec:a-c:a的别名。

由于您已使用-c:a:X指定了曲目,因此您不需要-acodec

这应该有效:

ffmpeg -i "input.mkv" -map 0:0 -map 0:1 -map 0:1 -map 0:1 -c:v copy -c:a:0 copy -c:a:1 ac3 -ac 6 -ab 448k -c:a:2 ac3 -ac 6 -ab 256 -ar 48000 "output.m4v"