bytedeco/javacv

FFmpegFrameGrabber's png image pipeline decodes dropped frames

Open

#2,025 opened on May 15, 2023

View on GitHub
 (3 comments) (0 reactions) (0 assignees)Java (1,583 forks)batch import
help wantedquestion

Repository metrics

Stars
 (6,985 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

This is my image input pseudocode

int inputCount=0;
whlie(true) {
   byte[] imageBytes = producePngImage();
   if (inputBytes.length == 0) {
       continue;
   }
   pipeOutputStream.write(imageBytes);
   inputCount++;
}

this is my FFmpegFrameGrabber's pseudocode

FFmpegFrameGrabber g= new FFmpegFrameGrabber(pipeInputStream, 0);
g.setImageWidth(width);
g.setImageheight(height);
g.setImageMode(ImageMode.RAW);
g.setFormat("image2pipe");
g.setPixelFormat(AV_PIX_FMT_BGR24);
g.start()

Frame frame;
int count=0
while((frame = g.grab()) != null) {
   count++;
   recorder.record(frame);
}

But the above two counters inputCount are not equal to count, always 16 frames less

Contributor guide