Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The executeAsync async method is not executed successfully #953

Closed
dancb10 opened this issue Apr 2, 2024 · 3 comments
Closed

The executeAsync async method is not executed successfully #953

dancb10 opened this issue Apr 2, 2024 · 3 comments
Labels
flutter Affect flutter platform no-issue-activity question Further information is requested

Comments

@dancb10
Copy link

dancb10 commented Apr 2, 2024

I have the following code in my flutter app which works when executing the FFmpegKit with synchronous method

final command =
        "'-y' '-i' '$attachmentPath' '-c:v' 'h264' '-b:v' '500k' '-c:a' 'aac' '-b:a' '128k' '$compressedAttachment'";

    FFmpegKit.execute(command).then((session) async {
      var logs = await session.getAllLogs();
      var stack = await session.getFailStackTrace();
      var statistics = await session.getAllStatistics();
      var code = await session.getReturnCode();

      print(code); // success
    });

So the above code works, I can see the compressed file and everything is ok. Now, I would like to execute multiple compress executions in parallel by using the async method.

try {
     final command =
        "'-y' '-i' '$attachmentPath' '-c:v' 'h264' '-b:v' '500k' '-c:a' 'aac' '-b:a' '128k' '$compressedAttachment'";

      var session = await FFmpegKit.executeAsync(command);
      var logs = await session.getAllLogs();
      var stack = await session.getFailStackTrace();
      var statistics = await session.getAllStatistics();
      var code = await session.getReturnCode();

      print(code); // null
    } catch (e) {
      print("Error executing FFmpeg command: $e");
    }

I don't know what's happening, I've tried in different ways, btw the example shown in your docs does not work in flutter with the executeAsync method. Could you please tell me if this is a bug or I'm doing something wrong.

Below is the code from your docs which doesn't work "The argument type 'void Function(Log)' can't be assigned to the parameter type 'void Function(Log)?"

FFmpegKit.executeAsync('-i file1.mp4 -c:v mpeg4 file2.mp4', (Session session) async {

  // CALLED WHEN SESSION IS EXECUTED

}, (Log log) {

  // CALLED WHEN SESSION PRINTS LOGS

}, (Statistics statistics) {

  // CALLED WHEN SESSION GENERATES STATISTICS

});
@tanersener
Copy link
Collaborator

Did you look at the flutter test applications under the ffmpeg kit test repo? They show how executeAsync can be called in different ways.

See this one to execute multiple commands at the same time.

@tanersener tanersener added question Further information is requested flutter Affect flutter platform labels Apr 10, 2024
Copy link

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

Copy link

This issue was closed because it has been stalled for 7 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flutter Affect flutter platform no-issue-activity question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants