Video header has empty length and file will not play

William Metcalf wmetcalf at
Mon Jul 11 15:40:09 PDT 2011

Hello all,

I am trying to take raw video and encode it into mp4 format.  I have a C 
application that takes in raw video frame from a capture card and stores 
them into buffer, and then I push those buffers into a gstreamer 
application using appsrc.   My pipeline is translated to command line as 

appsrc ! videoparse width=720 height=480 framerate=29/1 ! ffenc_mpeg4 ! 
qtmux ! filesink location=test.mp4

This pipeline executes correctly and doesn't report any errors, and it 
produces the desired file.

I used the following pipeline to try and play the file:

gst-launch filesrc location="c:\\Encoder_Output\\test.mp4" ! decodebin ! 

This pipeline does not play the file, and produces the following output:

Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
ERROR: from element 
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstQTDemux:qtdemux0: This 
file is invalid and cannot be played.
Additional debug info:
gst_qtdemux_loop_state_header (): 
Header atom 'mdat' has empty length
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...

After some research it seems that this problem usually occurs because of 
how you exit the pipeline and end the stream.  My application works by 
receiving 400 buffers.  After 400 buffers I call g_main_loop_quit(loop) 
and gst_element_set_state(GST_STATE_NULL).  Is this not the correct way 
to end the stream?  Can someone please provide me with some advice for 
the correct way to end the stream so the header will be written 
correctly and I can play the file?

Thank you in advance,
William Metcalf

More information about the gstreamer-devel mailing list