Question

how can I load bitmap into FFmpegFrameRecorder? My old code loaded it from SD card and now I wish to put id directly. I use javacv.

FFmpegFrameRecorder recorder = new  FFmpegFrameRecorder(Environment.getExternalStorageDirectory().getPath()+ "/MyApp/Media/test-ffmep.mp4", w, h);
public void offerEncoder(Bitmap input) 
{
    recorder.record(opencv_highgui.cvLoadImage(input));
    //recorder.record(opencv_highgui.cvLoadImage("/sdcard/MyApp/Media/" + input + ".bmp")); //input was string
}
Était-ce utile?

La solution

Both bitmap and IplImage can be converted to a bytearray. Both of them support the bytearray interconversion. Then you can use Bitmap.copyPixelsFromBuffer or copyPixelsToBuffer accompanied with IplImage.getByteBuffer().

The thing to keep in mind is, Bitmap is 4 channeled and so should be the IPL-Image.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top