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 > VapourSynth

Reply
 
Thread Tools Search this Thread Display Modes
Old 24th July 2020, 19:24   #301  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Quote:
Originally Posted by Cary Knoop View Post

Found out the solution myself, if an alpha channel is present two clips will be returned.
fun fact: python has language level support for functions with multiple return values, so this works even better (for the sake of readability)

Code:
c, alpha = core.ffms2.Source("prores4444.mov")
feisty2 is offline   Reply With Quote
Old 24th July 2020, 19:50   #302  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 397
Quote:
Originally Posted by feisty2 View Post
fun fact: python has language level support for functions with multiple return values, so this works even better (for the sake of readability)

Code:
c, alpha = core.ffms2.Source("prores4444.mov")
Cooool!
Cary Knoop is offline   Reply With Quote
Old 13th October 2020, 23:25   #303  |  Link
Blue_MiSfit
Derek Prestegard IRL
 
Blue_MiSfit's Avatar
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 5,988
THANK YOU for making this tool and the impeccable documentation. I've been remastering some old SD content recently into HD and this has been extremely helpful for doing the transfer and primaries conversion!
Blue_MiSfit is offline   Reply With Quote
Old 2nd November 2020, 20:39   #304  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,259
A Hybrid user reported this issue to me and I can reproduce it on my system.
using https://github.com/EleonoreMizo/fmtc...leases/tag/r22
with
Code:
# Imports
import vapoursynth as vs
core = vs.get_core()
# Loading Plugins
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
# source: 'F:\TestClips&Co\files\YUV\yuv422_16bitBitEndianStereo.mov'
# current color space: YUV422P8, bit depth: 0, resolution: 848x352, fps: 23.976, color matrix: 709, yuv luminance scale: limited, scanorder: progressive
# Loading F:\TestClips&Co\files\YUV\yuv422_16bitBitEndianStereo.mov using LWLibavSource
clip = core.lsmas.LWLibavSource(source="F:/TestClips&Co/files/YUV/yuv422_16bitBitEndianStereo.mov", format="YUV422P8", cache=0, prefer_hw=0)
# making sure input color matrix is set as 709
clip = core.resize.Point(clip, matrix_in_s="709",range_s="limited")
# making sure frame rate is set to 23.976
clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
original = clip
# cropping the video to 842x348
clip = core.std.CropRel(clip=clip, left=0, right=6, top=2, bottom=2)
# cropping the video to 842x348
original = core.std.CropRel(clip=original, left=0, right=6, top=2, bottom=2)
clip = core.fmtc.resample(clip=clip, kernel="spline16", w=1280, h=530, interlaced=False, interlacedd=False)
original = core.fmtc.resample(clip=original, kernel="spline16", w=1280, h=530, interlaced=False, interlacedd=False)
# adjusting output color from: YUV422P16 to YUV420P8 for x264Model (i420@8-bit)
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8, range_s="limited")
# adjusting for FilterView
#if original.format.id != clip.format.id:
# if (original.format.color_family == vs.RGB and clip.format.color_family != vs.RGB):
   #original = core.resize.Bicubic(original, format=clip.format.id, matrix_s="470bg", range_s="limited")
 #elif (original.format.color_family == clip.format.color_family):
#   original = core.resize.Bicubic(original, format=clip.format.id, range_s="limited")
# else:
#   original = core.resize.Bicubic(original, format=clip.format.id, matrix_in_s="470bg", range_s="limited")
stacked = core.std.StackHorizontal([original,clip])
# set output frame rate to 23.976fps
stacked = core.std.AssumeFPS(clip=stacked, fpsnum=24000, fpsden=1001)
# Output
stacked.set_output()
and
Code:
I:\Hybrid\64bit\Vapoursynth>VSPipe.exe  c:\Users\Selur\Desktop\test.vpy e:\Test.avi


I:\Hybrid\64bit\Vapoursynth>VSPipe.exe  c:\Users\Selur\Desktop\test.vpy e:\Test.raw


I:\Hybrid\64bit\Vapoursynth>VSPipe.exe  c:\Users\Selur\Desktop\test.vpy e:\Test.raw

Output 80 frames in 0.29 seconds (274.31 fps)

I:\Hybrid\64bit\Vapoursynth>VSPipe.exe  c:\Users\Selur\Desktop\test.vpy e:\Test.raw

Output 80 frames in 0.29 seconds (272.45 fps)

I:\Hybrid\64bit\Vapoursynth>VSPipe.exe  c:\Users\Selur\Desktop\test.vpy e:\Test.raw


I:\Hybrid\64bit\Vapoursynth>VSPipe.exe  c:\Users\Selur\Desktop\test.vpy e:\Test.raw

Output 80 frames in 0.29 seconds (272.80 fps)

I:\Hybrid\64bit\Vapoursynth>VSPipe.exe  c:\Users\Selur\Desktop\test.vpy e:\Test.raw


I:\Hybrid\64bit\Vapoursynth>
it randomly crashes,... every few times,..
Changing the source filter from LWLibavSource to FFMS2
Code:
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/SourceFilter/FFMS2/ffms2.dll")
clip = core.ffms2.Source(source="F:/TestClips&Co/files/YUV/yuv422_16bitBitEndianStereo.mov",cachefile="E:/Temp/mov_f1203bb1621d87009c15418dab3b00fb_853323747.ffindex",format=vs.YUV422P8,alpha=False)
doesn't help, it even seems that it crashed more often with ffms2.

removing:
Code:
clip = core.fmtc.resample(clip=clip, kernel="spline16", w=1280, h=530, interlaced=False, interlacedd=False)
original = core.fmtc.resample(clip=original, kernel="spline16", w=1280, h=530, interlaced=False, interlacedd=False)
and everything works.
Changing "spline16" to "spline64" same thing happens, but it seems to happen less frequently.
(same for spline36)
When using 'cubic' is seems to always crash.

Cu Selur

Ps.: Uploaded the clip I used to my GoogleDrive (~46MB)
__________________
Hybrid here in the forum, homepage

Last edited by Selur; 2nd November 2020 at 20:43.
Selur is offline   Reply With Quote
Old 16th April 2021, 22:07   #305  |  Link
groucho86
Registered User
 
Join Date: Apr 2016
Posts: 85
Quote:
Originally Posted by age View Post
Yes it looks so
Code:
import vapoursynth as vs
import muvsfunc
core = vs.get_core()

input_path = 'source_sgamut

c = core.imwri.Read(input_path,float_output=True)
#c = core.std.Expr(clips=[c], expr="  x 0.9 *")
c = core.std.Expr(clips=[c], expr="  x  0.01125000 >= x 0.01 +  0.19 / log 10 log / 261.5 * 420 + 1023 / 171.2102946929  95 -   x *   0.01125000  95 + /  1023 / ?")
c.set_output()
Not sure if the resolve result is right either, maybe there is need to scaling from linear to reflection multiply by 0.9

https://github.com/videovillage/Latt...sues/issues/17

https://pro.sony/s3/cms-static-conte...7494271406.pdf
age, for posterity's sake, I just realized that the second half of the lin to slog3 expression (the one dealing with values below 0.01125000) was not working as expected.

The proper RPN expr for linear to slog3 is:

Code:
x  0.01125000 >= x 0.01 +  0.19 / log 10 log / 261.5 * 420.0 +  1023.0  /  x 171.2102946929 95.0 -  * 0.01125000 / 95.0 + 1023.0 /  ?
groucho86 is offline   Reply With Quote
Old 21st June 2021, 19:54   #306  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,559
Running this code in VsEdit gives this error

Code:
video = core.resize.Point(video, format=vs.GRAY16)
video = core.fmtc.transfer(video, transs="709", transd="linear", fulls=0, fulld=1)
video = core.resize.Point(video, format=vs.GRAY8)
Quote:
Error on frame 0 request:
Resize error -1: invalid graph state L910: !m_state.has_chroma() || m_state.plan
MysteryX is offline   Reply With Quote
Old 22nd June 2021, 19:36   #307  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,259
@MysteryX: I can reproduce the issue unless I set the _ColorRange property beforehand:
Code:
# Setting color range to TV (limited) range.
video = core.std.SetFrameProp(clip=video , prop="_ColorRange", intval=1)
Code:
# Setting color range to PC (full) range.
video = core.std.SetFrameProp(clip=video , prop="_ColorRange", intval=0)
Cu Selur
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 14th July 2021, 12:53   #308  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 712
Quote:
Originally Posted by MysteryX View Post
Running this code in VsEdit gives this error
Code:
video = core.resize.Point(video, format=vs.GRAY16)
video = core.fmtc.transfer(video, transs="709", transd="linear", fulls=0, fulld=1)
video = core.resize.Point(video, format=vs.GRAY8)
Can be fixed by removing the _ColorRange property before sending it to output:
Code:
video = core.std.SetFrameProp (video, prop="_ColorRange", delete=True)
video.set_output()
The problem exists even without calling fmtconv, just by setting the property manually to 0 (full range). There’s nothing in the VS doc that forbids to attach a _ColorRange property set to 0 to a GRAY8 or GRAY16 clip, so I think it’s probably a bug related to VS Editor.
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding
cretindesalpes is offline   Reply With Quote
Old 14th July 2021, 14:18   #309  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 712
fmtconv r23:
  • transfer: added an Exposure Index (EI) parameter for the Arri Log C Alexa 2.x and 3.x curves.
  • bitdepth: properly sets the _ColorRange attribute.
  • Doesn’t output a debug message when AVSTP is not found.
  • Fixed a concurrency issue by using a more recent toolkit when compiling with MSVC.
  • Windows XP is not supported any more.
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding
cretindesalpes is offline   Reply With Quote
Old 14th July 2021, 14:49   #310  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,153
Please can you port to avisynth??
kedautinh12 is offline   Reply With Quote
Old 14th July 2021, 15:56   #311  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
dither is the equivalent toolkit for avisynth.
feisty2 is offline   Reply With Quote
Old 14th July 2021, 16:24   #312  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,153
Quote:
Originally Posted by feisty2 View Post
dither is the equivalent toolkit for avisynth.
I don't think so
https://forum.doom9.org/showpost.php...postcount=1131
kedautinh12 is offline   Reply With Quote
Old 10th August 2021, 10:30   #313  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 712
I already ported bitdepth, matrix and matrix2020cl to Avisynth+, so we’re halfway now. I’ll start a thread in the Avisynth forum when it is ready.
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding
cretindesalpes is offline   Reply With Quote
Old 17th August 2021, 07:14   #314  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 712
fmtconv r24:
  • bitdepth: added dithering mode 9: quasirandom sequences.
  • bitdepth: added a triangular probability distribution function (TPDF) for the dithering patterns and noises, along with the associated parameters tpdfo and tpdfn.
  • bitdepth: added corplane parameter to prevent colored noise in RGB processing.
  • bitdepth: fixed crash when trying to change the range (full or TV) without reducing the bitdepth.
  • matrix: deletes the _Matrix and _ColorSpace properties if a non-standard matrix is used.
  • matrix2020cl: sets the _Matrix and _Transfer frame properties.
  • matrix2020cl: fixed hideous colors when converting slightly out-of-colorspace values from integer Y’Cb’Cr’ to integer linear RGB.
  • resample: totalh and totalv are now correctly taken into account, added total parameter too.
  • resample: added a planes parameter.
  • transfer: sYCC curve (similar to sRGB) now supports signed values.
  • transfer: added a planes parameter.
  • Added support for Avisynth+
  • Added information on functions reading and writing frame properties.
  • Added more support for 14-bit data.
  • Vapoursynth: still uses API v3.6 but can use Python constants from future API v4.0.

I did a lot of internal changes in this release because of the Avisynth+ port so I hope I haven’t broke too many things. The next thing I’ll do is probably adding reference OOTFs (direct and inverse) to transfer to fully support the BT.2100 HDR pipeline and scene- or display-referred linear RGB.
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding

Last edited by cretindesalpes; 18th August 2021 at 10:39. Reason: phrasing
cretindesalpes is offline   Reply With Quote
Old 17th August 2021, 08:54   #315  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,153
Thanks
kedautinh12 is offline   Reply With Quote
Old 26th August 2021, 17:57   #316  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 712
I’m very likely to remove the planes parameter from fmtc_transfer introduced in r24. I added it because it was almost free, but with the upcomping addition of OOTFs, planes are no longer independant, and the parameter is making the implementation too complicated for my taste. Any objection?
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding
cretindesalpes is offline   Reply With Quote
Old 4th September 2021, 18:01   #317  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,345
Some issue with either transfer or primaries function in r24, that worked ok with r22 in vapoursynth version x64. I didn't test x86 or avs version

When converting ProPhoto (romm) or AdobeRGB to sRGB, it works ok in r22 . But in r24, there is some clipping or some errors in some channels

Best way is to see example:

Demo package ,

https://www.mediafire.com/file/k5rfb...,sRGB.zip/file

(src photos from https://furbo.org/color/WideGamut/)

Code:
srgb = core.imwri.Read(r'Oxbow_Boots_sRGB.jpg')
prophoto = core.imwri.Read(r'Oxbow_Boots_ProPhoto.jpg')
adobe = core.imwri.Read(r'Oxbow_Boots_AdobeRGB.jpg')

atos = core.fmtc.bitdepth (adobe, bits=32)
atos = core.fmtc.transfer (atos, transs="adobergb", transd="linear")
atos = core.fmtc.primaries (atos, prims="adobe98", primd="srgb")
atos = core.fmtc.transfer (atos, transs="linear", transd="srgb")
atos = core.resize.Point(atos, format=vs.RGB24)

ptos = core.fmtc.bitdepth (prophoto, bits=32)
ptos = core.fmtc.transfer (ptos, transs="romm", transd="linear")
ptos = core.fmtc.primaries (ptos, prims="romm", primd="srgb")
ptos = core.fmtc.transfer (ptos, transs="linear", transd="srgb")
ptos = core.resize.Point(ptos, format=vs.RGB24)

i = core.std.Interleave(clips=[srgb, atos, ptos])

i.set_output()
poisondeathray is offline   Reply With Quote
Old 5th September 2021, 08:40   #318  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 712
Thank you, I can reproduce the issue here (dark tones with transfer). I’m going to check what is wrong.

EDIT: it was the linear part of the sRGB curve that was wrong from r24. Fixed in commit f7cd019, will be available in the next full release or hot fix update.
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding

Last edited by cretindesalpes; 6th September 2021 at 12:01.
cretindesalpes is offline   Reply With Quote
Old 19th September 2021, 18:16   #319  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 712
fmtconv r25 is mostly a bug-fix release:
  • bitdepth/Avisynth+: fixed I420 input that couldn’t be converted to higher bitdepth. Thanks to StvG for the report.
  • matrix: fixed the output colorspace autodetection which failed with specific matrix combinations.
  • resample/Avisynth+: fixed fulls and fulld parameters which were wrongly defined as int instead of bool.
  • resample/Avisynth+: fixed cplaced which was wrongly copied from cplaces. Thanks to TbtBI for the report.
  • transfer: automatically adapts the output format (16-bit integer) if the input is a low-bitdepth clip and nothing is specified in bits nor flt, instead of emitting an error.
  • transfer: fixed the BT.2100 HLG curve that was inverted.
  • transfer: fixed the sRGB curve linear part and extended its positive range. Thanks to poisondeathray for the report.
  • Avisynth+: fixed a crash occuring when using data bitdepths between 9 and 14. Thanks to tormento for the report.
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding
cretindesalpes is offline   Reply With Quote
Old 27th September 2021, 16:15   #320  |  Link
Etroxamin
Registered User
 
Join Date: Jul 2021
Location: Bremen, Germany
Posts: 36
hey, i have a (hopefully) small problem:

i've converted YUV 8bit 420 to RGB 32bit 444, looks like this:

Code:
src = core.fmtc.bitdepth(src, bits=32)
src = core.fmtc.resample (src, css="444")
src = core.fmtc.matrix(src, mat="709", col_fam=vs.RGB, bits=32)
that works without problems.

now change it to YUV 10bit 420:

Code:
src = core.fmtc.bitdepth (src, bits=10)
src = core.fmtc.matrix(src, mat="709", col_fam=vs.YUV, bits=10)
src = core.fmtc.resample (src, css="420")
that works, but gives me a brighter picture, perhaps because of full range instead of tv.

i just started with VS scripts and could need some help here. How to do that?
Thanks in advance.
Etroxamin 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 06:58.


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