Identify local (LAN) vs live URL FFmpeg - ffmpeg

Hi I am using FFmpeg in my iOS app for stream local and live URL.
Is there any way to identify the URL which I am opening is local or live.
Actually I want to specify the rtsp_transport in avformat_open_input accordingly.
If I do not specify the transport its by default taking UDP.
In UPD I am losing packets in live stream.So i want to specify the transport TCP for live and default for local url.

Got the solution. I can not identify the URL is live or on lan but I can identify URL support protocol or not.
When you called avformat_open_input() for open an URL it return -43 if given protocol is not supported.
In my case I am opening URL with TCP so it works fine for live URL but for LAN I got error code -43 which is for unsupported protocol. Whenever I got the any error code regarding unsupported protocol I open the URL again with different protocol.

Related

How do I connect my IP Remote Camera to ZoneMinder?

I am using Ubuntu 16.04, ZoneMinder v1.29.1 with this docker and this camera(hikvision ir panoramic fisheye). I can connect to the camera and I get the camera interface for settings etc. The problem is the live views need a windows dependent plugin, that's why I wanted to use ZoneMinder.
Now I configured everything according to this guide. Basically I had to add a monitor, set the source to remote, set the protocol to rtsp, set the method to rtp/rtsp, set the host name to < user>:< pw>#< correct-ip>, set port to the rtsp port reported by the camera webinterface and set the host path to all possible things: I tried /Streaming/Channels/[1,2,3,4]/ and /live and /Streaming/Channels/[101,102,103]-[401,402,403,404]/ but I never had a live stream. I really don't know what I am doing wrong. Does anybody know the right host path or any other issues that could prevent me from receiving a live feed? According to this site the hikvision products should work with ZoneMinder. Maybe I am just missing something small and stupid, thank you.
EDIT:
I used ONVIF Device Manager to detect my rtsp stream: It is rtsp://< ip>:554/Streaming/Channels/101?transportmode=unicast&profile=Profile_101 and I use exactly those settings in ZoneMinder but it does still give me a 404 error on the video.
Most Hikvision cameras don't work with the "Remote" option, but with the "Ffmpeg" option.
Source should begin with rtsp://"username":"passwd"#"IP-ADDRESS cam":554 and sometimes you have to append things like /cam/realmonitor?channel=1&subtype=0?tcp
Protocol should be RTP/Unicast

Getting ICE failed in webrtc P2P video calling when communicating in different network

I'm working to create a video calling web app using WebRTC.
The communication is working fine on same network. But when communicating in different network I'm getting ICE failed error.
Error: ICE failed, see about:webrtc for more details
In about:webrtc I' able to get local and remote SDP's, but ICE State is failed. http://imgur.com/a/nPPDr
Here is the code of my main.js file
Here is the my log file from about:webrtc
P.S: Before posting the question I've checked several posts in SO and in other sites but no one did the trick.
Looking at the log file you provided it looks like you provided a TURN server, but the communication with that TURN server simply times out. So either something like a local firewall is blocking the communication with your TURN server or your TURN server is not working.
In case your local firewall blocks UDP traffic it might help to configure and use TURN TCP additionally to get through the firewall.
your about:webrtc does not show any relay candidates gathered from a TURN server. At the risk of sounding like a broken record: you need a TURN server for the majority of connections between different networks.

RTSP Proxy for local accessed content archive

I have local access from one computer to RTSP server by my ISP which is delivering IPTV content archive (timeshift). RTSP is avilable only from this computer because it has correctly configured internet access to the server. Because I would like to watch the content of this RTSP server on every device at home, I'd like to create local server which would accept connections and just transfer data from the end server (by ISP) to client.
I already tried to configure Live555 RTSP Proxy, but it's not really the right software which would enable me what I need. Another thing I tried out is Darwin Streaming Server, but I think it wouldn't support the format of IPTV content archive. What do I actually need?
Link to ISP's content archive looks like: rtsp://archive.my-isp.tld:554/programme_id_channel.ts.
I would like to access to the same stream via rtsp://IP-of-my-computer:port/programme_id_channel.ts.
Is there any software which is acting like proxy and it would be possible to set it to my needs? I would really appreciate any answer and help.
P.S.: Type of ISP's stream is MPEG TS.
EDIT: I already tried out node-ffmpeg-mpegts-proxy and it works good for approximately 10 seconds, then I got some error from avconv about RTSP packet loss and stream stops. I would also need an option to seek video to wanted destination and with current setup (default options of avconv) of node-ffmpeg-mpegts-proxy. For the start I need something that will successfully stream video from source to destination.

switch between video streaming

I am struggling with switching between multiple live streams. For example, I have five live streaming servers streaming(HTTP or RTSP) and I want to put some broker between those (five) streaming sources and destination so that output to the destination would be one video streaming (later I may change the streaming source again using switch). Broker plays role of switcher, My question is, is there such open source "switcher"? Or how this technology works?
here is link to similar question but I want some open source or some brief guidance about how it could be implemented: http://forums.creativecow.net/thread/117/858680
Thank You in advance
That answer can be an archive for the researchers
First Suggestion or Solution(Multicast Router)
You can use a Router or L3 Switch which is support IGMP protocol. That Router or L3 Switch must support IGMP protocol you can structure multicast IP address. You can configure L3 to switch all streaming. Multicast Ip address works within 224.0.0.0 to 239.255.255.255 and works based on device' mac address. You can create different multicast Ip address for the different type of switching scenarios. After finished Router or L3 Switch configuration, you only change IP address to switch streaming into your program. (I didn't mention Broadcast. Broadcast send data to all points. Multicast send data to certain points.)
Second Suggestion or Solution(Programming)
I am using Vlc.Dotnet wrapper for using the Vlc and libvlc libraries. It's open source. RTSP streaming is based on IP address and port number. I don't know any open source switch but you can write one of them for you with use Vlc.dotnet wrapper. You build 5 Streaming server and 1 control server. The Streaming Server's destination should be Control Server's IP. and you can control all data from control server with your basic switch program.
5 Streaming Servers : Sends data to Control server
1 Control Server : Controls and Switches data
I prefer to use Router or L3 Switch for make that. Because it's easier.

changing the protocol for client to server

I have to test the value from client to server using different protocols (Tcp , UDP , Sctp).
Please guide how it can be possible. Is there any way in windows to change the protocol or is there anyway to find it by using software like packet tracer .
Thanks
While the question is not entirely clear, it sounds as though your interested in seeing the information sent between the client and the server when each of those protocols is used.
Windows does not provide a built in utility to view packet data but it can be viewed using a packet analyser such as Wireshark.
In order to see the values sent by each protocol you must run a client for each of the protocols and use it to connect to the server for that protocol. If you don't have a server to connect to, you may need to run one on your local machine.
You can narrow down the data captured to just the protocol you're interested in using a filter in Wireshark If you don't know the protocol being used, you can filter by the port number used for that connection which can be established using the netstat command.
You may need to use netstat -b to show you which programs are using which ports.
If you just have to generate packets using different protocols then the tool like netcat can also help. It supports TCP and UDP and has been ported to windows .

Resources