HebiRobotics / HebiCam

MATLAB utility for streaming video acquisition (h264, mjpeg, etc.)
Other
12 stars 5 forks source link

error using code #8

Closed m1996 closed 5 years ago

m1996 commented 5 years ago

i have a problem. when i use cam = HebiCam('udp://@239.0.0.1:9999'); i get error remote url is not reachable but when use vlc with this url, it works fine.wha should i do? i really need it please answer as soon as you can. regards

ennerf commented 5 years ago

What camera model are you using?

The argument is passed directly to FFMpeg. Can you check whether you can access the stream using the FFMpeg binaries?

m1996 commented 5 years ago

thanks for your fast reply, i can even see the video using ffplay -fflags nobuffer udp://@239.0.0.0:9999 in cammand line. the video is being taken by obs in a linux system

edit: udp://@239.0.0.1:9999

ennerf commented 5 years ago

You are using a multicast ip address, so the reachability check is failing. Please try to comment out the following lines and try again:

https://github.com/HebiRobotics/HebiCam/blob/master/src/main/resources/matlab/HebiCam.m#L121-L123

m1996 commented 5 years ago

i did as you said but now i get this error: Error using HebiCam (line 177) Java exception occurred: java.lang.IllegalArgumentException: Unsupported number of channels: 0

at us.hebi.matlab.streaming.BackgroundFrameGrabber.<init>(BackgroundFrameGrabber.java:63)
ennerf commented 5 years ago

The input isn't getting decoded properly, so that's more tricky to "fix". You can try commenting out all of https://github.com/HebiRobotics/HebiCam/blob/master/src/main/resources/matlab/HebiCam.m#L114-L143 and see if OpenCV can read it.

Otherwise, there may be additional url arguments to specify the stream, e.g., ?width=x&height=x&channels=3

m1996 commented 5 years ago

i comment them and i get this error: Undefined function or variable 'grabber'.

Error in HebiCam (line 151) grabber.setTimeout(int32(args.Timeout * 1E3)); % [s] to [ms]

Error in testHebiCam (line 2) cam = HebiCam('udp://@239.0.0.1:9999');%?videocodec=h264&resolution=505x240');

i will try your other suggestion right now.

ennerf commented 5 years ago

Sorry, stop one line earlier. https://github.com/HebiRobotics/HebiCam/blob/master/src/main/resources/matlab/HebiCam.m#L114-L142 The else needs to be executed.

m1996 commented 5 years ago

when i comment them i get this error: Error using HebiCam (line 177) Java exception occurred: org.bytedeco.javacv.FrameGrabber$Exception: read() Error: Could not read frame in start().

at us.hebi.matlab.streaming.FixedOpenCVFrameGrabber.start(FixedOpenCVFrameGrabber.java:248)

at us.hebi.matlab.streaming.BackgroundFrameGrabber.<init>(BackgroundFrameGrabber.java:51)
m1996 commented 5 years ago

in linux system i've used this url: udp://@239.0.0.1:9999?pkt_size=1316&send_buffer_size=100000000 should i write them here in habiCam too?because i dont write them when i use ffplay

ennerf commented 5 years ago

Sorry, without having a reproducible setup here I can't help you any further. You can try different arguments and maybe find something that works. I've also read about a few issues related to FFMpeg and multicast IP addresses, so maybe it's worth seeing if you can use a unicast address instead.

An update to the latest ffmpeg/opencv libraries could potentially work as well, but I unfortunately don't have time to update and test everything at the moment.

m1996 commented 5 years ago

ok, the problem is when i try to stream only to one computer i cannot receive it with ffplay or vlc so i forced to use this url. thank you anyway. i really appreciate your fast reply. regards.

ennerf commented 5 years ago

Sorry I can't help you further :( Good luck

Regards