Log in

View Full Version : Preview Vapoursynth script with MPV


belonesox
18th January 2019, 21:49
I wish to preview vapoursynth scripts with MPV,
ideally with seeking, but I still cannot align MPV with VS on formats/colors, etc.

Consider small project:
https://github.com/belonesox/wtf-vapoursynth-mpv-preview

release.py:

#!/usr/bin/env python3
import vapoursynth as vs

core = vs.get_core()
video = core.std.BlankClip(format=vs.YUV420P10, length=1000, color=[128, 190, 128])
video = core.sub.Subtitle(video, "WTF???", 0, 500, style="sans-serif,200,&H00FF00FF")
video.set_output()


When I build it with 'build.sh'

vspipe --y4m release.py - | ffmpeg -i pipe: encoded.mkv

— all OK

When I preview it with 'preview-ffplay.sh'

vspipe --y4m release.py - | ffplay -i pipe:

— all OK

But how I can preview it with MPV?

I tried

vspipe --y4m release.py - | mpv --demuxer rawvideo --demuxer-rawvideo-mp-format=yuv420p10 -


and tried all formats supported by MPV...
but still getting wrong result ("moving text with wrong color").

What am I doing wrong?

jackoneill
18th January 2019, 22:15
But how I can preview it with MPV?

I tried

vspipe --y4m release.py - | mpv --demuxer rawvideo --demuxer-rawvideo-mp-format=yuv420p10 -


and tried all formats supported by MPV...
but still getting wrong result ("moving text with wrong color").

What am I doing wrong?

If you use the --y4m switch you probably don't need the --demuxer switch(es).

Revan654
21st January 2019, 00:21
I wish to preview vapoursynth scripts with MPV,
ideally with seeking, but I still cannot align MPV with VS on formats/colors, etc.

Consider small project:
https://github.com/belonesox/wtf-vapoursynth-mpv-preview

release.py:

#!/usr/bin/env python3
import vapoursynth as vs

core = vs.get_core()
video = core.std.BlankClip(format=vs.YUV420P10, length=1000, color=[128, 190, 128])
video = core.sub.Subtitle(video, "WTF???", 0, 500, style="sans-serif,200,&H00FF00FF")
video.set_output()


When I build it with 'build.sh'

vspipe --y4m release.py - | ffmpeg -i pipe: encoded.mkv

— all OK

When I preview it with 'preview-ffplay.sh'

vspipe --y4m release.py - | ffplay -i pipe:

— all OK

But how I can preview it with MPV?

I tried

vspipe --y4m release.py - | mpv --demuxer rawvideo --demuxer-rawvideo-mp-format=yuv420p10 -


and tried all formats supported by MPV...
but still getting wrong result ("moving text with wrong color").

What am I doing wrong?

This is the Command line I've used and worked for me.

"C:\Program Files (x86)\VapourSynth\core64\vspipe.exe" -y "to\your\VS\Script.vpy" - | "mpv.com or mpv.exe" [Options Here, --demuxer-rawvideo-mp-format=yuv420p10 Does work Here] -

For Testing I just used a very basic script

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()

belonesox
21st January 2019, 19:08
If you use the --y4m switch you probably don't need the --demuxer switch(es).

Great! It works! Thank you!

But how I can made seekable preview (with correct timeline, etc)?

"--force-seekable=yes" is not enough for my sample:

vspipe -y release.py - | mpv --force-seekable=yes -

Revan654
22nd January 2019, 02:17
Great! It works! Thank you!

But how I can made seekable preview (with correct timeline, etc)?

"--force-seekable=yes" is not enough for my sample:

vspipe -y release.py - | mpv --force-seekable=yes -


I don't think you can. FFPlayer acts the same way.

You might want to consider using PotPlayer which has native support for VS.

richardpl
22nd January 2019, 11:21
MPV also have native support for VS.

Revan654
23rd January 2019, 18:07
MPV also have native support for VS.

Not in the same way, MPV doesn't work that well. If you try to drop a VS script into MPV all it does is crash. Even my personally compiled version crashes.

Are_
23rd January 2019, 18:17
Does it crash or just graciously rejects to open that unsupported file format?

I think you are misunderstanding how it works, as far as I know you can use custom scripts as "video filters" and apply them to a playing video (actually tested), not open scripts as videos.

Revan654
25th January 2019, 23:49
Does it crash or just graciously rejects to open that unsupported file format?

I think you are misunderstanding how it works, as far as I know you can use custom scripts as "video filters" and apply them to a playing video (actually tested), not open scripts as videos.

Crash, Potplayer does allow you to use videoscript as a video clip(Without using custom videoplayer source filter).

jackoneill
28th January 2019, 15:23
Please report all crashes so they can be fixed. https://github.com/mpv-player/mpv/issues/new