Skip to content

Instantly share code, notes, and snippets.

View samueleastdev's full-sized avatar

Samuel East samueleastdev

View GitHub Profile
@samueleastdev
samueleastdev / medialive.json
Created February 8, 2021 18:51
MediaLive Cloudformation Template
{
"Resources": {
"MediaLive": {
"Type": "AWS::MediaLive::Channel",
"Properties": {
"Name" : {
"Fn::Sub": "${AWS::StackName}-Channel"
},
"ChannelClass": "SINGLE_PIPELINE",
"RoleArn": "arn:aws:iam::422423811642:role/Media_Live_Role",
// Takes an ArrayBuffer; returns an array of these objects:
// {
// seconds: *number of seconds into the video of this image*,
// bytes: *the bytes of this image, as an ArrayBuffer*
// }
var parseBif = function(buffer) {
var data = new Uint8Array(buffer);
// Make sure this really is a BIF.
var magicNumber = [0x89, 0x42, 0x49, 0x46, 0x0d, 0x0a, 0x1a, 0x0a];
@samueleastdev
samueleastdev / code.php
Last active December 16, 2024 16:23
Easily Extend Woocommerce Account Page With Custom Menu And Template
<?php
function streamium_add_watchlist_endpoint() {
add_rewrite_endpoint( 'watchlist', EP_ROOT | EP_PAGES );
}
add_action( 'init', 'streamium_add_watchlist_endpoint' );
@samueleastdev
samueleastdev / create-vod-hls.sh
Created June 10, 2020 16:04 — forked from maitrungduc1410/create-vod-hls.sh
Bash scripts to create VOD HLS stream with ffmpeg (Extended version)
#!/usr/bin/env bash
set -e
# Usage create-vod-hls.sh SOURCE_FILE [OUTPUT_NAME]
[[ ! "${1}" ]] && echo "Usage: create-vod-hls.sh SOURCE_FILE [OUTPUT_NAME]" && exit 1
# ----CUSTOM----
sourceResolution="$(ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 ${1})"
# echo ${sourceResolution}
@samueleastdev
samueleastdev / index.sh
Last active June 10, 2020 19:05
Helpful FFmpeg & FFprobe commands
// Use ffprobe to get stream value
$(ffprobe -v error -select_streams v:0 -show_entries stream=r_frame_rate -of default=noprint_wrappers=1:nokey=1 becky.mp4)
Note: If the source video was in H.264 format you can also use the H.265 command to produce a final video in H.265/HEVC format. Since H.265 is 25–50% more efficient you should be able to reduce the Bitrate and still maintain the same video quality.
ffmpeg -hide_banner -re -i becky.mov -map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0 \
-c:v h264 -profile:v main -crf 20 -sc_threshold 0 -g 48 -keyint_min 48 -c:a aac -ar 48000 \
-filter:v:0 scale=w=640:h=-2 -maxrate:v:0 856k -bufsize:v:0 1200k -b:a:0 96k \
-filter:v:1 scale=w=842:h=-2 -maxrate:v:1 1498k -bufsize:v:1 2100k -b:a:1 128k \
-filter:v:2 scale=w=1280:h=-2 -maxrate:v:2 2996k -bufsize:v:2 4200k -b:a:2 128k \
@samueleastdev
samueleastdev / index.html
Created June 9, 2020 14:24
rfc5646 language codes
<option value="af">Afrikaans</option>
<option value="af-ZA">Afrikaans (South Africa)</option>
<option value="ar">Arabic</option>
<option value="ar-AE">Arabic (U.A.E.)</option>
<option value="ar-BH">Arabic (Bahrain)</option>
<option value="ar-DZ">Arabic (Algeria)</option>
<option value="ar-EG">Arabic (Egypt)</option>
<option value="ar-IQ">Arabic (Iraq)</option>
<option value="ar-JO">Arabic (Jordan)</option>
<option value="ar-KW">Arabic (Kuwait)</option>
@samueleastdev
samueleastdev / index.sh
Created March 28, 2020 20:09
Remove large files accidentally committed to git
git filter-branch --tree-filter 'rm -rf dist/*' HEAD
git push
@samueleastdev
samueleastdev / extractvideo.js
Created July 18, 2019 14:30 — forked from atwong/extractvideo.js
Extract Multiple Screenshots Video
/*
* Extract multiple screenshots/frames from a video URL
* Params
* - vidURL : video URL
* - frOffsets : array of timestamps
* - frameWidth : screenshot width (default: video width)
* Returns
* - frames: object with offset => {imgUrl, blob}
*
* An multiple-frame extension of http://cwestblog.com/2017/05/03/javascript-snippet-get-video-frame-as-an-image/
# remove specific file from git cache
git rm --cached filename
# remove all files from git cache
git rm -r --cached .
git add .
git commit -m ".gitignore is now working"
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<link rel="stylesheet" type="text/css" href="https://kenwheeler.github.io/slick/slick/slick.css"/>
<link rel="stylesheet" type="text/css" href="https://kenwheeler.github.io/slick/slick/slick-theme.css"/>
<style id="jsbin-css">
.movies {