Surface-mount circuit board NC2030.

Rotating Digital Camera Movies by 90° and Converting to DVD

Rotating Video Files

Let's see how to rotate a video by 90°. Maybe you recorded a video using your smart phone or digital camera in "portrait" mode, and now you would like to watch it on something other than the phone or camera display. That means that you will need to rotate the video by 90° and probably convert it to DVD format. Here's how to do the needed video rotation and conversion.

I learned how to do this from this page However, I have updated a couple of steps described there to track changes in the mencoder tool, and I have added the steps needed to turn the result into a DVD.

All of this is easy and free with Linux, BSD, or similar!

The description is, of course, how to do this with Linux or BSD or Mac OS.

Rotate the Video

Use mencoder, part of the MPlayer package, to do this. The following assumes that input.avi is the name of the AVI video file from your camera (change as appropriate), and that it's 320x240 resolution (seems most common).

Note that I have split all of these long commands into multiple lines. The backslash character "\" means "ignore the special meaning of the following character." So if it is the last character on the line, these will work as single commands written across multiple lines. Or you can remove the backslashes and type each as a single long line. If you type one as a single line with the backslashes still in place, well, just don't do that. No good will come of it.

$ mencoder -ovc lavc \
	-lavcopts vcodec=mjpeg \
	-vf rotate=1 \
	-oac copy input.avi -o rotated.avi 

Amazon
ASIN: B01KTVJH3K

Look at the result. Is it upside down? Then you need to rotate it 90 degrees in the opposite direction. Change rotate=1 to rotate=2 in the command:

$ mencoder -ovc lavc \
	-lavcopts vcodec=mjpeg \
	-vf rotate=2 \
	-oac copy input.avi -o rotated.avi

Look at the resulting rotated.avi and verify that it's right-side up.

Pad to 4:3 Aspect Ratio

Use mencoder again to place the tall and narrow video between black borders, giving you a video stream of the right orientation and shape. Change the dimensions as appropriate for the video file created by your camera!

$ mencoder -ovc lavc \
	-lavcopts vcodec=mjpeg \
	-vf expand=427:320 \
	-oac copy rotated.avi -o padded.avi 

Look at the resulting padded.avi and verify that it resembles what you would want to see on the TV. The requested 427x320 is very close to 4:3.


Amazon
ASIN: B06W557RRR

Convert to DVD

This is taken from my page on converting PAL DVDs to NTSC. First, convert to the correct size and frame rate:

$ ffmpeg -i padded.avi \
	-target ntsc-dvd \
	-s 720x480 \
	-r 29.970 my-video-dvd.mpeg 

Next, create a new directory and build the DVD file system data structure in it:

$ mkdir my-dvd
$ dvdauthor -o my-dvd -t my-video-dvd.mpeg
$ dvdauthor -o my-dvd -T 

The result is a new directory my-dvd containing the DVD-specific subdirectories AUDIO_TS and VIDEO_TS, ready to be burned onto a DVD with K3b or similar.