FFmpegFrameRecorder 在录制时添加文本/图像

FFmpegFrameRecorder add text / image while recording

有谁知道如何在使用 JavaCV 的 FFmpegFrameRecorder 录制视频时添加文本、图像?我到处找遍了,一无所获

阅读 JAVCV example 以在 IplImage

中添加文本
FFmpegFrameRecorder recorder = null;

opencv_core.CvFont font = new opencv_core.CvFont(); 
opencv_core.cvInitFont(font, opencv_core.CV_FONT_HERSHEY_SCRIPT_SIMPLEX, 2.0, 2.0, 2, 2, opencv_core.CV_AA);
opencv_core.IplImage bgrImage = opencv_core.IplImage.create(width, height, IPL_DEPTH_8U, 3);;
//...
//init something(eg init recorder,init iplimage...)

opencv_core.cvPutText(bgrImage/*IplImage*/, "Text here", cvPoint(10,10), font, opencv_core.CvScalar.RED);
recorder.record(bgrImage);

或者你可以在位图上绘制文本也可以使用 FFmpegFrameRecorder 进行记录

      Bitmap newImage = Bitmap.createBitmap(width, height, Config.ARGB_8888);
        Canvas c = new Canvas(newImage);
        c.drawBitmap(your_image_bitmap, 0, 0, null);
        Paint paint = new Paint();
        paint.setColor(Color.RED); 
        paint.setStyle(Style.FILL);                
        paint.setTextSize(20);
        c.drawText("Some Text", 0, 25, paint);
org.bytedeco.javacv.AndroidFrameConverter converter2 = new AndroidFrameConverter();
        Frame frames = converter2.convert(newImage );
        recorder.record(frames);