[FFmpeg-user] Still Image tifs to uncompressed video
Michael Bradshaw
mbradshaw at sorensonmedia.com
Sun Aug 12 17:29:35 CEST 2012
On Thu, Aug 9, 2012 at 8:13 AM, Eric Hollis <eric.hollis at gmail.com> wrote:
> Hello,
>
> I have a series of 16,000 or so .tif images that I want to assemble into a
> video. I want the video to be of the highest quality possible, with no
> compression. I want to load the completed video into a video editing
> program, like Windows Movie Maker 2.6 (I'm just going to make cuts).
>
> I've read online, and gotten it to work, partially. I'm looking for some
> assistance with the command line.
>
> This command line produces a video, but it's not recognizable by Windows
> Movie Maker
>
> ffmpeg -b 3600 -r16 -i dw1%06d.tif -target ntsc-dvd dw1.mpg
>
> (tif names are "dw1000001.tif; dw1000002.tif; etc)
>
> This command line barfs:
>
> ffmpeg -b 3600 -r16 -i dw1%06d.tif dw1.mp4
>
> It returns "width or height not divisible by 2 (835x648)
>
> The tifs have sizes varying by +/- 10 pixels in x and y directions.
Neither of those options give you lossless compression (and in fact
the first one should be downsizing your images, which is even worse).
I had to create a video from a bunch of differently sized png images
once on Windows, and here's the command I used:
ffmpeg -r 30 -i %d.png -vf
"scale=min(3360/iw\,1080/ih)*iw:min(3360/iw\,1080/ih)*ih,pad=3360:1080:(3360-(min(3360/iw\,1080/ih)*iw))/2:(1080-(min(3360/iw\,1080/ih)*ih))/2"
out.mp4
My largest image was 3360x1080, which is why you see 3360 and 1080 so
much. You can replace those numbers with the width and height of your
own largest image (or bigger, if you want). This scale and pad command
will add black letterboxing and pillaring as necessary to the video
without resizing any image (and it will center each image).
You have to carefully choose your video codec though. Some video
codecs don't support odd widths or heights (as you can see), and some
give better quality than others. If you want lossless H.264 encoding
with libx264 (I believe it's defaulting to libx264 when you chose .mp4
without specifying the codec), you can pass -crf 0 to get lossless
video.
Other video codecs, like libopenjpeg, will do lossless by default.
--Michael
More information about the ffmpeg-user
mailing list