私のアプリケーションでは、surfaceiew を使用して Android でビデオを撮影しています。onpreviewFrame メソッドでフレームを取得するコードを書きましたが、ビデオのすべてのフレームを取得できないという問題があります。約 14 秒のビデオをキャプチャしていますが、約 90 フレームしか取得できません。フレームレートは 30 fps、画像サイズは 800 x 480 です。
onPreviewFrame メソッドでフレームを取得するためのコードは次のとおりです。
formattedFileCount = fileCountFormatter.format(fileCount);
jpegFile = new File(Environment
.getExternalStorageDirectory().getPath()
+ "/abc/foo-"
+ formattedFileCount + ".jpg");
fileCount++;
Camera.Parameters parameters = camera.getParameters();
Size size = parameters.getPreviewSize();
YuvImage image = new YuvImage(b,
parameters.getPreviewFormat(), 800,
480, null);
fos = new FileOutputStream(jpegFile);
bos = new BufferedOutputStream(fos);
image.compressToJpeg(
new Rect(0, 0, image.getWidth(), image.getHeight()),
90, bos);
したがって、約 14 秒のビデオの場合、合計フレーム数は 420 になりますが、取得できるフレーム数は 100 フレーム未満です。そのための解決策はありますか?