AVFoundation 介绍
参考文档:
http://underpop.online.fr/f/ffmpeg/help/avfoundation.htm.gz
https://github.com/FFmpeg/FFmpeg/blob/master/libavdevice/avfoundation.m
AVFoundation 是Mac特有的基于时间的多媒体处理框架。
AVFoundation input device.
AVFoundation is the currently recommended framework by Apple for streamgrabbing on OSX >= 10.7 as well as on iOS.
The input filename has to be given in the following syntax:
-i "[[VIDEO]:[AUDIO]]"
The first entry selects the video input while the latter selects the audio input. The stream has to be specified by the device name or the device index as shown by the device list. Alternatively, the video and/or audio input device can be chosen by index using the -video_device_index <INDEX>
and/or -audio_device_index <INDEX>
, overriding any device name or index given in the input filename.
All available devices can be enumerated by using -list_devices true
, listing all device names and corresponding indices.
There are two device name aliases:
default
Select the AVFoundation default device of the corresponding type.
none
Do not record the corresponding media type. This is equivalent to specifying an empty device name or index.
OPTIONS
AVFoundation supports the following options:
-
-list_devices true|false
If set to true, a list of all available input devices is given showing all device names and indices. -
-video_device_index index
Specify the video device by its index. Overrides anything given in the input filename. -
-audio_device_index index
Specify the audio device by its index. Overrides anything given in the input filename.
-
-pixel_format format
Request the video device to use a specific pixel format. If the specified format is not supported, a list of available formats is given and the first one in this list is used instead. Available pixel formats are:monob, rgb555be, rgb555le, rgb565be, rgb565le, rgb24, bgr24, 0rgb, bgr0, 0bgr, rgb0, bgr48be, uyvy422, yuva444p, yuva444p16le, yuv444p, yuv422p16, yuv422p10, yuv444p10, yuv420p, nv12, yuyv422, gray
-
-framerate
Set the grabbing frame rate. Default isntsc
, corresponding to a frame rate of30000/1001
. -
-video_size
Set the video frame size. -
-capture_cursor
Capture the mouse pointer. Default is 0. -
-capture_mouse_clicks
Capture the screen mouse clicks. Default is 0.
COMMAND LINE EXAMPLES
- Print the list of AVFoundation supported devices and exit:
ffmpeg -f avfoundation -list_devices true -i ""
- Record video from video device 0 and audio from audio device 0 into out.avi:
ffmpeg -f avfoundation -i "0:0" out.avi
- Record video from video device 2 and audio from audio device 1 into out.avi:
ffmpeg -f avfoundation -video_device_index 2 -i ":1" out.avi
- Record video from the system default video device using the pixel format bgr0 and do not record any audio into out.avi:
ffmpeg -f avfoundation -pixel_format bgr0 -i "default:none" out.avi