本文整理汇总了Java中com.xuggle.xuggler.IContainerFormat.make方法的典型用法代码示例。如果您正苦于以下问题:Java IContainerFormat.make方法的具体用法?Java IContainerFormat.make怎么用?Java IContainerFormat.make使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.xuggle.xuggler.IContainerFormat
的用法示例。
在下文中一共展示了IContainerFormat.make方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSupportedCodecs
import com.xuggle.xuggler.IContainerFormat; //导入方法依赖的package包/类
/**
* Given the short name of a container, prints out information about
* it, including which codecs Xuggler can write (mux) into that container.
*
* @param name the short name of the format (e.g. "flv")
*/
public static void getSupportedCodecs(String name) {
IContainerFormat format = IContainerFormat.make();
format.setOutputFormat(name, null, null);
List<ID> codecs = format.getOutputCodecsSupported();
if (codecs.isEmpty())
System.out.println("no supported codecs for "+name); //$NON-NLS-1$
else {
System.out.println(name+" ("+format+") supports following codecs:"); //$NON-NLS-1$ //$NON-NLS-2$
for(ID id : codecs) {
if (id != null) {
ICodec codec = ICodec.findEncodingCodec(id);
if (codec != null) {
System.out.println(codec);
}
}
}
}
}
示例2: setup
import com.xuggle.xuggler.IContainerFormat; //导入方法依赖的package包/类
public void setup(final SegmentFacade facade, ISimpleMediaFile outputStreamInfo) {
log.debug("setup {}", outputUrl);
this.outputStreamInfo = outputStreamInfo;
this.facade = facade;
// output to a custom handler
outputStreamInfo.setURL(outputUrl);
// setup our mpeg-ts io handler
MpegTsIoHandler outputHandler = new MpegTsIoHandler(outputUrl, facade);
MpegTsHandlerFactory.getFactory().registerStream(outputHandler, outputStreamInfo);
// create a container
container = IContainer.make();
log.trace("Container buffer length: {}", container.getInputBufferLength());
// create format
containerFormat = IContainerFormat.make();
containerFormat.setOutputFormat("mpegts", outputUrl, null);
}
示例3: setEncodingParameters
import com.xuggle.xuggler.IContainerFormat; //导入方法依赖的package包/类
/**
* A quick hack. Encoding paramaters are hard-coded here.
*
* @throws IOException
*/
@Override
public void setEncodingParameters() throws IOException {
containerFormat = IContainerFormat.make();
containerFormat.setOutputFormat("avi", null, null);
// ObjectOutputStream oos = new ObjectOutputStream();
// oos.writeObject(containerFormat);
streamCoders = new IStreamCoder[] { IStreamCoder
.make(IStreamCoder.Direction.ENCODING) };
ICodec codec = ICodec.guessEncodingCodec(containerFormat, null, null,
null, ICodec.Type.CODEC_TYPE_VIDEO);
streamCoders[0].setNumPicturesInGroupOfPictures(1);
streamCoders[0].setCodec(codec);
streamCoders[0].setBitRate(25000);
streamCoders[0].setBitRateTolerance(9000);
streamCoders[0].setPixelType(IPixelFormat.Type.YUV420P);
streamCoders[0].setWidth(352);
streamCoders[0].setHeight(288);
streamCoders[0].setFlag(IStreamCoder.Flags.FLAG_QSCALE, true);
streamCoders[0].setGlobalQuality(0);
IRational frameRate = IRational.make(25, 1);
streamCoders[0].setFrameRate(frameRate);
streamCoders[0].setTimeBase(IRational.make(frameRate.getDenominator(),
frameRate.getNumerator()));
}
示例4: saveScratch
import com.xuggle.xuggler.IContainerFormat; //导入方法依赖的package包/类
/**
* Saves the video to the current scratchFile.
*
* @throws IOException
*/
@Override
protected void saveScratch() throws IOException {
FileFilter fileFilter = videoType.getDefaultFileFilter();
if (!hasContent || !(fileFilter instanceof VideoFileFilter))
return;
// set container format
IContainerFormat format = IContainerFormat.make();
VideoFileFilter xuggleFilter = (VideoFileFilter)fileFilter;
format.setOutputFormat(xuggleFilter.getContainerType(), null, null);
// set the pixel type--may depend on selected fileFilter?
IPixelFormat.Type pixelType = IPixelFormat.Type.YUV420P;
// open the output stream, write the images, close the stream
openStream(format, pixelType);
// open temp images and encode
long timeStamp = 0;
int n=0;
synchronized (tempFiles) {
for (File imageFile: tempFiles) {
if (!imageFile.exists())
throw new IOException("temp image file not found"); //$NON-NLS-1$
BufferedImage image = ResourceLoader.getBufferedImage(imageFile.getAbsolutePath(), BufferedImage.TYPE_3BYTE_BGR);
if (image==null || image.getType()!=BufferedImage.TYPE_3BYTE_BGR) {
throw new IOException("unable to load temp image file"); //$NON-NLS-1$
}
encodeImage(image, pixelType, timeStamp);
n++;
timeStamp = Math.round(n*frameDuration*1000); // frameDuration in ms, timestamp in microsec
}
}
closeStream();
deleteTempFiles();
hasContent = false;
canRecord = false;
}