本文整理汇总了Java中com.xuggle.xuggler.IVideoPicture.setQuality方法的典型用法代码示例。如果您正苦于以下问题:Java IVideoPicture.setQuality方法的具体用法?Java IVideoPicture.setQuality怎么用?Java IVideoPicture.setQuality使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.xuggle.xuggler.IVideoPicture
的用法示例。
在下文中一共展示了IVideoPicture.setQuality方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: encode
import com.xuggle.xuggler.IVideoPicture; //导入方法依赖的package包/类
@Override
public void encode(BufferedImage image) throws Exception {
IVideoPicture frame = converter.toPicture(image, (long) (frameNo * deltat));
frame.setQuality(0);
movieWriter.encodeVideo(0, frame);
frameNo++;
}
示例2: recordFrame
import com.xuggle.xuggler.IVideoPicture; //导入方法依赖的package包/类
public void recordFrame(BufferedImage frame) {
final BufferedImage image = ConverterFactory.convertToType(frame, BufferedImage.TYPE_3BYTE_BGR);
final IConverter converter = ConverterFactory.createConverter(image, IPixelFormat.Type.YUV420P);
timestamp = (System.currentTimeMillis() - startTime) + timeOffset;
final IVideoPicture f = converter.toPicture(image, timestamp * 1000);
f.setKeyFrame(isFirstShotFrame);
f.setQuality(0);
if (forking) {
synchronized (bufferedFrames) {
bufferedFrames.add(f);
}
} else {
isFirstShotFrame = false;
synchronized (videoWriterLock) {
if (recording)
videoWriter.encodeVideo(0, f);
}
if (timestamp >= ShotRecorder.RECORD_LENGTH * 3) {
logger.debug("Rolling video file {}, timestamp = {} ms", relativeVideoFile.getPath(), timestamp);
fork(false);
}
}
}
示例3: recordFrame
import com.xuggle.xuggler.IVideoPicture; //导入方法依赖的package包/类
public void recordFrame(BufferedImage frame) {
final BufferedImage image = ConverterFactory.convertToType(frame, BufferedImage.TYPE_3BYTE_BGR);
final IConverter converter = ConverterFactory.createConverter(image, IPixelFormat.Type.YUV420P);
final long timestamp = (System.currentTimeMillis() - startTime) + timeOffset;
final IVideoPicture f = converter.toPicture(image, timestamp * 1000);
f.setKeyFrame(isFirstShotFrame);
f.setQuality(0);
isFirstShotFrame = false;
videoWriter.encodeVideo(0, f);
}
示例4: addImage
import com.xuggle.xuggler.IVideoPicture; //导入方法依赖的package包/类
/**
* Add new image into video stream.
*/
@Override
public void addImage(final Image image) throws IOException {
if (!isOpen()) {
throw new IOException("Current object does not opened yet! Please call #open() method!");
}
final BufferedImage worksWithXugglerBufferedImage = convertToType(TypeConvert.toBufferedImage(image),
BufferedImage.TYPE_3BYTE_BGR);
final IPacket packet = IPacket.make();
IConverter converter = null;
try {
converter = ConverterFactory.createConverter(worksWithXugglerBufferedImage, IPixelFormat.Type.YUV420P);
} catch (final UnsupportedOperationException e) {
throw new IOException(e.getMessage());
}
this.totalTimeStamp += this.incrementTimeStamp;
final IVideoPicture outFrame = converter.toPicture(worksWithXugglerBufferedImage, this.totalTimeStamp);
outFrame.setQuality(0);
int retval = this.outStreamCoder.encodeVideo(packet, outFrame, 0);
if (retval < 0) {
throw new IOException("Could not encode video!");
}
if (packet.isComplete()) {
retval = this.outContainer.writePacket(packet);
if (retval < 0) {
throw new IOException("Could not save packet to container!");
}
}
}
示例5: getPicture
import com.xuggle.xuggler.IVideoPicture; //导入方法依赖的package包/类
/**
* Converts a bgr source image to a xuggle picture.
*
* @param bgrImage the source image (must be type TYPE_3BYTE_BGR)
* @param pixelType the pixel type
* @param timeStamp the timestamp in microseconds
* @return the xuggle picture
*/
private IVideoPicture getPicture(BufferedImage bgrImage, IPixelFormat.Type pixelType, long timeStamp) {
IVideoPicture picture = null;
try {
IConverter converter = getConverter(bgrImage, pixelType);
picture = converter.toPicture(bgrImage, timeStamp);
picture.setQuality(0);
} catch (Exception ex) {
ex.printStackTrace();
} catch (Error err) {
err.printStackTrace();
}
return picture;
}