Quantum

SegmentTranscoder.doTranscode() and final muxing

SegmentTranscoder.doTranscode() does some validation and preprocessing of the list of segments (adding a segment for the “title slate” if necessary, determining whether any of the segments need an intermediate decoder, and if so splitting long segments into several shorter ones of around 10 seconds each to minimize intermediate storage requirements) then renders out the video and audio segments into two intermediate files V1.mov (or V1.mxf, V1.mp4 etc.) and A1.mov (or A1.wav).

In the “final muxing” stage the V1 and A1 files are combined by a single FFmpeg command line, constructed in SegmentTranscode.buildFinalArguments(), to produce the final output

file. The V1 file will already be encoded with the correct video codec and so the final muxing stage just has to copy the video essence, but the A1 file has uncompressed audio so if we are building an MP4 file the audio is compressed to AAC at this stage.

The final mux transcode also adds metadata and a timecode track (if appropriate) to the output movie.

The FFmpeg QuickTime muxer produces a file that isn’t compliant with Apple’s specifications, so if the target is an Apple ProRes MOV file the native helper post-processes and rechunks the file, tweaking the timing and changing the way video and audio samples are interleaved, to make it compliant.