I would like to create a quicktime movie from a sequence of still frames via perl. It seems like there should be a re开发者_JAVA技巧latively 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.
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.
精彩评论