Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between MPEG-TS and RTP for H.264 (.mp4) video streaming?

So I am trying to stream a H.264 (.mp4) video over ETHERNET using the ffmpeg tool. I have read a little about transport of H.264 video over ethernet and have learnt that there are two methods; mpeg-ts and RTP (both over UDP). I have been able to stream the .mp4 video through both methods in ffmpeg (over localhost) and haven't noticed any difference in quality or latency as such. What is the difference in concept and efficiency between the two protocols for transportation of video? Or am I mixing two different concepts? Any help is appreciated!

like image 386
Candy Avatar asked Sep 19 '25 01:09

Candy


2 Answers

RTP has less overhead than using a transport stream, since RTP uses the full Ethernet packet size available (MTU of around 1500 bytes normally), whereas TS packets are 188 bytes in size. Also, ffmpeg's UDP protocol, which is normally used to send a TS over the network does not support packet reordering on the receiver side.

like image 64
micha137 Avatar answered Sep 23 '25 11:09

micha137


The answer from micha137 does not quite cover all of the possibilities.

MPEG-TS can be carried directly over UDP or carried over RTP (over UDP). RTP adds a 12 byte (min) header containing a timestamp for synchronization.

In both cases, common practice is to put seven 188Byte TS packets within the underlying packet, whether the underlying packet is RTP or UDP. (some professional encoders also let you set 1- or 4-packets per UDP)

But to make it more confusing, RTP can also carry other media types (voice, etc), including directly mapping H.264 NALUs into an RTP payload.

Of all the encapsulation formats, H.264-NALU-over-RTP-over-UDP has the lowest overhead as it avoids the repeated packet headers of the MPEG-TS packets.

See RTP Payload Formats for more info on that.

Broadcast applications typically use MPEG-TS, most commonly directly over UDP but also RTP-over-UDP.

Internet applications did use H.264-over-RTP but this has been supplanted by HLS which (mostly) uses TS file chunks, and MPEG-DASH which (mostly) uses CMAF fragmented mp4 files.

like image 31
Danny Avatar answered Sep 23 '25 10:09

Danny