ONVIF video stream on camera side (not client side) - linux

I am trying to write an ONVIF video stream at the camera side on Linux Fedora (not the client side).
I already installed the WSDL2H and ran:
wsdl2h -c o onvif.h http://www.onvif.org/onvif/ver10/device/wsdl
This command built the onvif.h
I wrote a UDP, HTTP, TCP server on my Linux.
In my UDP server program I catch the Hello message from the ONVIF Device Test Tool.
How should I proceed from this stage/point?
I would like to know how to write the "answer" function in C?

At first you need soap tool like as gsoap.
Using gsoap you have to implement WS-Discovery
(Hello message is the one of the WS-Discovery)
In the gsoap FAQ, You can find useful information.
Also in the gsop documents, there is a information for WS-Discovery

Related

Is SCPI communication with a Chroma Power Supply possible?

First post! Full disclosure, I have a very limited programming / pi background.
I'm working on a project to communicate with a Chroma Bi-Directional power supply (Model #: 62180D-1200) using LXI / SCPI communication. There's more I hope to do in the future, but for the time being I'm simply trying to establish a working communication channel using the "*IDN?" identify command. I have a raspberry pi connected to the same network as the power supply, which I am using to communicate to the 62180D.
Before beginning any of this testing, I have been able to establish that I can communicate with the device via http (web browser). The web page for the device even includes an scpi query tool -- which works!
Successful HTTP communication
To query the device from the pi I have used PuTty to log in to my pi and issue the following command:
lxi scpi -a <device ip address> "*IDN?"
I am expecting to see the same result as shown in the image above (Model No. , Serial No., Firmware Version), but instead I'm receiving the following:
Error: Read error (timeout)
Error: Failed to receive message
I was under the impression that this protocol is fairly plug and play. I have other LXI enabled devices on the same network that I am able to communicate with them using this same approach. Is there some obvious thing I'm missing here?

Sniffing serial port /dev/ttyS0 while another application is using it

My platform: Linux Kubuntu 14
I am currently working on a project in which my application is communicating with a process via rs232 connected to /dev/ttyS0 serial port.
Sometimes incoming messages aren't intercepted by my process so I decided to use a sniffing tool called jpnevulator.
From what I see, if I run my application together with the sniffing tool, some messages are intercepted by the sniffing tool and some by my application, but not both.
Is it not possible to listen via sniffing tool on a serial port while another application is using it?
Thanks
Thanks all for the helpful responses.
As suggested in https://unix.stackexchange.com/questions...
I used interceptty to link a pseudo terminal to the serial port I am listening to and connected my application to the pseudo terminal and it worked.

Asterisk RTP data to Node.JS app

I've successfully set up Asterisk on my server using the res_pjsip Hello World configuration from their wiki, and I want to be able to forward the RTP data to a Node.JS app, which can interpret RTP. I've heard about directmedia and directrtpsetup (see this stackoverflow) but I'm not sure if that's what I want. So my question is this:
Should I use directmedia / directrtpsetup to send voice data to my Node.JS app, or should I use some sort of Asterisk functionality to forward RTP packets? If the latter, how can Asterisk forward just the voice data?
I can clarify if needed, but hopefully this is more specific than my last questions. Thanks!
UPDATE: Having poked around Asterisk docs and messing with Wireshark, I think I have two options.
Figure out if there's a channel driver for Asterisk that just sends RTP, without any signaling, or
Capture the RTP stream with Wireshark or something and send the packets to the Node.JS app, and inject the return packets into the RTP stream.
Asterisk is PBX. It not suitable to "redirect rtp data"
No, there are no reason in having channel driver "without signalling". For what anyone can use it? How to determine call started if "no signaling"? It will be useless.
You can write such app in c/c++ or use other soft designed to be traffic capture: libpcap, tcpdump etc.
You also can use audio staff: libalsa, jack.
Best option however will be create or find full featured sip client and use it.

Use an IP-camera with webRTC

I want to use an IP camera with webrtc. However webrtc seems to support only webcams. So I try to convert the IP camera's stream to a virtual webcam.
I found software like IP Camera Adapter, but they don't work well (2-3 frames per second and delay of 2 seconds) and they work only on Windows, I prefer use Linux (if possible).
I try ffmpeg/avconv:
firstly, I created a virtual device with v4l2loopback (the command was: sudo modprobe v4l2loopback). The virtual device is detected and can be feed with a video (.avi) with a command like: ffmpeg -re -i testsrc.avi -f v4l2 /dev/video1
the stream from the IP camera is available with: rtsp://IP/play2.sdp for a Dlink DCS-5222L camera. This stream can be captured by ffmpeg.
My problem is to make the link between these two steps (receive the rstp stream and write it to the virtual webcam). I tried ffmpeg -re -i rtsp://192.168.1.16/play2.sdp -f video4linux2 -input_format mjpeg -i /dev/video0 but there is an error with v4l2 (v4l2 not found).
Does anyones has an idea how to use an IP camera with webRTC?
Short answer is, no. RTSP is not mentioned in the IETF standard for WebRTC and no browser currently has plans to support it. Link to Chrome discussion.
Longer answer is that if you are truly sold out on this idea, you will have to build a webrtc gateway/breaker utilizing the native WebRTC API.
Start a WebRTC session between you browser and your breaker
Grab the IP Camera feed with your gateway/breaker
Encrypt and push the rtp stream to your WebRTC session from your RTSP stream gathered by the breaker through the WebRTC API.
This is how others have done it and how it will have to be done.
UPDATE 7/30/2014:
I have experimented with the janus-gateway and I believe the streaming plugin does EXACTLY this as it can grab an rtp stream and push it to an webrtc peer. For RTSP, you could probably create RTSP client(possibly using a library like gstreamer), then push the RTP and RTCP from the connection to the WebRTC peer.
Janus-gateway recently added a simple RTSP support (based on libcurl) to its streaming plugins since this commit
Then it is possible to configure the gateway to negotiate RTSP with the camera and relay the RTP thought WebRTC adding in the streaming plugins configuration <prefix>/etc/janus/janus.plugin.streaming.cfg
[camera]
type = rtsp
id = 99
description = Dlink DCS-5222L camera
audio = no
video = yes
url=rtsp://192.168.1.16/play2.sdp
Next you will be able to access to the WebRTC stream using the streaming demo page http://..../demos/streamingtest.html
I have created a simple example transforming a RTSP or HTTP video feed into a WebRTC stream. This example is based on Kurento Media Server (KMS) and requires having it installed for the example to work.
Install KMS and enjoy ...
https://github.com/lulop-k/kurento-rtsp2webrtc
UPDATE 22-09-2015.
Check this post for a technical explanation on why transcoding is just part of the solution to this problem.
If you have video4linux installed, the following command will create a virtual webcam from an rtsp stream:
gst-launch rtspsrc location=rtsp://192.168.2.18/play.spd ! decodebin ! v4l2sink device=/dev/video1
You were on the right track, the "decodebin" was the missing link.
For those who would like to get their hands dirty with some native-WebRTC, read on...
You could try streaming an IP camera’s RTSP stream through a simple ffmpeg-webrtc wrapper: https://github.com/TekuConcept/WebRTCExamples .
It uses the VideoCaptureModule and AudioDeviceModule abstract classes to inject raw media. Under the hood, these abstract classes are extended for all platform-specific hardware like video4linux or alsa-audio.
The wrapper uses the ffmpeg CLI tools, but I don’t feel it should be too difficult to use the ffmpeg C-libraries themself. (The wrapper relies on transcoding, or decoding the source media, and then letting WebRTC re-encode with respect to the ICE connections’ requirements. Still working out pre-encoded media pass-through.)
Actually our camera can support webrtc. It uses ip camera with h5, from P2P tramsmitting, and two way talk for ip camera with web browser! The delay is only 300ms!

netcat and videolan

I have:
one pc with videolan installed (windows 7) 192.168.1.2,
one pc with linux ubuntu 11.4 installed 192.168.1.12,
I've try to send a video via UDP (in videolan) from windows 7 to in linux-pc
throught port 8081
in linux I've run netcat listening on port 8081 and redirect to file, (netcat -lu 8081 >file.avi)
(my goal is to redirect to a serial in embeded linux snapgear,
by the way now I need to rediret to a file)
but don't works and I can figure out how config all, netcat don't write every byte sent on 8081?
thanks
update:
my problem is that I dunno address of source, take a look at the following scenario:
linux pc send stream to a serial, and other pc send to that pc a stream.
linux pc is alway in listening and don't know the address of source / sources,
this is my problem I dunno how to send with VLC, I know how send vlc to vlc (and it works)
but I dunno how send to 192.168.1.12:8081
thanks again
Your setup will probably not work: AVI is not designed to be streamed as-is over an unreliable transport layer protocol.
When you use VLC, it probably uses an encapsulation format like an MPEG transport stream or RTP, which you would have to properly decode before saving the contents to a file.
Even if you really manage to just stream the raw AVI file via UDP, you will run into problems because of packet loss and reordering - AVI is simply not designed to withstand that kind of errors.
You should either switch to a reliable transport protocol like HTTP (and even then use something else than AVI - it's really not designed for streaming), or use some other protocol to encapsulate your media, like an MPEG transport stream or RTP.
Please check your IP-Adresses. Do they really have the same?
Does the netcat work for other protocols? You may test it with the dns-port and nslookup on windows.

Resources