Python Improvements (What's New in 2022)
Flame Family products now use Python 3.7, you can now encode exports with FFmpeg, access the new Python console. Plus Python API updates.
Indicates a feature suggested and voted up by users on the Flame Feedback portal.
Moving to Python 3.7
Flame, Flare and Flame Assist now use Python 3.7. This means that you need to convert your Python scripts to Python 3.
The process for converting your scripts to from Python 2 to Python 3 is outside the scope of this documentation. But here a few pointers for doing just that.
- Read the Python Software Foundation Porting Python 2 Code to Python 3 documentation. Get familiar with the process of porting your scripts to Python 3, and with Python 3 differences from Python 2.
- Update your scripts to Python 3 using Futurize or Modernize.
Futurize and Modernize cannot fix everything automatically: you still need to verify your script compiles correctly.
To test to see if your script compiles and will run in Python 3:
From the command line, run:
python3 -m compileall <your_script>
In the shell, look at the compilation feedback:
- If there are no compilation errors, chances are your script is fine. Try running it in Flame.
- If the compiler complains, you'll need to go in and fix your script.
Python Console Update
The Python console, Flame menu Python
Python Console, now benefits from the following improvements:
- Modify the indentation of multiple lines: select the lines and then press Tab (increase indent) or Shift-Tab (decrease indent).
- You can now comment and uncomment multiple lines with Control+/ (CentOS) or Command+/ on (macOS).
- New lines start at the same indentation level as the previous one.
- New lines after a : character start with a 4-space indentation.
- Indentation made with Tab are converted to spaces.
- Saved scripts now default to the .py extension.
- The new colour scheme improves legibility.
FFmpeg Media Encoding with Python API
This release includes new Python API script examples showing how to encode Flame Family content using FFmpeg on CentOS and macOS
The Python example file is located in /opt/Autodesk/flame_2022/python_examples/export_selection.py
.
export_selection.py
contains examples to:
- Export selection using FFmpeg, in foreground: Encodes selected content as QuickTime (1920x1080, RLE video codec and IMA audio codec) to /var/tmp/export.
- Export selection using FFmpeg, in background: Encodes selected content as QuickTime (1920x1080, RLE video codec and IMA audio codec) to /var/tmp/export, but as a Backburner managed job.
The Python API encoding also uses some of the Wiretap tools already installed in /opt/Autodesk/io/bin
. The Wiretap tools used are:
- read_audio
- read_frame with the following metadata:
- Reel Name
- Timecode
- Frame rate
- Colour Space, with one of the following colours spaces for parameter:
- Rec.601 video
- Rec.601 video (PAL)
- Rec.709 video
- Rec.2020 video
- DCDM X'Y'Z' (DCI white)
- DCDM X'Y'Z' (D60 white)
- DCDM X'Y'Z' (D65 white)
- DCI-P3 (DCI white)
- DCI-P3 (D60 white)
- DCI-P3 (D65 white)
- sRGB display
- ST-2084 (PQ), Rec.709 primaries
- ST-2084 (PQ), Rec.2020 primaries
- ST-2084 (PQ), DCI-P3 (DCI white)
- ST-2084 (PQ), DCI-P3 (D65 white)
- Rec.2100 HLG (Lw=1000 nits, Lb=0)
Since Timeline FX have to be rendered prior exporting with Python API, we have added in the example a way to pre-render content before exporting. If you create your own Python script, make sure to pre-render any Timeline FX to avoid black frames in your resulting files. Also, Audio mix down might be required if your content has more than two audio tracks.
The above script also shows how to export clips located in a Reel or a Folder, and displays a file browser to select a destination.
Python API limitations:
- Content must first be imported (or generated) in Flame Family products to be exported through Python API and Wiretap Tools. You cannot transcode directly from MediaHub.
- You cannot export an alpha channel.
- Wiretap tools are paused to avoid interfering with foreground operations like playback.
Python API Updates
Expanded PyActionNode Reach
Every functions, attributes and properties available in the PyActionNode object are now available in GMask Tracer and Image.
New Sample Script
The script path_of_selected_clips.py shows how to get the path and file name of a media file in MediaHub.
Support for //
The // operator is now supported in the Python API. Python 3 does the distinction between / (float division) and // (integer division).
New in Action
New in Action/Image/Gmask Tracer
Command | Type | Description |
---|---|---|
![]() | function | The standard flame.duplicate() function can now be used to duplicate an object inside a PyActionNode, PyImageNode, and PyGMaskTracerNode. |
New in Media Panel
New in Timeline
Command | Type | Description |
---|---|---|
<PySegment>.create_connection() | function | Used to create a connected segment connection on a segment. Only works for segments inside a Reel Group. |
<PySegment>.remove_connection() | function | Used to remove a connected segment connection on a segment. Only works for segments inside a Reel Group. |
<PySegment>.sync_connected_segments() | function | Used to sync the connected segments. Only works for segments inside the same Reel Group. |
<PySegment>.connected_segments() | function | Returns a list of connected segments. Only works for segments inside the same Reel Group. |
<PySegment>.duplicate_source() | function | Used to duplicate the source media of a segment. |
<PySegment>.shared_source_segments() | function | Returns a list of segments sharing the same source media. |
New in Timeline FX
Command | Type | Description |
---|---|---|
<PyTimelineFx>.sync_connected_segments() | function | Used to sync a specific Timeline FX on connected segments inside the same Reel Group. This cannot be called on a Timewarp. |