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
@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>
@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)
@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.
*/
@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
@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)
@rveciana
rveciana / .block
Last active September 19, 2023 11:40
Basic gpu.js canvas example
licence: mit
@XueshiQiao
XueshiQiao / h264format.md
Last active February 5, 2025 06:22
H.264 Annex B format and AVCC format

AnnexB format:

([start code] NALU) | ( [start code] NALU) |

AVCC format:

([extradata]) | ([length] NALU) | ([length] NALU) |
@justsml
justsml / fetch-api-examples.md
Last active April 22, 2025 13:44
JavaScript Fetch API Examples
@EricDavies
EricDavies / TextureToJava.
Created June 27, 2017 17:26
Android code for getting a snapshot from a RTCMediaStream.
package com.priologic.easyrtcMedia;
import android.opengl.GLES11Ext;
import android.opengl.GLES20;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import org.webrtc.*;
/**
* Class for converting OES textures RGBA. It should be constructed on a thread with
* an active EGL context, and only be used from that thread. It is used by the EasyrtcSingleFrameCapturer.
@ryohey
ryohey / convert.js
Created May 23, 2017 04:13
Convert YUV420(I420) Progressive Planar to RGB in JavaScript
const WIDTH = 176
const HEIGHT = 144
const progRGB = yuv420ProgPlanarToRgb(base64ToArrayBuffer(yuv420ProgPlanarImage()), WIDTH, HEIGHT)
const canvas = document.createElement("canvas")
document.body.appendChild(canvas)
const ctx = canvas.getContext("2d")
const imageData = ctx.createImageData(WIDTH, HEIGHT)
putRGBToRGBA(imageData.data, progRGB, WIDTH, HEIGHT)
ctx.putImageData(imageData, 0, 0)