[FFmpeg-devel] Need suggestion for ROTATION

Michel Bardiaux mbardiaux
Tue Nov 27 10:47:01 CET 2007


Tilak Adhya a ?crit :
>  
> 
> 
> On Thu, 22 Nov 2007 Michel Bardiaux wrote :
>  >Tilak Adhya a ?crit :
>  > >
>  > > Hi Micheal,
>  > >
>  >Please dont top-post.
>  >
>  > > Thanks for the reply.
>  > > Yes, I meant yuv420P. But in the ffmpeg code-base
>  > > it is really difficult to get the point, where to
>  > > add the code. We thought to add the rotation specific
>  > > code in the do_video_out() function of ffmpeg.c. Is it
>  > > a right place to add code ?
>  >
>  >The logical place would be where the re-scaler is called, maybe its
>  >there. Other logical places would be as a vhook (but (1) that API is
>  >being depercated (2) I dont know that it supports size change); and the
>  >replacement for vhhok now in development. Read the archives about vhook.
>  >
>  >Note that if your rotation *replaces* the rescaling, it must act as if a
>  >-s was specified on the output side. So your best strategy would be to
>  >remove the -s option on output, and see which variable that affects, and
>  >  remove that variable, etc... letting the compiler errors guide you.
>  >
>  >If you have to keep both -s on output and a rotation...
> 
> I am not using the rescaling. I am simply trying to rotate a frame by
> degree(say). 

Rotation of an image wxh will give an image hxw so you *do* a kind of 
rescaling, so you will have to master what the rescaler code does in ffmpeg.

> And the good news is that, I have been able to rotate the 
> frame by 90 degree in the Y plane, but not able to do the same in the U 
> and V plane. Actually, it is the YUV420P and I've confused about the no
> of U and V. strlen(AVPicture->data[0]) 

strlen? Certainly not!

> represents the product of height 
> and width but I don't get any relation for the U and V components.

For YUV420P there are wxh bytes in the Y plane, (w/2)x(h/2) in the U 
plane, ditto V. Each byte in the U plane is the average of U for the 4 
neighbouring pixels.

> 
> Again in the rotated picture I am getting only the 80% of the picture,
> I mean some portion has been truncated. Not getting any idea to proceed.

Post precise descritions! '80% of the picture' is meaningless. Unless we 
get a prize for guessing right? Hint: I suspect the output image is not 
correctly initialized (wrong w or h or linesize or ...) or incorrectly 
saved.

> 
> Could you please help me out...


-- 
Michel Bardiaux
R&D Director
T +32 [0] 2 790 29 41
F +32 [0] 2 790 29 02
E mailto:mbardiaux at mediaxim.be

Mediaxim NV/SA
Vorstlaan 191 Boulevard du Souverain
Brussel 1160 Bruxelles
http://www.mediaxim.com/




More information about the ffmpeg-devel mailing list