mpv icon indicating copy to clipboard operation
mpv copied to clipboard

Vapoursynth + MPV need some help with a custom script

Open lubuntulux opened this issue 11 years ago • 18 comments

It is my goal to achieve 60FPS motion interpolation, such as produced by SVP.

I have downloaded Vapoursynth and the vapoursynth enabled mpv version from this repository: https://launchpad.net/~djcj/+archive/ubuntu/vapoursynth

I have also downloaded a custom script, namely 60fps.py which enables the interpolation process in conjunction with vapoursynth: https://gist.github.com/ghedo/fe0d232bda81f15e838b

import vapoursynth as vs core = vs.get_core()

src_fps = 24 dst_fps = 60

clip = core.std.AssumeFPS(video_in, fpsnum=src_fps) super = core.mv.Super(clip, pel=2) bv = core.mv.Analyse(super, isb=True, overlap=0) fv = core.mv.Analyse(super, isb=False, overlap=0)

clip = core.mv.FlowFPS(clip, super, bv, fv, dst_fps)

clip = core.mv.BlockFPS(clip, super, bv, fv, dst_fps)

clip.set_output()

I have tried to use it with mpv --vf=vapoursynth=/home/60fps.py /file.mkv and encountered the following errors:

jackson@jackson:~$ mpv --vf=vapoursynth=/home/jackson/Downloads/60fps.py --hwdec=no /media/jackson/b7d573e4-b6f9-42a9-bf71-1c9935c57738/file.mkv Playing: /media/jackson/b7d573e4-b6f9-42a9-bf71-1c9935c57738/file.mkv (+) Video --vid=1 (h264) (+) Audio --aid=1 --alang=ger () (ac3) Audio --aid=2 --alang=eng (dts) (+) Subs --sid=1 --slang=ger () (sub) Opening video filter: [vapoursynth file=/home/jackson/Downloads/60fps.py] AO: [pulse] 48000Hz 5.1(side) 6ch float [vapoursynth] Script evaluation failed: [vapoursynth] Python exception: No attribute with the name mv exists. Did you mistype a plugin namespace? [vapoursynth] Traceback (most recent call last): [vapoursynth] File "vapoursynth.pyx", line 1469, in vapoursynth.vpy_evaluateScript (src/cython/vapoursynth.c:23703) [vapoursynth] File "/home/jackson/Downloads/60fps.py", line 10, in [vapoursynth] super = core.mv.Super(clip, pel=2) [vapoursynth] File "vapoursynth.pyx", line 1090, in vapoursynth.Core.getattr (src/cython/vapoursynth.c:18137) [vapoursynth] AttributeError: No attribute with the name mv exists. Did you mistype a plugin namespace? [vapoursynth] Video filter chain: [vd] 1920x800 yuv420p auto/auto CL=mpeg2/4/h264 [in] 1920x800 yuv420p bt.709/limited CL=mpeg2/4/h264 [vapoursynth] 1920x800 yuv420p bt.709/limited CL=mpeg2/4/h264 <--- [out] ??? Cannot initialize video filters. Could not initialize video chain. Video: no video A: 00:00:03 / 01:41:35 (0%)

While it was running, only Audio worked, while there was no image.

Please help me set this up correctly, as I do not fully understand all the errors displayed.

lubuntulux avatar Jun 18 '15 10:06 lubuntulux

install vapoursynth-extra-plugins, whether this all 'fix's you up no idea...

mc4man avatar Jun 18 '15 12:06 mc4man

Well, fuck me. o.o That solved it, entirely.

Complete and utter smoothness. I'd actually like to point out, that this method of motion interpolation seems superior to SVP's. Motion blur is almost non-existant, and the video is so goddamn smooth, that it feels rather like 120FPS lol.

lubuntulux avatar Jun 18 '15 12:06 lubuntulux

Hardware decoding apparently doesn't work, which is fine, but the filter could not be initialized, which is weird. Adding filters such as oversample or mitchell caused an error. Is this simply not meant to be used with filters?

jackson@jackson:~$ mpv --vf=vapoursynth=/home/jackson/Downloads/60fps.py --hwdec=vdpau --vo=opengl-hq=tscale=oversample /media/jackson/b7d573e4-b6f9-42a9-bf71-1c9935c57738/file.mkv Playing: /media/jackson/b7d573e4-b6f9-42a9-bf71-1c9935c57738/file.mkv (+) Video --vid=1 (h264) (+) Audio --aid=1 --alang=ger () (ac3) Audio --aid=2 --alang=eng (dts) (+) Subs --sid=1 --slang=ger () (sub) Opening video filter: [vapoursynth file=/home/jackson/Downloads/60fps.py] Using hardware decoding. AO: [pulse] 48000Hz 5.1(side) 6ch float Using conversion filter. Image formats incompatible or invalid. Video filter chain: [vd] 1920x800 vdpau auto/auto CL=mpeg2/4/h264 [in] 1920x800 vdpau bt.709/limited CL=mpeg2/4/h264 [scale] ??? [a] <--- [vapoursynth] ??? [out] ??? Cannot initialize video filters. Error using hardware decoding, falling back to software decoding. [vapoursynth] Frame requested during init! This is unsupported. [vapoursynth] Returning black dummy frame with 0 duration. [vapoursynth] Frame requested during init! This is unsupported. [vapoursynth] Returning black dummy frame with 0 duration. VO: [opengl-hq] 1920x800 yuv420p AV: 00:00:44 / 01:41:35 (0%) A-V: 0.000

lubuntulux avatar Jun 18 '15 13:06 lubuntulux

It makes no sense to use hardware decoding when you apply a filter on the CPU (like vapoursynth). That's because you would need to read the raw decoded frames from the GPU/VRAM back to the CPU/RAM which negates a lot of the performance increase.

We should probably have some terminal output explaining this when one activates a filter with hwdec active.

pigoz avatar Jun 18 '15 13:06 pigoz

Yes but what about the filters? The output also stated "filter could not be initialized". (post above)

I tried it with both mitchell and overample. mpv --vf=vapoursynth=/home/jackson/Downloads/60fps.py --vo=opengl-hq=tscale=oversample mpv --vf=vapoursynth=/home/jackson/Downloads/60fps.py --vo=opengl-hq=tscale=mitchell

lubuntulux avatar Jun 18 '15 13:06 lubuntulux

I don't know what you mean. vapoursynth is a filter.

Also, I'm not sure if using tscale still makes sense here. Both conceptually, and the fact that interpolation is not enabled by default (so the tscale argument is essentially ignored).

ghost avatar Jun 18 '15 14:06 ghost

After reading the documentation again, I must admit, that there is little sense in additionally using oversample on top of it.

Thank you sooo much for all your support guys, please know, that I will relink both issues on the UbuntuForum, since you are awesome and this is guide material. :-)

I have one last question about Youtube streaming. I am running mpv 0.9.2 (vapoursynth enabled) from this ppa: https://launchpad.net/~djcj/+archive/ubuntu/vapoursynth youtube-dl via deb (youtube-dl_2015.06.04.1-1_all.deb) :https://packages.debian.org/sid/all/youtube-dl/download

When I try to stream a Youtube video with mpv, both with or without the vapoursynth script I get an error:

When I try to play something like this however, it works fine, both with and without the vapoursynth script: mpv --vf=vapoursynth=/home/jackson/Downloads/60fps.py --hwdec=no http://wpage.unina.it/aorefice/sharevari/tearingandsmoothness.mp4

Here the errors that exclusively occur with youtube: jackson@jackson:~$ mpv --vf=vapoursynth=/home/jackson/Downloads60fps.py --hwdec=no https://www.youtube.com/watch?v=Z_mf9aCHag8 Playing: https://www.youtube.com/watch?v=Z_mf9aCHag8 [ffmpeg] ?: https protocol not found, recompile with openssl or gnutls enabled. [ffmpeg] Protocol not found. Make sure ffmpeg/Libav is compiled with networking support. Failed to open https//r1---sn-4g57knes.googlevideo.com/videoplayback?lmt=1434341533454883&key=yt5&dur=185.411&fexp=936117%2C9407136%2C9407141%2C9407992%2C9408142%2C9408420%2C9408710%2C9409206%2C9412770%2C9412773%2C9412985%2C9413503%2C9415304%2C9415397%2C9415560%2C9416126%2C9416283%2C952626&initcwndbps=2165000&ipbits=0&mime=video%2Fmp4&nh=IgpwcjAyLmZyYTAzKgkxMjcuMC4wLjE&requiressl=yes&source=youtube&signature=627ADFD5F329FB6ADF25025F029C001A5108947A.7991EF1641E00A9A4112C6E57D0030D5AC3C02E3&hcs=yes&upn=XEsijOCEiQc&itag=22&mt=1434642035&pl=20&mv=m&ms=au&mm=31&expire=1434663769&id=o-ACkvgXZLOw6hTXU6kl1XBpKsgJeKTCoQRzwvKtVoR1tJ&ratebypass=yes&sver=3&ip=84.113.177.182&mn=sn-4g57knes&sparams=dur%2Chcs%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cnh%2Cpl%2Cratebypass%2Crequiressl%2Cshardbypass%2Csource%2Cupn%2Cexpire&shardbypass=yes. Exiting... (Errors when loading file)

The same happens when I don't use the vapoursynth script, hence the problem must be elsewhere: jackson@jackson:~$ mpv https://www.youtube.com/watch?v=Z_mf9aCHag8 Playing: https://www.youtube.com/watch?v=Z_mf9aCHag8 [ffmpeg] ?: https protocol not found, recompile with openssl or gnutls enabled. [ffmpeg] Protocol not found. Make sure ffmpeg/Libav is compiled with networking support. Failed to open https//r1---sn-4g57knes.googlevideo.com/videoplayback?requiressl=yes&dur=185.411&id=o-AHTuyjkfh2iy6OAy91OjLgroMvvr9BEdDjYZYwafotYn&mn=sn-4g57knes&pl=20&mm=31&source=youtube&fexp=9406128%2C9407141%2C9407535%2C9407663%2C9408142%2C9408420%2C9408710%2C9409095%2C9413503%2C9414806%2C9414916%2C9414936%2C9415304%2C9415810%2C9415972%2C9416126%2C9416573%2C952626%2C952640&ms=au&mv=m&mt=1434642151&hcs=yes&shardbypass=yes&upn=N1FSBRoSffE&itag=22&key=yt5&mime=video%2Fmp4&ip=84.113.177.182&nh=IgpwcjAyLmZyYTAzKgkxMjcuMC4wLjE&sver=3&lmt=1434341533454883&initcwndbps=2150000&sparams=dur%2Chcs%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cnh%2Cpl%2Cratebypass%2Crequiressl%2Cshardbypass%2Csource%2Cupn%2Cexpire&signature=B93CB6FE8DDC55ABE4049B593AFAB1172D26D32F.AFE99161949293A67F7EB4856A81A0483229489F&ratebypass=yes&expire=1434663821&ipbits=0. Exiting... (Errors when loading file)

lubuntulux avatar Jun 18 '15 15:06 lubuntulux

k

ghost avatar Jun 18 '15 16:06 ghost

[ffmpeg] ?: https protocol not found, recompile with openssl or gnutls enabled.

It would behoove you to actually read the output instead of blindly flailing around.

torque avatar Jun 18 '15 16:06 torque

That ppa version doesn't configure in https support in it's static ffmpeg build for mpv, drop him a note via LP email & maybe he'll do so.

mc4man avatar Jun 18 '15 18:06 mc4man

mpv --vf=vapoursynth=60fps.py video.mkv

Option vf: vapoursynth doesn't exist. Error parsing option vf (option could not be parsed) Setting command line option '--vf=vapoursynth=60fps.py' failed.

Exiting... (Fatal error)

What am I doing wrong?

strannik-j avatar Nov 15 '15 15:11 strannik-j

Your mpv is not compiled with vapoursynth support.

ghost avatar Nov 15 '15 15:11 ghost

But I use repository from official site: https://launchpad.net/~mc3man/+archive/ubuntu/mpv-tests. What should I do?

strannik-j avatar Nov 15 '15 23:11 strannik-j

Ask him to compile it with vapoursynt support or compile mpv yourself : https://github.com/mpv-player/mpv-build

kevinlekiller avatar Nov 15 '15 23:11 kevinlekiller

The ppa page tells you at the bottom how to get vapoursynth enabled mpv. To save you the effort will repeat re vapoursynth support remove this ppa, remove mpv & use this ppa https://launchpad.net/~djcj/+archive/ubuntu/vapoursynth Do note that vapoursynth-extra-plugins should be installed to make that mpv build useful, not currently a recommend..

mc4man avatar Nov 16 '15 04:11 mc4man

Can you please tell me how do you installed SVP on ubuntu ?? I tried but it's not working. Please tell me

shrey333 avatar Nov 08 '19 12:11 shrey333

Please ask the SVP people. We only provide a vapoursynth wrapper, and have nothing to do with SVP.

ghost avatar Nov 08 '19 13:11 ghost

Your mpv is not compiled with vapoursynth support.

Idk in other distros, but in AUR you must install mpv-vapoursynth in order to have SVP encoding working correctly.

Zeioth avatar Jan 16 '22 00:01 Zeioth