[FFmpeg-devel] Need suggestion for ROTATION

Tilak Adhya tilakadhya
Thu Nov 22 14:59:58 CET 2007

Hi Micheal,

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 ?
And for this rotation purpose, we need to rearrange the
byte sequence of data[0], then the height and width
will both be changed. So we need a new picture. This is
my idea. Is it correct ?

Can you tell me some good link such that I can make good
knowledge in YUVxyzP kind of stuff.

Awaiting for your reply...


On Thu, 22 Nov 2007 Michel Bardiaux wrote :
>Tilak Adhya a ?crit :
> >
> > Hi All,
> >
> > I am new to this list. I am trying to add one feature to the
> > ffmpeg code base regarding the rotation. FFmpeg does not have
> > any support for frame level rotation. My requirement is to
> > rotate(90, 180, 270 degrees ) a movie, before streaming.
> >
> > Now, first we thought that, we would create a new AVPicture
> > with the new data and linesize fields and rearrange the data[0],
> > data[1] and data[2] pointers for the rotated movie. But while
> > doing this, we faced lot of problems regarding the modification
> > of data and height and width fields.
> > So we decided to first convert this YUV format to RGB format
> > using img_convert() fuction and then rotate the picture in the
> > RGB level and then again convert it to the YUV format. But in
> > this procedure the main concerns are how to rotate a picture in
> > RGB format and how much feasible this approach is. Actually in
> > a 15fps movie the extra operations will be two image conversions
> > (YUV -> RGB and RGB -> YUV) and rotation in the RGB plane for each
> > frame.
> >
> > Now my question is, which procedure we will take to rotate a movie
> > and what is the concept of rotation in the YUV plane for a movie.
> > Need your suggestion in this regard...
> >
>First of all, dont use "YUV", there are too many different meanings.
>ITIYM yuv420p, the most common format lavc decodes to.
>Now, for YUV420P, you rotate the bytes in the Y plane (data[0]) just as
>if they were a sequence of greytone bytes. Then the same for the U and V
>planes, except they are 2x2 times smaller.
>For YUV444P, the same except the 3 planes have the same size.
>For YUV422P, you have a problem: U and V are averages on the line, and
>after rotation the lines would become columns, and the averages would
>have to be on different pixels. So you will have to go through YUV444P,
>but that is lighter than going through RGB.
>Short version: if you can rotate greytone, you can rotate YUVxyzP.
>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
>ffmpeg-devel mailing list
>ffmpeg-devel at mplayerhq.hu


More information about the ffmpeg-devel mailing list