convertAssSubtitles static method
- String inputPath
Converts ASS subtitles to SRT and returns the data.
Implementation
static Future<String> convertAssSubtitles(String inputPath) async {
Directory appDocDir = await getApplicationDocumentsDirectory();
Directory subsDir = Directory('${appDocDir.path}/subtitles');
if (!subsDir.existsSync()) {
subsDir.createSync(recursive: true);
}
String outputPath = '${subsDir.path}/assSubtitles.srt';
File targetFile = File(outputPath);
if (targetFile.existsSync()) {
targetFile.deleteSync();
}
String command = '-i "$inputPath" "$outputPath"';
final FlutterFFmpeg _flutterFFmpeg = FlutterFFmpeg();
await _flutterFFmpeg.execute(command);
return targetFile.readAsStringSync();
}