Skip to content

Instantly share code, notes, and snippets.

View roommini's full-sized avatar
🎯
Focusing

Chanchai Srithep roommini

🎯
Focusing
View GitHub Profile
@roommini
roommini / gist:ccb7f844a7bfb0306eec98e44ef91e1e
Created August 22, 2020 10:34 — forked from mharsch/gist:5188206
serve HLS (HTTP Live Streaming) content from node.js

HLS streaming from node

Provided that you already have a file or stream segmenter generating your .m3u8 playlist and .ts segment files (such as the ffmpeg 'hls' muxer), this little node server will serve up those files to an HLS compatible client (e.g. Safari). If you're using node for your streaming app already, this obviates the need to serve the HLS stream from a separate web server.

loosely based on https://gist.github.com/bnerd/2011232

// loosely based on https://gist.github.com/bnerd/2011232
// requires node.js >= v0.10.0
// assumes that HLS segmenter filename base is 'out'
// and that the HLS playlist and .ts files are in the current directory
@roommini
roommini / make247.sh
Created August 9, 2020 20:41 — forked from Domin8-IPTV/make247.sh
ffmpeg concatenate all media files in the current directory with .mp4 extension
#!/bin/sh
# use ffmpeg to concatenate all the mp4 files in the media directory
# make file executable and run like this
# ./make247.sh /path/to/media/folder
#
IN_DIR="$1";
if [ "$IN_DIR" = '' ] ; then
IN_DIR="."
fi
for f in ${IN_DIR}/*.mp4; do echo "file '$f'" >> concat-list.txt; done
@roommini
roommini / vod2hls.sh
Created August 9, 2020 20:41 — forked from Domin8-IPTV/vod2hls.sh
create hls live stream from files
#!/bin/bash
# Change this to path of file to stream /edit/to/vod/path.mp4
mediaFile="/edit/to/vod/path.mp4"
### 480x video400kbps audio40kbps ###
mediaStreams="-map 0"
audCodec="-acodec mp2"
audKbps="-b:a 40k"
@roommini
roommini / ffmpeg2mp4.php
Created August 9, 2020 20:38 — forked from Domin8-IPTV/ffmpeg2mp4.php
use ffmpeg to convert all media files in directory to mp4
<?php
/**
* cd into folder with video files and run:
* php /path/to/ffmpeg2mp4.php mp4
*/
class Transcoder{
protected static $ffmpeg='ffmpeg';
@roommini
roommini / gen.php
Created August 1, 2020 09:54 — forked from nemoTyrant/gen.php
nginx secure link
<?php
$ts = '1463646983';
$hash = str_replace('=', '',strtr(base64_encode(md5('1463646983 secret', TRUE)), '+/', '-_')); // base64url
echo $hash;
?>
@roommini
roommini / secure_link.php
Created August 1, 2020 09:51 — forked from bftanase/secure_link.php
generate URL for nginx secure_link

Compile NGINX with RTMP and setup Multi-Streaming

These Scripts will install NGINX with the RTMP Module in the usual directories similar to installation with apt-get.

The RTMP-Server you get with this can then be used to do one ore more of the following:

  • deliver streams in a local network
  • deliver streams to websites similar to youtube
  • transcode rtmp streams to hls video
  • publish to multiple streaming providers
  • record livestreams to a harddrive
@roommini
roommini / README.md
Created July 17, 2020 12:38 — forked from mrbar42/README.md
Secured HLS setup with Nginx as media server

Secured HLS setup with Nginx as media server

This example is part of this article.

This is an example for an HLS delivery with basic security. Nginx compiled with nginx-rtmp-module & secure-link is used as media server. Features:

  • Domain filtering
  • Referrer filtering
  • Embed buster
@roommini
roommini / install_nginx.sh
Created July 16, 2020 23:43 — forked from thurloat/install_nginx.sh
install nginx
#!/bin/sh
set -x
nginx_version=1.0.10
sudo apt-get install gcc
sudo apt-get install libpcre3-dev
sudo apt-get install libssl-dev
mkdir install_nginx && cd install_nginx
@roommini
roommini / ffmpeg.sh
Created July 16, 2020 12:08
CentOS FFMpeg Installation from Source
#!/bin/sh
rpm -Uhv http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
yum -y update
yum -y install autoconf automake gcc gcc-c++ git libtool make nasm pkgconfig zlib-devel freetype-devel speex-devel
#YASM
mkdir ~/ffmpeg_sources
cd ~/ffmpeg_sources
curl -O http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz