FFMPEG 输出视频文件但不输出音频

FFMPEG 输出视频文件但不输出音频

我正在尝试使用 FFMPEG(命令行)切片/剪切/分割视频。

它适用于视频,但不适用于音频。

我的意思是:生成的视频文件(“the-video-file-1.mpg”)可以呈现视频,但是没有声音,就像原始文件一样。

就好像 FFMPEG 不知道如何读取或写入 AC3 编解码器(我假设,通过查看控制台输出)。

知道如何解决这个问题吗?

me@my-box:~/backup$ ffmpeg -i the-video-file.mpg -vcodec copy -acodec copy -ss 00:00:00 -t 00:41:54 the-video-file-1.mpg
ffmpeg version 3.3.3-2~ubuntu16.04.1~ppa1 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
  configuration: --prefix=/usr --extra-version='2~ubuntu16.04.1~ppa1' --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-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --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-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libavresample   3.  5.  0 /  3.  5.  0
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100
Input #0, mpeg, from 'the-video-file.mpg':
  Duration: 01:07:07.12, start: 0.230389, bitrate: 4728 kb/s
    Stream #0:0[0x1bf]: Data: dvd_nav_packet
    Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, bt470bg, top first), 720x576 [SAR 16:15 DAR 4:3], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:2[0x80]: Audio: ac3, 48000 Hz, stereo, fltp, 256 kb/s
[mpeg @ 0x55968b869880] VBV buffer size not set, using default size of 130KB
If you want the mpeg file to be compliant to some specification
Like DVD, VCD or others, make sure you set the correct buffer size
[mpeg @ 0x55968b869880] ac3 in MPEG-1 system streams is not widely supported, consider using the vob or the dvd muxer to force a MPEG-2 program stream.
Output #0, mpeg, to 'the-video-file-1.mpg':
  Metadata:
    encoder         : Lavf57.71.100
    Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, bt470bg, top first), 720x576 [SAR 16:15 DAR 4:3], q=2-31, 25 fps, 25 tbr, 90k tbn, 25 tbc
    Stream #0:1: Audio: ac3, 48000 Hz, stereo, fltp, 256 kb/s
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
  Stream #0:2 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 1640 fps=0.0 q=-1.0 size=   45284kB time=00:01:06.61 bitrate=5568.5kbits/frame= 2976 fps=2975 q=-1.0 size=   78484kB time=00:02:00.36 bitrate=5341.5kbitsframe= 4013 fps=2671 q=-1.0 size=  101906kB frame=62267 fps=1259 q=-1.0 Lsize= 1472858kB time=00:41:53.98 bitrate=4799.4kbits/s speed=50.8x    trate=5038.6kbits/s speed= 111x    
video:1388209kB audio:77847kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.463944%

答案1

输入文件是 MPEG-2 程序流,但.mpg也用于 MPEG-1 程序流,因此这是 ffmpeg 默认创建的文件。

使用

ffmpeg -i the-video-file.mpg -c copy -ss 00:00:00 -t 00:41:54 -f vob the-video-file-1.mpg

相关内容