javacv
javacv copied to clipboard
FFmpegFrameGrabber's png image pipeline decodes dropped frames
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
Are you getting any warning messages? Please make sure that FFmpegLogCallback.set()
has been called.
There is no warn information, I'm sure that has been called.FFmpegLogCallback.set(), and the level setting is info
If I use a YUV420P encoded image with a format of rawvideo, I won't have a problem