# ffplay Documentation

# Table of Contents

# 1. Synopsis

ffplay [options] [‘`input_file`’]

# 2. Description

FFplay is a very simple and portable media player using the FFmpeg libraries and the SDL library. It is mostly used as a testbed for the various FFmpeg APIs.

# 3. Options

All the numerical options, if not specified otherwise, accept in input a string representing a number, which may contain one of the SI unit prefixes, for example ’K’, ’M’, ’G’. If ’i’ is appended after the prefix, binary prefixes are used, which are based on powers of 1024 instead of powers of 1000. The ’B’ postfix multiplies the value by 8, and can be appended after a unit prefix or used alone. This allows using for example ’KB’, ’MiB’, ’G’ and ’B’ as number postfix.

Options which do not take arguments are boolean options, and set the corresponding value to true. They can be set to false by prefixing with "no" the option name, for example using "-nofoo" in the command line will set to false the boolean option with name "foo".

## 3.1 Stream specifiers

Some options are applied per-stream, e.g. bitrate or codec. Stream specifiers are used to precisely specify which stream(s) does a given option belong to.

A stream specifier is a string generally appended to the option name and separated from it by a colon. E.g. `-codec:a:1 ac3` option contains `a:1` stream specifier, which matches the second audio stream. Therefore it would select the ac3 codec for the second audio stream.

A stream specifier can match several streams, the option is then applied to all of them. E.g. the stream specifier in `-b:a 128k` matches all audio streams.

An empty stream specifier matches all streams, for example `-codec copy` or `-codec: copy` would copy all the streams without reencoding.

Possible forms of stream specifiers are:

‘`stream_index`’

  Matches the stream with this index. E.g. `-threads:1 4` would set the thread count for the second stream to 4.

‘`stream_type[:stream_index]`’

  stream_type is one of: ’v’ for video, ’a’ for audio, ’s’ for subtitle, ’d’ for data and ’t’ for attachments. If stream_index is given, then matches stream number stream_index of this type. Otherwise matches all streams of this type.

‘`p:program_id[:stream_index]`’

  If stream_index is given, then matches stream number stream_index in program with id program_id. Otherwise matches all streams in this program.

‘`#stream_id`’

  Matches the stream by format-specific ID.

## 3.2 Generic options

These options are shared amongst the av* tools.

‘`-L`’

  Show license.

‘`-h, -?, -help, --help [arg]`’

  Show help. An optional parameter may be specified to print help about a specific item.

  Possible values of arg are:

  ‘`decoder=decoder_name`’

    Print detailed information about the decoder named decoder_name. Use the ‘`-decoders`’ option to get a list of all decoders.

  ‘`encoder=encoder_name`’

    Print detailed information about the encoder named encoder_name. Use the ‘`-encoders`’ option to get a list of all encoders.

  ‘`demuxer=demuxer_name`’

    Print detailed information about the demuxer named demuxer_name. Use the ‘`-formats`’ option to get a list of all demuxers and muxers.

  ‘`muxer=muxer_name`’

    Print detailed information about the muxer named muxer_name. Use the ‘`-formats`’ option to get a list of all muxers and demuxers.

‘`-version`’

  Show version.

‘`-formats`’

  Show available formats.

  The fields preceding the format names have the following meanings:

  ‘`D`’

    Decoding available

  ‘`E`’

    Encoding available

‘`-codecs`’

  Show all codecs known to libavcodec.

  Note that the term ’codec’ is used throughout this documentation as a shortcut for what is more correctly called a media bitstream format.

‘`-decoders`’

  Show available decoders.

‘`-encoders`’

  Show all available encoders.

‘`-bsfs`’

  Show available bitstream filters.

‘`-protocols`’

  Show available protocols.

‘`-filters`’

  Show available libavfilter filters.

‘`-pix_fmts`’

  Show available pixel formats.

‘`-sample_fmts`’

  Show available sample formats.

‘`-layouts`’

  Show channel names and standard channel layouts.

‘`-loglevel loglevel | -v loglevel`’

  Set the logging level used by the library. loglevel is a number or a string containing one of the following values:

  ‘`quiet`’
  ‘`panic`’
  ‘`fatal`’
  ‘`error`’
  ‘`warning`’
  ‘`info`’
  ‘`verbose`’
  ‘`debug`’

  By default the program logs to stderr, if coloring is supported by the terminal, colors are used to mark errors and warnings. Log coloring can be disabled setting the environment variable `AV_LOG_FORCE_NOCOLOR` or `NO_COLOR`, or can be forced setting the environment variable `AV_LOG_FORCE_COLOR`. The use of the environment variable `NO_COLOR` is deprecated and will be dropped in a following FFmpeg version.

‘`-report`’

  Dump full command line and console output to a file named `program-YYYYMMDD-HHMMSS.log` in the current directory. This file can be useful for bug reports. It also implies `-loglevel verbose`.

  Setting the environment variable `FFREPORT` to any value has the same effect. If the value is a ’:’-separated key=value sequence, these options will affect the report; options values must be escaped if they contain special characters or the options delimiter ’:’ (see the “Quoting and escaping” section in the ffmpeg-utils manual). The following option is recognized:

  ‘`file`’

    set the file name to use for the report; `%p` is expanded to the name of the program, `%t` is expanded to a timestamp, `%%` is expanded to a plain `%`

  Errors in parsing the environment variable are not fatal, and will not appear in the report.

‘`-cpuflags flags (global)`’

  Allows setting and clearing cpu flags. This option is intended for testing. Do not use it unless you know what you’re doing.

      ffmpeg -cpuflags -sse+mmx ...
      ffmpeg -cpuflags mmx ...
      ffmpeg -cpuflags 0 ...

## 3.3 AVOptions

These options are provided directly by the libavformat, libavdevice and libavcodec libraries. To see the list of available AVOptions, use the ‘`-help`’ option. They are separated into two categories:

‘`generic`’

  These options can be set for any container, codec or device. Generic options are listed under AVFormatContext options for containers/devices and under AVCodecContext options for codecs.

‘`private`’

  These options are specific to the given container, device or codec. Private options are listed under their corresponding containers/devices/codecs.

For example to write an ID3v2.3 header instead of a default ID3v2.4 to an MP3 file, use the ‘`id3v2_version`’ private option of the MP3 muxer:

    ffmpeg -i input.flac -id3v2_version 3 out.mp3

All codec AVOptions are obviously per-stream, so the chapter on stream specifiers applies to them

Note ‘`-nooption`’ syntax cannot be used for boolean AVOptions, use ‘`-option 0`’/‘`-option 1`’.

Note2 old undocumented way of specifying per-stream AVOptions by prepending v/a/s to the options name is now obsolete and will be removed soon.

## 3.4 Main options

‘`-x width`’

  Force displayed width.

‘`-y height`’

  Force displayed height.

‘`-s size`’

  Set frame size (WxH or abbreviation), needed for videos which do not contain a header with the frame size like raw YUV. This option has been deprecated in favor of private options, try -video_size.

‘`-an`’

  Disable audio.

‘`-vn`’

  Disable video.

‘`-ss pos`’

  Seek to a given position in seconds.

‘`-t duration`’

  play <duration> seconds of audio/video

‘`-bytes`’

  Seek by bytes.

‘`-nodisp`’

  Disable graphical display.

‘`-f fmt`’

  Force format.

‘`-window_title title`’

  Set window title (default is the input filename).

‘`-loop number`’

  Loops movie playback <number> times. 0 means forever.

‘`-showmode mode`’

  Set the show mode to use. Available values for mode are:

  ‘`0, video`’

    show video

  ‘`1, waves`’

    show audio waves

  ‘`2, rdft`’

    show audio frequency band using RDFT ((Inverse) Real Discrete Fourier Transform)

  Default value is "video", if video is not present or cannot be played "rdft" is automatically selected.

  You can interactively cycle through the available show modes by pressing the key <w>.

‘`-vf filter_graph`’

  Create the filter graph specified by filter_graph and use it to filter the video stream.

  filter_graph is a description of the filter graph to apply to the stream, and must have a single video input and a single video output. In the filter graph, the input is associated to the label `in`, and the output to the label `out`. See the ffmpeg-filters manual for more information about the filtergraph syntax.

‘`-i input_file`’

  Read input_file.

## 3.5 Advanced options

‘`-pix_fmt format`’

  Set pixel format. This option has been deprecated in favor of private options, try -pixel_format.

‘`-stats`’

  Show the stream duration, the codec parameters, the current position in the stream and the audio/video synchronisation drift.

‘`-bug`’

  Work around bugs.

‘`-fast`’

  Non-spec-compliant optimizations.

‘`-genpts`’

  Generate pts.

‘`-rtp_tcp`’

  Force RTP/TCP protocol usage instead of RTP/UDP. It is only meaningful if you are streaming with the RTSP protocol.

‘`-sync type`’

  Set the master clock to audio (`type=audio`), video (`type=video`) or external (`type=ext`). Default is audio. The master clock is used to control audio-video synchronization. Most media players use audio as master clock, but in some cases (streaming or high quality broadcast) it is necessary to change that. This option is mainly used for debugging purposes.

‘`-threads count`’

  Set the thread count.

‘`-ast audio_stream_number`’

  Select the desired audio stream number, counting from 0. The number refers to the list of all the input audio streams. If it is greater than the number of audio streams minus one, then the last one is selected, if it is negative the audio playback is disabled.

‘`-vst video_stream_number`’

  Select the desired video stream number, counting from 0. The number refers to the list of all the input video streams. If it is greater than the number of video streams minus one, then the last one is selected, if it is negative the video playback is disabled.

‘`-sst subtitle_stream_number`’

  Select the desired subtitle stream number, counting from 0. The number refers to the list of all the input subtitle streams. If it is greater than the number of subtitle streams minus one, then the last one is selected, if it is negative the subtitle rendering is disabled.

‘`-autoexit`’

  Exit when video is done playing.

‘`-exitonkeydown`’

  Exit if any key is pressed.

‘`-exitonmousedown`’

  Exit if any mouse button is pressed.

‘`-codec:media_specifier codec_name`’

  Force a specific decoder implementation for the stream identified by media_specifier, which can assume the values `a` (audio), `v` (video), and `s` subtitle.

‘`-acodec codec_name`’

  Force a specific audio decoder.

‘`-vcodec codec_name`’

  Force a specific video decoder.

‘`-scodec codec_name`’

  Force a specific subtitle decoder.

## 3.6 While playing

<q, ESC>

  Quit.

<f>

  Toggle full screen.

<p, SPC>

  Pause.

<a>

  Cycle audio channel.

<v>

  Cycle video channel.

<t>

  Cycle subtitle channel.

<w>

  Show audio waves.

<left/right>

  Seek backward/forward 10 seconds.

<down/up>

  Seek backward/forward 1 minute.

<page down/page up>

  Seek backward/forward 10 minutes.

<mouse click>

  Seek to percentage in file corresponding to fraction of width.

# 4. See Also

ffmpeg, ffprobe, ffserver, ffmpeg-utils, ffmpeg-scaler, ffmpeg-resampler, ffmpeg-codecs, ffmpeg-bitstream-filters, ffmpeg-formats, ffmpeg-devices, ffmpeg-protocols, ffmpeg-filters

# 5. 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 command `git log` in the FFmpeg source directory, or browsing the online repository at http://source.ffmpeg.org.

Maintainers for the specific components are listed in the file ‘`MAINTAINERS`’ in the source code tree.