|
1 | 1 | import 'dart:io'; |
2 | 2 |
|
3 | | -import 'package:ffmpeg_kit_https_flutter/ffmpeg_kit.dart'; |
4 | | -import 'package:ffmpeg_kit_https_flutter/ffmpeg_session.dart'; |
| 3 | +import 'package:flutter_ffmpeg/flutter_ffmpeg.dart'; |
5 | 4 | import 'package:path_provider/path_provider.dart'; |
6 | 5 | import 'package:subtitle/subtitle.dart'; |
7 | 6 | import 'package:path/path.dart' as path; |
@@ -140,7 +139,9 @@ class SubtitleUtils { |
140 | 139 | outputFile.deleteSync(); |
141 | 140 | } |
142 | 141 |
|
143 | | - await FFmpegKit.execute(command); |
| 142 | + final FlutterFFmpeg flutterFFmpeg = FlutterFFmpeg(); |
| 143 | + |
| 144 | + await flutterFFmpeg.execute(command); |
144 | 145 |
|
145 | 146 | await Future.delayed(const Duration(seconds: 1)); |
146 | 147 |
|
@@ -184,8 +185,11 @@ class SubtitleUtils { |
184 | 185 | outputFile.deleteSync(); |
185 | 186 | } |
186 | 187 |
|
187 | | - FFmpegSession session = await FFmpegKit.execute(command); |
188 | | - String output = await session.getOutput() ?? ''; |
| 188 | + final FlutterFFmpeg flutterFFmpeg = FlutterFFmpeg(); |
| 189 | + final FlutterFFmpegConfig flutterFFmpegConfig = FlutterFFmpegConfig(); |
| 190 | + |
| 191 | + await flutterFFmpeg.execute(command); |
| 192 | + String output = await flutterFFmpegConfig.getLastCommandOutput(); |
189 | 193 | if (output.contains("Stream map '0:s:$i' matches no streams.")) { |
190 | 194 | break; |
191 | 195 | } |
@@ -223,7 +227,9 @@ class SubtitleUtils { |
223 | 227 |
|
224 | 228 | String command = '-i "$inputPath" "$outputPath"'; |
225 | 229 |
|
226 | | - await FFmpegKit.execute(command); |
| 230 | + final FlutterFFmpeg flutterFFmpeg = FlutterFFmpeg(); |
| 231 | + |
| 232 | + await flutterFFmpeg.execute(command); |
227 | 233 |
|
228 | 234 | return targetFile.readAsStringSync(); |
229 | 235 | } |
|
0 commit comments