# How to let libmediasoupclient client sdk accept encoded video stream as input?

**URL:** <https://mediasoup.discourse.group/t/how-to-let-libmediasoupclient-client-sdk-accept-encoded-video-stream-as-input/3160>\
**Category:** Integration\
**Created:** [August 11, 2021, 6:58am UTC](https://mediasoup.discourse.group/t/how-to-let-libmediasoupclient-client-sdk-accept-encoded-video-stream-as-input/3160 "2021-08-11T06:58:59Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![chenzx](https://avatars.discourse-cdn.com/v4/letter/c/ee59a6/32.png) [@chenzx](https://mediasoup.discourse.group/u/chenzx)\
**Post date:** [August 11, 2021, 6:58am UTC](https://mediasoup.discourse.group/t/how-to-let-libmediasoupclient-client-sdk-accept-encoded-video-stream-as-input/3160/1 "2021-08-11T06:58:59Z")

</div>

I need to implement a webrtc RTP sender client with decoupled 2 parts:

One is the H264 encoded stream source, which produce series of I- & P-frames (logically);  
The other accepts the encoded video stream as input, and do RTP send stream to mediasoup SFU server.

The mediasoup-broadcaster-demo code depends on libmediasoupclient C++ client sdk, which further depends on libwebrtc, doesn’t provide useful sample code pieces for doing this.

When i take a look at the libwebrtc source, there is 2 concepts:

1. `VideoFrame` which is normally taken as libwebrtc’s input type, but it’s YUV420p raw format and not encoded by codecs. The video encoding occurs internally in libwebrtc, which i don’t need, since i have `encoded video stream` as input…

2. `EncodedFrame` which seems exactly what i need, but there is no convenient way to construct by parsing from a H264 encode video stream…

Look for advice.

Maybe i should not use libwebrtc but switch to directly use ffmpeg’s source to do this?

---

<div class="post-metadata">

**Author:** ![chenzx](https://avatars.discourse-cdn.com/v4/letter/c/ee59a6/32.png) [@chenzx](https://mediasoup.discourse.group/u/chenzx)\
**Post date:** [August 11, 2021, 7:05am UTC](https://mediasoup.discourse.group/t/how-to-let-libmediasoupclient-client-sdk-accept-encoded-video-stream-as-input/3160/2 "2021-08-11T07:05:30Z")

</div>

Previously i have experimenting use ffmpeg or gstreamer command line to `copy` the video stream part to RTP connection, but mediasoup server side seems stuck on a PLI keyframe request…

I’ve known there is a `single directional mode` RTP push stream case without RTCP feedback, (e.g. use a java forward proxy to RTP-packetize the encode video stream to a SFU server), this method doesn’t need to depend on libwebrtc, but loses the advanced feature of RTCP. How can mediasoup config support this?

---

<div class="post-metadata">

**Author:** ![chenzx](https://avatars.discourse-cdn.com/v4/letter/c/ee59a6/32.png) [@chenzx](https://mediasoup.discourse.group/u/chenzx)\
**Post date:** [August 11, 2021, 7:08am UTC](https://mediasoup.discourse.group/t/how-to-let-libmediasoupclient-client-sdk-accept-encoded-video-stream-as-input/3160/3 "2021-08-11T07:08:43Z")

</div>

I guess the more accurate question here is: when the webrtc receiver side is browser page, how to make it not send any RTCP feedback packet? The mediasoup SFU server just forward the receiver’s RTCP feedback packet, so if can disbale this, then a simple H264-over-RTP custom client is possible…

---

<div class="post-metadata">

**Author:** ![HuHeng](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/huheng/32/134_2.png) [@HuHeng](https://mediasoup.discourse.group/u/HuHeng)\
**Post date:** [August 18, 2021, 6:37am UTC](https://mediasoup.discourse.group/t/how-to-let-libmediasoupclient-client-sdk-accept-encoded-video-stream-as-input/3160/4 "2021-08-18T06:37:22Z")

</div>

You could send raw h264 packet to mediasoup by plaintransport or directtransport， then you can consume the media via webrtctransport or other transport from mediasoup.

If you want to inject encoded stream source to mediasoup, you don’t need most of rtcp feedbacks as your producer cannot change the encoded stream。Using other tools instead of libmediasoupclient.

There are lots of work to do to use libwebrtc peerconnection api sending encoded packet.

---

<div class="post-metadata">

**Author:** ![chenzx](https://avatars.discourse-cdn.com/v4/letter/c/ee59a6/32.png) [@chenzx](https://mediasoup.discourse.group/u/chenzx)\
**Post date:** [August 18, 2021, 6:43am UTC](https://mediasoup.discourse.group/t/how-to-let-libmediasoupclient-client-sdk-accept-encoded-video-stream-as-input/3160/5 "2021-08-18T06:43:01Z")

</div>

plaintransport can accept raw h264 packet?

I’m now writing C++ code to do RTP-packetize h264 stream to RTP packets, and will also add codes to do RTCP-feedback response(extract I-frames from h264 stream as keyframe)

---

<div class="post-metadata">

**Author:** ![chenzx](https://avatars.discourse-cdn.com/v4/letter/c/ee59a6/32.png) [@chenzx](https://mediasoup.discourse.group/u/chenzx)\
**Post date:** [August 18, 2021, 6:46am UTC](https://mediasoup.discourse.group/t/how-to-let-libmediasoupclient-client-sdk-accept-encoded-video-stream-as-input/3160/6 "2021-08-18T06:46:50Z")

</div>

libwebrtc is ok for consumer side SDK, i thought…

i want to further custom the consumer side SDK to remove SDP negotiation and DTLS handshake to archieve 0-RTT performance, but that’s another question~

---

<div class="post-metadata">

**Author:** ![HuHeng](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/huheng/32/134_2.png) [@HuHeng](https://mediasoup.discourse.group/u/HuHeng)\
**Post date:** [August 18, 2021, 6:50am UTC](https://mediasoup.discourse.group/t/how-to-let-libmediasoupclient-client-sdk-accept-encoded-video-stream-as-input/3160/7 "2021-08-18T06:50:12Z")

</div>

## plaintransport can accept raw h264 packet?

No, RTP packer for h264 is needed.

---

<div class="post-metadata">

**Author:** ![Alby](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/alby/32/480_2.png) [@Alby](https://mediasoup.discourse.group/u/Alby)\
**Post date:** [August 22, 2021, 7:37am UTC](https://mediasoup.discourse.group/t/how-to-let-libmediasoupclient-client-sdk-accept-encoded-video-stream-as-input/3160/8 "2021-08-22T07:37:46Z")

</div>

`See: rtc::VideoSinkInterface<webrtc::VideoFrame> `嘿嘿

---

<div class="post-metadata">

**Author:** ![xiao5555](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/xiao5555/32/1551_2.png) [@xiao5555](https://mediasoup.discourse.group/u/xiao5555)\
**Post date:** [June 1, 2023, 7:11am UTC](https://mediasoup.discourse.group/t/how-to-let-libmediasoupclient-client-sdk-accept-encoded-video-stream-as-input/3160/9 "2023-06-01T07:11:27Z")

</div>

This should be YUV data.

---

<div class="post-metadata">

**Author:** ![prkokate-ittiam](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/prkokate-ittiam/32/2790_2.png) [@prkokate-ittiam](https://mediasoup.discourse.group/u/prkokate-ittiam)\
**Post date:** [February 25, 2025, 7:05am UTC](https://mediasoup.discourse.group/t/how-to-let-libmediasoupclient-client-sdk-accept-encoded-video-stream-as-input/3160/10 "2025-02-25T07:05:04Z")

</div>

> [@HuHeng](#):
>
> You could send raw h264 packet to mediasoup by plaintransport or directtransport， then you can consume the media via webrtctransport or other transport from mediasoup.
> 
> If you want to inject encoded stream source to mediasoup, you don’t need most of rtcp feedbacks as your producer cannot change the encoded stream。

Hello,  
Were you able to get it to work? Any update/ help is greatly appreciated!
