interface HLSFromTSTranscodeOptions extends BaseTranscodeOptions {
type: 'hls-from-ts'
+ isAAC: boolean
+
hlsPlaylist: {
videoFilename: string
}
async function buildHLSVODFromTSCommand (command: ffmpeg.FfmpegCommand, options: HLSFromTSTranscodeOptions) {
const videoPath = getHLSVideoPath(options)
- command.inputOption('-safe 0')
- command.inputOption('-f concat')
+ command.outputOption('-c copy')
- command.outputOption('-c:v copy')
- command.audioFilter('aresample=async=1:first_pts=0')
+ if (options.isAAC) {
+ // Required for example when copying an AAC stream from an MPEG-TS
+ // Since it's a bitstream filter, we don't need to reencode the audio
+ command.outputOption('-bsf:a aac_adtstoasc')
+ }
addCommonHLSVODCommandOptions(command, videoPath)