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

Added the ability to execute FFmpeg and FFprobe synchronously #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Sub6Resources
Copy link

@Sub6Resources Sub6Resources commented Jun 27, 2018

This pull request adds the FFcommandExecuteSynchronous class and execute() methods needed to execute FFmpeg/FFprobe synchronously as requested in issue #27.

For example, rather than the asynchronous way of executing FFmpeg:

FFmpeg ffmpeg = FFmpeg.getInstance(context);
ffmpeg.execute(cmd, new ExecuteBinaryResponseHandler() {

    @Override
    public void onStart() {}

    @Override
    public void onProgress(String message) {}

    @Override
    public void onFailure(String message) {}

    @Override
    public void onSuccess(String message) {}

    @Override
    public void onFinish() {}

});

You can now run it synchronously with:

FFmpeg ffmpeg = FFmpeg.getInstance(context);
String result = ffmpeg.execute(cmd);
//Result is all the output of the ffmpeg command.

It is identical for FFprobe.

Most of the code is pulled from the already-existing asynchronous execution code, I just pulled it out of an AsyncTask.

I hope to continue to contribute to this excellent library, and I am willing to make requested changes to this pull request.

@Brianvdb
Copy link
Member

Thank you for your pull request.

However, I think we need to abstract the way to execute commands otherwise we would have the same code in four places. If you have any ideas, please let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants