Skip to content

Instantly share code, notes, and snippets.

View dudewheresmycode's full-sized avatar

Brian R dudewheresmycode

View GitHub Profile
dudewheresmycode /
Created November 13, 2023 02:53
Install NodeJS on Raspberry Pi 4 (armv8)
wget ""
tar -xf node-v20.9.0-linux-arm64.tar.xz
cd node-v20.9.0-linux-arm64
sudo cp -R bin include lib share /usr/local/
node -v
npm -v
dudewheresmycode /
Last active July 10, 2023 15:13
Transcode fragmented MP4s and package into HLS and DASH using shaka-packager
packager \
'in=./tmp/output_540p.mp4,stream=video,init_segment=./tmp/output/video_3000_0/video_init.mp4,segment_template=./tmp/output/video_3000_0/video_$Number$.m4s' \
'in=./tmp/output_720p.mp4,stream=video,init_segment=./tmp/output/video_1700_1/video_init.mp4,segment_template=./tmp/output/video_1700_1/video_$Number$.m4s' \
'in=./tmp/output_1080p.mp4,stream=video,init_segment=./tmp/output/video_1200_2/video_init.mp4,segment_template=./tmp/output/video_1200_2/video_$Number$.m4s' \
'in=./tmp/output_audio_128.mp4,stream=audio,language=en,roles=main,hls_name=main_en_2,init_segment=./tmp/output/audio_96_2/audio_init.mp4,segment_template=./tmp/output/audio_96_2/audio_$Number$.m4s' \
'in=./tmp/output_audio_196.mp4,stream=audio,language=en,roles=main,hls_name=main_en_3,init_segment=./tmp/output/audio_64_3/audio_init.mp4,segment_template=./tmp/output/audio_64_3/audio_$Number$.m4s' \
--fragment_duration 6 \
--segment_duration 6 \
dudewheresmycode / FFMPEG Scene
Last active April 3, 2023 02:30
Notes on scene detection with FFMPEG
View FFMPEG Scene

Basic ffmpeg scene detection:

ffmpeg -i input.flv -filter:v "select='gt(scene,0.4)',showinfo" -f null -

scene (video only) value between 0 and 1 to indicate a new scene; a low value reflects a low probability for the current frame to introduce a new scene, while a higher value means the current frame is more likely to be one (see the example below)

Set the scene change detection threshold as a percentage of maximum change on the luma plane. Good values are in the [8.0, 14.0] range. Scene change detection is only relevant in case combmatch=sc. The range for scthresh is [0.0, 100.0].

dudewheresmycode /
Created March 17, 2023 18:06
Generate a list of keyframes from a media file
ffprobe \
-v error \
-select_streams v \
-show_entries frame=pict_type,pts_time \
-of csv=p=0 \
-skip_frame nokey \
$INPUT_FILE > iframes.txt
View ical-create-download-javascript
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
View install ffmpeg on Raspberry

Install x264

cd ~
git clone git://
cd x264
./configure --host=arm-unknown-linux-gnueabi --enable-static --disable-opencl
make -j4
sudo make install

Generate 2min of colorbars and audio

ffmpeg \
-f lavfi -i "sine=frequency=1000:duration=120" \
-f lavfi \
-i testsrc=duration=5:size=1280x720:rate=24 \
-t 120 \
-map 0:0 \
-map 1:0 \
dudewheresmycode /
Last active January 27, 2022 23:35
A bash script to automate deploying test apps to Roku devices on the local network.
BUILD_ID=$(date +"%s")
dudewheresmycode /
Created February 8, 2021 02:33
Generate test colorbars and count for live streaming
ffmpeg \
-i "" \
-f lavfi \
-re \
-i testsrc=duration=120:size=1280x720:rate=24 \
-map 0:0 \
-map 1:0 \
-c:v libx264 \