lossless PNG to video in Imagemagick

4

2

As an intermediate step in creating an animation, I need to put a bunch of sequential PNGs into a movie file. I tried ffmpeg but was getting compression and artifacting even when I set quality to maximum.

Because this clip will be used in ANOTHER clip, I'd very much rather not compress it twice.

So I'm looking at Imagemagick to get a lossless PNG to Video conversion but am having trouble finding an equivalent command line call.

Any help?

Drew

Posted 2012-03-26T02:11:51.790

Reputation: 1 682

2You could supply the original command you used and we can tell you what's wrong with it. – slhck – 2012-03-26T05:48:38.400

did you use "-vcodec rawvideo" and not select a specific codec , nor shrunk the resolution in ffmpeg and still got compression? – Psycogeek – 2012-03-26T05:59:42.797

Answers

3

As you haven't given the command line you used we can only guess, but this ffmpeg command will generate a lossless video clip from files named frame00.png, frame01.png, frame02.png, etc.

ffmpeg -i frame%02d.png -codec png out.mov

The resulting video should work as input to at least ffmpeg, mplayer and VLC.

Adjust the framerate using an -r option before the -i.

OrangeDog

Posted 2012-03-26T02:11:51.790

Reputation: 679

1

I don't think Imagemagick has an appropriate tool, but this can be done with mencoder. You didn't specify how the encoded video should look, so I suggest lossless (crf=0) h.264, and will use that for this example.

mencoder -ovc x264 -x264encopts crf=0 -of rawvideo  mf://*.png -o video.h264

This will result in a raw h.264 stream with one frame for every *.png file in the current directory.

The stream can be muxed into a container or directly modified with some other software.

Eroen

Posted 2012-03-26T02:11:51.790

Reputation: 5 615