Skip to content

Instantly share code, notes, and snippets.

@kylefmohr
Created May 10, 2025 17:02
Show Gist options
  • Select an option

  • Save kylefmohr/b8c71792d151b98cb241d6bee42aa640 to your computer and use it in GitHub Desktop.

Select an option

Save kylefmohr/b8c71792d151b98cb241d6bee42aa640 to your computer and use it in GitHub Desktop.

Revisions

  1. kylefmohr created this gist May 10, 2025.
    18 changes: 18 additions & 0 deletions stream.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    #!/bin/bash
    ffmpeg \
    -hide_banner \
    -thread_queue_size 512 \
    -fflags +genpts+discardcorrupt+igndts \
    -err_detect ignore_err \
    -use_wallclock_as_timestamps 1 \
    -rtsp_transport tcp \
    -stimeout 30000000 \
    -re \
    -i "rtsp://YOUR_USERNAME:[email protected]:554/live/av0" \
    -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=44100 \
    -map 0:v:0 -map 1:a:0 \
    -c:v libx264 -preset veryfast -pix_fmt yuv420p -s 1920x1080 -r 60 -g 120 -b:v 4000k -maxrate 4500k -bufsize 8000k \
    -c:a aac -b:a 128k -ar 44100 \
    -f flv -max_muxing_queue_size 1024 \
    -tune zerolatency \
    "rtmp://a.rtmp.youtube.com/live2/YOUR_YOUTUBE_LIVE_STREAM_KEY"