Graphics

 View Only
  • 1.  Exporting video from Xpression via API

    Posted 05-26-2023 10:56

    I'm trying to Export a video from the sequencer, I've had no luck so far. Can anyone give me a hint, my VB is below.        

            Dim engine As New xpEngine
            Dim VE As New xpVideoExport
            Dim TakeItem As New xpTakeItem

            If engine.Sequencer.GetTakeItemByID(2905, TakeItem) Then
                'TakeItem.Cue()
                'TakeItem.Execute()

                VE.LoadProfile("Profile.xprof")

                VE.RenderTakeItem(TakeItem, "test.avi", "test_error")       
            End If



    ------------------------------
    Poul Erik
    ------------------------------


  • 2.  RE: Exporting video from Xpression via API

    Posted 05-26-2023 11:39
      |   view attached

    Attached is an example VB app for rendering take items. 


    Attachment(s)

    zip
    RenderTakeItem.zip   172 KB 1 version


  • 3.  RE: Exporting video from Xpression via API

    Posted 05-26-2023 12:45

    Hi Garner
    Thanks for the file. The example is in C# - I tried my best to translate to VB, but i'm not able to make it work. Do you have the VB version at hand?



    ------------------------------
    Poul Erik
    ------------------------------



  • 4.  RE: Exporting video from Xpression via API

    Posted 05-26-2023 12:48

    Sorry, this is the only example I have. 




  • 5.  RE: Exporting video from Xpression via API

    Posted 05-26-2023 13:33

    Well, I've got it now.  Thanks for the file, it was helpful after all.



    ------------------------------
    Poul Erik
    ------------------------------



  • 6.  RE: Exporting video from Xpression via API

    Posted 05-30-2023 14:51

    Hey, could you perhaps share what you figured out to get it to work? I've been playing with a similar script; the intention of mine is to go through a list of take IDs separated by commas and export all of them as videos, but it only "successfully" exports the first one--"successfully" because I think the engine remains in "export" mode, and while the video will technically work it won't play until I've first closed out of XPression, and when I do close XPression after exporting I'm given an error message:

    "Access violation at address 0000000000943D3B in module 'XPression.exe'. Read of address 0000000000000010."

    After I close out of XPression the video works fine so I've at least gotten that far. I saw events like "OnFinished" and "OnProgress" listed in the SDK but don't know how to call those within the XPression scripting environment [assuming I can; a lot of scripting I've just learned on the fly]. Any help on this front would be greatly appreciated! Here's my script for reference [set to OnOnline for the scene]:

    dim exportItems, presetPath, exportPath as xpTextObject
    self.getObjectByName("Export Take IDs (separated by commas)", exportItems)
    self.getObjectByName("Export Path", exportPath)
    self.getObjectByName("Preset Path", presetPath)


    dim takeIDList as string() = Split(exportItems.text, ",")


    dim sequence as xpSequencer = engine.Sequencer
    dim item as xpTakeItem


    dim filePath as string
    engine.VideoExport.LoadProfile(presetPath.text)


    for index as integer = 0 to (takeIDList.length-1)
     sequence.getTakeItemByID(takeIDList(index), item)
     filePath = exportPath.text & takeIDList(index) & ".avi"
     engine.VideoExport.RenderTakeItem(item, filePath, "ERROR")
    next



    ------------------------------
    -David O.
    ------------------------------



  • 7.  RE: Exporting video from Xpression via API

    Posted 08-09-2024 08:44

    Would you be able to share this script? Looking to do the same thing and hitting errors.

    Appreciate it!



    ------------------------------
    Casey Woodman Woodman
    ------------------------------



  • 8.  RE: Exporting video from Xpression via API

    Posted 08-09-2024 16:19
    Hi 
    Im on vacation until sep. I will try to remember��

    Poul Erik Sørensen


    Fra: Casey Woodman Woodman via Ross Video Limited <Mail@rossvideo.com>
    Sendt: Friday, August 9, 2024 5:46:14 AM
    Til: Poul Erik Sørensen <poso@tvmidtvest.dk>
    Emne: RE: Graphics : Exporting video from Xpression via API
     
    Would you be able to share this script? Looking to do the same thing and hitting errors. Appreciate it! ------------------------------ Casey... -posted to the "Graphics" community
    Ross Video Limited

    Graphics

    Post New Message
    Re: Exporting video from Xpression via API
    Reply to Group Reply to Sender
    Aug 9, 2024 8:44 AM
    Casey Woodman Woodman

    Would you be able to share this script? Looking to do the same thing and hitting errors.

    Appreciate it!



    ------------------------------
    Casey Woodman Woodman
    ------------------------------
      Reply to Group Online   View Thread   Recommend   Forward   Flag as Inappropriate  




     
    You are receiving this notification because you followed the 'Exporting video from Xpression via API' message thread. If you do not wish to follow this, please click here.

    Update your email preferences to choose the types of email you receive




    Original Message:
    Sent: 8/9/2024 8:44:00 AM
    From: Casey Woodman Woodman
    Subject: RE: Exporting video from Xpression via API

    Would you be able to share this script? Looking to do the same thing and hitting errors.

    Appreciate it!



    ------------------------------
    Casey Woodman Woodman
    ------------------------------

    Original Message:
    Sent: 05-26-2023 13:32
    From: Poul Erik
    Subject: Exporting video from Xpression via API

    Well, I've got it now.  Thanks for the file, it was helpful after all.



    ------------------------------
    Poul Erik

    Original Message:
    Sent: 05-26-2023 12:47
    From: Garner
    Subject: Exporting video from Xpression via API

    Sorry, this is the only example I have. 


    Original Message:
    Sent: 05-26-2023 12:44
    From: Sørensen
    Subject: Exporting video from Xpression via API

    Hi Garner
    Thanks for the file. The example is in C# - I tried my best to translate to VB, but i'm not able to make it work. Do you have the VB version at hand?



    ------------------------------
    Poul Erik

    Original Message:
    Sent: 05-26-2023 11:38
    From: Garner
    Subject: Exporting video from Xpression via API

    Attached is an example VB app for rendering take items. 


    Original Message:
    Sent: 05-26-2023 10:56
    From: Sørensen
    Subject: Exporting video from Xpression via API

    I'm trying to Export a video from the sequencer, I've had no luck so far. Can anyone give me a hint, my VB is below.        

            Dim engine As New xpEngine
            Dim VE As New xpVideoExport
            Dim TakeItem As New xpTakeItem

            If engine.Sequencer.GetTakeItemByID(2905, TakeItem) Then
                'TakeItem.Cue()
                'TakeItem.Execute()

                VE.LoadProfile("Profile.xprof")

                VE.RenderTakeItem(TakeItem, "test.avi", "test_error")       
            End If



    ------------------------------
    Poul Erik
    ------------------------------


  • 9.  RE: Exporting video from Xpression via API

    Posted 08-10-2024 09:35

    Hi

    This code should do what you need. I ran it as code fired off a GPI (script action).

    Just change the list of IDs at the top to what you need, or populate in a scene from a text box.

    This works by firing off a new thread to deal with video exporting, and then polls when the previous export has finished. You can only render 1 file at a time, so this is making a queue of items to render.  I'm not sure how "correct" this is a way of doing it, as it assumes that the Engine and VideoExport objects are thread safe, so don't use in a production environment until you're happy it's solid!

    Hope it helps.

    Simon

    'Written by Simon Latus Aug 10th 2024
    'our list of takeids
    dim items() as integer = {750, 751, 752, 753}
    dim renderData as clsRenderData
    
    engine.DebugMessage("Running GPI",0)
    'Make this what you need for your exports
    engine.VideoExport.LoadProfile(engine.ProjectPath & "Sample Video.xprof")
    'this class holds all the data we need to get at the takeids and start rendering
    renderData = new clsrenderData
    	with renderData
    		.items = items
    		.engine = engine
    		.engine.DebugMessage("Starting render thread",0)
    		.myThread = new system.threading.thread(addressof fnRender)
    		'and off we go
    		.myThread.start(renderData)
    	end with
    'the render thread is now running, but export won't start until we leave this function
    engine.DebugMessage("Finished", 0)
    end sub
    '==================================================================================
    
    'Our class for the render thread
    public class clsRenderData
    	public items() as integer
    	public engine as xpengine	
    	public MyThread as system.threading.thread
    	
    end class
    '==================================================================================
    'our render function 
    sub fnRender(data as object)
    dim d as clsRenderData = ctype(data, clsRenderData)
    dim filename as string
    dim takeItem as xpTakeItem
    dim errors as string
    dim first as boolean = true
    'we will render all of our takeids in this thread
    for each id as integer in d.items
    	with d	  
    		.engine.debugmessage("Getting ready to render ID " & id,0)
    		.engine.sequencer.GetTakeItemByID(id, takeItem)
    		filename = .engine.ProjectPath & "Renders\" & id.tostring & ".mov"
    		'wait while the previous video is being rendered
    		while .engine.VideoExport.active
    			system.threading.thread.sleep(1000)
    			.engine.DebugMessage("Waiting",0)
    			end while
    
    		if .engine.VideoExport.RenderTakeItem(takeItem, filename, errors) then
    			.engine.debugmessage("Rendering " & filename,0)
    			if first then
    				'allow the calling function to exit and start the export process
    				'once underway we can just wait until VideoExport.Active is false
    				'to start rendering the next takeid
    				system.threading.thread.sleep(2000)
    				end if
    			end if
    	
    	end with
    	'flag we have done the first id
      first = false
    next


    ------------------------------
    Simon Latus
    Simon Latus Media Ltd
    United Kingdom
    ------------------------------