在 React 中将 Dom 转换为视频

发布于 2025-01-09 00:20:27 字数 201 浏览 1 评论 0原文

是否有任何节点模块/链接可以让我们在 React 中将 DOM 转换为视频。 我的要求是用户可以上传视频和一些文本,并且会有一个下载按钮。 一旦用户单击下载按钮,用户输入的文本应与输入视频合并并被下载。

我尝试了react-dom-to-video包,但问题是输入视频需要在录制时播放,这不是我们的要求,因为我们不能强迫用户播放整个视频。

任何帮助将不胜感激。

Is there any node module/link through which we can convert the DOM to video in react.
My requirement is that the user can upload video along with some text and there will be a download button.
Once the user clicks on the download button the text entered by the user should merge with the input video and gets downloaded.

I tried the react-dom-to-video package but the issue is that the input video needs to played while recording which is not our requirement as we can't force user to play the whole video.

any help would be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

纸短情长 2025-01-16 00:20:27

听起来您希望允许用户将他们上传的文本与他们也上传的视频合并。

如果文本将覆盖在视频上,您可以使用 ffmpeg 在服务器端执行此操作。

假设您使用 node.js 作为后端,您可以找到支持 ffmpeg 的各种软件包 - 例如: https://www.npmjs.com/package/ Fluent-ffmpeg

您还可以再次在 ffmpeg 文档中看到专用的“drawtext”过滤器,此处:https://ffmpeg.org/ffmpeg-filters.html#toc-drawtext-1< /a>

这将允许您将文本作为服务器端的覆盖层添加到视频中,然后为用户提供下载合并内容的选项。

例如,如果您想将文本添加到视频的左下角:

ffmpeg -i 输入 -I [将文本作为图像] -filter_complex 'overlay=10:main_h-overlay_h-10' 输出

您可以在此处查看 ffmpeg 过滤器文档中的其他示例: https://ffmpeg.org/ffmpeg-filters.html#toc-Examples-89

您还可以查看“drawtext”过滤器:https://ffmpeg.org/ffmpeg-filters.html#toc-drawtext-1

It sounds like you want to allow user merge text they upload with a video they also upload.

If the text will be an overlay on the video you can do this on the server side using ffmpeg.

Assuming you are using node.js as your backend, you can find various packages supporting ffmpeg - e..g.: https://www.npmjs.com/package/fluent-ffmpeg

You can also see the dedicated 'drawtext' filter, again in the ffmpeg documentation, here: https://ffmpeg.org/ffmpeg-filters.html#toc-drawtext-1

This will allow you add the text to the video as an overlay on the server side and then give the suer the option to download the merged content.

For example if you wanted to add your text to the bottom left of the video:

ffmpeg -i input -I [your text as an image] -filter_complex 'overlay=10:main_h-overlay_h-10' output

You can see other examples in the ffmpeg filter documentation here: https://ffmpeg.org/ffmpeg-filters.html#toc-Examples-89

You can also look at the 'drawtext' filter: https://ffmpeg.org/ffmpeg-filters.html#toc-drawtext-1

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文