Skip to content

Instantly share code, notes, and snippets.

View luqmansen's full-sized avatar
🎯
Focusing

Luqman luqmansen

🎯
Focusing
View GitHub Profile
@andriika
andriika / mpeg-dash live stream.md
Last active February 27, 2024 09:41
live video streaming, html5, mpeg-dash, ffmpeg

Live streaming with HTML5

This document contains collected notes regarding html5 live streaming approaches. I'm trying to understand how to build a system that enables streaming of live video to HTML5 clients. Following content is mainly centered around MPEG-DASH - modern way of dealing with given needs.

Approach 1

To prepare movie.avi from MPEG-DASH streaming we will execute following ffmpeg commands:

> ffmpeg -y -i movie.avi -an -c:v libx264 -x264opts 'keyint=24:min-keyint=24:no-scenecut' -b:v 1500k -maxrate 1500k -bufsize 3000k -vf "scale=-1:720" movie-720.mp4
> ffmpeg -y -i movie.avi -an -c:v libx264 -x264opts 'keyint=24:min-keyint=24:no-scenecut' -b:v 800k -maxrate 800k -bufsize 1600k -vf "scale=-1:540" movie-540.mp4
> ffmpeg -y -i movie.avi -an -c:v libx264 -x264opts 'keyint=24:min-keyint=24:no-scenecut' -b:v 400k -maxrate 400k -bufsize 800k -vf "scale=-1:360" movie-360.mp4
@posener
posener / go-table-driven-tests-parallel.md
Last active April 30, 2024 20:34
Be Careful with Table Driven Tests and t.Parallel()

Be Careful with Table Driven Tests and t.Parallel()

We Gophers, love table-driven-tests, it makes our unittesting structured, and makes it easy to add different test cases with ease.

Let’s create our table driven test, for convenience, I chose to use t.Log as the test function. Notice that we don't have any assertion in this test, it is not needed to for the demonstration.

func TestTLog(t *testing.T) {
	t.Parallel()
@mchirico
mchirico / bashFor.go
Last active October 29, 2023 04:14
Go (golang) program to execute a bash for loop.
package main
import (
"bytes"
"fmt"
"log"
"os/exec"
"strings"
)