0

I'm using qtmux to merge audio and video to mp4 container file with GStreamer. My pipeline looks like:

gst-launch-1.0 autovideosrc ! x264enc ! queue ! qtmux0. autoaudiosrc! wavenc ! queue ! qtmux ! filesink location=file.mp4

videotestsrc --> x264enc -----\
                               >---> qtmux ---> filesink
audiotestsrc --> wavenc ------/ 

It's working good with commandline. But I want to code it in C code. I was stuck in this part:

x264enc -----\
              >---> qtmux
wavenc ------/ 

This is codes for this part.

  gst_element_link_many(audiosource, wavenc, audioqueue, NULL);
  gst_element_link_many(videosource, x264enc, videoqueue, NULL);
  gst_element_link_many(qtmux, filesink, NULL);
  
  audio_pad     =  gst_element_get_request_pad (audioqueue, "src");
  mux_audio_pad = gst_element_get_static_pad (qtmux, "sink_1");
  gst_pad_link (audio_pad,mux_audio_pad); **# ERROR HERE**

  video_pad     = gst_element_get_request_pad (videoqueue, "src");
  mux_video_pad = gst_element_get_static_pad(qtmux, "sink_2");
  gst_pad_link (video_pad,mux_video_pad); **# ERROR HERE**

But it's wrong in step link pads. And the error type: GST_PAD_LINK_NOFORMAT (-4) – pads do not have common format

How can I fix it ?

Jimmy
  • 147
  • 1
  • 11

1 Answers1

1

I think you have switches request/static pad calls here. The queue should have static pads while the muxer has request pads.

You can also make your life easier by using gst_parse_launch() function to create a pipeline as you do on the command line therefore saving a lot of error prone code.

Florian Zwoch
  • 6,764
  • 2
  • 12
  • 21
  • I tried to follow your guide. But I still error. I will upload all code below. – Jimmy Dec 19 '20 at 01:32
  • Actually, I want to modify a custom overlay which contains a lot of stuff info. So using gst_parse_launch() function seem not compatible. – Jimmy Dec 19 '20 at 01:34
  • 1
    You can always access all individual elements from a created pipeline at any time. – Florian Zwoch Dec 19 '20 at 14:45