Log in

View Full Version : BlankClip and VapourSynth as an MPV filter


hello_hello
8th November 2023, 13:12
I thought I'd ask about an issue I've come across when using a VapourSynth script as an MPV Player filter. It seems to be caused by stacking a blank clip with the source. I'm adding borders with a blank clip in a function rather than AddBorders, as it's easier to apply separate filters to the borders that way.

Here's two functions that should produce the same result, but while they both work as a function in VSEdit, the first one can be used in a script as an MPV filter while the second produces the errors below, according to the MPV log file. It's probably not due to using StackVertical/StackHorizontal as such, because from memory if I crop a section of the frame and then stack it with the remaining picture, there's no issue. I'm using the current 'stable' package from deb.multimedia on MX Linux. It appears to be R62.

import vapoursynth as vs
core = vs.core

def Borders1(clip):
return core.std.AddBorders(clip, 16, 16, 0, 0)

import vapoursynth as vs
core = vs.core

def Borders2(clip):
BC = core.std.BlankClip(clip, width=16)
return core.std.StackHorizontal([BC, clip, BC])

The script I'm using as an MPV VapourSynth filter.
vf="vapoursynth=/home/Me/Videos/Borders.py"

import vapoursynth as vs
core = vs.core
import Borders1 as b1
import Borders2 as b2

clip = video_in
# clip = b1.Borders1(clip)
clip = b2.Borders2(clip)
clip.set_output()

From the MPV log file:

(+) Video --vid=1 (*) (h264 720x540 50.000fps)
(+) Audio --aid=1 --alang=eng (*) (ac3 2ch 48000Hz)
Cannot load libcuda.so.1
Using hardware decoding (vaapi).
[autoconvert] HW-downloading from vaapi
[autoconvert] Converting nv12 -> yuv420p
[vapoursynth] No PTS after filter at frame 0!
[vapoursynth] No PTS after filter at frame 19!
[vapoursynth] No PTS after filter at frame 1!
[vapoursynth] No PTS after filter at frame 2!
[vapoursynth] No PTS after filter at frame 3!
[vapoursynth] No PTS after filter at frame 4!
[vapoursynth] No PTS after filter at frame 5!
[vapoursynth] No PTS after filter at frame 6!
[vapoursynth] No PTS after filter at frame 7!
[vapoursynth] No PTS after filter at frame 8!
[vapoursynth] No PTS after filter at frame 9!
[vapoursynth] No PTS after filter at frame 10!
[vapoursynth] No PTS after filter at frame 11!
[vapoursynth] No PTS after filter at frame 12!
[vapoursynth] No PTS after filter at frame 13!
[vapoursynth] No PTS after filter at frame 14!
[vapoursynth] No PTS after filter at frame 15!
[vapoursynth] No PTS after filter at frame 16!
[vapoursynth] No PTS after filter at frame 17!
[vapoursynth] No PTS after filter at frame 18!
[vapoursynth] No PTS after filter at frame 21!
[vapoursynth] No PTS after filter at frame 20!
[vapoursynth] No PTS after filter at frame 22!
[vapoursynth] No PTS after filter at frame 23!
[vapoursynth] No PTS after filter at frame 24!
AO: [pipewire] 48000Hz stereo 2ch doublep
VO: [gpu] 752x540 yuv420p
[vapoursynth] No PTS after filter at frame 25!
Invalid video timestamp: 0.000000 -> 0.000000
INFO_VIDEO_DSIZE=752x540
MPV_VERSION=mpv 0.35.1
INFO_VIDEO_WIDTH=720
INFO_VIDEO_HEIGHT=540
INFO_VIDEO_ASPECT=1.333333
INFO_VIDEO_FPS=50.000000
INFO_VIDEO_FORMAT=h264
INFO_VIDEO_CODEC=h264 (H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10)