Search code examples
node.jstypescriptffmpeggstreamerrtp

ffmpeg command to GStreamer pipeline for srtp stream


I would like to convert this working ffmpeg command to a GStreamer pipeline but I couldn't manage to get it working. Tried using srtpenc toset the key to a hex representation of the buffer and udpsink with the target host and port set.

The command I currently have:

ffmpeg -re -i <<rtspurl>> -map 0:0 -vcodec h264_omx -pix_fmt yuv420p \
  -r 30 -f rawvideo -tune zerolatency -vf scale=1280:720 -b:v 300k \
  -bufsize 300k -payload_type 99 -ssrc <<ssrc>> \
  -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 \
  -srtp_out_params <<base64key>> srtp://<<targetip>>:<<targetport>>?rtcpport=<<targetport>>&localrtcpport=<<targetport>>&pkt_size=1378

Some references:


Solution

  • For future reference, here is the pipeline i used in the end:

    gst-launch-1.0 rtspsrc location=<<rtsp url>> latency=0 ! \
      videoconvert ! \
      videoscale ! \
      videorate ! \
      video/x-raw, height=<<height>>, width=<<width>>, framerate=<<fps>>/1 !\
      v4l2h264enc ! \
      rtph264pay pt=99 mtu=1378 ssrc=<<ssrc>> ! \
      srtpenc key=<<key in hex>> ! \
      udpsink host=<<targetip>> port=<<targetport>>