当前位置: 首页>>代码示例>>Java>>正文


Java NIOUtils.writableFileChannel方法代码示例

本文整理汇总了Java中org.jcodec.common.NIOUtils.writableFileChannel方法的典型用法代码示例。如果您正苦于以下问题:Java NIOUtils.writableFileChannel方法的具体用法?Java NIOUtils.writableFileChannel怎么用?Java NIOUtils.writableFileChannel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jcodec.common.NIOUtils的用法示例。


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

示例1: SequenceEncoderMp4

import org.jcodec.common.NIOUtils; //导入方法依赖的package包/类
public SequenceEncoderMp4(File out)
        throws IOException
{
    super(out);
    this.ch = NIOUtils.writableFileChannel(out);

    // Muxer that will store the encoded frames
    muxer = new MP4Muxer(ch, Brand.MP4);

    // Add video track to muxer
    outTrack = muxer.addTrack(TrackType.VIDEO, 5);

    // Allocate a buffer big enough to hold output frames
    _out = ByteBuffer.allocate(1920 * 1080 * 6);

    // Create an instance of encoder
    encoder = new H264Encoder();

    // Transform to convert between RGB and YUV
    transform = ColorUtil.getTransform(ColorSpace.RGB, encoder.getSupportedColorSpaces()[0]);

    // Encoder extra data ( SPS, PPS ) to be stored in a special place of
    // MP4
    spsList = new ArrayList<ByteBuffer>();
    ppsList = new ArrayList<ByteBuffer>();
}
 
开发者ID:hiliving,项目名称:P2Video-master,代码行数:27,代码来源:SequenceEncoderMp4.java

示例2: SequenceEncoderMp4

import org.jcodec.common.NIOUtils; //导入方法依赖的package包/类
public SequenceEncoderMp4(File out)
        throws IOException
{
    super(out);
    this.ch = NIOUtils.writableFileChannel(out);

    // Muxer that will store the encoded frames
    muxer = new MP4Muxer(ch, Brand.MP4);

    // Add video track to muxer
    outTrack = muxer.addTrack(TrackType.VIDEO, timeScale);

    // Allocate a buffer big enough to hold output frames
    _out = ByteBuffer.allocate(1920 * 1080 * 6);

    // Create an instance of encoder
    encoder = new H264Encoder();

    // Transform to convert between RGB and YUV
    transform = ColorUtil.getTransform(ColorSpace.RGB, encoder.getSupportedColorSpaces()[0]);

    // Encoder extra data ( SPS, PPS ) to be stored in a special place of
    // MP4
    spsList = new ArrayList<ByteBuffer>();
    ppsList = new ArrayList<ByteBuffer>();
}
 
开发者ID:ynztlxdeai,项目名称:ImageToVideo,代码行数:27,代码来源:SequenceEncoderMp4.java

示例3: SequenceImagesEncoder

import org.jcodec.common.NIOUtils; //导入方法依赖的package包/类
public SequenceImagesEncoder(File out, int screenWidth, int screenHeight) throws IOException {
    this.ch = NIOUtils.writableFileChannel(out);

    // Transform to convert between RGB and YUV
    transform = new RgbToYuv420(0, 0);

    // Muxer that will store the encoded frames
    muxer = new MP4Muxer(ch, Brand.MP4);

    // Add video track to muxer
    outTrack = muxer.addTrackForCompressed(TrackType.VIDEO, timescale);

    // Allocate a buffer big enough to hold output frames
    _out = ByteBuffer.allocate(screenWidth * screenHeight * 6);

    // Create an instance of encoder
    encoder = new H264Encoder();

    // Encoder extra data ( SPS, PPS ) to be stored in a special place of
    // MP4
    spsList = new ArrayList<ByteBuffer>();
    ppsList = new ArrayList<ByteBuffer>();

}
 
开发者ID:rafaelaaraujo,项目名称:Face-detect-framework,代码行数:25,代码来源:SequenceImagesEncoder.java

示例4: SequenceEncoder

import org.jcodec.common.NIOUtils; //导入方法依赖的package包/类
public SequenceEncoder(File out, int frameRate) throws IOException {
    this.ch = NIOUtils.writableFileChannel(out);

    // Transform to convert between RGB and YUV
    transform = new RgbToYuv420(0, 0);

    // Muxer that will store the encoded frames
    muxer = new MP4Muxer(ch, Brand.MP4);

    // Add video track to muxer
    outTrack = muxer.addTrackForCompressed(TrackType.VIDEO, frameRate);// original frmae rate is 25

    // Allocate a buffer big enough to hold output frames
    _out = ByteBuffer.allocate(1920 * 1080 * 6);

    // Create an instance of encoder
    encoder = new H264Encoder();

    // Encoder extra data ( SPS, PPS ) to be stored in a special place of
    // MP4
    spsList = new ArrayList<ByteBuffer>();
    ppsList = new ArrayList<ByteBuffer>();

}
 
开发者ID:deepakpk009,项目名称:JScreenRecorder,代码行数:25,代码来源:SequenceEncoder.java

示例5: SequenceEncoder

import org.jcodec.common.NIOUtils; //导入方法依赖的package包/类
public SequenceEncoder(File out) throws IOException {
    this.ch = NIOUtils.writableFileChannel(out);

    // Muxer that will store the encoded frames
    muxer = new MP4Muxer(ch, Brand.MP4);

    // Add video track to muxer
    outTrack = muxer.addTrack(TrackType.VIDEO, 25);

    // Allocate a buffer big enough to hold output frames
    _out = ByteBuffer.allocate(1920 * 1080 * 6);

    // Create an instance of encoder
    encoder = new H264Encoder();

    // Transform to convert between RGB and YUV
    transform = ColorUtil.getTransform(ColorSpace.RGB, encoder.getSupportedColorSpaces()[0]);

    // Encoder extra data ( SPS, PPS ) to be stored in a special place of
    // MP4
    spsList = new ArrayList<ByteBuffer>();
    ppsList = new ArrayList<ByteBuffer>();

}
 
开发者ID:PenoaksDev,项目名称:OpenSpaceDVR,代码行数:25,代码来源:SequenceEncoder.java

示例6: main

import org.jcodec.common.NIOUtils; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
    FilePool fp = new FilePool(new File(args[0]), 10);
    MPSTrackFactory factory = new MPSTrackFactory(NIOUtils.fetchFrom(new File(args[1])), fp);
    Stream stream = factory.getVideoStreams().get(0);
    FileChannelWrapper ch = NIOUtils.writableFileChannel(new File(args[2]));

    List<VirtualPacket> pkt = new ArrayList<VirtualPacket>();
    for (int i = 0; i < 2000; i++) {
        pkt.add(stream.nextPacket());
    }

    for (VirtualPacket virtualPacket : pkt) {
        ch.write(virtualPacket.getData());
    }

    ch.close();
}
 
开发者ID:PenoaksDev,项目名称:OpenSpaceDVR,代码行数:18,代码来源:MPSTrackFactory.java

示例7: main

import org.jcodec.common.NIOUtils; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
    FilePool fp = new FilePool(new File(args[0]), 10);
    MTSTrackFactory factory = new MTSTrackFactory(NIOUtils.fetchFrom(new File(args[1])), fp);
    Stream stream = factory.getVideoStreams().get(0);
    FileChannelWrapper ch = NIOUtils.writableFileChannel(new File(args[2]));

    List<VirtualPacket> pkt = new ArrayList<VirtualPacket>();
    for (int i = 0; i < 2000; i++) {
        pkt.add(stream.nextPacket());
    }

    for (VirtualPacket virtualPacket : pkt) {
        ch.write(virtualPacket.getData());
    }

    ch.close();
}
 
开发者ID:PenoaksDev,项目名称:OpenSpaceDVR,代码行数:18,代码来源:MTSTrackFactory.java

示例8: Encoder

import org.jcodec.common.NIOUtils; //导入方法依赖的package包/类
public Encoder(File out, int width, int height) throws IOException {
    this.ch = NIOUtils.writableFileChannel(out);
    _out = ByteBuffer.allocate(width * height * 6);
    encoder = new H264Encoder();
    spsList = new ArrayList<ByteBuffer>();
    ppsList = new ArrayList<ByteBuffer>();


    this.ch = NIOUtils.writableFileChannel(out);
    muxer = new MP4Muxer(ch, Brand.MP4);
    outTrack = muxer.addTrackForCompressed(TrackType.VIDEO, 25);
}
 
开发者ID:kamil-karkus,项目名称:EasySnap,代码行数:13,代码来源:Encoder.java

示例9: MP4H264Muxer

import org.jcodec.common.NIOUtils; //导入方法依赖的package包/类
/**
 * NALProcessor to mux a raw h264 stream into a mp4 file
 * 
 * @param file File to save to
 * @param fps frame rate of the video
 * @param width Width of the video
 * @param height Height of the video
 * @throws IOException 
 */
public MP4H264Muxer(File file, int fps, int width, int height) throws IOException
{
   this.width = width;
   this.height = height;

   channel = NIOUtils.writableFileChannel(file);
   muxer = new MP4Muxer(channel);

   timescale = fps;
   track = muxer.addTrack(TrackType.VIDEO, timescale);
}
 
开发者ID:ihmcrobotics,项目名称:ihmc-video-codecs,代码行数:21,代码来源:MP4H264Muxer.java

示例10: MP4MJPEGMovieBuilder

import org.jcodec.common.NIOUtils; //导入方法依赖的package包/类
/**
 * Create an MP4 file with MJPEG
 * 
 * @param file Output file
 * @param width Frame width
 * @param height Frame height
 * @param framerate
 * @param quality JPEG quality 0 - 100
 * @throws IOException
 */
public MP4MJPEGMovieBuilder(File file, int width, int height, int framerate, int quality) throws IOException
{
   channel = NIOUtils.writableFileChannel(file);
   muxer = new MP4Muxer(channel);

   timescale = framerate;
   track = muxer.addTrack(TrackType.VIDEO, timescale);

   this.width = width;
   this.height = height;
   this.quality = quality;
}
 
开发者ID:ihmcrobotics,项目名称:ihmc-video-codecs,代码行数:23,代码来源:MP4MJPEGMovieBuilder.java

示例11: SequenceMuxer

import org.jcodec.common.NIOUtils; //导入方法依赖的package包/类
public SequenceMuxer(File out) throws IOException {
    this.ch = NIOUtils.writableFileChannel(out);

    // Muxer that will store the encoded frames
    muxer = new MP4Muxer(ch, Brand.MP4);

    // Add video track to muxer
    outTrack = muxer.addTrack(TrackType.VIDEO, 25);
}
 
开发者ID:PenoaksDev,项目名称:OpenSpaceDVR,代码行数:10,代码来源:SequenceMuxer.java

示例12: main

import org.jcodec.common.NIOUtils; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
    FileChannelWrapper ch = null;
    FileChannelWrapper out = null;
    try {
        ch = NIOUtils.readableFileChannel(new File(args[0]));
        out = NIOUtils.writableFileChannel(new File(args[1]));
        new MKVShiftTimecodes(Integer.parseInt(args[2])).run(ch, out);
    } finally {
        NIOUtils.closeQuietly(ch);
        NIOUtils.closeQuietly(out);
    }
}
 
开发者ID:PenoaksDev,项目名称:OpenSpaceDVR,代码行数:13,代码来源:MKVShiftTimecodes.java

示例13: saveRawFrame

import org.jcodec.common.NIOUtils; //导入方法依赖的package包/类
public static void saveRawFrame(ByteBuffer data, AvcCBox avcC, File f) throws IOException {
    SeekableByteChannel raw = NIOUtils.writableFileChannel(f);
    saveStreamParams(avcC, raw);
    raw.write(data.duplicate());
    raw.close();
}
 
开发者ID:PenoaksDev,项目名称:OpenSpaceDVR,代码行数:7,代码来源:H264Utils.java


注:本文中的org.jcodec.common.NIOUtils.writableFileChannel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。