/** * 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); }
/** * 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; }
/** * 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); }
/** * 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; }
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>(); }