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. |
1st September 2019, 16:10 | #1 | Link |
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. |
1st September 2019, 17:06 | #2 | Link |
Registered User
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.
|
1st September 2019, 18:59 | #3 | Link |
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. |
Thread Tools | Search this Thread |
Display Modes | |
|
|