FFmpegExporterClient
class FFmpegExporterClient implements Exporter
FFmpeg video exporter.
Most of the export logic is handled on the server. This class communicates with the FFmpegBridge through a WebSocket connection which lets it invoke methods on the FFmpegExporterServer class.
For example, calling the following method:
async this.invoke('process', 7);
Will invoke the process
method on the FFmpegExporterServer class with 7
as the argument. The result of the method will be returned as a Promise.
Before any methods can be invoked, the FFmpegExporterServer class must be
initialized by invoking start
.
Constructors
constructor
public new FFmpegExporterClientproject: Projectsettings: RendererSettings: FFmpegExporterClient
Parameters
Properties
displayName
static readonly public displayName: 'Video (FFmpeg)' = 'Video (FFmpeg)'
id
static readonly public id: '@revideo/core/ffmpeg' = '@revideo/core/ffmpeg'
Methods
downloadVideos
Download all assets necessary for the export process
Parameters
generateAudio
public generateAudioassets: AssetInfo[][]startFrame: numberendFrame: number: Promisevoid
Take in media assets per frame and generate audio track for the video.
Parameters
assets: AssetInfo[][]
startFrame: number
endFrame: number
handleFrame
public handleFramecanvas: HTMLCanvasElement: Promisevoid
Export a frame.
Called each time after a frame is rendered.
Parameters
canvas: HTMLCanvasElement
A canvas containing the rendered frame.
kill
public kill(): Promisevoid
Finish the rendering process.
Guaranteed to be called after the rendering has finished - no matter the result. Performs clean-up.
mergeMedia
public mergeMedia(): Promisevoid
after processing the image stream and generating an audio file, merge the video and audio stream as the final video
start
public start(): Promisevoid
Begin the rendering process.
Called after the rendering has been set up, right before the first frame
is rendered. Once start()
is called, it is guaranteed that the stop()
method will be called as well. Can be used to initialize any resources that
require a clean-up.
stop
public stopresult: RendererResult: Promisevoid
Finish the rendering process.
Called after rendering the visual elements has finished and audio so that audio track can be merged.
Parameters
result: RendererResult
The result of the rendering.
create
static public createproject: Projectsettings: RendererSettings: PromiseFFmpegExporterClient