What is ffmpeg's UDP protocol?

2019-03-21 03:25发布

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?

标签: ffmpeg
4条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-03-21 03:45

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!

查看更多
成全新的幸福
3楼-- · 2019-03-21 03:46

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.

查看更多
劳资没心,怎么记你
4楼-- · 2019-03-21 03:51

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

查看更多
倾城 Initia
5楼-- · 2019-03-21 04:01

Apparently it is RTSP, see libavformat/rtsp.c and libavformat/udp.c in the source.

查看更多
登录 后发表回答