{"id":13908539,"url":"https://github.com/futzu/umzz","last_synced_at":"2025-04-13T09:19:10.995Z","repository":{"id":151748529,"uuid":"622064562","full_name":"futzu/umzz","owner":"futzu","description":"SCTE-35 Injection for Adaptive Bitrate HLS","archived":false,"fork":false,"pushed_at":"2024-07-15T20:43:32.000Z","size":169,"stargazers_count":7,"open_issues_count":6,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-09T19:48:05.436Z","etag":null,"topics":["ad-break","adrian-of-doom","hls","hls-live-streaming","hls-stream","mpegts","pypy3","python3","scte-35","scte35","sexy","threefive","ultra-mega-zoom-zoom","umzz"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/futzu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"publiccode":null,"codemeta":null}},"created_at":"2023-04-01T02:48:01.000Z","updated_at":"2024-07-21T17:04:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"fdea0625-9cbd-4d57-8cc7-4a59073f707f","html_url":"https://github.com/futzu/umzz","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/futzu%2Fumzz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/futzu%2Fumzz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/futzu%2Fumzz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/futzu%2Fumzz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/futzu","download_url":"https://codeload.github.com/futzu/umzz/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248453610,"owners_count":21106295,"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":["ad-break","adrian-of-doom","hls","hls-live-streaming","hls-stream","mpegts","pypy3","python3","scte-35","scte35","sexy","threefive","ultra-mega-zoom-zoom","umzz"],"created_at":"2024-08-06T23:02:48.356Z","updated_at":"2025-04-13T09:19:10.947Z","avatar_url":"https://github.com/futzu.png","language":"Python","funding_links":[],"categories":["HarmonyOS"],"sub_categories":["Windows Manager"],"readme":"# Ultra Mega zoom zoom\n\n### Live Adaptive Bitrate HLS SCTE35 Cue Injection, powered by [threefive](https://github.com/futzu/threefive). \n## Latest Version `v0.0.33`\n![image](https://github.com/futzu/umzz/assets/52701496/428e189a-a2c3-4365-99b2-dbcc22014aad)\n\n---\n* umzz\n     * Handles __live streams in realtime__.\n     * supports __mpegts__ segments that use __h264, h265, and mpeg2__ video codecs.\n     * __Does not encode__. Use any encoder you like and pass umzz the master.m3u8.\n     * __Adds the SCTE-35 Cues__ to each variant, and __adjusts segments__ to start on iframes.\n     * Keeps variants in sync so __adaptive bitrate HLS works properly__.\n     * Outputs a __new master.m3u8__, new __variant m3u8s__, and __variant segments with SCTE-35__.\n\n\n\n### umzz parsing 4 live renditions (over a network) and ffplay playing all four umzz streams\n![image](https://github.com/futzu/umzz/assets/52701496/4ff73b69-5b87-4ff4-a6c0-9d5ad398a897)\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eInstall\u003c/b\u003e\u003c/summary\u003e\n    \n```lua\n    python3 -mpip install umzz\n```\n * and / or \n\n```lua\n    pypy3 -mpip install umzz\n```\n    \n\u003c/details\u003e    \n\n\n## `Inputs`\n\n\u003cdetails\u003e \u003csummary\u003e umzz takes a master.m3u8 as input,\u003cB\u003e More on inputs.\u003c/B\u003e \u003c/summary\u003e\n\n\n\n##### Don't use a master.m3u8 over a network, \n\n* Here's as close I can keep 4 renditions in sync over currently. \n*  If the master.m3u8 is local, the renditions stay in sync\n\n![image](https://github.com/futzu/umzz/assets/52701496/467571ea-6d36-49e9-8978-6d4e97f2d5eb)\n\n\n\u003cbr\u003e If you use a master,m3u8 across a network,\n\u003cbr\u003eit will have problems. You're trying to download \n\u003cbr\u003eand parse all the renditions at the same time. \n\u003cbr\u003e Instead use ffmpeg to pull one rendition off the network\n\u003cbr\u003eand use it to  create a new local master.m3u8.\n\u003cbr\u003e This is the faster way to do it\n\n* something like\n  \n```smalltalk\nffmpeg  -re -copyts    \n-i https://example.com/rendition4.m3u8  \\ \n-g 30 -r 30 -flags +cgop \\         \n-c:v libx264 -preset faster \\       \n-b:v:0 2500k -b:v:1 256k  \\          \n-filter:v:0 scale=1920:1080 -filter:v:1 scale=512:288 \\\n-c:a aac -b:a 64k \\                          \n-map 0:v -map 0:a -map 0:v -map 0:a  \\ \n-f hls -var_stream_map \"v:0,a:0 v:1,a:1\" \\\n-master_pl_name master.m3u8   \\\nfu3/mo_%v.m3u8  \n```\n\n* While ffmpeg is working, wait a few seconds and then startup umzz.\n  ```lua\n  umzz -i fu3/master.m3u8 -s my_sidecar.txt -l\n  ```\n* and you'll be good to go.\n\n\n\n\u003c/details\u003e  \n\n\n## `Command Line`    \n\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003ecli tool\u003c/b\u003e\u003c/summary\u003e\n\n```smalltalk\nusage: umzz [-h] [-i INPUT] [-c] [-d] [-l] [-n] [-o OUTPUT_DIR] [-p] [-r]\n            [-s SIDECAR_FILE] [-S] [-t TIME] [-T HLS_TAG] [-w WINDOW_SIZE]\n            [-v]\n\noptional arguments:\n  -h, --help            show this help message and exit\n\n  -i INPUT, --input INPUT\n                        Input source, like /home/a/vid.ts or\n                        udp://@235.35.3.5:3535 or https://futzu.com/xaa.ts or\n                        https://example.com/not_a_master.m3u8 [default: stdin]\n\n  -c, --continue_m3u8   Resume writing index.m3u8 [default:False]\n\n  -d, --delete          delete segments (enables --live) [default:False]\n\n  -l, --live            Flag for a live event (enables sliding window m3u8)\n                        [default:False]\n\n  -n, --no_discontinuity\n                        Flag to disable adding #EXT-X-DISCONTINUITY tags at\n                        splice points [default:False]\n\n  -o OUTPUT_DIR, --output_dir OUTPUT_DIR\n                        Directory for segments and index.m3u8 (created if\n                        needed) [default:'.']\n\n  -p, --program_date_time\n                        Flag to add Program Date Time tags to index.m3u8 (\n                        enables --live) [default:False]\n\n  -r, --replay          Flag for replay aka looping (enables --live,--delete)\n                        [default:False]\n\n  -s SIDECAR_FILE, --sidecar_file SIDECAR_FILE\n                        Sidecar file of SCTE-35 (pts,cue) pairs.[default:None]\n\n  -S, --shulga          Flag to enable Shulga iframe detection mode\n                        [default:False]\n\n  -t TIME, --time TIME  Segment time in seconds [default:2]\n\n  -T HLS_TAG, --hls_tag HLS_TAG\n                        x_scte35, x_cue, x_daterange, or x_splicepoint\n                        [default:x_cue]\n\n  -w WINDOW_SIZE, --window_size WINDOW_SIZE\n                        sliding window size (enables --live) [default:5]\n\n  -v, --version         Show version\n```\n\n\n\u003c/details\u003e\n\n\n## `Writing Code`\n\u003cdetails\u003e \u003csummary\u003eusing umzz \u003cB\u003eprogrammatically\u003c/B\u003e\n\n\n\u003c/summary\u003e\n\n\n\n```py3\n    from umzz import do, argue\n\n    args =argue()\n\n    args.input = \"/home/a/slow/master.m3u8\"\n    args.live = True\n    args.replay = True\n    args.sidecar_file=\"sidecar.txt\"\n    args.output_dir = \"out-stuff\"\n\n    do(args)\n```\n\n* set any command line options programmatically with args.\n* the vars in args correspond to the long_names of the cli tool.\n* the vars in args can be access via dot notation\n* these are the defaults returned from argue() .\n\n|  vars in args    |  default value |\n|------------------|----------------|\n| input            |sys.stdin.buffer|\n| continue_m3u8    |   False        |\n| delete           |   False        |\n| live             |   False        |\n| no_discontinuity |   False        |\n| output_dir       |    '.'         |\n| program_date_time|   False        |\n| replay           |   False        |\n| sidecar_file     |   None         |\n| shulga           |   False        |\n| time             |     2          |\n| hls_tags         |  'x_cue'       |\n| window_size      |     5          |\n   \n\n\n\u003c/details\u003e\n\n## `SCTE-35`\n\n\n\u003cdetails\u003e \u003csummary\u003eSCTE-35 cues are load from a sidecar file. \u003cb\u003eMore on sidecar files.\u003cb\u003e \u003c/summary\u003e\n\n\nSidecar Cues will be handled the same as SCTE35 cues from a video stream.   \nline format for text file  `insert_pts, cue`\n       \npts is the insert time for the cue, A four second preroll is standard. \ncue can be base64,hex, int, or bytes\n     \n```smalltalk\n      a@debian:~/umzz$ cat sidecar.txt\n  \n      38103.868589, /DAxAAAAAAAAAP/wFAUAAABdf+/+zHRtOn4Ae6DOAAAAAAAMAQpDVUVJsZ8xMjEqLYemJQ== \n      38199.918911, /DAsAAAAAAAAAP/wDwUAAABef0/+zPACTQAAAAAADAEKQ1VFSbGfMTIxIxGolm0= \n\n \n\n  umzz -i  noscte35-master.m3u8  -s sidecar.txt\n```\n\n \n    \n\u003c/details\u003e\n\n    \n\u003cdetails\u003e\u003csummary\u003e Quick Example \u003c/summary\u003e\n    \n \n* if you have a master.m3u8 like \n\n```js\na@debian:~/umzz$ cat ~/stuff/master.m3u8\n#EXTM3U\n#EXT-X-VERSION:6\n#EXT-X-STREAM-INF:BANDWIDTH=83222,RESOLUTION=864x486,CODECS=\"avc1.42c01f,mp4a.40.2\"\nstream_0.m3u8\n\n#EXT-X-STREAM-INF:BANDWIDTH=83222,RESOLUTION=1280x720,CODECS=\"avc1.42c01f,mp4a.40.2\"\nstream_1.m3u8\n\n#EXT-X-STREAM-INF:BANDWIDTH=83222,RESOLUTION=640x360,CODECS=\"avc1.42c01e,mp4a.40.2\"\nstream_2.m3u8\n```\n\n* and you want to add a splice insert  at PTS 13140.123456, create a sidecar file and add the following line.\n```js \na@debian:~/umzz$ cat sidecar.txt\n13140.123456,/DAhAAAAAAAAAP/wEAUAAAAJf78A/gASZvAACQAAAACokv3z\n```\n* then run this. \n```js\n\na@debian:~/umzz$ umzz -i ~/stuff/master.m3u8 -s sidecar.txt -o fu\n```\n* in the base dir fu is the new HLS with SCTE-35 \n```js\na@debian:~/umzz$ ls -ald fu/* fu/*/index.m3u8\ndrwxr-xr-x 1 a a 1816 Apr  9 06:07 fu/0\n-rw-r--r-- 1 a a 3171 Apr  9 06:07 fu/0/index.m3u8\ndrwxr-xr-x 1 a a 1816 Apr  9 06:07 fu/1\n-rw-r--r-- 1 a a 3171 Apr  9 06:07 fu/1/index.m3u8\ndrwxr-xr-x 1 a a 1816 Apr  9 06:07 fu/2\n-rw-r--r-- 1 a a 3171 Apr  9 06:07 fu/2/index.m3u8\n-rw-r--r-- 1 a a  320 Apr  9 06:07 fu/master.m3u8\n```\n    \n\u003c/details\u003e    \n\n\n![image](https://github.com/futzu/umzz/assets/52701496/cf52cf78-1b16-454c-a5b6-aae742ccad28)\n\n\n\n\n\n\n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffutzu%2Fumzz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffutzu%2Fumzz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffutzu%2Fumzz/lists"}