# Inject stream freezes

**URL:** <https://mediasoup.discourse.group/t/inject-stream-freezes/3588>\
**Category:** Integration\
**Created:** [November 18, 2021, 11:09am UTC](https://mediasoup.discourse.group/t/inject-stream-freezes/3588 "2021-11-18T11:09:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![neer](https://avatars.discourse-cdn.com/v4/letter/n/65b543/32.png) [@neer](https://mediasoup.discourse.group/u/neer)\
**Post date:** [November 18, 2021, 11:09am UTC](https://mediasoup.discourse.group/t/inject-stream-freezes/3588/1 "2021-11-18T11:09:18Z")

</div>

I am all new to Mediasoup and am trying to inject a RTMP stream with the following FFmpeg command:

```auto
ffmpeg \
  -re \
  -v info \
  -stream_loop -1 \
  -i rtmp://3.126.121.45:1935/live/stream\
  -map 0:a:0 \
  -acodec libopus -ab 128k -ac 2 -ar 48000 \
  -map 0:v:0 \
  -c:v libvpx -minrate 2500k -maxrate 2500k -b:v 2500k -r 30 -g 60 -max_delay 0 -bf 0 -deadline realtime -cpu-used 1 \
  -f tee \
"[select=a:f=rtp:ssrc=11111111:payload_type=101]rtp://52.29.30.225:41299?rtcpport=40612&pkt_size=1300|[select=v:f=rtp:ssrc=22222222:payload_type=102]rtp://52.29.30.225:44083?rtcpport=48791&pkt_size=1300"

```

The video when consumed freezes randomly and plays back after a while. I have tried the solution in [Here](https://mediasoup.discourse.group/t/ffmpeg-inject-video-only-can-play-first-frame/3378) but with no luck. I have also tried h264 codec and the result was the same.

I have tried the following gstreamer command too which has the same result too.

```auto
gst-launch-1.0 \
  rtpbin name=rtpbin \
  rtmpsrc location=rtmp://3.126.121.45:1935/live/stream \
  ! flvdemux name=demux \
  demux.video \
  ! queue \
  ! h264parse \
  ! decodebin \
  ! videoconvert \
  ! vp8enc target-bitrate=2000000 deadline=1 cpu-used=4 \
  ! rtpvp8pay pt=102 ssrc=22222222 picture-id-mode=2 \
  ! rtpbin.send_rtp_sink_0 \
  rtpbin.send_rtp_src_0 ! udpsink host="52.29.30.225" port="48875" \
  rtpbin.send_rtcp_src_0 ! udpsink host="52.29.30.225" port="48029" sync=false async=false \
  demux.audio \
  ! queue \
  ! decodebin \
  ! audioresample \
  ! audioconvert \
  ! opusenc bitrate=128000 \
  ! rtpopuspay pt=101 ssrc=11111111 \
  ! rtpbin.send_rtp_sink_1 \
  rtpbin.send_rtp_src_1 ! udpsink host="52.29.30.225" port="48988" \
  rtpbin.send_rtcp_src_1 ! udpsink host="52.29.30.225" port="46988" sync=false async=false

```

Can someone help me with a clue of what might cause this?

---

<div class="post-metadata">

**Author:** ![boygiandi](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/boygiandi/32/1223_2.png) [@boygiandi](https://mediasoup.discourse.group/u/boygiandi)\
**Post date:** [November 19, 2021, 10:28am UTC](https://mediasoup.discourse.group/t/inject-stream-freezes/3588/2 "2021-11-19T10:28:06Z")

</div>

You can try `-r 30 -g 30`

---

<div class="post-metadata">

**Author:** ![neer](https://avatars.discourse-cdn.com/v4/letter/n/65b543/32.png) [@neer](https://mediasoup.discourse.group/u/neer)\
**Post date:** [November 19, 2021, 10:53am UTC](https://mediasoup.discourse.group/t/inject-stream-freezes/3588/3 "2021-11-19T10:53:20Z")

</div>

Tried but the result is the same.
