June 17, 2021, 06:21:54 PM



Filter "Add Borders" decreases output quality?

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

Previous topic - Next topic


... made the same test with AVC1.

With that the "bordered" one is also less detailed.
But the difference between bordered or not is not as significant as with hevc comparisons

Everything with quality crf = 19 I compared that to the hevc version.
Hevc should be much better with that, as the lowest meanigful value
is 18 for avc1 and 24 for hevc.
Well, coding with hevc took about double as long, and produced a half-sized file, BUT ...
... the quality is worse then with avc1.
So ... maybe something wrong with the version, config of Avidemux' hevc?

Anyone has a clue for all of that?


HEVC encodes more effectively than AVC.

If you halved the file size then you have also halved the bit rate.
At half the bit rate you are just about at the limit of what HEVC can do to maintain the same quality obtained by AVC.

You get a better result at the same bit rate or
Same result with a lower bit rate.
Or you need to fully optimise your settings in HEVC to get a near equivalent result (2 pass encoding!).

That said many prefer to use AVC for 1080P encodes.


No, sorry, you got me wrong.

I did not "halve the bitrate".
I set the same option for quality (crf) for both avc and hevc.

As expected: more time for compression and smaller file size.
One would expect a better quality. But the opposite was the case.
One would expect comparable quality when add border. But it wasn't.
If the standard options of hevc do not suffice, and a "fully optimization"
should me necessary ... then hevc would be quite useless.

So to me it seems as if there is something wrong with hevc in Avidemux.


... checked hevc in a different "host" (VirtualDub2).

Comparison within VirtualDub2:
Add Border leads to only very slightly worse frames ... if at all.

Comparision between Avidemux and VirtualDub2 (border-less):
very similar quality.


January 23, 2019, 01:35:01 PM #19 Last Edit: January 23, 2019, 01:37:29 PM by fish
No re-encode you can do will give 'better' quality, every re-encode tends to discard some detail from each frame, unless you go to a lossless codec but of course this tends to be an intermediate step, mainly for the purpose of adding effects, the result must then be recompressed.  Part of what HEVC  does to attain better compression is to cleverly discard  more detail in a way that will not be noticed when casually viewing the video.
If you resize the video by re-encoding, so that the same whole image of each frame doesn't fit exactly into an identical 8x8 or 16x16  grid pattern, then you are going to lose quite a bit of detail, the more movement and detail in each frame, the more you will lose from that frame.
Personally I have never seen a good reason for using HEVC. The encoding times have always been many times longer than can be justified by file size savings and the 'quality' may well be slightly worse than for example x264.

What is the original video and what is the result you desire?


Must be the (third?) time in this thread, that I have to make clear, that I'm not about consecutive (de-)coding steps.
I have the simple task to crop an original movie, and have to take care of DAR (that's because I have to add horiz. borders).
I made the observation that when adding borders the quality of the result is worse is if not adding them.
Still I cannot do without adding borders as the viewing would be distorted then (or I would have to cut off vertical contents).

Your explanation gives me hint why this happen ("identical 8x8 or 16x16 pattern"), as my added border is 6 above and below.
(BTW: The original codec is AVC).

So there seem to be a lot of restraints to fullfil if cropping/ add border:
DAR, dimensions as multiple, adding/ cropping as multiple.
(An argument for helping/ preventing the user in the filter GUI ... see my proposal in that thread).

Moreover your experience about AVC vs HEVC was new to me.
I thought HEVC to be an improvement.
But it more seems to be (literally) eyewashing.
(And already the successor is in the tube ...).

OK then, the conclusion for me:
From now on no HEVC.
And every cropping, adding border as an exercise of discret algebra
(as long as the crop filter doesn't support).

Thankyou again  :)


I have asked you twice what you are trying to do because you don't tell us. I can assume from what you do tell us that you MIGHT be taking a 16:9 or widescreen video and fitting it into a 4:3 format, hence the black bar padding top and bottom, am I getting warm?
As for HEVC, my computer is built round a very early i7 processor, which is hardly cutting edge and the graphics card isn't up to much either, so maybe a more up to date computer and graphics card that helps with the encoding, would show better results with HEVC encoding.


Quote from: fish on January 23, 2019, 04:58:03 PM
... so maybe a more up to date computer and graphics card that helps with the encoding, would show better results with HEVC encoding.

If my conjecture is right, than a quicker hw would purely deliver results quicker.
Bad results ... no matter how demanding you choose crf parameter.
Still I wonder, as it is said that from a certain quality crf the results would be "transparent".

I don't know.
Strange world.
Jack, Zack, I cannot to swim!


From what you tell us the original video may be already heavily compressed and then you are cropping it, which will cause most of the content in each block of each frame to change slightly when re-encoded, that is likely to make things a lot worse than simply re-encoding without cropping.


The starting (from both: non added border and added border) is the same.
Whatever it comes from, whatever compressed it is.
It does not matter.
Than I hevc saved them.
(4th time if I counted right).

But your explanation (if right) tells why there is that quality difference:
The add border is not of multiple of 8 or sweet 16 (if you know what I mean).


The question how encoder react to specific changes in the source video like scaling, cropping or adding borders is surely interesting but also very academic. The best practices are to avoid all of them whenever possible.


I don't have in mind to resume this topic endlessly ...  ;) ... still: I've to contradict.

It's not academic.

If I'm not completely wrong then Avidemux is for manipulating movies?
And if you have to (for whatever reason) manipulate it,
it's anything but academic to know the pitfalls to avoid.
Don't you agree?

And for me (being a normal user with some knowledge here and there, but no prof)
there were many effects/ restrictions I learned in this thread about I never expected.
And it is not academic if your resulting video has bad quality
when you only used some "harmless" manipulations.
Not paying attention to some things one does not know.
(As I posted former, to my opinion most users will simply use Avidemux
without noticing the degradation of quality, as they don't have the time
to have an as close look as I did this time.)

What was I about to say ...?

Thankyou!  :)


... my experiences with AVC codec and adding border/ cropping.

When I dropped hevc coder (as its enhanced compression ratio
takes too much quality for my taste) I examined the effect
of cropping/ adding border in AVC.

There is no significant difference in quality if I set the
cropping/ add border on multiple of 8.
(The starting point is - as always - an AVC coded movie).

If one would expect the compression being better, when on
the 8-multiple: it wasn't, but the opposite. The "8-multiple" file
was slightly larger (due to the slightly larger frame dimensions I suppose).

Best quality was when not adding border.
But I had to to meet DAR.

So for me it's clear how to do up from now ...

BTW (as I was asked), why all this?
I got some older movies, AVC-coded and with format 16:9.
However there were large black borders encoded in,
as the actual content was about 4:3.
So it was my idea to reduce file size by cropping the black
and setting the DAR to 4:3.
With AVC now (crf = 18, "slower" encoding mode)
the file size is about 70%.
HEVC would reduce of more than another 50% (but with the
- for me - unacceptable degradation of the single frames.
Maybe - as it was stated by fish - not so much when "only"
watching the movie/ changing frames.)