{"id":13567572,"url":"https://github.com/lebougui/hls-creator","last_synced_at":"2025-04-04T01:32:26.379Z","repository":{"id":218019857,"uuid":"93736620","full_name":"lebougui/hls-creator","owner":"lebougui","description":"Tools to create hls playlists using ffmpeg.  Originally forked from https://github.com/bentasker/HLS-Stream-Creator","archived":false,"fork":false,"pushed_at":"2018-04-18T07:55:59.000Z","size":16,"stargazers_count":33,"open_issues_count":3,"forks_count":13,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-11-04T22:37:21.626Z","etag":null,"topics":["ffmpeg","hls","iframe","shell"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lebougui.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-06-08T10:23:41.000Z","updated_at":"2024-07-27T03:59:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"5b9e5be6-f466-4b61-90c6-45122ca7076e","html_url":"https://github.com/lebougui/hls-creator","commit_stats":null,"previous_names":["lebougui/hls-creator"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lebougui%2Fhls-creator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lebougui%2Fhls-creator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lebougui%2Fhls-creator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lebougui%2Fhls-creator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lebougui","download_url":"https://codeload.github.com/lebougui/hls-creator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247107816,"owners_count":20884793,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ffmpeg","hls","iframe","shell"],"created_at":"2024-08-01T13:02:35.094Z","updated_at":"2025-04-04T01:32:21.359Z","avatar_url":"https://github.com/lebougui.png","language":"Shell","funding_links":[],"categories":["Shell","HarmonyOS"],"sub_categories":["Windows Manager"],"readme":"hls-creator\n===========\n\nThis script has been forked from https://github.com/bentasker/HLS-Stream-Creator project.\nRenamed script from \"HLS-Stream-Creator.sh\" to \"hls.sh\".\nSome issues have been fixed + new params.\n\n\nhls.sh is a simple BASH Script designed to take a media file, segment it and create an M3U8 playlist for serving using HLS.\nThere are numerous tools out there which are far better suited to the task, and offer many more options. This project only exists because I was asked to look\ninto HTTP Live Streaming in depth, so after reading the [IETF Draft](http://tools.ietf.org/html/draft-pantos-http-live-streaming-11 \"HLS on IETF\") I figured I'd start with the basics by creating a script to encode arbitrary video into a VOD style HLS feed.\n\n\nI-FRAME Creator(iframe.sh) is used to generate I-Frame Playlist from existing HLS Playlist.\n\nPre-requisites\n-------------\nffmeg must be installed.\n\n\nUsage\n------\n\nUsage is incredibly simple\n\n```\n./hls.sh -[lf] [-c segmentcount] -i [inputfile] -s [segmentlength(seconds)] -o [outputdir] -b [bitrates]\n\n\nDeprecated Legacy usage:\n\thls.sh inputfile segmentlength(seconds) [outputdir='./output']\n\n```\n\nSo to split a video file called *example.avi* into segments of 10 seconds, we'd run\n\n```\n./hls.sh -i example.avi -s 10\n```\n\n**Arguments**\n\n```\n    Mandatory Arguments:\n\n\t-i [file]\tInput file or UR\n\t-s [s]  \tSegment length (seconds)\n\n    Optional Arguments:\n\n\t-o [directory]\tOutput directory (default: ./output)\n\t-c [count]\tNumber of segments to include in playlist (live streams only) - 0 is no limit\n\t-b [bitrates]\tOutput video Bitrates in kb/s (comma seperated list for adaptive streams)\n\t-p [name]\tPlaylist filename prefix\n\t-t [name]\tSegment filename prefix\n\t-l\t\tInput is a live stream\n\t-m\t\tCreate HLS Segments only with Video Stream\n\t-f\t\tForeground encoding only (adaptive non-live streams only)\n\t-S\t\tName of a subdirectory to put segments into\n```\n\n\nAdaptive Streams\n------------------\n\nAs of [HLS-6](http://projects.bentasker.co.uk/jira_projects/browse/HLS-6.html) the script can now generate adaptive streams with a top-level variant playlist for both VoD and Linear input streams.\n\nIn order to create seperate bitrate streams, pass a comma seperated list in with the *-b* option\n\n```\n./hls.sh -i example.avi -s 10 -b 28,64,128,256\n```\n\nBy default, transcoding for each bitrate will be forked into the background - if you wish to process the bitrates sequentially, pass the *-f* option\n\n```\n./hls.sh -i example.avi -s 10 -b 28,64,128,256 -f\n```\n\nIn either case, in accordance with the HLS spec, the audio bitrate will remain unchanged\n\n\nOutput\n-------\n\nAs of version 1, the HLS resources will be output to the directory *output*. These will consist of video segments encoded in H.264 with AAC audio and an m3u8 file in the format\n\n\u003e\\#EXTM3U  \n\u003e\\#EXT-X-MEDIA-SEQUENCE:0  \n\u003e\\#EXT-X-VERSION:3  \n\u003e\\#EXT-X-TARGETDURATION:10  \n\u003e\\#EXTINF:10, no desc  \n\u003eexample_00001.ts  \n\u003e\\#EXTINF:10, no desc  \n\u003eexample_00002.ts  \n\u003e\\#EXTINF:10, no desc  \n\u003eexample_00003.ts  \n\u003e\\#EXTINF:5, no desc  \n\u003eexample_00004.ts  \n\u003e\\#EXT-X-ENDLIST\n\n\nThe alternative audio media playlists with audio segments are created.\nThe appropriate EXT-X-MEDIA entries are added into TLM Playlist and a new attribute \"AUDIO=\" to each video playlist entry. like :\n\n\u003e\\#EXT-X-STREAM-INF:BANDWIDTH=41014,AUDIO=\"aac\"  \n\u003etest/41014/test_41014.m3u8  \n\u003e  \n\u003e  \n\u003e\\#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"aac\",LANGUAGE=\"eng\",NAME=\"ENG\",AUTOSELECT=YES,DEFAULT=NO,URI=\"test_Alt_Audio_Eng_AAC/test_Alt_Audio_Eng_AAC.m3u8\"  \n\n\n\nUsing a Specific FFMPEG binary\n-------------------------------\n\nThere may be occasions where you don't want to use the *ffmpeg* that appears in PATH. At the top of the script, the ffmpeg command is defined, so change this to suit your needs\n\n```\nFFMPEG='/path/to/different/ffmpeg'\n```\n\n\nAdditional Environment Variables\n-------------------------------\n\nThere are few environment variables which can control the ffmpeg behaviour.\n\n* `VIDEO_CODEC` - The encoder which will be used by ffmpeg for video streams. Examples: _libx264_, _nvenc_\n* `AUDIO_CODEC` - Encoder for the audio streams. Examples: _aac_, _libfdk_acc_, _mp3_, _libfaac_\n* `NUMTHREADS` - A number which will be passed to the `-threads` argument of ffmpeg. Newer ffmpegs with modern libx264 encoders will use the optimal number of threads by default.\n* `FFMPEG_FLAGS` - Additional flags for ffmpeg. They will be passed without any modification.\n\nExample usage:\n\n```\nexport VIDEO_CODEC=\"nvenc\"\nexport FFMPEG_FLAGS=\"-pix_fmt yuv420p -profile:v\"\n./hls.sh example.avi 10\n```\n\n\nI-FRAME Creator\n==================\n\nUsage\n------\n\nUsage is incredibly simple\n\n\n```\nUsage : ./iframe.sh -h -l \u003cmaster playlist location\u003e -t \u003ciframe type \u003e\n\nRetrieve all playlists file from a folder and generate the two iframes playlists :\n- byte range based ones\n- transport streams based ones.\n\nOPTIONS :\n        -h              displays this help\n        -l              master playlist location\n        -t              byterange or default\n\n        Examples : \n        ./iframe.sh -l /cdn/video_TLM.m3u8 -t default (Not complete yet)\n        ./iframe.sh -l /cdn/video_TLM.m3u8 -t byterange\n\nVersion       : ./iframe.sh 1.0 (2016/03/14) \nMaintainer(s) : Lebougi \n```\n\nTODO\n------\n\nI-FRAME Creator shall be called by hls.sh to generate I-FRAME Playlist when encoding new HLS\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flebougui%2Fhls-creator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flebougui%2Fhls-creator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flebougui%2Fhls-creator/lists"}