GStreamer qtmux/mp4mux command to code converting

Showing results for 
Search instead for 
Did you mean: 

GStreamer qtmux/mp4mux command to code converting

Senior Contributor I

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 ?

Tags (3)
0 Kudos
0 Replies