All Projects → rockcarry → V4l2test

rockcarry / V4l2test

Licence: gpl-3.0
v4l2 camera test for android platform.

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to V4l2test

Sandrioscamera
Easy integration of camera for image and video capturing with Image Picker.
Stars: ✭ 185 (+293.62%)
Mutual labels:  camera, video-recording
Androidffmpeg
android 读取摄像头和麦克风,使用rtmp推流
Stars: ✭ 298 (+534.04%)
Mutual labels:  camera, ffmpeg
Videocalling
局域网p2p视频聊天
Stars: ✭ 223 (+374.47%)
Mutual labels:  camera, ffmpeg
Cameramanager
Simple Swift class to provide all the configurations you need to create custom camera view in your app
Stars: ✭ 1,130 (+2304.26%)
Mutual labels:  camera, video-recording
Trinity
android video record editor muxer sdk
Stars: ✭ 609 (+1195.74%)
Mutual labels:  camera, ffmpeg
Swiftycam
A Snapchat Inspired iOS Camera Framework written in Swift
Stars: ✭ 1,879 (+3897.87%)
Mutual labels:  camera, video-recording
CAM
macOS camera recording using ffmpeg
Stars: ✭ 43 (-8.51%)
Mutual labels:  camera, ffmpeg
Android
Android app for collecting OpenStreetCam imagery
Stars: ✭ 119 (+153.19%)
Mutual labels:  camera, ffmpeg
Evilslive
This project is a SDK about video stream live
Stars: ✭ 420 (+793.62%)
Mutual labels:  camera, ffmpeg
Android Ffmpeg Camerarecord
使用JavaCV提供的支持, 使用OpenGL实时处理+显示摄像头采集的图像, 并使用FFMPEG实时录制音视频
Stars: ✭ 334 (+610.64%)
Mutual labels:  camera, ffmpeg
Screen Recorder Ffmpeg Cpp
*Multimedia project* A screen recording application to capture your desktop and store in a video format. Click here to watch the demo
Stars: ✭ 98 (+108.51%)
Mutual labels:  ffmpeg, video-recording
Homebridge Camera Ffmpeg
Homebridge Plugin Providing FFmpeg-based Camera Support
Stars: ✭ 726 (+1444.68%)
Mutual labels:  camera, ffmpeg
pmvr
Raspberry Pi Motion Video Recorder
Stars: ✭ 22 (-53.19%)
Mutual labels:  camera, ffmpeg
Goprostream
Tools for handling/displaying GoPro HTTP/UDP stream (Python/Ruby)
Stars: ✭ 311 (+561.7%)
Mutual labels:  camera, ffmpeg
Obs Studio
OBS Studio - Free and open source software for live streaming and screen recording
Stars: ✭ 34,115 (+72485.11%)
Mutual labels:  ffmpeg, video-recording
Ios tips
iOS的一些示例,持续更新中:1、AVFoundation 高仿微信相机拍摄和编辑 2、AVFoundation 人脸检测、实时滤镜、音视频编解码、GPUImage框架的使用等音视频相关内容 3、OpenGLES 4、LeetCode算法练习 5、iOS Crash防护和APM监控 6、WKWebView相关的内容 等........
Stars: ✭ 896 (+1806.38%)
Mutual labels:  camera, video-recording
Pi Webcam
Automation to configure a Raspberry Pi as a USB OTG webcam
Stars: ✭ 990 (+2006.38%)
Mutual labels:  camera
Jcamera
This is Android CameraActivity,Imitation WeChat Camera Android 仿微信视频拍摄 支持触摸拍摄 长按拍摄
Stars: ✭ 42 (-10.64%)
Mutual labels:  camera
Analysisavp
音视频学习,相关文件格式/协议分析。h264 nalu aac adts flv
Stars: ✭ 38 (-19.15%)
Mutual labels:  ffmpeg
Pyimagevideo
write animated GIF, multipage append TIFF, AVI OGV video in Python
Stars: ✭ 36 (-23.4%)
Mutual labels:  ffmpeg

v4l2test

v4l2test is a project for video & audio recording on android platform. The project implements audio capture via tinyalsa interface, and video capture via v4l2 interface, on android platform. Rendering camrea preview on screen, and recording audio and video into mp4 files by ffmpeg library.

In the project, I write a script to customize ffmpeg library building, which only including ACC & H264 encoder and MP4 file muxer, to reduce library size. If you have a android standalone toolchain, it's very easy for you, to build out the ffmpeg library for android platform.

All code are written in C/C++, after building, you get elf binary excutable program, which can execute in adb shell. v4l2test - capture video from camera, and rendering on screen encodertest - generate randomize audio & video data, and encode into mp4 file. recordertest - capture audio & video from mic & camera, preview camera on screen, and recording audio & video into mp4 files.

After code stable, I will implement jni and test apks. It aimed to provide api for audio & video recording and live streaming on android platform, with high stability and performace.

Why did I create it

At my work, I am maintaining codes of android DVR app for in-car products, which request high stability and long time work, which using the android standard camera and recorder api. I meet many bugs and issues, on android camera hal, camera api, recorder api.

The android standard api:

android.hardware.Camera android.media.MediaRecorder

is very unstable. My apks often meet fatal error, and crash many times. And it is very diffcult to position the problem code, and fix bugs. How is the android standard api for camera and recorder? I say, it just a toy. This is why I create the v4l2test project.

Compared with android camera hal & camera api, my project directly access to camera and mic devices, it is KISS, with out any complex architecture, with out any hal, with out any service, the code is very simple and easy to debug. above the project C/C++ code, you can write a simple jni for java, then you can write a apk, to implement the camera preview and video recording. The code is simple to read and debug, is great.

How to build

  1. using build_ffmpeg_for_android.sh to build ffmpeg library.
  2. using NDK or android build environment to build test program (I built these codes under AllWinner A33 Android 4.4 source code enviroment. So I suggest using NDK version corresponding to Android 4.4.)

if you cloned google AOSP source code, and switch to tag android-4.4.4_r2.0.1, I think it's possible to build v4l2test.

under android source dir, try steps:

  1. source build/envsetup.sh
  2. lunch (and select a combo, ex. aosp_arm-eng)
  3. make -j8
  4. cd v4l2test
  5. mm -B -j8

if not using A33 platform, remove -DUSE_MEDIASERVER_H264ENC -DPLATFORM_ALLWINNER_A33 from Android.mk

and add -DUSE_MEDIACODEC_H264ENC

this will disable allwinner A33 cedarx hw encoding code, and support android mediacodec hw encoding.

Features

  1. audio capture from tinyalsa/AudioRecord
  2. video capture from v4l2
  3. audio & video encoding into mp4
  4. rendering video on screen
  5. resize video when recording
  6. resample audio when recording
  7. change frame rate when recording
  8. optimized for allwinner A33 platorm
  9. record segmented video with out dropping any frame
  10. auto drop frame when could't encoding in time
  11. support push rtmp/hls live stream
  12. support android mediacodec h264 hardware encoding
  13. support cedarx hardware encoding for A33 platfrom

How to use

after build success, you will get v4l2test, encodertest, recordertest and libffrecorder_jni.

v4l2test

push it to /system/bin/ (using adb), chmod 755. in adb shell, try command: v4l2test /dev/video0 0 640 480 /dev/video0 - video device file name 0 - video device sub source (for some platform front and rear camera both share using /dev/video0, but use different source, maybe 0 - rear camera, 1 - front camera) 640 480 - camera preview resolution. if success, the camera preview will be displayed on screen

encodertest

try command: encodertest it will generate random video and audio data, and encode into mp4 file.

recordertest

try command: recordertest it will capture video from camera, audio from mic, and encode into mp4 file.

libffrecorder_jni

it is a jni library for MediaRecorder.java class file. by libffrecorder_jni and MediaRecorder.java, you are able to use v4l2test for android apk development with java code. an other related project is CameraDVR: https://github.com/rockcarry/CameraDVR

permission issue ?

on android platform, we usually got the permisson issue, such as file access permission, selinux permission, .. these permission issues, will cause our app unable to work correctly. for v4l2test/CameraDVR project, you want to test it ? you should first fix these permission issues, example:

  1. test it in adb shell as root user
  2. chmod 666 /dev/video*
  3. modify sepolicy if selinux is enforced
  4. ...

TODO

  1. stability and performance

rockcarry 2017-2-10

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].