I’m working on a java project to create a rtmp server and download the real-time flv video every second(need to download multiple recording frame secondly instead of download entire recording after live stream finished)
This is my logic, firstly listen to the rtmp channel to write video and audio into file
if(msg instanceof VideoMessage vm){
byteArrayOutputStream = new ByteArrayOutputStream();
byteArrayOutputStream.writeBytes(vm.getVideoData());
File file = new File("tmp/video_" + i);
FileOutputStream fos = new FileOutputStream(file);
fos.write(byteArrayOutputStream.toByteArray());
fos.close();
}
Then decode to H264 to get playable flv file
FFmpegFrameGrabber grabber = new FFmpegFrameGrabber(input);
grabber.setFormat("h264");
grabber.start();
FFmpegFrameRecorder recorder = new FFmpegFrameRecorder(outputFilePath, grabber.getImageWidth(), grabber.getImageHeight());
recorder.start();
while ((frame = grabber.grab()) != null) {
recorder.record(frame);
}
grabber.stop();
grabber.release();
recorder.stop();
recorder.release();
}
But this login was failed. I met this issue when I implemented the ffmpeg
data partitioning is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
Is there any other idea to solve this or other way to achieve the logic? Thanks
Chenguang He is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1