Skip to content

Instantly share code, notes, and snippets.

@bangonkali
Created April 16, 2023 05:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bangonkali/3ad96511154f406daeebfe8c2cf7c195 to your computer and use it in GitHub Desktop.
Save bangonkali/3ad96511154f406daeebfe8c2cf7c195 to your computer and use it in GitHub Desktop.
Streaming RSTP CCTV to RTMP Facebook Live

Streaming RSTP CCTV to RTMP Facebook Live

Powershell Script

$env:FB_STREAM_KEY = 'FB-99999999999999999-9-XXXXXXXXXXXXXXXX'
$env:FB_STREAM_URL = 'rtmps://live-api-s.facebook.com:443/rtmp/'
$env:CCTV_YARD = 'rtsp://admin:mypassword@cctv_ip:554/stream1'

gst-launch-1.0 flvmux name=mux streamable=true `
    ! rtmpsink `
        async=true `
        location="${ENV:FB_STREAM_URL}${ENV:FB_STREAM_KEY}" `
    rtspsrc location=$ENV:CCTV_YARD `
            debug=TRUE `
            is-live=TRUE `
            onvif-mode=TRUE `
            onvif-rate-control=TRUE `
            short-header=FALSE `
            latency=8000 `
        ! rtph265depay `
        ! h265parse `
        ! d3d11h265dec `
        ! videoscale `
        ! "video/x-raw,width=1920,height=1080,framerate=30/1" `
        ! x264enc bitrate=4096 key-int-max=60 `
        ! h264parse `
        ! queue ! mux. `
    audiotestsrc  wave=ticks apply-tick-ramp=true tick-interval=100000000 `
     freq=10000 volume=0.0 marker-tick-period=10 sine-periods-per-tick=20 is-live=true `
        ! audio/x-raw,rate=44100,channels=2 `
        ! identity sync=true `
        ! voaacenc bitrate=128000 `
        ! queue ! mux.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment