Exemplo n.º 1
0
    def __run_wav_out(self):

        videoconvert = gst.element_factory_make(
            "fakesink", "video-out")
        self.add(videoconvert)

        # path de salida
        location = os.path.basename(self.origen)

        if "." in location:
            extension = ".%s" % self.origen.split(".")[-1]
            location = location.replace(extension, ".%s" % self.codec)

        else:
            location = "%s.%s" % (location, self.codec)

        self.newpath = os.path.join(self.dirpath_destino, location)

        if os.path.exists(self.newpath):
            fecha = datetime.date.today()
            hora = time.strftime("%H-%M-%S")
            location = "%s_%s_%s" % (fecha, hora, location)
            self.newpath = os.path.join(self.dirpath_destino, location)

        wavenc = wav_bin(self.newpath)
        self.add(wavenc)
Exemplo n.º 2
0
    def __run_wav_out(self):

        videoconvert = gst.element_factory_make("fakesink", "video-out")
        self.add(videoconvert)

        # path de salida
        location = os.path.basename(self.origen)

        if "." in location:
            extension = ".%s" % self.origen.split(".")[-1]
            location = location.replace(extension, ".%s" % self.codec)

        else:
            location = "%s.%s" % (location, self.codec)

        self.newpath = os.path.join(self.dirpath_destino, location)

        if os.path.exists(self.newpath):
            fecha = datetime.date.today()
            hora = time.strftime("%H-%M-%S")
            location = "%s_%s_%s" % (fecha, hora, location)
            self.newpath = os.path.join(self.dirpath_destino, location)

        wavenc = wav_bin(self.newpath)
        self.add(wavenc)
Exemplo n.º 3
0
    def __run_wav_out(self):
        from Bins import wav_bin
        self.player = gst.element_factory_make("playbin2", "playbin2")
        videoconvert = gst.element_factory_make("fakesink", "video-out")
        self.player.set_property('video-sink', videoconvert)

        wavenc = wav_bin(self.newpath)
        wavenc.set_name("audio-out")
        self.player.set_property('audio-sink', wavenc)

        self.player.set_property("uri", "file://" + self.origen)

        self.bus = self.player.get_bus()
        #self.bus.set_sync_handler(self.__bus_handler)
        self.bus.add_signal_watch()                             # ****
        self.bus.connect('message', self.__on_mensaje)          # ****
Exemplo n.º 4
0
    def __run_wav_out(self):
        from Bins import wav_bin
        self.player = gst.element_factory_make("playbin2", "playbin2")
        videoconvert = gst.element_factory_make("fakesink", "video-out")
        self.player.set_property('video-sink', videoconvert)

        wavenc = wav_bin(self.newpath)
        wavenc.set_name("audio-out")
        self.player.set_property('audio-sink', wavenc)

        self.player.set_property("uri", "file://" + self.origen)

        self.bus = self.player.get_bus()
        #self.bus.set_sync_handler(self.__bus_handler)
        self.bus.add_signal_watch()  # ****
        self.bus.connect('message', self.__on_mensaje)  # ****
Exemplo n.º 5
0
    def __setup2(self):
        """
        Construye los codificadores para la salida seleccionada.
        """

        audioresample = self.get_by_name('audioresample')

        if self.codec == 'mp3':
            self.emit("info", "Agregando Codificador mp3")
            from Bins import mp3_bin
            lamemp3enc = mp3_bin(self.location)

            self.add(lamemp3enc)
            audioresample.link(lamemp3enc)

        elif self.codec == 'wav':
            self.emit("info", "Agregando Codificador wav")
            from Bins import wav_bin
            wavenc = wav_bin(self.location)

            self.add(wavenc)
            audioresample.link(wavenc)

        elif self.codec == 'ogg':
            self.emit("info", "Agregando Codificador ogg")
            from Bins import ogg_bin
            vorbisenc = ogg_bin(self.location)

            self.add(vorbisenc)
            audioresample.link(vorbisenc)

        elif self.codec == 'ogv':
            self.emit("info", "Agregando Codificador ogv")
            videoconvert = gst.element_factory_make(
                "ffmpegcolorspace", "videoconvert")
            videorate = gst.element_factory_make(
                'videorate', 'videorate')
            videorate.set_property('max-rate', 30)

            theoraenc = gst.element_factory_make(
                "theoraenc", "theoraenc")
            oggmux = gst.element_factory_make(
                "oggmux", "oggmux")

            vorbisenc = gst.element_factory_make(
                "vorbisenc", "vorbisenc")

            filesink = gst.element_factory_make(
                "filesink", "filesink")
            filesink.set_property('location',
                self.location)

            self.add(videoconvert)
            self.add(videorate)
            self.add(theoraenc)
            self.add(oggmux)
            self.add(filesink)
            self.add(vorbisenc)

            videoconvert.link(videorate)
            videorate.link(theoraenc)
            theoraenc.link(oggmux)
            oggmux.link(filesink)

            audioresample.link(vorbisenc)
            vorbisenc.link(oggmux)

        self.bus.add_signal_watch()
        self.bus.connect(
            'message', self.__on_mensaje)

        self.bus.enable_sync_message_emission()
        self.bus.connect(
            'sync-message', self.__sync_message)