-
Notifications
You must be signed in to change notification settings - Fork 25
Camera Support
It is possible to access the built-in camera using the android_camera input device. android_camera requires API level 24 by default. If you build the Android library with a lower API level, this input device will not be available.
Additionally, devices with deprecated Camera HAL 1.0 implementations, meaning camera devices with the LEGACY hardware level, are not supported by the Android NDK Native API. Consequently, they are not supported by FFmpegKit either.
-
List available input devices using the
getSupportedCameraIdsAPI method:FFmpegKitConfig.getSupportedCameraIds(this);
-
Record the video stream to a file using the command below. Audio is not supported.
-f android_camera -i 0:0 -r 30 -pixel_format bgr0 -t 00:00:05 <record file path>
-
Refer to the android_camera input device documentation for all available options of the
android_camerainput device.
Flutter exposes the same Android camera API through FFmpegKitConfig.getSupportedCameraIds().
This method is Android-only. It fails if called on other platforms. It also requires API level 24 or later. On older API levels, it returns an empty list.
-
List available Android camera input devices:
import 'package:ffmpeg_kit_next_flutter/ffmpeg_kit_config.dart'; final cameraIds = await FFmpegKitConfig.getSupportedCameraIds();
-
Use the returned camera IDs with the same
android_camerainput device command:-f android_camera -i 0:0 -r 30 -pixel_format bgr0 -t 00:00:05 <record file path>
React Native exposes the same Android camera API through FFmpegKitConfig.getSupportedCameraIds().
This method is Android-only. It fails if called on other platforms. It also requires API level 24 or later. On older API levels, it returns an empty list.
-
List available Android camera input devices:
import { FFmpegKitConfig } from 'ffmpeg-kit-next-react-native'; const cameraIds = await FFmpegKitConfig.getSupportedCameraIds();
-
Use the returned camera IDs with the same
android_camerainput device command:-f android_camera -i 0:0 -r 30 -pixel_format bgr0 -t 00:00:05 <record file path>
The built-in camera and microphone can be accessed using the AVFoundation input device. All Main releases for iOS, iPadOS, and macOS are built with AVFoundation enabled.
AVFoundation is not included in tvOS or visionOS releases.
-
Before capturing from a device, you must define and provide the following keys in your application's
Info.plistfile:Privacy - Camera Usage Description (NSCameraUsageDescription)Privacy - Microphone Usage Description (NSMicrophoneUsageDescription) -
List available input devices by running:
-f avfoundation -list_devices true -i ""
AVFoundation video devices: [0] Back Camera [1] Front Camera AVFoundation audio devices: [0] iPhone Microphone -
Record video and audio streams to a file using the following command:
-f avfoundation -r 30 -video_size 1280x720 -pixel_format bgr0 -i 0:0 -vcodec h264_videotoolbox -vsync 2 -f h264 -t 00:00:05 <record file path>
-
Refer to the AVFoundation input device documentation for all available options of the
AVFoundationinput device.
Linux camera capture uses FFmpeg's v4l2 input device and standard Linux video device nodes such as /dev/video0.
-
List FFmpeg input/output devices enabled in the build:
-devices
-
List Linux video device nodes:
ls /dev/video* -
Or, if
v4l2-ctlis installed:v4l2-ctl --list-devices
-
List supported formats for a known camera device:
-f v4l2 -list_formats all -i /dev/video0
-
Record video from a Linux camera device:
-f v4l2 -framerate 30 -video_size 1280x720 -i /dev/video0 -t 00:00:05 <record file path>
Copyright (c) 2026 FFmpegKitNext
- Status
- Versions
- Changelog
- Project Layout
- Using
- Building
- External Libraries
- Patents
- License