Problems muxing raw h264 stream with qtmux

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Problems muxing raw h264 stream with qtmux

laena
Hi all,

I am trying to mux a raw h264 video stream (already encoded) into a QuickTime file using the following pipeline:
appsrc => qtmux => filesink

The appsrc and qtmux components are connected filtered with the following caps:
gst_caps_new_simple (
      "video/x-h264",
      "stream-format",  G_TYPE_STRING,      "avc",
      "alignment",      G_TYPE_STRING,      "au",
      "bpp",            G_TYPE_INT,         32,
      "framerate",      GST_TYPE_FRACTION,  1, 5,
      "endianness",     G_TYPE_INT,         4321,
      "width",          G_TYPE_INT,         1280,
      "height",         G_TYPE_INT,         1024,
      NULL);

The pipeline runs properly without errors.
The end-of-stream event is also arriving when it should and the container itself seems valid, because VLC is able to extract aspect ratio and format information from it.

However, I am not able to play the resulting video file with any media player I know.

I think the problem might be that I simply push buffer into the appsrc component with every frame:

GstBuffer* buffer = gst_buffer_new();
gst_buffer_set_caps( buffer, m_caps );
 
GST_BUFFER_MALLOCDATA(buffer) = (guint8*)g_malloc(stream->DataLength);
GST_BUFFER_SIZE(buffer)       = stream->DataLength;
GST_BUFFER_DATA(buffer)       = (guint8*)g_malloc0(stream->DataLength);
 
// Timestamp is important here, else the muxer will exit with an error at once
GST_BUFFER_TIMESTAMP(buffer)  = stream->TimeStamp;

memcpy( GST_BUFFER_DATA(buffer), stream->Data, stream->DataLength);
GstFlowReturn rtrn = gst_app_src_push_buffer( GST_APP_SRC(m_source), buffer );

But I never got any appsrc buffer errors in my bus_call function, so I assumed this would work.

What have I done wrong here? Any ideas are welcome.

Cheers!
Reply | Threaded
Open this post in threaded view
|

Re: Problems muxing raw h264 stream with qtmux

Tim-Philipp Müller-2
On Fri, 2012-02-24 at 05:26 -0800, laena wrote:

> Hi all,
>
> I am trying to mux a raw h264 video stream (already encoded) into a
> QuickTime file using the following pipeline:
> appsrc => qtmux => filesink
>
> The appsrc and qtmux components are connected filtered with the following
> caps:
> gst_caps_new_simple (
>       "video/x-h264",
>       "stream-format",  G_TYPE_STRING,      "avc",
>       "alignment",      G_TYPE_STRING,      "au",
>       "bpp",            G_TYPE_INT,         32,
>       "framerate",      GST_TYPE_FRACTION,  1, 5,
>       "endianness",     G_TYPE_INT,         4321,
>       "width",          G_TYPE_INT,         1280,
>       "height",         G_TYPE_INT,         1024,
>       NULL);
>
> The pipeline runs properly without errors.
> The end-of-stream event is also arriving when it should and the container
> itself seems valid, because VLC is able to extract aspect ratio and format
> information from it.
>
> However, I am not able to play the resulting video file with any media
> player I know.

the "bpp" and "endianness" fields don't make sense here. You are missing
a "codec_data" field, which should contain the sps/pps in a GstBuffer
(avcc-atom style).

 Cheers
  -Tim

PS: the frame rate is really 1 frame every 5 seconds?

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Problems muxing raw h264 stream with qtmux

laena
Thanks, Tim!

Do you know where I could see some sample code for creating such a GstBuffer?
How should pps/sps information be represented and what should its data pointer point towards?

Cheers
Lena

PS: true, the framerate was wrong- oops.