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

Handling Multiple Commands #115

Open
robinonsay opened this issue Jul 9, 2016 · 13 comments
Open

Handling Multiple Commands #115

robinonsay opened this issue Jul 9, 2016 · 13 comments

Comments

@robinonsay
Copy link

robinonsay commented Jul 9, 2016

I'm trimming mp4 files and noticed if I ran another command while one was running, I get this error.

com.github.hiteshsondhi88.libffmpeg.exceptions.FFmpegCommandAlreadyRunningException: FFmpeg command is already running, you are only allowed to run single command at a time
      at com.github.hiteshsondhi88.libffmpeg.FFmpeg.execute(FFmpeg.java:66)
      at com.github.hiteshsondhi88.libffmpeg.FFmpeg.execute(FFmpeg.java:79)
      at drivespotter.com.continuousrecordcam.api.s3.S3MediaAPI.sendMediaSegment(S3MediaAPI.java:55)
      at drivespotter.com.continuousrecordcam.ContinuousRecordActivity.stopRecorder(ContinuousRecordActivity.java:199)
      at drivespotter.com.continuousrecordcam.ContinuousRecordActivity.access$200(ContinuousRecordActivity.java:41)
      at drivespotter.com.continuousrecordcam.ContinuousRecordActivity$2.onClick(ContinuousRecordActivity.java:171)
      at android.view.View.performClick(View.java:4466)
      at android.view.View$PerformClick.run(View.java:18542)
      at android.os.Handler.handleCallback(Handler.java:733)
      at android.os.Handler.dispatchMessage(Handler.java:95)
      at android.os.Looper.loop(Looper.java:136)
      at android.app.ActivityThread.main(ActivityThread.java:5097)
      at java.lang.reflect.Method.invokeNative(Native Method)
      at java.lang.reflect.Method.invoke(Method.java:515)
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
      at dalvik.system.NativeStart.main(Native Method)

I would think that because it is running on a separate thread it would be fine. What is the recommended way to run multiple commands?

@HD-AD
Copy link

HD-AD commented Aug 21, 2017

Have you resolved this issue?

@robinonsay
Copy link
Author

No, I have not

@Aditya94A
Copy link

I've been using this library for over a year too and haven't found any workaround for this, the library manages threading (or rather the lack thereof) on it's own, so calling execute() from another thread is of no use.

My suggestion: Manage your own 'pool' of commands. A simple queue of tasks that you do one after another. This way you can move up the elements in onFinish() and simply append to the queue whenever another task comes up and they'll get done one by one.

@HD-AD
Copy link

HD-AD commented Aug 24, 2017

@AdityaAnand1 My issue is that I get this error "FFmpeg command is already running" even after the command is done. I can't run a command one after the other?

@Aditya94A
Copy link

@HD-AD That's weird. Are you absolutely certain you're waiting for onFinish() before firing off the second command?

Are you able to run multiple commands using the sample apk?

@HD-AD
Copy link

HD-AD commented Aug 26, 2017

@AdityaAnand1 yes I'm sure the command completes in onFinish(). The processing I do doesn't take long so I haven't tried running multiple commands as the command doesn't take long to finish. At the moment I have to destroy the application/activity in order to run a new command. I don't know if the issue could be because I'm calling loadFFmpeg() in onCreate(), but the example does the same, this is a big issue for my application so I really hope someone can help me out. Thanks for taking the time to reply.

@HD-AD
Copy link

HD-AD commented Aug 28, 2017

@AdityaAnand1 I can also downvote, I'm asking for help, no need to be an ass!

@lessismore100
Copy link

The last task was left unfinished。

@HD-AD
Copy link

HD-AD commented Sep 20, 2017

@steveLYL yes I got it working, thank you for answering.

@lessismore100
Copy link

@HD-AD very good.

@wapchief
Copy link

trying to mFFmpeg.killRunningProcesses()

@duwurensheng010
Copy link

mFFmpeg.killRunningProcesses() 这个不起作用

@SwapnilNSDN
Copy link

but I don't want to kill my running progress.

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

No branches or pull requests

7 participants