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 > VapourSynth

Reply
 
Thread Tools Search this Thread Display Modes
Old 12th May 2019, 16:25   #61  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,722
Same error using ffms2 as src filter.

edit:

I missed using : -f vapoursynth
__________________
mpv.net - StaxRip - MediaInfo.NET - Get-MediaInfo - More

Last edited by stax76; 12th May 2019 at 16:33.
stax76 is offline   Reply With Quote
Old 12th May 2019, 16:45   #62  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,722
The built works very well and it's really helpful being able to open vpy with ffmpeg.

I wonder if mpv can open vpy too? I tried it a few days before but couldn't get it working.
__________________
mpv.net - StaxRip - MediaInfo.NET - Get-MediaInfo - More
stax76 is offline   Reply With Quote
Old 14th May 2019, 20:19   #63  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,722
@Wolfberry

I would like to suggest using --enable-libmp3lame in the next built.
__________________
mpv.net - StaxRip - MediaInfo.NET - Get-MediaInfo - More
stax76 is offline   Reply With Quote
Old 15th May 2019, 16:55   #64  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,722
@Wolfberry

Thanks for the new built. There is an issue, I'm not able to use this command line:

ffmpeg.exe -f vapoursynth -i C:\test.vpy -c:v libx265 -an -y -hide_banner C:\test.mkv

The problem seem to be arbitrary because sometimes it works and it happens only with x265 and not with x264.
__________________
mpv.net - StaxRip - MediaInfo.NET - Get-MediaInfo - More
stax76 is offline   Reply With Quote
Old 16th May 2019, 19:59   #65  |  Link
Revan654
Registered User
 
Revan654's Avatar
 
Join Date: May 2004
Posts: 324
Quote:
Originally Posted by stax76 View Post
@Wolfberry

Thanks for the new built. There is an issue, I'm not able to use this command line:

ffmpeg.exe -f vapoursynth -i C:\test.vpy -c:v libx265 -an -y -hide_banner C:\test.mkv

The problem seem to be arbitrary because sometimes it works and it happens only with x265 and not with x264.
from what I read there been some changes to x265 ffmpeg encoder.

If all else fails you could just do this:

Quote:
"C:\Program Files (x86)\VapourSynth\core64\vspipe.exe" -y "to\your\VS\Script.vpy" - | "x265.exe" [Options] -
I know it defeats the purpose of using ffmpeg internal encoder, but cmd line might help come up with proper cmdline.

I know this code works with x265, NVEnc, and mpv player.
Revan654 is offline   Reply With Quote
Old 16th May 2019, 20:02   #66  |  Link
Revan654
Registered User
 
Revan654's Avatar
 
Join Date: May 2004
Posts: 324
Quote:
Originally Posted by stax76 View Post
The built works very well and it's really helpful being able to open vpy with ffmpeg.

I wonder if mpv can open vpy too? I tried it a few days before but couldn't get it working.
Unless something has changed, It's Not possible. I've tried to get it to work last year, Every single test failed. It would just refuse to open file or just crash the program.

However using the following line will play back the vpy script in mpv, It will lack the ability to properly scrub the file forward or back.

Quote:
"C:\Program Files (x86)\VapourSynth\core64\vspipe.exe" -y "to\your\VS\Script.vpy" - | "mpv.exe" [Options] -
This was the basic set to the script:

Quote:
import os
import sys
ScriptPath = 'Path/to/your/VS/Scripts/Filters'
sys.path.append(os.path.abspath(ScriptPath))
import vapoursynth as vs
core = vs.get_core()
core.std.LoadPlugin(r"SourceFilterHere|I'm Using DGIndexNV")
clip = core.dgdecodenv.DGSource(r"C:\to\your\Source\File.mkv")
clip.set_output()
However Potplayer can open vpy script and play it back.

Last edited by Revan654; 16th May 2019 at 20:08.
Revan654 is offline   Reply With Quote
Old 18th May 2019, 03:34   #67  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 193
clip could be output to mpv player right from script itself using output() and using subprocess modul. VSEdit might need clip.set_output() at the end.
Code:
import vapoursynth as vs
from vapoursynth import core
import subprocess

clip = core.avisource.AVISource(r'C:\video.avi')

#import shutil
#mpv = shutil.which('mpv')
mpv = r'C:\tools\mpv.exe'
mpv_cmd = [mpv, '-']
process = subprocess.Popen(mpv_cmd, stdin=subprocess.PIPE)
file_handle=process.stdin
clip.output(file_handle, y4m = True)
process.communicate()

Last edited by _Al_; 18th May 2019 at 03:42.
_Al_ is offline   Reply With Quote
Old 19th May 2019, 08:44   #68  |  Link
Wolfberry
Helenium(Easter)
 
Wolfberry's Avatar
 
Join Date: Aug 2017
Location: Hsinchu, Taiwan
Posts: 97
Quote:
Originally Posted by stax76 View Post
The problem seem to be arbitrary because sometimes it works and it happens only with x265 and not with x264.
Yes, I am able to reproduce it.

I adjusted the LAVF patches for x265 and it seems to be better, can you confirm?
__________________
Monochrome Anomaly

Last edited by Wolfberry; 28th May 2019 at 08:08.
Wolfberry is offline   Reply With Quote
Old 19th May 2019, 13:13   #69  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,722
@Wolfberry

It's either fixed or improved, didn't happen in a couple of test runs, much appreciated, thanks.
__________________
mpv.net - StaxRip - MediaInfo.NET - Get-MediaInfo - More
stax76 is offline   Reply With Quote
Old 23rd May 2019, 21:16   #70  |  Link
unix
Registered User
 
Join Date: Aug 2015
Posts: 44
I tried to use Wolfberry FFmpeg Builds but I couldn't encode, did I missed something?

vpy script:

Quote:
import os
import sys
from vapoursynth import core
import vapoursynth as vs
core = vs.get_core()

src = core.ffms2.Source(source='dcr.mkv').std.AssumeFPS(fpsnum=24000,fpsden=1001).std.Trim(60,75)
src.set_output()

Quote:
ffmpeg.exe -f vapoursynth -i TEST.vpy -c:v libx264 -an test1.mkv

Last edited by unix; 25th May 2019 at 08:41.
unix is offline   Reply With Quote
Old 23rd May 2019, 22:19   #71  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,722
Try with the most simple script, meaning only the source filter, what does ffmpeg output?
__________________
mpv.net - StaxRip - MediaInfo.NET - Get-MediaInfo - More
stax76 is offline   Reply With Quote
Old 24th May 2019, 07:59   #72  |  Link
unix
Registered User
 
Join Date: Aug 2015
Posts: 44
But my script so simple

Quote:
from vapoursynth import core
import vapoursynth as vs
core = vs.get_core()

src = core.ffms2.Source(source='drc.mkv')
src.set_output()
Still I didn't get any output file!!!

Last edited by unix; 25th May 2019 at 08:41.
unix is offline   Reply With Quote
Old 24th May 2019, 12:26   #73  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,722
There is no output so it could be the same problem I had before. Since you are using relative paths, are you sure all files can be found? Does it work with a real input file (mkv)?
__________________
mpv.net - StaxRip - MediaInfo.NET - Get-MediaInfo - More
stax76 is offline   Reply With Quote
Old 24th May 2019, 17:19   #74  |  Link
unix
Registered User
 
Join Date: Aug 2015
Posts: 44
Quote:
Originally Posted by stax76 View Post
There is no output so it could be the same problem I had before. Since you are using relative paths, are you sure all files can be found? Does it work with a real input file (mkv)?
All files are in the same folder which is VapourSynth64Portable

Quote:
from vapoursynth import core
import vapoursynth as vs
core = vs.get_core()

src = core.ffms2.Source(source='C:/Users//Desktop/VapourSynth64Portable/cdl.mkv')
src.set_output()
I tried with avi as well, but there's no output, also I used ffplay but nothing happens!

Quote:
ffplay.exe -f vapoursynth -i test.vpy
unix is offline   Reply With Quote
Old 24th May 2019, 17:43   #75  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 747
Quote:
Originally Posted by Wolfberry View Post
VapourSynth and VSScript are now statically linked into ffmpeg.
By the way, did you need to patch VapourSynth to accomplish this?
__________________
Buy me a "coffee" and/or hire me to write code!
jackoneill is offline   Reply With Quote
Old 24th May 2019, 18:22   #76  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,477
Quote:
Originally Posted by unix View Post
All files are in the same folder which is VapourSynth64Portable



I tried with avi as well, but there's no output, also I used ffplay but nothing happens!
I think VS needs to be installed. ffmpeg & ffplay are working fine.
Tested with: ffplay.exe -f vapoursynth -i 'D:\test.vpy'
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database || https://github.com/avisynth-repository
ChaosKing is offline   Reply With Quote
Old 24th May 2019, 22:50   #77  |  Link
Wolfberry
Helenium(Easter)
 
Wolfberry's Avatar
 
Join Date: Aug 2017
Location: Hsinchu, Taiwan
Posts: 97
Quote:
Originally Posted by jackoneill View Post
By the way, did you need to patch VapourSynth to accomplish this?
I use gendef and dlltool to generate delay-import libraries from official VapourSynth and Python dlls, so no patch is needed.

What I mean by static is that ffmpeg will not require extra dlls at startup.

Quote:
Originally Posted by ChaosKing View Post
I think VS needs to be installed. ffmpeg & ffplay are working fine.
Tested with: ffplay.exe -f vapoursynth -i 'D:\test.vpy'
Portable VapourSynth should also works since this is the only one I tested.

I just extracted VapourSynth64-Portable-R45, python-3.7.3-embed-amd64 and ffmpeg to the same directory and use that as a testing environment.
__________________
Monochrome Anomaly

Last edited by Wolfberry; 28th May 2019 at 08:07.
Wolfberry is offline   Reply With Quote
Old 25th May 2019, 08:40   #78  |  Link
unix
Registered User
 
Join Date: Aug 2015
Posts: 44
Thank you Wolfberry.

By the way using direct vapoursynth method is it faster than vspipe to ffmpeg, or it depends on the filters that using?

Last edited by unix; 25th May 2019 at 09:16.
unix is offline   Reply With Quote
Old 28th May 2019, 08:24   #79  |  Link
Wolfberry
Helenium(Easter)
 
Wolfberry's Avatar
 
Join Date: Aug 2017
Location: Hsinchu, Taiwan
Posts: 97
Quote:
Originally Posted by unix View Post
By the way using direct vapoursynth method is it faster than vspipe to ffmpeg, or it depends on the filters that using?
Usually the native vapoursynth demuxer is faster than piping, but different implementation of the demuxer can have a impact on speed, see post #47 and #48 for details.
__________________
Monochrome Anomaly

Last edited by Wolfberry; 29th May 2019 at 10:11.
Wolfberry is offline   Reply With Quote
Old 31st May 2019, 05:39   #80  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,281
Since I've now hammered out the kinks (hopefully), I'm able to answer this based on actually cross-compiling VapourSynth instead of using gendef on Windows dlls.
Quote:
Originally Posted by jackoneill View Post
By the way, did you need to patch VapourSynth to accomplish this?
Not really. Most of the weirdness is in how to handle Python (it still needs to be gendeffed, et al.). VapourSynth itself has only three issues at play here:
  • src/vsscript/vsscript.cpp has an include of Windows.h that trips up cross-compiles due to case sensitivity.
  • No matter what I tried, I couldn't force NASM to recognize the multilib MinGW-w64 environment and actually compile 32-bit objects, so I have to force-override the Makefile to compile the correct object format.
  • The Requires.private invocation of python in vapoursynth-script.pc screws up FFmpeg's configure tests; Libs.private does work as expected.
  • A possible fourth issue is whether there's a case for including -lstdc++ in the .pc file's Libs(.private) stuff (it's not a problem when a bunch of other external libraries are enabled, since one/several of them pull in -lstdc++, but a 'simple' build of FFmpeg with VapourSynth and AviSynth as the only enabled external libraries fails unless --extra-libs is used to provide libstdc++ as detailed way earlier in this thread). Or whether a Cflags.private entry should be added for pkgconf users so -DVS_CORE_EXPORTS can be used only in the case of static linking. Essentially, this 'point' basically is just bikeshedding.

The entire process is documented here (link goes directly to the VapourSynth section of the guide):
https://github.com/qyot27/mpv/blob/e...ious.txt#L4396


One distinction is that when I'd tested with using gendef to handle VapourSynth too, I could get FFmpeg to link to it, but mpv refused to link to libavformat. gendeffing only Python and then cross-compiling VapourSynth like any other library results in both FFmpeg and mpv being able to link to it (importantly, mpv being able to directly play back scripts this way).

32-bit and 64-bit FFmpeg and mpv with static VapourSynth

Said binaries include *both* VS demuxers. The upstream demuxer is still 'vapoursynth', and the other one is 'vapoursynth_alt'. It's easy to tell them apart because they return different data types as input: '-f vapoursynth' returns wrapped_avframe, '-f vapoursynth_alt' returns rawvideo. The upstream demuxer also doesn't honor relative file paths across directories (in just FFMS2? maybe in general?), while the alt demuxer does.

Last edited by qyot27; 31st May 2019 at 16:47.
qyot27 is offline   Reply With Quote
Reply

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:50.


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