bytedeco / javacv

Java interface to OpenCV, FFmpeg, and more
Other
7.52k stars 1.58k forks source link

Could not open Mobotix Stream when a timeout is set #165

Closed rpgomes closed 9 years ago

rpgomes commented 9 years ago

Hello,

I having a strange behavior when testing to get the video Stream of a Mobotix camera, I'm using javaCV 0.11. When I set a timeout I can't open the stream, the stream only open if I don't set the timeout parameter.

I verified this behavior with javaCV 0.11 and Java CV 0.11 in version 0.9 and 0.8 it works with the timeout.

My code is the following:

grabber = new FFmpegFrameGrabber("http://IP//control/faststream.jpg?stream=mxg&fps=10"); grabber.setFormat("mxg"); grabber.setVideoOption("timeout", "5000000"); grab.start()

When the stream is open it timeout at 0, the following dump format appears:

nput #0, mxg, from 'http://IP/control/faststream.jpg?str eam=mxg&fps=10': Duration: N/A, start: 1435231794.877011, bitrate: 64 kb/s Stream #0:0: Video: mxpeg, yuvj420p(pc, bt470bg), 1024x768, 50.08 tbr, 1000k tbn, 1000k tbc Stream #0:1: Audio: pcm_alaw, 8000 Hz, mono, s16, 64 kb/s

the function av_strerror retruns the following error: Error number -138 occurred

What can I do to set a timeout to this stream?

saudet commented 9 years ago

I don't know, that would something to ask the developers of FFmpeg I guess.

rpgomes commented 9 years ago

Wich version of FFmpeg are your project using for version 0.10 and 0.11? This problem only happens whit that versions. When I try it the latest build outside javacv it works.

saudet commented 9 years ago

So could try to build from the latest source? It will build with the latest version of FFmpeg.

rpgomes commented 9 years ago

OK.

Do you have some instructions to build the ffmpeg.jar and ffmpeg-windows-x86.jar.

rpgomes commented 9 years ago

Hi saudet, sorry for insisting, I never compiled something so complex (at least for me)

If I follow this instructions https://github.com/bytedeco/javacpp-presets/wiki/Create-New-Presets

I manage to build the ffmpeg.jar and ffmpeg-windows-x86.jar ? If I understand what you said when I build the jar it already had the lattest ffmpeg version? Where can I see the version of the FFMPEG that are in the javaCV builds?

saudet commented 9 years ago

Try to follow the instructions here: https://github.com/bytedeco/javacpp-presets/blob/master/README.md#build-instructions

rpgomes commented 9 years ago

OK,

I will try to compile. Meanwhile do you know at error -138 mean in avformat_open_input

saudet commented 9 years ago

Use the av_strerror() to get a description.

rpgomes commented 9 years ago

I try that I got this description: Error number -138 occurred

saudet commented 9 years ago

It looks like you're trying to use a 32-bit compiler with a 64-bit JDK: This won't work. Please read the README.md file.

rpgomes commented 9 years ago

I finally manage to compile a new FFMPEG.jar and the ffmpeg-windows-x86.jar

With the function avformat_version returning 3679332 I think is FFmpeg 2.7

I'm still getting the same behaviour, with the timeout parameter the stream does not open an return error -138 ( av_strerror() returns Error number -138 occurred)

If I use the FFMPEG.jar and the ffmpeg-windows-x86.jar in Javacv 0.8 release the stream opens.

What can I do to debug?

saudet commented 9 years ago

What happens when you use ffplay on the same URL?

rpgomes commented 9 years ago

OK, I find out my problem.

With your ffplay tip ;) I was setting the timeout in seconds, but this parameter is to be set in microseconds.

saudet commented 9 years ago

Ok, good, so I'm assuming everything works fine then? Thanks for the feedback!