Skip to content
This repository has been archived by the owner on Jan 6, 2025. It is now read-only.

Camera Support

Taner Sener edited this page Jun 14, 2019 · 9 revisions

1. Android

Since v4.2 it is possible to access built-in camera on Android using android_camera input device.

Please note that android_camera input device requires API level 24+ and is supported only in v4.2 main release, v4.2.LTS release which built with API 21 does 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.

  • 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 / tvOS

Since v3.0 it is possible to access built-in camera and microphone on iOS and tvOS using AVFoundation input device.

  • 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