[Ffmpeg-devel] [PATCH] fix error croping

Baptiste Coudurier baptiste.coudurier
Tue Apr 3 13:56:17 CEST 2007

Limin Wang wrote:
> Hi,
>>>> I think the correct solution is to implement support for the desired 
>>>> pixel format in av_picture_crop().
>>> So the next picture pading should use enc->pix_fmt instead of dec->pix_fmt?
>> Check input picture and his pixel format, and it's right atm.
> The input video is from v4l2 capture device and its format is PIX_FMT_YUV420P
> from the ffmpeg output result. My question is padding process should be use
> dec->pix_fmt instead of enc->pix_fmt also?

Padding occurs after resampling, so padding is applied on picture with
enc->pix_fmt. If no resampling is applied, dec->pix_fmt == enc->pix_fmt
of course, so this has no importance.

Now I don't remember why cropping is needed when padding and resampling
is requested. Luca might I think.

>>> For padding is OK and I check it uses enc->pix_fmt, based on this I try with
>>> enc->pix_fmt for crop, and the fact is the crop test result is OK. 
>> crop test cannot be ok, if you supply packed input you'll get this:
>> "error cropping picture"
> yes, it reports error cropping picture, after change to enc->pix_fmt, it's ok
> without problem. 

you cannot change pix_fmt like that, it's wrong. pix_fmt supplied to
av_picture_crop must be input picture pix_fmt.

Can you please post full ffmpeg commandline and output ?

Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
SMARTJOG S.A.                                    http://www.smartjog.com
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
Phone: +33 1 49966312

More information about the ffmpeg-devel mailing list