title: GStreamer: Caps negotiation failure
body: <p>I have a problem with linking of a two elements: avdec_h264 and avenc_mpeg4. I think that somehow these elements can't negotiate a capabilities of a data. </p>
  
  <p>I've tested my pipeline with gst-launch:</p>
  
  <pre><code>gst-launch-1.0 rtspsrc location="rtsp://camera" ! rtph264depay ! h264parse ! avdec_h264 ! avenc_mpeg4 ! fakesink
  </code></pre>
  
  <p>It have worked fine. </p>
  
  <p>When I use my application where the pipeline is implemented:</p>
  
  <pre><code>    pipeline_ = gst_pipeline_new("default");
  
      if (!pipeline_)
      {
          return false;
      }
  
      receiver_ = gst_element_factory_make("rtspsrc",      "receiver");
      demuxer_  = gst_element_factory_make("rtph264depay", "demuxer");
      parser_   = gst_element_factory_make("h264parse",    "parser");
      decoder_  = gst_element_factory_make("avdec_h264",   "decoder");
      encoder_  = gst_element_factory_make("avenc_mpeg4,   "encoder");
      output_   = gst_element_factory_make("fakesink",     "output");
  
      if (!receiver_ || !demuxer_ || !parser_ || 
          !decoder_  || !encoder_ || !output_)
      {
          return false;
      }
  
      g_object_set(GST_OBJECT(receiver_), "location", "rtsp://camera", nullptr);
      // On this signal source pad of the receiver is being connected to
      // the sink pad of the demuxer.
      g_signal_connect(receiver_, "pad-added", G_CALLBACK(on_pad_added), this);
  
      gst_bin_add_many(GST_BIN(pipeline_), receiver_, demuxer_, parser_,
                       decoder_, encoder_, output, nullptr);
  
      if (!gst_element_link_many(demuxer_, parser_, decoder_,
                                 encoder_, output_, nullptr))
      {
          return false;
      }
  </code></pre>
  
  <p>Everything links successfully. All elements change their state to PLAYING, but I get nothing: I do not get GST_MESSAGE_STREAM_START on the pipeline's bus.</p>
  
  <p>Here is the graphs from gst-launch and my application:
  <a href="https://i.stack.imgur.com/y5xsQ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/y5xsQ.jpg" alt="Graph generated by gst-launch"></a>
  <a href="https://i.stack.imgur.com/lkzeu.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lkzeu.jpg" alt="Graph generated by my application"></a></p>
  
  <p>If I change avenc_mpeg4 to, videoconvert element, which is not an encoder, everything will works well. If I put an other encoder, I will still have current problem.</p>
  
  <p>Probably I don't know about some particular things on how to work with the encoder. But I could not find solution.</p>
  
  <p>Thank you.</p>