Skip to content

Instantly share code, notes, and snippets.

@mokoshalb
Last active May 23, 2021 14:27
Show Gist options
  • Save mokoshalb/fd8a6f74b1b5b4d99d83c327064edd08 to your computer and use it in GitHub Desktop.
Save mokoshalb/fd8a6f74b1b5b4d99d83c327064edd08 to your computer and use it in GitHub Desktop.
Perfect FFMPEG Command For Stable Live Streaming
ffmpeg -re -i "http://example.com/live/username/password/1234.m3u8" -bsf:a aac_adtstoasc -r 30 -b:v 2048k -bufsize 2048k -maxrate 4296k -vf scale="1280:720" -vcodec libx264 -preset ultrafast -c:a copy -f flv "rtmp://freertmpserver.com/servername/keyname"
@mokoshalb
Copy link
Author

#!/bin/bash
RTMP="rtmp://freertmpserver.com/servername/keyname"
SOURCE="http://example.com/live/username/password/1234.m3u8"
until C:/ffmpeg/bin/ffmpeg.exe
-ss 76 -t 10 -re -i "$SOURCE"
-c:v libx264 -b:v 4000k -maxrate 4000k -bufsize 6000k -pix_fmt yuv420p -g 60 -c:a aac
-f flv "$RTMP"; do
echo "Error! Restarting!"
sleep 2
done

@mokoshalb
Copy link
Author

#!/bin/bash
RTMP="rtmp://freertmpserver.com/servername/keyname"
SOURCE="http://example.com/live/username/password/1234.m3u8"
until C:/ffmpeg/bin/ffmpeg.exe
-ss 0 -t 0 -re -i "$SOURCE"
-bsf:a aac_adtstoasc -c copy
-f flv "$RTMP"; do
echo "Error! Restarting!"
sleep 2
done

@mokoshalb
Copy link
Author

#!/bin/bash
RTMP="rtmp://freertmpserver.com/servername/keyname"
SOURCE="http://example.com/live/username/password/1234.m3u8"
until C:/ffmpeg/bin/ffmpeg.exe
-ss 0 -t 0 -re -i "$SOURCE"
-vcodec libx264 -b:v 2000k -acodec aac -b:a 128k -preset ultrafast -vf scale="hd720"
-f flv "$RTMP"; do
echo "Error! Restarting!"
sleep 2
done

@mokoshalb
Copy link
Author

ffmpeg -i file.wmv -vcodec h264 -b:v 1000k -acodec mp3 file.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment