How To Make Video From Image Sequence
четверг 07 мая admin 66
I have a large set of jpgs that I want to convert to a video losslessly (or, at the very least, very close to losslessly as long as the encoding time isn't much higher than otherwise).Naively, I would think that there should be some codec that can store each individual jpg frames as-is (without recompression), and perhaps achieve some nice compression by replacing some of the frames by just the information on the delta from the previous frame. In my case there are many sequences of frames which are identical to each other, or that have a tiny difference between them.Is there some codec and suitable settings for ffmpeg that can achieve this? Just mux the imagesYou can simply mux the JPG images to make a video: ffmpeg -framerate 30 -i input%03d.jpg -codec copy output.mkvNote that if you omit -framerate then a default of -framerate 25 will be applied to the input. Lossless optimizationYou can use jpegtran to perform lossless optimization on each frame which may provide significant file size savings: mkdir outputdirfor f in.jpg; do jpegtran -optimize -copy none -perfect -v '$f' 'outputdir/$f'; doneNow mux with ffmpeg as shown above. This will output a lossless H.264 video where frames will use information from other framesffmpeg -f image2 -r 30 -i%09d.jpg -vcodec libx264 -profile:v high444 -refs 16 -crf 0 -preset ultrafast a.mp4Explanation of options:.f image2 - tells ffmpeg to select a group of images.r 30 - tells ffmpeg to encode at 30 frames (or images) per second (change this to your desired framerate).i%09d.jpg - tells ffmpeg to use the images 000000000.jpg to 999999999.jpg as the input.
Change the 9 in%09d.jpg to how many zeroes the names of your image sequence has. Refs 5 at MOST, unless you know your content has identical images separated by several other ones, that might cause x264 to lose the reference before it gets to the duplicate.
Higher than ultrafast makes little different in lossless mode, other than CABAC's 10% gain over CAVLC (for a high cpu cost at the bitrates required for lossless). Seriously, on some live-action 720x480p60 (deinterlace output), superfast was 28GB, slower was 27GB. If encode time doesn't matter, but decode time does, make sure you avoid CABAC.
If we use only these 7 images then the video will be played within 1.4 seconds. And you may not be able to view the images in the video. So in order to make all the images viewable for certain time, each frame is replicated 5 times. Houdini 9.5.230 for mac.

Maybe even -tune fastdecode. Moderate ref count shouldn't hurt.–Jan 17 '15 at 14:16.
This easy workaround allows you to turn your image sequences into playable video clips within FCPX.FCPX editors working with image sequences will often opt to convert their still images to a video clip in a third party application such as Adobe After Effects. After all, After Effects (like most other compositing or motion graphics software) was designed to function with an image-sequence-based workflow.