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 22nd September 2020, 22:57   #1  |  Link
ISmileAtYouuu
Registered User
 
Join Date: Sep 2020
Posts: 15
my resizing method

how to convert 2D video to 360 degree VR video, or resize-upscale 2D video

step 1 the basic software and resizing

vr software: virtual desktop, watch with windows movie & TV program, roll the video up with your mouse so you can see it.

avisynth+
https://github.com/AviSynth/AviSynthPlus/releases

avisynth shader, i deleted shader.dll because otherwise its the 32 bit version in the 64 bit folder, and that would cause an error when opening the avs file with virtualdub x64.
https://github.com/mysteryx93/AviSynthShader/releases

AviSynth AiUpscale v1.0.1, put shaders folder and AiUpscale.avsi file into avisynth plugins folder
https://github.com/Alexkral/AviSynth...ses/tag/v1.0.1

FFmpeg, i unzip using 7 zip, the put folder in c drive, then add the bin folder to my path; C:\ffmpeg-4.4-full_build\bin
- Open the Start Search, type in “env”, and choose “Edit the system environment variables”
- Click the “Environment Variables…” button
- Under the “System Variables” section (the lower half), find the row with “Path” in the first column, and click edit
- The “Edit environment variable” UI will appear. Here, you can click “New” and type in the new path you want to add. From this screen you can also edit or reorder them.
- Dismiss all of the dialogs by choosing “OK”. Your changes are saved!
You will probably need to restart apps for them to pick up the change. Restarting the machine would ensure all apps are run with the PATH change.
https://www.gyan.dev/ffmpeg/builds/

LSMASHSource
http://avisynth.nl/index.php/LSMASHSource

avidemux
http://avidemux.sourceforge.net/

daa()
http://avisynth.nl/index.php/DAA
Nnedi3
http://avisynth.nl/index.php/Nnedi3
MaskTools2
http://avisynth.nl/index.php/MaskTools2
RgTools
http://avisynth.nl/index.php/RgTools
Microsoft Visual C++ 2019 Redistributable Package (x86 / x64)
https://support.microsoft.com/en-us/...al-c-downloads

SmoothD2
http://avisynth.nl/index.php/SmoothD2

DeHalo alpha
http://avisynth.nl/index.php/DeHalo_alpha

LSFmod
http://avisynth.nl/index.php/LSFmod

Last NVEnc codec
https://github.com/rigaya/NVEnc/releases/

install python 2 for windows 10;
https://www.python.org/downloads/release/python-2718/

converter:
https://github.com/google/spatial-me...a.Tool.win.zip

staxrip
https://github.com/Revan654/staxrip/...es/tag/2.0.2.4

resize

Code:
video = LSMASHVideoSource("C:\Users\office\Downloads\Enya - It's In The Rain.mp4").Crop(0, 56, 0, -56).ConvertToYV12(interlaced = false)

audio = LSMASHAudioSource("C:\Users\office\Downloads\Enya - It's In The Rain.mp4")
AudioDubStep = AudioDub(video, audio)
 
step1 = SmoothD2(AudioDubStep, ZWlmDark = 50, Qtype = 3, Matrix = 4, quant = 12)
step2 = daa(step1)
step3 = LSFmod(step2, strength = 200)

step4 = AiUpscale (step3, Luma = "HQ", Width = 1280, Height = 736 )

step5 = DeHalo_alpha (step4, rx = 1.2, ry = 1.2, lowsens = 1, highsens = 2)

resizeVideo = Spline64Resize(step5, 1920, 1104 ) 

step6 = LSFmod(resizeVideo, strength = 200)

return (step6)
2d to 360d

Code:
video = LSMASHVideoSource("C:\do it.mp4").Crop(0, 0, 0, 0).ConvertToYV12(interlaced = false)

blank = BlankClip(video)

step4a = StackVertical(blank, blank, blank)
step4b = StackVertical(blank, blank, video)
step4c = StackVertical(blank, blank, blank)

step5 = StackHorizontal(step4a, step4b, step4c)

audio = LSMASHAudioSource("C:\do it.mp4")
AudioDubStep = AudioDub(audio, step5)

return (step5)
for the stacked video the source should be 1920,1080.
i like to speed up a section into either 170 percent or 30 percent, using movavi video editor. for warzone i use movavi video editor and change the speed, save as 1920,1080, and fps 60.

setup staxrip
- move staxrip.exe and staxrip.exe.config from \Staxrip.2.0.2.4.x64\v4.8 folder, into \Staxrip.2.0.2.4.x64 folder
- apps, manage
update NVEnc and avisynth versions
- drag and drop from NVEnc folder into the staxrip Staxrip.2.0.2.4.x64\Apps\Encoders\NVEnc folder.
- replace the LSMASHSource.dll in Staxrip.2.0.2.4.x64\Apps\Plugins\AVS\L-Smash-Works with the LSMASHSource.dll in C:\Program Files (x86)\AviSynth+\plugins64+
-
nvidia h.265
encoder options
basic, mode, vbr hq - variable bitrate hq
basic depth 8 bit
Slice Decision, GOP Length = 33
make new profile nvidia h.265 8 bit
ok, change encoder from nvidia h.265 to the profile you just made.

mp4

-
audio aac 318

-
1080p resize video bitrate 5000
1080p 2d to 360d video bitrate 5000.
-
file, save project as template, check box load template on startup

you can then encode multiple avs files with staxrip,
make a bunch of sets of video files, a bunch of avs files, save the avs files into the same folder, then in staxrip, file, open video file, file batch, add, add folder.

or,
for the one video,
open staxrip, file, open video file, choose avs file
click target and choose where to save the file, click next, start.

use converter software open the file staxrip made and convert to 360 degree video ("my video is spherical 360").

if the video stutters and your videocard supports h.265 decoding, then your not using hw decoding, then you need to use the hw decoding on the videocard,

"If you are on the latest Windows 10 Fall Creators Update, make sure to download the HEVC Video Extension to get the best hardware decoding performance. It used to be part of Windows but is now a separate download, from the microsoft store."
which means the microsoft store hevc codec you buy is really good to use instead of klite which is free.

or
install klite;
k_lite_mega_codec_pack
https://m.majorgeeks.com/files/detai...odec_pack.html

i installed the klite codec pack and set h.265 decoder to lav in "preferred decoders" tab using the tweak tool in the klite software.
i just set everything to use lav in the "preferred decoders" tab though.

do not open file with vlc it is buggy as of today i put in a bug report,

- if the youtube 360 degree downloaded video plays in regular 2d video, then you need to use the converter tool again, to reconvert the 2d video back to 360 degree video.

https://www.movavi.com/videoeditor/
Attached Files
File Type: 7z MCTemporalDenoise.7z (13.1 KB, 6 views)

Last edited by ISmileAtYouuu; 18th April 2021 at 23:53.
ISmileAtYouuu is offline   Reply With Quote
Old 22nd September 2020, 23:25   #2  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,473
For some reason, there's no link for the mod version of MCTemporalDenoise at the top of the page. You have to use the link at the bottom.
http://avisynth.nl/index.php/MCTemporalDenoise
http://pastebin.com/raw.php?i=xuRuW787

The function name of the mod version is MCTD(), although now I've looked, it appears to also be using the original Sangnom.

Last edited by hello_hello; 22nd September 2020 at 23:31.
hello_hello is offline   Reply With Quote
Old 23rd September 2020, 00:14   #3  |  Link
ISmileAtYouuu
Registered User
 
Join Date: Sep 2020
Posts: 15
the version i uploaded has the sangnom changes.
ISmileAtYouuu is offline   Reply With Quote
Old 23rd September 2020, 00:17   #4  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 306
Quote:
Originally Posted by hello_hello View Post
For some reason, there's no link for the mod version of MCTemporalDenoise at the top of the page. You have to use the link at the bottom.
http://avisynth.nl/index.php/MCTemporalDenoise
http://pastebin.com/raw.php?i=xuRuW787

The function name of the mod version is MCTD(), although now I've looked, it appears to also be using the original Sangnom.
Your old too, here for last ver
https://github.com/realfinder/AVS-St...alDenoise.avsi

And last MCTD too
https://github.com/Asd-g/AviSynthPlu...ter/MCTD_.avsi

Can put 2 script above in one folder
kedautinh12 is offline   Reply With Quote
Old 23rd September 2020, 00:25   #5  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,158
my edit of MCTemporalDenoise still use SangNom since https://github.com/Asd-g/AviSynth-SangNom2 added SangNom
__________________
See My Avisynth Stuff
real.finder is offline   Reply With Quote
Old 23rd September 2020, 02:54   #6  |  Link
ISmileAtYouuu
Registered User
 
Join Date: Sep 2020
Posts: 15
i updated the smoothd2 settings, they were too strong, not visible on 1080p but clear on 480p video. so i tested it and this smoothd2 setting loses next to no resolution.
ISmileAtYouuu is offline   Reply With Quote
Old 23rd September 2020, 04:37   #7  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 306
libfftw3f-3.dll 3.3.8 (faster than 3.3.5)
https://drive.google.com/file/d/1KUz...w?usp=drivesdk
kedautinh12 is offline   Reply With Quote
Old 29th September 2020, 20:37   #8  |  Link
Katie Boundary
Registered User
 
Katie Boundary's Avatar
 
Join Date: Jan 2015
Posts: 781
My resizing method:

spline144resize()
__________________
If I ask "How do I do X?" or "what happens if I do X?", and X is a very bad thing that no one would ever normally do, assume that I already know this, and that I have Katie reasons for asking anyway.
Katie Boundary is offline   Reply With Quote
Old 30th September 2020, 16:58   #9  |  Link
ISmileAtYouuu
Registered User
 
Join Date: Sep 2020
Posts: 15
Quote:
Originally Posted by Katie Boundary View Post
My resizing method:

spline144resize()
Quote:
Originally Posted by Katie Boundary View Post
(trying to simulate the effects of upscaling 720x480 to 1280x720)

Script:

Code:
source blah blah deinterlace blah blah

converttorgb()

X=arearesize(640,360)
Y=bilinearresize(360,240).spline144resize(640,360)
Z=bilinearresize(360,240).lanczos4resize(640,360)

M=compare(Y,X)
N=compare(Z,X)

stackvertical(M,N)
Although Spline64 very very very slightly underperforms Lanczos on maybe 90% of frames, with the difference between Lanczos-3 and Lanzcos-4 being negligible, Spline144 absolutely blows Lanczos out of the water. I'm seeing PSNR improvements of up to 2 dB, and a ~0.2 reduction in mean absolute deviation.

Why is this not more commonly mentioned?
https://forum.doom9.org/showthread.php?t=175187

sounds cool. i might try this out later on. how would i double the size of a video with spline144resize()?

Last edited by ISmileAtYouuu; 30th September 2020 at 17:00.
ISmileAtYouuu is offline   Reply With Quote
Old 30th September 2020, 19:21   #10  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Metropolitan City of Milan, Italy
Posts: 1,405
If your final goal is to upscale, I wouldn't just use a resizing kernel and trust it blindly, but I would use it through NNEDI3 instead.

For instance:

Code:
nnedi3_resize16(target_width=1920, target_height=1080, mixed=true, thr=1.0, elast=1.5, 
nns=4, qual=2, etype=0, pscrn=4, threads=0, tv_range=true, kernel_d="Spline", 
kernel_u="Spline", taps=6, f_d=1.0, f_u=2.0, sharp=0, lsb_in=true, lsb=true)
here you can choose the kernel, in this case Spline, and the number of taps to be arbitrarily how many you want.
This way, you can have Spline16, Spline36, Spline64, Spline144 and so on.
Right now I already set it to "taps=6" for you so that it's gonna be Spline144Resize.
Feel free to test it and report.
Some people find Spline36Resize to be ok and Spline64 to be perfect for pretty much everything, but some other people like Katie say that going to 144 actually makes sense and it's noticeable. Ultimately, I think it's up to you and your eyes as it's really just a tradeoff between what you consider to be worth quality wise and speed.

Side note: this works in 16bit stacked. Put lsb_in=true, lsb=true for 16bit stacked, set them to false for 8bit planar.
For instance, in Avisynth+:

Code:
ConvertBits(16)
ConverttoStacked()
nnedi3_resize16() #with the parameters you want
ConvertFromStacked()
in normal Avisynth 2.6.1:

Code:
Dither_convert_8_to_16()
nnedi3_resize16()

I personally use NNEDI3 in 16bit with Spline64 by the way.

Cheers,
Frank
FranceBB is offline   Reply With Quote
Old 1st October 2020, 01:38   #11  |  Link
ISmileAtYouuu
Registered User
 
Join Date: Sep 2020
Posts: 15
ty francebb, i like to use the sw called AiUpscale though. it works and that's all i care about. if i was younger i might have tried everything in the avisynth wiki including nnedi3_resize16 and tweaked it too, but its not in me anymore, sry. ty tho. weary traveler smiles at yu.

Last edited by ISmileAtYouuu; 1st October 2020 at 01:40.
ISmileAtYouuu is offline   Reply With Quote
Old 1st October 2020, 21:48   #12  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,158
Quote:
Originally Posted by FranceBB View Post
If your final goal is to upscale, I wouldn't just use a resizing kernel and trust it blindly, but I would use it through NNEDI3 instead.

For instance:

Code:
nnedi3_resize16(target_width=1920, target_height=1080, mixed=true, thr=1.0, elast=1.5, 
nns=4, qual=2, etype=0, pscrn=4, threads=0, tv_range=true, kernel_d="Spline", 
kernel_u="Spline", taps=6, f_d=1.0, f_u=2.0, sharp=0, lsb_in=true, lsb=true)
here you can choose the kernel, in this case Spline, and the number of taps to be arbitrarily how many you want.
This way, you can have Spline16, Spline36, Spline64, Spline144 and so on.
Right now I already set it to "taps=6" for you so that it's gonna be Spline144Resize.
Feel free to test it and report.
Some people find Spline36Resize to be ok and Spline64 to be perfect for pretty much everything, but some other people like Katie say that going to 144 actually makes sense and it's noticeable. Ultimately, I think it's up to you and your eyes as it's really just a tradeoff between what you consider to be worth quality wise and speed.

Side note: this works in 16bit stacked. Put lsb_in=true, lsb=true for 16bit stacked, set them to false for 8bit planar.
For instance, in Avisynth+:

Code:
ConvertBits(16)
ConverttoStacked()
nnedi3_resize16() #with the parameters you want
ConvertFromStacked()
in normal Avisynth 2.6.1:

Code:
Dither_convert_8_to_16()
nnedi3_resize16()

I personally use NNEDI3 in 16bit with Spline64 by the way.

Cheers,
Frank
I modded nnedi3_resize16 to work with HBD if you don't know
__________________
See My Avisynth Stuff
real.finder is offline   Reply With Quote
Old 2nd October 2020, 12:53   #13  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Metropolitan City of Milan, Italy
Posts: 1,405
Quote:
Originally Posted by real.finder View Post
I modded nnedi3_resize16 to work with HBD if you don't know
Ah! That's sweet. So it works with 16bit stacked AND 16bit planar as well now?
FranceBB is offline   Reply With Quote
Old 2nd October 2020, 18:00   #14  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,158
Quote:
Originally Posted by FranceBB View Post
Ah! That's sweet. So it works with 16bit stacked AND 16bit planar as well now?
yes and 32 bit float, you need also update ContraSharpen_mod.avsi, but keep in mind that with HBD you will need ResizeX and most conversion parameters in nnedi3_resize16 will not do anything (since the input color formats = the output color formats), the output also is different in HBD see here https://forum.doom9.org/showthread.p...63#post1903763
__________________
See My Avisynth Stuff
real.finder is offline   Reply With Quote
Old 2nd October 2020, 20:21   #15  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Metropolitan City of Milan, Italy
Posts: 1,405
Uhm... I updated nnedi3_resize16, resizex and zrf_share with the latest ones you uploaded on Doom9 / GitHub and I tried something really simple (and stupid):

Code:
ColorBars(848, 480, pixel_type="YV12")

ConvertBits(32)

nnedi3_resize16(target_width=1920, target_height=1080, kernel_u="Spline", taps=6)
but



If I get rid of the "kernel_u=" parameter, then it works:

Code:
nnedi3_resize16(target_width=1920, target_height=1080)
however, without specifying the kernel, I don't really know which resizing kernel is going to use.
I can of course specify it as:

Code:
nnedi3_resize16(target_width=1920, target_height=1080, kernel_u="Spline64")
however if someone wants to specify different taps/lobes for Lanczos or Spline for instance, it's not possible.
For instance, although I'm gonna be fine with Spline64, if someone like Katie wants to specify taps=6 in Spline to use Spline144Resize, it's not possible.
Wouldn't it be better to port ResizeX to planar High Bit Depth as well? (Or at least add a conversion/fallback to stacked for it?)
FranceBB is offline   Reply With Quote
Old 2nd October 2020, 20:38   #16  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,158
Quote:
Originally Posted by FranceBB View Post
Uhm... I updated nnedi3_resize16, resizex and zrf_share with the latest ones you uploaded on Doom9 / GitHub and I tried something really simple (and stupid):

Code:
ColorBars(848, 480, pixel_type="YV12")

ConvertBits(32)

nnedi3_resize16(target_width=1920, target_height=1080, kernel_u="Spline", taps=6)
but



If I get rid of the "kernel_u=" parameter, then it works:

Code:
nnedi3_resize16(target_width=1920, target_height=1080)
however, without specifying the kernel, I don't really know which resizing kernel is going to use.
I can of course specify it as:

Code:
nnedi3_resize16(target_width=1920, target_height=1080, kernel_u="Spline64")
however if someone wants to specify different taps/lobes for Lanczos or Spline for instance, it's not possible.
For instance, although I'm gonna be fine with Spline64, if someone like Katie wants to specify taps=6 in Spline to use Spline144Resize, it's not possible.
Wouldn't it be better to port ResizeX to planar High Bit Depth as well? (Or at least add a conversion/fallback to stacked for it?)
ResizeX already ported to HBD, but not with all the settings (since some use dither tools pack)

as the message said, there are no Spline without lsb, unless someone did this port https://forum.doom9.org/showpost.php...postcount=1125 then I will update ResizeX to use it, I avoid use "HBD to hack then HBD" in first place, and even if it done you can't use anything from HBD except 16bit so it's not worth it
__________________
See My Avisynth Stuff
real.finder is offline   Reply With Quote
Old 2nd October 2020, 22:52   #17  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Metropolitan City of Milan, Italy
Posts: 1,405
Ah ok, got it. Makes sense.
Well, thank you, by the way.
I've put your Github page in my watchlist so that I'm not gonna miss any future update (hopefully xD).
FranceBB is offline   Reply With Quote
Old 4th November 2020, 20:55   #18  |  Link
ISmileAtYouuu
Registered User
 
Join Date: Sep 2020
Posts: 15
i updated the 360 degree code in the first post. looks nicer in vr.
ISmileAtYouuu is offline   Reply With Quote
Old 5th November 2020, 09:57   #19  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Metropolitan City of Milan, Italy
Posts: 1,405
Well, since we're talking about VR and 360 videos, I used to encode HD 3D SBS videos, but I've never really encoded a VR one.
Out of curiosity, before I make any tests, is there something I should be aware of before I encode one, converting from 2D with your script?
I mean, is there a flag I gotta put when I encode with x264?
You know, I'm not really a fan of VR stuff, so this is all pretty new to me...
FranceBB is offline   Reply With Quote
Old 5th November 2020, 12:08   #20  |  Link
ISmileAtYouuu
Registered User
 
Join Date: Sep 2020
Posts: 15
the souce file can be too big a resolution which will crash avidemux and staxrip when you open the avs file. i find 1080p files work and look nice, but 720p videos look nice too. and larger a source video and it will probably not even open the avs file.

you need movavi video editor, if you follow my guide. if you find some other way for free then please do share. its impossible otherwise to split and have the same files length for the three videos which causes lip sync errors.

https://www.movavi.com/videoeditor/

all the flags for the encoder are detailed in the guide i updated the guide a minute ago to be more clear.

assuming a 1080p source file resolution, if you crop in the avs code you need to adjust the crop in the code from 540 for height to the half height value, and the width instead of 960 to half the width.

heres some of my videos so you can see what they look like, look in the vr videos to see some mmd dance videos with miku and rin:

https://www.youtube.com/channel/UCO_...1x0KH9fog5gTkA

Last edited by ISmileAtYouuu; 7th November 2020 at 22:34.
ISmileAtYouuu is offline   Reply With Quote
Reply

Tags
guide, mctemporaldenoise, resize

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


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