bytedeco/javacv
View on GitHubSome problem with these code, sometime recorder may blocked?
Open
#2,180 opened on Jan 30, 2024
help wantedquestion
Repository metrics
- Stars
- (6,985 stars)
- PR merge metrics
- (No merged PRs in 30d)
Description
FFmpegFrameRecorder recorder = new FFmpegFrameRecorder(localPath, width, height);
recorder.setVideoCodec(avcodec.AV_CODEC_ID_H264);
recorder.setFrameRate(frame);
recorder.setPixelFormat(avutil.AV_PIX_FMT_YUV420P);
recorder.setFormat("mp4");
recorder.start();
Future<Void> future =closeTaskExecutor.submit(()->{
int index = imgMap.firstKey();
int maxIndex = imgMap.lastKey();
try {
for(int i =0; i<timeSlash; i++) {
for(int j =0; j<frame; j++) {
sb.append(" " + index);
File file = imgMap.get(index);
if (null == file){
continue;
}
recorder.record(imgFrameMap2.get(index).get());
index++;
if (index > maxIndex) {
break;
}
}
}
}catch (Exception e) {
LOGGER.error("e, ", e);
}finally {
LOGGER.info("future release record!");
try {
recorder.stop();
recorder.release();
}catch (Exception e){
LOGGER.warn("e ", e);
}
}
return null;
});
most of the time run very well record finished in 300ms , but when request press goes up, some times it record slowly , may cost more than 20s, some problem with the implemention? May javacv + ffmpeg some component would be blocked?
version info : org.bytedeco:javacv-platform:1.5.5 org.bytedeco:ffmpeg:4.3.2-1.5.5:linux-x86_64