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 1st September 2019, 16:10   #1  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,823
Avisynth+ and matching color format

For classic Avisynth it's fairly easy to convert a video to the same format as another, or to convert a video back to it's original format. Something like this (ignoring any possible matrix mismatch if the original/intermediate format is RGB):

Color_Format = SourceVideo.PixelType()

# Video is converted to another format by SomeFunction()
New_Video = SourceVideo.SomeFunction()

# Conversion back to the original format
New_Video.Eval("ConvertTo"+Color_Format+"()")

Does Avisynth+ offer a similar level of simplicity I've missed? I realise there's bitdepth to consider too, but for PixelType() Avisynth+ returns format names such as YUV420P10 for bitdepths greater than 8, which can't be used the same way.

The closest I have to a cunning plan at the moment is to

- get the original bitdepth
- create a temporary video converted to 8 bit
- get PixelType() after the 8 bit conversion, which seems to result in "traditional" format names such as YV24
- convert the video to the original bitdepth, then convert to the original color format using the "traditional" name (maybe doing it in the reverse order might be better?).

Would I be missing much using the above method?

Cheers.

Last edited by hello_hello; 1st September 2019 at 16:22.
hello_hello is offline   Reply With Quote
Old 1st September 2019, 17:06   #2  |  Link
DJATOM
Registered User
 
DJATOM's Avatar
 
Join Date: Sep 2010
Location: Ukraine, Bohuslav
Posts: 377
I don't see a point of doing such conversions. Anyway you can check if your video is YUV420/422/444 and decide howto process it based on that.
__________________
Me on GitHub
PC Specs: Ryzen 5950X, 64 GB RAM, RTX 2070
DJATOM is offline   Reply With Quote
Old 1st September 2019, 18:59   #3  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,823
It's for a function that may use a plugin requiring a YV24 input and it outputs YV24. If the bitdepth is greater than 8 bit, it converts to 16 bit as required and outputs 16 bit. I want the function to always output video in the same format as it went in, hence the need to automatically convert it back the the original format, no matter what it was.

I've since remembered Raffriff42's Avisynth+ utilities collection has a function called MatchColorFormat() that does the job, but it seems to me like something it should be easy to do with Avisynth itself.
hello_hello 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:57.


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