Skip to content

Instantly share code, notes, and snippets.

View kevinGodell's full-sized avatar
🎯
Focusing

Kevin Godell kevinGodell

🎯
Focusing
View GitHub Profile
@kevinGodell
kevinGodell / manifest.mpd
Created October 4, 2017 22:29
sample mpeg dash manifest
<?xml version="1.0" encoding="utf-8"?>
<MPD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:mpeg:dash:schema:mpd:2011"
xmlns:xlink="http://www.w3.org/1999/xlink"
xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011 http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-DASH_schema_files/DASH-MPD.xsd"
profiles="urn:mpeg:dash:profile:isoff-live:2011"
type="dynamic"
minimumUpdatePeriod="PT3S"
suggestedPresentationDelay="PT3S"
availabilityStartTime="2017-10-04T03:31:48"
@kevinGodell
kevinGodell / mpeg-dash-ffmpeg-dashjs.md
Created September 20, 2017 22:53
Use ffmpeg to connect to an ip cctv camera and create video files on the fly that can be viewed in an mpeg-dash compatible browser using dash.js and an html5 video element.

Live streaming mpeg-dash video using ffmpeg and dash.js

Use ffmpeg to connect to an ip cctv camera and create video files on the fly that can be viewed in an mpeg-dash compatible browser using dash.js and an html5 video element.

Prerequisites

A linux server, such as Ubuntu

Apache web server installed, running, and reachable via its ip address
@kevinGodell
kevinGodell / generate_sample_videos.sh
Last active November 19, 2021 11:51
generate h.254 video with various combinations of profiles and levels and verify codec string with bento4's mp4info
#!/bin/bash
# profiles: main main10 mainstillpicture msp main-intra main10-intra main444-8 main444-intra main444-stillpicture main422-10 main422-10-intra main444-10 main444-10-intra main12 main12-intra main422-12 main422-12-intra main444-12 main444-12-intra main444-16-intra main444-16-stillpicture
# levels : 1, 2, 2.1, 3, 3.1, 4, 4.1, 5, 5.1, 5.2, 6, 6.1, 6.2, 8.5
# https://www.bento4.com/documentation/mp4info/
# https://stackoverflow.com/a/2033417/8965434
# create 100mb ram disk on mac
# hdiutil attach -nomount ram://$((2 * 1024 * 100))
@kevinGodell
kevinGodell / ffmpeg.sh
Created August 2, 2020 00:34
testing ffmpeg mp4 encryption
#!/bin/bash
# convert, encrypt, decrypt, probe
echo "Hello ffmpeg mp4 encryption!"
echo -e "\n---------- convert wav to mp4 ----------\n"
ffmpeg -y -i long_input_44100.wav long_input_44100.mp4
echo -e "\n---------- encrypt mp4 ----------\n"

Raspberry Pi 4 Model B Rev 1.1 (4GB)

ffmpeg hardware decoding experiment

modifications (needed for hardware decoding multiple video streams)

  • gpu_mem=512 was set in /boot/config.txt

dependencies

  • mp4frag (used for parsing the piped mp4 from ffmpeg)
  • pipe2jpeg (used for parsing the piped jpeg from ffmpeg)

description

var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@kevinGodell
kevinGodell / .travis.yml
Created February 13, 2018 19:23
Travis delpoyment install ffmpeg
language: node_js
node_js: node
os:
- linux
- osx
sudo: required
dist: trusty
before_install:
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo add-apt-repository -y ppa:mc3man/trusty-media; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get update; fi
@kevinGodell
kevinGodell / appveyor.yml
Created February 13, 2018 19:24
Appveyor deployment install ffmpeg
image: Visual Studio 2017
environment:
ffmpeg_download: https://ffmpeg.zeranoe.com/builds/
matrix:
- platform: x64
nodejs_version: LTS
ffmpeg_version: 3.4.1
ffmpeg_platform: win64
@kevinGodell
kevinGodell / memdjpeg.c
Created April 8, 2018 15:23 — forked from PhirePhly/memdjpeg.c
A bare-bones example of how to use jpeglib to decompress a jpg in memory.
// memdjpeg - A super simple example of how to decode a jpeg in memory
// Kenneth Finnegan, 2012
// blog.thelifeofkenneth.com
//
// After installing jpeglib, compile with:
// cc memdjpeg.c -ljpeg -o memdjpeg
//
// Run with:
// ./memdjpeg filename.jpg
//
@kevinGodell
kevinGodell / ffmpegToWeb.js
Created October 29, 2017 20:28 — forked from moeiscool/ffmpegToWeb.js
FFMPEG to Web Browser with Express, Socket.IO and JSMPEG
// Shinobi (http://shinobi.video) - FFMPEG H.264 over HTTP Test
// How to Use raw H.264 (Simulated RTSP)
// 1. Start with `node ffmpegToWeb.js`
// 2. Get the IP address of the computer where you did step 1. Example : 127.0.0.1
// 3. Open VLC and "Open Network Stream".
// 4. Input the following without quotes : `http://127.0.0.1:8001/h264` and start.
var child = require('child_process');
var io = require('socket.io');
var events = require('events');