process the Video
329613
public function process($LogFile = false, $runAfterProcess = true){
            
		if(!$LogFile) $LogFile = TEMP_FOLDER.'/AudioFileProcessing-ID-'.$this->ID.'-'.md5($this->getRelativePath()).'.log';
            
        if($this->ProcessingStatus == 'new'){
			$this->ProcessingStatus = 'processing';
            $this->write();
                
            $Message = "[LOGTIME: ".date("Y-m-d H:i:s")."]\nProcessing for File ".$this->getRelativePath()." started\n\n";
            // Write the contents to the logfile, 
            // using the FILE_APPEND flag to append the content to the end of the file
            // and the LOCK_EX flag to prevent anyone else writing to the file at the same time
            file_put_contents($LogFile, $Message, FILE_APPEND | LOCK_EX);
                
            // Audio Object
            $ffprobe = FFMpeg\FFProbe::create();
            $audio = $ffprobe->format($this->getFullPath());
                
            // read data
            $return = $this->processAudioInformation($audio, $LogFile);
			
			if($return && $runAfterProcess && $this->ProcessingStatus = 'finished') $this->onAfterProcess();
			
			return $return;
        }else{
			$Message = "[LOGTIME: ".date("Y-m-d H:i:s")."]\nFile allready processed\n";
            file_put_contents($LogFile, $Message, FILE_APPEND | LOCK_EX);
			return false;
        }
    }
120744
private void processFromFile(String source, ListeFilme listeFilme) {
        notifyProgress(source, PROGRESS_MAX);
        try (InputStream in = selectDecompressor(source, new FileInputStream(source));
             JsonParser jp = new JsonFactory().createParser(in)) {
            readData(jp, listeFilme);
        } catch (FileNotFoundException ex) {
            Log.errorLog(894512369, "FilmListe existiert nicht: " + source);
            listeFilme.clear();
        } catch (Exception ex) {
            Log.errorLog(945123641, ex, "FilmListe: " + source);
            listeFilme.clear();
        }
    }
47503
def video(query, opts = {})
      invoke 'Video',
        query,
        opts,
        passthrough_opts: %i(filters sort),
        enum_opt_to_module: {filters: VideoFilter, sort: VideoSort},
        param_name_replacements: {filters: 'VideoFilters', sort: 'VideoSortBy'}
    end
1314458
def _post_process(self):
        
        self._process = None
        shutil.move(self._temp_capture_file_path, self._capture_file_path)
843768
public void process() {

		// compute match intensities
		if( mask == null )
			match.process(template);
		else
			match.process(template,mask);

		GrayF32 intensity = match.getIntensity();
		int offsetX = 0;
		int offsetY = 0;

		// adjust intensity image size depending on if there is a border or not
		if (!match.isBorderProcessed()) {
			int x0 = match.getBorderX0();
			int x1 = imageWidth - (template.width - x0);
			int y0 = match.getBorderY0();
			int y1 = imageHeight - (template.height - y0);
			intensity = intensity.subimage(x0, y0, x1, y1, null);
		} else {
			offsetX = match.getBorderX0();
			offsetY = match.getBorderY0();
		}

		// find local peaks in intensity image
		candidates.reset();
		extractor.process(intensity, null,null,null, candidates);

		// select the best matches
		if (scores.length < candidates.size) {
			scores = new float[candidates.size];
			indexes = new int[candidates.size];
		}

		for (int i = 0; i < candidates.size; i++) {
			Point2D_I16 p = candidates.get(i);

			scores[i] = -intensity.get(p.x, p.y);
		}

		int N = Math.min(maxMatches, candidates.size);

		QuickSelect.selectIndex(scores, N, candidates.size, indexes);

		// save the results
		results.reset();
		for (int i = 0; i < N; i++) {
			Point2D_I16 p = candidates.get(indexes[i]);

			Match m = results.grow();
			m.score = -scores[indexes[i]];
			m.set(p.x - offsetX, p.y - offsetY);
		}
	}
726715
private long finalizeFlv() {
        long bytesTransferred = 0L;
        if (!finalized.get()) {
            log.debug("Finalizing {}", filePath);
            try {
                // read file info if it exists
                File tmpFile = new File(filePath + ".info");
                if (tmpFile.exists()) {
                    int[] info = readInfoFile(tmpFile);
                    if (audioCodecId == -1 && info[0] > 0) {
                        audioCodecId = info[0];
                    }
                    if (videoCodecId == -1 && info[1] > 0) {
                        videoCodecId = info[1];
                    }
                    if (duration == 0 && info[2] > 0) {
                        duration = info[2];
                    }
                    if (audioDataSize == 0 && info[3] > 0) {
                        audioDataSize = info[3];
                    }
                    if (soundRate == 0 && info[4] > 0) {
                        soundRate = info[4];
                    }
                    if (soundSize == 0 && info[5] > 0) {
                        soundSize = info[5];
                    }
                    if (!soundType && info[6] > 0) {
                        soundType = true;
                    }
                    if (videoDataSize == 0 && info[7] > 0) {
                        videoDataSize = info[7];
                    }
                } else {
                    log.debug("Flv info file not found");
                }
                tmpFile = null;
                // write the file header
                writeHeader();
                log.debug("Pos post header: {}", fileChannel.position());
                // write the metadata with the final duration
                writeMetadataTag(duration * 0.001d, videoCodecId, audioCodecId);
                log.debug("Pos post meta: {}", fileChannel.position());
                // create a transfer buffer
                ByteBuffer dst = ByteBuffer.allocate(1024);
                // when appending, read original stream data first and put it at the front
                if (append) {
                    Path prevFlv = Paths.get(filePath.replace(".flv", ".old"));
                    if (Files.exists(prevFlv)) {
                        log.debug("Found previous flv: {} offset: {}", prevFlv, appendOffset);
                        SeekableByteChannel prevChannel = Files.newByteChannel(prevFlv, StandardOpenOption.READ);
                        // skip the flv header, prev tag size, and possibly metadata
                        prevChannel.position(appendOffset);
                        int read = -1, wrote;
                        boolean showfirsttag = true;
                        do {
                            read = prevChannel.read(dst);
                            log.trace("Read: {} bytes", read);
                            if (read > 0) {
                                dst.flip();
                                // inspect the byte to make sure its a valid type
                                if (showfirsttag) {
                                    showfirsttag = false;
                                    dst.mark();
                                    log.debug("Tag type: {}", (dst.get() & 31));
                                    dst.reset();
                                }
                                wrote = fileChannel.write(dst);
                                log.trace("Wrote: {} bytes", wrote);
                                bytesTransferred += wrote;
                            }
                            dst.compact();
                        } while (read > 0);
                        dst.clear();
                        prevChannel.close();
                        // remove the previous flv
                        Files.deleteIfExists(prevFlv);
                        log.debug("Previous FLV bytes written: {} final position: {}", (bytesWritten + bytesTransferred), fileChannel.position());
                    } else {
                        log.warn("Previous flv to be appended was not found: {}", prevFlv);
                    }
                }
                // get starting position of the channel where latest stream data was written
                long pos = dataChannel.position();
                log.trace("Data available: {} bytes", pos);
                // set the data file the beginning 
                dataChannel.position(0L);
                // transfer / write data file into final flv
                int read = -1, wrote;
                do {
                    read = dataChannel.read(dst);
                    log.trace("Read: {} bytes", read);
                    if (read > 0) {
                        dst.flip();
                        wrote = fileChannel.write(dst);
                        log.trace("Wrote: {} bytes", wrote);
                        bytesTransferred += wrote;
                    }
                    dst.compact();
                } while (read > 0);
                dst.clear();
                dataChannel.close();
                // get final position
                long length = fileChannel.position();
                // close the file
                fileChannel.close();
                // close and remove the ser file if write was successful
                if (bytesTransferred > 0) {
                    if (!Files.deleteIfExists(Paths.get(filePath + ".info"))) {
                        log.warn("FLV info file not deleted");
                    }
                    if (!Files.deleteIfExists(Paths.get(filePath + ".ser"))) {
                        log.warn("FLV serial file not deleted");
                    }
                }
                log.debug("FLV bytes written: {} final position: {}", (bytesWritten + bytesTransferred), length);
            } catch (Exception e) {
                log.warn("Finalization of flv file failed; new finalize job will be spawned", e);
            } finally {
                finalized.compareAndSet(false, true);
                // check for post processors that may be available
                if (FLVWriter.flv != null) {
                    LinkedList<Class<IPostProcessor>> writePostProcessors = ((FLV) FLVWriter.flv).getWritePostProcessors();
                    if (writePostProcessors != null) {
                        for (Class<IPostProcessor> postProcessor : writePostProcessors) {
                            try {
                                addPostProcessor(postProcessor.newInstance());
                            } catch (Exception e) {
                                log.warn("Post processor: {} instance creation failed", postProcessor, e);
                            }
                        }
                    }
                }
                // run post process
                if (postProcessors != null) {
                    for (IPostProcessor postProcessor : postProcessors) {
                        log.debug("Execute: {}", postProcessor);
                        try {
                            // set properties that the post processor requires or may require
                            postProcessor.init(filePath);
                            // execute and block
                            executor.submit(postProcessor).get();
                        } catch (Throwable t) {
                            log.warn("Exception during post process on: {}", filePath, t);
                        }
                    }
                    postProcessors.clear();
                } else {
                    log.debug("No post processors configured");
                }
            }
        } else {
            log.trace("Finalization already completed");
        }
        return bytesTransferred;
    }
266355
def process(self):
        '''
        '''
        self._item_session.request = request = Request(self._item_session.url_record.url)
        verdict = self._fetch_rule.check_ftp_request(self._item_session)[0]

        if not verdict:
            self._item_session.skip()
            return

        self._add_request_password(request)

        dir_name, filename = self._item_session.url_record.url_info.split_path()
        if self._processor.fetch_params.glob and frozenset(filename) & GLOB_CHARS:
            request = self._to_directory_request(request)
            is_file = False
            self._glob_pattern = urllib.parse.unquote(filename)
        else:
            is_file = yield from self._prepare_request_file_vs_dir(request)

            self._file_writer_session.process_request(request)

        wait_time = yield from self._fetch(request, is_file)

        if wait_time:
            _logger.debug('Sleeping {0}.', wait_time)
            yield from asyncio.sleep(wait_time)
664086
protected function processHeroVideo($heroVidData)
    {
        if ($heroVidData) {
            $hero = Video::get()->filter(['HailID' => $heroVidData['id']])->first();
            if (!$hero) {
                $hero = new Video();
            }
            $hero->OrganisationID = $this->OrganisationID;
            $hero->HailOrgID = $this->HailOrgID;
            $hero->HailOrgName = $this->HailOrgName;

            $hero->importHailData($heroVidData);
            $hero = $hero->ID;
        } else {
            $hero = null;
        }

        $this->HeroVideoID = $hero;
    }
1192939
def harvest_video_data(image)
      response = Typhoeus.get(image.video_url, followlocation: true)

      if response.success?
        raise "Invalid content type: " + response.headers['Content-Type'] unless (response.headers['Content-Type'] == 'video/mp4')
      elsif response.timed_out?
        raise "Request timed out"
      elsif response.code == 0
        raise "Could not get an HTTP response"
      else
        raise "HTTP request failed: " + response.code.to_s
      end

      response.body
    end
957369
def handle(self, addrport='', *args, **options):
        """"""
        server = WebserverThread(addrport, *args, **options)
        server.start()
        options['camera'] = 'djcelery.snapshot.Camera'
        options['prog_name'] = 'djcelerymon'
        ev.run(*args, **options)
622553
def process_frame(self):
        
        input_name = self.inputs[0]
        output_name = self.outputs[0]
        in_frame = self.input_buffer[input_name].get()
        out_frame = self.outframe_pool[output_name].get()
        out_frame.initialise(in_frame)
        if self.transform(in_frame, out_frame):
            self.send(output_name, out_frame)
        else:
            raise StopIteration()
953378
def from_video(self, path):
        
        frames = self.get_video_frames(path)
        self.handle_type(frames)
        return self
557434
public void reprocessInput() {
		if ( inputMethod == InputMethod.VIDEO ) {
			openVideo(true,inputFilePath);
		} else if( inputMethod == InputMethod.IMAGE ) {
			BufferedImage buff = inputStreams.get(0).getBufferedImage();
			openImage(true,new File(inputFilePath).getName(),buff);// TODO still does a pointless image conversion
		} else if( inputMethod == InputMethod.IMAGE_SET ) {
			openImageSet(inputFileSet);
		}
	}
1270423
function (param, options, callback) {
              embedProcessor.log(param.worker + ' started with parameters = ', param);
              if (param.url.match(/\/channel\//) === null) {
                var video_id = param.url.split('/').pop();
                var api_url = '//api.ustream.tv/json/video/' + video_id + '/getInfo?key=CA8D42389DA4266B9489912DE63A817F&callback=?';
                $.getJSON(api_url, function (data) {
                  if (data) {
                    param.status = true;
                    param.duration = data.lengthInSecond;
                    param.duration_formatted = false;
                    param.thumbnail_url = data.imageUrl.medium || data.imageUrl.small || '';
                    param.title = data.title || '';
                    param.description = data.description || '';
                    param.rating = data.rating || '';
                    param.numberOf = data.numberOf || '';
                    param.html = data.embedTag;
                    if (embedProcessor._sources[param.source] && embedProcessor._sources[param.source].prepareEmbedCode) {
                      param = embedProcessor._sources[param.source].prepareEmbedCode(param);
                    }
                    param = embedProcessor._paramEmbedCodeNormalizer(param);
                  } else {
                    param.status = false;
                  }
                  embedProcessor.log(param.worker + ' receive parameters = ', param);
                  callback(param);
                });
              } else {
                this.embedly(param, options, callback);
              }
            }
633378
def process(self):
        """"""
        var_name = self.name_edt.text()
        try:
            self.var_name = str(var_name)
        except UnicodeEncodeError:
            self.var_name = to_text_string(var_name)
        if self.text_widget.get_as_data():
            self.clip_data = self._get_table_data()
        elif self.text_widget.get_as_code():
            self.clip_data = try_to_eval(
                to_text_string(self._get_plain_text()))
        else:
            self.clip_data = to_text_string(self._get_plain_text())
        self.accept()
378080
def process_stream(self, tree):
        """"""
        try:
            etype = SENSOR_MAP[tree.find(
                self.element_query('eventType')).text.lower()]
            estate = tree.find(
                self.element_query('eventState')).text
            echid = tree.find(
                self.element_query('channelID'))
            if echid is None:
                # Some devices use a different key
                echid = tree.find(
                    self.element_query('dynChannelID'))
            echid = int(echid.text)
            ecount = tree.find(
                self.element_query('activePostCount')).text
        except (AttributeError, KeyError, IndexError) as err:
            _LOGGING.error('Problem finding attribute: %s', err)
            return

        # Take care of keep-alive
        if len(etype) > 0 and etype == 'Video Loss':
            self.watchdog.pet()

        # Track state if it's in the event list.
        if len(etype) > 0:
            state = self.fetch_attributes(etype, echid)
            if state:
                # Determine if state has changed
                # If so, publish, otherwise do nothing
                estate = (estate == 'active')
                old_state = state[0]
                attr = [estate, echid, int(ecount),
                        datetime.datetime.now()]
                self.update_attributes(etype, echid, attr)

                if estate != old_state:
                    self.publish_changes(etype, echid)
                self.watchdog.pet()
711819
protected function perform()
    {
        $path = $this->file->path();

        $imageName = pathinfo($path, PATHINFO_FILENAME) . '.jpg';
        $imagePath = pathinfo($path, PATHINFO_DIRNAME) . '/' . $imageName;

        $ffmpeg = FFMpeg::create([
            'ffmpeg.binaries'  => $this->getFfpmegBinaryPath(),
            'ffprobe.binaries' => $this->getFfprobeBinaryPath(),
        ]);

        $video = $ffmpeg->open($path);

        // Determine second at which to extract screenshot
        if (null !== ($percentage = $this->getPercentageConfigValue())) {
            // Percentage of full duration

            $ffprobe = FFProbe::create([
                'ffprobe.binaries' => $this->getFfprobeBinaryPath(),
            ]);

            $duration = (float) $ffprobe->format($path)->get('duration');

            $seconds = $percentage / 100 * $duration;

        } elseif (null === ($seconds = $this->getSecondsConfigValue())) {

            $seconds = 0;
        }

        $frame = $video->frame(TimeCode::fromSeconds($seconds));
        $frame->save($imagePath);

        $this->file->setName($imageName);
        $this->file->setMimeType('image/jpeg');
        $this->file->setData($imagePath);
    }