-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
FFmpegFrameGrabber not starting in another thread #1338
Comments
Java makes no guarantees that all threads will get any CPU time at all when
they have to synchronize. You'll need to provide some mechanism for that.
|
It's working now, but the grabber its taking 6 minutes to start grabbing frames... Any Idea? |
Maybe a problem with your network? Check the log!
|
I guess not, because when i start in main thread on a static method it works. But when i create another thread, its take this time. `public static void main(String[] args){ // but when i call this in another thread, takes much time; |
@saudet sorry by inconvenience, but the problem is when i build the jar file in ant builder. Do you have any idea ? I'm really stucked on this. |
Like I said, Java doesn't make any guarantees that a thread is going to get any CPU time at all. You need to provide a mechanism for that. |
And don't use Ant to build, use Maven. |
I know that, and i'm using concurrency to solve this. But the problem is before that. When i generate the jar file and execute it, the Thread(i tested in main too) simply stop in this line and back after a long time:
|
What does FFmpeg's log say? Make sure you've called |
The log only start after the time (4 min in media). |
It is really strange, the delay is when i instantiate the FFmpegGrabber and deploy in ant builder |
Also make sure to set the "org.bytedeco.javacpp.logger.debug" system property to "true". |
the error is not in your lib saudet! The delay is because the loading the jars files of libs(ffmpeg, opencv,javacv, etc). closed |
I see, so this is a duplicate of bytedeco/javacpp#287. For some reason, loading libraries on Android is really slow in some cases. This doesn't happen here on my devices, so I still don't know what causes this. |
It is not on Android, but the ant build are copying all jar files on a fat jar, and i guess the delay is when unpack the jars files. |
In that case we can reduce the amount of files to package: |
The changes in commit bytedeco/javacpp@af0e513 should also help with this. |
Save a lot of time now! Thank you so much man!!!! I am having only one problem from loading classes, but i guess this will be fixed when you update the version right ? |
@saudet , this work in a armv7 too ? now i need put on a armv7 arch. If not, any tutorial how work on this ? i not found anything |
What problem are you referring to? Gradle not working well with snapshots? It doesn't have that issue with released artifacts, yes.
Sure, binaries are available, something like this: https://github.com/bytedeco/javacpp-presets/wiki/Reducing-the-Number-of-Dependencies#including-binaries-only-for-mobile-platforms |
It was my mistake. I'm installing the wrongs jars manually. Thanks for patience! But now the debug is showing this errors above with a lot of tmp files from javacpp. Oh, and its take much more time on rasp to initiate. I don't understand why(15 min more). It is a way to have all desire so or jar files extracted on my raspberry ? ` |
Be sure to use the snapshots: http://bytedeco.org/builds/ |
Please let me know if this latest fix doesn't solve the issue you're describing though. Thanks! |
Yes! It's much faster now. Thanks for listening saudet! |
Hello guys!
i want to grab frames to a streaming video in another Thread. But when i started the thread the FFmpegFrameGrabber doens't start. Any solution ? The streaming can't pause my main thread.
`public class Producer implements Runnable {
private CircularQueueImplementation buffer = new CircularQueueImplementation<>(100);
protected static Logger logger = Logger.getLogger("aa.central");
int maxSize;
String SOURCE_RTSP = "streaming_link_camera";
The text was updated successfully, but these errors were encountered: