org.jcodec.common.NIOUtils Java Examples
The following examples show how to use
org.jcodec.common.NIOUtils.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SequenceEncoderMp4.java From ImageToVideo with Apache License 2.0 | 6 votes |
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>(); }
Example #2
Source File: SequenceEncoderMp4.java From ImageToVideo with Apache License 2.0 | 5 votes |
public void finish() throws IOException { // Push saved SPS/PPS to a special storage in MP4 outTrack.addSampleEntry(H264Utils.createMOVSampleEntry(spsList, ppsList, 4)); // Write MP4 header and finalize recording muxer.writeHeader(); NIOUtils.closeQuietly(ch); }
Example #3
Source File: JCodecVideoDecoder.java From cineast with MIT License | 5 votes |
@Override public void close(){ this.fg = null; NIOUtils.closeQuietly(this.channel); this.channel = null; LOGGER.info("closed JCodecVideoDecoder"); }
Example #4
Source File: PMTSection.java From mpegts-streamer with Apache License 2.0 | 5 votes |
static List<Tag> parseTags(ByteBuffer bb) { List<Tag> tags = new ArrayList<Tag>(); while (bb.hasRemaining()) { int tag = bb.get(); int tagLen = bb.get(); tags.add(new Tag(tag, NIOUtils.read(bb, tagLen))); } return tags; }
Example #5
Source File: ImageToMJPEGMOVMuxer.java From CameraV with GNU General Public License v3.0 | 5 votes |
public void finish() throws IOException { videoTrack.addSampleEntry(MP4Muxer.videoSampleEntry(imageType, size, ENCODER_NAME)); // Write MP4 header and finalize recording if (af != null) audioTrack.addSampleEntry(MP4Muxer.audioSampleEntry(af)); muxer.writeHeader(); NIOUtils.closeQuietly(ch); }
Example #6
Source File: ImageToH264MP4Encoder.java From CameraV with GNU General Public License v3.0 | 5 votes |
public void finish() throws IOException { // Push saved SPS/PPS to a special storage in MP4 outTrack.addSampleEntry(H264Utils.createMOVSampleEntry(spsList, ppsList, 4)); audioTrack.addSampleEntry(MP4Muxer.audioSampleEntry(af)); // Write MP4 header and finalize recording muxer.writeHeader(); NIOUtils.closeQuietly(ch); }
Example #7
Source File: ImageToVP8Encoder.java From CameraV with GNU General Public License v3.0 | 4 votes |
public void finish() throws IOException { muxer.mux(ch); NIOUtils.closeQuietly(ch); }
Example #8
Source File: YUVtoWebmMuxer.java From CameraV with GNU General Public License v3.0 | 2 votes |
public void finish() throws IOException { NIOUtils.closeQuietly(ch); }