1

Hello all i am new in android developing. I want to create video from sequence of images. And i already fetch images from the specific folder which is resides in external memory card in android devices but i do not know how to use FF MPEG library to convert images into a video file. i had much tried to find out solution but yet i could not get the solution. Any help would be appreciated and Thanks in advance.

I implement below code but it does not working.

private void convertImg_to_vid() {

    // TODO Auto-generated method stub
    Process chperm;
    try {
        chperm=Runtime.getRuntime().exec("su");
          DataOutputStream os = 
              new DataOutputStream(chperm.getOutputStream());

              os.writeBytes("ffmpeg -f image2 -i img%d.jpg /tmp/a.mpg\n");
              os.flush();

              chperm.waitFor();

    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
Jignesh Patel
  • 27
  • 1
  • 7
  • [take a look on this answer](http://stackoverflow.com/a/21304505/2749470) – Bhargav Modi Feb 24 '15 at 10:49
  • Run the `ffmpeg` command manually in command-line interface. If it works then the problem is with your code. If it does not work then include the actual `ffmpeg` command and the complete console output. – llogan Feb 24 '15 at 18:29

1 Answers1

0

You can use -loop command like this ffmpeg -loop 1 -i img.png -c:v libx264 -t 30 -pix_fmt yuv420p out.mp4. This will loop single image as mentioned here. https://trac.ffmpeg.org/wiki/Create%20a%20video%20slideshow%20from%20images

and the documentation http://ffmpeg.org/ffmpeg.html

budthapa
  • 974
  • 14
  • 22