IP camera with RTSP on the web, RED5 and ffmpeg - camera

i have a ip camera with rtsp protocol and i want to stream on the web using flash video. I know i can use vlc but i do not want to use that.
I installed red5 and ffmpeg for convert RTSP to RTMP
ffmpeg -i "rtsp://46.13.85.43:8020/ch0.h264" -f flv -r 25 -s 640x480 -an "rtmp://localhost/live"
and result is: UDP timeout. retrying with TCP
Any idea where is the problem ?

You have to specify that tcp protocol is used, or at least that helped me. Please add this parameter -rtsp_transport tcp to your ffmpeg command.

Related

Set UDP port of VLC server for RTP streaming on Windows 10

I ran into an issue when streaming a video using RTP with VLC in Windows 10.
I have 2 laptops, one for streaming a short video using RTP over UDP and another one for receiving and displaying the video stream.
My concern is that I can stream to a given destination address and port e.g. 10.0.0.140:5006 but I cannot stream from the same port of a given address e.g. 10.0.0.130:5006. The server port (one the first laptop) has to be the same as the client port.
I followed a tutorial to stream a video using RTP / MPEG Transport Stream and I checked on Wireshark but I always have the streaming source port not set to 5006 as I wanted (Instead, it opens random server ports).
I checked on the internet for an answer to this but I found nothing helpful for my problem. I also checked in VLC preferences I set RTP port to 5006 but still the same behavior...
Does anyone know how to change udp server port of VLC to stream exclusively from port 5006 ?
Thanks!
I finally found out the solution by myself.
I did not set a static UDP server port, but I redirect the packets on postrouting using Ubuntu over a Virtual Machine.
To post-redirect the packets, I opened a terminal, and followed the two following steps:
Declare the wanted UDP port number in iptables
iptables -A OUTPUT -p udp --sport 5006 --dport 5006 -j ACCEPT
Redirect output data in nat's table to the previously declared UDP port number
iptables -t nat -A POSTROUTING -o eth0 -p udp -j SNAT --to :5006
This method allows to redirect any UDP packets output to source port 5006 before sending them on the network.

Netcat will not send messages through UDP connection between Socket PDU blocks in GNU Radio Companion

I am fairly new to Linux and GNU Radio.
I am trying to use GNU Radio to process information. To pass information into GNU Radio, I was planning on using the Socket PDU blocks to pass in information through a socket. To test out the connection I placed 2 Socket PDU blocks in GNU Radio Companion and connected them together, then I used netcat to send and receive messages and files.
I was able to get the connection to work when I had both Socket PDU blocks to TCP server. The sending block was set to port 52001 and the receiving block to 52002. In one terminal I typed:
nc localhost 52002
In a second terminal I typed:
nc localhost 52001
After that, any messages I typed in the second terminal appeared in the first.
I tried to do the same thing with setting the Socket PDU blocks to UDP Server and using the commands:
nc -u localhost 52002
nc -u localhost 52001
But nothing I typed in the second terminal would appear in the first.
What am I missing here? Does netcat just not work with this kind of stuff, or am I forgetting a step? With being new to Linux, GNU Radio and network protocols, I don't even know where to start.
You'll have to go to the receiving terminal and press enter. This will send an empty UDP packet to the server and tell it about the existence of this terminal/socket.
Just
nc -u localhost 52001
doesn't do anything as UDP has no connection setup.

Stream webcam video with Gstreamer 1.0 over UDP to VLC player

I'm trying to stream a webcam video with gstreamer 1.0 over UDP. This is the command I used:
gstreamer-1.4.0$ gst-launch-1.0 -v v4l2src device=/dev/video1 ! "image/jpeg,width=1280, height=720,framerate=30/1" ! rtpjpegpay \ ! udpsink host = 10.234.2.65 port = 5000
I got receiving via VLC player working with gstreamer 0.1 using an sdp file as explained here.
How do I achieve the same with gstreamer 1.0?

rtmpt protocol dump handshake error

When I try to dump rtmpt protocol with rtmpdump in Ubuntu, I got this error:
ERROR: RTMP_Connect1, handshake failed.
I would like to dump:
rtmpdump -v -r "rtmpt://37.130.228.52:80/atv/atv3"
I solved the problem. First of all the ip addresses for rtmp url was changing between few ip addresses.When I try the other ip numbers it was connecting to the rtmp but it was being rejected instantly. This was due swf verification, that is some rtmp urls also needs swf verification. Hence, when I typed as follow it successfully play on vlc player.
rtmpdump -v -r "rtmpt://..../atv/atv3" -s http://....swf?i=1 | vlc -
Next problem is that I want to play this rtmp with avconv/avplay not with vlc player. I could not give swfurl parameter succesfully in avplay. Instead this we can also dump with rtmpdump first and pipe it with avplay or avconv but I could not achieve this as well.
Edit: Second problem is solved with
rtmpdump ...... | avplay -i pipe:0

Livestream with crtmpserver - I can't find the live file

I use crtmpserver to make my RTMP server. I use Adobe Flash Media Live Encoder 3.2 to publish the livestream to the server. It is OK. I use a webflash player to receive the live stream. It is OK.
Now, I want to find the live file in the server, but I can't find the file. Which folder is the livestream?
If you want to stream a .flv file:
In every crtmpserver application there is a property called mediaFolder that by default refers to folder media.
mediaFolder="./media",
Then the streaming URL of the file is as:
rtmp://<server IP address>/<application name>/<file name>
If you want to stream a live stream:
When you define an stream acceptor in the acceptors section, you can specify the name of the stream by localStreamName as:
{
ip="0.0.0.0",
port=9005,
protocol="inboundTcpTs",
localStreamName="tcpchan5"
},
Then the URL of this stream is as:
rtmp://<server IP address>/<application name>/tcpchan5
To receive the input stream and feed the RTMP server, you may use FFmpeg:
ffmpeg -i <input_stream> -vcodec libx264 -s 320x240 -vb 512k -async 1 -acodec libvo_aacenc -ab 32k -ac 1 -f mpegts tcp://<server IP address>:<server feed port>
For example:
ffmpeg -i udp://224.11.11.11:2000 -vcodec libx264 -s 320x240 -vb 512k -async 1 -acodec libvo_aacenc -ab 32k -ac 1 -f mpegts tcp://127.0.0.1:9000