Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
TIMECUT_ARGUMENTS="--viewport=1920,1080 --fps=60 --pipe-mode"
LAUNCH_ARGUMENTS="--no-sandbox --disable-setuid-sandbox --allow-file-access-from-files"
WORKERS=3
START_TIME=0
FILE_TYPE=mp4
set -e
@carylee
carylee / crop.py
Created November 8, 2020 18:47
Face-aware video cropping
#!/usr/bin/env python3
import click
import ffmpeg
from matplotlib import pyplot as plt
import matplotlib
import face_recognition
from PIL import Image
import numpy as np
def face_location(filename):
@wesbos
wesbos / node-google-speech-to-text.js
Created September 30, 2020 14:47
Syntax Speech to Text
import speech from '@google-cloud/speech';
import fs from 'fs';
import dotenv from 'dotenv';
dotenv.config();
async function main() {
const client = new speech.SpeechClient();
const config = {
@maitrungduc1410
maitrungduc1410 / create-vod-hls.sh
Last active April 12, 2025 01:00
Bash scripts to create VOD HLS stream with ffmpeg (Extended version)
#!/usr/bin/env bash
START_TIME=$SECONDS
set -e
echo "-----START GENERATING HLS STREAM-----"
# Usage create-vod-hls.sh SOURCE_FILE [OUTPUT_NAME]
[[ ! "${1}" ]] && echo "Usage: create-vod-hls.sh SOURCE_FILE [OUTPUT_NAME]" && exit 1
# comment/add lines here to control which renditions would be created
renditions=(
@jessuni
jessuni / GenerateAudioWaveform
Last active July 3, 2023 05:58
Audio Oscilloscope (Frequency Byte) - w/ web audio API and canvas
// rename gist
@jordicenzano
jordicenzano / start-simple-streaming-server.sh
Last active September 8, 2021 23:34
Live streaming server RTMP in HLS out (1 rendition + overlay)
#!/usr/bin/env bash
# We assume ffmpeg installed (recommened v 4+)
# Acts as RMTP server for application named live (expects stream)
# transcodes the media data into h264-aac, craetes HLS 4s chunks,
# and sends the data to ~/origin
# Create 1 rendition1
# 854x480@30fps 1000Kbps (+ Overlay)
@daliborgogic
daliborgogic / Dockerfile
Last active December 17, 2018 16:19
Navigation Timing, Headless Chrome, Docker
FROM node:8.7.0-slim
RUN apt-get update && \
apt-get install -yq gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \
libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \
libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \
libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \
ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
RUN npm i puppeteer micro qs
@ktmud
ktmud / parse_email.py
Created August 17, 2017 19:34
Python 3.6 Parse Email Message
import re
import email.charset
from pathlib import Path
from glob import glob
from email import message_from_binary_file, policy
RE_QUOPRI_BS = re.compile(r'\b=20=\n')
RE_QUOPRI_LE = re.compile(r'\b=\n')
RE_LONG_WORDS = re.compile(r'\b[\w\/\+\=\n]{72,}\b')

Direct copy of pre-encoded file:

$ ffmpeg -i filename.mp4 -codec: copy -start_number 0 -hls_time 10 -hls_list_size 0 -f hls filename.m3u8

@noeljackson
noeljackson / docker-compose-swarm.sh
Last active September 27, 2020 17:56
Run docker-compose with docker-machine and docker-swarm on digital ocean
#from https://www.linux.com/learn/how-use-docker-machine-create-swarm-cluster
#export digital ocean token
export DO_TOKEN="abcdefghijklmnopqrstuvwxyz"
#make keystore
docker-machine create -d digitalocean \
-digitalocean-access-token ${DO_TOKEN} \
--digitalocean-region "nyc1" \
--digitalocean-image="ubuntu-14-04-x64" \
--digitalocean-size "512mb" \