This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

NVEnc Preview
#31
Ok, the pipe goes only one way: forward, but is better than nothing. 
In this case the scope of "preview" is to see the effect of the filters applied in NVEnc, and for this scope a preview that is able to go only forward is enough.
Reply
#32
That sounds like an option that is more trouble than good, since the next thing users ask for is to be able to navigate and then I have to explain to users over and over again why I won't implement this.
Would it help to write a post in the forum, or a tool-tip in the gui: No, users don't read either.
=> no for me adding this to Hybrid just calls for trouble.

Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Reply
#33
In this case the preview should be made available with a button inside the NVEnc->Hardware and only if is checked "Only use encoder".
So in this case the user know that is something different, like the Preview/CropView.
Moreover I tested the script and even if is not possible going back, the solution adopted is not too bad, and for sure is better than nothing.
Having a preview the experienced users (your tool is not for beginners) can be motivate to ask to rigya to fix the filters or to add new ones.
It is for sure a significant improvement (rigaya is involved in develop a own GUI, but Hybrid is much better).
Reply
#34
Hello Selur,

This is a working example of preview using filters. 
It is very useful to have a preview of filtered output.

import vapoursynth as vs
from vapoursynth import core
import subprocess
import ctypes

NVEnc = r'E:\VideoTest\TestSubs\NVEncC64.exe'
source_path=r'E:\VideoTest\TestSubs\TestVideo.mp4'
#Loading Plugins
core.std.LoadPlugin(path="E:/VideoTest/TestSubs/BestSource.dll") #from https://forum.doom9.org/showthread.php?t=184255
#current color space: YUV420P8, bit depth: 8
#resolution: 1280x536, fps: 25, color matrix: 470bg, yuv luminance scale: limited, scanorder: progressive
#this clip is not not needed, just to get width and height
clip = core.bs.VideoSource(source=source_path)

w = clip.width
h = clip.height
bitdepth=8
Ysize  = w * h * bitdepth // 8
Usize = w * h//4 * bitdepth // 8
Vsize = w * h//4 * bitdepth // 8
frame_len = Ysize + Usize + Vsize #YUV420

nvenc_filters = [
'--vpp-pmd apply_count=3,strength=100,threshold=100',
'--vpp-unsharp radius=4,weight=0.5,threshold=10',                 
'--vpp-smooth quality=3,qp=60,prec=fp32',
'--vpp-tweak brightness=0.01,contrast=1.01,gamma=0.98,saturation=0.90,hue=-2,swapuv=false',
'--vpp-deband range=15,sample=1,thre=15,dither=15,seed=1234,blurfirst=off,rand_each_frame=off',
]

command = [NVEnc,
                 '--avhw',
                 '--input "'+source_path+'" '
                 '-c raw',
                 ' '.join(nvenc_filters),
                 '--output-res '+str(w)+'x'+str(h),
                 '--output-csp yuv420',
                 '--output-depth '+str(bitdepth),
                 '--output-format raw',               
                 '--output -',         
             ]
command = ' '.join(command)

pipe = subprocess.Popen(command, stdout = subprocess.PIPE, bufsize=frame_len)

def load_frame_from_pipe(n,f):
    vs_frame = f.copy()   
    try:
        for i, size in enumerate([Ysize, Usize, Vsize]):
            ctypes.memmove(vs_frame.get_write_ptr(i), pipe.stdout.read(size),  size)
        pipe.stdout.flush()
    except Exception as e:
        raise ValueError(repr(e))   
    return vs_frame

try:
    clip = core.std.ModifyFrame(clip, clip, load_frame_from_pipe)
except ValueError as e:
    pipe.terminate()
    print(e)

clip.set_output()

Hybrid has already all the components necessary to build the preview.
What was missing was the script to obtain the preview with Vapoursynth.
Now that we have it, it's a shame not to use it.
 
I hope that you will reconsider the possibility to include this feature in Hybrid.

Thanks,
Dan
Reply
#35
Why use vsPreview and not ffplay?
Seems much more straight forward to use ffplay, since all the overhead of vsPreview do not seem to make sense to me.

I'll send you a link to dev version which has a 'Play with ffplay'-button in a few minutes. (uploading takes its time)
When pressed, it will start NVEncC->ffplay, which will open the normal ffplay window. Since there are no controls, the amount of complaints about buttons not working etc. should (hopefully) be minimal.

Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Reply
#36
Hello Selur,

   I do agree with you, the ffplay solution is a better option, in effect the Vapoursynth approach introduced a lot of not necessary complexity, but the vsedit display is much better than ffplay.
   Willing to improve the display it is possible to use mpv player it is open source (see: https://github.com/mpv-player/mpv ) it is based on ffmpeg, but the developer spent more time in developing the GUI.
  The usage of mpv is even simpler than ffplay because it is able to auto-detect the import format  (see "mpv.com --help" and "mpv.com --list-options").

   here an example of usage using the TestVideo

D:\Programs\Hybrid\64bit\NVEncC.exe  --avhw -i E:\VideoTest\TestSubs\TestVideo.mp4 --fps 25.000 --codec raw --sar 1:1 --output-depth 10 --vpp-resize auto --output-res 1920x800 --vpp-gauss disabled --vpp-pmd apply_count=2,strength=100,threshold=100 --cuda-schedule sync --output-format y4m --output - |  E:\VideoTest\TestSubs\mpv.com --window-scale=0.8 -

   In this case I applied a resize to 1080p in NVEnc and then I asked to mpv to apply a rescale of 80%. Very simple, and the GUI is much better.

   In any case ffplay is already a big improvement.

Thanks! Smile
Dan
Reply
#37
Sorry, I gave up on mpv, it's mainly aiming to be a video player not a player you can integrate into a ui, properly control remotely or use for encoding, extraction, etc. like you could do with mplayer and mencoder.
=> not adding support to mpv (also way too much hassle building mpv)

Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Reply
#38
OK, ffplay is already a big improvement.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)