[gst-devel] File Duration

Ruben Gonzalez Gonzalez rubenrua at uvigo.es
Wed Mar 11 09:57:24 CET 2009


On Miércoles 11 Marzo 2009 09:46:40 Nitin Mahajan wrote:
> 
> HI!
> 
> I am new to gstreamer development. Is there a way to get the duration of a media file, without trying to play it.

You can use gst.extend.discoverer. A python example is:




import sys

import gobject
gobject.threads_init()

import pygst
pygst.require('0.10')
import gst
from gst.extend.discoverer import Discoverer


def on_discovered(discoverer, ismedia, infile):
    print '\non_discovered:', infile
    discoverer.print_info()

if __name__ == '__main__':
    if len(sys.argv) >= 2:
        print 'ANALIZO: %s ' % sys.argv[0]
        discoverer = Discoverer(sys.argv[1])
        discoverer.connect('discovered', on_discovered, sys.argv[1])

        # The MainLoop
        mainloop = gobject.MainLoop()
        gobject.idle_add(discoverer.discover)
        mainloop.run()

    else:
        print 'Usage: %s <input_file>' % sys.argv[0]


--

> 
> regards
> 
> -Nitin
> 
> 
>       Get your new Email address!
> Grab the Email name you&#39;ve always wanted before someone else does!
> http://mail.promotions.yahoo.com/newdomains/aa/
> 
> ------------------------------------------------------------------------------
> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
> powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
> easily build your RIAs with Flex Builder, the Eclipse(TM)based development
> software that enables intelligent coding and step-through debugging.
> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
> 




--
Un saludo
Ruben Gonzalez Gonzalez
rubenrua at uvigo.es




More information about the gstreamer-devel mailing list