Using the command line - OSX

226 views
Skip to first unread message

karim beyrouti

unread,
Feb 18, 2015, 4:37:05 AM2/18/15
to
Version 2.07 (and later) of SWFRenderer:

In windows you can send multiple commands through the CLI to an application, while on OSX this only works to launch the app and subsequent CLI calls fail. To resolve this we have implemented a simple socket server in SWFRenderer that you can use to send commands to the application using the CLI and CURL . Attached is a sample .sh file  (renamed as txt) which adds a number of jobs to the queue and starts the render process.


Here is an example command
:

curl -d 'command=render,file=/anim.swf,exportPath=/testExport/,stopMode=2,fileName=anim,autoStartRender=true,quitOnComplete=true' http://localhost:8888/

Another main differential with windows is, commands sent through CURL need to be separated by a comma, that aside, the interface is mostly the same for both platforms.
We have also added the option to specify the port number for the SWFRenderer socket server when opening the application using the CLI

------------------------------------------------------------------------------------------------------------------------
-- Opening the application and setting the port number
------------------------------------------------------------------------------------------------------------------------

Command: setPort
Required Parameters: port, Default:8888
Example: open /path/to/application/SWFRenderer.app --args command=setPort port=8889

Note: This command opens the application and does not use CURL so no comma is needed to separate the parameters. 

------------------------------------------------------------------------------------------------------------------------
-- Add a Render Job
------------------------------------------------------------------------------------------------------------------------

Command: render

Example:

curl -d 'command=render,file=/anim.swf,exportPath=/testExport/,stopMode=2,fileName=anim,exportFormat=MP4Exporter' http://localhost:8888/
curl -d 'command=render,file=Main.swf,exportPath=/export/,fileName=flashVarsTest,exportFormat=PNGExporter,flashVars=varA=10&varB=test' http://localhost:8888/

Required Parameters:

"fileName"
"file"
"exportPath"

Optional Parameters:

"filePadding", Default: 000000
"frameRate", Default: 24
"backgroundColor", Default: 0x000000
"transparent", Default: true
"startFrame", Default: 1
"captureStep", Default: 1
"scale", Default: 1
"stopMode", Default: 0
Stop after time elapsed, value = 0
Stop at frame, value = 1
Stop at last frame, value = 2
"stopTime", Default: 5
"stopAtFrame", Default: 120
"createSubFolderFromFileName", Default:  true
"startFrameEnable", Default: false
"captureStepEnabled", Default: false
"useAppContext", Default: false
"exportFormat", Default: PNGExporter
Export JPEG sequences: exportFormat=JPEGExporter
Export PNG sequences: exportFormat=PNGExporter
Export MP4 video: exportFormat=MP4Exporter
Note: The options for this are case sensitive, make sure you use the right camel casing ( i.e. PNGExporter )
"autoStartRender", Default: false 
        "quitOnComplete", Default: false
        "flashVars", Send flash variables to a loaded SWF file ( new in 2.086 ) this needs to follow general URL query string value paid format:
                flashVars=varA=10&varB=test&anotherVar=Test55
                Sample SWF code using flash parameters: https://gist.github.com/karimbeyrouti/98dfaf24fe82af3245fa

------------------------------------------------------------------------------------------------------------------------
-- Start the render queue
------------------------------------------------------------------------------------------------------------------------

Description: start the render queue
Command: startRender
Example: curl -d 'command=startRender' http://localhost:8888/

------------------------------------------------------------------------------------------------------------------------
-- Exit the application
------------------------------------------------------------------------------------------------------------------------

Description: exit the application
Commandexit
Example: curl -d 'command= exit' http://localhost:8888/

------------------------------------------------------------------------------------------------------------------------
-- Quit on complete ( global flag )
------------------------------------------------------------------------------------------------------------------------

Description: Toggle global quit on complete flag (persistent between sessions)
CommandquitOnComplete
Example: curl -d 'command=quitOnComplete,enable=true' http://localhost:8888/

------------------------------------------------------------------------------------------------------------------------
-- Set a timeout
------------------------------------------------------------------------------------------------------------------------

Added in version Version 2.082 of SWFRenderer

Description: Set a timeout that stops a render job after a specified number of seconds of footage has been exported. 
Command: timeout
Required Parameters:
"enable" - true | false
Optional Parameters:
"time", Default: 60 (seconds)
Example: curl -d 'command=timeout,enable=true,time=120' http://localhost:8888/

------------------------------------------------------------------------------------------------------------------------
-- Check / enable autoupdate notification on startup
------------------------------------------------------------------------------------------------------------------------

Added in version Version 2.082 of SWFRenderer

Description: Check for updates on startup
Commandautoupdate
Required Parameters:
"enable" - true | false
Example: curl -d 'command=autoupdate,enable=true' http://localhost:8888/

------------------------------------------------------------------------------------------------------------------------
-- Job notification callback
------------------------------------------------------------------------------------------------------------------------

Version 2.08 of SWFRenderer lets users specify a callback URL to post job reports
to a server side script. This can be changed using the command line, or the UI. 

Description: Enable / Disable job report/callback URL
Command: callbackURL
Example: curl -d 'command=callbackURL,enable=true,url=http://localhost:8087/job2.php' http://localhost:8888/

Required Parameters:

"enable", Default: true ( enable / disable job notification callback)

Optional; Parameters:
"url", Default: '' ( set the full URL to a script to call when a SWF is finished processing ) 

See: Callback URL for more info.

------------------------------------------------------------------------------------------------------------------------
-- Continue rendering on sandbox violation security errors
------------------------------------------------------------------------------------------------------------------------

Added in version Version 2.085 of SWF Renderer

Description: Continue rendering if loaded SWF encounters a sandbox violation security error
normally rendering stops on all errors and moves to the next item in queue. This continues rendering
on these errors (  Error #2070: Security sandbox violation ).

CommandcontinueRenderOnSandboxViolations
Required Parameters:
"enable" - true | false
Example: curl -d 'command=continueRenderOnSandboxViolations,enable=true' http://localhost:8888/

------------------------------------------------------------------------------------------------------------------------
-- Multiple commands in one CLI Call
------------------------------------------------------------------------------------------------------------------------

Added in version Version 2.084 of SWFRenderer

Description: This is an aggregation of multiple commands that can be sent in a single CLI call. As long as each command starts with ‘command’ users can chain multiple commands in one CLI entry. Example below hi-lights each command in bold. 

Example: curl -d 'command=autoupdate,enable=true,command=callbackURL,enable=true,url=http://localhost:8087/job2.php,command=render,file=/anim.swf,exportPath=/testExport/,stopMode=2,fileName=anim,exportFormat=MP4Exporter' http://localhost:8888/

------------------------------------------------------------------------------------------------------------------------
-- Customising FFMPEG command strings
------------------------------------------------------------------------------------------------------------------------

Added in version 2.087 of SWFRenderer 

Description: a mechanism to customize the FFMPEG encoding process from the CLI. This requires some knowledge of FFMPEG's CLI operations and settings. 

CommandenableCustomFFMPEGSettings
Required Parameters:
"enable" - true | false, enable or disable custom FFMPEG settings
Optional Parameters:
"settings" - CLI string with dynamic variables that SWF Renderer uses to run FFMPEG processes
                       - the default settings string:
                          $FPS -i $IMAGE_SEQUENCE -c:v libx264 -preset ultrafast -qp 0 $OUTPUT_FILE -y

You can replace that with your encode string provided you keep the three dynamic fields, SWF Renderer requires for this to work. 
These are:

$FPS - Frames Per Second from SWF Renderer
$IMAGE_SEQUENCE - Path to image sequence generated from SWF Renderer
$OUTPUT_FILE - Path to output file 

Failure to include ALL of these in your custom command will cause SWF Renderer to revert to the default command.

Example: curl -d 'command=enableCustomFFMPEGSettings,enable=true,settings=-r $FPS -i $IMAGE_SEQUENCE -c:v libx264 -preset veryslow -qp 0 $OUTPUT_FILE -y' http://localhost:8888/


addAndStart.txt
Reply all
Reply to author
Forward
0 new messages