0

I want to hide the text on video (in java). I created video from images, and I got a video lossless format. Now, I want to get frame from this video. How can I do it?. This is code that I used:

public class SequenceMuxer {
private SeekableByteChannel ch;
private MuxerTrack outTrack;
private int frameNo;
private MP4Muxer muxer;
private Size size;

public SequenceMuxer(File out) throws IOException {
    this.ch = NIOUtils.writableChannel(out);

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

}

public void encodeImage(File png) throws IOException {
    if (size == null) {
        BufferedImage read = ImageIO.read(png);
        size = new Size(read.getWidth(), read.getHeight());
        // Add video track to muxer
        outTrack = muxer.addVideoTrack(Codec.PNG, VideoCodecMeta.createSimpleVideoCodecMeta(size, ColorSpace.RGB));
    }
    // Add packet to video track
    outTrack.addFrame(MP4Packet.createMP4Packet(NIOUtils.fetchFromFile(png), frameNo, 25, 1, frameNo, FrameType.KEY, null,
            frameNo, frameNo, 0));

    frameNo++;
}

public void finish() throws IOException {
    // Write MP4 header and finalize recording
    muxer.finish();
    NIOUtils.closeQuietly(ch);
}

}

cello
  • 5,356
  • 3
  • 23
  • 28
MeiMei
  • 1
  • They are various questions on SO about extracting frames from a video in java. Is any of them applicable to your situation? – Reti43 Oct 15 '17 at 09:24
  • i try getting all frames from this video, but i do not get any frames. This is code i used: [link](https://github.com/jcodec/jcodec) – MeiMei Oct 15 '17 at 13:49
  • You should edit your question and show the actual code you wrote for extracting the frames. Read [how to write a minimal, complete and verifiable example](https://stackoverflow.com/help/mcve). – Reti43 Oct 15 '17 at 13:58

0 Answers0