创建使用ffmpeg的影像视频文件 [英] Create a Video file from images using ffmpeg

查看:163
本文介绍了创建使用ffmpeg的影像视频文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够编译并添加到ffmpeg的JNI文件夹中创建Android.mk文件现在我想用ffmpeg的创建从我已存储在我的静态ArrayList中的图像的视频文件,我的项目

I am able to compile and add ffmpeg to jni folder in my project created Android.mk file now I want to use ffmpeg to create a video file from the images I have stored in my static arraylist

我已经搜索了很多,但找不到任何教程任何帮助,真是AP preciated。

I have searched alot but couldn't find any tutorial any help is really appreciated.

推荐答案

我是在一个类似的需要,完成了相同的。 有中,你可以这样做两种方式。我想先分享简单的办法。

I was in a similar need and accomplished the same. There are two ways in which you can do this. I would like to share the simpler one first.

  • 创建了Android里面的临时文件夹。

  • Create a temporary folder inside the Android.

复制图像的新文件夹

首先,重命名您的图片按照数字顺序。例如,img1.jpg,img2.jpg,img3.jpg,......然后,你可能会遇到:

First, rename your pictures to follow a numerical sequence. For example, img1.jpg, img2.jpg, img3.jpg,... Then you may run:

要以编程方式运行此,

使用下面的code:

void convertImg_to_vid()
{
    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();
    }
}

开始使用这一点。我会帮你。所有最好的

Get started with this. I will help you.. All the best

使用教程: http://ffmpeg.org/faq.html 特别gothrough 3.2节内教程。

Use the tutorial : http://ffmpeg.org/faq.html Specially gothrough 3.2 section inside the tutorial.

要能够运行上面的命令,你应该在bin目录下的ffmpeg命令。 FFmpeg的二进制应交叉编译为Android平台...

To be able to run the above commands, you should have ffmpeg command in bin directory. The ffmpeg binary should be cross compiled for Android platform...

这篇关于创建使用ffmpeg的影像视频文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆