@chapter Output Devices
@c man begin OUTPUT DEVICES

Output devices are configured elements in FFmpeg that can write
multimedia data to an output device attached to your system.

When you configure your FFmpeg build, all the supported output devices
are enabled by default. You can list all available ones using the
configure option "--list-outdevs".

You can disable all the output devices using the configure option
"--disable-outdevs", and selectively enable an output device using the
option "--enable-outdev=@var{OUTDEV}", or you can disable a particular
input device using the option "--disable-outdev=@var{OUTDEV}".

The option "-formats" of the ff* tools will display the list of
enabled output devices (amongst the muxers).

A description of the currently available output devices follows.

@section alsa

ALSA (Advanced Linux Sound Architecture) output device.

@subsection Examples

@itemize
@item
Play a file on default ALSA device:
@example
ffmpeg -i INPUT -f alsa default
@end example

@item
Play a file on soundcard 1, audio device 7:
@example
ffmpeg -i INPUT -f alsa hw:1,7
@end example
@end itemize

@section caca

CACA output device.

This output device allows to show a video stream in CACA window.
Only one CACA window is allowed per application, so you can
have only one instance of this output device in an application.

To enable this output device you need to configure FFmpeg with
@code{--enable-libcaca}.
libcaca is a graphics library that outputs text instead of pixels.

For more information about libcaca, check:
@url{http://caca.zoy.org/wiki/libcaca}

@subsection Options

@table @option

@item window_title
Set the CACA window title, if not specified default to the filename
specified for the output device.

@item window_size
Set the CACA window size, can be a string of the form
@var{width}x@var{height} or a video size abbreviation.
If not specified it defaults to the size of the input video.

@item driver
Set display driver.

@item algorithm
Set dithering algorithm. Dithering is necessary
because the picture being rendered has usually far more colours than
the available palette.
The accepted values are listed with @code{-list_dither algorithms}.

@item antialias
Set antialias method. Antialiasing smoothens the rendered
image and avoids the commonly seen staircase effect.
The accepted values are listed with @code{-list_dither antialiases}.

@item charset
Set which characters are going to be used when rendering text.
The accepted values are listed with @code{-list_dither charsets}.

@item color
Set color to be used when rendering text.
The accepted values are listed with @code{-list_dither colors}.

@item list_drivers
If set to @option{true}, print a list of available drivers and exit.

@item list_dither
List available dither options related to the argument.
The argument must be one of @code{algorithms}, @code{antialiases},
@code{charsets}, @code{colors}.
@end table

@subsection Examples

@itemize
@item
The following command shows the @command{ffmpeg} output is an
CACA window, forcing its size to 80x25:
@example
ffmpeg -i INPUT -vcodec rawvideo -pix_fmt rgb24 -window_size 80x25 -f caca -
@end example

@item
Show the list of available drivers and exit:
@example
ffmpeg -i INPUT -pix_fmt rgb24 -f caca -list_drivers true -
@end example

@item
Show the list of available dither colors and exit:
@example
ffmpeg -i INPUT -pix_fmt rgb24 -f caca -list_dither colors -
@end example
@end itemize

@section fbdev

Linux framebuffer output device.

The Linux framebuffer is a graphic hardware-independent abstraction
layer to show graphics on a computer monitor, typically on the
console. It is accessed through a file device node, usually
@file{/dev/fb0}.

For more detailed information read the file
@file{Documentation/fb/framebuffer.txt} included in the Linux source tree.

@subsection Options
@table @option

@item xoffset
@item yoffset
Set x/y coordinate of top left corner. Default is 0.
@end table

@subsection Examples
Play a file on framebuffer device @file{/dev/fb0}.
Required pixel format depends on current framebuffer settings.
@example
ffmpeg -re -i INPUT -vcodec rawvideo -pix_fmt bgra -f fbdev /dev/fb0
@end example

See also @url{http://linux-fbdev.sourceforge.net/}, and fbset(1).

@section opengl
OpenGL output device.

To enable this output device you need to configure FFmpeg with @code{--enable-opengl}.

Device allows 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:
@code{AV_CTL_MESSAGE_CREATE_WINDOW_BUFFER} - create OpenGL context on current thread.
@code{AV_CTL_MESSAGE_PREPARE_WINDOW_BUFFER} - make OpenGL context current.
@code{AV_CTL_MESSAGE_DISPLAY_WINDOW_BUFFER} - swap buffers.
@code{AV_CTL_MESSAGE_DESTROY_WINDOW_BUFFER} - destroy OpenGL context.
Application is also required to inform a device about current resolution by sending @code{AV_DEVICE_WINDOW_RESIZED} message.

@subsection Options
@table @option

@item background
Set background color. Black is a default.
@item no_window
Disables default SDL window when set to non-zero value.
Application must provide OpenGL context and both @code{window_size_cb} and @code{window_swap_buffers_cb} callbacks when set.
@item window_title
Set the SDL window title, if not specified default to the filename specified for the output device.
Ignored when @option{no_window} is set.

@end table

@subsection Examples
Play a file on SDL window using OpenGL rendering:
@example
ffmpeg  -i INPUT -f opengl "window title"
@end example

@section oss

OSS (Open Sound System) output device.

@section pulse

PulseAudio output device.

To enable this output device you need to configure FFmpeg with @code{--enable-libpulse}.

More information about PulseAudio can be found on @url{http://www.pulseaudio.org}

@subsection Options
@table @option

@item server
Connect to a specific PulseAudio server, specified by an IP address.
Default server is used when not provided.

@item name
Specify the application name PulseAudio will use when showing active clients,
by default it is the @code{LIBAVFORMAT_IDENT} string.

@item stream_name
Specify the stream name PulseAudio will use when showing active streams,
by default it is set to the specified output name.

@item device
Specify the device to use. Default device is used when not provided.
List of output devices can be obtained with command @command{pactl list sinks}.

@item buffer_size
@item buffer_duration
Control the size and duration of the PulseAudio buffer. A small buffer
gives more control, but requires more frequent updates.

@option{buffer_size} specifies size in bytes while
@option{buffer_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 they
are set to 0 (which is default), the device will use the default
PulseAudio duration value. By default PulseAudio set buffer duration
to around 2 seconds.
@end table

@subsection Examples
Play a file on default device on default server:
@example
ffmpeg  -i INPUT -f pulse "stream name"
@end example

@section sdl

SDL (Simple DirectMedia Layer) output device.

This output device allows to show a video stream in an SDL
window. Only one SDL window is allowed per application, so you can
have only one instance of this output device in an application.

To enable this output device you need libsdl installed on your system
when configuring your build.

For more information about SDL, check:
@url{http://www.libsdl.org/}

@subsection Options

@table @option

@item window_title
Set the SDL window title, if not specified default to the filename
specified for the output device.

@item icon_title
Set the name of the iconified SDL window, if not specified it is set
to the same value of @var{window_title}.

@item window_size
Set the SDL window size, can be a string of the form
@var{width}x@var{height} or a video size abbreviation.
If not specified it defaults to the size of the input video,
downscaled according to the aspect ratio.

@item window_fullscreen
Set fullscreen mode when non-zero value is provided.
Default value is zero.
@end table

@subsection Interactive commands

The window created by the device can be controlled through the
following interactive commands.

@table @key
@item q, ESC
Quit the device immediately.
@end table

@subsection Examples

The following command shows the @command{ffmpeg} output is an
SDL window, forcing its size to the qcif format:
@example
ffmpeg -i INPUT -vcodec rawvideo -pix_fmt yuv420p -window_size qcif -f sdl "SDL output"
@end example

@section sndio

sndio audio output device.

@section xv

XV (XVideo) output device.

This output device allows to show a video stream in a X Window System
window.

@subsection Options

@table @option
@item display_name
Specify the hardware display name, which determines the display and
communications domain to be used.

The display name or DISPLAY environment variable can be a string in
the format @var{hostname}[:@var{number}[.@var{screen_number}]].

@var{hostname} specifies the name of the host machine on which the
display is physically attached. @var{number} specifies the number of
the display server on that host machine. @var{screen_number} specifies
the screen to be used on that server.

If unspecified, it defaults to the value of the DISPLAY environment
variable.

For example, @code{dual-headed:0.1} would specify screen 1 of display
0 on the machine named ``dual-headed''.

Check the X11 specification for more detailed information about the
display name format.

@item window_size
Set the created window size, can be a string of the form
@var{width}x@var{height} or a video size abbreviation. If not
specified it defaults to the size of the input video.

@item window_x
@item window_y
Set the X and Y window offsets for the created window. They are both
set to 0 by default. The values may be ignored by the window manager.

@item window_title
Set the window title, if not specified default to the filename
specified for the output device.
@end table

For more information about XVideo see @url{http://www.x.org/}.

@subsection Examples

@itemize
@item
Decode, display and encode video input with @command{ffmpeg} at the
same time:
@example
ffmpeg -i INPUT OUTPUT -f xv display
@end example

@item
Decode and display the input video to multiple X11 windows:
@example
ffmpeg -i INPUT -f xv normal -vf negate -f xv negated
@end example
@end itemize

@c man end OUTPUT DEVICES
