[x264-devel] wrong cropping value when encoding interlaced content

BugMaster BugMaster at narod.ru
Wed Oct 10 19:24:30 CEST 2018


On Tue, 9 Oct 2018 15:48:39 +0000, Koby Shina wrote:
> Hi all
> I am trying to encode some interlaced video content and crop it.
>
> The source resolution is 720x480 and I need to crop it to 720x392.
> The cropping values that I set in the crop_rect member are:
> i_right = 0
> i_left = 0
> i_top = 44
> i_bottom = 44
>
> The encoder is starting fine, but it seems that one of the crop
> values in the resulted SPS is wrong.
> 2 different H264 analyzers shows :
> frame_crop_left_offset = 0
> frame_crop_right_offset = 0
> frame_crop_top_offset = 22
> frame_crop_bottom_offset = 11
>
> According to the crop values above, the resolution is 720 x 348
> While the frame_crop_bottom_offset  value is correct,
> frame_crop_top_offset is wrong and should be 11 as well (according
> to H.264 standard, CropUnitY is equal to 4 in my configuration)
>
> The source video frames are 720x480,  8 bit, 4:2:0 (NV12)
>
> My solution was to fix set.c : 288
>
> -     sps->>crop.i_top    = param->crop_rect.i_top;
> +    sps->>crop.i_top    = (param->crop_rect.i_top) >> !sps->b_frame_mbs_only;
>
>  I am using  the shared object of this version 0.157.2932 303c484
>
> Thanks for great work !
>

Hi. Thanks for the bug report. I have attached patch which should fix it.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-crop-rect-top-offset-with-interlaced-or-fake-int.patch
Type: application/octet-stream
Size: 2073 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x264-devel/attachments/20181010/5b5e7d9f/attachment.obj>


More information about the x264-devel mailing list