Technik, Gothic und Anderes

Technik ist Spiel, Gothic ist ernst und Zeit hat man zuviel

  • Kategorien

  • Tags

  • Archiv

  • Links

    zu Bee5

    blog.oncode.info läuft bei Cyon und ich bin sehr glücklich damit.

Rotate a video (AVI) with Linux

Geschrieben von skaldrom am 6. May 2009 / deutsch

rotateToday, every camera is, every mobile is and soon every stapler will be able to record videos. Depending if your friends are rather large than tall, the recordings may have the wrong orientation after download. Fortunately there is mencoder, and with its help, it is easily possible to straighten the movies.

Rotating videos

Unfortunately, recoding the video is mandatory because -ovc copy leaves the rotation untouched.

With lavc encoding, files are rather small:

mencoder -vf rotate=1 VIDEO-INPUT.avi -ovc lavc -oac copy -o VIDEO-OUTPUT.avi

x264 provides better image-quality, but the files are larger:

mencoder -vf rotate=1 VIDEO-INPUT.avi -ovc x264 -oac copy -o VIDEO-OUTPUT.avi -x264encopts qp=26

The Parameter rotate has the following meaning:

0 Rotate by 90 degrees clockwise and flip (default).
1 Rotate by 90 degrees clockwise.
2 Rotate by 90 degrees counterclockwise.
3 Rotate by 90 degrees counterclockwise and flip.

Some more tricks

Saving a (preview-) image:

mplayer -nosound -ss 10 -frames 1 -vo png VIDEO-INPUT.avi
-vo
Can also be jpeg.
-ss 10
Take the image after 10 seconds.

Animated GIFs (256 colors only):

mplayer -nosound -ss 20 -endpos 5 -vo gif89a:fps=15:output=test.gif VIDEO-INPUT.avi
-ss 20
Start at 20 Seconds (only if the video has an index).
-endpos 5
Record 5 seconds (only if the video has an index).
fps=15
15 frames per second instead of the default 5.

For videos without index, mencoder can create one:

mencoder -forceidx -oac copy -ovc copy VIDEO-INPUT.avi -o VIDEO-OUTPUT.avi

A better solution with color adaption is described in blog..

Removing audio (for the drunken party vids :) ):

mencoder -ovc copy -nosound VIDEO-INPUT.avi -o VIDEO-OUTPUT.avi

Substitute audio:

mencoder -oac copy -ovc copy -audiofile NEW-SOUND.mp3 VIDEO-INPUT.avi -o VIDEO-OUTPUT.avi

Extract the sound as mp3:

mencoder VIDEO-INPUT.avi -of rawaudio -oac mp3lame -ovc copy -o SOUND-OUTPUT.mp3

Rip realmedia Stream:

Realmedia is a real PITA. If you want to save the stream as local file, you need to download the .rm file and search a link starting with rtsp:// inside.

mplayer -dumpstream rtsp://linkfound.in.the.rm-file.akamaistream.net/ondemand/video.rm -dumpfile output.ram

And now you need some patience…

Teile und geniesse:
  • Technorati
  • del.icio.us
  • MisterWong
  • Digg
  • StumbleUpon
  • Facebook
  • Google Bookmarks
  • Netvibes
  • Reddit
  • Twitter
  • Print
  • email
  • LinkArena


Eine Antwort zu “Rotate a video (AVI) with Linux”

Trackbacks


  1. Kurz gelinkt - Klappe die Erste | Wil and me

    [...] N97: Bald ist es soweit | Evolution der Cloud: Der Abschied von der Festplatte | Ein Video (AVI) unter linux rotieren | Zeitersparnis für Fotograf | Alles neu macht der Mai: Optimierung des Layouts | Blackberry [...]

  2. Lassen Sie eine Antwort hier...

    XHTML: Sie können folgende Tags verwenden: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>