Skip to content

Instantly share code, notes, and snippets.

View dudewheresmycode's full-sized avatar

Brian R dudewheresmycode

View GitHub Profile
@dudewheresmycode
dudewheresmycode / ubuntu-node-install.sh
Last active March 5, 2016 06:20
Install Node.js on Ubuntu 14.04 (DigitalOcean)
sudo apt-get update
sudo apt-get install git -y
cd ~
wget https://nodejs.org/dist/v4.3.2/node-v4.3.2-linux-x64.tar.xz
mkdir node
tar xvf node-v4.3.2-linux-x64.tar.xz --strip-components=1 -C ./node
cd ~
rm -rf node-v*
mkdir node/etc
echo 'prefix=/usr/local' > node/etc/npmrc
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
</head>
<body>
#regex pattern
/(frame)=\s*(\d+)|(fps)=\s*(\d+)|(fps)=\s*(\d+)|(time)\s*=(\d+:\d+:\d+\.\d+)|(size)=\s*(\d+)([a-z]+)|(bitrate)=\s*([\d\.]+)([a-z\/]+)|(speed)=\s*([\dx]+)/mgi
#javascript
var regexp = /(frame)=\s*(\d+)|(fps)=\s*(\d+)|(fps)=\s*(\d+)|(time)\s*=(\d+:\d+:\d+\.\d+)|(size)=\s*(\d+)([a-z]+)|(bitrate)=\s*([\d\.]+)([a-z\/]+)|(speed)=\s*([\dx]+)/mgi;

Install x264

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

Crazy regex for matching acceptable video inputs for AWS Elemental MediaConvert:

I got the error trying to convert a gif image.

BadRequestException: /inputs/0/fileInput: Should match the pattern:
/^(s3://)([^/]+/)+([^/\.]+|(([^/]*)\.([mM]2[vV]|[mM][pP][eE][gG]|[aA][vV][iI]|[mM][pP]4|[fF][lL][vV]|[mM][pP][tT]|[mM][pP][gG]|[mM]4[vV]|[tT][rR][pP]|[fF]4[vV]|[mM]2[tT][sS]|[tT][sS]|264|[hH]264|[mM][kK][vV]|[mM][oO][vV]|[mM][tT][sS]|[mM]2[tT]|[wW][mM][vV]|[aA][sS][fF]|[vV][oO][bB]|3[gG][pP]|3[gG][pP][pP]|[mM][xX][fF]|[dD][iI][vV][xX]|[xX][vV][iI][dD]|[rR][aA][wW]|[dD][vV]|[gG][xX][fF]|[mM]1[vV]|3[gG]2|[vV][mM][fF]|[mM]3[uU]8|[lL][cC][hH]|[gG][xX][fF]_[mM][pP][eE][gG]2|[mM][xX][fF]_[mM][pP][eE][gG]2|[mM][xX][fF][hH][dD]|[wW][aA][vV]|[yY]4[mM])))$/
1080p Long Videos
x264
Format: mkv
RF: 29
Preset: slower
Tune: film
Profile: high
Level: 4.0
Audio Codec: aac
@dudewheresmycode
dudewheresmycode / fullscreen-hbo.js
Last active November 21, 2018 00:04
This js code should expand the player to the width/height of the browser window.
window._fs__hbo_timeout;
window._fs__hbo = function(){
document.querySelector("#ifp").parentNode.setAttribute("style", "position:fixed;top:0px;left:0px;width:100vw;height:100vh;background-color:#000;z-index:2147483648;");
document.querySelector("#ifp").parentNode.setAttribute("id", "flvideo");
document.querySelector("#ifp").parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.style.top = "0px";
document.querySelectorAll(".default").forEach(function(e){
var style = window.getComputedStyle(e);
if(e.getAttribute("id") != "flvideo" && style.position == "fixed"){ e.style.opacity = 0; e.style.zIndex = 1; }
});
}
@dudewheresmycode
dudewheresmycode / FFMPEG Scene Detection.md
Last active March 4, 2024 10:06
Notes on scene detection with FFMPEG

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) https://ffmpeg.org/ffmpeg-filters.html#select_002c-aselect

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].