Log in

View Full Version : How do I play a VapourSynth script with mpv?


stax76
2nd March 2020, 00:49
I'm trying again to play a VapourSynth script with mpv, goal is to play it with mpv.net but to verify that it works mpv will do as well.

I tried it before and gave up when I was told mpv.exe, python.exe and vapoursynth.dll must be in the same folder, that sounds really messy and I want to try to make it work with mpv, python and vapoursynth in separate folders, actually I want to make it work by using the setup versions of python and vapoursynth and not portable versions.

Requests I made before are located here:

https://github.com/shinchiro/mpv-winbuild-cmake/issues/54

https://github.com/mpv-player/mpv/issues/7213

Quote by qyot27:

libavformat's support for vapoursynth are as demuxer(s), and FFmpeg deliberately does not allow execution of those scripts as video files unless you force the demuxer (-f vapoursynth before the input). If mpv was built against an FFmpeg that has vapoursynth support enabled, it will play the scripts back as video as long as you do the same thing you have to do in FFmpeg: force the demuxer when you invoke mpv (--demuxer-lavf-format=vapoursynth).

This is what I got in the cm shell:

Desktop> mpv --demuxer-lavf-format=vapoursynth D:\Samples\aaa_temp\aaa.vpy
[lavf] Unknown lavf format vapoursynth
[lavf] Unknown lavf format vapoursynth
Failed to recognize file format.

I always use shinchiro builds but think that I have also tried other builds and it appears that all those builds were built against an FFmpeg that hasn't vapoursynth support enabled. If that is true then maybe somebody can provide me with a x64 build, otherwise I might build it myself, I used to hate this but meanwhile have learned a couple of things.

qyot27
2nd March 2020, 07:18
E:\Documents>vspipe --version
VapourSynth Video Processing Library
Copyright (c) 2012-2019 Fredrik Mellbin
Core R48
API R3.6
Options: -

E:\Documents>python --version
Python 3.7.5

VapourSynth script:
#!/usr/bin/env python
import vapoursynth as vs
core = vs.get_core()

clip = core.ffms2.Source("source")
clip.set_output()

mpv build (it's a couple months old, but for demonstrative purposes):
http://www.mediafire.com/file/7j6pt28kbmgl598/mpv_r47942.7z/file

The playback-relevant parts of mpv/config:
# Write your default config options here!
vo=gpu
gpu-context=dxinterop
hwdec=dxva2
msg-color=no
vd-lavc-o=strict=-2
framedrop=no
ytdl=yes
audio-display=no
vd=libdav1d
tone-mapping=mobius

[extension.vpy]
demuxer-lavf-format=vapoursynth

Those are the regular installed versions of both VapourSynth and Python. mpv was compiled according to the build guide I maintain (https://github.com/qyot27/mpv/blob/extra-new/DOCS/crosscompile-mingw-tedious.txt).

stax76
2nd March 2020, 09:01
It's working, awesome, thank you qyot27! :thanks:

I probably have to build libmpv x64 myself and your guide will be helpful since I don't have any experience in building something like this.


mpv> .\mpv.com --version
mpv r47930+12 0.31.0-31-gba145cf193 (master-3b6c4e7be1 HEAD-ba145cf193)
contains: before_optical_removal extra-new Copyright © 2000-2019 mpv/MPlayer/mplayer2 projects
binary built on Mon Dec 30 21:20:17 2019 -0500
last updated on Mon Dec 30 21:09:30 2019 -0500
ffmpeg library versions:
libavutil 56.38.100
libavcodec 58.65.100
libavformat 58.35.101
libswscale 5.6.100
libavfilter 7.70.101
libswresample 3.6.100
ffmpeg version: r96207+6 master-f1353ce222 HEAD-24f87c7974
contains: datetime new_pkgconfig silent_invoke vapoursynth_alt versioninfo

amayra
10th April 2020, 20:58
can you share with me the least mpv build ?

stax76
10th April 2020, 21:20
I don't have builds because it's probably a lot of work, I'll make builds hopefully someday.

stax76
13th April 2020, 15:17
It's finally working with the shinchiro libmpv build from yesterday, I think both python and vs must be in path.

amayra
16th April 2020, 17:27
vpy script need full link direction for file to work properly and there no auto lead plugin support you need to Load Plugin manually like that
core.std.LoadPlugin("C:\Program Files\VapourSynth\plugins\ffms2.dll")

stax76
17th April 2020, 11:42
For staxrip it's OK as it does manual plugin loading, sorry for not being able to be a greater help, maybe create a new thread if it's a problem.