export method
Implementation
Future<bool> export(String input, int? fps, String output) async {
var path = this.path;
if (type == FileType.asset) {
path = await moveAssetToTemp(path);
}
final buffer = StringBuffer();
final overlay = 'overlay=${x ?? '(W-w)/2'}:${y ?? '(H-h)/2'}';
if (height != null || width != null) {
buffer.write(
'[1:v]scale=${height ?? -1}:${width ?? -1}[ov];[0:v][ov]$overlay;',
);
} else {
buffer.write('"[0:v][1:v]$overlay;"');
}
final audiocmd = [
if (isMute) ...['-an', ' -c:v'] else '-c:a',
];
return ffmpeg.execute([
'-i',
input,
if (fps != null) ...['-r', '$fps'],
'-i',
path,
'-filter_complex',
buffer.toString(),
...audiocmd,
'copy',
output,
'-y',
]);
}