FFMPEG 叠加两个视频并添加文字 [英] FFMPEG overlay two video and add text

查看:46
本文介绍了FFMPEG 叠加两个视频并添加文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想叠加两个视频并在视频上添加时间.

I want to overlay two videos and add time on the video.

当我合并两个视频时

ffmpeg 
-y 
-i video1.mp4 -i video2.mp4 
-filter_complex " 
    [0:v]setpts=PTS-STARTPTS,scale=720x720[top]; 
    [1:v]setpts=PTS-STARTPTS,scale=240x240[bottom]; 
    [top][bottom]overlay=x=10:y=10:eof_action=pass" 
-acodec aac -vcodec libx264 merge.mp4

它有效.

但是当我尝试在其上添加文本

But when I try to add text on it with

ffmpeg 
-y 
-i video1.mp4 -i video2.mp4 
-filter_complex " 
    [0:v]setpts=PTS-STARTPTS,scale=720x720[top]; 
    [1:v]setpts=PTS-STARTPTS,scale=240x240[bottom]; 
    [top][bottom]overlay=x=10:y=10:eof_action=pass; 
    drawtext=fontfile=Arial.ttf:text=yo" 
-acodec aac -vcodec libx264 merge.mp4

我出错了

在过滤器 Parsed_drawtext_5 上找不到未标记的输入板 0 的匹配流

Cannot find a matching stream for unlabeled input pad 0 on filter Parsed_drawtext_5

我应该如何修改我的命令

How should I modify my command

推荐答案

对链中另一个过滤器的输出进行操作的过滤器应该用逗号分隔.所以,

Filters which operate upon the output of another filter in a chain, should be separated by a comma. So,

[top][bottom]overlay=x=10:y=10:eof_action=pass, 
    drawtext=fontfile=Arial.ttf:text=yo"

这篇关于FFMPEG 叠加两个视频并添加文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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