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 18th October 2023, 13:53   #21  |  Link
Emulgator
Big Bit Savings Now !
 
Emulgator's Avatar
 
Join Date: Feb 2007
Location: close to the wall
Posts: 1,594
You can set VD2 to decode to RGB24.
Video -> Decode Format -> Decompression format RGB24
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain)
"Data reduction ? Yep, Sir. We're that issue working on. Synce invntoin uf lingŲage..."
Emulgator is offline   Reply With Quote
Old 18th October 2023, 19:14   #22  |  Link
andiandi
Registered User
 
Join Date: Aug 2017
Posts: 58
Quote:
Originally Posted by Emulgator View Post
You can set VD2 to decode to RGB24.
Video -> Decode Format -> Decompression format RGB24
I don't know if it's important to know whether the source is actually in RGB32 or RGB24? (I guess not, since x264 and x265 shouldn't take that into account). What's a bit confusing too, is that some Lossless codecs with Vdub2 only support RGB32 even when you set the decode format to RGB24. I don't think it's very important, but just in case.
andiandi is offline   Reply With Quote
Old 19th October 2023, 00:49   #23  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,819
Quote:
Originally Posted by andiandi View Post
I don't know if it's important to know whether the source is actually in RGB32 or RGB24? (I guess not, since x264 and x265 shouldn't take that into account). What's a bit confusing too, is that some Lossless codecs with Vdub2 only support RGB32 even when you set the decode format to RGB24. I don't think it's very important, but just in case.
RGB32 is just 8-bit with an alpha channel. It is effectively interchangeable with RGB24 if alpha isnít used. If you have a choice, do 24.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 19th October 2023, 09:38   #24  |  Link
nevcairiel
Registered Developer
 
Join Date: Mar 2010
Location: Hamburg/Germany
Posts: 10,360
fwiw, 24 is terrible for optimizations, because its not a power of 2. 3 byte alignment doesn't play well with CPUs, so you might see it being slower. Worth testing at least.
__________________
LAV Filters - open source ffmpeg based media splitter and decoders
nevcairiel is offline   Reply With Quote
Old 19th October 2023, 20:46   #25  |  Link
andiandi
Registered User
 
Join Date: Aug 2017
Posts: 58
Quote:
Originally Posted by benwaggoner View Post
RGB32 is just 8-bit with an alpha channel. It is effectively interchangeable with RGB24 if alpha isnít used. If you have a choice, do 24.

OK, apparently the alpha channel can be present but not really used. I'm not quite sure how to check that. (In any case, the DC and GC were in 24-bit color, and the PS2 and Xbox were in 32-bit, if that can be an indication.)

Quote:
Originally Posted by nevcairiel View Post
fwiw, 24 is terrible for optimizations, because its not a power of 2. 3 byte alignment doesn't play well with CPUs, so you might see it being slower. Worth testing at least.
OK, to be tested then.
andiandi is offline   Reply With Quote
Old 23rd October 2023, 21:27   #26  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,819
Quote:
Originally Posted by andiandi View Post
OK, apparently the alpha channel can be present but not really used. I'm not quite sure how to check that. (In any case, the DC and GC were in 24-bit color, and the PS2 and Xbox were in 32-bit, if that can be an indication.)

OK, to be tested then.
24-bit should never be slower than 32-bit. The gap is more than it materially faster due to byte alignment.

Also, definitely try encoding as RGB 444 8-bit full range; exactly the same as your sources. I think some of the encoding challenge comes from color space conversion rounding away the palletized nature of the sources, reducing the efficiency of lossless and transform skip modes.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 25th October 2023, 16:30   #27  |  Link
andiandi
Registered User
 
Join Date: Aug 2017
Posts: 58
Quote:
Originally Posted by benwaggoner View Post
24-bit should never be slower than 32-bit. The gap is more than it materially faster due to byte alignment.

Also, definitely try encoding as RGB 444 8-bit full range; exactly the same as your sources. I think some of the encoding challenge comes from color space conversion rounding away the palletized nature of the sources, reducing the efficiency of lossless and transform skip modes.
For the color range according to MediaInfo, it's limited range with x265 Lossless RGB 8-bit (with Vdub2), but it's strange because normally RGB should be full range (?).

Another thing I'm not sure about regarding 4:2:0 lossy encodings (x264 and x265) is whether it's better to feed the encoder with the RGB source or first convert the source to 4:2:0 (I see a slight difference, but nothing significant).
andiandi is offline   Reply With Quote
Old 26th October 2023, 23:04   #28  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,819
Quote:
Originally Posted by andiandi View Post
For the color range according to MediaInfo, it's limited range with x265 Lossless RGB 8-bit (with Vdub2), but it's strange because normally RGB should be full range (?).
I'm on the road without my workstation the rest of the week, so I can't check the files. I concur limited range would be weird, but wouldn't be stunningly weird for devices of these devices predating HDMI by years.

Quote:
Another thing I'm not sure about regarding 4:2:0 lossy encodings (x264 and x265) is whether it's better to feed the encoder with the RGB source or first convert the source to 4:2:0 (I see a slight difference, but nothing significant).
x264 and x264 don't natively include RGB->YUV conversion or subsampling, although many builds have added those features. As long as an implementation does a good job, it doesn't really matter where it happens. My go to method for "trusted quality and good speed" is zscale in ffmpeg. Other things can be as good or as fast, but I don't know anything actually better.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 27th October 2023, 16:15   #29  |  Link
andiandi
Registered User
 
Join Date: Aug 2017
Posts: 58
Quote:
Originally Posted by benwaggoner View Post
I'm on the road without my workstation the rest of the week, so I can't check the files. I concur limited range would be weird, but wouldn't be stunningly weird for devices of these devices predating HDMI by years.

Alright. I looked at the various RGB options with Vdub2 (Compression -> Pixel Format -> Other), and indeed there's only Full Range available for RGB, so, I assume that MediaInfo is mistaken.

Quote:
Originally Posted by benwaggoner View Post
x264 and x264 don't natively include RGB->YUV conversion or subsampling, although many builds have added those features. As long as an implementation does a good job, it doesn't really matter where it happens. My go to method for "trusted quality and good speed" is zscale in ffmpeg. Other things can be as good or as fast, but I don't know anything actually better.
OK
andiandi is offline   Reply With Quote
Old 2nd November 2023, 17:55   #30  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,819
Quote:
Originally Posted by andiandi View Post
Alright. I looked at the various RGB options with Vdub2 (Compression -> Pixel Format -> Other), and indeed there's only Full Range available for RGB, so, I assume that MediaInfo is mistaken.
Take a look in the VDub2 histogram in the Levels filter to know for sure. Whether or not VDub2 supports it doesn't matter; full/limited is determined by the range output by your emulator.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 6th November 2023, 18:57   #31  |  Link
andiandi
Registered User
 
Join Date: Aug 2017
Posts: 58
Quote:
Originally Posted by benwaggoner View Post
Take a look in the VDub2 histogram in the Levels filter to know for sure. Whether or not VDub2 supports it doesn't matter; full/limited is determined by the range output by your emulator.
OK. I always see differences, except when I set it to 0-255 for both input and output (even with YUV sources...), maybe I'm missing something ?
andiandi is offline   Reply With Quote
Old 7th November 2023, 01:05   #32  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,819
Quote:
Originally Posted by andiandi View Post
OK. I always see differences, except when I set it to 0-255 for both input and output (even with YUV sources...), maybe I'm missing something ?
Do you see differences if you set both to 16-235?

The basic test is that output video black areas should be as black (RGB=0) in both cases. If 16-235 at darkest is dark gray instead of black, the source is likely full range.

If you encode limited range as full range, darks, whites, and saturation will be muted. If you encode full range as limited range, shadow detail gets turned into flat black, and bright areas get extra white.

Mathematically, a mismatch is essentially turning contrast too high or too low.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 8th November 2023, 18:00   #33  |  Link
andiandi
Registered User
 
Join Date: Aug 2017
Posts: 58
Quote:
Originally Posted by benwaggoner View Post
Do you see differences if you set both to 16-235?

The basic test is that output video black areas should be as black (RGB=0) in both cases. If 16-235 at darkest is dark gray instead of black, the source is likely full range.

If you encode limited range as full range, darks, whites, and saturation will be muted. If you encode full range as limited range, shadow detail gets turned into flat black, and bright areas get extra white.

Mathematically, a mismatch is essentially turning contrast too high or too low.

Yeah, it's only with both 0-255 that there's no difference, for the others, the contrast changes except for 0-255 (input) -> 16-235 (output), which looks more like gamma correction, for example :

https://mega.nz/file/cihWDR7B#bGnwXt...hHlUR2EPRqAsGI

Normally, I should conclude that the source is full range, but it's the same with all videos I've tested with (even with YUV 4:2:0 videos...).
andiandi is offline   Reply With Quote
Old 8th November 2023, 23:01   #34  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,819
Quote:
Originally Posted by andiandi View Post
Yeah, it's only with both 0-255 that there's no difference, for the others, the contrast changes except for 0-255 (input) -> 16-235 (output), which looks more like gamma correction, for example :

https://mega.nz/file/cihWDR7B#bGnwXt...hHlUR2EPRqAsGI

Normally, I should conclude that the source is full range, but it's the same with all videos I've tested with (even with YUV 4:2:0 videos...).
If MediaInfo says that an elementary stream in a .mp4 is limited range, that is generally quite accurate.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 9th November 2023, 18:43   #35  |  Link
andiandi
Registered User
 
Join Date: Aug 2017
Posts: 58
Quote:
Originally Posted by benwaggoner View Post
If MediaInfo says that an elementary stream in a .mp4 is limited range, that is generally quite accurate.
Good, with samples converted to YUV 4:4:4 (since Vdub2 allows choosing Limited range and Full range for YUV), there aren't all these differences, and it seems to match MediaInfo.
andiandi is offline   Reply With Quote
Old 13th November 2023, 20:57   #36  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,819
Quote:
Originally Posted by andiandi View Post
Good, with samples converted to YUV 4:4:4 (since Vdub2 allows choosing Limited range and Full range for YUV), there aren't all these differences, and it seems to match MediaInfo.
What exactly is matching?
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 14th November 2023, 23:24   #37  |  Link
andiandi
Registered User
 
Join Date: Aug 2017
Posts: 58
Quote:
Originally Posted by benwaggoner View Post
What exactly is matching?
The converted YUV 4.4.4 samples (limited range and full range) matches with the source (a Dreamcast source captured in x264 Lossless RGB by the emulator, Limited Range according to MediaInfo). There is no difference in Full Range either, but since there isn't any in Limited Range too, I assume it's limited range for this tested source (as in MediaInfo).

Last edited by andiandi; 14th November 2023 at 23:27.
andiandi 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 11:04.


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