add ffmpeg script to mirror a live (to peertube)

This commit is contained in:
sakrecoer 2024-11-20 17:01:07 +01:00
parent ba0697438b
commit 427bc22d07

19
rip-stream2platform.sh Executable file
View file

@ -0,0 +1,19 @@
#! /bin/bash
## This script assumes ffmpeg is installed.
## You can find the m3u8 url with `yt-dlp --print-json | grep m3u8`
read -p 'Type desired preset (recommended 'faster'): ' PRESET
read -p 'Enter source URL for m3u8: ' SOURCE
read -p 'Enter the desitnation URL: ' DESTINATION
read -sp 'Enter the streaming key: ' KEY
# PRESET="faster" # ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo
# SOURCE="" # use yt-dlp to find the m3u8 stream
# DESTINATION=""
# KEY="" # Your peertubetube key.
ffmpeg \
-re -i "$SOURCE" -vcodec libx264 -preset $PRESET -maxrate 3000k -b:v 2500k \
-bufsize 600k -pix_fmt yuv420p -g 60 -c:a aac -b:a 160k -ac 2 \
-ar 48000 -f flv -s 1280x720 "$DESTINATION/$KEY"