You are not logged in.

#1 2011-10-12 08:43:26

kahlil88
Member
From: Mendocino, CA
Registered: 2010-08-10
Posts: 138
Website

Unable to rotate video

Trying to rotate some home movies that were filmed sideways by mistake. They just need to be rotated 90° counter-clockwise, and I've tried with both mencoder and ffmpeg but neither of them actually rotates the videos.

mencoder VIDEO.AVI -vf rotate=2 -oac copy -ovc copy -o VIDEO-ROTATED.AVI
ffmpeg -i VIDEO.AVI -acodec copy -vcodec copy -vf rotate=2 VIDEO-ROTATED.AVI

There is no system but GNU and Linux is one of its kernels.

Offline

#2 2011-10-12 08:57:58

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Unable to rotate video

mencoder -vf rotate=2 -oac pcm -ovc lavc input.file -o output.file 

works for me.

Offline

#3 2011-10-12 21:50:12

kahlil88
Member
From: Mendocino, CA
Registered: 2010-08-10
Posts: 138
Website

Re: Unable to rotate video

Maybe my videos are just too weird a format for it to handle? Here is the output of 'ffmpeg -i'

$ ffmpeg -i VIDEO.AVI 
ffmpeg version 0.7.6, Copyright (c) 2000-2011 the FFmpeg developers
  built on Oct  3 2011 13:04:32 with gcc 4.6.1 20110819 (prerelease)
  configuration: --prefix=/usr --enable-libmp3lame --enable-libvorbis --enable-libxvid --enable-libx264 --enable-libvpx --enable-libtheora --enable-postproc --enable-shared --enable-x11grab --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libschroedinger --enable-libopenjpeg --enable-librtmp --enable-gpl --enable-version3 --enable-runtime-cpudetect --disable-debug
  libavutil    50. 43. 0 / 50. 43. 0
  libavcodec   52.122. 0 / 52.122. 0
  libavformat  52.110. 0 / 52.110. 0
  libavdevice  52.  5. 0 / 52.  5. 0
  libavfilter   1. 80. 0 /  1. 80. 0
  libswscale    0. 14. 1 /  0. 14. 1
  libpostproc  51.  2. 0 / 51.  2. 0
Input #0, avi, from 'VIDEO.AVI':
  Metadata:
    encoder         : Lavf52.110.0
  Duration: 00:03:55.40, start: 0.000000, bitrate: 6094 kb/s
    Stream #0.0: Video: mjpeg, yuvj420p, 640x480, 14.99 tbr, 14.99 tbn, 14.99 tbc
    Stream #0.1: Audio: mp3, 44100 Hz, stereo, s16, 224 kb/s

There is no system but GNU and Linux is one of its kernels.

Offline

#4 2011-10-12 22:14:20

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: Unable to rotate video

Lets take the ffmpeg example, you have "-acodec copy -vcodec copy" this will copy the video and audio streams directly to the output file, to rotate the video you need to re-encode it so directly copying it is not an option, for the audio it should be ok.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#5 2011-10-12 22:21:36

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Unable to rotate video

R00KIE wrote:

Lets take the ffmpeg example, you have "-acodec copy -vcodec copy" this will copy the video and audio streams directly to the output file, to rotate the video you need to re-encode it so directly copying it is not an option, for the audio it should be ok.

+1
When I used '-ovc copy' the video remained unrotated.

Offline

#6 2011-10-12 22:44:07

kahlil88
Member
From: Mendocino, CA
Registered: 2010-08-10
Posts: 138
Website

Re: Unable to rotate video

So there's no way to losslessly rotate it?


There is no system but GNU and Linux is one of its kernels.

Offline

#7 2011-10-13 10:39:40

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: Unable to rotate video

kahlil88 wrote:

So there's no way to losslessly rotate it?

Not that I know of, it could be possible to use a container format that would allow you to specify the desired rotation, which when used with a player that supports output rotation would make it work as you want, but I don't know if that's possible or widely supported.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#8 2011-10-13 17:27:43

DrZaius
Member
Registered: 2008-01-02
Posts: 193

Re: Unable to rotate video

kahlil88 wrote:
ffmpeg -i VIDEO.AVI -acodec copy -vcodec copy -vf rotate=2 VIDEO-ROTATED.AVI

The filter used to rotate video in FFmpeg is called transpose:

ffmpeg -i VIDEO.AVI -acodec copy -vcodec mjpeg -qscale 2 -vf transpose=2 VIDEO-ROTATED.AVI

You didn't mention a specific output format, so I just used the same as the input.

kahlil88 wrote:

So there's no way to losslessly rotate it?

You could use a lossless format, but the file will be much bigger.

ffmpeg -i VIDEO.AVI -acodec copy -vcodec huffyuv -vf transpose=2 VIDEO-ROTATED.mkv

I know you can losslessly rotate jpg images with jpegtran for example, but I'm not sure about mjpeg.

Offline

#9 2011-10-14 04:03:02

ConnorBehan
Package Maintainer (PM)
From: Long Island NY
Registered: 2007-07-05
Posts: 1,359
Website

Re: Unable to rotate video

Mplayer can of course use the rotate and transpose filters for playback. But I guess that only helps if you never want to use another player.


6EA3 F3F3 B908 2632 A9CB E931 D53A 0445 B47A 0DAB
Great things come in tar.xz packages.

Offline

Board footer

Powered by FluxBB