ffmpeg:连接webm文件 - 输出文件仅显示第一个视频

时间:2016-06-17 12:22:55

标签: video ffmpeg webm

我有6个webm文件(视频/音频),我通过WebRTC(网络浏览器getUserMedia API)捕获。个别地他们都玩得很好。它们的长度均为15秒,每个大小为2MB。

当我使用concat demuxer(documentation)将它们与ffmpeg连接起来时,生成的输出文件是12MB(我希望如此),但是当我播放它时,它只播放第一个视频然后在15之后停止秒。尝试使用Google Chrome和VLC播放。

这是我正在使用的ffmpeg命令:

ffmpeg -f concat -i mylist.txt -c copy output3.webm

这是mylist.txt:

file 'tmpD08D.webm'
file 'tmpD08E.webm'
file 'tmpD08F.webm'
file 'tmpD090.webm'
file 'tmpD091.webm'
file 'tmpD0A1.webm'

这是ffmpeg输出:

c:\Temp\files>ffmpeg -f concat -i mylist.txt -c copy output4.webm
ffmpeg version N-72383-g7206b94 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-l
ibilbc --enable-libmodplug --enable-libmfx --enable-libmp3lame --enable-libopenc
ore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --ena
ble-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable
-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enabl
e-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable
-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --e
nable-lzma --enable-decklink --enable-zlib
  libavutil      54. 26.100 / 54. 26.100
  libavcodec     56. 41.100 / 56. 41.100
  libavformat    56. 33.101 / 56. 33.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 16.101 /  5. 16.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, concat, from 'mylist.txt':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Audio: opus, 48000 Hz, mono, fltp
    Stream #0:1: Video: vp8, yuv420p, 640x480, SAR 1:1 DAR 4:3, 30 fps, 30 tbr,
1k tbn, 1k tbc
[webm @ 00000000003a5fe0] Codec for stream 0 does not use global headers but con
tainer format requires global headers
[webm @ 00000000003a5fe0] Codec for stream 1 does not use global headers but con
tainer format requires global headers
Output #0, webm, to 'output4.webm':
  Metadata:
    encoder         : Lavf56.33.101
    Stream #0:0: Video: vp8, yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=2-31, 30 fps,
 30 tbr, 1k tbn, 1k tbc
    Stream #0:1: Audio: opus, 48000 Hz, mono
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
  Stream #0:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
[concat @ 0000000000361e20] DTS 0 < 14911 out of order
[webm @ 00000000003a5fe0] Non-monotonous DTS in output stream 0:0; previous: 149
11, current: 0; changing to 14911. This may result in incorrect timestamps in th
e output file.
[webm @ 00000000003a5fe0] Non-monotonous DTS in output stream 0:0; previous: 149
11, current: 48; changing to 14911. This may result in incorrect timestamps in t
he output file.
[webm @ 00000000003a5fe0] Non-monotonous DTS in output stream 0:1; previous: 148
69, current: 59; changing to 14869. This may result in incorrect timestamps in t
he output file.

请注意,我在ffmpeg输出中看到很多“输出流中的非单调DTS”错误。

我在这里做错了什么?

1 个答案:

答案 0 :(得分:0)

结束使用mkvmerge,它能够合并文件而没有问题。

mkvmerge.exe -w -o file1.webm + file2.webm + file3.webm

如果您的文件具有不同的音频/视频曲目顺序,则可以使用--append-to选项追加不同的曲目编号,如:

mkvmerge.exe -w -o file1.webm + file2.webm + file3.webm --append-to 2:1:1:0,2:0:1:1

追加曲目的格式:

FILE2ID:VIDEOTRACKID:FILE1ID:VIDEOTRACKID,FILE2ID:AUDIOTRACKID:FILE1ID:AUDIOTRACKID