Very high packet loss with ffmpeg broadcasting

Now it works by setting the same profile-level-id in Router and Producer codec params. So no change in the GStreamer command was needed.

I prefer to use VP8 and I believe that GStreamer should also work with VP8. Any idea on why is it slow?

@mkh
Using the above video caps, I donā€™t think you would need to change anything on the mediasoup side.

I prefer to use VP8 and I believe that GStreamer should also work with VP8. Any idea on why is it slow?

By slow do you mean lagging? Have you tried setting vp8encā€™s deadline setting to fast?

I donā€™t understand this. If h264 is desired them a proper profile-level-id must be set in the Router mediaCodecs, and such a profile-level-id must correspond (or via compatible with) the real H264 encoding that you tell gstreamer to produce (otherwise receivers may have problems to render it).

Slow in speed, there is no lag.

No! But Iā€™ve used -deadline realtime for FFmpeg. What should it be for GStreamer? The doc says:

Deadline per frame (usec, 0=disabled).
Flags: Read / Write
Allowed values: >= 0
Default value: 0

Fixed by setting vp8enc deadline=1. :+1::pray:

Hereā€™s the full command for VP8 as reference:

gst-launch-1.0 \
rtpbin name=rtpbin rtp-profile=avpf \
filesrc location="${filename}" ! decodebin \
! queue \
! videoconvert \
! vp8enc deadline=1 cpu-used=-5 ! rtpvp8pay pt=${VIDEO_PAYLOAD_TYPE} ssrc=${VIDEO_SSRC} picture-id-mode=1 \
! rtprtxqueue max-size-time=2000 max-size-packets=0 \
! rtpbin.send_rtp_sink_0 \
rtpbin.send_rtp_src_0 ! udpsink bind-address=${LOCALIP} host=${LOCALIP} bind-port=5004 port=${videoRtpPort} \
rtpbin.send_rtcp_src_0 ! udpsink bind-address=${LOCALIP} host=${LOCALIP} port=${videoRtcpPort} sync=false async=false udpsrc port=5005 ! rtpbin.recv_rtcp_sink_0 \
1 Like

You should set also cpu-used=<negative value>. -5 is a good value for a FullHD video stream.

@ibc

I donā€™t understand this. If h264 is desired them a proper profile-level-id must be set in the Router mediaCodecs , and such a profile-level-id must correspond (or via compatible with) the real H264 encoding that you tell gstreamer to produce (otherwise receivers may have problems to render it).

What I meant was you wouldnā€™t have to change the current profile-level-id (42e01f) being used.
I matched the gstreamer caps to the h264 codec options he was currently using. Thus no change to mediasoup settings.

{
  kind: 'video',
  mimeType: 'video/H264',
  clockRate: 90000,
  parameters: {
    'packetization-mode': 1,
    'profile-level-id': '42e01f',
    'level-asymmetry-allowed': 1,
  },
}

@mkh

Fixed by setting vp8enc deadline=1

Awesome :slight_smile:

Thanks for the tip :ok_hand:. The command was updated.