【问题标题】:ffmpeg: Concatenating webm files - output file shows first video onlyffmpeg:连接 webm 文件 - 输出文件仅显示第一个视频
【发布时间】:2016-10-19 06:53:12
【问题描述】:

我有 6 个通过 WebRTC(网络浏览器 getUserMedia API)捕获的 webm 文件(视频/音频)。单独他们都玩得很好。它们的长度均为 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”错误。

我在这里做错了什么?

【问题讨论】:

  • 所有视频的流顺序和属性应该相同。

标签: video ffmpeg webm


【解决方案1】:

最终使用了 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

【讨论】:

  • 嗨,我遇到了同样的问题,仍然使用带有“mkv”容器的 ffmpeg,它确实对我有用。
猜你喜欢
  • 1970-01-01
  • 2020-05-20
  • 2016-09-06
  • 1970-01-01
  • 2019-01-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-06-20
相关资源
最近更新 更多