VideoExporter

VideoExporter.transcode() takes a list of VideoSegments and renders each out to separate file (V1-seg0000.mov, V1-seg0001.mov, etc.) then concatenates these, without further transcoding, into V1.mov. (Depending on the output format these might also be MXF or MP4 files instead of MOV.)

The way each segment is rendered depends on the both the source file format and the desired output format:

· In the simplest case, if FFmpeg directly supports both the input and output format, we can transcode the segment using FFmpeg by executing a command of the form:

ffmpeg -i inputFile -ss startTime -t duration -an -codec:v videoCodec outputFile

· If the output format is “special”, ie. one that we’re using the native helper for rather than FFmpeg (including ProRes MOV, DNx MXF Op1a, DNx MXF OpAtom, DNx MOV, AVFoundation MP4, etc.) then we open the file as a movie in the native player and tell it to transcode to the desired output format.

· If the input file can’t be decoded by FFmpeg (for example, RED or CanonRAW or BRAW) but the output can be encoded by FFmpeg then we also open the input file as a movie with the native player and export it to an intermediate YUV format, then pass that intermediate file to FFmpeg to transcode.

· If the source video doesn’t come from a media file at all but is a “programmatic” video of some kind (e.g. a title slate, a blank black filler where there’s a gap in a sequence, or in the most extreme case, is rendered completely programmatically using our JavaScript API, though I don’t think anyone currently uses this) it is rendered to an intermediate RGB format, which is then passed to FFmpeg to transcode.

In each case it’s VideoSegment.prepareSource() that does the intermediate decode if required. SegmentExporter.getIntermediateDecoder() tests if to see it looks like FFmpeg will support the input file or an intermediate decode is required.

If we need to use the native helper rather than FFmpeg to do the transcode (to ProRes, DNx, YUV etc.) then SpecialTranscoder.exportSpecial() handles this.