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 > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 24th August 2022, 12:15   #1  |  Link
rgr
Registered User
 
Join Date: Jun 2022
Posts: 10
How do I get Avisynth to treat a file as a full range?

I have a file encoded with UTVideo codec (lossless, YUV, full range colors).
I load it with the command:
ffms2("file.avi")

1. There is no color range information in the header and AviSynth treats it as a limited range. How can I make AviSynth treat this file as full range?

2. How can I make AviSynth generate the output file as full range color? MPC-HE assumes that the file is in the range 16-235 when played back.
rgr is offline   Reply With Quote
Old 24th August 2022, 13:27   #2  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,737
To populate frame properties correctly inside Avisynth, you can use:

Code:
propSet("_ColorRange", 0)
this will set Full PC Range.
If you're encoding the output, make sure to flag it correctly.
For instance, if you're re-encoding to H.265 with x265 you can use --range full while if you're using x264 or x262 to encode in H.264 or MPEG-2 you can use --range pc.
If you're using FFMpeg to encode to something else (ProRes, DNX, AV1, VP9 etc) you can use -color_range 0
FranceBB is offline   Reply With Quote
Old 24th August 2022, 18:04   #3  |  Link
DTL
Registered User
 
Join Date: Jul 2018
Posts: 1,000
AVS do not treat or change the range itself. AVS moves the frames buffers between filters and in/out (using some caching). It is task for each internal filter or external plugin to treat incoming format as having some range mapping (using some hints or internal defaults or some metadata signalling like frame properties of direct user-provided fliter params). So user need to read documentation and understand expected result of each used filter. The range mapping conversion may be done with ConvertBits() with fulls,fulld params.

"How can I make AviSynth treat this file as full range?"

Read documentation on the sink filter (used to request data from ffms2() ).

"2. How can I make AviSynth generate the output file as full range color?"

Make sure final source filter in the script outputs full range. (or the filter to make source for 'return' command if it used). AVS typically not generate file - only serves as a frame source for some sink process. So it is a task of the sink process to treat provided 8 or 16 (or 32) bit samples as having some range mapping.
DTL is offline   Reply With Quote
Old 24th August 2022, 21:15   #4  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,787
Quote:
Originally Posted by rgr View Post
2. How can I make AviSynth generate the output file as full range color? MPC-HE assumes that the file is in the range 16-235 when played back.
YUV is normally limited range, so if you're re-encoding that's what you probably want it to be. If FFMS2 is decoding it as full range and the player is treating it as limited range, it probably looks too dark and/or with too much contrast. If FFMS is converting it to limited range it should look okay, but I assume it doesn't?

If it's full range you can use the V.U.I range argument in the encoder command line and cross your fingers the player pays attention to it. For x264 and full range it's --range pc, but I don't think there's a way to flag the output as full range when opening a script directly with a media player.

Levels adjusts the luma and chroma, so from memory the color saturation will change as a result. Sometimes that's a good thing.
http://avisynth.nl/index.php/Levels
Full to limited range conversion (values for 8 bit video).
Levels(0, 1.0, 255, 16, 235, coring=false)
Limited to full range.
Levels(16, 1.0, 235, 0, 255, coring=false)

Alternatively, YLevels only adjust the luma.
http://avisynth.nl/index.php/Ylevels
Full to limited range.
YLevels(0, 1.0, 255, 16, 235)
Limited to full range.
YLevels(16, 1.0, 235, 0, 255)

ColorYUV.
http://avisynth.nl/index.php/ColorYUV
ColorYUV(Levels="TV->PC")
ColorYUV(Levels="PC->TV")

Last edited by hello_hello; 24th August 2022 at 21:40.
hello_hello is offline   Reply With Quote
Reply

Tags
avisynth, full range, limited, utvideo

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 08:58.


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