Building m3u8 playlist with mp4 files

2.5k views Asked by At

I own a digital receiver which could also play IPTV channels (m3u8). I want to build my own local IPTV station to be able to watch a video playlist on TV. I configured a computer as a web server. Now, I am trying to build the m3u8 playlist. I tried to add the video files (mp4) to a blank m3u8 file.

#EXTM3U
file1.mp4
file2.mp4

The problem is that my IPTV player only plays file1.mp4 then stops. I am new to hls, however I would like to avoid to convert all my videos to hls with ts segments.

Are there any ways to make it working? Thank you!

1

There are 1 answers

0
James John McGuire 'Jahmic' On

While the first mp4 is recognized and played correctly, it isn't the 'correct' type of mp4 file to be played in this type of playlist. They need to be encoded as 'Fragmented MPEG-4' files. I'm suspecting that each file needs to contain a bit of information about the next segment.

From RFC 8216:

3.3. Fragmented MPEG-4

MPEG-4 Fragments are specified by the ISO Base Media File Format
[ISOBMFF]. Unlike regular MPEG-4 files that have a Movie Box
('moov') that contains sample tables and a Media Data Box ('mdat')
containing the corresponding samples, an MPEG-4 Fragment consists of
a Movie Fragment Box ('moof') containing a subset of the sample table and a Media Data Box containing those samples. Use of MPEG-4
Fragments does require a Movie Box for initialization, but that Movie Box contains only non-sample-specific information such as track and
sample descriptions.

A Fragmented MPEG-4 (fMP4) Segment is a "segment" as defined by
Section 3 of [ISOBMFF], including the constraints on Media Data Boxes in Section 8.16 of [ISOBMFF].

The Media Initialization Section for an fMP4 Segment is an ISO Base Media File that can initialize a parser for that Segment.

Broadly speaking, fMP4 Segments and Media Initialization Sections are [ISOBMFF] files that also satisfy the constraints described in this section.

The Media Initialization Section for an fMP4 Segment MUST contain a File Type Box ('ftyp') containing a brand that is compatible with
'iso6' or higher. The File Type Box MUST be followed by a Movie Box. The Movie Box MUST contain a Track Box ('trak') for every Track
Fragment Box ('traf') in the fMP4 Segment, with matching track_ID.
Each Track Box SHOULD contain a sample table, but its sample count
MUST be zero. Movie Header Boxes ('mvhd') and Track Header Boxes
('tkhd') MUST have durations of zero. A Movie Extends Box ('mvex')
MUST follow the last Track Box. Note that a Common Media Application Format (CMAF) Header [CMAF] meets all these requirements.