简体   繁体   English

如何在Android上使用ffmpeg录制视频?

[英]How to record video using ffmpeg on android?

I want to create a video using ffmpeg by taking byte[] data from Android Camera. 我想通过从Android Camera中获取byte []数据来使用ffmpeg创建视频。 Now the problem is i don't have much knowledge about ffmpeg. 现在的问题是我对ffmpeg并不了解。 So i need some documentation on ffmpeg. 所以我需要一些关于ffmpeg的文档。 I will appreciate if anyone can provide some useful tutorial / sample code / example on ffmpeg and how it works , how it can be used to create video programmatically, Thanks. 如果有人能在ffmpeg上提供一些有用的教程/示例代码/示例,以及如何工作,如何将其用于以编程方式创建视频,我将不胜感激,谢谢。

ffmpeg is a C library so you will have to use NDK to build it and bridge it together with your Android device using a JNI interface. ffmpeg是一个C库,因此您将不得不使用NDK进行构建,并使用JNI接口将其与Android设备桥接在一起。 As far as I know, I dont think its possible to record a video directly using ffmpeg. 据我所知,我认为不可能直接使用ffmpeg录制视频。 However, you can use openCv to capture video stream then decode/encode it with ffmpeg if you decided to go this route. 但是,如果您决定采用这种方法,则可以使用openCv捕获视频流,然后使用ffmpeg对其进行解码/编码。 Once again, all of this must be done in C/C++, and the information can be sent to the android device via JNI using NDK once you finished processing it with ffmpeg. 再一次,所有这些都必须在C / C ++中完成,一旦使用ffmpeg处理完信息,即可使用NDK通过JNI将信息发送到android设备。

Here is the link to OpenCV Library for Android http://opencv.org/downloads.html 这是指向Android的OpenCV库的链接http://opencv.org/downloads.html

Once downloaded, there are sample projects which show you how to record video using native android camera and as well as using opencv feature. 下载后,有一些示例项目向您展示了如何使用本机android摄像机以及opencv功能录制视频。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM