def startConverting(self,dir,filename,videoRate,subs,subsFile,subsEnc): self.progress=0 if sys.platform.startswith('win'): if vlc_path() != None: exe=vlc_path() + "\\vlc.exe " self.proto=vlcInputProtocol(self) else: raise("unable to find vlc path") pipeline=vlc_defaults['win'] else: exe='vlc' pipeline=vlc_defaults['linux'] self.dest=os.path.join(dir,os.path.basename(filename)) self.proto = vlcInputProtocol(self,self.dest) arg1=arg2='' if subs: arg1=('--sub-file=%s'%subsFile) arg2=('--subsdec-encoding=%s'%subsEnc) args=(int(videoRate),int(videoRate)) #line = str(pipeline%args).split() proc = ['vlcProcess', filename,arg1,arg2]+(pipeline%args).split() reactor.spawnProcess(self.proto,exe,(proc),env=None)
def start(self): self.player.set_state(gst.STATE_PLAYING) proc = 'vlcProcess', 'rtp://@:' + str(self.port) self.fd.close() if 'win' in sys.platform: if vlc_path() != None: exe = vlc_path() + "\\vlc.exe " self.proto = vlcProtocol(self.player, self) else: exe = 'vlc' self.proto = vlcProtocol(self.player, self) reactor.spawnProcess(self.proto, exe, (proc), env=None) self.playing = True
def initOutput(self, *args, **kwargs): self.port = self.findPort() pipe = "appsrc name=appsrc !mpegtsparse ! rtpmp2tpay ! queue ! udpsink host=127.0.0.1 port=" + str( self.port) self.player = gst.parse_launch(pipe) self.appsrc = self.player.get_by_name('appsrc') self.appsrc.props.format = 4 self.playing = False if not vlc_path(): self.log.error('vlc is not installed') reactor.callLater(0, self.streamComponent.stop) self.interface.displayError('you need to install vlc player') return if getVlcHexVersion() < getVlcReqHexVersion(): self.log.error('the version of vlc is wrong') reactor.callLater(0, self.streamComponent.stop) self.interface.displayError( 'version %s of vlc is old.\n version %s or greater is needed' % (getVlcVersion(), getVlcReqVersion())) return
def initInput(self, *args, **kwargs): self.playing = False if not vlc_path(): self.log.error('vlc is not installed') reactor.callLater(0, self.streamComponent.stop) self.interface.displayError('you need to install vlc player') return if getVlcHexVersion() < getVlcReqHexVersion(): self.log.error('the version of vlc is wrong') reactor.callLater(0, self.streamComponent.stop) self.interface.displayError( 'version %s of vlc is old.\n version %s or greater is needed' % (getVlcVersion(), getVlcReqVersion())) return if getVlcVersion() <= '2.0.8': self.acodec = 'mp4a' else: self.acodec = 'mpga' self.input = kwargs['input'] self.videoRate = self.input['videoRate'] self.hasPlayer = False try: self.videoRate = int(self.videoRate) except: self.videoRate = 0 self.height = self.input['height'] self.width = self.input['width']
def start(self): so = '--sout=#transcode{}:standard{access=http,mux=ts,dst=%s:%s}' % ( self.ip, self.port) proc = 'vlcProcess', '-', '--ignore-config', so, 'vlc://quit' print proc if 'win' in sys.platform: if vlc_path() != None: proc = 'vlcProcess', '-', '-I', 'dummy-quiet', so, 'vlc://quit' exe = vlc_path() + "\\vlc.exe " self.proto = vlcProtocol(self, self.log) else: exe = 'cvlc' self.proto = vlcProtocol(self, self.log) reactor.spawnProcess(self.proto, exe, (proc), env=None) #self.playing=True self.log.info('http vlc output initting')
def stop(self): if self.playing: self.playing = False if 'win' in sys.platform: if vlc_path() != None: self.proto.closeVlc() else: self.proto.closeVlc() self.log.debug('http vlc output is closing')
def stop(self): if self.playing: self.playing = False print 'close output' self.cleanup() if sys.platform == 'win32': if vlc_path() != None: # self.proc.terminate() self.proto.closeVlc() else: self.proto.closeVlc()
def stop(self): if self.playing: self.playing = False if 'win' in sys.platform: if vlc_path() != None: # self.proc.terminate() self.proto.closeVlc() else: self.proto.closeVlc() self.hasPlayer = False self.log.debug('vcl input stopped')
def start(self): if self.so and len(self.so): so = "".join(["--sout=", self.so]) else: so = '' proc = 'vlcProcess', '-', '--ignore-config', '--no-qt-privacy-ask', so, 'vlc://quit' if 'win' in sys.platform: if vlc_path() != None: proc = 'vlcProcess', '-', '-I', 'dummy-quiet', '--ignore-config', '--no-qt-privacy-ask', so, 'vlc://quit' exe = vlc_path() + "\\vlc.exe " self.proto = vlcProtocol(self, self.log) else: exe = 'vlc' self.proto = vlcProtocol(self, self.log) reactor.spawnProcess(self.proto, exe, (proc), env=None) #self.playing=True self.log.info('pure vlc output initting')
def start(self): """ if self.so and len(self.so): so = "".join(["--sout=", self.so]) else: so = '' """ so = "--sout=#transcode{width=320,height=200,venc=x264{slice-max-size=25200,keyint=60,ratetol=0},vcodec=h264,scale=1,soverlay,acodec=mp4a,ab=32,channels=1,samplerate=44100}:standard{access=http{mime=video/x-flv},mux=ffmpeg{mux=flv},dst=0.0.0.0:12000/flow.flv} " proc = 'vlcProcess', '-', '--ignore-config', so, 'vlc://quit' if 'win' in sys.platform: if vlc_path() != None: proc = 'vlcProcess', '-', '-I', 'dummy-quiet', so, 'vlc://quit' exe = vlc_path() + "\\vlc.exe " self.proto = vlcProtocol(self, self.log) else: exe = 'cvlc' self.proto = vlcProtocol(self, self.log) reactor.spawnProcess(self.proto, exe, (proc), env=None) #self.playing=True self.log.info('flv vlc output initting')
def initOutput(self, *args, **kwargs): self.log.debug('http vlc output loaded') self.playing = False self.ip = kwargs['output']['ip']['value'] self.port = kwargs['output']['port']['value'] if not vlc_path(): self.log.error('vlc is not installed') reactor.callLater(0, self.streamComponent.stop) self.interface.displayError('you need to install vlc player') return if getVlcHexVersion() < getVlcReqHexVersion(): self.log.error('the version of vlc is wrong') reactor.callLater(0, self.streamComponent.stop) self.interface.displayError( 'version %s of vlc is old.\n version %s or greater is needed' % (getVlcVersion(), getVlcReqVersion())) return
def initOutput(self, *args, **kwargs): self.log.debug('flv vlc output loaded') self.playing = False self.web = WebUI(_parent=self.root) """ try: self.so=kwargs['output']['sout']['value'] except: self.so=None """ if not vlc_path(): self.log.error('vlc is not installed') reactor.callLater(0, self.streamComponent.stop) self.interface.displayError('you need to install vlc player') return if getVlcHexVersion() < getVlcReqHexVersion(): self.log.error('the version of vlc is wrong') reactor.callLater(0, self.streamComponent.stop) self.interface.displayError( 'version %s of vlc is old.\n version %s or greater is needed' % (getVlcVersion(), getVlcReqVersion())) return
def setIF(self, type, filename=None, videorate=0, streamport=-1, exe=None, line=None): try: streamport = int(streamport) if streamport < -1: streamport = -1 print streamport except: streamport = -1 platform = sys.platform if sys.platform.startswith('win'): self.platform = platform = 'win' if sys.platform.startswith('linux'): self.platform = platform = 'linux' if exe: if not os.path.exists(exe): print "invalid exe.. fall back" exe = None if not exe: if platform == 'win': if vlc_path() != None: exe = vlc_path() + "\\vlc.exe " self.proto = vlcInputProtocol(self, self.log) else: raise ("unable to find vlc path") else: exe = 'vlc' self.proto = vlcInputProtocol(self, self.log) arg1 = arg2 = '' if self.input['advanced'] and self.input['advanced']['subs']: arg1 = ('--sub-file=%s' % self.input['advanced']['subsFile']) arg2 = ('--subsdec-encoding=%s' % self.input['advanced']['encoding']) if not line: args = (int(self.width), int(self.height), int(videorate), int(videorate), self.acodec, int(self.scheduler.blocksSec)) if type == 'webcam': proc = ['vlcProcess' ] + (vlc_defaults[platform][type] % args).split() elif type == 'cfile': proc = ['vlcProcess', filename ] + (vlc_defaults[platform][type]).split() elif type == 'stream': if not self.input['transcode']: proc = ['vlcProcess', filename, arg1, arg2 ] + (vlc_defaults[platform]['dstream']).split() else: proc = ['vlcProcess', filename, arg1, arg2 ] + (vlc_defaults[platform][type] % args).split() elif type == 'tv': fileargs = filename[0].split() file = fileargs[0] fileargs = fileargs[1:] args = (int(filename[1]), int(self.width), int(self.height), int(videorate), int(videorate), self.acodec, int(self.scheduler.blocksSec)) proc = ['vlcProcess', file] + fileargs + ( vlc_defaults[platform][type] % args).split() else: proc = ['vlcProcess', filename, arg1, arg2 ] + (vlc_defaults[platform][type] % args).split() else: proc = ('vlcProcess') + line.split() print proc reactor.spawnProcess(self.proto, exe, (proc), env=None) #self.playing=True self.hasPlayer = True