Hi,
After googling around for hours, it seems that the VapourSynth is the latest advancement based on AviSynth. This piqued my interest;
1.a - I would like to know, how to convert AviSynth scripts to VapourSynth ones correctly. This is what needs to be done;
1.b - I would also like to know, if you can do this FFMpeg command with a VapourSynth script;Code:#combine two videos together ffms2("E:\Game_Project\Taival\Marketing\3rd_recording01.mkv")++ffms2("E:\Game_Project\Taival\Marketing\3rd_recording02.mkv") #crop and addborder crop(0,45,0,-69) AddBorders(0,0,0,114)
If these (1.a and 1.b) could be combined into one script, that would streamline everything needed in regards to initial processing of time-lapse videos.Code:#remove every duplicate frame with specified similarity threshold. ffmpeg -i E:\3rd_recording_cropped-bordered.mkv -an -c hevc_nvenc -preset lossless -pix_fmt yuv444p -vf "select='if(gt(scene,0.01),st(1,t),lte(t-ld(1),1))',setpts=N/FRAME_RATE/TB" E:\3rd_recording_crop-bord-trim.mkv
2. Can the latest HandBrake (1.2.0 at the time of writing) be used with this script in some way?
Thank you for your time and effort
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 15 of 15
Thread
-
-
I would like to know, how to convert AviSynth scripts to VapourSynth ones correctly.
If I understand the AVS script correctly, this should do what you want:
Code:import vapoursynth as vs core = vs.core src = core.ffms2.Source(r"path to src1") + core.ffms2.Source("path to src2") src = core.resize.Point(src, format=vs.YUV444P8) # necessary because non-mod 2 resolutions obviously don’t work in 420 cropped = core.std.Crop(src, 0, 0, 45, 69) withborders = core.std.AddBorders(cropped, 0, 0, 0, 114) withborders.set_output()
The duplicate removal is most likely doable as well with PlaneStats/Expr and FrameEval, but that would take some more advanced scripting.
2. Can the latest HandBrake (1.2.0 at the time of writing) be used with this script in some way?Last edited by Lypheo; 10th Feb 2019 at 09:49. Reason: I’m dumb
-
VapourSynth package comes with a virtual fileserver allowing both AviSynth and VapourSynth scripts to be opened in software that otherwise don't support opening such scripts but do support uncompressed AVI - like HandBrake.
http://www.vapoursynth.com/doc/avfs.html -
Thank you for the tip Could you instruct on how this could be done in a single script file - the above functions to combine, crop and add border to video and after that automatically launch the ffmpeg command through VSPipe?
Could you give me an example on how I would run the above script with AVFS? The instructions say to run the avfs.exe with the script file as an argument, but does not specify the format of the argument it needs to function. -
Not sure I understand the question. Maybe it is too simple?
Code:avfs "c:\script.vpy"
Code:avfs "c:\script.avs"
-
Thank you for the tip Could you instruct on how this could be done in a single script file - the above functions to combine, crop and add border to video and after that automatically launch the ffmpeg command through VSPipe?
Save the script I wrote to some file (ending with .vpy) and run this command:
Code:vspipe --y4m script.vpy - | ffmpeg -i pipe: -c:v hevc_nvenc -preset lossless -pix_fmt yuv444p -vf "select='if(gt(scene,0.01),st(1,t),lte(t-ld(1),1))',setpts=N/FRAME_RATE/TB" E:\3rd_recording_crop-bord-trim.mkv
-
Yup, was too simple Usually when documentation says "use as an argument" there is some front indicator to what kind of argument it is, like "-i E:\
murderinc.mkv" or similar. Good to know, thank you for your help
Thank you for the patience, I have noticed some format differences between actual command lines and manuals, or just fixated too much on the different way the documentations have been written in, like for AVS, the wiki often uses a style of explanation that easily misleads beginners.
For example, a AVS script documentation; "Crop(clip clip, int left, int top, int -right, int -bottom [, bool align ] )"
The first "clip clip," is confusing, especially since to crop a video, you only need "crop(10,10,-10,-10)" in most cases.
Luckily there was a clear example in the bottom of the wiki page, but not every manual/documentation have these.
I checked the examples on VSPipe usage and only understood the logic of it after I watched your example. Might be because of several badly slept nights but still
Thank you for your examples, sped up my progress tremendously -
Last edited by pernicio; 10th Feb 2019 at 13:31. Reason: for not paying attention
-
I tried to apply the settings as instructed on the site, but I'm clearly doing something wrong. I tried many different settings, but this is the latest that doesn't work;
Code:-vf "crop=w=1920:h=1080:x=45:y=69,pad=1920:1080:0:114"
-
crop x is on the horizontal axis, i.e. if you want to crop on left side. Not for bottom.
Try:
Code:-vf "crop=w=1920:h=(1080-45-69):x=0:y=45,pad=1920:1080:0:0"
Last edited by sneaker; 11th Feb 2019 at 09:02.
-
Nice! that worked perfectly Thank you so much. Hopefully there will be a simpler alternative to this in the future, like separation of advanced and simple cropping and padding.
Couple of more questions about the logic of the filter arguments;
1.a - If I ever wanted to crop from left and right side, would the argument look like this?
Code:-vf "crop=w=(1920-12-3):h=1080:x=12:y=0"
For example, if I needed to fit a 1440x1080 4:3 video to a 1920x1080 16:9 size with 240 pixels of padding on both sides.
2 - What would the "pad" be, if I would need to put the padding on top of the video?
3 - Does "pad" argument work with the same logic as "crop"?
Thank you for helping me understand the logic behind this, the width : height : x : y needs completely different kind of logic I have ever had to deal with when editing videos.
For example, what does the "y=45" really tell the software to do in this argument, when the cropped pixels are already defined in the "h=(1080-45-69"?
Code:"crop=w=1920:h=(1080-45-69):x=0:y=45"
-
Not much time right now, but e.g. h=(1080-45-69) does not by itself tell ffmpeg where to crop. It's just a mathematical expression that ffmpeg solves/evaluates so you don't have to calculate it manually. If you wrote h=966 the result would be exactly the same.
Let's say your input has 1000 pixels height. h is the height of the output. y is how much ffmpeg crops from top. The rest is implicit. If I set e.g. h=700, y=100, then it's clear that 100 rows will be cropped from the top and 200 from the bottom. -
Makes sense, thank you for the clear explanation
So, instead of needing to use cropping separately for top and bottom, you only need to define how much to crop form the top. The bottom is then cropped out by default in an area that is outside of the bounds of the defined pixel count (counted from top left corner of the video), which in this case is 966 pixels.
Following this logic, the answer to my above questions would be like this;
1.a - If I ever wanted to crop from left and right side, would the argument look like this?
Code:-vf "crop=w=(1920-12-3):h=1080:x=12:y=0"
1.b - If I'd like to pad the left and/or right side of the video, what would the "pad" arguments be?
Code:-vf "pad=1920:1080:240:0"
2 - What would the "pad" be, if I would need to put the padding on top of the video?
Code:-vf "pad=1920:1080:0:114"
Yes
Am I correct thus far?
Similar Threads
-
Help transitioning from avisynth to vapoursynth.
By zanzar in forum Newbie / General discussionsReplies: 10Last Post: 3rd Feb 2019, 17:50 -
Qt Vapoursynth simple viewer example?
By Selur in forum ProgrammingReplies: 3Last Post: 20th Mar 2018, 12:02 -
Vapoursynth: How to getting BilateralGPU to work?
By Selur in forum Newbie / General discussionsReplies: 0Last Post: 17th Feb 2018, 06:58 -
StaxRip 1.7.0.0 with Vapoursynth ?
By locky in forum Video ConversionReplies: 6Last Post: 24th Jan 2018, 19:08 -
vapoursynth
By logicom in forum Video ConversionReplies: 0Last Post: 1st Dec 2014, 08:26