Skip to content

Instantly share code, notes, and snippets.

View peerasan's full-sized avatar

Patrickz peerasan

View GitHub Profile
# FIX ERROR: unable to open for writing: [Errno 36] File name too long
youtube-dl -o "%(id)s.%(ext)s" {URL}
ffmpeg -f lavfi -re -i life=s=300x200:mold=10:r=25:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16 \
-f lavfi -re -i sine=frequency=1000:sample_rate=44100 \
-pix_fmt yuv420p -c:v libx264 -b:v 1000k -g 30 -keyint_min 120 \
-profile:v baseline -preset veryfast \
-c:a aac -b:a 96k \
-f flv "rtmp://localhost:1935/live/pat"
@peerasan
peerasan / gist:5333baeb5f331ff9b9f128204ddfdd1e
Created February 2, 2018 08:24
ffmpeg pull RTMP stream
ffmpeg -i rtmp://localhost:1935/pull-live/pat -f null /dev/null
@peerasan
peerasan / How to use
Last active February 13, 2018 10:23
Nagios Plugin for checking host bandwidth
check_bandwidth.sh - Nagios Plugin for checking host bandwidth
Usage: check_bandwidth.sh -w <warnlevel> -c <critlevel> <NIC>
= warnlevel and critlevel is bandwidth in KBps
EXAMPLE: /usr/lib64/nagios/plugins/check_bandwidth.sh -w 900 -c 950 eth1
= Send warning when more than 900 KBps, critical when more than 950 KBps
EXAMPLE: /usr/lib64/nagios/plugins/check_bandwidth.sh -w 50000 -c 80000 eth1
= Send warning when more than 500 Mbps, critical when more than 800 Mbps
-----------------------------------------------------
@peerasan
peerasan / gist:b2a2889671b3c318d607583e7242e113
Created June 8, 2019 14:17
FFmpeg send multiple live stream
ffmpeg -f lavfi -re -i 'life=s=300x200:mold=10:r=25:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16' \
-f lavfi -re -i sine=frequency=1000:sample_rate=44100 -pix_fmt yuv420p \
-c:v libx264 -b:v 1000k -g 30 -keyint_min 60 -profile:v baseline -preset veryfast -c:a aac -b:a 96k \
-f flv "rtmp://patrickz.iiwnz.com:1935/live/stream1" \
-f flv "rtmp://patrickz.iiwnz.com:1935/live/stream2" \
-f flv "rtmp://patrickz.iiwnz.com:1935/live/stream3" \
@peerasan
peerasan / gist:542c4882c2c67ee74b8bdb22a238b5ed
Created June 8, 2019 14:18
FFmpeg: test livestream to facebook
./ffmpeg -f lavfi -re -i "life=s=300x200:mold=10:r=25:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16" -f lavfi -re -i sine=frequency=1000:sample_rate=44100 -pix_fmt yuv420p -c:v libx264 -b:v 1000k -g 30 -keyint_min 120 -profile:v baseline -preset veryfast -c:a aac -b:a 96k -f flv "rtmps://live-api-s.facebook.com:443/rtmp/{YOUR STREAM KEY}"
@peerasan
peerasan / setup-docker.sh
Created June 8, 2019 14:21
Install Docker & Docker compose
#Prepare
apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
#Install Docker from Latest Stable Version
#Ubuntu
apt-get install build-essential git libfuse-dev libcurl4-openssl-dev libxml2-dev mime-support automake libtool libjsoncpp-dev pkg-config libssl-dev
#Alpine
apk --update add fuse alpine-sdk automake autoconf libxml2-dev fuse-dev curl-dev git openssl-dev
#Download source code, Compile and Install
wget https://github.com/s3fs-fuse/s3fs-fuse/archive/v1.83.tar.gz
tar xvzf v1.83.tar.gz
cd s3fs-fuse-1.83/
@peerasan
peerasan / compile-python.sh
Created June 8, 2019 14:25
Compile Python
apt-get install build-essential checkinstall
apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
tar xzf Python-3.7.0.tgz
cd Python-3.7.0
./configure --enable-optimizations
make install # replace default python
make altinstall #used to prevent replacing the default python binary file /usr/bin/python.
@peerasan
peerasan / setup-cosfs.sh
Created June 8, 2019 14:28
Install Tencent cloud (COSFS)
#Prepare
apt-get install automake autotools-dev g++ git libcurl4-gnutls-dev libfuse-dev libssl-dev libxml2-dev make pkg-config fuse
#download source-code, compile and install
git clone https://github.com/tencentyun/cosfs.git /usr/cosfs
cd /usr/cosfs
./autogen.sh
./configure
make
make install