Skip to content

Instantly share code, notes, and snippets.

View Bioblaze's full-sized avatar

Bioblaze Payne Bioblaze

View GitHub Profile
@Bioblaze
Bioblaze / make247.sh
Created June 26, 2020 05:23 — 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
@Bioblaze
Bioblaze / stream.sh
Created June 26, 2020 05:23 — forked from Enweave/stream.sh
ffmpeg stream rtsp to youtube via rtmp
# your youtube name/key
KEY="1234-5678-9101-1121"
# your rtsp url
RTSP="rtsp://user:[email protected]:1234/cam/etc"
# youtube rtmp url
YTUBE="rtmp://a.rtmp.youtube.com/live2"
ffmpeg \
@Bioblaze
Bioblaze / stitch.sh
Created June 26, 2020 05:23 — forked from carylee/stitch.sh
Generate a virtual quartet video
#!/bin/bash
ffmpeg -y \
-ss 5 -i "elisabeth.mp4" \
-ss 0 -i "ryan.MOV" \
-ss 7.5 -i "cary.mp4" \
-ss 2.9 -i "jackie.MOV" \
-ss 9 -i "tess.MOV" \
-ss 9 -i "Water River Spirit Grace.m4a" \
-filter_complex " \
[0:v] setpts=PTS-STARTPTS, crop=608:720:in_w/2-out_w/2+100:100, scale=912:1080 [v0]; \
@Bioblaze
Bioblaze / mp4-cover-image-create.sh
Created June 26, 2020 05:23 — forked from codecreate-dev/mp4-cover-image-create.sh
Create image covers from mp4 vids in a for loop
for vid in *.mp4; do ffmpeg -i $vid -codec mjpeg -ss 4 -vframes 1 -q:v 1 ./covers/$vid.jpg; done
@Bioblaze
Bioblaze / radiko.sh
Created June 26, 2020 05:24 — forked from soramugi/radiko.sh
radikoをlinuxで聞いたり録音したりするやつ
#!/bin/bash
# https://mtunn.wordpress.com/odroid-u2★セットアップ/radikoの録音・再生(archlinux)/
pid=$$
wkdir='/var/tmp'
playerurl=http://radiko.jp/player/swf/player_3.0.0.01.swf
playerfile="${wkdir}/player.swf"
keyfile="${wkdir}/authkey.png"
auth1_fms="${wkdir}/auth1_fms_${pid}"
auth2_fms="${wkdir}/auth2_fms_${pid}"
@Bioblaze
Bioblaze / youtube-gif.sh
Created June 26, 2020 05:24 — forked from hubgit/youtube-gif.sh
Convert a section of a YouTube video to an animated GIF
#!/bin/bash
# brew install x265
# brew install ffmpeg
# brew install youtube-dl
# brew install imagemagick
ID='U65_uY5N2WM' # YouTube video ID, i.e. https://www.youtube.com/watch?v={ID}
# fetch the video file with youtube-dl
@Bioblaze
Bioblaze / ffmpeg_frames.sh
Created June 26, 2020 05:24 — forked from loretoparisi/ffmpeg_frames.sh
Extract all frames from a movie using ffmpeg
# Output a single frame from the video into an image file:
ffmpeg -i input.mov -ss 00:00:14.435 -vframes 1 out.png
# Output one image every second, named out1.png, out2.png, out3.png, etc.
# The %01d dictates that the ordinal number of each output image will be formatted using 1 digits.
ffmpeg -i input.mov -vf fps=1 out%d.png
# Output one image every minute, named out001.jpg, out002.jpg, out003.jpg, etc.
# The %02d dictates that the ordinal number of each output image will be formatted using 2 digits.
ffmpeg -i input.mov -vf fps=1/60 out%02d.jpg
@Bioblaze
Bioblaze / shell.sh
Created June 26, 2020 05:24 — forked from valentineus/shell.sh
Convert video file to audio file
ffmpeg -i filename.ogg -vn -c:a libopus -ar 16k -ac 1 -b:a 16k -vbr on -compression_level 10 new_filename.ogg
@Bioblaze
Bioblaze / ffmpeg.sh
Created June 26, 2020 05:24 — forked from TonyChangho/ffmpeg.sh
ffmpeg cheat sheet
# Encode a video in H.264 with a constant rate factor of 0 (visually non-lossy), run it through a filter for deinterlacing (Weston
# Three-Field), and do not re-encode the audio
ffmpeg -i input.mkv -c:v libx264 -crf 0 -filter:v w3fdif -c:a copy output_edit-x264-crf0-w3fdif.mkv
# H.264 video at an average bitrate of 25MB/s, and just copy the audio
# - `-an` disables audio on first pass
# - `-y` automatically overwrites an existing output file, but don't worry since it's /dev/null on the first pass
ffmpeg -y -i input.mkv -c:v libx264 -b:v 25000k -pass 1 -an -f mp4 /dev/null && \
ffmpeg -i input.mkv -c:v libx264 -b:v 25000k -pass 2 -c:a copy output_edit-x264-abr25000.mkv

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