What the crop?

Random chit-chat and anything that doesn't belong elsewhere
Post Reply
Woodstock
Veteran User
Posts: 4094
Joined: Tue Aug 27, 2013 6:39 am

What the crop?

Post by Woodstock »

Had a machine that wasn't doing anything today, so I decided to test whether cropping makes for smaller files, or the easy-to-compress letterbox would win out with smaller sizes.

Test file is the Bluray version of Logans Run, which is 1920x1080 on disk, 140 pixels worth of letter box top and bottom, netting 1920x800 screen size.

Testing with v1.3.x of handbrake, using a modified Fast 1080p30 preset. Modifications were to shut down all filters on the filter tab, set the audio to AC3 copy (MakeMKV created the AC3 track from DTS HD MA), frame rate set to "variable same as source", subtitles and chapters removed, RF=20.

First run was automatic cropping to 1920x800, x264 as the encoder. Second run was no cropping, 1920x1080, x264. There are additional runs being made with QSV doing the encoding, but that doesn't seem to be working.

Code: Select all

Cropped: 7,584,582kb
No crop: 7,661,244kb
So, cropping does shrink the file size, as expected. But, it isn't a massive difference, only about 1%.
mduell
Veteran User
Posts: 7433
Joined: Sat Apr 21, 2007 8:54 pm

Re: What the crop?

Post by mduell »

The resulting quality is also different, since the big flat simple black areas change how the RF quality metric thinks its doing.
Woodstock
Veteran User
Posts: 4094
Joined: Tue Aug 27, 2013 6:39 am

Re: What the crop?

Post by Woodstock »

Perhaps; it wasn't noticeable in my limited testing. I was only looking at the size, and RF=20 on a BD source should have covered for a fair amount of potential quality issues (default for the preset was RF=22).

I did the same test using the qsv_h264 encoder, which used QP=20, and got smaller files than the x264 fast preset.

Code: Select all

Cropped: 6,119,780kb
No Crop: 6,552,968kb
Here the size difference was more pronounced.

Maybe I should run the same test with x264 and a slower preset...
Woodstock
Veteran User
Posts: 4094
Joined: Tue Aug 27, 2013 6:39 am

Re: What the crop?

Post by Woodstock »

To confirm what has been mentioned before, slower encoder settings do not necessarily mean smaller files. I queued up the same cropped/uncropped encodes with the x264 encoder set to "very slow". Only one of them (cropped) has completed so far, and the result is the largest file so far, and 7,972,890kb.

Life is so much simpler when you don't fret over little stuff like this...
mduell
Veteran User
Posts: 7433
Joined: Sat Apr 21, 2007 8:54 pm

Re: What the crop?

Post by mduell »

Same RF isn't constant quality across different encoder settings.

Need to compare objective quality metrics (and use the appropriate tunes), or do proper double blind subjective testing, for real results.
rollin_eng
Veteran User
Posts: 3914
Joined: Wed May 04, 2011 11:06 pm

Re: What the crop?

Post by rollin_eng »

Would also be interesting to see if cropping has any effect on speed? Perhaps we could see your logs :)
Woodstock
Veteran User
Posts: 4094
Joined: Tue Aug 27, 2013 6:39 am

Re: What the crop?

Post by Woodstock »

But why would you need the logs? Don't you believe me? :)

I've got the logs all isolated for future posting.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5585
Joined: Sat Feb 09, 2008 7:21 pm

Re: What the crop?

Post by JohnAStebbins »

Woodstock wrote: Fri Feb 19, 2021 3:54 pm But why would you need the logs? Don't you believe me? :)

I've got the logs all isolated for future posting.
We'll be allowed to see them after the requisite 2 week covid quarantine .
Woodstock
Veteran User
Posts: 4094
Joined: Tue Aug 27, 2013 6:39 am

Re: What the crop?

Post by Woodstock »

As fast as the last encode is going, it might be two weeks... Very slow is making almost 3 frames per second on my hardware.

Summary portions, uncropped 1080p Fast:

Code: Select all

[16:09:12] vc1-decoder done: 170508 frames, 0 decoder errors
[16:09:12] sync: got 170507 frames, 170508 expected
[16:09:12] sync: framerate min 23.976 fps, max 23.976 fps, avg 23.976 fps
x264 [info]: frame I:1824  Avg QP:14.67  size:157300
x264 [info]: frame P:55230 Avg QP:18.07  size: 59347
x264 [info]: frame B:113453 Avg QP:20.83  size: 32655
x264 [info]: consecutive B-frames: 10.6%  1.4%  1.8% 86.2%
x264 [info]: mb I  I16..4: 37.0%  0.0% 63.0%
x264 [info]: mb P  I16..4:  2.2%  0.0%  6.2%  P16..4: 35.6% 19.8%  9.1%  0.0%  0.0%    skip:27.1%
x264 [info]: mb B  I16..4: 10.0%  0.0%  1.5%  B16..8: 25.4% 10.5%  0.6%  direct:17.1%  skip:34.9%  L0:44.5% L1:40.9% BI:14.6%
x264 [info]: coded y,uvDC,uvAC intra: 81.7% 78.2% 35.4% inter: 30.3% 36.3% 2.5%
x264 [info]: i16 v,h,dc,p: 20% 12% 51% 16%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 17% 21%  7%  8%  7%  8%  6%  7%
x264 [info]: i8c dc,h,v,p: 58% 19% 20%  4%
x264 [info]: Weighted P-Frames: Y:5.4% UV:1.9%
x264 [info]: ref P L0: 56.4% 43.6%
x264 [info]: ref B L0: 75.9% 24.1%
x264 [info]: ref B L1: 92.3%  7.7%
x264 [info]: kb/s:8177.60
[16:12:44] mux: track 0, 170507 frames, 7269375055 bytes, 8177.43 kbps, fifo 1024
[16:12:44] mux: track 1, 222238 frames, 568929280 bytes, 640.00 kbps, fifo 2048
[16:12:44] Finished work at: Wed Feb 17 16:12:44 2021
[16:12:44] libhb: work result = 0
Cropped 800p Fast:

Code: Select all

[13:28:53] vc1-decoder done: 170508 frames, 0 decoder errors
[13:28:53] sync: got 170507 frames, 170508 expected
[13:28:53] sync: framerate min 23.976 fps, max 23.976 fps, avg 23.976 fps
x264 [info]: frame I:1798  Avg QP:18.30  size:155722
x264 [info]: frame P:56987 Avg QP:21.20  size: 58471
x264 [info]: frame B:111722 Avg QP:22.64  size: 32034
x264 [info]: consecutive B-frames: 12.3%  0.6%  1.2% 85.9%
x264 [info]: mb I  I16..4: 16.4%  0.0% 83.6%
x264 [info]: mb P  I16..4:  3.0%  0.0%  8.4%  P16..4: 46.0% 26.6% 12.7%  0.0%  0.0%    skip: 3.3%
x264 [info]: mb B  I16..4: 13.6%  0.0%  2.0%  B16..8: 31.7% 14.0%  0.8%  direct:24.8%  skip:13.1%  L0:44.5% L1:41.0% BI:14.6%
x264 [info]: coded y,uvDC,uvAC intra: 85.1% 78.3% 37.7% inter: 43.8% 50.1% 2.9%
x264 [info]: i16 v,h,dc,p: 19% 11% 54% 17%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 17% 21%  7%  9%  7%  8%  6%  7%
x264 [info]: i8c dc,h,v,p: 59% 16% 21%  4%
x264 [info]: Weighted P-Frames: Y:8.0% UV:3.1%
x264 [info]: ref P L0: 56.2% 43.8%
x264 [info]: ref B L0: 75.3% 24.7%
x264 [info]: ref B L1: 92.1%  7.9%
x264 [info]: kb/s:8089.31
[13:32:24] mux: track 0, 170507 frames, 7190889168 bytes, 8089.14 kbps, fifo 1024
[13:32:24] mux: track 1, 222238 frames, 568929280 bytes, 640.00 kbps, fifo 2048
[13:32:24] Finished work at: Wed Feb 17 13:32:24 2021
[13:32:24] libhb: work result = 0
Cropped was around 1 frame per second faster to encode, because there was less TO encode.
Woodstock
Veteran User
Posts: 4094
Joined: Tue Aug 27, 2013 6:39 am

Re: What the crop?

Post by Woodstock »

To see if the cropping affected x265 results in the same way, I ran one encode each with the "H.265 MKV 1080p30" preset, modified in the same way as the x264 presets (no filters, RF=20, variable frame rate same as source). This took a LOT longer on my hardware, as expected, but here are the relative file sizes:

Code: Select all

Cropped: 5,942,287kb
No Crop: 6,171,095kb
So, in the tested cases, cropping reduced the file size a few percentage points.
rollin_eng
Veteran User
Posts: 3914
Joined: Wed May 04, 2011 11:06 pm

Re: What the crop?

Post by rollin_eng »

% wise, is there any speed difference?
Woodstock
Veteran User
Posts: 4094
Joined: Tue Aug 27, 2013 6:39 am

Re: What the crop?

Post by Woodstock »

Measurable, but I wouldn't call them huge.

Fast x264 preset, 19.389250/18.127485 fps, cropped/uncropped, not quite 7% faster.
Very Slow x264, 2.809664/2.620724 fps, slightly more than 7% faster.

The others had extenuating circumstances (other encodes being run on the machine at the same time), so their average FPS is suspect. Extrapolating the favorable results like agencies with an agenda would, the amount of cropping would have the greatest affect the speed of encoding, because there would be more or less data flowing in to the encoder.

With the limited data set, though, Your Mileage May Vary, certain exclusions apply.
Woodstock
Veteran User
Posts: 4094
Joined: Tue Aug 27, 2013 6:39 am

Re: What the crop?

Post by Woodstock »

Generally speaking, handbrake is not suffer from "disk I/O bottlenecks". I'm reading AND writing to a gigabit-capable NAS, at far below its capabilities. I can do multiple simultaneous rips with MakeMKV while handbrake is encoding, and handbrake keeps the 4-core 8-thread i5 CPU saturated.

But speed wasn't the goal of this "test" (term used lightly); it was determining what affect cropping had on size of the result. Testing it with different encoder presets was an afterthought.
Post Reply