Open pixellet14 opened 1 year ago
example
private async encodeVideo(inputFilePath: string, outputFilePath: string) {
// https://superuser.com/questions/1155186/convert-mov-video-to-mp4-with-ffmpeg
if (inputFilePath) {
const command = [
`-i ${inputFilePath}`,
'-vcodec libx264',
'-preset veryfast',
'-vf scale=w=1280:h=1280:force_original_aspect_ratio=decrease',
'-pix_fmt yuv420p',
'-c:a aac',
'-ss 00:00',
'-to 00:30',
'-movflags +faststart',
outputFilePath,
].join(' ');
await this.ffMpeg.exec(command);
}
}
Npm package https://www.npmjs.com/package/cordova-plugin-ffmpeg
Active fork https://github.com/MaximBelov/cordova-plugin-ffmpeg
The transcoded video doesn't play in the html5 video element.