1

I'm trying to understand how a MP4 video is going to be segmented over RTP in online streaming (it's coded with the H.264 codec). There are some tools like FFMPEG or MP4box, or we can use the ISO format itself [moov, pair of moof and mdat] for streaming. What I want to know is how these tools will segment mdat part of video? Will they separate all the units (a group of video and audio frames) of the MP4 video and make them into one segment with related moov part or they do it in some other way?

Or do they use H264 streaming and NAL units for streaming?

I want to know how it works.

5
  • MP4 is not sent over RTP. Its is repackaged from MP4 to RTP and (possibly) back again on the other side.
    – szatmary
    Jun 28, 2017 at 19:10
  • so it will be used in DASH or HLS streaming? for RTP i cant use ffmpeg?
    – lighting
    Jun 28, 2017 at 19:17
  • What? Dash and HLS and RTP are competing technologies. You can convert between them but you don't0 use one on top of the other. RTP doesn't use segments. Segments are only using in HTTP protocols (HLS and DASH)
    – szatmary
    Jun 28, 2017 at 19:30
  • So RTP will send the whole file after adding headers?
    – lighting
    Jun 28, 2017 at 19:34
  • No, there is no "file" once its converted to RTP, its just a series for frames. RTP is not FTP.
    – szatmary
    Jun 28, 2017 at 20:04

1 Answer 1

2

Typically, the video streaming flow goes like this:

Capture Video--> Encode-->                                     -->Decode-->Display
                            Mux--> Transmit--> Receive-->De-Mux  
Capture Audio--> Encode-->                                     -->Decode-->Display

So, basically in your case, ffmpeg takes NAL units from H.264 and muxes it with encoded audio bitstream and transmits together.

5
  • So if i receive a packet what doest it contain? can i say i have moov header and mdat units? if yes, the first four bytes would be unit size (after removing header)? and if i have a MP4 video with H.264 codec that i want to stream, it will detect H.264 codec and packetize that for streaming? what will happen to format?
    – lighting
    Jun 28, 2017 at 18:09
  • You can see this link: stackoverflow.com/questions/8525824/…
    – mdasari
    Jun 28, 2017 at 18:25
  • can i access the NAL units in any MP4 video files? for example in a downloaded MP4 video?
    – lighting
    Jun 28, 2017 at 19:09
  • Yes, you can. You can use ffmpeg APIs for that. All you need to do is: First de-mux the MP4 video file to get video stream. From that, you can extract different types of NAL units such as SPS, PPS and SEI and video bitstream. Check Ffmpeg documention in ffmpeg.org/documentation.html
    – mdasari
    Jun 28, 2017 at 20:35
  • I assume that i have no header or footer can i get the video bitstream myself without using any tools like ffmpeg?
    – lighting
    Jun 29, 2017 at 8:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.