1
votes

I have char* buffer that I read from video.mp4 file. This buffer has size 4096. I tried to create GstBuffer from char* buffer

GstBuffer* Buffer = gst_buffer_new_wrapped(data, size);
dataBuffer = gst_buffer_copy(tmpBuf);

Then I push this buffer to the appsrc

GstElement* source = gst_bin_get_by_name (GST_BIN (consumer), "source");
gst_app_src_push_buffer (GST_APP_SRC (source), dataBuffer);
gst_object_unref (source);

Pipeline consumer was created in the next way:

gchar* videoConsumerString = g_strdup_printf ("appsrc max-buffers=5 drop=false name=source ! decodebin ! xvimagesink");
consumer = gst_parse_launch (videoConsumerString, NULL);
gst_element_set_state (consumer, GST_STATE_NULL);
g_free (videoConsumerString);

After the create of pipeline I set its state to the GST_STATE_NULL. When I starts playing I set its state to GST_STATE_PLAYING.

But in the out I got error:

ERROR from element mpegvparse0: No valid frames found before end of stream

I tried to change size of char* buffer, use different elements in the pipeline (e.g. ffmpegcolorspace, videconvert, some other) but did not resolve this issue.

If run with GST_DEBUG=3, i have a lot of warnings

0:00:00.064480642  4059      0x12c66d0 WARN    codecparsers_mpegvideo gstmpegvideoparser.c:887:gst_mpeg_video_packet_parse_picture_header: Unsupported picture type : 0

I use gstreamer 1.0. Does anybody faced with such problem?

P.S. I don't have possibility to read data from file with Gstreamer. I only can read buffers from file with fread and then try to play them. Maybe I have to set some specific fixed size of readed buffer?

1
Did you used this example? how was that eos created(I mean end of stream - who created that, are you doing this somehow)? My guess is that you push the buffer after EOS.. do you see any warnings regarding this (run with GST_DEBUG=3 ./your_app)nayana
Why '''gst_element_set_state (consumer, GST_STATE_NULL);'''? WHen are you setting it to '''GST_STATE_PLAYING'''? We probably need a more complete code snippet. Also seeing ffmpegcolorspace tells me that you are using gstreamer-0.10 which has not been updated for years. Please consider switching to 1.X especially for new code.ensonic
@otopolsky No, used gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/… example, but they a almost similar. I push EOS to the buffer when all data a already pushed. I updated the body of question. If run with GST_DEBUG=3, i get a lot of codecparsers_mpegvideo gstmpegvideoparser.c:887:gst_mpeg_video_packet_parse_picture_header: Unsupported picture type : 0Dmitriy Savin
@ensonic I set pipeline to the GST_STATE_PLAYING when when I finished initializing of other objects. I use gstreamer 1.0. I don't know why I did not got an error when tried to use ffmpegcolorspace.Dmitriy Savin
ok I guess you do some processing to the mp4 files (otherwise you would simply use filesrc) - check the altered buffers. I just noticed the size 4096 mentioned at the beginning of question - is it in Bytes? this is quite small for the video buffer.. also you should provide some caps for the appsrc.. are you doing this somewhere? if so please paste all relevenat code snippets..nayana

1 Answers

4
votes

I solved this problem. Unexpectedly for me it was in the creating of the GstBuffer.

Correct way to create such buffer from data(char*) with known size is

    GstBuffer * buffer = gst_buffer_new_allocate(NULL, size, NULL);
    gst_buffer_fill(m_dataBufferProducer, 0, data, size);

Thank you for your help!