1 (edited by smooth-motion 22-06-2018 18:57:55)

Topic: SVP Encoding Problem With GTX 1050 TI

Hi guys!

Great job on the new feature, I really love the idea.

I am using Ubuntu 16.04 with nvidia-390 drivers and 4.16 rc1 kernel.
CPU: i7 4790K 4.8GHZ
GPU: GTX 1050 TI

Encoding with the CPU works fine, but it is a bit slow so I tried to encode with NVENC option, which would use GPU, as well.
This option crashes a lot mostly saying:

[out] ??? <---
20:29:41.786: [convert] ??? [a]
20:29:41.786: Cannot initialize video filters.
20:29:41.786: Could not initialize video chain.
20:29:41.789: (!!!) Intermediate file may be broken:

When it does start with NVENC option then I don't see any GPU Engine Utilization in nvidia driver-settings, so I assume it's not working.
I use NVENC encoding with Kdenlive when I encode videos for Youtube, so I know it works with this card.

Could you help me find out what the problem is?

Thanks, and again awesome job on this software!

Re: SVP Encoding Problem With GTX 1050 TI

8 or 10 bits color depth? x264 or x265? try various combinations...

Re: SVP Encoding Problem With GTX 1050 TI

Yeah, I've tried everything.

h265 encoding with NVENC is not supported by my card I believe, only 264.

I noticed that the ocvopts do not include the nvenc codec pointer

 vcodec=nvenc_h264 

, is this on purpose?

Are there any specific parameter combinations that you recommend?

I am a little paranoid as it is, because of the latest mainline kernels completely breaking nvidia drivers.
I just came down from 4.18 after pretty much compiling and testing every single 4.0 - 4.17 kernel until nvidia didn't completely f*ck Xserver.

Re: SVP Encoding Problem With GTX 1050 TI

it should be like this

mpv input -o output --no-audio --no-sub --no-sub-auto --input-ipc-server=mpvencodepipe --vf=vapoursynth:/some-path/ffff.py:4:16 --ofps 60.000 --of=matroska --ovc=h264_nvenc --ovcopts=b=11055051,rc=vbr_hq,preset=slow,profile=high,threads=16

ovc=h264_nvenc

You may try to run the exact mpv command line from the log in console directly, it will probably give a more verbose output.

5 (edited by smooth-motion 23-06-2018 08:16:40)

Re: SVP Encoding Problem With GTX 1050 TI

Thanks for the tips!

h264_nvenc in ovc option shows that gpu initialization is the problem.

09:53:11.113: [vapoursynth] Script evaluation failed:
09:53:11.113: [vapoursynth] Python exception: SVSmoothFps: unable to init GPU-based renderer - code 327680
09:53:11.113: [vapoursynth]
09:53:11.113: [vapoursynth] Traceback (most recent call last):
09:53:11.113: [vapoursynth] File "src/cython/vapoursynth.pyx", line 1847, in vapoursynth.vpy_evaluateScript (src/cython/vapoursynth.c:37206)
09:53:11.113: [vapoursynth] File "/home/donald/.local/share/SVP4/scripts/ffff.py", line 52, in <module>
09:53:11.113: [vapoursynth] smooth = interpolate(clip)
09:53:11.114: [vapoursynth] File "/home/donald/.local/share/SVP4/scripts/ffff.py", line 35, in interpolate
09:53:11.114: [vapoursynth] smooth = core.svp2.SmoothFps(input_m,super["clip"],super["data"],vectors["clip"],vectors["data"],smoothfps_params,src=input_um,fps=src_fps)
09:53:11.114: [vapoursynth] File "src/cython/vapoursynth.pyx", line 1739, in vapoursynth.Function.__call__ (src/cython/vapoursynth.c:35323)
09:53:11.114: [vapoursynth] vapoursynth.Error: SVSmoothFps: unable to init GPU-based renderer - code 327680
09:53:11.114: [vapoursynth]
09:53:11.121: (!!!) Intermediate file may be broken: /home/donald/sintel.temporary.mkv

The command you suggested produced a similar result.
But I am positive that it's not my driver's fault, because I can encode with nvenc on kdenlive with 80% . 90% video engine utilization. To be safe I reinstalled and tested with nvidia-384, nvidia-396 and nvidia-375 from graphics team ppa on various kernels, and everytime the same error.
What do you think could be causing the issue?

[vapoursynth] Script evaluation failed:
[vapoursynth] Python exception: SVSmoothFps: unable to init GPU-based renderer - code 327680
[vapoursynth] 
[vapoursynth] Traceback (most recent call last):
[vapoursynth]   File "src/cython/vapoursynth.pyx", line 1847, in vapoursynth.vpy_evaluateScript (src/cython/vapoursynth.c:37206)
[vapoursynth]   File "/home/donald/.local/share/SVP4/scripts/ffff.py", line 52, in <module>
[vapoursynth]     smooth =  interpolate(clip)
[vapoursynth]   File "/home/donald/.local/share/SVP4/scripts/ffff.py", line 35, in interpolate
[vapoursynth]     smooth  = core.svp2.SmoothFps(input_m,super["clip"],super["data"],vectors["clip"],vectors["data"],smoothfps_params,src=input_um,fps=src_fps)
[vapoursynth]   File "src/cython/vapoursynth.pyx", line 1739, in vapoursynth.Function.__call__ (src/cython/vapoursynth.c:35323)
[vapoursynth] vapoursynth.Error: SVSmoothFps: unable to init GPU-based renderer - code 327680
[vapoursynth] 
Video filter chain:
  [in] 4096x1744 yuv420p bt.709/bt.709/bt.1886/limited SP=1.000000 CL=mpeg2/4/h264
  [vapoursynth] "vapoursynth.00" 4096x1744 yuv420p bt.709/bt.709/bt.1886/limited SP=1.000000 CL=mpeg2/4/h264   <---
  [out] ???
Cannot initialize video filters.
Could not initialize video chain.
Video: no video
: 00:00:00 / 00:14:48 (0%) {1759.1min 0.0MB}


Exiting... (Errors when loading file)
[encode-lavc] vo-lavc: encoded 0 bytes
[encode-lavc] ao-lavc: encoded 0 bytes

Re: SVP Encoding Problem With GTX 1050 TI

this's about OpenCL initialization failure
which is another part of the video driver

if you turn off GPU acceleration in SVP it will work

7 (edited by smooth-motion 23-06-2018 09:30:45)

Re: SVP Encoding Problem With GTX 1050 TI

Why do you think OpenCL is the issue?

Disabling GPU acceleration removes the gpu renderer initialization error, but transcoding still does not seem to work, unfortunately.
I only disabled it GPU acceleration in SVP Control Panel. I am looking for a deeper way to do it, I think in override.js you can do it with levels-gpu option right?

Are you running Linux by any chance?

Using conversion filter.
Using conversion filter.
Image formats incompatible or invalid.
Video filter chain:
  [in] 4096x1744 yuv420p bt.709/bt.709/bt.1886/limited SP=1.000000 CL=mpeg2/4/h264
  [vapoursynth] "vapoursynth.00" 4096x1744 yuv420p bt.709/bt.709/bt.1886/limited SP=1.000000 CL=mpeg2/4/h264
  [convert] 4096x1744 yuv420p bt.709/bt.709/bt.1886/limited SP=1.000000 CL=mpeg2/4/h264 [a]
  [out] ???   <---
  [convert] ??? [a]
Cannot initialize video filters.
Could not initialize video chain.
Video: no video
: 00:00:00 / 00:14:48 (0%) {1722.7min 0.0MB}


Exiting... (Errors when loading file)
[encode-lavc] vo-lavc: encoded 0 bytes
[encode-lavc] ao-lavc: encoded 0 bytes

Re: SVP Encoding Problem With GTX 1050 TI

Hey man, I have made some new findings.
Latest vapoursynth version from djcj ppa could be the issue. I rolled back to <43 and SVP doesn't exit anymore. It's transcoding with NVENC option, just 0% video engine utilization, but no errors at least.
I assume the script doesn't just bypass the gpu completely and jumps right to cpu.

Re: SVP Encoding Problem With GTX 1050 TI

Have you given up on me already? .(

Re: SVP Encoding Problem With GTX 1050 TI

You're messing things.

First problem: SVP GPU acceleration doesn't work. This will give "SVSmoothFps: unable to init GPU-based renderer" error, and caused by video driver not supporting OpenCL or not properly installed. It has _nothing_ in common with NVENC.

Second problem: NVENC doesn't work. Ant it has _nothing_ in common with any "SVSmoothFps" / OpenCL errors.

Does SVP (not encoding, just real-time mpv) work for you with GPU acceleration enabled?
Does encoding work for you with x264 codec?

Re: SVP Encoding Problem With GTX 1050 TI

Yes, sir.
Both x264 software encoding and gpu acceleration work fine with SVP.
I only get these errors when trying to encode with NVENC option.

So should I open an issue at the Ubuntu Nvidia forum section for an OpenCL incompatibility or do you have any possible fixes in mind?

Listen, I don't want to come off too pushy here, I really appreciate all the amazing work you guys have done here and I am obsessed with this progam, that's why I want to iron out any irregularities on the Linux end.

Re: SVP Encoding Problem With GTX 1050 TI

Apparently 10bit colors are selected by default, that was definitely breaking some shit, because after switching it off GPU utilization during normal interpolation jumped from 15% to 35%.
Transcoding still only works with Software Encoding, anything else causes instant Fail.

Come on, I know you can solve this, you guys are geniuses!

Re: SVP Encoding Problem With GTX 1050 TI

> Transcoding still only works with Software Encoding, anything else causes instant Fail.

I don't see how we could fix this. It completely depends on mpv and ffmpeg.

You can take a mpv command line and remove the "--vf" argument completely.
Will it still give the same error?

Re: SVP Encoding Problem With GTX 1050 TI

Ok, running it without --vf option produces the same error, so it's definitely not SVP's fault.
But dude, I have literally tried every single Nvidia driver since 2015, it can't be the driver, right?
Now, it is a widely known fact, that since kernel > 4.10 all the way up to 4.18 rc1 both OpenCl and Cuda are broken on Ubuntu, so I am using 4.8.
WTF could be causing this.... I mean that pretty much leaves mpv or the driver, correct?
I want to get into this deep, man.

$ mpv /home/donald/sintel.mkv -o output --no-audio --no-sub --no-sub-auto --input-ipc-server=mpvencodepipe --ofps 60.000 --of=matroska --ovc=h264_nvenc --ovcopts=b=11055051,rc=vbr_hq,preset=slow,profile=high,threads=16
Playing: /home/donald/sintel.mkv
 (+) Video --vid=1 (*) (h264 1280x720 29.970fps)
     Audio --aid=1 --alang=eng (*) (opus 1ch 48000Hz)
Using conversion filter.
Using conversion filter.
Image formats incompatible or invalid.
Video filter chain:
  [in] 1280x720 yuv420p bt.709/bt.709/bt.1886/limited SP=1.000000 CL=mpeg2/4/h264
  [convert] 1280x720 yuv420p bt.709/bt.709/bt.1886/limited SP=1.000000 CL=mpeg2/4/h264 [a]
  [out] ???   <---
  [convert] ??? [a]
Cannot initialize video filters.
Could not initialize video chain.
Video: no video


Exiting... (Errors when loading file)
[encode-lavc] vo-lavc: encoded 0 bytes
[encode-lavc] ao-lavc: encoded 0 bytes

15 (edited by smooth-motion 01-07-2018 23:18:55)

Re: SVP Encoding Problem With GTX 1050 TI

I have compiled  ffmpeg from latest git with nvenc support enabled, how exactly do I point SVP to that binary file? (couldn't find anything in the folder or available scripts)
I have built everything from scratch + gpu driver, exclusively running necessary shit without the chance of coinciding packages.

OpenCL, CUDA, NVENC, ffmpeg has all been tested and confirmed to work properly.

Since you are a professional, I am sure that you run Linux as well. If you can find the time at some point, would it be possible for you to test transcoding with Nvenc? Would be amazing, man.
I have checked some SVP threads about Nvenc Transcoding issues, and it seems to come up a lot, even on Windows, without any real solution, as far as I have seen.