Sunday, February 11, 2007

Converting and rotating video files

Converting your video files SUPER © Simplified Universal Player Encoder & Renderer. Is a GUI to ffmpeg, MEncoder, mplayer, x264, mppenc, ffmpeg2theora & the theora/vorbis RealProducer plugIn. Simply put, it allows you to easily convert your video file from one format to another. http://www.erightsoft.com/SUPER.html download page: http://www.erightsoft.net/S6Kg1.html Rotating your video files Super also contains MPlayer as well as mencoder. Scott Hanselman has documented how to rotate the video from the command line using the mplayer and mencoder tools. (Useful as it might give you better control over the conversion process and the Super GUI does not have a way to specify rotations.) mplayer>mencoder -vf rotate=1 -o OUTPUT.AVI -oac copy -ovc lavc INPUT.AVI The -vf is for "Video Filter" and you can chain them, like -vf rotate=1,flip,scale=640:480 if you like. The -oac and -ovc are the audio and video outputs. In this case, I "copy" the audio over, and use the "libavcodecs" for the output. You can do mencoder -ovc help to get a list of choices or read the massive docs. At this point, I have a really tall 480x640 video, since it used to be at 640x480. Certainly I can leave it there, or I can expand it to a more regular 4:3 ratio. As it's now 640 tall, it'll need to be 853x640 to be 4:3. mplayer>mencoder -vop expand=853:640 -oac copy ovc lavc -lavcopts vcodec=mjpeg OUTPUT.AVI -o BIGOUTPUT.AVI Notice that the portrait is now centered between black bars like a vertical DVD. The aspect ratio is correctish now and we have a vertically oriented video inside a horizontally oriented "container." I probably (and you as well) should use "raw" as your output format as you move through these steps, as we're making copies of copies here and the quality is getting worse and worse. You'll end up with gigabyte-size temp files, for a bit, but your output will be much better. Next I'll just scale the video back to 640x480 for posting on the web. mplayer>mencoder -ovc lavc -lavcopts vcodec=mjpeg -vop scale=640:480 -oac copy BIGOUTPUT.AVI -o FINAL.AVI It is suggested the final encoding pass be done by FFMPEG, rather than mencoder: mplayer>c:\utils\ffmpeg_mp2.exe" -i finaltest.avi -sameq -acodec pcm_u8 -vcodec mjpeg FFMPEGOUTPUT.AVI (read the complete article at : http://feeds.feedburner.com/~r/ScottHanselman/~3/89281094/HowToRotateAnAVIOrMPEGFileTakenInPortrait.aspx) Another tool that is much more simpiler to use for this purpose is the professional version of the Apple's QuickTime Player. But its not free!

No comments: