3

I am using mediafilesegmenter to generate HLS playlists for mp4 movies. My command is as follows,

mediafilesegmenter movieName.mp4 -I -f /Library/WebServer/Documents/vod/movieName/ -t 10 -l movie.log -k /Library/WebServer/Documents/vod/movieName/keys/ -K http://KEYSERVER/keys/ -key-rotation-period 10 -encrypt-rotate-iv-mbytes=1024 -J random

Through this command i am getting playlist generated fine, but the duration in #EXTINF: is decimal placed. I did checked the HLS draft, it says

The EXTINF tag specifies the duration of a media segment. It applies only to the media URI that follows it. Each media segment URI MUST be preceded by an EXTINF tag. Its format is:

#EXTINF:<duration>,<title> >

"duration" is an integer or floating-point number in decimal positional notation that specifies the duration of the media segment in seconds. Durations that are reported as integers SHOULD be rounded to the nearest integer. Durations MUST be integers if the protocol version of the Playlist file is less than 3.

My question is How can i make #EXTINF to whole integer? I did used the option -t 10 and -t 15 and several numbers, but still my playlist has
#EXTINF:14.792, etc.

Can anybody point me what changes in the command to be made so that i get whole integer based #EXTINF ?

My mediasegmenter version is mediafilesegmenter: Beta Version 1.1(111116)

I am using Darwin Kernel Version 10.8.0 with x86_64 mac.

Kara
  • 6,115
  • 16
  • 50
  • 57
cb24
  • 61
  • 2
  • 6
  • Is there a way to specify which protocol version is used in mediafilesegmenter? I don't have enough money to access the man page. But if you can set it to version 2, it should only output integers for duration. But what might be simplest is to just modify the generated playlist with a simple regex in a script. – vipw Mar 02 '12 at 08:39
  • Thanks for the reply, i got the things working with reg-ex, here is the reg-ex i have used `perl -pi -e 's/#EXTINF:(\d{1,2})\.(.*),/#EXTINF:10,/g' prog_index.m3u8 ` – cb24 Apr 13 '12 at 05:00
  • 1
    You're replacing all the durations with 10? That doesn't seem right and might have consequences in the clients when they try to use the seek bar. If the client tries to seek what it thinks is 100 seconds, it will skip 10 segments, which may or may not be close to 100 seconds. I would recommend to update the code to round-off the value. Ideally, you could keep a running total of the fractional parts to avoid cumulative rounding error. – vipw Apr 13 '12 at 07:00
  • Thanks for the reply. I changed my approach from search and replace to round off. Looks like seek issue is resolved :) – cb24 Apr 20 '12 at 10:18

1 Answers1

5

There is now a proper solution provided by Apple. You should use this flag to the mediafilesegmenter tool.

-no-floating-point-duration

vipw
  • 7,593
  • 4
  • 25
  • 48