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 14th January 2017, 20:05   #1  |  Link
pixel
Registered User
 
Join Date: Jan 2017
Posts: 5
Applying HLSL Shaders To Video With Avisynth?

I have read that avisynth can do the following:

1. Load a video.
2. Apply an HLSL shader to the video frames.
3. Save the video.

This plugin down below is supposed to make this possible:

https://github.com/mysteryx93/AviSynthShader

I have never used avisynth before, so I'm a bit lost.

Can anyone tell me how to do this?

I need an example script that tells Avisynth to:

1. Load video
2. Apply HLSL shader(s)
3. Save result

Also, is there any another software that can apply HLSL shaders to video frames and save the result to a video file?

Thank you all very much!
pixel is offline   Reply With Quote
Old 15th January 2017, 06:29   #2  |  Link
TheFluff
Excessively jovial fellow
 
Join Date: Jun 2004
Location: rude
Posts: 974
http://avisynth.nl/index.php/Getting_started
TheFluff is offline   Reply With Quote
Old 15th January 2017, 06:38   #3  |  Link
FranceBB
FranceBB
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Germany
Posts: 198
FFMpegSource2("yourvideo.mkv" fpsnum=24000, fpsden=1001, atrack=-1)

Converttoyv12()

SuperRes(Input, Passes=1, Str=1, Soft=0, Upscale="""nnedi3_rpow2(2, cshift="Spline16Resize")""", lsb_upscale=false, PlanarOut=true, MatrixIn="Rec709", MatrixOut="Rec709", fWidth=1920, fHeight=1080)

_________________

That is the avs. Basically you use an indexer like ffms2 to open both audio and video and then you filter it using the plugin you posted about. Please note that you need the plugin to be in your plugins folder and/or to load it and its dependencies when you call it. Then, just download virtual dub and drop the avs in that program; you will see the result of the avs and you will be able to encode it.
FranceBB is offline   Reply With Quote
Old 15th January 2017, 08:42   #4  |  Link
pixel
Registered User
 
Join Date: Jan 2017
Posts: 5
I am going to try what you posted.

Where do the HLSL shaders go in this example?

Surely you have to specify something like this somewhere:

Apply bloom.hlsl
Apply sharpen.hlsl
Apply anglecorrect.hlsl

pixel is offline   Reply With Quote
Old 15th January 2017, 10:09   #5  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 5,317
Looking at AvisynthShader page:
Assuming you installed Avisynth and placed the AvisynthShader and the FFmpegSource plugin inside the plugins folder:
Code:
ConvertToShader(1)
FFMpegSource2("yourvideo.mkv")
Shader("bloom.hlsl", Output=2)
Shader("sharpen.hlsl", Output=3)
Shader("anglecorrect.hlsl", Clip1=2, Clip2=3, Output=1)
ShaderExecute(last, Input, Clip1Precision=1, Precision=3, OutputPrecision=1)
ConvertFromShader(1)
should apply the shaders,.. (you still need to use the avisynth script with a tool that supports Avisynth like ffmpeg/mencoder/mplayer/VirtualDub/... to process the script and create the video output,..)
-> you might want to get accustomed with Avisynth in general and start with the link TheFluff posted to understand the whole thing,..
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 15th January 2017, 15:19   #6  |  Link
pixel
Registered User
 
Join Date: Jan 2017
Posts: 5
Thank you very much - I am new to Avisynth/frameserving.

I am going to try the suggested steps.

I'll report back if I get results.

pixel is offline   Reply With Quote
Old 15th January 2017, 21:21   #7  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 1,887
You not only posted this same exact thing at VideoHelp, which is OK, but now you've cross posted this exact same thing elsewhere in this forum (in the General section). That is against the rules of this forum. You should delete that other post.
johnmeyer is offline   Reply With Quote
Old 16th January 2017, 00:53   #8  |  Link
FranceBB
FranceBB
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Germany
Posts: 198
@pixel... I used SuperRes because it was the first function of the Shader.avsi you linked (I was in a hurry as I had to go to work; morning shift, sadly). Anyway, using HLSL it's pretty much the same as Selur wrote.
FranceBB is offline   Reply With Quote
Old 16th January 2017, 17:54   #9  |  Link
pixel
Registered User
 
Join Date: Jan 2017
Posts: 5
@JohnMeyer

An inventor has brought us a video-processing prototype which is basically 4 custom-developed HLSL shaders that run in realtime inside Media Player Classic.

The results are great in MPC, but we need to find a way to process 20 - 30 test videos a day with this, and SAVE the result to a pixel-accurate video file each time.

This Avisynth plugin seems to be the only technology that can do this.

I'm trying very hard to get Avisynth/Shader Plugin/Virtualdub to work together, but I'm completely new to Avisynth.

So please have some patience with me. =)
pixel is offline   Reply With Quote
Old 16th January 2017, 18:04   #10  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 1,887
You completely misunderstood my post: I was simply trying to help you to avoid violating the rules of this forum so that one or both of your threads don't get closed. I was not being "inpatient" with you.
johnmeyer is offline   Reply With Quote
Old 16th January 2017, 18:14   #11  |  Link
pixel
Registered User
 
Join Date: Jan 2017
Posts: 5
I have deleted the other post - I didn't see the delete option when I first clicked "edit". I thought a moderator might have to delete it.

Thanks!
pixel is offline   Reply With Quote
Reply

Tags
avisynth, hlsl, script, shader

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 01:39.


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