本文整理汇总了TypeScript中fluent-ffmpeg类的典型用法代码示例。如果您正苦于以下问题:TypeScript fluent-ffmpeg类的具体用法?TypeScript fluent-ffmpeg怎么用?TypeScript fluent-ffmpeg使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了fluent-ffmpeg类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
import * as ffmpeg from "fluent-ffmpeg";
let source: string;
let format: string;
let output: string;
ffmpeg({ source }).format(format).save(output);
示例2: if
return new Promise<void>(async (res, rej) => {
const fps = await getVideoFileFPS(options.inputPath)
let command = ffmpeg(options.inputPath)
.output(options.outputPath)
.videoCodec('libx264')
.outputOption('-threads ' + CONFIG.TRANSCODING.THREADS)
.outputOption('-movflags faststart')
// .outputOption('-crf 18')
// Our player has some FPS limits
if (fps > VIDEO_TRANSCODING_FPS.MAX) command = command.withFPS(VIDEO_TRANSCODING_FPS.MAX)
else if (fps < VIDEO_TRANSCODING_FPS.MIN) command = command.withFPS(VIDEO_TRANSCODING_FPS.MIN)
if (options.resolution !== undefined) {
// '?x720' or '720x?' for example
const size = options.isPortraitMode === true ? `${options.resolution}x?` : `?x${options.resolution}`
command = command.size(size)
}
command
.on('error', (err, stdout, stderr) => {
logger.error('Error in transcoding job.', { stdout, stderr })
return rej(err)
})
.on('end', res)
.run()
})
示例3: Promise
return new Promise((resolve, reject) => {
ffmpeg()
.input(mediaFilePath)
.output(outputFilePath)
.outputOptions(overwriteOutput)
.on('end', () => resolve(outputFilePath))
.on('error', err => reject(err))
.run(); // TODO Maybe add somewhere the fact that medium has been converted, to avoid to do it again
});
示例4: ffmpeg
.on('finish', () => {
ffmpeg()
.input(ytdl(videoToDownload, { filter: format => format.itag === '299' }))
.videoCodec('copy')
.input(audioOutput)
.audioCodec('copy')
.save(mainOutput)
.on('error', console.error)
// .on('progress', progress => {
// process.stdout.write(progress.timemark);
// })
.on('end', () => {
deleteFile(audioOutput);
p.resolve();
});
});
示例5: ffmpeg
await new Promise<string>((res, rej) => {
ffmpeg(fromPath)
.on('error', rej)
.on('end', () => res(imageName))
.thumbnail(options)
})