Shift crop by 1px

Archive of historical feature requests.
Please use the GitHub link above to report issues.
Forum rules
*******************************

Please be aware we are now using GitHub for issue tracking and feature requests.

- This forum is now closed to new topics.
- Existing topics will remain open for a short while as the transition over occurs.
*******************************
Post Reply
v2x
Posts: 4
Joined: Sat Nov 26, 2016 1:29 am

Shift crop by 1px

Post by v2x » Sat Nov 26, 2016 2:19 am

Please describe what you would like to see added to HandBrake:
An option to perfectly crop videos with black bars that both consist of an uneven number of pixels.

Why would you like to see this added:
I have a video source that has a black bar of 61 px on top and 59px on the bottom. Cropping these would give me a neat 1920x960 video.
However the only video I can get without losing anything from the original framing is 1920x962, which would leave me with a single line of black bar on top and one on the bottom.
Maybe an option to shift the crop by a certain number of pixels vertically (or even horizontally). 1px for mod2, 1-3px for mod4, 1-7 for mod8?



What version of HandBrake are you currently running:
0.10.5.0 - 64 bit

What operating system and version and you currently running (e.g. OSX 10.11, Windows 7, Ubuntu 14):
Windows 10

Woodstock
Veteran User
Posts: 2662
Joined: Tue Aug 27, 2013 6:39 am

Re: Shift crop by 1px

Post by Woodstock » Sat Nov 26, 2016 10:33 am

Are you trying to use manual cropping and it is not cropping in the right place?

User avatar
Rodeo
HandBrake Team
Posts: 11910
Joined: Tue Mar 03, 2009 8:55 pm

Re: Shift crop by 1px

Post by Rodeo » Sat Nov 26, 2016 1:16 pm

Woodstock wrote:Are you trying to use manual cropping and it is not cropping in the right place?
We only allow cropping by an even number of pixels for each crop setting (instead of overall).

v2x, you might be able to do what you want with the command-line interface, but I'm not 100% sure.

Otherwise you could edit the crop-rect at the encoder level (e.g. H.264 encoders always use dimensions that divide evenly by 16, and use the crop-rect to "hide" pixels; x264 lets you control it directly), but it's a bit of a hack -- plus some buggy players simply ignore it and hide (encoded dimensions - storage dimensions) from the corner where all encoders usually place hidden content -- which I can't even remember what it is without reading the x264 source code.

As for the feature request, it's an interesting idea, just a bit of a pain to implement. I guess the easy solution would be to allow single-pixel crop everywhere and sanitize behind the scenes before sending the job to libhb.

musicvid
Veteran User
Posts: 3081
Joined: Sat Jun 27, 2009 1:19 am

Re: Shift crop by 1px

Post by musicvid » Sat Nov 26, 2016 1:43 pm

There have no situations where overcropping by 1 px produced anything objectionable to me.

v2x
Posts: 4
Joined: Sat Nov 26, 2016 1:29 am

Re: Shift crop by 1px

Post by v2x » Sat Nov 26, 2016 5:40 pm

I appreciate all the replies so far. I was able to crop this properly via the HandbrakeCLI tool.
I'd still love this as a feature on the GUI version in the future, but for now this will do.

v2x
Posts: 4
Joined: Sat Nov 26, 2016 1:29 am

Re: Shift crop by 1px

Post by v2x » Fri Jun 16, 2017 8:25 pm

So, with the current version of Handbrake (1.0.7) I can't parse the CLI line from the log anymore.
Any chance single-pixel crop (odd crop, instead of even) can be added to the GUI version?
Unfortunately I'm not proficient enough with the CLI to create a line that does the encode exactly as I want it to.

Post Reply