使用 Java2D 创建视频

发布于 2024-11-19 08:34:20 字数 503 浏览 1 评论 0原文

我正在编写一个基于 Java 和 FFmpeg 的视频编辑器,并且我正在尝试找到一个库,该库允许我从通过 Java2D 渲染的帧创建视频。

我所说的“视频”是指标准格式(最好是 vp8/webm,但任何常见的格式都可以)。如果还有一些修改现有视频的工具,那就更好了,但这可能需要留给 ffmpeg。不需要音频,因为我主要使用 ffmpeg 来实现音频。

显而易见的解决方案是将每个帧保存为图像并让 ffmpeg 将它们组合起来 - 但我担心使用这种方法的性能和质量。此外,一些测试表明,即使是 1280x720 分辨率的短视频(少于 5 分钟),其尺寸也会相当大 - 我希望尽可能避免这种情况。更直接地使用压缩格式而不是大量的图像文件肯定是首选,或者至少是一些不太占用磁盘空间的方法。

我也不反对自制解决方案(我已经从头开始编写 ffmpeg 绑定),但我不知道为看起来应该相当简单的东西编写自己的 vp8 编码器有多实用。

关于去哪里有什么建议吗?或者是生成单个图像文件并稍后将它们组合的最佳解决方案?

谢谢!

I'm in the process of writing a Java and FFmpeg based video editor, and I'm trying to find a library that would allow me to create a video from frames rendered via Java2D.

By 'video' I mean in a standard format (preferably vp8/webm, but anything common should be alright). It would be a plus if there was some facility for modifying preexisting videos as well, but that may need to be left to ffmpeg. Audio isn't needed as I'll mainly be working with ffmpeg for that.

The obvious solution would be to save each frame as an image and have ffmpeg combine them - but I worry about performance and quality using this method. Additionally, some tests showed that even short videos (less than 5 minutes) at 1280x720 resolution would be pretty massive in size - which I'd like to avoid if possible. Working a little more directly with compressed formats rather than huge batches of image files would certainly be preferred, or at least some method that isn't too hungry for disk space.

I'm not against homebrew solutions either (I'm already writing the ffmpeg bindings from scratch), but I don't know how practical it would be to write my own vp8 encoder for something that seems like it should be fairly simple.

Any suggestions on where to go with this? Or is the best solution to generate a individual image files and combine them later?

Thanks!

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

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

发布评论

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

评论(1

怀中猫帐中妖 2024-11-26 08:34:20

您看过 Xuggler 吗?它应该能够按照您描述的方式对视频进行编码,尽管我还没有尝试从一系列 BufferedImages 生成视频,但这应该是可能的。

它位于 ffmpeg 之上,并且功能非常强大 - 它不是最容易上手的 API,但有很多很好的教程。

Have you had a look at Xuggler? It should be able to encode videos in the way you describe, though I haven't tried producing videos from a series of BufferedImages it should be possible.

It sits on top of ffmpeg and is pretty powerful with what it can achieve - it's not the easiest API to start with but there are a number of good tutorials around.

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