pygi

Thibault Saunier tsaunier at gnome.org
Thu Nov 19 07:47:33 PST 2015


Hello,

Could you explain how it is failling?

Regards,

Thibault Saunier

On Thu, Nov 19, 2015 at 4:37 PM, vassilux . <v.gontcharov at gmail.com> wrote:
> Yes ...
>
> 2015-11-19 16:32 GMT+01:00 Raushan Kumar Choudhary
> <raushankumar at tataelxsi.co.in>:
>>
>> did u switch on your internet connection
>>
>> Sent from my iPhone
>>
>> > On 19-Nov-2015, at 8:24 pm, vassilux . <v.gontcharov at gmail.com> wrote:
>> >
>> > Hi alls,
>> > I try to port my old java-gstreamer application to pygi and make a
>> > little test with follow
>> > This commande works
>> > gst-launch-1.0 filesrc location=c:\\audiotest\\0000ad39.wav ! decodebin
>> > ! audioconvert ! audioresample ! lamemp3enc ! filesink
>> > location=c:\\audiotest\\0000ad39.mp3
>> >
>> >
>> > I want to run something like this from python(pygi)
>> >
>> > import logging
>> > from logging.handlers import RotatingFileHandler
>> >
>> > logging.basicConfig(level=logging.INFO)
>> >
>> > logger = logging.getLogger('myapp')
>> >
>> > import gi
>> > gi.require_version('Gst', '1.0')
>> > from gi.repository import GObject, Gst
>> >
>> > GObject.threads_init()
>> > Gst.init(None)
>> >
>> > def transcode_process(pathin, pathout):
>> >
>> >       log_message = "Transcoding %s to %s" % (pathin, pathout)
>> >
>> >       cmd = 'filesrc location=c:\\\\audiotest\\0000ad39.wav name=source
>> > ! decodebin ! audioconvert ! audioresample ! lamemp3enc name=encoder !
>> > filesink location=c:\\\\audiotest\\0000ad39.mp3 name=output'
>> >
>> >       pipeline = Gst.parse_launch(cmd)
>> >
>> >       if pipeline == None:
>> >               logger.error("Failed get pipeline")
>> >               return
>> >
>> >       source = pipeline.get_by_name('source')
>> >
>> >       if source == None:
>> >               logger.error("Failed get source")
>> >               return
>> >
>> >       try:
>> >
>> >               pipeline.set_state(Gst.State.PLAYING)
>> >
>> >               bus = pipeline.get_bus()
>> >
>> >               msg = bus.timed_pop_filtered(Gst.CLOCK_TIME_NONE,
>> > Gst.MessageType.ERROR | Gst.MessageType.EOS)
>> >
>> >
>> >               pipeline.set_state(Gst.State.NULL)
>> >
>> >       except Exception as e:
>> >               logger.error(str(e))
>> >               logger.error("Could not open the file for transcoding.
>> > This is probably happening because there are non-ASCII characters in the
>> > filename.")
>> >       finally:
>> >               try:
>> >                       # I think this is supposed to free the memory used
>> > by the pipeline
>> >                       pipeline.set_state(Gst.State.NULL)
>> >               except:
>> >                       pass
>> >
>> >
>> > def main():
>> >       print sys.getdefaultencoding()
>> >       transcode_process("c:\\\\audiotest\\0000ad39.wav",
>> > "c:\\\\audiotest\\0000ad39.mp3")
>> >
>> >
>> > if __name__ == "__main__":
>> >       main()
>> >
>> >
>> > Something missing .. :-)
>> >
>> > Thank for help
>> >
>> >
>> >
>> > _______________________________________________
>> > gstreamer-devel mailing list
>> > gstreamer-devel at lists.freedesktop.org
>> > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
>
>
> --
> Vassili Gontcharov
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>


More information about the gstreamer-devel mailing list