Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to rotate a video
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
HomerSimpson
l33t
l33t


Joined: 25 Jan 2003
Posts: 869
Location: Ohio, USA

PostPosted: Tue Nov 22, 2005 4:15 am    Post subject: How to rotate a video Reply with quote

I took a short movie with my Canon camera. I copied the file onto my Gentoo box. The file created is an AVI. The file plays fine with mplayer, xine and totem. The problem is that the video is sideways. I need to rotate is 90 degrees.

Totem says it is a motion Jpeg.

When I try to load it with Kino it says "Failed to load media file".

I can load it into Cinelerra but there is no video playback.

How do I rotate this video?

Thanks
_________________
The strong must protect the Sweet.
Back to top
View user's profile Send private message
fangorn
Veteran
Veteran


Joined: 31 Jul 2004
Posts: 1886

PostPosted: Tue Nov 22, 2005 9:45 am    Post subject: Reply with quote

Kino is designed for DV streams, this is the same format but far more restrictive than just Motion JPEG.

I would use transcode or, if you are not so good with cryptic command line options :twisted: avidemux2
Back to top
View user's profile Send private message
HomerSimpson
l33t
l33t


Joined: 25 Jan 2003
Posts: 869
Location: Ohio, USA

PostPosted: Tue Nov 22, 2005 12:18 pm    Post subject: Reply with quote

Excellant!!!

I already had avidemux2 and didn't know it.

Thanks
_________________
The strong must protect the Sweet.
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20067

PostPosted: Tue Nov 22, 2005 6:04 pm    Post subject: Reply with quote

Moved from Other Things Gentoo
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
___c___
n00b
n00b


Joined: 04 Dec 2003
Posts: 61

PostPosted: Mon Dec 26, 2005 10:00 pm    Post subject: Reply with quote

i'm trying to rotate a mpeg movie ...

anyone know the cryptic command line for transcode ?
or is there an easier way ?
Back to top
View user's profile Send private message
HomerSimpson
l33t
l33t


Joined: 25 Jan 2003
Posts: 869
Location: Ohio, USA

PostPosted: Mon Dec 26, 2005 10:28 pm    Post subject: Reply with quote

It was easier for me to use avidmux2
_________________
The strong must protect the Sweet.
Back to top
View user's profile Send private message
leosgb
Apprentice
Apprentice


Joined: 07 Mar 2006
Posts: 272
Location: Rio de Janeiro, Brazil

PostPosted: Thu May 03, 2007 3:46 am    Post subject: Reply with quote

Hi guys,

I am trying to do the same and I would like to use transcode since avidemux is masked for my amd64. The ~amd64 package is file with a bug and I dont want to install it since it is not considered stable and it has known bugs.

Does anyone know what to do to rotate the movie using transcode?

Thanks!
Back to top
View user's profile Send private message
SZwarts
l33t
l33t


Joined: 13 Oct 2003
Posts: 629
Location: Sydney, NSW, Australia

PostPosted: Thu May 03, 2007 6:49 am    Post subject: Reply with quote

leosgb wrote:

I am trying to do the same and I would like to use transcode since avidemux is masked for my amd64. The ~amd64 package is file with a bug and I dont want to install it since it is not considered stable and it has known bugs.

Does anyone know what to do to rotate the movie using transcode?


Sorry not to answer your question completely, but who knows it helps... (Since I don't know transcode)..

mplayer both has a version in AMD64 and ~AMD64 and it does support rotating..

from the man page:
Code:

       rotate[=<0-7>]
              Rotates  the  image  by 90 degrees and optionally flips it.  For
              values between 4-7 rotation is only done if the  movie  geometry
              is portrait and not landscape.

                 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.


Both in realtime playback (no need to turn) and in recoding if you want to distribute...
_________________
only when it is dark enough, can you see the stars
Back to top
View user's profile Send private message
leosgb
Apprentice
Apprentice


Joined: 07 Mar 2006
Posts: 272
Location: Rio de Janeiro, Brazil

PostPosted: Thu May 03, 2007 3:50 pm    Post subject: Reply with quote

Actually I tried that without success. I did a mplayer rotate=1 movie.avi

And all it displayed was the same movie as with mplayer movie.avi.

I read many posts and many how to to use mencoder but I dont have that with my mplayer. I also tried to rotate the movie with mplayer and several other options that didnt work either. So I decided to try transcode.

But thanks for the suggestion anyway. Will continue looking.
Back to top
View user's profile Send private message
SZwarts
l33t
l33t


Joined: 13 Oct 2003
Posts: 629
Location: Sydney, NSW, Australia

PostPosted: Fri May 04, 2007 2:33 am    Post subject: Reply with quote

leosgb wrote:
Actually I tried that without success. I did a mplayer rotate=1 movie.avi

And all it displayed was the same movie as with mplayer movie.avi.

I read many posts and many how to to use mencoder but I dont have that with my mplayer. I also tried to rotate the movie with mplayer and several other options that didnt work either. So I decided to try transcode.

But thanks for the suggestion anyway. Will continue looking.


The manual page I quoted is refering to the video filters sections, I guess it would have been handy if I had mentioned that...

So,
Code:

$ mplayer tmp.avi -vf rotate=1


will do the job...

Likewise re-coding... (using default settings)
Code:

$ mencoder -oac lavc -ovc lavc -vf rotate=1 inputfile.avi -o outputfile.avi

I assume the use flag encode is needed to get mencoder...

But really there are many settings and the manpage is usefull...
_________________
only when it is dark enough, can you see the stars
Back to top
View user's profile Send private message
leosgb
Apprentice
Apprentice


Joined: 07 Mar 2006
Posts: 272
Location: Rio de Janeiro, Brazil

PostPosted: Fri May 04, 2007 5:37 am    Post subject: Reply with quote

Thanks! The mplayer command worked. And I emerging mplayer again with the encode flag. I didnt know I needed this flag to have mencoder.
Back to top
View user's profile Send private message
leosgb
Apprentice
Apprentice


Joined: 07 Mar 2006
Posts: 272
Location: Rio de Janeiro, Brazil

PostPosted: Fri May 04, 2007 6:09 am    Post subject: Reply with quote

Hi SZwarts, so I installed mencoder using the encode. I dont know if you can continue helping me thoug :)

When I ran mencoder I got a sampling rate error. Do you know what it means?

mencoder -oac lavc -ovc lavc -vf rotate=1 MVI_3350.AVI -o out.avi
MEncoder dev-SVN-rUNKNOWN-4.1.1 (C) 2000-2006 MPlayer Team
CPU: AMD Athlon(tm) 64 Processor 3500+ (Family: 15, Model: 47, Stepping: 2)
3DNow supported but disabled
3DNowExt supported but disabled
CPUflags: Type: 15 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled for x86 CPU with extensions: MMX MMX2 SSE SSE2

success: format: 0 data: 0x0 - 0xe57a38
AVI file format detected.
VIDEO: [MJPG] 320x240 24bpp 15.000 fps 2122.1 kbps (259.0 kbyte/s)
[V] filefmt:3 fourcc:0x47504A4D size:320x240 fps:15.00 ftime:=0.0667
==========================================================================
Opening audio decoder: [pcm] Uncompressed PCM audio decoder
AUDIO: 11024 Hz, 1 ch, u8, 88.2 kbit/100.00% (ratio: 11024->11024)
Selected audio codec: [pcm] afm: pcm (Uncompressed PCM)
==========================================================================
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
Opening video filter: [rotate=1]
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffmjpeg] vfm: ffmpeg (FFmpeg MJPEG decoder)
==========================================================================
[mp2 @ 0xb03580]Sampling rate 11024 is not allowed in mp2
Couldn't open codec mp2, br=224.

Exiting...
Back to top
View user's profile Send private message
tuam
l33t
l33t


Joined: 04 May 2004
Posts: 765
Location: CGN, Germany

PostPosted: Sun May 06, 2007 8:42 am    Post subject: Reply with quote

I think you need some more encoding options, something like "-lavcopts acodec=mp3:abitrate=96:vcodec=mpeg4:vbitrate=500". They are all listed in the man page under "lavcopts".

FF,

Daniel
_________________
Logic clearly dictates that the needs of the many outweigh the needs of the few. - Spock
The needs of the one outweigh the needs of the many. - Kirk
I refuse to let arithmetic decide questions like that. - Picard
Back to top
View user's profile Send private message
leosgb
Apprentice
Apprentice


Joined: 07 Mar 2006
Posts: 272
Location: Rio de Janeiro, Brazil

PostPosted: Tue May 08, 2007 5:44 am    Post subject: Reply with quote

It cant find the "mp3" encoder. I compiled my mplayer/mencoder with mp3 set. Do you have any idea what is missing?

This is the output:

mencoder -oac lavc -ovc lavc -vf rotate=1 MVI_3350.AVI -o out.avi -lavcopts acodec=mp3:abitrate=96:vcodec=mpeg4:vbitrate=500
MEncoder dev-SVN-rUNKNOWN-4.1.1 (C) 2000-2006 MPlayer Team
CPU: AMD Athlon(tm) 64 Processor 3500+ (Family: 15, Model: 47, Stepping: 2)
3DNow supported but disabled
3DNowExt supported but disabled
CPUflags: Type: 15 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled for x86 CPU with extensions: MMX MMX2 SSE SSE2

success: format: 0 data: 0x0 - 0xe57a38
AVI file format detected.
VIDEO: [MJPG] 320x240 24bpp 15.000 fps 2122.1 kbps (259.0 kbyte/s)
[V] filefmt:3 fourcc:0x47504A4D size:320x240 fps:15.00 ftime:=0.0667
==========================================================================
Opening audio decoder: [pcm] Uncompressed PCM audio decoder
AUDIO: 11024 Hz, 1 ch, u8, 88.2 kbit/100.00% (ratio: 11024->11024)
Selected audio codec: [pcm] afm: pcm (Uncompressed PCM)
==========================================================================
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
Opening video filter: [rotate=1]
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffmjpeg] vfm: ffmpeg (FFmpeg MJPEG decoder)
==========================================================================
Couldn't open codec mp3, br=96.

Exiting...
Back to top
View user's profile Send private message
kimmie
Guru
Guru


Joined: 08 Sep 2004
Posts: 531
Location: Australia

PostPosted: Tue Jun 19, 2007 2:15 pm    Post subject: Reply with quote

The error you are seeing is actually that mencoder can't open the mp3 codec at a bit rate of 96 kbps and a sample rate of 11024 Hz. But the error message conveniently leaves out that last bit.

I have the same problem, also with stuff from a Canon camera. The camera generates a mono audio stream using a sample rate of 11024Hz, which is non-standard, and the lavc mp3 codec barfs. The standard rate is 11025Hz. Somebody at Canon was off by one that day, I guess. Luckily, you can force mencoder to resample using the -srate option:

Code:
 mencoder -oac lavc -ovc lavc -lavcopts acodec=mp3:abitrate=96 -srate 11025 file.avi -o file.out.avi


Unfortunately I've found that the result has really, really bad audio/video sync (out by seconds at the end of the video). I don't really know if this is to do with the resampling or not. I suspect that getting the sync right can be tricky in general because I've seen quite a few videos people have made with bad sync. But I'm new at this too. The best audio sync I could get was by telling mplayer to simply copy the incoming audio stream, like this:

Code:
 mencoder -oac copy -ovc lavc  file.avi -o file.out.avi


But that leaves the original 11024Hz audio in the file, and some players have trouble... mplayer is fine, but totem with the xine back-end really hates it, lots of audio distortion. And even then, the sync isn't too good, it still gets noticably out in places, although it's not miles off at the end.

Let me know how you go!
Back to top
View user's profile Send private message
leosgb
Apprentice
Apprentice


Joined: 07 Mar 2006
Posts: 272
Location: Rio de Janeiro, Brazil

PostPosted: Wed Jun 20, 2007 5:04 am    Post subject: Reply with quote

Hi kimmie,

I tested your suggestion here and you are right. It does work when I resample the audio stream but then the movie only playback with audio using mplayer.

BUT if I copy the audio stream:

mencoder -oac copy -ovc lavc -vf rotate=1 in.AVI -o out.AVI

Then I get a useable file. If there is any delay I couldnt appreciate it with my short length movies. I have some longer ones but it will take me some time to go over all my movie collection to find one of my 3 minute movie.

Thank you for your input! It probably solved my problem!
Back to top
View user's profile Send private message
kimmie
Guru
Guru


Joined: 08 Sep 2004
Posts: 531
Location: Australia

PostPosted: Wed Jun 20, 2007 8:36 am    Post subject: Reply with quote

Glad that worked for you.

I found out a way to improve the sync and get a file which works with both mplayer and xine:
  1. Extract the audio from the original file as a .wav file
  2. Encode the .wav to an .mp3 using lame
  3. Recode your video, muxing in the audio you just encoded
Code:
mplayer -vo null -vc null -ao pcm:file=IN.wav IN.avi    # note 1
lame IN.wav IN.mp3
mencoder -oac copy -audiofile IN.mp3 -ovc lavc -vf-add harddup IN.avi -o OUT.avi   # note 2

# Notes:
#   1. It is normal to get the "Your system is too SLOW to play this" message here (see mplayer man page)
#   2. harddup video filter improves a/v sync (see mplayer manual section 14.1.12).
#      I tested this, it did help in my case

I've tested this with 3 minute vids, and the result is fine.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum