Skip to content

Instantly share code, notes, and snippets.

package main
import (
"crypto/hmac"
"crypto/sha256"
"encoding/hex"
"fmt"
)
func main() {
val = "a0192faa0"
function string.pack(str)
local packed_string = "" for i=1, #str, 2 do
local hex_number = tonumber("0x" .. str:sub(i,i) .. str:sub(i+1,i+1))
packed_string = packed_string .. string.char(hex_number)
end return packed_string
end
ffmpeg -y -hide_banner -re -t 00:00:10 \
-f lavfi -i 'testsrc2=size=1280x720:rate=60,format=yuv420p' \
-filter_complex "[0:v]fps=1,split=2[out1][out2]" \
-map "[out1]" \
-vcodec libwebp \
-lossless 1 \
-preset photo \
-threads 1 \
pixx/thumb%9d.webp \
-map "[out2]" \
ffmpeg -i small_bunny_1080p_60fps.mp4 -i 2s.mkv -filter_complex signature=detectmode=full:nb_inputs=2 -f null -
ffmpeg -hide_banner \
-re -f lavfi -i "testsrc2=size=384x216:rate=30,format=yuv420p" \
-f lavfi -i "sine=frequency=220:beep_factor=4:duration=5" -threads 8\
-c:v libvpx-vp9 -deadline realtime -cpu-used 4 -row-mt 1 \
-speed 6 -tile-columns 4 -frame-parallel 1 -threads 8 -static-thresh 0 -max-intra-rate 300 -deadline realtime -lag-in-frames 0 -error-resilient 1 \
-tile-columns 6 -frame-parallel 1 \
-minrate 400k -maxrate 400k -b:v 400k -keyint_min 30 -g 30 \
-c:a libvorbis -b:a 128k \
-window_size 5 -extra_window_size 10 -remove_at_exit 1 -adaptation_sets "id=0,streams=v id=1,streams=a" \
-fflags +genpts \
# webm - mp4
ffmpeg -hide_banner \
-re -f lavfi -i "testsrc2=size=1280x720:rate=30,format=yuv420p" \
-f lavfi -i "sine=frequency=220:beep_factor=4:duration=5" \
-c:v libx264 -preset ultrafast -tune zerolatency -profile:v high \
-b:v 1400k -bufsize 2800k -x264opts keyint=30:min-keyint=30:scenecut=-1 \
-c:a aac -b:a 128k \
-window_size 5 -extra_window_size 10 -remove_at_exit 1 -adaptation_sets "id=0,streams=v id=1,streams=a" \
-fflags +genpts \
-movflags isml+frag_keyframe output.mpd
if math.random(100) <= sampling then
pcall(code)
end
local wrapper_loadstring = function(str_code)
local api_fun, err = loadstring("return function (edge_computing) " .. str_code .. " end")
if api_fun then return api_fun() else return api_fun, err end
end
-- ... compile cu["code] = wrapper_loadstring(raw_code)
local status, ret = pcall(cu["code"], {redis_client=edge_computing.redis_client})
-- CU in Redis --
-- set authentication "rewrite||local resp, err = edge_computing.redis_client:incr(\"key\") \n ngx.log(ngx.ERR, \" >>>> \", resp) \n"
local resp, err = edge_computing.redis_client:incr("key")
git checkout 1.0.4
# in tab1 - run the NOTT
make run
# in tab2 - run the tv show
make broadcast_tvshow
# in tab3 - test
http http://localhost:8080/hls/colorbar.m3u8
http {
init_by_lua_block {
config = "redis-cluster-config"
redis_cluster = require "resty-redis-cluster"
edge_computing = require "resty-edge-computing"
}
server {
listen 8080;