Page 1 of 1

Rotate Vs Transform

Posted: 30 Oct 2008 18:09
by mwahal
Hi,

I'm trying to rotate a video by 90 deg and stream it via sout. I googled and found there are two video filters, rotate and transform. Seems like somehow I can't use transform in the sout (#transcode{vfilter=transform{type=90}} doesnt work). Only rotate vfilter works in the sout->transcode.

Anyway, when I play a file locally using rotate and transform filter, I get different results. The rotate 90 deg will rotate the picture, but will clip the left and right of the original picture. So, when the picture is flipped, the video has clipped top and bottom. When playing the video using rotate, the vlc window size doesn't change, just the movie is rotated inside, thus clipping the original sides and leaving blank bars vertically.

When I use transform filter, the video is actually rotated 90 deg and the vlc window changes to show complete vertical image. Seems like transformation filter is what I really need. But somehow I can't use it inside sout->transcode->vfilter=transform. May be I'm giving some wrong syntax.

My question is if rotate filter is what its supposed to do , that means clipping the image ? I'd have thought rotate will be same as transform. I looked at the code in motion.c and it says, transform is obsolete, use rotate.

Code: Select all

#define USE_ROTATE_TEXT N_("Use the rotate video filter instead of transform")
I've attached images at the bottom for explanation.

Thanks
Mudit

Code: Select all

VLC media player 1.0.0-git Goldeneye [0x804ba38] main libvlc debug: VLC media player - version 1.0.0-git Goldeneye - (c) 1996-2008 the VideoLAN team [0x804ba38] main libvlc debug: libvlc was configured with ./configure '--prefix=/usr' '--enable-wxwidgets' '--enable-dvdread' '--enable-dvdplay' '--enable-esd' '--enable-v4l' '--enable-dvb' '--enable-x264' '--enable-lirc' '--with-ffmpeg-mp3lame' '--with-ffmpeg-faac' '--with-ffmpeg-dts' '--with-ffmpeg-vorbis' '--with-ffmpeg-ogg' '--enable-ffmpeg' '--enable-theora' '--enable-faad' '--enable-live555' '--with-live555-tree=../../liveMedia/live' '--enable-debug' '--enable-visual' '--enable-bonjour=no'

Code: Select all

vlc --snapshot-path . --snapshot-prefix normal_ 5100_20081030093409.mpg
Here is the normal image. Image

Code: Select all

vlc --snapshot-path . --snapshot-prefix rotated_ --video-filter "rotate{angle=90}" 5100_20081030093409.mpg
Here is the rotated image. Image

Code: Select all

vlc --snapshot-path . --snapshot-prefix transform_ --vout-filter=transform --transform-type=90 5100_20081030093409.mpg
Here is the transformed image --- sorry forgot deinterlacing, but you can see its completely turned 90 deg.
Image

Re: Rotate Vs Transform

Posted: 30 Oct 2008 20:17
by mwahal
I think I was looking at wrong code. The correct code is in modules/video_filter/rotate.c . I'll investigate and see how its working and compare it with transform.

Re: Rotate Vs Transform

Posted: 30 Oct 2008 22:25
by mwahal
The rotate filter is "video filter2" type and transform filter is "video filter" type. If I use vfilter=transform in the sout->transcode, I get an error message that its not supported or something. Seems like sout->transcode->vfilter only uses "video filter2" type filters.

I looked at the code of rotate and transcode. Rotate is just transposing pixels inside the same canvas where transform is actually changing the canvas's height and width. The logic is totally different. Ideally what I'd like to use is transform in the vfilter. I changed the capability of transform to video filter2, but its failing in unknown chroma. Unfortunately, I really don't know anything about vlc code or what it takes to port transform from video filter to video filter2.

Any pointers to some mailing list etc ? I dont see it on the vlc forums page.

Thanks

Mudit

Re: Rotate Vs Transform

Posted: 30 Oct 2008 22:52
by Arite

Re: Rotate Vs Transform

Posted: 17 Dec 2008 04:00
by mgroff
Any update on this? I've been trying desperately to permanently change the orientation of a .mov file (ie, rotate it 90 degrees) to no avail.

Thank you and regards,

Marcus

Re: Rotate Vs Transform

Posted: 19 Jan 2011 12:34
by vaskrist
I have wresled with this problem too and got somehow through the docs.

This is what I did when I needed to transcode, rotate and filter a video and store it as a file:
In the parameters to transcode I have chained the filters to:
1) pad the canvas so that it can accomodate the rotated video and won't get cropped (1280x720->1280x1280)
2) rotate it 90 degrees anti-clockwise
3) crop to 720x1280 after the rotation

after that it is just the two filters I wanted to use to distort the video.

vlc -I dummy -v D:\Video\in.mp4 --file-caching="20000" --sout="#transcode{vcodec=mp4v,acodec=mp4a,vb=6144,ab=128,vfilter={croppadd{paddtop=280,paddbottom=280}:rotate{angle=90}:croppadd{cropleft=280,cropright=280}:gradient{mode=gradient}:invert}}:standard{access=file,mux=mp4,dst=D:\Video\conv.mp4}" --stop-time="20"

For testing purposes I just watch the video by replacing the "standard" part with "display".