Skip to content

Instantly share code, notes, and snippets.

View ffmpeg.sh
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]" \
View check_signature.sh
ffmpeg -i small_bunny_1080p_60fps.mp4 -i 2s.mkv -filter_complex signature=detectmode=full:nb_inputs=2 -f null -
View faster_vp9_vorbis_webm_dash_ffmpeg.sh
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 \
View ffmpeg.sh
# 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
View sampling.lua
if math.random(100) <= sampling then
pcall(code)
end
View wrapping.lua
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")
View to_test.sh
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
View nginx.conf
http {
init_by_lua_block {
config = "redis-cluster-config"
redis_cluster = require "resty-redis-cluster"
edge_computing = require "resty-edge-computing"
}
server {
listen 8080;
View background.lua
-- ngx.timer.every(sync_interval, sync, self)
ngx.timer.every(sync_interval, sync, self)
View webp.sh
ffmpeg -i ${source} \
-vcodec libwebp -lossless 0 -q:v 75 -preset picture -loop 0 -an -vsync 0 -filter_complex "setpts=0.5*PTS,fps=12,scale=w=320:h=-2" -t 10 animated.webp
You can’t perform that action at this time.