Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 7th October 2022, 17:15   #1  |  Link
birdie
Artem S. Tashkinov
 
birdie's Avatar
 
Join Date: Dec 2006
Posts: 337
Can HW H.264 encodes be reduced in size without loss of detail?

Here's my source encoded at roughly 40Mbit/sec.

The best I can reduce it to is 35 (!) Mbit/sec using these parameters:

Code:
ffmpeg -i source.mp4 -c:a copy -c:v libx264 -preset veryslow -x264opts keyint=180:min-keyint=30:bframes=16 -crf 17 -tune grain result.mkv
It's easy to compare the source with the result using the very first frame, the wall of the building on the left. It's rich in detail.

I'm now encoding this clip using H.266 because with AV1 (libaom) and H.265 (x265) I've failed to reduce the file size.

Can HW H.264 encodes be reduced in size without loss of detail?
birdie is offline   Reply With Quote
Old 7th October 2022, 18:28   #2  |  Link
rwill
Registered User
 
Join Date: Dec 2013
Posts: 343
Maybe you should lower your expectations? There will always be a quality loss when re-encoding.
rwill is offline   Reply With Quote
Old 7th October 2022, 20:44   #3  |  Link
Asmodian
Registered User
 
Join Date: Feb 2002
Location: San Jose, California
Posts: 4,406
Quote:
Originally Posted by birdie View Post
Can HW H.264 encodes be reduced in size without loss of detail?
No, this is impossible. You can get minimal loss of detail, perhaps even imperceptible loss given your viewing conditions, but there will always be some loss.
__________________
madVR options explained
Asmodian is offline   Reply With Quote
Old 7th October 2022, 22:29   #4  |  Link
birdie
Artem S. Tashkinov
 
birdie's Avatar
 
Join Date: Dec 2006
Posts: 337
Quote:
Originally Posted by Asmodian View Post
No, this is impossible. You can get minimal loss of detail, perhaps even imperceptible loss given your viewing conditions, but there will always be some loss.
I'm taken aback to be honest because pirates somehow manage to compress near losslessly (for what I can tell) ~25GB BluRays to a third of their size. Maybe there's some loss, I need to check it.
birdie is offline   Reply With Quote
Old 8th October 2022, 01:54   #5  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,750
Bear in mind that Blu-ray has a bunch of restrictions (max 3 B-frames, 4 slices, max 1 sec GOP) that impair compression efficiency, so an encoded optimized for streaming or download can be significantly more efficient.

Blu-ray discs often use bitrates well above what the content requires because there's tons of space and bandwidth available, so why try to make the video smaller? Plus technical folks will say stuff like "BD X sux because it only has an ABR of 20 Mbps!" ignoring whether or not the content looks great.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 11th October 2022, 03:29   #6  |  Link
GEfS
Registered User
 
Join Date: Aug 2011
Posts: 25
Usually, Blu-ray has a really good source. Digital Intermediate master file use around 200-400mbps with 1080p content (it's also the file that got distributed to cinemas). It has a lot of details to lose, so in case you decrease bitrate, it won't lose as much data as bloated 40mbps from a phone. Phone video footage doesn't have that much of detail, so the encoder removes details without knowing it is important to the file. The detail on phone is worth like 5-6mbps on 40mbps footage. So, you decrease them by dividing the bloat.
Also, play around with deblock setting. I (and so many encoders out there) prefer -3 to 2 setting. On Blu-ray real-life movies, -3:-3 is widely used to retain the grain (mostly Arri grain, on RED or things like live concert or homemade video, -2:-1 might be better, on animated stuff, 0:0 or 1:1 is somewhat better, and also apply to low res source like DVD when deblocking really help).
You can always add some dynamic grain and a sharpener (LSFmod with ss_x=ss_y=1.5 with strength under 60) to compensate for the softness after encoding.

Fun fact: A lot of movie on Bluray has been encoded with 80% bitrate of the source just because the movie has too many details like grain and motion, so you can't decrease video bitrate anymore otherwise it will look like mud.
GEfS is offline   Reply With Quote
Old 20th October 2022, 09:30   #7  |  Link
outhud
Registered User
 
Join Date: Aug 2018
Posts: 21
Quote:
Originally Posted by birdie View Post
Here's my source encoded at roughly 40Mbit/sec.

The best I can reduce it to is 35 (!) Mbit/sec using these parameters:

Code:
ffmpeg -i source.mp4 -c:a copy -c:v libx264 -preset veryslow -x264opts keyint=180:min-keyint=30:bframes=16 -crf 17 -tune grain result.mkv
Have you tried using crf 18 or 19 and see what bitrate you get?

Tune grain is probably not needed, that's useful for film sources, your source seems to be from a digital camera.

I think you'll find you'll maintain a lot of the detail with a crf 19 encode here.

EDIT: I checked some bitrates from some test encodes of your video. (and removed tune grain)

CRF 17: 35Mbit/sec
CRF 19: 12Mbit/sec
CRF 21.5: 7Mbit/sec

Here's a comparison of your source and the 7Mbit/sec encode: https://screenshotcomparison.com/comparison/28797
(mouse over to show the 7/Mbit encoded version)

Last edited by outhud; 20th October 2022 at 20:25.
outhud is offline   Reply With Quote
Old 20th October 2022, 20:12   #8  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,750
Was the source heavy grain? Did you try --tune film instead?
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 16:48.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.