Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is ffmpeg's UDP protocol?

Tags:

ffmpeg

What is ffmpeg's UDP protocol ?

Here is example from another question

ffmpeg -i udp://localhost:1234 -vcodec copy output.mp4
Or try:

ffmpeg -i rtp://localhost:1234 -vcodec copy output.mp4

Is RTP and UDP streams similar protocols or UDP packets contain same files I can created with -f segement option?

like image 603
Artem Avatar asked Jan 13 '15 20:01

Artem


3 Answers

udp:// in ffmpeg means that it will stream/parse direct video/audio content (e.g. H.264) into/from UDP network packets, with no intermediate protocols.

rtp:// on the other hand, adds another level of encapsulation, where video/audio content will be encapsulated into an RTP packet, and the RTP packet will be in turn encapsulated into the UDP packet.

RTP is much better suited for media streaming, because it includes timestamp and sequencing information. Raw UDP packets lack that information, being more prone to out-of-order and dropped packets, leading to video/audio artifacts.

like image 177
luislopezmartin Avatar answered Dec 04 '22 02:12

luislopezmartin


User Datagram Protocol.

The required syntax for an UDP URL is:

udp://hostname:port[?options]

options contains a list of &-separated options of the form key=val.

In case threading is enabled on the system, a circular buffer is used to store the incoming data, which allows one to reduce loss of data due to UDP socket buffer overruns. The fifo_size and overrun_nonfatal options are related to this buffer.

The list of supported options follows.

Use ffmpeg to stream over UDP to a remote endpoint:

ffmpeg -i input -f format udp://hostname:port

Use ffmpeg to stream in mpegts format over UDP using 188 sized UDP packets, using a large input buffer:

ffmpeg -i input -f mpegts udp://hostname:port?pkt_size=188&buffer_size=65535

Use ffmpeg to receive over UDP from a remote endpoint:

ffmpeg -i udp://[multicast-address]:port ...

you can find some tips in the man commande!

like image 36
surfman Avatar answered Dec 04 '22 03:12

surfman


ffmpeg can listen to a UDP port and receive data from that port. The data can be from a camera who send RTP pakets encapsulated in UDP . SO imagine the camera as a sender who just send udp pakets on a port to a ip and ffmpeg listening on that ip on same port and processing what camera send to it They are just the input of your data and you can use the -f option , no matter the input is from a udp port or from a movie for you is same you can do

ffmpeg -i movie.mp4 -c copy -f flv a.flv

or do

ffmpeg -i udp://localhost:1234 -c copy -f flv a.flv 

, for ffmpeg dnt matter ,is just a input

like image 35
Maria Gheorghe Avatar answered Dec 04 '22 03:12

Maria Gheorghe