用FFmpeg设置时间偏移后叠加视频 [英] Overlay video after set time offset with FFmpeg

查看:295
本文介绍了用FFmpeg设置时间偏移后叠加视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过ffmpeg在视频开始后出现一段时间添加重叠式广告。



添加叠加层的基本方法是: / p>

  ffmpeg -i in.avi -vfmovie = overlay.avi [ovl]; [in] [ovl] overlayout但是,这会从输入视频的开始添加重叠视频(或图像)直到一个的视频结束。



我知道如何使用来补偿重叠影片movie = overlay.avi:seek_point = 1.4 ,但输入视频的偏移量如何?



我可以随时将视频剪辑到所需的位置,在第二个剪辑上添加叠加,然后缝合两个,

解决方案

展开 arttronics的洞察力,但推测的答案视频确实可以很容易地被覆盖偏移使用 -itsoffset 标志。



-itsoffset 标志的作用如下:


-itsoffset 偏移输入



设置输入时间偏移量(以秒为单位)。 [ - ] hh:mm:ss [.xxx]语法也受支持。偏移量被添加到输入文件的时间戳。指定正偏移意味着相应的流被延迟偏移量秒。


(注意:尽管短语输入文件 s ,该标志实际上仅适用于紧随其后的输入。另请注意这个bug 关于不适用于音频流的偏移量。H / T attronics 。)



所以用偏移量重叠一样简单:

  ffmpeg -i bg.avi -itsoffset 2 -i over.avi -filter_complex overlay out.avi 

不管容器类型如何。


I'm trying to add overlays to an input video with ffmpeg that appear some time after the video starts.

The basic way to add an overlay is:

ffmpeg -i in.avi -vf "movie=overlay.avi [ovl]; [in][ovl] overlay" out.avi

But this adds the overlay video (or image) from the start of the input video until one of the videos ends.

I know how to offset the overlay video using movie=overlay.avi:seek_point=1.4, but what about an offset on the input video?

I could always clip the video to the desired point, add overlay on the second clip, then stitch the two but that's not very efficient.

解决方案

Expanding on arttronics' insightful, but speculative answer, video can indeed be easily be overlaid offset using the -itsoffset flag.

The -itsoffset flag works like so:

-itsoffset offset (input)

Set the input time offset in seconds. [-]hh:mm:ss[.xxx] syntax is also supported. The offset is added to the timestamps of the input files. Specifying a positive offset means that the corresponding streams are delayed by offset seconds.

(NB: Despite the phrase "input files", the flag actually applies only to the input immediately following it. Note also this bug about offsets not applying to audio streams. H/T attronics.)

So overlaying with an offset is as simple as:

ffmpeg -i bg.avi -itsoffset 2 -i over.avi -filter_complex overlay out.avi

This works regardless of the container type.

这篇关于用FFmpeg设置时间偏移后叠加视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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