Created
April 29, 2025 14:56
-
-
Save syrm/174a8a7d4f62fa7afcad9dd316f5c510 to your computer and use it in GitHub Desktop.
stream-ffmpeg.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Résolution et FPS | |
| RESOLUTION="2560x1440" | |
| FPS="30" | |
| # Entrée vidéo (par exemple, votre webcam) | |
| WEBCAM_SOURCE="/dev/video0" | |
| WEBCAM_VIDEO_WIDTH=1920 | |
| WEBCAM_VIDEO_HEIGHT=1080 | |
| WEBCAM_WIDTH="548" | |
| WEBCAM_HEIGHT="308" | |
| WEBCAM_X="2012" # Position X de la webcam | |
| WEBCAM_Y="1132" # Position Y de la webcam | |
| # Entrée audio (par exemple, votre microphone) | |
| AUDIO_SOURCE="hw:0" | |
| # Clé de stream Twitch | |
| source .env.sh | |
| # | |
| # -f v4l2 -framerate $FPS -video_size $RESOLUTION -i $VIDEO_SOURCE \ | |
| # | |
| # | |
| # | |
| # -f pulse -i music \ | |
| # Commande FFmpeg | |
| ffmpeg \ | |
| -f v4l2 -i $WEBCAM_SOURCE -video_size ${WEBCAM_VIDEO_WIDTH}x${WEBCAM_VIDEO_HEIGHT} \ | |
| -f x11grab -s $RESOLUTION -i :0+2560,600 \ | |
| -f alsa -i $AUDIO_SOURCE \ | |
| -f pulse -i stream.monitor \ | |
| -filter_complex "[0:v]scale=$WEBCAM_WIDTH:$WEBCAM_HEIGHT[webcam]; \ | |
| [1:v][webcam]overlay=$WEBCAM_X:$WEBCAM_Y[out]; \ | |
| [2:a]aresample=async=1:first_pts=0,aformat=sample_fmts=s16:channel_layouts=stereo[a1]; \ | |
| [3:a]aresample=async=1:first_pts=0,aformat=sample_fmts=s16:channel_layouts=stereo[a2]; \ | |
| [a1][a2]amerge=inputs=2[aout]" \ | |
| -map "[out]:v" \ | |
| -map "[aout]:a" \ | |
| -c:v libx264 -preset veryfast -maxrate 6000k -bufsize 5000k \ | |
| -pix_fmt yuv420p -g 50 -c:a aac -b:a 160k -strict experimental \ | |
| -tune zerolatency \ | |
| -f flv "rtmp://live.twitch.tv/app/$STREAM_KEY" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment