Nitty gritty of cropping?

General questions or discussion about HandBrake, Video and/or audio transcoding, trends etc.
Post Reply
ChrisJenkins
Posts: 12
Joined: Sun May 29, 2011 7:19 pm

Nitty gritty of cropping?

Post by ChrisJenkins »

Can someone explain when cropping is applied and how it relates to the final/output picture size as set in the Picture settings?

Let me give a concrete example to illustrate my confusion.

I have some source material that has storage dimensions of 720x576 and which is 14:9 (1.555:1) aspect ratio. When it is played there are black bars all around the picture. Removing those leaves a real picture area (pixels) of 686x494. So, I guess I need to encode this to output as (custom) anamorphic 768 (494*1.555) x 494? But with cropping set to T:52, B:30, L:16, R:10 Handbrake defaults to an output height of 576. So does this mean I should really encode to a target of 896 (576*1.5555) x 576? Or...

Basically, is cropping applied to the source then the result (after cropping) 'scaled' to the specified output size? Or should the specified output size reflect the 'cropped' dimensions (adjusted for anamorphism etc.)?

Thanks for any enlightenment.
TedJ
Veteran User
Posts: 5388
Joined: Wed Feb 20, 2008 11:25 pm

Re: Nitty gritty of cropping?

Post by TedJ »

While PAL DVD video has a standard storage frame size of 720x576, it's displayed at either 768*576 (4:3) or 1024*576 (16:9) - for a 14:9 ratio source, this would be presented as a mildly letterboxed 4:3 transfer, so the display frame size should be in the vicinity of 768x494.

What happens if you use anamorphic strict or loose? An activity log supplied with your post would be appreciated.
ChrisJenkins
Posts: 12
Joined: Sun May 29, 2011 7:19 pm

Re: Nitty gritty of cropping?

Post by ChrisJenkins »

Thanks for the reply. I'm sorry if my example misled on the nature of my question. I'm fully conversant with PAL DVD encoding, 4:3 versus 16:9 etc. I just used that example to illustrate my specific question which is about when cropping is applied and how that affects the overall encoding flow. The HandBrake help is silent on this important aspect.

My assumption is that if cropping is specified it is applied to the display size of the source material and then the cropped source is passed into the output processing stage. i.e. using my example (purely for illustrative purposes) a source of display size 768x576, cropped using T:52, B:30, L:16, R:10 (giving a cropped display size of 742x576) is handled exactly the same as a source with an original display size of 742x494 with regards to output processing?

Is this correct or is there more to it than this?

Thanks.
TedJ
Veteran User
Posts: 5388
Joined: Wed Feb 20, 2008 11:25 pm

Re: Nitty gritty of cropping?

Post by TedJ »

No, the cropping is applied to the source frame then the appropriate PAR is applied to get the scaled display size.

Your example would be much clearer if you provided an activity log.
mduell
Veteran User
Posts: 8198
Joined: Sat Apr 21, 2007 8:54 pm

Re: Nitty gritty of cropping?

Post by mduell »

TedJ wrote:Your example would be much clearer if you provided an activity log.
This, this, a million times this, as always.

It's in bold red at the top of every page for a reason.
Deleted User 31589

Re: Nitty gritty of cropping?

Post by Deleted User 31589 »

I think I know what Chris means. I have the same question too. Here's an example, but with an NTSC source. The storage dimensions are 720x480, even after cropping 4 pixels off the left side. I've also noticed that there's a notable decrease in the file sizes of cropped content which seems odd considering I'm only cropping off a green bar on the side which should be very compressible.

Code: Select all

[00:43:54] 1 job(s) to process
[00:43:54] starting job
[00:43:54] sync: expecting 2901 video frames
[00:43:54] job configuration:
[00:43:54]  * source
[00:43:54]    + D:\STARGATE_ATLANTIS_S2_D2\VIDEO_TS\VTS_09_1.VOB
[00:43:54]    + title 1, start 0:0:0.00 stop 0:2:0.00
[00:43:54]  * destination
[00:43:54]    + D:\Videos\Vts 09 1-3.mp4
[00:43:54]    + container: MPEG-4 (.mp4 and .m4v)
[00:43:54]      + 64-bit formatting
[00:43:54]  * video track
[00:43:54]    + decoder: mpeg2
[00:43:54]      + bitrate 9800 kbps
[00:43:54]    + frame rate: 23.976 fps -> peak rate limited to 29.970 fps
[00:43:54]    + loose anamorphic
[00:43:54]      + storage dimensions: 720 * 480 -> 720 * 480, crop 0/0/4/0, mod 0
[00:43:54]      + pixel aspect ratio: 1432 / 1215
[00:43:54]      + display dimensions: 848 * 480
[00:43:54]    + encoder: H.264 (x264)
[00:43:54]      + quality: 20.00 (RF)
[00:43:54]  * audio track 1
[00:43:54]    + decoder: Unknown (AC3) (5.1 ch) (track 1, id 0x8000bd)
[00:43:54]      + bitrate: 448 kbps, samplerate: 48000 Hz
[00:43:54]    + mixdown: Dolby Pro Logic II
[00:43:54]    + encoder: AAC (faac)
[00:43:54]      + bitrate: 160 kbps, samplerate: 48000 Hz
[00:43:54] file is MPEG Program Stream
[00:43:54] Probing 1 unknown stream
[00:43:54]     Probe: Found stream mpeg2video. stream id 0xe0-0x0
[00:43:54] reader: first SCR 146 id 0xe0 DTS 15180
[00:43:55] encx264: min-keyint: 24, keyint: 240
[00:43:55] encx264: encoding with stored aspect 1432/1215
[00:43:55] encx264: Encoding at constant RF 20.000000
x264 [warning]: --psnr used with psy on: results will be invalid!
x264 [warning]: --tune psnr should be used if attempting to benchmark psnr!
x264 [info]: [00:43:55] mpeg2: "" (1) at frame 0 time 3003
using SAR=1432/1215
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
x264 [info]: profile High, level 3.0
[00:43:55] sync: first pts is 3003
[00:45:16] sync: reached pts 10801791, exiting early
[00:45:22] work: average encoding speed for job is 35.228352 fps
[00:45:22] sync: got 2878 frames, 2901 expected
[00:45:22] reader: done. 1 scr changes
[00:45:22] mpeg2 done: 7130 frames
[00:45:22] render: 2878 frames output, 0 dropped and 0 duped for CFR/PFR
[00:45:22] render: lost time: 0 (0 frames)
[00:45:22] render: gained time: 0 (0 frames) (0 not accounted for)
x264 [info]: frame I:65    Avg QP:16.69  size: 31454  PSNR Mean Y:48.06 U:51.85 V:52.45 Avg:48.82 Global:48.35
x264 [info]: frame P:1339  Avg QP:21.13  size: 10748  PSNR Mean Y:44.80 U:48.33 V:48.47 Avg:45.65 Global:44.98
x264 [info]: frame B:1474  Avg QP:22.85  size:  2230  PSNR Mean Y:45.15 U:48.57 V:49.06 Avg:46.00 Global:45.30
x264 [info]: consecutive B-frames: 21.4% 26.3% 13.4% 38.8%
x264 [info]: mb I  I16..4:  7.3% 81.1% 11.5%
x264 [info]: mb P  I16..4:  1.9% 13.8%  1.6%  P16..4: 42.2% 20.0%  9.0%  0.0%  0.0%    skip:11.6%
x264 [info]: mb B  I16..4:  0.1%  0.4%  0.1%  B16..8: 42.8%  4.3%  0.8%  direct: 2.2%  skip:49.3%  L0:40.3% L1:50.9% BI: 8.7%
x264 [info]: 8x8 transform intra:80.1% inter:79.0%
x264 [info]: coded y,uvDC,uvAC intra: 80.3% 79.7% 39.4% inter: 25.3% 28.5% 1.7%
x264 [info]: i16 v,h,dc,p: 30% 17%  6% 47%
x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 15% 18%  6%  8%  9%  8%  9%  9%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 18% 15%  6% 10%  9%  8%  7%  5%
x264 [info]: i8c dc,h,v,p: 51% 19% 20% 10%
x264 [info]: Weighted P-Frames: Y:5.5% UV:3.6%
x264 [info]: ref P L0: 66.3% 18.1% 11.8%  3.7%  0.1%
x264 [info]: ref B L0: 92.5%  6.7%  0.8%
x264 [info]: ref B L1: 97.5%  2.5%
x264 [info]: SSIM Mean Y:0.9834617 (17.815db)
x264 [info]: PSNR Mean Y:45.048 U:48.530 V:48.860 Avg:45.894 Global:45.195 kb/s:1314.62
[00:45:22] mux: track 0, 2878 frames, 19720183 bytes, 1314.28 kbps, fifo 2048
[00:45:22] mux: track 1, 5626 frames, 2400260 bytes, 159.97 kbps, fifo 4096
[00:45:22] stream: 89466 good frames, 0 errors (0%)
[00:45:22] libhb: work result = 0
Encode done!
HandBrake has exited.
Post Reply