View Full Version : Turning PNG Sequences into MPEG2s?
Pookie
24th March 2006, 04:27
I have directories with PNG sequences at 1024x768. Would like to encode via commandline, maintaining same size. There's a tweaked version of Mpeg2Enc from Tytools that let's you encode at HD resolutions (yes, I know 1024x768 isn't exactly HD).
Here it is, if anyone is interested - http://www.tivofiles.com
So far, I've been able to create an uncompressed AVI with Mencoder via:
mencoder mf://*.png -mf w=1024:h=768:fps=29.97:type=png -ovc raw -oac copy -o output.avi
This results in a BGR32 AVI which Mpeg2enc rejects, as it only accepts YUV format. I suppose I could wrap the AVI in an Avisynth script, convert to YV12, AVS2YUV and pipe it into Mpeg2enc, but it seems like a lot of steps.
Is there a simpler way ? TIA
foxyshadis
24th March 2006, 09:50
Avisynth has the ability to import images into a stream, but only if they follow certain naming conditions.
It can also open the avi you've already made and convert it to yv12 with one command (ConvertToYV12) which can be fed into one of the many mpeg2 encoders that accept avisynth input. (And which would be better quality and/or faster than the one you use.)
Pookie
24th March 2006, 10:04
Indeed. Yeah, I thought about the Imagereader function in AviSynth, but it'll make automation much more difficult due to the wildcard file naming conventions.
I'm guessing it'll end up being:
PNGs-->Mencoder-->BGR32.AVI-->AviSynth-->YV12-->Avs2yuv-->Mpeg2enc-->output.mpg
hellfred
24th March 2006, 14:05
Indeed. Yeah, I thought about the Imagereader function in AviSynth, but it'll make automation much more difficult due to the wildcard file naming conventions.
I'm guessing it'll end up being:
PNGs-->Mencoder-->BGR32.AVI-->AviSynth-->YV12-->Avs2yuv-->Mpeg2enc-->output.mpg
Are your sure that you can not get MEncoder to output yv12? I guess you can even use it for encoding to mpeg2, too.
manpage of mplayer should tell you more. I guess for yv12 you can try -vf format=yv12:scale. I think, that without scale the colorspace transformation will not be enforced. See mplayer manpage of the video filters:
format[=fourcc]
Restricts the colorspace for the next filter without doing any conversion. Use together with the scale filter for a real conversion.
NOTE: For a list of available formats see format=fmt=help.
<fourcc>
format name like rgb15, bgr24, yv12, etc (default: yuy2)
scale[=w:h[:interlaced[:chr_drop[:param[:param2[:presize[:noup]]]]]]]
Scales the image with the software scaler (slow) and performs a YUV<−>RGB colorspace conversion (also see −sws).
Pookie
24th March 2006, 16:55
Hellfred - Thanks very much for the Mencoder switches. If that works, woo hoo ! :)
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.