Skip to content

Instantly share code, notes, and snippets.

View VCone's full-sized avatar

VC:One VCone

  • VC:One (freelance audio/visual design & apps)
  • Sheffield, U.K
View GitHub Profile
@ryancat
ryancat / colorConvert.js
Created May 9, 2018 06:10
Convert color from RGB to LAB, RGB to HEX, or vice versa
/**
* Convert a hex color string to RGB array
* @param {String} hex Hex color string
*/
function hexToRgb(hex) {
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result ? [
parseInt(result[1], 16),
parseInt(result[2], 16),
parseInt(result[3], 16)
@yohhoy
yohhoy / yuvrgb.md
Last active April 2, 2025 23:15
RGB <=> YCbCr(YPbPr) color space conversion
Y  = a * R + b * G + c * B
Cb = (B - Y) / d
Cr = (R - Y) / e
BT.601 BT.709 BT.2020
a 0.299 0.2126 0.2627
b 0.587 0.7152 0.6780
@OllieJones
OllieJones / h264tools.js
Created February 4, 2021 16:11
h.264: Create an 'avcC' atom from a sequence of NALUs emitted by MediaRecorder
'use static'
// noinspection JSUnusedLocalSymbols,JSUnusedGlobalSymbols
/**
* Tools for handling H.264 bitstream issues.
*/
/**
* Handle the parsing and creation of "avcC" atoms.
*/
@nickferrando
nickferrando / smpte_hd_bars.sh
Created March 2, 2021 18:22
Generate SMPTE Color Bars/1kHz Test Tone with FFMPEG
#Display Custom Message on STMPE Bars and Server's Local Time
ffmpeg -re -f lavfi -i "smptehdbars=rate=30:size=1920x1080" \
-f lavfi -i "sine=frequency=1000:sample_rate=48000" \
-vf drawtext="text='YOUR MESSAGE %{localtime\:%X}':rate=30:x=(w-tw)/2:y=(h-lh)/2:fontsize=48:fontcolor=white:box=1:boxcolor=black" \
-f flv -c:v h264 -profile:v baseline -pix_fmt yuv420p -preset ultrafast -tune zerolatency -crf 28 -g 60 -c:a aac \
"rtmp://your_server_address/stream_key"
#Display Custom Message on STMPE Bars and Time (HH:MM:MS)
@ZiTAL
ZiTAL / index.html
Last active September 10, 2023 12:11
js: videojs hls example
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>videojs-contrib-hls embed</title>
<link href="https://vjs.zencdn.net/8.0.4/video-js.css" rel="stylesheet">
<script src="https://vjs.zencdn.net/8.0.4/video.min.js"></script>
<script src="https://unpkg.com/@videojs/[email protected]/dist/videojs-http-streaming.min.js"></script>