Skip to content

Instantly share code, notes, and snippets.

View bugre's full-sized avatar

Werner [wm] bugre

  • South Brazil
View GitHub Profile
@bugre
bugre / haproxy-cors.md
Last active May 23, 2023 18:13 — forked from nasrulhazim/haproxy-cors.md
Setting Up CORS in HAProxy

The "Credentials" is important if you're using Authentication..

frontend localnodes
    bind *:80
    reqadd X-Forwarded-Proto:\ http

    # Add CORS headers when Origin header is present
    capture request header origin len 128
    http-response add-header Access-Control-Allow-Origin %[capture.req.hdr(0)] if { capture.req.hdr(0) -m found }
@bugre
bugre / app.js
Created April 27, 2022 12:15 — forked from satori99/app.js
This is a proof-of-concept for using ffmpeg as a HTTP video stream proxy that can reduce the volume of ad-breaks
/**
* This is a proof-of-concept for using ffmpeg as a HTTP video stream proxy
* that can reduce ad volume.
*
* It only works on streams containing SCTE35 data packets.
* You can check a stream using:
*
* ffmpeg -hide_banner -i <SOURCE_URL> 2>&1 | grep scte_35
*
* Start the demo:
@bugre
bugre / python-ffmpeg.py
Created March 15, 2022 10:59 — forked from hiwonjoon/python-ffmpeg.py
ffmpeg and ffprobe subprocess call in python; extract specific frame at some timepoint, extract duration of a video
import subprocess
import datetime
import numpy as np
THREAD_NUM=4
def get_video_info(fileloc) :
command = ['ffprobe',
'-v', 'fatal',
'-show_entries', 'stream=width,height,r_frame_rate,duration',
@bugre
bugre / README.md
Created March 2, 2022 02:11 — forked from mikoim/README.md
[Updated! Aug 14 2020] YouTube recommended encoding settings on ffmpeg (+ libx264)

Parameters

Container: MP4

Parameter YouTube recommends setting
-movflags faststart moov atom at the front of the file (Fast Start)

Video codec: H.264

@bugre
bugre / project.json
Created January 5, 2021 09:41 — forked from TsuyoshiUshio/project.json
Storage migration from Google Cloud Storage to Azure with Async/Await
{
"frameworks": {
"net46":{
"dependencies": {
"Google.Cloud.Storage.V1": "1.0.0-beta05"
}
}
}
}
@bugre
bugre / CSCubeBGRA.cc
Created September 22, 2020 13:54 — forked from victusfate/CSCubeBGRA.cc
decode a video with libav/ffmpeg
#include "CSCubeBGRA.h""
#include <sstream>
#include <cmath>
int getNearestIndexForTime(const vector<double> &times, double rTime)
{
// binary search
// returns an iterator pointing to the first element in the range [first,last) which does not compare less than val.
auto pFrameIndex = lower_bound(times.begin(),times.end(),rTime);
@bugre
bugre / Time-based-auto-scaling-on-fargate.md
Created February 2, 2020 21:16 — forked from toricls/Time-based-auto-scaling-on-fargate.md
Example: Time-based Auto Scaling on Amazon ECS + AWS Fargate

Set parameters

$ export ECS_CLUSTER_NAME={YOUR_ECS_CLUSTER_NAME}
$ export ECS_SERVICE_NAME={YOUR_ECS_SERVICE_NAME}

RegisterScalableTarget

@bugre
bugre / format.json
Created October 14, 2019 21:40 — forked from apeckham/format.json
fastly json log format
{
"service_id":"%{req.service_id}V",
"service_version":"%{fastly_info.version}V",
"time_start":%{begin:msec}t,
"time_end":%{end:msec}t,
"time_elapsed":%{time.elapsed.usec}V,
"client_ip":"%{req.http.Fastly-Client-IP}V",
"request":"%{req.request}V",
"protocol":"%{req.proto}V",
"host":"%{req.http.Fastly-Orig-Host}V",
@bugre
bugre / build-tmux.sh
Created July 21, 2019 17:44 — forked from cisano-arelia/build-tmux.sh
Script to build a static tmux for CoreOS
#!/usr/bin/env bash
#Author: https://groups.google.com/forum/#!topic/coreos-dev/JAeABXnQzuE
pushd $(dirname $0) > /dev/null; CURRABSPATH=$(readlink -nf "$(pwd)"); popd > /dev/null; # Get the directory in which the script resides
set -x
MUSLPKG="musl:musl.tgz:http://www.musl-libc.org/releases/musl-1.1.14.tar.gz"
LEVTPKG="libevent:libevent2.tgz:https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz"
TMUXPKG="tmux:tmux.tgz:https://github.com/tmux/tmux/releases/download/2.1/tmux-2.1.tar.gz"
NCRSPKG="ncurses:ncurses.tgz:http://ftp.gnu.org/gnu/ncurses/ncurses-6.0.tar.gz"
TEMPDIR="$CURRABSPATH/tmp"
TMPLIB="tempinstall/lib"

Live Transcoding

This is a collection of working commandline examples to show how one could use FFMpeg and VLC for live transcoding of video streams. All examples have been tested on OSX 10.7.5 with FFMPeg 1.1.3 and VLC 2.0.5 in early 2013.

Documentation links