我尝试在特定时间将视频的一部分放入视频中。
这是我的命令:
./ffmpeg-3.0-32bit-static/ffmpeg \
-y \
-i main.mp4 \
-itsoffset -10 \
-i overlay.mp4 \
-filter_complex \
"[1:a] atrim=5:20 [1:a1]; \
[1:a1] adelay=5000|5000 [1:a2]; \
[0:a][1:a2] amix [outa]; \
[1:v] scale=120:-1 [1:v1]; \
[0:v][1:v1] overlay=x=25:y=25:enable='between(t,5,20)'[outv]" \
-map "[outv]" \
-map "[outa]" \
-c:a aac \
-c:v libx264 \
-vb 1000k \
-r 24 \
-strict -2 \
output.mp4
但是我已经得到了#34;缓冲区队列溢出,掉线"我认为,这些消息使我的overlay.mp4在output.mp4上有点生涩:
[Parsed_overlay_4 @ 0xc29d9c0] [framesync @ 0xc29da84] Buffer queue overflow, dropping.
Last message repeated 50 times
[Parsed_overlay_4 @ 0xc29d9c0] [framesync @ 0xc29da84] Buffer queue overflow, dropping.0.927x
[Parsed_overlay_4 @ 0xc29d9c0] [framesync @ 0xc29da84] Buffer queue overflow, dropping.=2.72x
Last message repeated 33 times
[Parsed_overlay_4 @ 0xc29d9c0] [framesync @ 0xc29da84] Buffer queue overflow, dropping.=2.72x
Last message repeated 14 times
[Parsed_overlay_4 @ 0xc29d9c0] [framesync @ 0xc29da84] Buffer queue overflow, dropping.=2.97x
Last message repeated 13 times
[Parsed_overlay_4 @ 0xc29d9c0] [framesync @ 0xc29da84] Buffer queue overflow, dropping.=3.16x
Last message repeated 35 times
[Parsed_overlay_4 @ 0xc29d9c0] [framesync @ 0xc29da84] Buffer queue overflow, dropping.=3.35x
Last message repeated 45 times
[Parsed_overlay_4 @ 0xc29d9c0] [framesync @ 0xc29da84] Buffer queue overflow, dropping.=3.46x
Last message repeated 5 times
知道为什么吗?
编辑:忘了说我已经获得了最后一个版本的ffmpeg => 3.0。答案 0 :(得分:1)
尝试
ffmpeg -y -i main.mp4 -i overlay.mp4 \
-filter_complex \
"[1:a] atrim=15:30,adelay=5000|5000 [a1]; \
[0:a][a1] amix [outa]; \
[1:v] scale=120:-1,setpts=PTS-(10/TB) [1v]; \
[0:v][1v] overlay=x=25:y=25:enable='between(t,5,20)'[outv]" \
-map "[outv]" -map "[outa]" \
-c:a aac -c:v libx264 \
-b:v 1000k \
-r 24 \
output.mp4
如果您的叠加层长于主要输入,请使用amix=duration=shortest
和overlay=x=25:y=25:enable='between(t,5,20):shortest=1
对于同一视频,
ffmpeg -y -i main.mp4 \
-filter_complex \
"[0:a]asplit[a1][a2];
[a2] volume=0:enable='between(t\,0,15)',asetpts=PTS-(10/TB) [a3]; \
[a1][a3] amix [outa]; \
[0:v]fps=24,split[v1][v2];
[v2] scale=120:-1,setpts=PTS-(10/TB) [v3]; \
[v1][v3] overlay=x=25:y=25:enable='between(t,5,20)'[outv]" \
-map "[outv]" -map "[outa]" \
-c:a aac -c:v libx264 \
-b:v 1000k \
output.mp4