Step B: Format the source media
Make sure that the source media meets the requirements.
Format requirements
You must format the source media according to the CMAF Ingest (Interface-1) version 1.2 specification.
The following table identifies specific requirements for Elemental Inference.
| Characteristic | Requirement |
|---|---|
|
Media fragments |
Fragmented CMAF Ingest containerized media fragments |
|
MovieFragmentBox |
One per segment |
|
Initialization segment: naming |
Include an initialization segment with each stream, as follows:
|
|
Media segments: naming |
Media segments after the initialization segment must following this naming pattern:
Where: <type> is video or audio <ext> is cmfv or cmfa <sequence-number> must increase monotonically, although it doesn't have to be contiguous. Each sequence number must match the sequence number in the MovieFragmentHeader box. For example:
|
|
End of Stream indicator |
The last media segment in the session must be:
If you can't signal the end of stream in this way, there is a workaround. See Step C: Deliver the source media. |
Example
The following code shows how to use FFMPG to format the media to follow these
requirements. The commands demux, segment, and containerize the video and audio.
Note the -init_seg_name and -media_seg_name lines
$ mkdir 'Streams(default-video.cmfv)' $ ffmpeg -i input.mp4 \ -map 0:v:0 -c:v libx264 \ -profile:v main -pix_fmt yuv420p \ -g 30 -keyint_min 30 -sc_threshold 0 \ -force_key_frames 'expr:gte(t,n_forced*1)' \ -f dash -seg_duration 1 -use_timeline 0 \ -use_template 1 -remove_at_exit 0 \ -init_seg_name 'Streams(default-video.cmfv)/InitializationSegment' \ -media_seg_name 'Streams(default-video.cmfv)/Segment($Number%09d$)' \ 'video.mpd' $ mkdir 'Streams(default-audio.cmfa)'$ ffmpeg -i input.mp4 \ -map 0:a:0 -c:a aac -ar 48000 -ac 2 \ -f dash -seg_duration 1 -use_timeline 0 \ -use_template 1 -remove_at_exit 0 \ -init_seg_name 'Streams(default-audio.cmfa)/InitializationSegment' \ -media_seg_name 'Streams(default-audio.cmfa)/Segment($Number%09d$)' \ 'audio.mpd'