FFmpegFrameRecorder

   file=new File(sdcard+"ok.mp4");
    if (!file.exists()){
        try {
            file.createNewFile();
        }catch (IOException e){

      }
       }
        try{
      //      File file1=new File(sdcard+"1.mp4");
       //     file1.createNewFile();
        //    recorder= new FFmpegFrameRecorder(
         //   sdcard+"ok.mp4", 1080,
          //  720);
            recorder=new FFmpegFrameRecorder(file,2100,2100,0);
        //    File file11=new File(sdcard+"11.mp4");
       //     file11.createNewFile();
           // testBitmap.recycle();
        }

        catch (Exception e){
         //   Toast.makeText(getApplicationContext(), "recorder", Toast.LENGTH_LONG).show();
        }
    recorder.setFormat("mp4");
    recorder.setFrameRate(20);// 褰曞儚甯х巼
    recorder.setPixelFormat(avutil.AV_PIX_FMT_YUV420P);
  //  recorder.setSampleRate(20);
//recorder.setVideoCodec(avcodec.AV_CODEC_ID_H264);
  //  recorder.setVideoQuality(0);
//    recorder.setVideoOption("preset", "veryfast");
    try{
   //     File file2=new File(sdcard+"12.mp4");
    //    file2.createNewFile();
        recorder.start();
    }catch (Exception e){
    //    Toast.makeText(getApplicationContext(), "start", Toast.LENGTH_LONG).show();
    }
    for (int index=0;index < 5;index++) {


        try{
          //  recorder.
            image = cvLoadImage(arrayList.get(index));

            testBitmap = VideoCapture.getImageByPath(arrayList.get(index));
            image.alphaChannel(100);
            for (int i=0;i<50;i++){
               recorder.setImageWidth(100*(index+1));
                recorder.setImageHeight(100*(index+1));

                //  recorder
            recorder.record(image);

            }
            image.release();
        }catch (Exception e){
        //    Toast.makeText(getApplicationContext(), "record", Toast.LENGTH_LONG).show();
        }
testBitmap.recycle();
        index++;
    }
    try{
    recorder.stop();
    }
    catch (Exception e){
   //     Toast.makeText(getApplicationContext(), "stop", Toast.LENGTH_LONG).show();
    }
}
  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值