本文整理汇总了Java中com.xuggle.mediatool.ToolFactory.makeWriter方法的典型用法代码示例。如果您正苦于以下问题:Java ToolFactory.makeWriter方法的具体用法?Java ToolFactory.makeWriter怎么用?Java ToolFactory.makeWriter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.xuggle.mediatool.ToolFactory
的用法示例。
在下文中一共展示了ToolFactory.makeWriter方法的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: 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)
;
}
示例6: 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)
;
}
示例7: 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;
}
}
}
示例8: 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;
}
}
}
示例9: 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;
}
示例10: 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;
}
示例11: 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;
}
示例12: encode
import com.xuggle.mediatool.ToolFactory; //导入方法依赖的package包/类
public void encode() {
IMediaReader mediaReader = ToolFactory.makeReader(input);
mediaReader.setBufferedImageTypeToGenerate(BufferedImage.TYPE_3BYTE_BGR);
mediaReader.addListener(new Transcoder());
writer = ToolFactory.makeWriter(output, mediaReader);
mediaReader.addListener(writer);
while (mediaReader.readPacket() == null) {
// read through input and process using the MediaWriter listener
}
}
示例13: run
import com.xuggle.mediatool.ToolFactory; //导入方法依赖的package包/类
@Override
public void run() {
outputFile=new File("/tmp/res.wav");
writer = ToolFactory.makeWriter(outputFile.getAbsolutePath(), reader);
this.addListener(writer);
while (reader.readPacket() == null) {
}
}
示例14: init
import com.xuggle.mediatool.ToolFactory; //导入方法依赖的package包/类
private void init() {
mWriter = ToolFactory.makeWriter(XugglerIO.map(outputStream));
// manually set the container format (because it can't detect it by filename anymore)
IContainerFormat containerFormat = IContainerFormat.make();
containerFormat.setOutputFormat("flv", null, "application/flv");
mWriter.getContainer().setFormat(containerFormat);
// add the video stream
mWriter.addVideoStream(0, 0, ICodec.ID.CODEC_ID_H264, IRational.make(getFrameRate()), getVideoSize().width, getVideoSize().height);
}
示例15: createVideoFromScreens
import com.xuggle.mediatool.ToolFactory; //导入方法依赖的package包/类
public void createVideoFromScreens() {
IMediaWriter writer = null;
try {
if (getOutputFile() == null) {
throw new IllegalStateException(
"Output video file cannot be null");
}
setStoppedCreation(false);
writer = ToolFactory.makeWriter(getOutputFile()
.getAbsolutePath());
writer.addVideoStream(0, 0, SCREEEN_BOUNDS.width,
SCREEEN_BOUNDS.height);
long startTime = System.nanoTime();
while (!getPleaseStop()) {
BufferedImage screen = getDesktopScreenshot();
BufferedImage bgrScreen = convertToType(screen, BufferedImage.TYPE_3BYTE_BGR);
writer.encodeVideo(0, bgrScreen, System.nanoTime() - startTime, TimeUnit.NANOSECONDS);
try {
Thread.currentThread().sleep(1000 / FRAME_RATE);
} catch (InterruptedException e) {
// Ignore
}
}
setStoppedCreation(true);
} finally {
if(writer!=null){
writer.flush();
writer.close();
}
}
}