Reputation: 4827
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
}
Upvotes: 1
Views: 696
Reputation: 1504
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.
Upvotes: 1