使用下面的JCodec代码,我期待视频显示4张图像,持续3秒,总共12秒。
然而,视频只显示第1张,第2张,第3张图像3秒,然后在9秒停止,但视频的总持续时间为12秒。
任何人都可以帮助我吗?
SeekableByteChannel ch = NIOUtils.writableFileChannel(out);
MP4Muxer muxer = new MP4Muxer(ch, Brand.MP4);
FramesMP4MuxerTrack outTrack = muxer.addTrackForCompressed(TrackType.VIDEO, 1);
outTrack.addFrame(new MP4Packet(NIOUtils.fetchFrom(image1), 0, 1, 3, 0, true, null, 0, 0));
outTrack.addFrame(new MP4Packet(NIOUtils.fetchFrom(image2), 3, 1, 3, 1, true, null, 3, 0));
outTrack.addFrame(new MP4Packet(NIOUtils.fetchFrom(image3), 6, 1, 3, 2, true, null, 6, 0));
outTrack.addFrame(new MP4Packet(NIOUtils.fetchFrom(image4), 9, 1, 3, 3, true, null, 9, 0));
outTrack.addSampleEntry(MP4Muxer.videoSampleEntry("png ", new Size(800, 600), "JCodec"));
muxer.writeHeader();
NIOUtils.closeQuietly(ch);