Files
bin/meltTwitch
2026-06-11 15:14:00 +02:00

25 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
STREAM_KEY=live_115784325_I9Oaw3Sc41VfIXCnWEvyU3GX2wQ6fk
melt "$@" -realtime 1 -profile square_ntsc_wide -filter crop center=1 -consumer avformat:rtmp://live-prg.twitch.tv/app/$STREAM_KEY properties=x264-medium-main f=flv r=24 g=48 bf=0 refs=1 frequency=44100 real_time=1 acodec=aac strict=-2 ivb=1500k ab=128k
streaming() {
INRES="1600x900" # input resolution
OUTRES="1280x720" # output resolution
FPS="15" # target FPS
GOP="30" # i-frame interval, should be double of FPS,
GOPMIN="15" # min i-frame interval, should be equal to fps,
THREADS="4" # max 6
CBR="1000k" # constant bitrate (should be between 1000k - 3000k)
QUALITY="ultrafast" # one of the many FFMPEG preset
AUDIO_RATE="44100"
STREAM_KEY="$1" # use the terminal command Streaming streamkeyhere to stream your video to twitch or justin
SERVER="live-fra" # twitch server in frankfurt, see http://bashtech.net/twitch/ingest.php for list
ffmpeg -f x11grab -s "$INRES" -r "$FPS" -i :0.0 -f alsa -i pulse -f flv -ac 2 -ar $AUDIO_RATE \
-vcodec libx264 -g $GOP -keyint_min $GOPMIN -b:v $CBR -minrate $CBR -maxrate $CBR -pix_fmt yuv420p\
-s $OUTRES -preset $QUALITY -tune film -acodec libmp3lame -threads $THREADS -strict normal \
-bufsize $CBR "rtmp://$SERVER.twitch.tv/app/$STREAM_KEY"
}
#streaming