News:

--

Main Menu

Filter "Add Borders" decreases output quality?

Started by guju, January 20, 2019, 05:42:41 PM

Previous topic - Next topic

guju

I take a movie, crop it to something only near (!) to 4:3,
set that DAR in stream and container, save as hevc.
Then play that and output a frame.

Then again in Avidemux I add borders above and below (2 x 6 pixels)
to make the frame dimension match exactly the DAR of 4:3.
Result:
The output frames have noticeably less details compared to the ones
from the non-DAR movie.

Can someone please explain that to me?
If anything at all, I would have expected the non-DAR frames being worse.
How can the addition of horizontal (!) borders decrease the overall quality?

eumagga0x2a

Each generation of lossy compression worsens the quality. The question should have been, if you don't apply any video filters and simply re-encode the video a second time, does the unfiltered output video exhibit a significantly better quality than with filters like "Add Borders"?

guju

The answer to your question is "Yes".

... as you got me wrong.
I did not take the result of the first as input of the second.

Starting point of BOTH was a cropped movie.
Test A is to save as-is, test B is to do "Add Border" before saving.
I saved it as hevc.
Loaded that movies into MPC-HC and let it export a single frame.

Frame of B is less detailed.

dosdan

Quote from: guju on January 20, 2019, 11:37:01 PM

Starting point of BOTH was a cropped movie.
Test A is to save as-is, test B is to do "Add Border" before saving.
I saved it as hevc.
Loaded that movies into MPC-HC and let it export a single frame.

Frame of B is less detailed.

Was the BPF, Bits/(Pixel*Frame), as reported by MediaInfo, similar for encoded clips A & B?

Dan.

guju

My MediaInfo (v18.03) doesn't report BPF for HEVC streams.
Still (on a 15s example) the borderless A strip is 5% larger (!)
than the one with added border (DAR exact 4:3).

However I didn't change encoding settings between A and B.

Strange enough today I have problems to reproduce the results,
although with all settings the same than yesterday (border-size etc.).
Today the frame contents are only different.
Yesterday the bordered movie was definitely worse/ less detailed.

mean

If the border size is not a multiple of 8 or 16, it will take a lot of bits to encode, hence worsening the quality at a given size
Additionally, the encoder presets are a good compromise between speed & quality
You can tweak them to increase quality, with a longer encoding time

guju

#6
I have to ask.
Do you mean, mean, "border size" or "frame size"?

Actually the reason for me to add border was to match the set DAR of 4:3.
I knew already that some encoders (older ones) have a restriction in frame sizes.
Although I thought hevc would be free at that.
Still I chose a width as multiple of 8,
the height of non-bordered (A) is too,
the bordered is not, as I thought not too important.

But all this doesn't have anything to do with the loss of detail, if bordered ...

Or do I get something wrong?

eumagga0x2a

All dimensions should be a multiple of 8, better a multiple of 16, for better compressibility. Otherwise higher bitrates are required to keep the quality more or less the same.

guju

As said, the width was always a multiple of 8.

The height of non-bordered was too.
With added border (2 * 6), to meet DAR (4:3), its height was not.

Still, the non-bordered (multiple-conform) movie was larger.

I left the hevc encoding settings the same (standard config, preset "medium", quality 19)
and expected the same quality, with a larger file of bordered (as non-multiple).
But the opposite was the case !?


... a short addendum (although not exactly about the topic in this thread):

If I have a movie, whose size is multiple of 8 (or 16) minus say 6.

Why doesn't the Add-Border-filter let me add 2 * 3 pixels left and right
to meet the multiple restriction?

eumagga0x2a

#9
The function which paints black stripes needs even values, it can't paint 3px. Don't forget that chroma has 1/2 resolution of luma, so the color information of a 720px wide and 576px high picture is only 360x288. You can't divide 3 by 2 without a remainder.

guju

Quote from: eumagga0x2a on January 21, 2019, 10:33:01 AM
All dimensions should be a multiple of 8, better a multiple of 16, for better compressibility. Otherwise higher bitrates are required to keep the quality more or less the same.

ALL dimensions?
I would have thought that this holds only for the width ...

guju

Meanwhile I reproduced the effect of detail-loss when AddBorder.
To sum it up again:
Saving a movie as hevc (DAR 4:3 in stream and container).
First scenario: 1456 x 1080 (= slightly off DAR).
Second scenario: Add Border (2 x 6) to match DAR: 1456 x 1092.
Export Frames.
Result: Second one is slightly less detailed.
If I enhance encoding quality (from 19 to 17) in second scenario it gets better.

Question:
Why decreases AddBorder the quality?
(1092 not being a multiple of 8 should only effect the compression effiency
but not the quality, to my thinking ...)

eumagga0x2a

Quote from: guju on January 21, 2019, 03:09:48 PM
Quote from: eumagga0x2a on January 21, 2019, 10:33:01 AM
All dimensions should be a multiple of 8, better a multiple of 16, for better compressibility. Otherwise higher bitrates are required to keep the quality more or less the same.

ALL dimensions?

Yes.

QuoteWhy decreases AddBorder the quality?

(1092 not being a multiple of 8 should only effect the compression effiency
but not the quality, to my thinking ...)

I don't know the former as it is related to internal working of the x265 encoder and I'm not sure about the latter for the same reason.

guju

OK then, thankyou.

I'm a little bit on the loss now.

As increasing the hevc encoding quality to better than 19 actually leads to unaccetable compression time (and size).

And I only tried to do it right, when adding borders to match DAR ...

guju

... did another test then:

Increased border (to 1472 x 1104) to match not only DAR but also to be multiples of 8.

Frames are still less detailed.