RV API Playback from Shotgun Slow

Hello! I’m writing a tool to automatically compare a list of versions from a playlist.

The script works entirely, importing the correct media with the correct layout, but the playback is incredibly slow. We’ve tested on multiple computers- the action item ‘Play in RV’ or ‘Compare in RV’ runs smoothly in all cases, but when I run my package RV chugs like crazy. The only issue I can think of is how I’m obtaining the media.

Currently, I’m using this command to import the media in a for loop:

source_list.append(commands.addSourceVerbose([“Link to server/file_serve/version/{id}/mp4”.format(id = idlizt[g])]))

Is there a better command or better link to source the media from? If anyone has a way to look at the ‘Play in RV’ source code, that would help immensely too.

Thank you for your help and patience,

-Phil F

Hi,

I’m also having the same issue. Which RV version you are using?

Dody

Glad to hear I’m not alone! I filled in a ticket directly to Shotgun and I’ll loop back if I find any solutions. I’m on RV 2021.0.1

Hi Phil, are you doing one source or many? It is likely better to do addSources vs addSourceVerbose in a loop so that you can make use of parallelism.

Hi Michael! I tried switching to AddSource, but it resulted in the same performance issues.

Are you adding all your sources at once, or are you still running it one source at a time?

Ohh I see what you mean! I missed the ‘s’ on addsources. I’m going to try to make this edit and get back to you.

1 Like

So addsources worked! and it plays back at normal speed- but, it broke many other lines in my script to make a comparison playback edit.

I use this command after adding my sources:

source_groups.append(commands.nodeGroup(source_list[k]))

This command was to put the sources into their node groups, to then add it into their respective sequences.

but without the ‘AddSourceVerbose’ command within the array itself, it returns “None” as the name of the source group without that command in my array, essentially breaking the rest of the script.

Let me know if what I’m saying makes sense, haha

-Phil F

1 Like

Yeah, because its asynchronus, it doesn’t return the result of the sources. Instead, you need to break up your logic into source creation, and then post-source creation.

If you respond to the event source-group-complete, you can then do whatever post-processing you need to do on each source.

Also, note that the addSources has a tag you can use. This can help you figure out which batch if you were to use unique items, since events called on those sources on creation will include the tag.

From the docs:

An optional tag can be provided which is passed to the generated internal events. The tag can indicate the context in which the addSource() call is occuring (e.g. drag, drop, etc).

I don’t quite have time to do this myself, but something that would be “cool” is if someone made an addSources decorator for handlers…

Rough idea of what the code might look like that uses it:

@RVAddSources
def myCustomAddSources(sourceGroup):
   # Stuff after the source 
   Stuff that Happens After Each Source is Added

Behind the secens, the decorator would make the addSources call with a unique tag idenfiier and register a callback handler for source-group-complete, call the wrapped function for each result and operate only on that tag. After the progressive loading is completed, it tears down the handlers.

This would make it a lot easier for you to write code that works. You could even instead just have a lambda or anonymous function you pass and it does the same thing if you want captures to work. That could help you translate your existing code.

:slight_smile: