FFmpeg is a free and open-source software project consisting of a large suite of libraries and programs for handling video, audio, and other multimedia files and streams. At its core is the FFmpeg program. For MCCDisplay, an overlay behavior for multi-line subtitles is the same for both EIA-608 and CEA-708 Fixed preview of Closed Captions with diacritic symbols 1.7.16.10369 beta - October 11, 2018.
Table of Contents
- 3 Input Devices
- 3.1 alsa
- 3.2 android_camera
- 3.3 avfoundation
- 3.4 bktr
- 3.5 decklink
- 3.6 dshow
- 3.7 fbdev
- 3.8 gdigrab
- 3.9 iec61883
- 3.10 jack
- 3.11 kmsgrab
- 3.12 lavfi
- 3.13 libcdio
- 3.14 libdc1394
- 3.15 openal
- 3.16 oss
- 3.17 pulse
- 3.18 sndio
- 3.19 video4linux2, v4l2
- 3.20 vfwcap
- 3.21 x11grab
- 4 Output Devices
- 4.1 alsa
- 4.2 AudioToolbox
- 4.3 caca
- 4.4 decklink
- 4.5 fbdev
- 4.6 opengl
- 4.8 pulse
- 4.9 sdl
- 4.12 xv
1 Description
This document describes the input and output devices provided by thelibavdevice library.
2 Device Options
The libavdevice library provides the same interface aslibavformat. Namely, an input device is considered like a demuxer, andan output device like a muxer, and the interface and generic deviceoptions are the same provided by libavformat (see the ffmpeg-formatsmanual).
In addition each input or output device may support so-called privateoptions, which are specific for that component.
Options may be set by specifying -optionvalue in theFFmpeg tools, or by setting the value explicitly in the deviceAVFormatContext
options or using the libavutil/opt.h APIfor programmatic use.
3 Input Devices
Input devices are configured elements in FFmpeg which enable accessingthe data coming from a multimedia device attached to your system.
When you configure your FFmpeg build, all the supported input devicesare enabled by default. You can list all available ones using theconfigure option '–list-indevs'.
You can disable all the input devices using the configure option'–disable-indevs', and selectively enable an input device using theoption '–enable-indev=INDEV', or you can disable a particularinput device using the option '–disable-indev=INDEV'.
The option '-devices' of the ff* tools will display the list ofsupported input devices.
A description of the currently available input devices follows.
3.1 alsa
ALSA (Advanced Linux Sound Architecture) input device.
To enable this input device during configuration you need libasoundinstalled on your system.
This device allows capturing from an ALSA device. The name of thedevice to capture has to be an ALSA card identifier.
An ALSA identifier has the syntax:
where the DEV and SUBDEV components are optional.
The three arguments (in order: CARD,DEV,SUBDEV)specify card number or identifier, device number and subdevice number(-1 means any).
To see the list of cards currently recognized by your system check thefiles /proc/asound/cards and /proc/asound/devices.
For example to capture with ffmpeg
from an ALSA device withcard id 0, you may run the command:
For more information see:http://www.alsa-project.org/alsa-doc/alsa-lib/pcm.html
3.1.1 Options
Set the sample rate in Hz. Default is 48000.
Set the number of channels. Default is 2.
3.2 android_camera
Android camera input device.
This input devices uses the Android Camera2 NDK API which isavailable on devices with API level 24+. The availability ofandroid_camera is autodetected during configuration.
This device allows capturing from all cameras on an Android device,which are integrated into the Camera2 NDK API.
The available cameras are enumerated internally and can be selectedwith the camera_index parameter. The input file string isdiscarded.
Generally the back facing camera has index 0 while the front facingcamera has index 1.
3.2.1 Options
Set the video size given as a string such as 640x480 or hd720.Falls back to the first available configuration reported byAndroid if requested video size is not available or by default.
Set the video framerate.Falls back to the first available configuration reported byAndroid if requested framerate is not available or by default (-1).
Set the index of the camera to use. Default is 0.
Set the maximum number of frames to buffer. Default is 5.
3.3 avfoundation
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:
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 anydevice name or index given in the input filename.
All available devices can be enumerated by using -list_devices true, listingall 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.
3.3.1 Options
AVFoundation supports the following options:
If set to true, a list of all available input devices is given showing alldevice names and indices.
Specify the video device by its index. Overrides anything given in the input filename.
Specify the audio device by its index. Overrides anything given in the input filename.
Request the video device to use a specific pixel format.If the specified format is not supported, a list of available formats is givenand 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
Set the grabbing frame rate. Default is ntsc
, corresponding to aframe rate of 30000/1001
.
Set the video frame size.
Capture the mouse pointer. Default is 0.
Capture the screen mouse clicks. Default is 0.
Capture the raw device data. Default is 0.Using this option may result in receiving the underlying data delivered to the AVFoundation framework. E.g. for muxed devices that sends raw DV data to the framework (like tape-based camcorders), setting this option to false results in extracted video frames captured in the designated pixel format only. Setting this option to true results in receiving the raw DV stream untouched.
3.3.2 Examples
- Print the list of AVFoundation supported devices and exit:
- Record video from video device 0 and audio from audio device 0 into out.avi:
- Record video from video device 2 and audio from audio device 1 into out.avi:
- Record video from the system default video device using the pixel format bgr0 and do not record any audio into out.avi:
- Record raw DV data from a suitable input device and write the output into out.dv:
3.4 bktr
BSD video input device.
3.4.1 Options
Set the frame rate.
Set the video frame size. Default is vga
.
Available values are:
- ‘pal’
- ‘ntsc’
- ‘secam’
- ‘paln’
- ‘palm’
- ‘ntscj’
3.5 decklink
The decklink input device provides capture capabilities for BlackmagicDeckLink devices.
To enable this input device, you need the Blackmagic DeckLink SDK and youneed to configure with the appropriate --extra-cflags
and --extra-ldflags
.On Windows, you need to run the IDL files through widl
.
DeckLink is very picky about the formats it supports. Pixel format of theinput can be set with raw_format.Framerate and video size must be determined for your device with-list_formats 1
. Audio sample rate is always 48 kHz and the numberof channels can be 2, 8 or 16. Note that all audio channels are bundled in one singleaudio track.
3.5.1 Options
If set to true, print a list of devices and exit.Defaults to false. This option is deprecated, please use the-sources
option of ffmpeg to list the available input devices.
If set to true, print a list of supported formats and exit.Defaults to false.
This sets the input video format to the format given by the FourCC. To seethe supported values of your device(s) use list_formats.Note that there is a FourCC 'pal ' that can also be usedas pal (3 letters).Default behavior is autodetection of the input video format, if the hardwaresupports it.
Set the pixel format of the captured video.Available values are:
This is the default which means 8-bit YUV 422 or 8-bit ARGB if formatautodetection is used, 8-bit YUV 422 otherwise.
8-bit YUV 422.
10-bit YUV 422.
8-bit RGB.
8-bit RGB.
10-bit RGB.
If set to nonzero, an additional teletext stream will be captured from thevertical ancillary data. Both SD PAL (576i) and HD (1080i or 1080p)sources are supported. In case of HD sources, OP47 packets are decoded.
This option is a bitmask of the SD PAL VBI lines captured, specifically lines 6to 22, and lines 318 to 335. Line 6 is the LSB in the mask. Selected lineswhich do not contain teletext information will be ignored. You can use thespecial all constant to select all possible lines, orstandard to skip lines 6, 318 and 319, which are not compatible withall receivers.
For SD sources, ffmpeg needs to be compiled with --enable-libzvbi
. ForHD sources, on older (pre-4K) DeckLink card models you have to capture in 10bit mode.
Defines number of audio channels to capture. Must be ‘2’, ‘8’ or ‘16’.Defaults to ‘2’.
Sets the decklink device duplex mode. Must be ‘unset’, ‘half’ or ‘full’.Defaults to ‘unset’.
Ffmpeg Cea 708 Din
Timecode type to include in the frame and video stream metadata. Must be‘none’, ‘rp188vitc’, ‘rp188vitc2’, ‘rp188ltc’,‘rp188hfr’, ‘rp188any’, ‘vitc’, ‘vitc2’, or ‘serial’.Defaults to ‘none’ (not included).
In order to properly support 50/60 fps timecodes, the ordering of the queriedtimecode types for ‘rp188any’ is HFR, VITC1, VITC2 and LTC for >30 fpscontent. Note that this is slightly different to the ordering used by theDeckLink API, which is HFR, VITC1, LTC, VITC2.
Sets the video input source. Must be ‘unset’, ‘sdi’, ‘hdmi’,‘optical_sdi’, ‘component’, ‘composite’ or ‘s_video’.Defaults to ‘unset’.
Sets the audio input source. Must be ‘unset’, ‘embedded’,‘aes_ebu’, ‘analog’, ‘analog_xlr’, ‘analog_rca’ or‘microphone’. Defaults to ‘unset’.
Sets the video packet timestamp source. Must be ‘video’, ‘audio’,‘reference’, ‘wallclock’ or ‘abs_wallclock’.Defaults to ‘video’.
Sets the audio packet timestamp source. Must be ‘video’, ‘audio’,‘reference’, ‘wallclock’ or ‘abs_wallclock’.Defaults to ‘audio’.
If set to ‘true’, color bars are drawn in the event of a signal loss.Defaults to ‘true’.
Sets maximum input buffer size in bytes. If the buffering reaches this value,incoming frames will be dropped.Defaults to ‘1073741824’.
Sets the audio sample bit depth. Must be ‘16’ or ‘32’.Defaults to ‘16’.
If set to true, timestamps are forwarded as they are without removingthe initial offset.Defaults to false.
Capture start time alignment in seconds. If set to nonzero, input frames aredropped till the system timestamp aligns with configured value.Alignment difference of up to one frame duration is tolerated.This is useful for maintaining input synchronization across N differenthardware devices deployed for ’N-way’ redundancy. The system time of differenthardware devices should be synchronized with protocols such as NTP or PTP,before using this option.Note that this method is not foolproof. In some border cases inputsynchronization may not happen due to thread scheduling jitters in the OS.Either sync could go wrong by 1 frame or in a rarer casetimestamp_align seconds.Defaults to ‘0’.
Drop frames till a frame with timecode is received. Sometimes serial timecodeisn’t received with the first input frame. If that happens, the stored streamtimecode will be inaccurate. If this option is set to true, input framesare dropped till a frame with timecode is received.Option timecode_format must be specified.Defaults to false.
If set to true, extracts KLV data from VANC and outputs KLV packets.KLV VANC packets are joined based on MID and PSC fields and aggregated intoone KLV packet.Defaults to false.
3.5.2 Examples
- List input devices:
- List supported formats:
- Capture video clip at 1080i50:
- Capture video clip at 1080i50 10 bit:
- Capture video clip at 1080i50 with 16 audio channels:
3.6 dshow
Windows DirectShow input device.
DirectShow support is enabled when FFmpeg is built with the mingw-w64 project.Currently only audio and video devices are supported.
Multiple devices may be opened as separate inputs, but they may also beopened on the same input, which should improve synchronism between them.
The input name should be in the format:
where TYPE can be either audio or video,and NAME is the device’s name or alternative name..
3.6.1 Options
If no options are specified, the device’s defaults are used.If the device does not support the requested options, it willfail to open.
Set the video size in the captured video.
Set the frame rate in the captured video.
Set the sample rate (in Hz) of the captured audio.
Set the sample size (in bits) of the captured audio.
Set the number of channels in the captured audio.
If set to true, print a list of devices and exit.
If set to true, print a list of selected device’s optionsand exit.
Set video device number for devices with the same name (starts at 0,defaults to 0).
Set audio device number for devices with the same name (starts at 0,defaults to 0).
Select pixel format to be used by DirectShow. This may only be set whenthe video codec is not set or set to rawvideo.
Set audio device buffer size in milliseconds (which can directlyimpact latency, depending on the device).Defaults to using the audio device’sdefault buffer size (typically some multiple of 500ms).Setting this value too low can degrade performance.See alsohttp://msdn.microsoft.com/en-us/library/windows/desktop/dd377582(v=vs.85).aspx
Select video capture pin to use by name or alternative name.
Select audio capture pin to use by name or alternative name.
Select video input pin number for crossbar device. This will berouted to the crossbar device’s Video Decoder output pin.Note that changing this value can affect future invocations(sets a new default) until system reboot occurs.
Select audio input pin number for crossbar device. This will berouted to the crossbar device’s Audio Decoder output pin.Note that changing this value can affect future invocations(sets a new default) until system reboot occurs.
If set to true, before capture starts, popup a display dialogto the end user, allowing them to change video filter propertiesand configurations manually.Note that for crossbar devices, adjusting values in this dialogmay be needed at times to toggle between PAL (25 fps) and NTSC (29.97)input frame rates, sizes, interlacing, etc. Changing these values canenable different scan rates/frame rates and avoiding green bars atthe bottom, flickering scan lines, etc.Note that with some devices, changing these properties can also affect futureinvocations (sets new defaults) until system reboot occurs.
If set to true, before capture starts, popup a display dialogto the end user, allowing them to change audio filter propertiesand configurations manually.
If set to true, before capture starts, popup a displaydialog to the end user, allowing them to manuallymodify crossbar pin routings, when it opens a video device.
If set to true, before capture starts, popup a displaydialog to the end user, allowing them to manuallymodify crossbar pin routings, when it opens an audio device.
If set to true, before capture starts, popup a displaydialog to the end user, allowing them to manuallymodify TV channels and frequencies.
If set to true, before capture starts, popup a displaydialog to the end user, allowing them to manuallymodify TV audio (like mono vs. stereo, Language A,B or C).
Load an audio capture filter device from file instead of searchingit by name. It may load additional parameters too, if the filtersupports the serialization of its properties to.To use this an audio capture source has to be specified, but it canbe anything even fake one.
Save the currently used audio capture filter device and itsparameters (if the filter supports it) to a file.If a file with the same name exists it will be overwritten.
Load a video capture filter device from file instead of searchingit by name. It may load additional parameters too, if the filtersupports the serialization of its properties to.To use this a video capture source has to be specified, but it canbe anything even fake one.
Save the currently used video capture filter device and itsparameters (if the filter supports it) to a file.If a file with the same name exists it will be overwritten.
3.6.2 Examples
- Print the list of DirectShow supported devices and exit:
- Open video device Camera:
- Open second video device with name Camera:
- Open video device Camera and audio device Microphone:
- Print the list of supported options in selected device and exit:
- Specify pin names to capture by name or alternative name, specify alternative device name:
- Configure a crossbar device, specifying crossbar pins, allow user to adjust video capture properties at startup:
3.7 fbdev
Linux framebuffer input device.
The Linux framebuffer is a graphic hardware-independent abstractionlayer to show graphics on a computer monitor, typically on theconsole. It is accessed through a file device node, usually/dev/fb0.
For more detailed information read the fileDocumentation/fb/framebuffer.txt included in the Linux source tree.
See also http://linux-fbdev.sourceforge.net/, and fbset(1).
To record from the framebuffer device /dev/fb0 withffmpeg
:
You can take a single screenshot image with the command:
3.7.1 Options
Set the frame rate. Default is 25.
3.8 gdigrab
Win32 GDI-based screen capture device.
This device allows you to capture a region of the display on Windows.
There are two options for the input filename:
or
The first option will capture the entire desktop, or a fixed region of thedesktop. The second option will instead capture the contents of a singlewindow, regardless of its position on the screen.
For example, to grab the entire desktop using ffmpeg
:
Grab a 640x480 region at position 10,20
:
Grab the contents of the window named 'Calculator'
3.8.1 Options
Specify whether to draw the mouse pointer. Use the value 0
tonot draw the pointer. Default value is 1
.
Set the grabbing frame rate. Default value is ntsc
,corresponding to a frame rate of 30000/1001
.
Show grabbed region on screen.
If show_region is specified with 1
, then the grabbingregion will be indicated on screen. With this option, it is easy toknow what is being grabbed if only a portion of the screen is grabbed.
Note that show_region is incompatible with grabbing the contentsof a single window.
For example:
Set the video frame size. The default is to capture the full screen if desktop is selected, or the full window size if title=window_title is selected.
When capturing a region with video_size, set the distance from the left edge of the screen or desktop.
Note that the offset calculation is from the top left corner of the primary monitor on Windows. If you have a monitor positioned to the left of your primary monitor, you will need to use a negative offset_x value to move the region to that monitor.
When capturing a region with video_size, set the distance from the top edge of the screen or desktop.
Note that the offset calculation is from the top left corner of the primary monitor on Windows. If you have a monitor positioned above your primary monitor, you will need to use a negative offset_y value to move the region to that monitor.
3.9 iec61883
FireWire DV/HDV input device using libiec61883.
To enable this input device, you need libiec61883, libraw1394 andlibavc1394 installed on your system. Use the configure option--enable-libiec61883
to compile with the device enabled.
The iec61883 capture device supports capturing from a video deviceconnected via IEEE1394 (FireWire), using libiec61883 and the new LinuxFireWire stack (juju). This is the default DV/HDV input method in LinuxKernel 2.6.37 and later, since the old FireWire stack was removed.
Specify the FireWire port to be used as input file, or 'auto'to choose the first port connected.
3.9.1 Options
Override autodetection of DV/HDV. This should only be used if autodetection does not work, or if usage of a different device typeshould be prohibited. Treating a DV device as HDV (or vice versa) willnot work and result in undefined behavior.The values auto, dv and hdv are supported.
Set maximum size of buffer for incoming data, in frames. For DV, thisis an exact value. For HDV, it is not frame exact, since HDV doesnot have a fixed frame size.
Select the capture device by specifying its GUID. Capturing will onlybe performed from the specified device and fails if no device with thegiven GUID is found. This is useful to select the input if multipledevices are connected at the same time.Look at /sys/bus/firewire/devices to find out the GUIDs.
3.9.2 Examples
Ffmpeg Cea 708 Code
- Grab and show the input of a FireWire DV/HDV device.
- Grab and record the input of a FireWire DV/HDV device,using a packet buffer of 100000 packets if the source is HDV.
3.10 jack
JACK input device.
To enable this input device during configuration you need libjackinstalled on your system.
A JACK input device creates one or more JACK writable clients, one foreach audio channel, with name client_name:input_N, whereclient_name is the name provided by the application, and Nis a number which identifies the channel.Each writable client will send the acquired data to the FFmpeg inputdevice.
Once you have created one or more JACK readable clients, you need toconnect them to one or more JACK writable clients.
To connect or disconnect JACK clients you can use the jack_connect
and jack_disconnect
programs, or do it through a graphical interface,for example with qjackctl
.
To list the JACK clients and their properties you can invoke the commandjack_lsp
.
Follows an example which shows how to capture a JACK readable clientwith ffmpeg
.
For more information read:http://jackaudio.org/
3.10.1 Options
Set the number of channels. Default is 2.
3.11 kmsgrab
KMS video input device.
Captures the KMS scanout framebuffer associated with a specified CRTC or plane as aDRM object that can be passed to other hardware functions.
Requires either DRM master or CAP_SYS_ADMIN to run.
If you don’t understand what all of that means, you probably don’t want this. Look atx11grab instead.
3.11.1 Options
DRM device to capture on. Defaults to /dev/dri/card0.
Pixel format of the framebuffer. This can be autodetected if you are running Linux 5.7or later, but needs to be provided for earlier versions. Defaults to bgr0,which is the most common format used by the Linux console and Xorg X server.
Format modifier to signal on output frames. This is necessary to import correctly intosome APIs. It can be autodetected if you are running Linux 5.7 or later, but will needto be provided explicitly when needed in earlier versions. See the libdrm documentationfor possible values.
KMS CRTC ID to define the capture source. The first active plane on the given CRTCwill be used.
KMS plane ID to define the capture source. Defaults to the first active plane found ifneither crtc_id nor plane_id are specified.
Framerate to capture at. This is not synchronised to any page flipping or framebufferchanges - it just defines the interval at which the framebuffer is sampled. Samplingfaster than the framebuffer update rate will generate independent frames with the samecontent. Defaults to 30
.
3.11.2 Examples
- Capture from the first active plane, download the result to normal frames and encode.This will only work if the framebuffer is both linear and mappable - if not, the resultmay be scrambled or fail to download.
- Capture from CRTC ID 42 at 60fps, map the result to VAAPI, convert to NV12 and encode as H.264.
- To capture only part of a plane the output can be cropped - this can be used to capturea single window, as long as it has a known absolute position and size. For example, tocapture and encode the middle quarter of a 1920x1080 plane:
3.12 lavfi
Libavfilter input virtual device.
This input device reads data from the open output pads of a libavfilterfiltergraph.
For each filtergraph open output, the input device will create acorresponding stream which is mapped to the generated output. Currentlyonly video data is supported. The filtergraph is specified through theoption graph.
3.12.1 Options
Specify the filtergraph to use as input. Each video open output must belabelled by a unique string of the form 'outN', where N is anumber starting from 0 corresponding to the mapped input streamgenerated by the device.The first unlabelled output is automatically assigned to the 'out0'label, but all the others need to be specified explicitly.
The suffix '+subcc' can be appended to the output label to create an extrastream with the closed captions packets attached to that output(experimental; only for EIA-608 / CEA-708 for now).The subcc streams are created after all the normal streams, in the order ofthe corresponding stream.For example, if there is 'out19+subcc', 'out7+subcc' and up to 'out42', thestream #43 is subcc for stream #7 and stream #44 is subcc for stream #19.
If not specified defaults to the filename specified for the inputdevice.
Set the filename of the filtergraph to be read and sent to the otherfilters. Syntax of the filtergraph is the same as the one specified bythe option graph.
Dump graph to stderr.
3.12.2 Examples
- Create a color video stream and play it back with
ffplay
: - As the previous example, but use filename for specifying the graphdescription, and omit the 'out0' label:
- Create three different video test filtered sources and play them:
- Read an audio stream from a file using the amovie source and play itback with
ffplay
: - Read an audio stream and a video stream and play it back with
ffplay
: - Dump decoded frames to images and closed captions to a file (experimental):
3.13 libcdio
Audio-CD input device based on libcdio.
To enable this input device during configuration you need libcdioinstalled on your system. It requires the configure option--enable-libcdio
.
This device allows playing and grabbing from an Audio-CD.
For example to copy with ffmpeg
the entire Audio-CD in /dev/sr0,you may run the command:
3.13.1 Options
Set drive reading speed. Default value is 0.
The speed is specified CD-ROM speed units. The speed is set throughthe libcdio cdio_cddap_speed_set
function. On many CD-ROMdrives, specifying a value too large will result in using the fastestspeed.
Set paranoia recovery mode flags. It accepts one of the following values:
- ‘disable’
- ‘verify’
- ‘overlap’
- ‘neverskip’
- ‘full’
Default value is ‘disable’.
For more information about the available recovery modes, consult theparanoia project documentation.
3.14 libdc1394
IIDC1394 input device, based on libdc1394 and libraw1394.
Requires the configure option --enable-libdc1394
.
3.14.1 Options
Set the frame rate. Default is ntsc
, corresponding to a framerate of 30000/1001
.
Select the pixel format. Default is uyvy422
.
Set the video size given as a string such as 640x480
or hd720
.Default is qvga
.
3.15 openal
The OpenAL input device provides audio capture on all systems with aworking OpenAL 1.1 implementation.
To enable this input device during configuration, you need OpenALheaders and libraries installed on your system, and need to configureFFmpeg with --enable-openal
.
OpenAL headers and libraries should be provided as part of your OpenALimplementation, or as an additional download (an SDK). Depending on yourinstallation you may need to specify additional flags via the--extra-cflags
and --extra-ldflags
for allowing the buildsystem to locate the OpenAL headers and libraries.
An incomplete list of OpenAL implementations follows:
The official Windows implementation, providing hardware accelerationwith supported devices and software fallback.See http://openal.org/.
Portable, open source (LGPL) software implementation. Includesbackends for the most common sound APIs on the Windows, Linux,Solaris, and BSD operating systems.See http://kcat.strangesoft.net/openal.html.
OpenAL is part of Core Audio, the official Mac OS X Audio interface.See http://developer.apple.com/technologies/mac/audio-and-video.html
This device allows one to capture from an audio input device handledthrough OpenAL.
You need to specify the name of the device to capture in the providedfilename. If the empty string is provided, the device willautomatically select the default device. You can get the list of thesupported devices by using the option list_devices.
3.15.1 Options
Set the number of channels in the captured audio. Only the values1 (monaural) and 2 (stereo) are currently supported.Defaults to 2.
Set the sample size (in bits) of the captured audio. Only the values8 and 16 are currently supported. Defaults to16.
Set the sample rate (in Hz) of the captured audio.Defaults to 44.1k.
If set to true, print a list of devices and exit.Defaults to false.
3.15.2 Examples
Print the list of OpenAL supported devices and exit:
Capture from the OpenAL device DR-BT101 via PulseAudio:
Capture from the default device (note the empty string ” as filename):
Capture from two devices simultaneously, writing to two different files,within the same ffmpeg
command:
Note: not all OpenAL implementations support multiple simultaneous capture -try the latest OpenAL Soft if the above does not work.
3.16 oss
Open Sound System input device.
The filename to provide to the input device is the device noderepresenting the OSS input device, and is usually set to/dev/dsp.
For example to grab from /dev/dsp using ffmpeg
use thecommand:
For more information about OSS see:http://manuals.opensound.com/usersguide/dsp.html
3.16.1 Options
Set the sample rate in Hz. Default is 48000.
Set the number of channels. Default is 2.
3.17 pulse
PulseAudio input device.
To enable this output device you need to configure FFmpeg with --enable-libpulse
.
The filename to provide to the input device is a source device or thestring 'default'
To list the PulseAudio source devices and their properties you can invokethe command pactl list sources
.
More information about PulseAudio can be found on http://www.pulseaudio.org.
3.17.1 Options
Connect to a specific PulseAudio server, specified by an IP address.Default server is used when not provided.
Specify the application name PulseAudio will use when showing active clients,by default it is the LIBAVFORMAT_IDENT
string.
Specify the stream name PulseAudio will use when showing active streams,by default it is 'record'.
Specify the samplerate in Hz, by default 48kHz is used.
Specify the channels in use, by default 2 (stereo) is set.
Specify the number of bytes per frame, by default it is set to 1024.
Specify the minimal buffering fragment in PulseAudio, it will affect theaudio latency. By default it is unset.
Set the initial PTS using the current time. Default is 1.
3.17.2 Examples
Record a stream from default device:
3.18 sndio
sndio input device.
To enable this input device during configuration you need libsndioinstalled on your system.
The filename to provide to the input device is the device noderepresenting the sndio input device, and is usually set to/dev/audio0.
For example to grab from /dev/audio0 using ffmpeg
use thecommand:
3.18.1 Options
Set the sample rate in Hz. Default is 48000.
Set the number of channels. Default is 2.
3.19 video4linux2, v4l2
Video4Linux2 input video device.
'v4l2' can be used as alias for 'video4linux2'.
If FFmpeg is built with v4l-utils support (by using the--enable-libv4l2
configure option), it is possible to use it with the-use_libv4l2
input device option.
The name of the device to grab is a file device node, usually Linuxsystems tend to automatically create such nodes when the device(e.g. an USB webcam) is plugged into the system, and has a name of thekind /dev/videoN, where N is a number associated tothe device.
Video4Linux2 devices usually support a limited set ofwidthxheight sizes and frame rates. You can check which aresupported using -list_formats all
for Video4Linux2 devices.Some devices, like TV cards, support one or more standards. It is possibleto list all the supported standards using -list_standards all
.
The time base for the timestamps is 1 microsecond. Depending on the kernelversion and configuration, the timestamps may be derived from the real timeclock (origin at the Unix Epoch) or the monotonic clock (origin usually atboot time, unaffected by NTP or manual changes to the clock). The-timestamps abs or -ts abs option can be used to forceconversion into the real time clock.
Some usage examples of the video4linux2 device with ffmpeg
and ffplay
:
- List supported formats for a video4linux2 device:
- Grab and show the input of a video4linux2 device:
- Grab and record the input of a video4linux2 device, leave theframe rate and size as previously set:
For more information about Video4Linux, check http://linuxtv.org/.
3.19.1 Options
Set the standard. Must be the name of a supported standard. To get alist of the supported standards, use the list_standardsoption.
Set the input channel number. Default to -1, which means using thepreviously selected channel.
Set the video frame size. The argument must be a string in the formWIDTHxHEIGHT or a valid size abbreviation.
Select the pixel format (only valid for raw video input).
Set the preferred pixel format (for raw video) or a codec name.This option allows one to select the input format, when several areavailable.
Set the preferred video frame rate.
List available formats (supported pixel formats, codecs, and framesizes) and exit.
Available values are:
Show all available (compressed and non-compressed) formats.
Show only raw video (non-compressed) formats.
Show only compressed formats.
List supported standards and exit.
Available values are:
Show all supported standards.
Set type of timestamps for grabbed frames.
Available values are:
Use timestamps from the kernel.
Use absolute timestamps (wall clock).
Force conversion from monotonic to absolute timestamps.
Default value is default
.
Use libv4l2 (v4l-utils) conversion functions. Default is 0.
3.20 vfwcap
VfW (Video for Windows) capture input device.
The filename passed as input is the capture driver number, ranging from0 to 9. You may use 'list' as filename to print a list of drivers. Anyother filename will be interpreted as device number 0.
3.20.1 Options
Set the video frame size.
Set the grabbing frame rate. Default value is ntsc
,corresponding to a frame rate of 30000/1001
.
3.21 x11grab
X11 video input device.
To enable this input device during configuration you need libxcbinstalled on your system. It will be automatically detected duringconfiguration.
This device allows one to capture a region of an X11 display.
The filename passed as input has the syntax:
hostname:display_number.screen_number specifies theX11 display name of the screen to grab from. hostname can beomitted, and defaults to 'localhost'. The environment variableDISPLAY
contains the default display name.
x_offset and y_offset specify the offsets of the grabbedarea with respect to the top-left border of the X11 screen. Theydefault to 0.
Check the X11 documentation (e.g. man X
) for more detailedinformation.
Use the xdpyinfo
program for getting basic information aboutthe properties of your X11 display (e.g. grep for 'name' or'dimensions').
For example to grab from :0.0 using ffmpeg
:
Grab at position 10,20
:
3.21.1 Options
Specify whether to select the grabbing area graphically using the pointer.A value of 1
prompts the user to select the grabbing area graphicallyby clicking and dragging. A single click with no dragging will select thewhole screen. A region with zero width or height will also select the wholescreen. This option overwrites the video_size, grab_x, andgrab_y options. Default value is 0
.
Specify whether to draw the mouse pointer. A value of 0
specifiesnot to draw the pointer. Default value is 1
.
Make the grabbed area follow the mouse. The argument can becentered
or a number of pixels PIXELS.
When it is specified with 'centered', the grabbing region follows the mousepointer and keeps the pointer at the center of region; otherwise, the regionfollows only when the mouse pointer reaches within PIXELS (greater thanzero) to the edge of region.
For example:
To follow only when the mouse pointer reaches within 100 pixels to edge:
Set the grabbing frame rate. Default value is ntsc
,corresponding to a frame rate of 30000/1001
.
Show grabbed region on screen.
If show_region is specified with 1
, then the grabbingregion will be indicated on screen. With this option, it is easy toknow what is being grabbed if only a portion of the screen is grabbed.
Set the region border thickness if -show_region 1 is used.Range is 1 to 128 and default is 3 (XCB-based x11grab only).
For example:
With follow_mouse:
Set the video frame size. Default is the full desktop.
Set the grabbing region coordinates. They are expressed as offset fromthe top left corner of the X11 window and correspond to thex_offset and y_offset parameters in the device name. Thedefault value for both options is 0.
4 Output Devices
Output devices are configured elements in FFmpeg that can writemultimedia data to an output device attached to your system.
When you configure your FFmpeg build, all the supported output devicesare enabled by default. You can list all available ones using theconfigure option '–list-outdevs'.
You can disable all the output devices using the configure option'–disable-outdevs', and selectively enable an output device using theoption '–enable-outdev=OUTDEV', or you can disable a particularinput device using the option '–disable-outdev=OUTDEV'.
The option '-devices' of the ff* tools will display the list ofenabled output devices.
A description of the currently available output devices follows.
4.1 alsa
ALSA (Advanced Linux Sound Architecture) output device.
4.1.1 Examples
- Play a file on default ALSA device:
- Play a file on soundcard 1, audio device 7:
4.2 AudioToolbox
AudioToolbox output device.
Allows native output to CoreAudio devices on OSX.
The output filename can be empty (or -
) to refer to the default system output device or a number that refers to the device index as shown using: -list_devices true
.
Alternatively, the audio input device can be chosen by index using the -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, listingall device names, UIDs and corresponding indices.
4.2.1 Options
AudioToolbox supports the following options:
Specify the audio device by its index. Overrides anything given in the output filename.
4.2.2 Examples
- Print the list of supported devices and output a sine wave to the default device:
- Output a sine wave to the device with the index 2, overriding any output filename:
4.3 caca
CACA output device.
This output device allows one to show a video stream in CACA window.Only one CACA window is allowed per application, so you canhave only one instance of this output device in an application.
To enable this output device you need to configure FFmpeg with--enable-libcaca
.libcaca is a graphics library that outputs text instead of pixels.
For more information about libcaca, check:http://caca.zoy.org/wiki/libcaca
4.3.1 Options
Set the CACA window title, if not specified default to the filenamespecified for the output device.
Set the CACA window size, can be a string of the formwidthxheight or a video size abbreviation.If not specified it defaults to the size of the input video.
Set display driver.
Set dithering algorithm. Dithering is necessarybecause the picture being rendered has usually far more colours thanthe available palette.The accepted values are listed with -list_dither algorithms
.
Set antialias method. Antialiasing smoothens the renderedimage and avoids the commonly seen staircase effect.The accepted values are listed with -list_dither antialiases
.
Set which characters are going to be used when rendering text.The accepted values are listed with -list_dither charsets
.
Set color to be used when rendering text.The accepted values are listed with -list_dither colors
.
If set to true, print a list of available drivers and exit.
List available dither options related to the argument.The argument must be one of algorithms
, antialiases
,charsets
, colors
.
4.3.2 Examples
- The following command shows the
ffmpeg
output is anCACA window, forcing its size to 80x25: - Show the list of available drivers and exit:
- Show the list of available dither colors and exit:
4.4 decklink
The decklink output device provides playback capabilities for BlackmagicDeckLink devices.
To enable this output device, you need the Blackmagic DeckLink SDK and youneed to configure with the appropriate --extra-cflags
and --extra-ldflags
.On Windows, you need to run the IDL files through widl
.
DeckLink is very picky about the formats it supports. Pixel format is alwaysuyvy422, framerate, field order and video size must be determined for yourdevice with -list_formats 1
. Audio sample rate is always 48 kHz.
4.4.1 Options
If set to true, print a list of devices and exit.Defaults to false. This option is deprecated, please use the-sinks
option of ffmpeg to list the available output devices.
If set to true, print a list of supported formats and exit.Defaults to false.
Amount of time to preroll video in seconds.Defaults to 0.5.
Sets the decklink device duplex mode. Must be ‘unset’, ‘half’ or ‘full’.Defaults to ‘unset’.
Sets the genlock timing pixel offset on the used output.Defaults to ‘unset’.
4.4.2 Examples
- List output devices:
- List supported formats:
- Play video clip:
- Play video clip with non-standard framerate or video size:
4.5 fbdev
Linux framebuffer output device.
Ffmpeg Cea-708
The Linux framebuffer is a graphic hardware-independent abstractionlayer to show graphics on a computer monitor, typically on theconsole. It is accessed through a file device node, usually/dev/fb0.
For more detailed information read the fileDocumentation/fb/framebuffer.txt included in the Linux source tree.
4.5.1 Options
Set x/y coordinate of top left corner. Default is 0.
4.5.2 Examples
Play a file on framebuffer device /dev/fb0.Required pixel format depends on current framebuffer settings.
See also http://linux-fbdev.sourceforge.net/, and fbset(1).
4.6 opengl
OpenGL output device.
To enable this output device you need to configure FFmpeg with --enable-opengl
.
This output device allows one to render to OpenGL context.Context may be provided by application or default SDL window is created.
When device renders to external context, application must implement handlers for following messages:AV_DEV_TO_APP_CREATE_WINDOW_BUFFER
- create OpenGL context on current thread.AV_DEV_TO_APP_PREPARE_WINDOW_BUFFER
- make OpenGL context current.AV_DEV_TO_APP_DISPLAY_WINDOW_BUFFER
- swap buffers.AV_DEV_TO_APP_DESTROY_WINDOW_BUFFER
- destroy OpenGL context.Application is also required to inform a device about current resolution by sending AV_APP_TO_DEV_WINDOW_SIZE
message.
4.6.1 Options
Set background color. Black is a default.
Disables default SDL window when set to non-zero value.Application must provide OpenGL context and both window_size_cb
and window_swap_buffers_cb
callbacks when set.
Set the SDL window title, if not specified default to the filename specified for the output device.Ignored when no_window is set.
Set preferred window size, can be a string of the form widthxheight or a video size abbreviation.If not specified it defaults to the size of the input video, downscaled according to the aspect ratio.Mostly usable when no_window is not set.
4.6.2 Examples
Play a file on SDL window using OpenGL rendering:
4.7 oss
OSS (Open Sound System) output device.
4.8 pulse
PulseAudio output device.
To enable this output device you need to configure FFmpeg with --enable-libpulse
.
More information about PulseAudio can be found on http://www.pulseaudio.org
4.8.1 Options
Connect to a specific PulseAudio server, specified by an IP address.Default server is used when not provided.
Specify the application name PulseAudio will use when showing active clients,by default it is the LIBAVFORMAT_IDENT
string.
Specify the stream name PulseAudio will use when showing active streams,by default it is set to the specified output name.
Specify the device to use. Default device is used when not provided.List of output devices can be obtained with command pactl list sinks
.
Control the size and duration of the PulseAudio buffer. A small buffergives more control, but requires more frequent updates.
buffer_size specifies size in bytes whilebuffer_duration specifies duration in milliseconds.
When both options are provided then the highest value is used(duration is recalculated to bytes using stream parameters). If theyare set to 0 (which is default), the device will use the defaultPulseAudio duration value. By default PulseAudio set buffer durationto around 2 seconds.
Specify pre-buffering size in bytes. The server does not start withplayback before at least prebuf bytes are available in thebuffer. By default this option is initialized to the same value asbuffer_size or buffer_duration (whichever is bigger).
Specify minimum request size in bytes. The server does not request lessthan minreq bytes from the client, instead waits until the bufferis free enough to request more bytes at once. It is recommended to not setthis option, which will initialize this to a value that is deemed sensibleby the server.
4.8.2 Examples
Play a file on default device on default server:
4.9 sdl
SDL (Simple DirectMedia Layer) output device.
'sdl2' can be used as alias for 'sdl'.
This output device allows one to show a video stream in an SDLwindow. Only one SDL window is allowed per application, so you canhave only one instance of this output device in an application.
To enable this output device you need libsdl installed on your systemwhen configuring your build.
For more information about SDL, check:http://www.libsdl.org/
4.9.1 Options
Set the SDL window title, if not specified default to the filenamespecified for the output device.
Set the name of the iconified SDL window, if not specified it is setto the same value of window_title.
Set the SDL window size, can be a string of the formwidthxheight or a video size abbreviation.If not specified it defaults to the size of the input video,downscaled according to the aspect ratio.
Set the position of the window on the screen.
Set fullscreen mode when non-zero value is provided.Default value is zero.
Enable quit action (using window button or keyboard key)when non-zero value is provided.Default value is 1 (enable quit action)
4.9.2 Interactive commands
The window created by the device can be controlled through thefollowing interactive commands.
Quit the device immediately.
4.9.3 Examples
The following command shows the ffmpeg
output is anSDL window, forcing its size to the qcif format:
4.10 sndio
sndio audio output device.
4.11 v4l2
Video4Linux2 output device.
4.12 xv
XV (XVideo) output device.
This output device allows one to show a video stream in a X Window Systemwindow.
4.12.1 Options
Specify the hardware display name, which determines the display andcommunications domain to be used.
The display name or DISPLAY environment variable can be a string inthe format hostname[:number[.screen_number]].
hostname specifies the name of the host machine on which thedisplay is physically attached. number specifies the number ofthe display server on that host machine. screen_number specifiesthe screen to be used on that server.
If unspecified, it defaults to the value of the DISPLAY environmentvariable.
For example, dual-headed:0.1
would specify screen 1 of display0 on the machine named “dual-headed”.
Check the X11 specification for more detailed information about thedisplay name format.
When set to non-zero value then device doesn’t create new window,but uses existing one with provided window_id. By defaultthis options is set to zero and device creates its own window.
Set the created window size, can be a string of the formwidthxheight or a video size abbreviation. If notspecified it defaults to the size of the input video.Ignored when window_id is set.
Set the X and Y window offsets for the created window. They are bothset to 0 by default. The values may be ignored by the window manager.Ignored when window_id is set.
Set the window title, if not specified default to the filenamespecified for the output device. Ignored when window_id is set.
For more information about XVideo see http://www.x.org/.
4.12.2 Examples
- Decode, display and encode video input with
ffmpeg
at thesame time: - Decode and display the input video to multiple X11 windows:
5 See Also
ffmpeg, ffplay, ffprobe,libavdevice
6 Authors
The FFmpeg developers.
For details about the authorship, see the Git history of the project(git://source.ffmpeg.org/ffmpeg), e.g. by typing the commandgit log
in the FFmpeg source directory, or browsing theonline repository at http://source.ffmpeg.org.
Maintainers for the specific components are listed in the fileMAINTAINERS in the source code tree.
This document was generated on December 6, 2020 using makeinfo.
Hosting provided by telepoint.bg
What's CCExtractor?
A tool that analyzes video files and produces independent subtitle files from the closed captions data. CCExtractor is portable, small, and very fast. It works in Linux, Windows, and OSX.
What kind of closed captions does CCExtractor support?
Almost all of them:
- American TV captions (CEA-608 is well supported, and CEA-708 is starting to look good)
- European Teletext
- European DVB
- Brazilian ISBD
- DVD
- MXF
Missing:
- DTMB (Chinese)
How easy is it to use CCExtractor?
Very. Just tell it what file to process and it does everything for you.
CCExtractor integration with other tools
It is possible to integrate CCExtractor in a larger process. A couple of tools already call CCExtractor as part their video process - this way they get subtitle support for free.Starting in 0.52, CCExtractor is very front-end friendly. Front-ends can easily get real-time status information. The GUI source code is provided and can be used for reference.Any tool, commercial or not, is specifically allowed to use CCExtractor for any use the authors seem fit. So if your favourite video tools still lacks captioning tool, feel free to send the authors here.
You can also use CCExtractor as a library (as opposed to just running the binary), or take parts of the code. Keep in mind however that CCExtractor is GPLv2 so if you take parts or all of the source code your code must also be GPLv2.
What's the point of generating separate files for subtitles, if they are already in the source file?
There are several reasons to have subtitles separated from the video file, including:
Ffmpeg Cea 708 Test
- Closed captions never survive MPEG processing. If you take a MPEG file and encode it to any format (such as divx), your result file will not have closed captions. This means that if you want to keep the subtitles, you need to keep the original file. This is hardly practical if you are archiving HDTV shows for example.
- Subtitles files are small - so small (around 250 Kb for a movie) that you can quickly download them, or email them, etc, in case you have a recording without subtitles.
- Subtitles files are indexable: You can have a database with all your subtitles if you want (there are many available), so you can search the dialogs.
- Subtitles files are a de-facto standard: Almost every player can use them. In fact, many setbox players accept subtitles files in .srt format - so you can have subtitles in your .mp4/.mkv/.avi./etc movies and not just in your original DVDs.
- Closed captions are stored in many different formats by capture cards. Upgrading to a new card, if it comes with a new player, may mean that you can't use your previously recorded closed captions, even if the audio/video are fine.
- Closed captions require a closed caption decoder. All US TV have one (it's a legal requirement), but no European TV does, since there are not closed captions in Europe (teletext and DVB subtitles are used instead). Basically this means that if you buy a DVD in the US which has closed captions but no DVD subtitles, you are out of luck. This is a problem with many (most) old TV shows DVDs, which only come with closed captions. DVD producers don't bother doing DVD subs, since it's another way to segment the market, same as with DVD regions.
How I do use subtitles once they are in a separate file?
CCExtractor generates files in the two most common formats: .srt (SubRip) and .smi (which is a Microsoft standard). Most players support at least .srt natively. You just need to name the .srt file as the file you want to play it with, for example sample.avi and sample.srt.
Other formats just as .txt (transcripts) are supported as well.
What kind of files can I extract closed captions from?
CCExtractor currently handles:
- Most HDTV captures (where you save the Transport Stream).
- Captures where captions are recorded in bttv format. The number of cards that use this card is huge. My test samples came from a Hauppage PVR-250. You can check the complete list here.
- DVR-MS (microsoft digital video recording).
- Tivo files
- ReplayTV files
- Dish Network files
- DVDs
Usually, if you record a TV show with your capture card and CCExtractor produces the expected result, it will work for your all recordings. If it doesn't, which means that your card uses a format CCExtractor can't handle, please contact me and we'll try to make it work.
Can I edit the subtitles?
.srt files are just text files, with time information (when subtitles are supposed to be shown and for how long) and some basic formatting (use italics, bold, etc). So you can edit them with any text editor. If you need to do serious editing (such as adjusting timing), you can use subtitle editing tools - there are many available.
Can CCExtractor generate other subtitles formats?
At this time, CCExtractor can generate .srt, .smi and raw and bin files.
What's a raw file?
A raw file is a file that contains an exact dump of the closed captions bytes, without any processing. This lets you use any tool of your choice to process the data. For example, McPoodle's excellent tools can generate subtitles files in several formats, adjust timing, etc.
What's a bin file? How is it different from a raw file?
A bin file contains a dump of the closed captions bytes (same as a raw file) but it also includes timing information. This is a format that we made up for CCExtractor, i.e. it's not any kind of industry standard. However, it's the most useful (to us) for debugging purposes, so if you need to send us a sample please use this format.Also, a bin format can hold several CC streams (several languages, even from both analog and digital). A raw file cannot.
How long does it take to process a MPEG file?
Obviously, it depends on the computer and the length of the file. In my (really old) computer it took around 90 seconds for a 45 minutes show in HDTV, with CPU usage around 3% (I/O operations are what's holding it back).Currently (2018) we're processing as many as 20 TV channels in real time using a single computer with a i5 CPU.
What platforms does CCExtractor work on?
CCExtractor is developed and tested in Windows and Linux. It is also known to compile and run fine in OSX (a build script is included in the source .zip).
Where can I download it?
The source code is hosted on github. Check out our download page for links to everything.Old versions were hosted on sourceforge. We're keeping those there for statistical purposes. This is the old download page and this is the old project summary page.
How I can contact the author?
There's no longer one author. Carlos is still the official maintainer but there's a lot of people contributing to the project. Best thing is to check out our support page.
How do I use this tool (parameters, etc)?
Run it without parameters and you will get a help screen. Basically, you just give it the input file name, like this:
ccextractor the.sopranos.ts
As for the lack of documentation: There is no lack of documentation! It's just included in the program itself. Just run it without parameters and you will get complete details.
How can I contribute to this project?
There are several ways:
- If you are a developer, since the source code is available, you can fix things or add features yourself and submit a patch.
- If you are an user and find any bug, or have good suggestions, let me know.
- If you are doing your own recordings and have any particular one that CCExtractor can't process correctly, I'd definitely like to take a look at it and try to fix it.
- If you really hate that there is not a lot of documentation, you can write it yourself. I'll answer any question you might have.
Does CCExtractor use code from other projects?
Yes. Lots of code came originally from McPoodle's tools (even though it was ported from Perl to C). We've also taken code from MythTV (which in turn took some from other places) and FFmpeg. The teletext code is 95% Petr Kutalek's and was integrated with permission.
A good thing about Open Source is that you don't need to reinvent the wheel unless you want to (or unless you think you can come up with a 'rounder' wheel).