ConversionCopyOptions
Options for copying encoded media during conversion.
type ConversionCopyOptions = {
mode?: 'forced' | 'preferred';
shiftTolerance?: number;
boundaryPolicy?: 'expand' | 'shrink';
};Used by
Properties
mode
mode?: 'forced' | 'preferred';Controls whether media copying is preferred or required. Defaults to 'preferred'.
'forced': Copy encoded media where possible and discard tracks that cannot possibly be copied.'preferred': Copy encoded media when possible, and transcode tracks that cannot be copied.
shiftTolerance
shiftTolerance?: number;The maximum absolute shift, in seconds, that may be applied to the media to be able to copy it into the output format. Defaults to 0, which permits no additional shift. Set to Infinity to permit any shift.
A shift of 0 gives you perfect timeline sync: output timestamps will match input timestamps exactly (only offset by the trim region). Any non-zero shift will break this property but will still, under all circumstances, maintain perfect cross-track and audio-video sync.
boundaryPolicy
boundaryPolicy?: 'expand' | 'shrink';Controls which media region will be copied to satisfy the requested trim range. Defaults to 'expand'.
'expand': Include at least all media in the requested range. This may require expanding the media region due to key frames and packet boundaries, and thus may include media outside of your trim range. The region is always minimally expanded to satisfy the copy criteria.'shrink': Only include media that lies entirely within the requested trim range. This may require shrinking the media region due to key frames and packet boundaries, and thus may exclude media inside of your trim range. The region is always minimally shrunk to satisfy the copy criteria.
Use expand if you don't want to lose any media; use shrink to never expose any media outside of the trim region.