video - FFMPEG画中画

标签 video ffmpeg

我尝试在特定时间将视频的一部分放入视频中。

这是我的命令:

./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

但我收到“缓冲区队列溢出,丢失”消息,我认为这会使我的 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。

最佳答案

尝试

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=shortestoverlay=x=25:y=25:enable='between(t,5, 20):最短=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

关于video - FFMPEG画中画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35461197/

相关文章:

encoding - 缩小 H264 视频的最快方法是什么 2 :1?

video - Avconv/FFmpeg - VOB 到 mp4

ffmpeg 将传入的 RTP 音频仅流保存到文件

javascript - 为 onclick() Action 覆盖 JS 视频播放器

python - 有没有办法在 python 中编写视频崩溃安全?

c++ - 如何在基本视频流中寻找特定帧?

ffmpeg - ffmpeg 错误 "Prediction is not allowed in AAC-LC"是什么意思?

video - 创建没有视频转码的 OpenCV 项目(ffmpeg 部分)在 Linux 上的支持如何?

html - 使用 ffmpeg 旋转的视频无法在 IE9 的 flowplayer 中播放

android - Grafika 和 OpenGL 在 android 上以方形录制视频