Skip to content

Commit

Permalink
[LUS] 0516 update some testcode, fix throwing ffmpeg log
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeUSeob committed May 16, 2023
1 parent c18c6eb commit 4defda3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class TestWidget extends StatelessWidget {
await _vmsdkWidget.initialize();
}

String testSetName = "oriented";
String testSetName = "set1_1080p";

final filelist = json.decode(
await rootBundle.loadString("assets/_test/mediajson-joined/$testSetName.json"));
Expand Down
9 changes: 4 additions & 5 deletions lib/vm_sdk/impl/ffmpeg_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,26 @@ class FFMpegManager {
FFmpegKit ffmpegIns = FFmpegKit();
FFmpegKitConfig ffmpegConfig = FFmpegKitConfig();

String log = "";

Future<void> execute(
Future<FFmpegSession> execute(
List<String> args, Function(Statistics)? callback) async {

if (callback != null) {
FFmpegKitConfig.enableStatisticsCallback((statistics) => callback(statistics));
}

log = "";
FFmpegKitConfig.enableLogCallback((log) {
this.log += log.getMessage();
print(log.getMessage());
});

final FFmpegSession session = await FFmpegKit.executeWithArguments(args);
final ReturnCode? returnCode = await session.getReturnCode();

final log = await session.getAllLogsAsString();
if (returnCode == null || !returnCode.isValueSuccess()) {
throw Exception("FFMPEG EXECUTE FAILED!\nLOG : $log");
}

return session;
}

Future<void> cancel() async {
Expand Down
8 changes: 7 additions & 1 deletion lib/vm_sdk/vm_sdk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,13 @@ class VMSDKWidget extends StatelessWidget {
final RenderedData mergedClip = await mergeAllClips(xfadeAppliedList);
final RenderedData resultClip = await applyMusics(mergedClip, regeneratedMusicList);

print(DateTime.now().difference(now).inSeconds);
print("elapsed time for rendering : ${DateTime.now().difference(now).inMilliseconds / 1000}s");

File resultFile = File(resultClip.absolutePath);
if (await resultFile.exists()) {
double fileSizeInMegaBytes = ((await resultFile.length()) * 1.0) / 1024 / 1024;
print("resultFile : ${(fileSizeInMegaBytes * 100).floor() / 100}MB");
}

if (_currentTimer != null) {
_currentTimer!.cancel();
Expand Down
3 changes: 2 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@ flutter:
# - assets/_mlkittest/set02/
# - assets/_mlkittest/subin/
# - assets/_test/set1/
# - assets/_test/set1_1080p/
# - assets/_test/monaco1/
# - assets/_test/monaco2/
# - assets/_test/monaco2_scaled/
# - assets/_test/monaco2_1080p/
# - assets/_test/asdasd/
# - assets/_test/oriented/
# - assets/_test/mediajson-joined/
Expand Down

0 comments on commit 4defda3

Please sign in to comment.