如何通过 Perl 从一系列图像创建 QuickTime 电影?
我想通过 Perl 从一系列静止帧创建一个 QuickTime 电影。看起来应该有一个比较简单的方法可以做到这一点,但到目前为止我还没有找到。我尝试过的事情:
阅读 Quicktime 文件规范并从头开始创建电影文件。过去,这种低级方法对于 TIFF 和 PDF 文件格式非常有效,但 Quicktime 似乎极其复杂。
查看各种与 Quicktime 相关的 Perl 模块。到目前为止,我还没有找到一个可以让我毫不费力地做我想做的事情(图像 --> 电影)。
使用 Applescript 和 Quicktime Player。如果我付费购买 Quicktime Pro,这可能会起作用,但我不想这样做。
我对任何关于以相对简单的方式将图像序列组装成 Quicktime 影片的建议(甚至是非基于 Perl 的建议)感兴趣。
I would like to create a quicktime movie from a sequence of still frames via perl. It seems like there should be a relatively simple way to do this, but so far I have not found it. Things I've tried:
Reading the Quicktime file spec and creating the movie file from scratch. This low level approach has worked well for me in the past with TIFF and PDF file formats, but Quicktime seems dauntingly complicated.
Looking at the various quicktime-related perl modules. So far I haven't found one that lets me do what I want (images --> movie) with a minimum of fuss.
Using Applescript and Quicktime Player. This would probably work if I paid for Quicktime Pro, but I'd prefer not to do that.
I'm interested in any suggestions (even non-perl-based ones) for a relatively simple way to assemble a sequence of images into a quicktime movie.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于 perl 来说,视频编码并不是真正的理想工作——有很多部分需要组合在一起。我建议只使用 mencoder - 您可以使用例如的输入
-mf type=png:fps=30 mf://frame*.png
,输出格式为例如-of lavf -ovc lavc -lavcopts vcodec=libx264 -owhatever.mov
。如果您想在音频中进行配音,可以使用-audiofilewhatever.mp3
,然后使用-acodec copy
(如果您希望它在电影中也是 MP3),或者如果电影中的音频格式需要为 AAC,则可能是-acodec faac
(和-faacopts
)。有很多不同的选项需要调整和学习,但它几乎是完成这项工作的理想工具。 FFmpeg 在很多方面都更好用,但它没有 mf:// 输入模式,这使得从帧组装视频变得更加痛苦。Video encoding isn't really an ideal job for perl -- there are a lot of pieces to put together. I would suggest just using mencoder -- you can use an input of e.g.
-mf type=png:fps=30 mf://frame*.png
, and an output format of e.g.-of lavf -ovc lavc -lavcopts vcodec=libx264 -o whatever.mov
. If you want to dub in audio you can use-audiofile whatever.mp3
, and then either-acodec copy
if you want it to be MP3 in the movie as well, or perhaps-acodec faac
(and-faacopts
) if the audio format in the movie needs to be AAC. There are lots of different options to tweak and things to learn but it's pretty much the ideal tool for the job. FFmpeg is nicer to use in a lot of ways, but it doesn't have the mf:// input mode, which makes assembling a video from frames a lot more painful.