Skip to content
This repository has been archived by the owner on Oct 7, 2021. It is now read-only.

Camera Support

Taner Şener edited this page Jul 27, 2020 · 9 revisions

1. Android

Since v4.2, it is possible to access built-in camera using android_camera input device. Unfortunately, android_camera requires API level 24 and is only supported by Main releases. LTS releases, which are built with API 21 or 16, do not have this device enabled.

Additionally devices with deprecated camera HAL 1.0 implementations (camera devices that have the LEGACY hardware level) are not supported by Android NDK Native API, consequently they are not supported by MobileFFmpeg as well.

  • List available input devices using getSupportedCameraIds API method

    Config.getSupportedCameraIds(this);

  • Record video and audio into a file with this command

    -y -f android_camera -i 0:0 -r 30 -pixel_format bgr0 -t 00:00:05 <record file path>

  • Refer to android_camera input device documentation for all available options of android_camera input device

2. iOS

Built-in camera and microphone can be accessed using AVFoundation input device. All releases since v3.0, except LTS releases, are built with AVFoundation enabled.

  • Before capturing a device, first you need to define and provide the following keys in your application's Info.plist file.

    Privacy - Camera Usage Description

    Privacy - Microphone Usage Description

  • Then list available input devices by running this command

    -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 into a file with this 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 AVFoundation input device documentation for all available options of AVFoundation input device

Clone this wiki locally