Selur's Little Message Board

Full Version: Possible to go from PNG input stream to PNG output stream in VapourSynth?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
It works in AviSynth, but hangs in Vapoursynth.

To reproduce, import any PNG image stream, set output container to RAW, set processing for video to PNG. When it gets to "encoding an png image sequence using ffmpeg" it will hang there, and not output any PNG's in the output directory.

If it can't work, it means I'll have to convert my PNG stream to lossless MP4, then make a second image stream from that. (I'm processing different aspect ratios and settings for multiple clips to the same resolution, then making a final mp4 from that... video editing using Windows Explorer. Smile)

It's not a huge deal, but it would be nice if it worked for VapourSynth. Smile
What is a "PNG image stream" is it a normal image sequence ?
If it is something different I need an example.

Cu Selur
Tried reproducing it using a png image sequence as input and as output while filtering with Vapoursynth.
Worked fine, but might be something I fixed in my dev version.
-> please clarify and share a debug output, so I know what is happening on your end.

Cu Selur
Sorry, I meant image sequence, not image stream.

It's weird, I can't get it to behave as before. I can set a .png image sequence input and a .png image sequence output now in Vapoursynth and it will work.

But, I found that won't work if I use a custom filter. When using one, when the job is started it ends immediately with no .png files output. It will work with the same custom filter though if the input is a h264 .mp4 file.

Here's the debug for .png input, custom filter, and .png output for Vapoursynth, where job ends immediately with no output:

(Attachments are no longer working here for me... here is a Google drive link)

https://drive.google.com/file/d/1sfBbQKh...sp=sharing
Oh, I guess the attachment did work. It didn't look like it did when I tried to upload it. Tongue
Looking at the script:
Code:
# Imports
import vapoursynth as vs
# getting Vapoursynth core
core = vs.core
# Loading Plugins
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/Support/libimwri.dll")
# defining beforeLSFMod-function - START
def beforeLSFMod(clip):
  import os
  import sys
  import ctypes
  # Loading Support Files
  Dllref = ctypes.windll.LoadLibrary("C:/Program Files/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll")
  # Import scripts folder
  scriptPath = 'C:/Program Files/Hybrid/64bit/vsscripts'
  sys.path.append(os.path.abspath(scriptPath))
  # Loading Plugins
  core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/SharpenFilter/CAS/CAS.dll")
  core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
  # Import scripts
  import havsfunc
  clip = havsfunc.LSFmod(input=clip, strength=100, Smode=2, Smethod=3, secure=True, Lmode=4, soft=-2, edgemaskHQ=True, preblur=1, ss_x=1.5)
  return clip
# defining beforeLSFMod-function - END

# source: 'F:/Test/source/000000.png'
# current color space: RGB24, bit depth: 8, resolution: 1440x960, fps: 23.976, color matrix: 709, yuv luminance scale: full, scanorder: progressive
# Loading F:\Test\source\%06d.png using vsImageReader
clip = core.imwri.Read("F:/Test/source/%06d.png", firstnum=0)
clip = core.std.Trim(clip=clip, length=501)
# Input color space is assumed to be RGB24
# making sure frame rate is set to 23.976
clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
# Setting color range to PC (full) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=0)
clip = beforeLSFMod(clip)
# adjusting output color from: RGB24 to YUV444P8 for PNGModel
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="709", range_s="full")
# set output frame rate to 23.976fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
# Output
clip.set_output()
Does this work in the Vapoursynth Preview?

I assume it does not, since you apply:
Code:
clip = havsfunc.LSFmod(input=clip, strength=100, Smode=2, Smethod=3, secure=True, Lmode=4, soft=-2, edgemaskHQ=True, preblur=1, ss_x=1.5)
on an RGB24 clip which will not work, as LSFMod only works on YV12 content.

Also: Why use LSFmod this way and not through Filtering->Vapoursynth->Sharpen->LSFmod?

Cu Selur
Small correction: LSFmod should support YUVXXX, but not RGB. Smile

So Hybrid would normaly convert to YUV444P8
Code:
# adjusting color space from RGB24 to YUV444P8 for vsLSFMod
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="470bg", range_s="full")
clip = havsfunc.LSFmod(input=clip, ...)
-> if you use custom additions you are responsible:
a. to apply any needed color space conversions
b. to let Hybrid know if the color space&co changed.
for example adding:
Code:
# colorformat YUV444P8
to a custom section would let Hybrid know that the output of the section is now YUV44P8.

-> this does not seem like a bug in Hybrid, but like a bug in your custom addition code.

Cu Selur
Oh s**t, I could have SWORN I checked this in the previewer. I must have had the custom script disabled when I clicked the previewer button, it's the only thing I can think of.

Hybrid of course works fine.

I'm really sorry I wasted your time with this. Sad