如何使用流映射将 VOB 文件与 ffmpeg 连接起来?

如何使用流映射将 VOB 文件与 ffmpeg 连接起来?

我有 5 个 VOB 文件,我想将它们合并为一个大的 mpegts 文件,并只保留视频流和最后一个(第 3 个)音频流。不幸的是,VOB 中的流顺序不同:

    Input #0, mpeg, from 'VTS_01_1.VOB':
      Duration: 00:25:03.00, start: 0.280633, bitrate: 5715 kb/s
        Stream #0:0[0x1bf]: Data: dvd_nav_packet
        Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv), 720x576 [SAR 64:45 DAR 16:9], max. 7500 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
        Stream #0:2[0x20]: Subtitle: dvd_subtitle
        Stream #0:3[0x80]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
        Stream #0:4[0x81]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
        Stream #0:5[0x82]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
    [mpeg2video @ 0x82d3600] Invalid frame dimensions 0x0.
        Last message repeated 5 times

Input #1, mpeg, from 'VTS_01_2.VOB':
      Duration: 00:24:51.03, start: 1503.128633, bitrate: 5761 kb/s
        Stream #1:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv), 720x576 [SAR 64:45 DAR 16:9], max. 7500 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
        Stream #1:1[0x21]: Subtitle: dvd_subtitle
        Stream #1:2[0x80]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
        Stream #1:3[0x81]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
        Stream #1:4[0x82]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
        Stream #1:5[0x1bf]: Data: dvd_nav_packet
        Stream #1:6[0x20]: Subtitle: dvd_subtitle
    [mpeg2video @ 0x86aff00] Invalid frame dimensions 0x0.
        Last message repeated 8 times

Input #2, mpeg, from 'VTS_01_3.VOB':
      Duration: 00:24:17.94, start: 2993.976633, bitrate: 5891 kb/s
        Stream #2:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv), 720x576 [SAR 64:45 DAR 16:9], max. 7500 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
        Stream #2:1[0x80]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
        Stream #2:2[0x81]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
        Stream #2:3[0x82]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
        Stream #2:4[0x1bf]: Data: dvd_nav_packet
        Stream #2:5[0x20]: Subtitle: dvd_subtitle
        Stream #2:6[0x21]: Subtitle: dvd_subtitle
    [mpeg2video @ 0x868fc20] Invalid frame dimensions 0x0.
        Last message repeated 8 times

Input #3, mpeg, from 'VTS_01_4.VOB':
      Duration: 00:24:38.52, start: 4451.800633, bitrate: 5809 kb/s
        Stream #3:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv), 720x576 [SAR 64:45 DAR 16:9], max. 7500 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
        Stream #3:1[0x80]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
        Stream #3:2[0x81]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
        Stream #3:3[0x82]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
        Stream #3:4[0x1bf]: Data: dvd_nav_packet
    [mpeg2video @ 0x83a4aa0] Invalid frame dimensions 0x0.
        Last message repeated 9 times

Input #4, mpeg, from 'VTS_01_5.VOB':
      Duration: 00:02:45.18, start: 5930.104633, bitrate: 5897 kb/s
        Stream #4:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv), 720x576 [SAR 64:45 DAR 16:9], max. 7500 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
        Stream #4:1[0x80]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
        Stream #4:2[0x81]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
        Stream #4:3[0x82]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
        Stream #4:4[0x1bf]: Data: dvd_nav_packet

所以我尝试了这个命令:

ffmpeg -y f concat -i list.txt -map 0:v -map 0:a:2 -map 1:v -map 1:a:2 -map 2:v -map 2:a:2 -map 3:v -map 3:a:2 -map 4:v -map 4:a:2 -c copy -f mpegts joined.mpeg

其中 list.txt 包含

file VTS_01_1.VOB
file VTS_01_2.VOB
file VTS_01_3.VOB
file VTS_01_4.VOB
file VTS_01_5.VOB

不幸的是不起作用,完整的输出:

ffmpeg -y -f concat -i list.txt -map 0:v -map 0:a:2 -map 1:v -map 1:a:2 -map 2:v -map 2:a:2 -map 3:v -map 3:a:2 -map 4:v -map 4:a:2 -c copy -f mpegts joined.mpeg
ffmpeg version 2.3.1 Copyright (c) 2000-2014 the FFmpeg developers
  built on Jul 31 2014 14:53:16 with gcc 4.9.1 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --enable-avisynth --enable-avresample --enable-decoder=atrac3 --enable-decoder=atrac3p --enable-dxva2 --enable-fontconfig --enable-gnutls --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libv4l2 --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-pic --enable-postproc --enable-runtime-cpudetect --enable-shared --enable-swresample --enable-vdpau --enable-version3 --enable-x11grab
  libavutil      52. 92.100 / 52. 92.100
  libavcodec     55. 69.100 / 55. 69.100
  libavformat    55. 48.100 / 55. 48.100
  libavdevice    55. 13.102 / 55. 13.102
  libavfilter     4. 11.100 /  4. 11.100
  libavresample   1.  3.  0 /  1.  3.  0
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 19.100 /  0. 19.100
  libpostproc    52.  3.100 / 52.  3.100
[concat @ 0x893b1c0] Estimating duration from bitrate, this may be inaccurate
Input #0, concat, from 'list.txt':
  Duration: 00:00:00.00, start: 0.000000, bitrate: 573 kb/s
    Stream #0:0: Data: dvd_nav_packet
    Stream #0:1: Video: mpeg2video (Main), yuv420p(tv), 720x576 [SAR 64:45 DAR 16:9], max. 7500 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:2: Subtitle: dvd_subtitle
    Stream #0:3: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
    Stream #0:4: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
    Stream #0:5: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
Invalid input file index: 1.

如何实现应用流映射的连接?

答案1

您可以使用catshell 中的命令将.vob文件连接为一个。

以下是一个例子:

要将同一目录中的file1.vobfile2.vob和连接起来,可以使用以下命令:file3.vobAllfiles.vob

cat file*.vob > Allfiles.vob

相关内容