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

Koby Shina koby at zixi.com
Tue Oct 9 17:48:39 CEST 2018


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 !

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x264-devel/attachments/20181009/7097332f/attachment.html>


More information about the x264-devel mailing list