How get file size using gstreamer queries elements

Wes Miller wmiller at
Wed Jul 10 07:29:10 PDT 2013

I don't know any way for gstreamer to do file size watching.  Would be a cool
thing to add to multisink, new-file-on-filesize, along with a

However, assuming you are writing this as a program and not as a gst-launch

One of the not so obvious bits of gst-knowledge is that the "thing" that
runs forever after a pipeline is started does not have to be an empty
g_main_loop.  Yhe pipeline runs itself.  The loop or whatever ater the
pipeline starts is there to keep YOUR program running. 

You can code the g_main_loop with contents or write your own timer loop that
will run "forever" after the pipeline is started.  It could be as simple as   
while( !sleep(1) );  which would just keep doing 1 second sleeps forever, or
it could be a complicated loop that sleeps as long as you wish and then
checks the filesize.

         sleep( your_timeout );
         if ( check_filesize() > MAX_FILE_SIZE ) then whatever();

This is based on the rash assumption that your OS of choice allows asking
for the filesize while the file is open in another thread/application.  


View this message in context:
Sent from the GStreamer-devel mailing list archive at

More information about the gstreamer-devel mailing list