Please or Register to create posts and topics.

Render previews not visible in DCC apps

12

When I open the project browser inside a DCC app (Nuke and Fusion tested) I can't get a preview under renders.

In the standalone app previews are visible, only not in DCC apps.

This is fixed now in v1.3.0.51.

The fix is not in the Prism Scripts, but in the external dependencies, which are not updated with the automatic update in Prism. So to get this fix you have to download and install the installer for v1.3.0.51, which includes the updated dependencies.

Seems to be fixed in Nuke but the problem still exists in Fusion.
That's super weird as they run exactly the same code right?

It's not python code which is the problem here. It's because some of the depencies are compiled code using cython which creates .pyd files. They only can be imported in python distributions, which were compiled with a similar compiler. Many DCC apps are compiling their python with a different compiler than the official python version. Because of that some .pyd files can be imported in one DCC, but not always in every other DCC although the python version is the same.

The .pyd files depend on specific .dll files. If a required .dll file cannot be found, then the .pyd cannot be imported in python. So usually this problem can be solved by finding out which .dll files are missing and adding them to the python package.

On my computer the preview is working, which means that all .dll files could be found somewhere on my computer. It might be that some of them where installed by a completely different program, which added the .dll files in a location in my system PATH variable so that Fusion can find it. That might be different on your computer.

For the .mp4 previews Prism uses the python module imageio, which depends on numpy, which contains some .pyd files. I assume they are the ones causing the problem in this case.

Can you type this in the python shell in Fusion and see what error you get @danell?

import imageio

 

I made a .py and ran it in fusion with this code:

import imageio as pd
print(pd.__version__)

and got the answer 2.8.0 back (Both in F16 and in the latest F17 beta)

I also did this for the sys version (python version) and got this:

3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)]

Then it must be something else. I can't really debug it without reproducing the problem.

If you want to debug it in the Project Browser code I can give you some hints which functions to look at.

Quote from RichardF on 12. November 2020, 9:57

Then it must be something else. I can't really debug it without reproducing the problem.

If you want to debug it in the Project Browser code I can give you some hints which functions to look at.

Please do!

A good starting point would be here:

https://github.com/RichardFrangenberg/Prism/blob/90b673c439f92bd695fe1d7713e9f148a1e3853c/Prism/Scripts/ProjectScripts/ProjectBrowser.py#L4206

When this try except fails, the MP4 fallback image will be displayed, which you see in Fusion. To find out why the code in the "try" part fails you can replace the line

except:

with

except Exception as e:
    print(e)

If imageio is not defined then check why it couldn't be loaded in this function:

https://github.com/RichardFrangenberg/Prism/blob/90b673c439f92bd695fe1d7713e9f148a1e3853c/Prism/Scripts/ProjectScripts/ProjectBrowser.py#L818

I found the problem.
After following the breadcrumbs I ended up in the updatePreview function, mainly the mediaPlayback["vidPrw"] = imageio.get_reader(imgPath, "ffmpeg") code.
That part gave me and error and when catching it, this is what I got:

To use the imageio ffmpeg plugin you need to 'pip install imageio-ffmpeg'

So I'm guessing Fusion don't have the imageio-ffmpeg plugin.

Would it be possible to import the imageio-ffmpeg separatly or import imageio from the prism library instead of using Fusions internal somehow?

 

EDIT:
As Fusion uses your computers Python version I installed the imageio-ffmpeg package but now I'm getting this error:

Traceback (most recent call last):
File "C:\Prism\Scripts\ProjectScripts\ProjectBrowser.py", line 3918, in updatePreview
mediaPlayback["pduration"] * 40, self
OverflowError

RuntimeWarning: libshiboken: Overflow: Value -9223372036854775808 exceeds limits of type [signed] "int" (4bytes).

 

EDIT2:
After some more searching it seems like it's the installed imageio-ffmpeg version that messes some stuff up :S Gonna see if I can figure something out here...

EDIT3:
Once again I tracked down the leads and ended up on line 4071 in ProjectBrowser.py (mediaPlayback["pduration"] = vidReader._meta["nframes"]
Printing vidReader._meta reveald that I'm getting the exact same metadata back as Prism standalone (ffmpeg version, fps, source_size etc), everything except nframes that returns inf instead of 94 as Prism standalone does.

Ok so I have figured out the problem and come up with a solution.

First of all, the user sadly has to install imageio-ffmpeg themself (Can this be checked under the DCC installation? And if imageio-ffmpeg isn't installed, ask the user to install it with a ui button?).
Next we can't get the nframes out from the video for some reason, but we do get the fps and duration.

I made a pull-request for this in the github: https://github.com/RichardFrangenberg/Prism/pull/26

But is it somehow possible to import prisms imageio instead of the systems imageio so the user don't need to manuallt install imageio-ffmpeg if they don't have it? That would be the best solution I think...

12