[gst-devel] My H.264 encoder cound not work well with the MP4 muxer

Chen, Weian weian.chen at intel.com
Wed Aug 12 01:12:22 CEST 2009



Hi,



Thanks a lot for the reply, my chain function is as following:



gst_video_enc_chain (GstPad * pad, GstBuffer * buf)

{

  GstVideoEnc *videoenc = GST_VIDEO_ENC (GST_OBJECT_PARENT (pad));



  GstClockTime timestamp, duration;

  gboolean discont;

  GstBuffer *out_buf = NULL;

  GstFlowReturn ret = GST_FLOW_OK;

  guint width, height;

  guint size;

  guint outsize;



  guint8 * buffer = GST_BUFFER_DATA (buf);

  size = GST_BUFFER_SIZE (buf)



  timestamp = GST_BUFFER_TIMESTAMP (buf);

  duration = GST_BUFFER_DURATION (buf);

  discont = GST_BUFFER_IS_DISCONT (buf);



  outsize = encode_one_picture (videoenc, buffer, &codedbuf);  //encode one picture



   out_buf = gst_buffer_new_and_alloc (outsize);

   memcpy (GST_BUFFER_DATA (out_buf), coded_buf, outsize);

   GST_BUFFER_SIZE (out_buf) = outsize;

   GST_BUFFER_TIMESTAMP (out_buf) = timestamp;

   GST_BUFFER_DURATION (out_buf) = duration;

   gst_buffer_set_caps (out_buf, GST_PAD_CAPS (videoenc->srcpad));



   gst_buffer_unref (buf);



   gst_pad_push (videoenc->srcpad, out_buf);

  return ret;

}





And the srccaps set function is as following:



gst_video_enc_set_src_caps (GstVideoEnc * videoenc, GstPad * pad)

{

  GstCaps *outcaps;

  gboolean res;



    outcaps = gst_caps_new_simple ("video/x-h264",

      "width", G_TYPE_INT, videoenc->width,

      "height", G_TYPE_INT, videoenc->height,

      "framerate", GST_TYPE_FRACTION, videoenc->fps_num, videoenc->fps_den, NULL);

  res = gst_pad_set_caps (pad, outcaps);

  gst_caps_unref (outcaps);

}



Is my info enough? If yes, what’s the problem?



Could you please give me some help?



Thanks in advanced.





thanks,

Weian

-----Original Message-----
From: Michael Smith [mailto:msmith at xiph.org]
Sent: 2009年8月11日 19:56
To: Discussion of the development of GStreamer
Subject: Re: [gst-devel] My H.264 encoder cound not work well with the MP4 muxer



On Tue, Aug 11, 2009 at 2:08 AM, Chen, Weian<weian.chen at intel.com> wrote:

> Hi All

>

>

>

> I am developing an H.264 encoder element, and with pipeline: gst-launch

> videotestsrc ! myencoder ! filesink location=test.264 I can dump the

> test.264 data, and also I can decoder it.

>

>

>

> But when I use pipeline: gst-launch videotestsrc ! myencoder ! mp4mux !

> filesink location=test.mp4 I could not get any output, and the size of

> test.mp4 is 0.

>

>

>

> Could anybody here give me some hint what’s the problem in my encoder? Why

> my encoder could not work with the MP4 muxer?



You've given far too little information for us to help. What caps are

produced by your encoder? What's set on the buffers you push? Etc.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20090812/e6e90f6a/attachment.htm>


More information about the gstreamer-devel mailing list