Package: umzz
Ultra Mega zoom zoomLive Adaptive Bitrate HLS SCTE35 Cue InjectionLatest Versionv0.0.31umzzHandleslive streams in realtime.supportsmpegtssegments that useh264, h265, and mpeg2video codecs.Does not encode. Use any encoder you like and pass umzz the master.m3u8.Adds the SCTE-35 Cuesto each variant, andadjusts segmentsto start on iframes.Keeps variants in sync soadaptive bitrate HLS works properly.Outputs anew master.m3u8, newvariant m3u8s, andvariant segments with SCTE-35.umzz parsing 4 live renditions (over a network) and ffplay playing all four umzz streamsInstallpython3-mpipinstallumzzand / orpypy3-mpipinstallumzzInputsumzz takes a master.m3u8 as input,More on inputs.Don't use a master.m3u8 over a network,Here's as close I can keep 4 renditions in sync over currently.If the master.m3u8 is local, the renditions stay in syncIf you use a master,m3u8 across a network,it will have problems. You're trying to downloadand parse all the renditions at the same time.Instead use ffmpeg to pull one rendition off the networkand use it to  create a new local master.m3u8.This is the faster way to do itsomething likeffmpeg-re-copyts-ihttps://example.com/rendition4.m3u8\-g30-r30-flags+cgop\-c:vlibx264-presetfaster\-b:v:02500k-b:v:1256k\-filter:v:0scale=1920:1080-filter:v:1scale=512:288\-c:aaac-b:a64k\-map0:v-map0:a-map0:v-map0:a\-fhls-var_stream_map"v:0,a:0 v:1,a:1"\-master_pl_namemaster.m3u8\fu3/mo_%v.m3u8While ffmpeg is working, wait a few seconds and then startup umzz.umzz-ifu3/master.m3u8-smy_sidecar.txt-land you'll be good to go.Command Linecli toolusage:umzz[-h] [-iINPUT] [-c] [-d] [-l] [-n] [-oOUTPUT_DIR] [-p] [-r]
            [-sSIDECAR_FILE] [-S] [-tTIME] [-THLS_TAG] [-wWINDOW_SIZE]
            [-v]optionalarguments:-h,--helpshowthishelpmessageandexit-iINPUT,--inputINPUTInputsource,like/home/a/vid.tsorudp://@235.35.3.5:3535orhttps://futzu.com/xaa.tsorhttps://example.com/not_a_master.m3u8[default:stdin]-c,--continue_m3u8Resumewritingindex.m3u8[default:False]-d,--deletedeletesegments(enables--live) [default:False]-l,--liveFlagforaliveevent(enablesslidingwindowm3u8)
                        [default:False]-n,--no_discontinuityFlagtodisableadding#EXT-X-DISCONTINUITYtagsatsplicepoints[default:False]-oOUTPUT_DIR,--output_dirOUTPUT_DIRDirectoryforsegmentsandindex.m3u8(createdifneeded) [default:'.']-p,--program_date_timeFlagtoaddProgramDateTimetagstoindex.m3u8(enables--live) [default:False]-r,--replayFlagforreplayakalooping(enables--live,--delete)
                        [default:False]-sSIDECAR_FILE,--sidecar_fileSIDECAR_FILESidecarfileofSCTE-35(pts,cue)pairs.[default:None]-S,--shulgaFlagtoenableShulgaiframedetectionmode[default:False]-tTIME,--timeTIMESegmenttimeinseconds[default:2]-THLS_TAG,--hls_tagHLS_TAGx_scte35,x_cue,x_daterange,orx_splicepoint[default:x_cue]-wWINDOW_SIZE,--window_sizeWINDOW_SIZEslidingwindowsize(enables--live) [default:5]-v,--versionShowversionWriting Codeusing umzzprogrammaticallyfromumzzimportdo,argueargs=argue()args.input="/home/a/slow/master.m3u8"args.live=Trueargs.replay=Trueargs.sidecar_file="sidecar.txt"args.output_dir="out-stuff"do(args)set any command line options programmatically with args.the vars in args correspond to the long_names of the cli tool.the vars in args can be access via dot notationthese are the defaults returned from argue() .vars in argsdefault valueinputsys.stdin.buffercontinue_m3u8FalsedeleteFalseliveFalseno_discontinuityFalseoutput_dir'.'program_date_timeFalsereplayFalsesidecar_fileNoneshulgaFalsetime2hls_tags'x_cue'window_size5SCTE-35SCTE-35 cues are load from a sidecar file.More on sidecar files.Sidecar Cues will be handled the same as SCTE35 cues from a video stream.line format for text fileinsert_pts, cuepts is the insert time for the cue, A four second preroll is standard.
cue can be base64,hex, int, or bytesa@debian:~/umzz$catsidecar.txt38103.868589,/DAxAAAAAAAAAP/wFAUAAABdf+/+zHRtOn4Ae6DOAAAAAAAMAQpDVUVJsZ8xMjEqLYemJQ==38199.918911,/DAsAAAAAAAAAP/wDwUAAABef0/+zPACTQAAAAAADAEKQ1VFSbGfMTIxIxGolm0=umzz-inoscte35-master.m3u8-ssidecar.txtQuick Exampleif you have a master.m3u8 likea@debian:~/umzz$ cat ~/stuff/master.m3u8#EXTM3U#EXT-X-VERSION:6#EXT-X-STREAM-INF:BANDWIDTH=83222,RESOLUTION=864x486,CODECS="avc1.42c01f,mp4a.40.2"stream_0.m3u8#EXT-X-STREAM-INF:BANDWIDTH=83222,RESOLUTION=1280x720,CODECS="avc1.42c01f,mp4a.40.2"stream_1.m3u8#EXT-X-STREAM-INF:BANDWIDTH=83222,RESOLUTION=640x360,CODECS="avc1.42c01e,mp4a.40.2"stream_2.m3u8and you want to add a splice insert  at PTS 13140.123456, create a sidecar file and add the following line.a@debian:~/umzz$ cat sidecar.txt13140.123456,/DAhAAAAAAAAAP/wEAUAAAAJf78A/gASZvAACQAAAACokv3zthen run this.a@debian:~/umzz$ umzz -i ~/stuff/master.m3u8 -s sidecar.txt -o fuin the base dir fu is the new HLS with SCTE-35a@debian:~/umzz$ ls -ald fu/*fu/*/index.m3u8drwxr-xr-x1aa1816Apr906:07fu/0-rw-r--r--1aa3171Apr906:07fu/0/index.m3u8drwxr-xr-x1aa1816Apr906:07fu/1-rw-r--r--1aa3171Apr906:07fu/1/index.m3u8drwxr-xr-x1aa1816Apr906:07fu/2-rw-r--r--1aa3171Apr906:07fu/2/index.m3u8-rw-r--r--1aa320Apr906:07fu/master.m3u8