• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java IVideoPictureEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.xuggle.mediatool.event.IVideoPictureEvent的典型用法代码示例。如果您正苦于以下问题:Java IVideoPictureEvent类的具体用法?Java IVideoPictureEvent怎么用?Java IVideoPictureEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IVideoPictureEvent类属于com.xuggle.mediatool.event包,在下文中一共展示了IVideoPictureEvent类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onVideoPicture

import com.xuggle.mediatool.event.IVideoPictureEvent; //导入依赖的package包/类
@Override
public void onVideoPicture(IVideoPictureEvent event) {
	// < 0 means the file we are rolling off of has < RECORD_LENGTH
	// seconds of footage
	if (event.getTimeStamp() >= startingTimestamp || startingTimestamp < 0) {
		final IVideoPicture picture = event.getPicture();

		if (startTimestamp == -1) {
			startTimestamp = picture.getTimeStamp();
		}

		lastTimestamp = picture.getTimeStamp() - startTimestamp;
		picture.setTimeStamp(lastTimestamp);

		writer.encodeVideo(0, picture);
	}
}
 
开发者ID:phrack,项目名称:ShootOFF,代码行数:18,代码来源:RollingRecorder.java


示例2: onVideoPicture

import com.xuggle.mediatool.event.IVideoPictureEvent; //导入依赖的package包/类
@Override
public void onVideoPicture(IVideoPictureEvent event) {
	final long currentTimestamp = event.getTimeStamp(TimeUnit.MILLISECONDS);

	if (doDelay) {
		try {
			final long delay = currentTimestamp - lastTimestamp;
			Thread.sleep(delay);
		} catch (final InterruptedException e) {
			logger.error("Error while reading video frames", e);
		}
	}

	lastTimestamp = currentTimestamp;
	imageView.setImage(SwingFXUtils.toFXImage(event.getImage(), null));
	if (isPlaying || !doDelay) Platform.runLater(() -> listener.frameUpdated(currentTimestamp));
}
 
开发者ID:phrack,项目名称:ShootOFF,代码行数:18,代码来源:VideoPlayerController.java


示例3: onVideoPicture

import com.xuggle.mediatool.event.IVideoPictureEvent; //导入依赖的package包/类
/**
 * Event handler for dealing with each frame in the stream.
 *
 * @param event Event that occurred
 */
@Override
public void onVideoPicture(IVideoPictureEvent event) {
    if (event.getStreamIndex() != mVideoStreamIndex) {
        if (mVideoStreamIndex == -1) {
            mVideoStreamIndex = event.getStreamIndex();
        } else {
            return;
        }
    }

    if (event.getTimeStamp() != 0 && event.getTimeStamp() >= grabAt) {
        dumpImage(event.getImage());
        gotStill = true;
    }
}
 
开发者ID:getconverge,项目名称:converge-1.x,代码行数:21,代码来源:StillVideo.java


示例4: onVideoPicture

import com.xuggle.mediatool.event.IVideoPictureEvent; //导入依赖的package包/类
/**
 * Gets called when FFMPEG transcoded a frame
 */
public void onVideoPicture(IVideoPictureEvent event) {
	lastRead  = System.currentTimeMillis();
       if (event.getStreamIndex() != mVideoStreamIndex) {
           if (mVideoStreamIndex == -1){
               mVideoStreamIndex = event.getStreamIndex();
           }else return;
       }
       if(frameNr % frameSkip < groupSize) try{
       	BufferedImage frame = event.getImage();
       	byte[] buffer = ImageUtils.imageToBytes(frame, imageType);
       	long timestamp = event.getTimeStamp(TimeUnit.MILLISECONDS);
       	if(frameMs > 0 ) timestamp = frameNr * frameMs;
       	Frame newFrame = new Frame(streamId, frameNr, imageType, buffer, timestamp, new Rectangle(0, 0,frame.getWidth(), frame.getHeight()));
       	newFrame.getMetadata().put("uri", streamLocation);
       	frameQueue.put(newFrame);
       	// enforced throttling
       	if(sleepTime > 0) Utils.sleep(sleepTime);
       	// queue based throttling 
       	if(frameQueue.size() > 20) Utils.sleep(frameQueue.size());
       }catch(Exception e){
       	logger.warn("Unable to process new frame due to: "+e.getMessage(), e);
       }
       
       frameNr++;
   }
 
开发者ID:sensorstorm,项目名称:StormCV,代码行数:29,代码来源:StreamReader.java


示例5: onVideoPicture

import com.xuggle.mediatool.event.IVideoPictureEvent; //导入依赖的package包/类
@Override
public void onVideoPicture(IVideoPictureEvent event) {
    BufferedImage image = event.getImage();

    long ts = event.getTimeStamp();
    if (ts / 1000000 > 15) {
        if (ts / 1000000 % 2 == 1) {
            Graphics2D g = image.createGraphics();
            Rectangle2D bounds = new Rectangle2D.Float(0, 0,
                    logoImage.getWidth(), logoImage.getHeight());

            // compute the amount to inset the time stamp and translate the image to that position
            double insetX = bounds.getWidth();
            double insetY = bounds.getHeight();
            //            g.translate(inset, event.getImage().getHeight() - inset);
            g.translate(insetX, insetY);

            g.setColor(Color.WHITE);
            g.fill(bounds);
            g.setColor(Color.BLACK);
            g.drawImage(logoImage, 0, 0, null);
        }
        // call parent which will pass the video to next tool in chain
        super.onVideoPicture(event);
    }
}
 
开发者ID:destiny1020,项目名称:java-learning-notes-cn,代码行数:27,代码来源:XuggleTest.java


示例6: onVideoPicture

import com.xuggle.mediatool.event.IVideoPictureEvent; //导入依赖的package包/类
@Override
public void onVideoPicture(IVideoPictureEvent event) {
	BufferedImage currentFrame = event.getImage();

	if (initialSystemTimeAtVideoStart == -1) initialSystemTimeAtVideoStart = System.currentTimeMillis();

	currentFrameTimestamp = (event.getTimeStamp() / 1000) + initialSystemTimeAtVideoStart;

	if (frameCount == 0) {
		if (cameraEventListener.isPresent())
			setViewSize(new Dimension(currentFrame.getWidth(), currentFrame.getHeight()));
			cameraEventListener.get().setFeedResolution(currentFrame.getWidth(), currentFrame.getHeight());
	}

	if (lastVideoTimestamp > -1 && (frameCount % 30) == 0) {

		double estimateFPS = (double) SECOND_IN_MICROSECONDS
				/ (double) (event.getTimeStamp() - lastVideoTimestamp);

		setFPS(estimateFPS);
	}
	lastVideoTimestamp = event.getTimeStamp();

	if (cameraEventListener.isPresent())
		cameraEventListener.get().newFrame(new Frame(Camera.bufferedImageToMat(currentFrame), currentFrameTimestamp));
	
	frameCount++;
}
 
开发者ID:phrack,项目名称:ShootOFF,代码行数:29,代码来源:MockCamera.java


示例7: onVideoPicture

import com.xuggle.mediatool.event.IVideoPictureEvent; //导入依赖的package包/类
/**
 * {@inheritDoc}
 *
 * @see com.xuggle.mediatool.MediaToolAdapter#onVideoPicture(com.xuggle.mediatool.event.IVideoPictureEvent)
 */
@Override
public void onVideoPicture(final IVideoPictureEvent event) {
	// event.getPicture().getTimeStamp();
	if (event.getStreamIndex() == XuggleVideo.this.streamIndex) {
		XuggleVideo.this.currentMBFImage = ((MBFImageWrapper) event.getImage()).img;
		XuggleVideo.this.currentFrameIsKeyFrame = event.getMediaData().isKeyFrame();
		XuggleVideo.this.timestamp = (long) ((event.getPicture().getTimeStamp()
				* event.getPicture().getTimeBase().getDouble()) * 1000)
				+ XuggleVideo.this.timestampOffset;
		XuggleVideo.this.currentFrameUpdated = true;
	}
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:18,代码来源:XuggleVideo.java


示例8: onVideoPicture

import com.xuggle.mediatool.event.IVideoPictureEvent; //导入依赖的package包/类
public void onVideoPicture(IVideoPictureEvent event) {
try{
	BufferedImage frame = event.getImage();
	byte[] buffer = ImageUtils.imageToBytes(frame, imageType);
	Frame newFrame = new Frame(streamId, seqNum+frames.size()*frameSkip, imageType, buffer, event.getTimeStamp(TimeUnit.MILLISECONDS), new Rectangle(0, 0,frame.getWidth(), frame.getHeight()));
	frames.add(newFrame);
}catch(IOException ioe){
	logger.error("Exception while decoding video: "+ioe.getMessage(), ioe);
}
  }
 
开发者ID:sensorstorm,项目名称:StormCV,代码行数:11,代码来源:VideoToFramesOp.java


示例9: onVideoPicture

import com.xuggle.mediatool.event.IVideoPictureEvent; //导入依赖的package包/类
public void onVideoPicture(IVideoPictureEvent event) {
    IVideoPicture picture = event.getMediaData();
    long originalTimeStamp = picture.getTimeStamp();

    // set the new time stamp to the original plus the offset established
    // for this media file

    long newTimeStamp = originalTimeStamp + mOffset;

    // keep track of predicted time of the next video picture, if the end
    // of the media file is encountered, then the offset will be adjusted
    // to this this time.
    //
    // You'll note in the audio samples listener above we used
    // a method called getNextPts().  Video pictures don't have
    // a similar method because frame-rates can be variable, so
    // we don't now.  The minimum thing we do know though (since
    // all media containers require media to have monotonically
    // increasing time stamps), is that the next video timestamp
    // should be at least one tick ahead.  So, we fake it.

    mNextVideo = originalTimeStamp + 1;

    // set the new timestamp on video samples

    picture.setTimeStamp(newTimeStamp);

    // create a new video picture event with the one true video stream
    // index

    super.onVideoPicture(new VideoPictureEvent(this, picture,
            mVideoStreamIndex));
}
 
开发者ID:destiny1020,项目名称:java-learning-notes-cn,代码行数:34,代码来源:ConcatenateAudioAndVideo.java


示例10: onVideoPicture

import com.xuggle.mediatool.event.IVideoPictureEvent; //导入依赖的package包/类
/**
 * Creates a thumbnail image from the video image passed in by an IMediaReader. 
 * @param event the IVideoPictureEvent from the mediaReader
 */
@Override
public void onVideoPicture(IVideoPictureEvent event) {
	if (!isFinished()) {
    BufferedImage image = event.getImage();
    
    double widthFactor = dim.getWidth()/image.getWidth();
    double heightFactor = dim.getHeight()/image.getHeight();
    double factor = Math.min(widthFactor, heightFactor);
    
    // determine actual dimensions of thumbnail
    int w = (int)(image.getWidth()*factor);
    int h = (int)(image.getHeight()*factor);
    
		thumbnail = new BufferedImage(w, h, BufferedImage.TYPE_3BYTE_BGR);
		g = thumbnail.createGraphics();
    AffineTransform transform = AffineTransform.getScaleInstance(factor, factor);
    g.setTransform(transform); // shrink video image
    g.drawImage(image, 0, 0, null);
    
    if (overlay!=null) {
     g.scale(1/factor, 1/factor); // draw overlay at full scale
     
      // determine the inset and translate the image
      Rectangle2D bounds = new Rectangle2D.Float(0, 0, overlay.getWidth(), overlay.getHeight());
      double ht = bounds.getHeight();
      g.translate(0.5*ht, thumbnail.getHeight()-1.5*ht);

      g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.2f));
      g.drawImage(overlay, 0, 0, null);

    }
    frameNumber++;
    finished = frameNumber>=TARGET_FRAME_NUMBER;
	}
    
  // call parent which will pass the video onto next tool in chain
  super.onVideoPicture(event);
    
}
 
开发者ID:OpenSourcePhysics,项目名称:video-engines,代码行数:44,代码来源:XuggleThumbnailTool.java


示例11: onVideoPicture

import com.xuggle.mediatool.event.IVideoPictureEvent; //导入依赖的package包/类
@Override
public void onVideoPicture(IVideoPictureEvent event) {
	log.debug("Adjust onVideo");
	IVideoPicture in = event.getPicture();
	log.debug("Video ts: {}", in.getFormattedTimeStamp());
	int inWidth = in.getWidth();
	int inHeight = in.getHeight();
	if (inHeight != height || inWidth != width) {
		log.debug("VideoAdjustTool onVideoPicture");
		log.trace("Video timestamp: {} pixel type: {}", event.getTimeStamp(), in.getPixelType());
		log.trace("Video in: {} x {} out: {} x {}", new Object[] { inWidth, inHeight, width, height });
		if (resampler == null) {
			resampler = IVideoResampler.make(width, height, pixelType, inWidth, inHeight, in.getPixelType());
			log.debug("Video resampler: {}", resampler);
		}
		if (resampler != null) {
			IVideoPicture out = IVideoPicture.make(pixelType, width, height);
			if (resampler.resample(out, in) >= 0) {
				//check complete
				if (out.isComplete()) {
					// queue video
					facade.queueVideo(out, event.getTimeStamp(), event.getTimeUnit());
					in.delete();
				} else {
					log.warn("Resampled picture was not marked as complete");
				}
			} else {
				log.warn("Resample failed");
			}
			out.delete();
		} else {
			log.debug("Resampler was null");
		}
		log.debug("VideoAdjustTool onVideoPicture - end");
	} else {
		// queue video
		facade.queueVideo(in, event.getTimeStamp(), event.getTimeUnit());
	}
}
 
开发者ID:Red5,项目名称:red5-hls-plugin,代码行数:40,代码来源:VideoAdjustTool.java


示例12: onVideoPicture

import com.xuggle.mediatool.event.IVideoPictureEvent; //导入依赖的package包/类
@Override
public void onVideoPicture(IVideoPictureEvent event) {
	log.trace("Reader onVideo");
	if (videoEnabled) {
		// look for a key frame
		keyFrameReceived = event.getPicture().isKeyFrame() ? true : keyFrameReceived;
		// once we have had one, proceed
		if (keyFrameReceived) {
			videoFramesRead += 1;
			super.onVideoPicture(event);
		}
	}
}
 
开发者ID:Red5,项目名称:red5-hls-plugin,代码行数:14,代码来源:RTMPReader.java


示例13: onVideoPicture

import com.xuggle.mediatool.event.IVideoPictureEvent; //导入依赖的package包/类
/** {@inheritDoc} */

        @Override
        public void onVideoPicture(IVideoPictureEvent event) {
            // get the graphics for the image

            Graphics2D g = event.getImage().createGraphics();

            // establish the timestamp and how much space it will take

            String timeStampStr = event.getPicture().getFormattedTimeStamp();
            Rectangle2D bounds = g.getFont().getStringBounds(timeStampStr,
                    g.getFontRenderContext());

            // compute the amount to inset the time stamp and translate the
            // image to that position

            double inset = bounds.getHeight() / 2;
            g.translate(inset, event.getImage().getHeight() - inset);

            // draw a white background and black timestamp text

            g.setColor(Color.WHITE);
            g.fill(bounds);
            g.setColor(Color.BLACK);
            g.drawString(timeStampStr, 0, 0);

            // call parent which will pass the video onto next tool in chain

            super.onVideoPicture(event);
        }
 
开发者ID:destiny1020,项目名称:java-learning-notes-cn,代码行数:32,代码来源:ModifyVideoAndAudio.java



注:本文中的com.xuggle.mediatool.event.IVideoPictureEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JsonXMLConfigBuilder类代码示例发布时间:2022-05-23
下一篇:
Java TransactionContext类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap