Log in

View Full Version : Cropping x264 without re-encode?


AlekseiV
22nd February 2010, 14:28
So, x264 pads and invisibly crops non-mod16 (mod4?) videos, right?

Is it possible to adjust that after encode?

For example, if I have an h.264 video from YouTube, can I crop out black bars?

I know it won't change size.

roozhou
22nd February 2010, 16:21
Yes, try this (http://forum.doom9.org/showthread.php?t=152419).

Well, only cropping of right and bottom are supported. And most decoders do not support cropping more than 15 pixels.

from libavcodec/h264_ps.c

if(sps->crop_left || sps->crop_top){
av_log(h->s.avctx, AV_LOG_ERROR, "insane cropping not completely supported, this could look slightly wrong ...\n");
}
if(sps->crop_right >= 8 || sps->crop_bottom >= (8>> !sps->frame_mbs_only_flag)){
av_log(h->s.avctx, AV_LOG_ERROR, "brainfart cropping not supported, this could look slightly wrong ...\n");

Lam3rD
22nd February 2010, 16:29
You can set the container (Matroska) to crop it by manually adding --cropping <ID>: left,top,right,bottom when you mux it in MKVMerge

Note that the older version of haali supported this flawlessly, but the new one bugs with those