本文整理汇总了Java中com.xuggle.mediatool.ToolFactory类的典型用法代码示例。如果您正苦于以下问题:Java ToolFactory类的具体用法?Java ToolFactory怎么用?Java ToolFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ToolFactory类属于com.xuggle.mediatool包,在下文中一共展示了ToolFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: RollingRecorder
import com.xuggle.mediatool.ToolFactory; //导入依赖的package包/类
public RollingRecorder(ICodec.ID codec, String extension, String sessionName, String cameraName,
CameraManager cameraManager) {
this.codec = codec;
this.extension = extension;
this.sessionName = sessionName;
this.cameraName = cameraName;
recordWidth = cameraManager.getFeedWidth();
recordHeight = cameraManager.getFeedHeight();
startTime = System.currentTimeMillis();
relativeVideoFile = new File(
sessionName + File.separator + "rolling" + String.valueOf(System.nanoTime()) + extension);
videoFile = new File(System.getProperty("shootoff.sessions") + File.separator + relativeVideoFile.getPath());
videoWriter = ToolFactory.makeWriter(videoFile.getPath());
videoWriter.addVideoStream(0, 0, codec, recordWidth, recordHeight);
logger.debug("Started recording new rolling video: {}", videoFile.getName());
}
示例2: setUp
import com.xuggle.mediatool.ToolFactory; //导入依赖的package包/类
/**
* Performs a check of the setup.
*
* @return null if OK, otherwise error message
*/
@Override
public String setUp() {
String result;
result = super.setUp();
if (result == null) {
try {
m_Webcam = getWebcam();
if (m_Webcam == null)
return "No webcam found for ID: " + (m_WebcamID.isEmpty() ? "-default-" : m_WebcamID);
m_Webcam.setViewSize(m_Size);
m_Webcam.open();
}
catch (Exception e) {
return "Failed to open webcam: " + Utils.throwableToString(e);
}
m_Writer = ToolFactory.makeWriter(m_Output.getAbsolutePath());
m_Writer.addVideoStream(0, 0, CAPTURE_FORMAT, m_Size.width, m_Size.height);
}
return result;
}
示例3: open
import com.xuggle.mediatool.ToolFactory; //导入依赖的package包/类
@Override
public void open(String path, int w, int h, int fps) throws Exception {
int bitRate = (int) Math.max(w * h * fps * BPP, MIN_BITRATE);
IRational frameRate = IRational.make(fps, 1);
deltat = 1e6 / frameRate.getDouble();
movieWriter = ToolFactory.makeWriter(path);
movieWriter.addVideoStream(0, 0, ICodec.ID.CODEC_ID_H264, w, h);
IPixelFormat.Type pixFmt = IPixelFormat.Type.YUV420P;
converter = ConverterFactory.createConverter(ConverterFactory.XUGGLER_BGR_24, pixFmt, w, h);
IStreamCoder coder = movieWriter.getContainer().getStream(0).getStreamCoder();
coder.setBitRate(bitRate);
coder.setFrameRate(frameRate);
coder.setTimeBase(IRational.make(frameRate.getDenominator(), frameRate.getNumerator()));
coder.setFlag(IStreamCoder.Flags.FLAG_QSCALE, true);
coder.setGlobalQuality(0);
// coder.setNumPicturesInGroupOfPictures(fps);
coder.setPixelType(pixFmt);
frameNo = 0;
}
示例4: initialise
import com.xuggle.mediatool.ToolFactory; //导入依赖的package包/类
/**
* Initialise the writer
*/
public void initialise()
{
if( writer == null )
{
// First, let's make a IMediaWriter to write the file.
this.writer = ToolFactory.makeWriter( filename );
// We tell it we're going to add one video stream, with id 0,
// at position 0
this.writer.addVideoStream(0, 0, width, height);
// Reset the next frame's timecode
this.nextFrameTime = 0;
}
}
示例5: grab
import com.xuggle.mediatool.ToolFactory; //导入依赖的package包/类
/**
* Grab a still image from the video and store it in
* {@link StillVideo#getStill()}.
*/
public void grab() {
IMediaReader mediaReader = ToolFactory.makeReader(inputFilename);
mediaReader.setBufferedImageTypeToGenerate(BufferedImage.TYPE_3BYTE_BGR);
mediaReader.addListener(new ImageSnapListener());
if (grabAt == -1) {
// Get a screenshot half way through the video
grabAt = (getVideoDuration() / 2);
}
try {
while (mediaReader.readPacket() == null && !gotStill) ;
} catch (Throwable t) {
Logger.getLogger(StillVideo.class.getName()).log(Level.INFO, t.
getMessage());
}
}
示例6: testTranscoding
import com.xuggle.mediatool.ToolFactory; //导入依赖的package包/类
@Test
public void testTranscoding() {
IMediaReader mediaReader = ToolFactory.makeReader(filename);
IMediaWriter mediaWriter = ToolFactory.makeWriter(targetFilename,
mediaReader);
mediaReader.addListener(mediaWriter);
// create a media viewer with stats enabled
// IMediaViewer mediaViewer = ToolFactory.makeViewer(true);
//
// mediaReader.addListener(mediaViewer);
while (mediaReader.readPacket() == null)
;
}
示例7: testModifyMedia
import com.xuggle.mediatool.ToolFactory; //导入依赖的package包/类
@Test
public void testModifyMedia() {
IMediaReader mediaReader = ToolFactory.makeReader(targetFilename);
// configure it to generate buffer images
mediaReader
.setBufferedImageTypeToGenerate(BufferedImage.TYPE_3BYTE_BGR);
IMediaWriter mediaWriter = ToolFactory.makeWriter(targetAvi,
mediaReader);
IMediaTool imageMediaTool = new StaticImageMediaTool(targetImage);
IMediaTool audioVolumeMediaTool = new VolumeAdjustMediaTool(0.3);
mediaReader.addListener(imageMediaTool);
imageMediaTool.addListener(audioVolumeMediaTool);
audioVolumeMediaTool.addListener(mediaWriter);
while (mediaReader.readPacket() == null)
;
}
示例8: testSplittingIntoTwo
import com.xuggle.mediatool.ToolFactory; //导入依赖的package包/类
@Test
public void testSplittingIntoTwo() {
String source = "D:/worksap/HUE-kickoff/team-introduction/SRE.mp4";
String target1 = "D:/worksap/HUE-kickoff/team-introduction/SRE-1.mp4";
String target2 = "D:/worksap/HUE-kickoff/team-introduction/SRE-2.mp4";
IMediaReader reader = ToolFactory.makeReader(source);
CutChecker cutChecker = new CutChecker();
reader.addListener(cutChecker);
IMediaWriter writer = ToolFactory.makeWriter(target1, reader);
cutChecker.addListener(writer);
boolean updated = false;
while (reader.readPacket() == null) {
// 15 below is the point to split, in seconds
if ((cutChecker.currentTimestamp >= 15 * 1000000) && (!updated)) {
cutChecker.removeListener(writer);
writer.close();
writer = ToolFactory.makeWriter(target2, reader);
cutChecker.addListener(writer);
updated = true;
}
}
}
示例9: testSplittingOnlyOne
import com.xuggle.mediatool.ToolFactory; //导入依赖的package包/类
@Test
public void testSplittingOnlyOne() {
String source = "D:/worksap/HUE-kickoff/team-introduction/SRE.mp4";
String target3 = "D:/worksap/HUE-kickoff/team-introduction/SRE-3.mp4";
IMediaReader reader = ToolFactory.makeReader(source);
CutChecker cutChecker = new CutChecker();
reader.addListener(cutChecker);
boolean updated = false;
while (reader.readPacket() == null) {
// 15 below is the point to split, in seconds
if ((cutChecker.currentTimestamp >= 15 * 1000000) && (!updated)) {
IMediaWriter writer = ToolFactory.makeWriter(target3, reader);
cutChecker.addListener(writer);
updated = true;
}
}
}
示例10: main
import com.xuggle.mediatool.ToolFactory; //导入依赖的package包/类
/**
* Takes a media container (file) as the first argument, opens it,
* plays audio as quickly as it can, and opens up a Swing window and
* displays video frames with <i>roughly</i> the right timing.
*
* @param args Must contain one string which represents a filename
*/
public static void main(String[] args) {
args = new String[] { "D:\\worksap\\HUE-kickoff\\team-introduction\\SRE.mp4" };
if (args.length <= 0)
throw new IllegalArgumentException(
"must pass in a filename as the first argument");
// create a new mr. decode an play audio and video
IMediaReader reader = ToolFactory.makeReader(args[0]);
reader.addListener(ToolFactory.makeViewer());
while (reader.readPacket() == null)
do {
} while (false);
}
示例11: setUp
import com.xuggle.mediatool.ToolFactory; //导入依赖的package包/类
/**
* Performs a check of the setup.
*
* @return null if OK, otherwise error message
*/
@Override
public String setUp() {
String result;
result = super.setUp();
if (result == null) {
m_Writer = ToolFactory.makeWriter(m_Output.getAbsolutePath());
m_Writer.addVideoStream(0, 0, CAPTURE_FORMAT, m_ScreenPortion.width, m_ScreenPortion.height);
}
return result;
}
示例12: startRecordingStream
import com.xuggle.mediatool.ToolFactory; //导入依赖的package包/类
public void startRecordingStream(File videoFile) {
if (logger.isDebugEnabled()) logger.debug("Writing Video Feed To: {}", videoFile.getAbsoluteFile());
videoWriterStream = ToolFactory.makeWriter(videoFile.getName());
videoWriterStream.addVideoStream(0, 0, ICodec.ID.CODEC_ID_H264, getFeedWidth(), getFeedHeight());
recordingStartTime = System.currentTimeMillis();
isFirstStreamFrame = true;
recordingStream = true;
}
示例13: startRecordingCalibratedArea
import com.xuggle.mediatool.ToolFactory; //导入依赖的package包/类
public void startRecordingCalibratedArea(File videoFile, int width, int height) {
if (logger.isDebugEnabled()) logger.debug("Writing Video Feed To: {}", videoFile.getAbsoluteFile());
videoWriterCalibratedArea = ToolFactory.makeWriter(videoFile.getName());
videoWriterCalibratedArea.addVideoStream(0, 0, ICodec.ID.CODEC_ID_H264, width, height);
recordingCalibratedAreaStartTime = System.currentTimeMillis();
isFirstCalibratedAreaFrame = true;
recordingCalibratedArea = true;
}
示例14: PlaybackContext
import com.xuggle.mediatool.ToolFactory; //导入依赖的package包/类
public PlaybackContext(File videoFile, PlaybackListener listener) {
this.listener = listener;
mediaReader = ToolFactory.makeReader(videoFile.getPath());
mediaReader.setBufferedImageTypeToGenerate(BufferedImage.TYPE_3BYTE_BGR);
mediaReader.open();
duration = mediaReader.getContainer().getDuration() / 1000; // microseconds
// to
// milliseconds
mediaReader.addListener(this);
}
示例15: run
import com.xuggle.mediatool.ToolFactory; //导入依赖的package包/类
public void run() {
if (videoFile == null)
return;
IMediaReader reader = ToolFactory.makeReader(videoFile.getAbsolutePath());
reader.setBufferedImageTypeToGenerate(BufferedImage.TYPE_3BYTE_BGR);
reader.addListener(this);
logger.trace("opening {}", videoFile.getAbsolutePath());
while (reader.readPacket() == null)
do {} while (false);
}