ffmpeg drawtext

编程入门 行业动态 更新时间:2024-10-25 22:27:40
ffmpeg drawtext - 仅在剪切矩形内绘制(ffmpeg drawtext - only draw within clipping rectangle)

关于过滤器的ffmpeg文档在drawtext的剪切矩形上没有任何内容。 我希望在视频过滤器之前可以设置一个设置来设置剪辑矩形,未记录的功能或巧妙的解决方法,以便您只能在输出视频的某个边界框内绘制文本。

我试图通过滴答作响的时钟视频覆盖电影标题。 这些可能很长,我不希望它们溢出到时钟的一部分。 我知道如何叠加文字。 我目前正在通过使用较短版本的标题来解决这个问题。

这是需要过滤器图形或中间视频文件的东西还是可以通过简单的视频过滤器完成?

The ffmpeg documentation on filters doesn't have anything on a clipping rectangle for drawtext. I'm hoping there might be a setting I can put before a video filter to set a clip rect, an undocumented feature or a clever workaround so that you can draw the text only within a certain bounding box on the output video.

I'm trying to overlay movie titles over a ticking clock video. These might be long and I don't want them to spill over onto part of the clock. I know how to overlay text already. I am currently working around this by using a shorter version of the title.

Is this something that requires filter graphs or intermediate video files or can it be done with a simple video filter?

最满意答案

在此处输入图像描述

方法1:字幕过滤器

假设你想要简单的剪辑,而不是有限的自动换行,你可以使用ASS字幕。 请参阅视觉排版 - Aegisub 。

一旦你创建了字幕文件, ffmpeg命令很简单:

ffmpeg -i input -filter_complex "subtitles=subs.ass" output

如果你想避免使用Aegisub,你可以手动制作简单的SRT样式子,然后使用force_style选项设置剪辑坐标。 请参阅字幕过滤器文档 。

方法2:作物

另一种方法是使用裁剪,drawtext和overlay过滤器。 您可以在Blur特定区域(不带遮罩)中调整示例。

enter image description here

Method 1: subtitles filter

Assuming you want simple clipping, and not bounded word wrapping, you can use ASS subtitles. See Visual Typesetting - Aegisub.

Once you make your subtitles file the ffmpeg command is simple:

ffmpeg -i input -filter_complex "subtitles=subs.ass" output

If you want to avoid using Aegisub you can manually make simple SRT style subs and then use the force_style option to set the clipping co-ordinates. See the subtitles filter documentation.

Method 2: crop

Another method would be to use crop, drawtext, and overlay filters. You can adapt the example in Blur specific area (without a mask).

更多推荐

本文发布于:2023-08-07 20:25:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1465628.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:ffmpeg   drawtext

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!