File source to webrtcbin

I want to stream a mp4 file via webrtc. My current pipeline looks like this

pipeline_str = f"""
    filesrc location={container_path} ! qtdemux name=demux
    webrtcbin name=sendrecv stun-server=stun://
    demux.audio_0! aacparse ! rtpmp4apay ! queue ! application/x-rtp,media=audio,encoding-name=MP4A-LATM,payload=96 ! sendrecv.
    demux.video_0 ! h264parse ! rtph264pay ! queue ! application/x-rtp,media=video,encoding-name=H264,payload=97 ! sendrecv.

When parsing it gives errors like could not link queue0 to sendrecv, sendrecv can't handle caps application/x-rtp, media=(string)video, encoding-name=(string)H264, payload=(int)97 (3)

Any idea how I can connect this with the webrtcbin element?

gst-launch-1.0 style strings can usually only get you so far. At some point you may probably need to manually construct the parts of the pipeline and combine them. This is likely one of those cases as the dynamic nature of both qtdemux and webrtcbin mean that gst_parse_launch may very easily try to combine two completely incompatible branches.

If webrtcbin is generating the offer, then the payload type does not really matter. If however, webrtcbin is creating the answer, then the payload type must match the value in the offer SDP or webrtcbin will fail negotiation.

You might want to check out these examples