Hi, I needed to encode m3u8 playlists (and .ts segments) with my local FFmpeg installation (compiled from recent git pull). I could do it via the command line using m3u8 as the output extension, but for some reason m3u8 didn't show up in ffpmeg -formats, so wasn't available via the ffmpeg_ui preset form.
I also needed to specify custom FFmpeg options in the preset form via a textfield (eg. in this case, -hls_list_size 9999 since it would default to 4).
I've submitted a patch which adds a custom options textfield in the preset form for the FFmpeg transcoder, and applies these options in the transcoding run. The patch also hardcodes (naughty me) m3u8 as an available extension format and deals with moving the .ts segments as well as the m3u8 playlist to the appropriate Drupal-managed file location. I also modified the generic html5 player template to include m3u8 files but ignore .ts files when building a list of sources for a video, this may not suit everyone.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | video.final_.patch | 30.54 KB | bgilhome |
| #3 | video.m3u8.smil_.options.phpvidtk.patch | 27.98 KB | bgilhome |
| #2 | video.m3u8_index.options.phpvidtk.patch | 26.47 KB | bgilhome |
| #1 | video.m3u8_index.options.phpvidtk.patch | 23.77 KB | bgilhome |
| video.m3u8.options.patch | 7.42 KB | bgilhome |
Comments
Comment #1
bgilhome commentedA better implementation here. An additional option to create a 'master' m3u8 index containing multiple m3u8 files for different bandwidths, used in adaptive bitrate streaming. TS segments and non-'master' m3u8 files are moved into a subdirectory '/streams' of the converted videos output directory so they can be distinguished in player template files by eg.
(basename(dirname($file->uri)) == 'streams')(and in most cases won't be added as a source in an html5videotag).This patch also includes a couple of alterations to phpvideotoolkit.php5.php, I needed to encode audio with libfdk_aac high-efficiency aac, the toolkit only had FORMAT_AAC, I wasn't sure that included HE-AAC.
Comment #2
bgilhome commentedOK, I needed to check that more thoroughly. Here's an updated patch with a few bugfixes, including a fix for Video module when preserved aspect ratio leads to an odd pixel height or width. It also hides the dimensions dropdown on node forms when "Use preset dimensions for video conversion" is selected at /admin/config/media/video/presets.
Comment #3
bgilhome commentedOK. One more patch, this includes an option to create a SMIL index file for RTMP streaming. This patch includes all other modifications above.
Comment #4
bgilhome commentedProbably better with absolute paths in the index files (smil & m3u8) - here's a patch. Also adds separate video & audio bitrate info to .smil and codec info to .m3u8 and .smil files. Does it help much/at all? Not sure.
Comment #5
rjdjohnston commented@bgilhome - you are the BOMB!!!!!
The patch is slightly off from when you probably made it. These three files failed:
I went through and manually updated. It looks like a maintainer actually used some of your updates to the Factory file, but not all of them. Why? I have no idea.
This patch along with this customer present
-hls_list_size 9999(that you mentioned), has me rocking and rolling!Setup 4 presets for 180/360/720/1080. Upload file, boom. m3u8 playlist made with ease.
I love that you added a master playlist to round adaptive bitrate streaming out.. the only piece I see you're missing so far is the "BANDWIDTH" parameter. They're all 0.
I'll hack around and post an update how I got bandwidth added.
Thank you for your contribution and this absolutely should be included in the core module.
Comment #6
hypertext200Comment #7
bgilhome commentedGlad to help!
Comment #8
hypertext200The patch need to clean and test against the 2.x branch.