Skip to content

Instantly share code, notes, and snippets.

View lyarinet's full-sized avatar

Asif Agaria lyarinet

View GitHub Profile

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

@lyarinet
lyarinet / ubuntu_18_mail_server.md
Created June 27, 2020 08:01 — forked from emotality/ubuntu_18_mail_server.md
Ubuntu 18.04 Postfix with Dovecot mail server
@lyarinet
lyarinet / Firebase_push.php
Created March 1, 2021 19:42 — forked from nitinegoro/Firebase_push.php
Codeigniter Firebase Push Notification
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Single Sender FIrebase Push To Android
*
* @package Codeigniter
* @author Vicky Saputra <http://vicky.work
**/
class Firebase_push
{
@lyarinet
lyarinet / fcm.php
Created March 1, 2021 19:54 — forked from sab99r/fcm.php
PHP Function to Send FCM Message to Android
<?php
/*
Parameter Example
$data = array('post_id'=>'12345','post_title'=>'A Blog post');
$target = 'single tocken id or topic name';
or
$target = array('token1','token2','...'); // up to 1000 in one request
*/
public function sendMessage($data,$target){
//FCM api URL
@lyarinet
lyarinet / README.md
Created August 29, 2021 08:43 — 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

@lyarinet
lyarinet / create-vod-hls.sh
Created September 28, 2021 18:59 — forked from maitrungduc1410/create-vod-hls.sh
Bash scripts to create VOD HLS stream with ffmpeg (Extended version)
#!/usr/bin/env bash
START_TIME=$SECONDS
set -e
echo "-----START GENERATING HLS STREAM-----"
# Usage create-vod-hls.sh SOURCE_FILE [OUTPUT_NAME]
[[ ! "${1}" ]] && echo "Usage: create-vod-hls.sh SOURCE_FILE [OUTPUT_NAME]" && exit 1
# comment/add lines here to control which renditions would be created
renditions=(
@lyarinet
lyarinet / iptv-to-hls.sh
Created October 9, 2021 17:15 — forked from drzax/iptv-to-hls.sh
IPTV to HTTP live streaming
#!/bin/bash
while true; do
currTime=`date +%Y%m%d%H%M`
if [ "$currTime" -ge 201507081658 -a "$currTime" -le 201507082300 ]; then
echo "$currTime: Stream should be on. Start ffmpeg if the process does not exist"
if [ "$(pidof ffmpeg)" ]; then
echo "$currTime: ffmpeg already running."
sleep 10
else
@lyarinet
lyarinet / ffmpeg_hls.md
Created November 27, 2021 05:20 — forked from stecman/ffmpeg_hls.md
ffmpeg streaming examples

FFmpeg streaming

These are some ffmpeg command lines used when developing VHS dubbing controller.

HLS Stream (on Linux)

#!/bin/bash

# Stream a PAL 50i capture, cropped and de-interlaced using ffmpeg
@lyarinet
lyarinet / transcode-plex.sh
Created November 27, 2021 06:02 — forked from karllmitchell/transcode-plex.sh
Scripts for transcoding Channels DVR recordings and adding them to Plex
#!/bin/bash
# (C) Karl Mitchell 2017, GPL: https://www.gnu.org/licenses/gpl-3.0.en.html
# Best run once daily, e.g. using launchd or cron job, during quiet time
# Converts Channels DVR to a Plex & iOS-friendly m4v (h.264) format
# Pre-requisites:
# HandBrakeCLI (video transcoding application)
# Optional pre-requisites:
# MP4Box (part of GPAC, use MacPorts or similar) for marking commercials start/end as chapters
# Curl and an IFTTT Maker Key for phone statusnotifications.
# FFMPeg (a part of channels DVR, but you'll need to point to it) for commercial trimming
@lyarinet
lyarinet / ffmpeg-progress
Created November 27, 2021 08:44 — forked from csparker247/ffmpeg-progress
Outputs ffmpeg progress to console as percentage of work completed.
# Get video duration in frames
duration=$(ffmpeg -i [filename] 2>&1 | sed -n "s/.* Duration: \([^,]*\), start: .*/\1/p")
fps=$(ffmpeg -i [filename] 2>&1 | sed -n "s/.*, \(.*\) tbr.*/\1/p")
hours=$(echo $duration | cut -d":" -f1)
minutes=$(echo $duration | cut -d":" -f2)
seconds=$(echo $duration | cut -d":" -f3)
FRAMES=$(echo "($hours*3600+$minutes*60+$seconds)*$fps" | bc | cut -d"." -f1)
# Start ffmpeg, use awk to flush the buffer and remove carriage returns
ffmpeg -i [filename] [options] [outputfile] 2>&1 | awk '1;{fflush()}' RS='\r\n'>[errorlog] &