奇怪的“暂停"在两个MP4视频串联后的视频中 [英] Strange "pause" in video after concatenation of two mp4 videos

查看:65
本文介绍了奇怪的“暂停"在两个MP4视频串联后的视频中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要连接两个mp4视频.问题在于,第一个视频(intro.mp4)持续5秒,第二个视频(output.mp4)持续2秒,将它们串联而成的视频持续9秒(并且应持续5 + 2 = 7秒).在final.mp4视频中,在播放第二个视频(output.mp4)之前,我还显示了来自第一个视频(intro.mp4)的最后一帧2秒钟.观看视频时似乎有点滞后.我在做什么错了?

I am concatenating two mp4 videos. The problem is that first video (intro.mp4) lasts 5 seconds, second video (output.mp4) lasts 2 seconds and video created by concatenating them lasts 9 seconds (and should last 5+2 = 7 seconds). In final.mp4 video the last frame from first video (intro.mp4) i shown for additional 2 seconds before second video (output.mp4) is played. It looks like a lag when watching video. What I am doing wrong?

list.txt:

file 'data/intro.mp4'
file 'output.mp4'

命令:

./bin/ffmpeg -f concat -i list.txt -c copy final.mp4

输出:

ffmpeg version 2.7.2 Copyright (c) 2000-2015 the FFmpeg developers
  built with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
  configuration: --prefix=/Volumes/Ramdisk/sw --enable-gpl --enable-pthreads --enable-version3 --enable-libspeex --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --enable-libgsm --enable-libvidstab --enable-libx265 --disable-doc --arch=x86_64 --enable-runtime-cpudetect
  libavutil      54. 27.100 / 54. 27.100
  libavcodec     56. 41.100 / 56. 41.100
  libavformat    56. 36.100 / 56. 36.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 16.101 /  5. 16.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.100 /  1.  2.100
  libpostproc    53.  3.100 / 53.  3.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f8a6a80e600] Auto-inserting h264_mp4toannexb bitstream filter
Input #0, concat, from 'list.txt':
  Duration: N/A, start: 0.000000, bitrate: 1296 kb/s
    Stream #0:0: Video: h264 (High) (avc1 / 0x31637661), yuv420p, 960x540, 1163 kb/s, 23.98 fps, 23.98 tbr, 11988 tbn, 47.95 tbc
    Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 133 kb/s
[mp4 @ 0x7f8a6c006a00] Codec for stream 0 does not use global headers but container format requires global headers
[mp4 @ 0x7f8a6c006a00] Codec for stream 1 does not use global headers but container format requires global headers
Output #0, mp4, to 'final.mp4':
  Metadata:
    encoder         : Lavf56.36.100
    Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 960x540, q=2-31, 1163 kb/s, 23.98 fps, 23.98 tbr, 11988 tbn, 11988 tbc
    Stream #0:1: Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, stereo, 133 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f8a6a80e600] Auto-inserting h264_mp4toannexb bitstream filter
frame=  258 fps=0.0 q=-1.0 Lsize=     997kB time=00:00:09.84 bitrate= 829.5kbits/s    
video:897kB audio:93kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.634306%

推荐答案

我在处理2个mpg文件时遇到了同样的问题.我正在使用以下命令:

I was having the same problem with 2 mpg files. I was using this command:

ffmpeg -i"concat:foo.mpg | bar.mpg |"-c复制out.mpg

ffmpeg -i "concat:foo.mpg|bar.mpg|" -c copy out.mpg

我找到了此链接:

https://ffmpeg.org/pipermail/ffmpeg-user/2013-March/013933.html

建议在输入文件(即如下所示的文件)中使用duration指令显式设置持续时间:

which suggested setting the duration explicitly with the duration directive in an input file, i.e. a file looking like this:

file foo.mpg
duration 6
file bar.mpg
duration 4.5

数字以秒为单位.

奇怪的是,当我切换到使用文件中的输入列表时,即使不设置持续时间,问题也消失了.很奇怪.我仔细检查了一下,并始终在命令行列表中暂停了该命令,在文本文件中始终没有该文件列表..显然,这对您不起作用,因为您已经有了一个输入列表文件,但是持续时间技巧可能值得尝试.

Oddly, when I switched to using an input list from a file, the problem went away even without setting the duration. Very odd. I double checked and consistently got the pause with the command line list and none with the file list in a text file.. Obviously that's not working for you, as you've already got an input list file, but the duration trick might be worth a try.

这篇关于奇怪的“暂停"在两个MP4视频串联后的视频中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆