FFMPEG:Multiple Image frames + 1 Audio =1 Video

前端 未结 4 1709
囚心锁ツ
囚心锁ツ 2020-12-01 20:43

I am using this library Android-MJPEG-Video-Capture-FFMPEG to and getting the frames with using the camera..I am Using below FFMPEG command for this

String[         


        
4条回答
  •  余生分开走
    2020-12-01 21:00

    I found the solution after applied lot of tricks.

    public void myFunction(ShellCallback sc, String imgPath, String audioPath, String outPath) throws IOException, InterruptedException
        {
    
            Log.e("MyFunction","audioPath"+audioPath);
            Log.e("MyFunction","imagePath"+imgPath);
            ArrayList cmd = new ArrayList();
    
            cmd = new ArrayList();
    
            cmd.add(ffmpegBin);
            cmd.add("-y");
            cmd.add("-loop");
            cmd.add("1");
            cmd.add("-r");
            cmd.add("1");
            cmd.add("-i");
            cmd.add(new File(imgPath).getCanonicalPath());
            cmd.add("-i");
            cmd.add(new File(audioPath).getCanonicalPath());
            cmd.add("-acodec");
            cmd.add("aac");
            cmd.add("-vcodec");
            cmd.add("mpeg4");
            cmd.add("-s");
            cmd.add("480x320");
            cmd.add("-strict");
            cmd.add("experimental");
            cmd.add("-b:a");
            cmd.add("32k");
            cmd.add("-shortest");
            cmd.add("-f");
            cmd.add("mp4");
            cmd.add("-r");
            cmd.add("2");
            File fileOut = new File(outPath);
            cmd.add(fileOut.getCanonicalPath());
    
            execFFMPEG(cmd, sc);
        }
    

    I hope this may help others.Thanks!

提交回复
热议问题