0

Export annotated frames from Python

Hi there, what is the correct way to export annotated frames from rv using a python minor mode? I see a few posts on the forum with people asking the same question then saying "I fixed it", without a definitive answer as to what the best way of doing this is.


Cheers,

 

Anders

5 comments

  • 0
    Avatar
    Jon Morley

    Hi Anders,

    The easiest way is to call:

    path_with_extension = "/this/is/the/path/to/your/desired/output.ext"
    mu = 'rvui.markAnnotatedFrames(); require export_utils; export_utils.exportMarkedFrames("path_with_extension");'
    rv.runtime.eval(mu,[])
    

    Will that work for you?

    Thanks,
    Jon

  • 0
    Avatar
    Anders Langlands

    Hi Jon, thanks for the quick reply! What's the correct pattern to put into the filename I give to exportMarkedFrames() in order to get it to substitute the frame number in there?

    Also, this will leave the annotated frames marked in the timeline, and presumably will also export any frames I've previously marked. I assume there are commands I can use to save the already marked frames (if any) to a list and then remark them (and only them) once the export is done?

    Cheers,

     

    Anders

  • 0
    Avatar
    Jon Morley

    Hi Anders,

    For the frame numbers you can use "@" to represent a single frame digit or an un-padded multidigit frame number. Though you can use as many "@" characters as you like to introduce padding. Using "#" works as shorthand for "@@@@" and pads like "%04d". All of this is in the RV/RVIO "-help" output.

    As far as saving and restoring marked frames go, I would read about commands.markedFrames and commands.markFrame in the Help -> "Mu Commands API Browser...". The functions listed there are also available from the Python API so you can call them around the Mu eval or add them into the payload as Mu.

    Thanks,
    Jon

  • 0
    Avatar
    Jon Morley

    NOTE: The output frame numbers will be number in global frame numbers and will have no relation to the input sources for the exported frames unless you are only exporting from one input source and the two ranges are the same.

  • 0
    Avatar
    Anders Langlands

    That's great, thanks Jon!

Please sign in to leave a comment.