Sophie

Sophie

distrib > Mageia > 2 > i586 > media > core-updates > by-pkgid > 43be034253e2a3c1572620c34e5168f8 > files > 14

ffmpeg-0.10.4-1.mga2.i586.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html>
<!-- Created on June 16, 2012 by texi2html 1.82 -->
<!--
texi2html was written by: 
            Lionel Cons <Lionel.Cons@cern.ch> (original author)
            Karl Berry  <karl@freefriends.org>
            Olaf Bachmann <obachman@mathematik.uni-kl.de>
            and many others.
Maintained by: Many creative people.
Send bugs and suggestions to <texi2html-bug@nongnu.org>

-->
<head>
<title>FFmpeg documentation : : </title>

<meta name="description" content=": ">
<meta name="keywords" content="FFmpeg documentation : : ">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2html 1.82">

<style type="text/css">
<!--
a.summary-letter { text-decoration: none }
a { color: #2D6198; }
a:visited { color: #884488; }
h1 a, h2 a, h3 a { text-decoration: inherit; color: inherit; }
p { margin-left: 1em; margin-right: 1em; }
table { margin-left: 2em; }
pre { margin-left: 2em; }
#footer { text-align: center; }
#body { margin-left: 1em; margin-right: 1em; }
body { background-color: #313131; margin: 0; }

#container {
    background-color: white;
    color: #202020;
    margin-left: 1em;
    margin-right: 1em;
}

h1 {
    background-color: #7BB37B;
    border: 1px solid #6A996A;
    color: #151515;
    font-size: 1.2em;
    padding-bottom: 0.2em;
    padding-left: 0.4em;
    padding-top: 0.2em;
}

h2 {
    color: #313131;
    font-size: 1.2em;
}

h3 {
    color: #313131;
    font-size: 0.8em;
    margin-bottom: -8px;
}

.note {
    margin: 1em;
    border: 1px solid #bbc9d8;
    background-color: #dde1e1;
}

.important {
    margin: 1em;
    border: 1px solid #d26767;
    background-color: #f8e1e1;
}

-->
</style>

<link rel="icon" href="favicon.png" type="image/png" />
<link rel="stylesheet" type="text/css" href="default.css" />

</head>

<body >
<div id="container">

<div id="body">
<a name="SEC_Top"></a>
<h1 class="settitle">ffmpeg Documentation</h1>

<a name="SEC_Contents"></a>
<h1>Table of Contents</h1>
<div class="contents">

<ul class="toc">
  <li><a name="toc-Synopsis" href="#Synopsis">1. Synopsis</a></li>
  <li><a name="toc-Description" href="#Description">2. Description</a></li>
  <li><a name="toc-Stream-selection" href="#Stream-selection">3. Stream selection</a></li>
  <li><a name="toc-Options-7" href="#Options-7">4. Options</a>
  <ul class="toc">
    <li><a name="toc-Stream-specifiers-1" href="#Stream-specifiers-1">4.1 Stream specifiers</a></li>
    <li><a name="toc-Generic-options" href="#Generic-options">4.2 Generic options</a></li>
    <li><a name="toc-AVOptions" href="#AVOptions">4.3 AVOptions</a></li>
    <li><a name="toc-Main-options" href="#Main-options">4.4 Main options</a></li>
    <li><a name="toc-Video-Options" href="#Video-Options">4.5 Video Options</a></li>
    <li><a name="toc-Advanced-Video-Options" href="#Advanced-Video-Options">4.6 Advanced Video Options</a></li>
    <li><a name="toc-Audio-Options" href="#Audio-Options">4.7 Audio Options</a></li>
    <li><a name="toc-Advanced-Audio-options_003a" href="#Advanced-Audio-options_003a">4.8 Advanced Audio options:</a></li>
    <li><a name="toc-Subtitle-options_003a" href="#Subtitle-options_003a">4.9 Subtitle options:</a></li>
    <li><a name="toc-Audio_002fVideo-grab-options" href="#Audio_002fVideo-grab-options">4.10 Audio/Video grab options</a></li>
    <li><a name="toc-Advanced-options" href="#Advanced-options">4.11 Advanced options</a></li>
    <li><a name="toc-Preset-files" href="#Preset-files">4.12 Preset files</a></li>
  </ul></li>
  <li><a name="toc-Tips" href="#Tips">5. Tips</a></li>
  <li><a name="toc-Examples" href="#Examples">6. Examples</a>
  <ul class="toc">
    <li><a name="toc-Preset-files-1" href="#Preset-files-1">6.1 Preset files</a></li>
    <li><a name="toc-Video-and-Audio-grabbing" href="#Video-and-Audio-grabbing">6.2 Video and Audio grabbing</a></li>
    <li><a name="toc-X11-grabbing" href="#X11-grabbing">6.3 X11 grabbing</a></li>
    <li><a name="toc-Video-and-Audio-file-format-conversion" href="#Video-and-Audio-file-format-conversion">6.4 Video and Audio file format conversion</a></li>
  </ul></li>
  <li><a name="toc-Expression-Evaluation" href="#Expression-Evaluation">7. Expression Evaluation</a></li>
  <li><a name="toc-Decoders" href="#Decoders">8. Decoders</a></li>
  <li><a name="toc-Video-Decoders" href="#Video-Decoders">9. Video Decoders</a>
  <ul class="toc">
    <li><a name="toc-rawvideo" href="#rawvideo">9.1 rawvideo</a>
    <ul class="toc">
      <li><a name="toc-Options-1" href="#Options-1">9.1.1 Options</a></li>
    </ul>
</li>
  </ul></li>
  <li><a name="toc-Audio-Decoders" href="#Audio-Decoders">10. Audio Decoders</a>
  <ul class="toc">
    <li><a name="toc-ffwavesynth" href="#ffwavesynth">10.1 ffwavesynth</a></li>
  </ul></li>
  <li><a name="toc-Encoders" href="#Encoders">11. Encoders</a></li>
  <li><a name="toc-Audio-Encoders" href="#Audio-Encoders">12. Audio Encoders</a>
  <ul class="toc">
    <li><a name="toc-ac3-and-ac3_005ffixed" href="#ac3-and-ac3_005ffixed">12.1 ac3 and ac3_fixed</a>
    <ul class="toc">
      <li><a name="toc-AC_002d3-Metadata" href="#AC_002d3-Metadata">12.1.1 AC-3 Metadata</a>
      <ul class="toc">
        <li><a name="toc-Metadata-Control-Options" href="#Metadata-Control-Options">12.1.1.1 Metadata Control Options</a></li>
        <li><a name="toc-Downmix-Levels" href="#Downmix-Levels">12.1.1.2 Downmix Levels</a></li>
        <li><a name="toc-Audio-Production-Information" href="#Audio-Production-Information">12.1.1.3 Audio Production Information</a></li>
        <li><a name="toc-Other-Metadata-Options" href="#Other-Metadata-Options">12.1.1.4 Other Metadata Options</a></li>
      </ul></li>
      <li><a name="toc-Extended-Bitstream-Information" href="#Extended-Bitstream-Information">12.1.2 Extended Bitstream Information</a>
      <ul class="toc">
        <li><a name="toc-Extended-Bitstream-Information-_002d-Part-1" href="#Extended-Bitstream-Information-_002d-Part-1">12.1.2.1 Extended Bitstream Information - Part 1</a></li>
        <li><a name="toc-Extended-Bitstream-Information-_002d-Part-2" href="#Extended-Bitstream-Information-_002d-Part-2">12.1.2.2 Extended Bitstream Information - Part 2</a></li>
      </ul></li>
      <li><a name="toc-Other-AC_002d3-Encoding-Options" href="#Other-AC_002d3-Encoding-Options">12.1.3 Other AC-3 Encoding Options</a></li>
      <li><a name="toc-Floating_002dPoint_002dOnly-AC_002d3-Encoding-Options" href="#Floating_002dPoint_002dOnly-AC_002d3-Encoding-Options">12.1.4 Floating-Point-Only AC-3 Encoding Options</a></li>
    </ul>
</li>
  </ul></li>
  <li><a name="toc-Video-Encoders" href="#Video-Encoders">13. Video Encoders</a>
  <ul class="toc">
    <li><a name="toc-libvpx" href="#libvpx">13.1 libvpx</a>
    <ul class="toc">
      <li><a name="toc-Options-5" href="#Options-5">13.1.1 Options</a></li>
    </ul></li>
    <li><a name="toc-libx264" href="#libx264">13.2 libx264</a>
    <ul class="toc">
      <li><a name="toc-Options-4" href="#Options-4">13.2.1 Options</a></li>
    </ul>
</li>
  </ul></li>
  <li><a name="toc-Demuxers" href="#Demuxers">14. Demuxers</a>
  <ul class="toc">
    <li><a name="toc-image2-2" href="#image2-2">14.1 image2</a></li>
    <li><a name="toc-applehttp" href="#applehttp">14.2 applehttp</a></li>
    <li><a name="toc-sbg" href="#sbg">14.3 sbg</a></li>
  </ul></li>
  <li><a name="toc-Muxers" href="#Muxers">15. Muxers</a>
  <ul class="toc">
    <li><a name="toc-crc-1" href="#crc-1">15.1 crc</a></li>
    <li><a name="toc-framecrc-1" href="#framecrc-1">15.2 framecrc</a></li>
    <li><a name="toc-image2-1" href="#image2-1">15.3 image2</a></li>
    <li><a name="toc-mov" href="#mov">15.4 mov</a></li>
    <li><a name="toc-mpegts" href="#mpegts">15.5 mpegts</a></li>
    <li><a name="toc-null" href="#null">15.6 null</a></li>
    <li><a name="toc-matroska" href="#matroska">15.7 matroska</a></li>
    <li><a name="toc-segment" href="#segment">15.8 segment</a></li>
  </ul></li>
  <li><a name="toc-Input-Devices" href="#Input-Devices">16. Input Devices</a>
  <ul class="toc">
    <li><a name="toc-alsa-1" href="#alsa-1">16.1 alsa</a></li>
    <li><a name="toc-bktr" href="#bktr">16.2 bktr</a></li>
    <li><a name="toc-dshow" href="#dshow">16.3 dshow</a>
    <ul class="toc">
      <li><a name="toc-Options-2" href="#Options-2">16.3.1 Options</a></li>
      <li><a name="toc-Examples-8" href="#Examples-8">16.3.2 Examples</a></li>
    </ul></li>
    <li><a name="toc-dv1394" href="#dv1394">16.4 dv1394</a></li>
    <li><a name="toc-fbdev" href="#fbdev">16.5 fbdev</a></li>
    <li><a name="toc-jack" href="#jack">16.6 jack</a></li>
    <li><a name="toc-lavfi" href="#lavfi">16.7 lavfi</a>
    <ul class="toc">
      <li><a name="toc-Options" href="#Options">16.7.1 Options</a></li>
      <li><a name="toc-Examples-4" href="#Examples-4">16.7.2 Examples</a></li>
    </ul></li>
    <li><a name="toc-libdc1394" href="#libdc1394">16.8 libdc1394</a></li>
    <li><a name="toc-openal" href="#openal">16.9 openal</a>
    <ul class="toc">
      <li><a name="toc-Options-6" href="#Options-6">16.9.1 Options</a></li>
      <li><a name="toc-Examples-3" href="#Examples-3">16.9.2 Examples</a></li>
    </ul></li>
    <li><a name="toc-oss" href="#oss">16.10 oss</a></li>
    <li><a name="toc-pulse" href="#pulse">16.11 pulse</a>
    <ul class="toc">
      <li><a name="toc-server-AVOption" href="#server-AVOption">16.11.1 <var>server</var> AVOption</a></li>
      <li><a name="toc-name-AVOption" href="#name-AVOption">16.11.2 <var>name</var> AVOption</a></li>
      <li><a name="toc-stream_005fname-AVOption" href="#stream_005fname-AVOption">16.11.3 <var>stream_name</var> AVOption</a></li>
      <li><a name="toc-sample_005frate-AVOption" href="#sample_005frate-AVOption">16.11.4 <var>sample_rate</var> AVOption</a></li>
      <li><a name="toc-channels-AVOption" href="#channels-AVOption">16.11.5 <var>channels</var> AVOption</a></li>
      <li><a name="toc-frame_005fsize-AVOption" href="#frame_005fsize-AVOption">16.11.6 <var>frame_size</var> AVOption</a></li>
      <li><a name="toc-fragment_005fsize-AVOption" href="#fragment_005fsize-AVOption">16.11.7 <var>fragment_size</var> AVOption</a></li>
    </ul></li>
    <li><a name="toc-sndio" href="#sndio">16.12 sndio</a></li>
    <li><a name="toc-video4linux-and-video4linux2" href="#video4linux-and-video4linux2">16.13 video4linux and video4linux2</a></li>
    <li><a name="toc-vfwcap" href="#vfwcap">16.14 vfwcap</a></li>
    <li><a name="toc-x11grab" href="#x11grab">16.15 x11grab</a>
    <ul class="toc">
      <li><a name="toc-follow_005fmouse-AVOption" href="#follow_005fmouse-AVOption">16.15.1 <var>follow_mouse</var> AVOption</a></li>
      <li><a name="toc-show_005fregion-AVOption" href="#show_005fregion-AVOption">16.15.2 <var>show_region</var> AVOption</a></li>
    </ul>
</li>
  </ul></li>
  <li><a name="toc-Output-Devices" href="#Output-Devices">17. Output Devices</a>
  <ul class="toc">
    <li><a name="toc-alsa" href="#alsa">17.1 alsa</a></li>
    <li><a name="toc-oss-1" href="#oss-1">17.2 oss</a></li>
    <li><a name="toc-sdl" href="#sdl">17.3 sdl</a>
    <ul class="toc">
      <li><a name="toc-Options-3" href="#Options-3">17.3.1 Options</a></li>
      <li><a name="toc-Examples-7" href="#Examples-7">17.3.2 Examples</a></li>
    </ul></li>
    <li><a name="toc-sndio-1" href="#sndio-1">17.4 sndio</a></li>
  </ul></li>
  <li><a name="toc-Protocols" href="#Protocols">18. Protocols</a>
  <ul class="toc">
    <li><a name="toc-applehttp-1" href="#applehttp-1">18.1 applehttp</a></li>
    <li><a name="toc-concat" href="#concat">18.2 concat</a></li>
    <li><a name="toc-file" href="#file">18.3 file</a></li>
    <li><a name="toc-gopher" href="#gopher">18.4 gopher</a></li>
    <li><a name="toc-http" href="#http">18.5 http</a></li>
    <li><a name="toc-mmst" href="#mmst">18.6 mmst</a></li>
    <li><a name="toc-mmsh" href="#mmsh">18.7 mmsh</a></li>
    <li><a name="toc-md5" href="#md5">18.8 md5</a></li>
    <li><a name="toc-pipe" href="#pipe">18.9 pipe</a></li>
    <li><a name="toc-rtmp" href="#rtmp">18.10 rtmp</a></li>
    <li><a name="toc-rtmp_002c-rtmpe_002c-rtmps_002c-rtmpt_002c-rtmpte" href="#rtmp_002c-rtmpe_002c-rtmps_002c-rtmpt_002c-rtmpte">18.11 rtmp, rtmpe, rtmps, rtmpt, rtmpte</a></li>
    <li><a name="toc-rtp" href="#rtp">18.12 rtp</a></li>
    <li><a name="toc-rtsp" href="#rtsp">18.13 rtsp</a></li>
    <li><a name="toc-sap" href="#sap">18.14 sap</a>
    <ul class="toc">
      <li><a name="toc-Muxer" href="#Muxer">18.14.1 Muxer</a></li>
      <li><a name="toc-Demuxer" href="#Demuxer">18.14.2 Demuxer</a></li>
    </ul></li>
    <li><a name="toc-tcp" href="#tcp">18.15 tcp</a></li>
    <li><a name="toc-udp" href="#udp">18.16 udp</a></li>
  </ul></li>
  <li><a name="toc-Bitstream-Filters" href="#Bitstream-Filters">19. Bitstream Filters</a>
  <ul class="toc">
    <li><a name="toc-aac_005fadtstoasc" href="#aac_005fadtstoasc">19.1 aac_adtstoasc</a></li>
    <li><a name="toc-chomp" href="#chomp">19.2 chomp</a></li>
    <li><a name="toc-dump_005fextradata" href="#dump_005fextradata">19.3 dump_extradata</a></li>
    <li><a name="toc-h264_005fmp4toannexb" href="#h264_005fmp4toannexb">19.4 h264_mp4toannexb</a></li>
    <li><a name="toc-imx_005fdump_005fheader" href="#imx_005fdump_005fheader">19.5 imx_dump_header</a></li>
    <li><a name="toc-mjpeg2jpeg" href="#mjpeg2jpeg">19.6 mjpeg2jpeg</a></li>
    <li><a name="toc-mjpega_005fdump_005fheader" href="#mjpega_005fdump_005fheader">19.7 mjpega_dump_header</a></li>
    <li><a name="toc-movsub" href="#movsub">19.8 movsub</a></li>
    <li><a name="toc-mp3_005fheader_005fcompress" href="#mp3_005fheader_005fcompress">19.9 mp3_header_compress</a></li>
    <li><a name="toc-mp3_005fheader_005fdecompress" href="#mp3_005fheader_005fdecompress">19.10 mp3_header_decompress</a></li>
    <li><a name="toc-noise" href="#noise">19.11 noise</a></li>
    <li><a name="toc-remove_005fextradata" href="#remove_005fextradata">19.12 remove_extradata</a></li>
  </ul></li>
  <li><a name="toc-Filtergraph-description" href="#Filtergraph-description">20. Filtergraph description</a>
  <ul class="toc">
    <li><a name="toc-Filtergraph-syntax" href="#Filtergraph-syntax">20.1 Filtergraph syntax</a></li>
  </ul></li>
  <li><a name="toc-Audio-Filters" href="#Audio-Filters">21. Audio Filters</a>
  <ul class="toc">
    <li><a name="toc-aconvert" href="#aconvert">21.1 aconvert</a></li>
    <li><a name="toc-aformat" href="#aformat">21.2 aformat</a></li>
    <li><a name="toc-amerge" href="#amerge">21.3 amerge</a></li>
    <li><a name="toc-anull" href="#anull">21.4 anull</a></li>
    <li><a name="toc-aresample" href="#aresample">21.5 aresample</a></li>
    <li><a name="toc-ashowinfo" href="#ashowinfo">21.6 ashowinfo</a></li>
    <li><a name="toc-asplit" href="#asplit">21.7 asplit</a></li>
    <li><a name="toc-astreamsync" href="#astreamsync">21.8 astreamsync</a></li>
    <li><a name="toc-earwax" href="#earwax">21.9 earwax</a></li>
    <li><a name="toc-pan" href="#pan">21.10 pan</a>
    <ul class="toc">
      <li><a name="toc-Mixing-examples" href="#Mixing-examples">21.10.1 Mixing examples</a></li>
      <li><a name="toc-Remapping-examples" href="#Remapping-examples">21.10.2 Remapping examples</a></li>
    </ul></li>
    <li><a name="toc-silencedetect" href="#silencedetect">21.11 silencedetect</a></li>
    <li><a name="toc-volume" href="#volume">21.12 volume</a>
    <ul class="toc">
      <li><a name="toc-Examples-1" href="#Examples-1">21.12.1 Examples</a></li>
    </ul>
</li>
  </ul></li>
  <li><a name="toc-Audio-Sources" href="#Audio-Sources">22. Audio Sources</a>
  <ul class="toc">
    <li><a name="toc-abuffer" href="#abuffer">22.1 abuffer</a></li>
    <li><a name="toc-aevalsrc" href="#aevalsrc">22.2 aevalsrc</a>
    <ul class="toc">
      <li><a name="toc-Examples-5" href="#Examples-5">22.2.1 Examples</a></li>
    </ul></li>
    <li><a name="toc-amovie" href="#amovie">22.3 amovie</a></li>
    <li><a name="toc-anullsrc" href="#anullsrc">22.4 anullsrc</a></li>
  </ul></li>
  <li><a name="toc-Audio-Sinks" href="#Audio-Sinks">23. Audio Sinks</a>
  <ul class="toc">
    <li><a name="toc-abuffersink" href="#abuffersink">23.1 abuffersink</a></li>
    <li><a name="toc-anullsink" href="#anullsink">23.2 anullsink</a></li>
  </ul></li>
  <li><a name="toc-Video-Filters" href="#Video-Filters">24. Video Filters</a>
  <ul class="toc">
    <li><a name="toc-ass" href="#ass">24.1 ass</a></li>
    <li><a name="toc-blackframe" href="#blackframe">24.2 blackframe</a></li>
    <li><a name="toc-boxblur" href="#boxblur">24.3 boxblur</a></li>
    <li><a name="toc-copy" href="#copy">24.4 copy</a></li>
    <li><a name="toc-crop" href="#crop">24.5 crop</a></li>
    <li><a name="toc-cropdetect" href="#cropdetect">24.6 cropdetect</a></li>
    <li><a name="toc-delogo" href="#delogo">24.7 delogo</a></li>
    <li><a name="toc-deshake" href="#deshake">24.8 deshake</a></li>
    <li><a name="toc-drawbox" href="#drawbox">24.9 drawbox</a></li>
    <li><a name="toc-drawtext" href="#drawtext">24.10 drawtext</a></li>
    <li><a name="toc-fade" href="#fade">24.11 fade</a></li>
    <li><a name="toc-fieldorder" href="#fieldorder">24.12 fieldorder</a></li>
    <li><a name="toc-fifo" href="#fifo">24.13 fifo</a></li>
    <li><a name="toc-format" href="#format">24.14 format</a></li>
    <li><a name="toc-frei0r-1" href="#frei0r-1">24.15 frei0r</a></li>
    <li><a name="toc-gradfun" href="#gradfun">24.16 gradfun</a></li>
    <li><a name="toc-hflip" href="#hflip">24.17 hflip</a></li>
    <li><a name="toc-hqdn3d" href="#hqdn3d">24.18 hqdn3d</a></li>
    <li><a name="toc-lut_002c-lutrgb_002c-lutyuv" href="#lut_002c-lutrgb_002c-lutyuv">24.19 lut, lutrgb, lutyuv</a></li>
    <li><a name="toc-mp" href="#mp">24.20 mp</a></li>
    <li><a name="toc-negate" href="#negate">24.21 negate</a></li>
    <li><a name="toc-noformat" href="#noformat">24.22 noformat</a></li>
    <li><a name="toc-null-1" href="#null-1">24.23 null</a></li>
    <li><a name="toc-ocv" href="#ocv">24.24 ocv</a>
    <ul class="toc">
      <li><a name="toc-dilate-1" href="#dilate-1">24.24.1 dilate</a></li>
      <li><a name="toc-erode" href="#erode">24.24.2 erode</a></li>
      <li><a name="toc-smooth" href="#smooth">24.24.3 smooth</a></li>
    </ul></li>
    <li><a name="toc-overlay-1" href="#overlay-1">24.25 overlay</a></li>
    <li><a name="toc-pad" href="#pad">24.26 pad</a></li>
    <li><a name="toc-pixdesctest" href="#pixdesctest">24.27 pixdesctest</a></li>
    <li><a name="toc-scale" href="#scale">24.28 scale</a></li>
    <li><a name="toc-select" href="#select">24.29 select</a></li>
    <li><a name="toc-setdar-1" href="#setdar-1">24.30 setdar</a></li>
    <li><a name="toc-setpts" href="#setpts">24.31 setpts</a></li>
    <li><a name="toc-setsar-1" href="#setsar-1">24.32 setsar</a></li>
    <li><a name="toc-settb" href="#settb">24.33 settb</a></li>
    <li><a name="toc-showinfo" href="#showinfo">24.34 showinfo</a></li>
    <li><a name="toc-slicify" href="#slicify">24.35 slicify</a></li>
    <li><a name="toc-split" href="#split">24.36 split</a></li>
    <li><a name="toc-swapuv" href="#swapuv">24.37 swapuv</a></li>
    <li><a name="toc-thumbnail" href="#thumbnail">24.38 thumbnail</a></li>
    <li><a name="toc-tinterlace" href="#tinterlace">24.39 tinterlace</a></li>
    <li><a name="toc-transpose" href="#transpose">24.40 transpose</a></li>
    <li><a name="toc-unsharp" href="#unsharp">24.41 unsharp</a></li>
    <li><a name="toc-vflip" href="#vflip">24.42 vflip</a></li>
    <li><a name="toc-yadif" href="#yadif">24.43 yadif</a></li>
  </ul></li>
  <li><a name="toc-Video-Sources" href="#Video-Sources">25. Video Sources</a>
  <ul class="toc">
    <li><a name="toc-buffer" href="#buffer">25.1 buffer</a></li>
    <li><a name="toc-cellauto" href="#cellauto">25.2 cellauto</a>
    <ul class="toc">
      <li><a name="toc-Examples-2" href="#Examples-2">25.2.1 Examples</a></li>
    </ul></li>
    <li><a name="toc-color" href="#color">25.3 color</a></li>
    <li><a name="toc-movie" href="#movie">25.4 movie</a></li>
    <li><a name="toc-mptestsrc" href="#mptestsrc">25.5 mptestsrc</a></li>
    <li><a name="toc-frei0r_005fsrc" href="#frei0r_005fsrc">25.6 frei0r_src</a></li>
    <li><a name="toc-life" href="#life">25.7 life</a>
    <ul class="toc">
      <li><a name="toc-Examples-6" href="#Examples-6">25.7.1 Examples</a></li>
    </ul></li>
    <li><a name="toc-nullsrc_002c-rgbtestsrc_002c-testsrc" href="#nullsrc_002c-rgbtestsrc_002c-testsrc">25.8 nullsrc, rgbtestsrc, testsrc</a></li>
  </ul></li>
  <li><a name="toc-Video-Sinks" href="#Video-Sinks">26. Video Sinks</a>
  <ul class="toc">
    <li><a name="toc-buffersink" href="#buffersink">26.1 buffersink</a></li>
    <li><a name="toc-nullsink" href="#nullsink">26.2 nullsink</a></li>
  </ul></li>
  <li><a name="toc-Metadata" href="#Metadata">27. Metadata</a></li>
</ul>
</div>

<a name="Synopsis"></a>
<h1 class="chapter"><a href="ffmpeg.html#toc-Synopsis">1. Synopsis</a></h1>

<p>The generic syntax is:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg [global options] [[infile options][&lsquo;<samp>-i</samp>&rsquo; <var>infile</var>]]... {[outfile options] <var>outfile</var>}...
</pre></td></tr></table>

<a name="Description"></a>
<h1 class="chapter"><a href="ffmpeg.html#toc-Description">2. Description</a></h1>

<p>ffmpeg is a very fast video and audio converter that can also grab from
a live audio/video source. It can also convert between arbitrary sample
rates and resize video on the fly with a high quality polyphase filter.
</p>
<p>ffmpeg reads from an arbitrary number of input &quot;files&quot; (which can be regular
files, pipes, network streams, grabbing devices, etc.), specified by the
<code>-i</code> option, and writes to an arbitrary number of output &quot;files&quot;, which are
specified by a plain output filename. Anything found on the command line which
cannot be interpreted as an option is considered to be an output filename.
</p>
<p>Each input or output file can in principle contain any number of streams of
different types (video/audio/subtitle/attachment/data). Allowed number and/or
types of streams can be limited by the container format. Selecting, which
streams from which inputs go into output, is done either automatically or with
the <code>-map</code> option (see the Stream selection chapter).
</p>
<p>To refer to input files in options, you must use their indices (0-based). E.g.
the first input file is <code>0</code>, the second is <code>1</code> etc. Similarly, streams
within a file are referred to by their indices. E.g. <code>2:3</code> refers to the
fourth stream in the third input file. See also the Stream specifiers chapter.
</p>
<p>As a general rule, options are applied to the next specified
file. Therefore, order is important, and you can have the same
option on the command line multiple times. Each occurrence is
then applied to the next input or output file.
Exceptions from this rule are the global options (e.g. verbosity level),
which should be specified first.
</p>
<p>Do not mix input and output files &ndash; first specify all input files, then all
output files. Also do not mix options which belong to different files. All
options apply ONLY to the next input or output file and are reset between files.
</p>
<ul>
<li>
To set the video bitrate of the output file to 64kbit/s:
<table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i input.avi -b:v 64k output.avi
</pre></td></tr></table>

</li><li>
To force the frame rate of the output file to 24 fps:
<table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i input.avi -r 24 output.avi
</pre></td></tr></table>

</li><li>
To force the frame rate of the input file (valid for raw formats only)
to 1 fps and the frame rate of the output file to 24 fps:
<table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -r 1 -i input.m2v -r 24 output.avi
</pre></td></tr></table>
</li></ul>

<p>The format option may be needed for raw input files.
</p>

<a name="Stream-selection"></a>
<h1 class="chapter"><a href="ffmpeg.html#toc-Stream-selection">3. Stream selection</a></h1>

<p>By default ffmpeg includes only one stream of each type (video, audio, subtitle)
present in the input files and adds them to each output file.  It picks the
&quot;best&quot; of each based upon the following criteria; for video it is the stream
with the highest resolution, for audio the stream with the most channels, for
subtitle it&rsquo;s the first subtitle stream. In the case where several streams of
the same type rate equally, the lowest numbered stream is chosen.
</p>
<p>You can disable some of those defaults by using <code>-vn/-an/-sn</code> options. For
full manual control, use the <code>-map</code> option, which disables the defaults just
described.
</p>

<a name="Options-7"></a>
<h1 class="chapter"><a href="ffmpeg.html#toc-Options-7">4. Options</a></h1>

<p>All the numerical options, if not specified otherwise, accept in input
a string representing a number, which may contain one of the
International System number postfixes, for example &rsquo;K&rsquo;, &rsquo;M&rsquo;, &rsquo;G&rsquo;.
If &rsquo;i&rsquo; is appended after the postfix, powers of 2 are used instead of
powers of 10. The &rsquo;B&rsquo; postfix multiplies the value for 8, and can be
appended after another postfix or used alone. This allows using for
example &rsquo;KB&rsquo;, &rsquo;MiB&rsquo;, &rsquo;G&rsquo; and &rsquo;B&rsquo; as postfix.
</p>
<p>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 &quot;no&quot; the option name, for example using &quot;-nofoo&quot; in the
command line will set to false the boolean option with name &quot;foo&quot;.
</p>
<p><a name="Stream-specifiers"></a>
</p><a name="Stream-specifiers-1"></a>
<h2 class="section"><a href="ffmpeg.html#toc-Stream-specifiers-1">4.1 Stream specifiers</a></h2>
<p>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.
</p>
<p>A stream specifier is a string generally appended to the option name and
separated from it by a colon. E.g. <code>-codec:a:1 ac3</code> option contains
<code>a:1</code> stream specifer, which matches the second audio stream. Therefore it
would select the ac3 codec for the second audio stream.
</p>
<p>A stream specifier can match several stream, the option is then applied to all
of them. E.g. the stream specifier in <code>-b:a 128k</code> matches all audio
streams.
</p>
<p>An empty stream specifier matches all streams, for example <code>-codec copy</code>
or <code>-codec: copy</code> would copy all the streams without reencoding.
</p>
<p>Possible forms of stream specifiers are:
</p><dl compact="compact">
<dt> &lsquo;<samp><var>stream_index</var></samp>&rsquo;</dt>
<dd><p>Matches the stream with this index. E.g. <code>-threads:1 4</code> would set the
thread count for the second stream to 4.
</p></dd>
<dt> &lsquo;<samp><var>stream_type</var>[:<var>stream_index</var>]</samp>&rsquo;</dt>
<dd><p><var>stream_type</var> is one of: &rsquo;v&rsquo; for video, &rsquo;a&rsquo; for audio, &rsquo;s&rsquo; for subtitle,
&rsquo;d&rsquo; for data and &rsquo;t&rsquo; for attachments. If <var>stream_index</var> is given, then
matches stream number <var>stream_index</var> of this type. Otherwise matches all
streams of this type.
</p></dd>
<dt> &lsquo;<samp>p:<var>program_id</var>[:<var>stream_index</var>]</samp>&rsquo;</dt>
<dd><p>If <var>stream_index</var> is given, then matches stream number <var>stream_index</var> in
program with id <var>program_id</var>. Otherwise matches all streams in this program.
</p></dd>
</dl>
<a name="Generic-options"></a>
<h2 class="section"><a href="ffmpeg.html#toc-Generic-options">4.2 Generic options</a></h2>

<p>These options are shared amongst the av* tools.
</p>
<dl compact="compact">
<dt> &lsquo;<samp>-L</samp>&rsquo;</dt>
<dd><p>Show license.
</p>
</dd>
<dt> &lsquo;<samp>-h, -?, -help, --help</samp>&rsquo;</dt>
<dd><p>Show help.
</p>
</dd>
<dt> &lsquo;<samp>-version</samp>&rsquo;</dt>
<dd><p>Show version.
</p>
</dd>
<dt> &lsquo;<samp>-formats</samp>&rsquo;</dt>
<dd><p>Show available formats.
</p>
<p>The fields preceding the format names have the following meanings:
</p><dl compact="compact">
<dt> &lsquo;<samp>D</samp>&rsquo;</dt>
<dd><p>Decoding available
</p></dd>
<dt> &lsquo;<samp>E</samp>&rsquo;</dt>
<dd><p>Encoding available
</p></dd>
</dl>

</dd>
<dt> &lsquo;<samp>-codecs</samp>&rsquo;</dt>
<dd><p>Show available codecs.
</p>
<p>The fields preceding the codec names have the following meanings:
</p><dl compact="compact">
<dt> &lsquo;<samp>D</samp>&rsquo;</dt>
<dd><p>Decoding available
</p></dd>
<dt> &lsquo;<samp>E</samp>&rsquo;</dt>
<dd><p>Encoding available
</p></dd>
<dt> &lsquo;<samp>V/A/S</samp>&rsquo;</dt>
<dd><p>Video/audio/subtitle codec
</p></dd>
<dt> &lsquo;<samp>S</samp>&rsquo;</dt>
<dd><p>Codec supports slices
</p></dd>
<dt> &lsquo;<samp>D</samp>&rsquo;</dt>
<dd><p>Codec supports direct rendering
</p></dd>
<dt> &lsquo;<samp>T</samp>&rsquo;</dt>
<dd><p>Codec can handle input truncated at random locations instead of only at frame boundaries
</p></dd>
</dl>

</dd>
<dt> &lsquo;<samp>-bsfs</samp>&rsquo;</dt>
<dd><p>Show available bitstream filters.
</p>
</dd>
<dt> &lsquo;<samp>-protocols</samp>&rsquo;</dt>
<dd><p>Show available protocols.
</p>
</dd>
<dt> &lsquo;<samp>-filters</samp>&rsquo;</dt>
<dd><p>Show available libavfilter filters.
</p>
</dd>
<dt> &lsquo;<samp>-pix_fmts</samp>&rsquo;</dt>
<dd><p>Show available pixel formats.
</p>
</dd>
<dt> &lsquo;<samp>-sample_fmts</samp>&rsquo;</dt>
<dd><p>Show available sample formats.
</p>
</dd>
<dt> &lsquo;<samp>-loglevel <var>loglevel</var> | -v <var>loglevel</var></samp>&rsquo;</dt>
<dd><p>Set the logging level used by the library.
<var>loglevel</var> is a number or a string containing one of the following values:
</p><dl compact="compact">
<dt> &lsquo;<samp>quiet</samp>&rsquo;</dt>
<dt> &lsquo;<samp>panic</samp>&rsquo;</dt>
<dt> &lsquo;<samp>fatal</samp>&rsquo;</dt>
<dt> &lsquo;<samp>error</samp>&rsquo;</dt>
<dt> &lsquo;<samp>warning</samp>&rsquo;</dt>
<dt> &lsquo;<samp>info</samp>&rsquo;</dt>
<dt> &lsquo;<samp>verbose</samp>&rsquo;</dt>
<dt> &lsquo;<samp>debug</samp>&rsquo;</dt>
</dl>

<p>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
<code>AV_LOG_FORCE_NOCOLOR</code> or <code>NO_COLOR</code>, or can be forced setting
the environment variable <code>AV_LOG_FORCE_COLOR</code>.
The use of the environment variable <code>NO_COLOR</code> is deprecated and
will be dropped in a following FFmpeg version.
</p>
</dd>
<dt> &lsquo;<samp>-report</samp>&rsquo;</dt>
<dd><p>Dump full command line and console output to a file named
<code><var>program</var>-<var>YYYYMMDD</var>-<var>HHMMSS</var>.log</code> in the current
directory.
This file can be useful for bug reports.
It also implies <code>-loglevel verbose</code>.
</p>
<p>Note: setting the environment variable <code>FFREPORT</code> to any value has the
same effect.
</p>
</dd>
</dl>

<a name="AVOptions"></a>
<h2 class="section"><a href="ffmpeg.html#toc-AVOptions">4.3 AVOptions</a></h2>

<p>These options are provided directly by the libavformat, libavdevice and
libavcodec libraries. To see the list of available AVOptions, use the
&lsquo;<samp>-help</samp>&rsquo; option. They are separated into two categories:
</p><dl compact="compact">
<dt> &lsquo;<samp>generic</samp>&rsquo;</dt>
<dd><p>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.
</p></dd>
<dt> &lsquo;<samp>private</samp>&rsquo;</dt>
<dd><p>These options are specific to the given container, device or codec. Private
options are listed under their corresponding containers/devices/codecs.
</p></dd>
</dl>

<p>For example to write an ID3v2.3 header instead of a default ID3v2.4 to
an MP3 file, use the &lsquo;<samp>id3v2_version</samp>&rsquo; private option of the MP3
muxer:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i input.flac -id3v2_version 3 out.mp3
</pre></td></tr></table>

<p>All codec AVOptions are obviously per-stream, so the chapter on stream
specifiers applies to them
</p>
<p>Note &lsquo;<samp>-nooption</samp>&rsquo; syntax cannot be used for boolean AVOptions,
use &lsquo;<samp>-option 0</samp>&rsquo;/&lsquo;<samp>-option 1</samp>&rsquo;.
</p>
<p>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.
</p>
<a name="Main-options"></a>
<h2 class="section"><a href="ffmpeg.html#toc-Main-options">4.4 Main options</a></h2>

<dl compact="compact">
<dt> &lsquo;<samp>-f <var>fmt</var> (<em>input/output</em>)</samp>&rsquo;</dt>
<dd><p>Force input or output file format. The format is normally auto detected for input
files and guessed from file extension for output files, so this option is not
needed in most cases.
</p>
</dd>
<dt> &lsquo;<samp>-i <var>filename</var> (<em>input</em>)</samp>&rsquo;</dt>
<dd><p>input file name
</p>
</dd>
<dt> &lsquo;<samp>-y (<em>global</em>)</samp>&rsquo;</dt>
<dd><p>Overwrite output files without asking.
</p>
</dd>
<dt> &lsquo;<samp>-n (<em>global</em>)</samp>&rsquo;</dt>
<dd><p>Do not overwrite output files but exit if file exists.
</p>
</dd>
<dt> &lsquo;<samp>-c[:<var>stream_specifier</var>] <var>codec</var> (<em>input/output,per-stream</em>)</samp>&rsquo;</dt>
<dt> &lsquo;<samp>-codec[:<var>stream_specifier</var>] <var>codec</var> (<em>input/output,per-stream</em>)</samp>&rsquo;</dt>
<dd><p>Select an encoder (when used before an output file) or a decoder (when used
before an input file) for one or more streams. <var>codec</var> is the name of a
decoder/encoder or a special value <code>copy</code> (output only) to indicate that
the stream is not to be re-encoded.
</p>
<p>For example
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -map 0 -c:v libx264 -c:a copy OUTPUT
</pre></td></tr></table>
<p>encodes all video streams with libx264 and copies all audio streams.
</p>
<p>For each stream, the last matching <code>c</code> option is applied, so
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -map 0 -c copy -c:v:1 libx264 -c:a:137 libvorbis OUTPUT
</pre></td></tr></table>
<p>will copy all the streams except the second video, which will be encoded with
libx264, and the 138th audio, which will be encoded with libvorbis.
</p>
</dd>
<dt> &lsquo;<samp>-t <var>duration</var> (<em>output</em>)</samp>&rsquo;</dt>
<dd><p>Stop writing the output after its duration reaches <var>duration</var>.
<var>duration</var> may be a number in seconds, or in <code>hh:mm:ss[.xxx]</code> form.
</p>
</dd>
<dt> &lsquo;<samp>-fs <var>limit_size</var> (<em>output</em>)</samp>&rsquo;</dt>
<dd><p>Set the file size limit.
</p>
</dd>
<dt> &lsquo;<samp>-ss <var>position</var> (<em>input/output</em>)</samp>&rsquo;</dt>
<dd><p>When used as an input option (before <code>-i</code>), seeks in this input file to
<var>position</var>. When used as an output option (before an output filename),
decodes but discards input until the timestamps reach <var>position</var>. This is
slower, but more accurate.
</p>
<p><var>position</var> may be either in seconds or in <code>hh:mm:ss[.xxx]</code> form.
</p>
</dd>
<dt> &lsquo;<samp>-itsoffset <var>offset</var> (<em>input</em>)</samp>&rsquo;</dt>
<dd><p>Set the input time offset in seconds.
<code>[-]hh:mm:ss[.xxx]</code> syntax is also supported.
The offset is added to the timestamps of the input files.
Specifying a positive offset means that the corresponding
streams are delayed by <var>offset</var> seconds.
</p>
</dd>
<dt> &lsquo;<samp>-timestamp <var>time</var> (<em>output</em>)</samp>&rsquo;</dt>
<dd><p>Set the recording timestamp in the container.
The syntax for <var>time</var> is:
</p><table><tr><td>&nbsp;</td><td><pre class="example">now|([(YYYY-MM-DD|YYYYMMDD)[T|t| ]]((HH[:MM[:SS[.m...]]])|(HH[MM[SS[.m...]]]))[Z|z])
</pre></td></tr></table>
<p>If the value is &quot;now&quot; it takes the current time.
Time is local time unless &rsquo;Z&rsquo; or &rsquo;z&rsquo; is appended, in which case it is
interpreted as UTC.
If the year-month-day part is not specified it takes the current
year-month-day.
</p>
</dd>
<dt> &lsquo;<samp>-metadata[:metadata_specifier] <var>key</var>=<var>value</var> (<em>output,per-metadata</em>)</samp>&rsquo;</dt>
<dd><p>Set a metadata key/value pair.
</p>
<p>An optional <var>metadata_specifier</var> may be given to set metadata
on streams or chapters. See <code>-map_metadata</code> documentation for
details.
</p>
<p>This option overrides metadata set with <code>-map_metadata</code>. It is
also possible to delete metadata by using an empty value.
</p>
<p>For example, for setting the title in the output file:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.avi -metadata title=&quot;my title&quot; out.flv
</pre></td></tr></table>

<p>To set the language of the first audio stream:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -metadata:s:a:1 language=eng OUTPUT
</pre></td></tr></table>

</dd>
<dt> &lsquo;<samp>-target <var>type</var> (<em>output</em>)</samp>&rsquo;</dt>
<dd><p>Specify target file type (<code>vcd</code>, <code>svcd</code>, <code>dvd</code>, <code>dv</code>,
<code>dv50</code>). <var>type</var> may be prefixed with <code>pal-</code>, <code>ntsc-</code> or
<code>film-</code> to use the corresponding standard. All the format options
(bitrate, codecs, buffer sizes) are then set automatically. You can just type:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i myfile.avi -target vcd /tmp/vcd.mpg
</pre></td></tr></table>

<p>Nevertheless you can specify additional options as long as you know
they do not conflict with the standard, as in:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i myfile.avi -target vcd -bf 2 /tmp/vcd.mpg
</pre></td></tr></table>

</dd>
<dt> &lsquo;<samp>-dframes <var>number</var> (<em>output</em>)</samp>&rsquo;</dt>
<dd><p>Set the number of data frames to record. This is an alias for <code>-frames:d</code>.
</p>
</dd>
<dt> &lsquo;<samp>-frames[:<var>stream_specifier</var>] <var>framecount</var> (<em>output,per-stream</em>)</samp>&rsquo;</dt>
<dd><p>Stop writing to the stream after <var>framecount</var> frames.
</p>
</dd>
<dt> &lsquo;<samp>-q[:<var>stream_specifier</var>] <var>q</var> (<em>output,per-stream</em>)</samp>&rsquo;</dt>
<dt> &lsquo;<samp>-qscale[:<var>stream_specifier</var>] <var>q</var> (<em>output,per-stream</em>)</samp>&rsquo;</dt>
<dd><p>Use fixed quality scale (VBR). The meaning of <var>q</var> is
codec-dependent.
</p>
</dd>
<dt> &lsquo;<samp>-filter[:<var>stream_specifier</var>] <var>filter_graph</var> (<em>output,per-stream</em>)</samp>&rsquo;</dt>
<dd><p><var>filter_graph</var> is a description of the filter graph to apply to
the stream. Use <code>-filters</code> to show all the available filters
(including also sources and sinks).
</p></dd>
<dt> &lsquo;<samp>-pre[:<var>stream_specifier</var>] <var>preset_name</var> (<em>output,per-stream</em>)</samp>&rsquo;</dt>
<dd><p>Specify the preset for matching stream(s).
</p>
</dd>
<dt> &lsquo;<samp>-stats (<em>global</em>)</samp>&rsquo;</dt>
<dd><p>Print encoding progress/statistics. On by default.
</p>
</dd>
<dt> &lsquo;<samp>-attach <var>filename</var> (<em>output</em>)</samp>&rsquo;</dt>
<dd><p>Add an attachment to the output file. This is supported by a few formats
like Matroska for e.g. fonts used in rendering subtitles. Attachments
are implemented as a specific type of stream, so this option will add
a new stream to the file. It is then possible to use per-stream options
on this stream in the usual way. Attachment streams created with this
option will be created after all the other streams (i.e. those created
with <code>-map</code> or automatic mappings).
</p>
<p>Note that for Matroska you also have to set the mimetype metadata tag:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -attach DejaVuSans.ttf -metadata:s:2 mimetype=application/x-truetype-font out.mkv
</pre></td></tr></table>
<p>(assuming that the attachment stream will be third in the output file).
</p>
</dd>
<dt> &lsquo;<samp>-dump_attachment[:<var>stream_specifier</var>] <var>filename</var> (<em>input,per-stream</em>)</samp>&rsquo;</dt>
<dd><p>Extract the matching attachment stream into a file named <var>filename</var>. If
<var>filename</var> is empty, then the value of the <code>filename</code> metadata tag
will be used.
</p>
<p>E.g. to extract the first attachment to a file named &rsquo;out.ttf&rsquo;:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -dump_attachment:t:0 out.ttf INPUT
</pre></td></tr></table>
<p>To extract all attachments to files determined by the <code>filename</code> tag:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -dump_attachment:t &quot;&quot; INPUT
</pre></td></tr></table>

<p>Technical note &ndash; attachments are implemented as codec extradata, so this
option can actually be used to extract extradata from any stream, not just
attachments.
</p>
</dd>
</dl>

<a name="Video-Options"></a>
<h2 class="section"><a href="ffmpeg.html#toc-Video-Options">4.5 Video Options</a></h2>

<dl compact="compact">
<dt> &lsquo;<samp>-vframes <var>number</var> (<em>output</em>)</samp>&rsquo;</dt>
<dd><p>Set the number of video frames to record. This is an alias for <code>-frames:v</code>.
</p></dd>
<dt> &lsquo;<samp>-r[:<var>stream_specifier</var>] <var>fps</var> (<em>input/output,per-stream</em>)</samp>&rsquo;</dt>
<dd><p>Set frame rate (Hz value, fraction or abbreviation), (default = 25).
</p></dd>
<dt> &lsquo;<samp>-s[:<var>stream_specifier</var>] <var>size</var> (<em>input/output,per-stream</em>)</samp>&rsquo;</dt>
<dd><p>Set frame size. The format is &lsquo;<samp>wxh</samp>&rsquo; (default - same as source).
The following abbreviations are recognized:
</p><dl compact="compact">
<dt> &lsquo;<samp>sqcif</samp>&rsquo;</dt>
<dd><p>128x96
</p></dd>
<dt> &lsquo;<samp>qcif</samp>&rsquo;</dt>
<dd><p>176x144
</p></dd>
<dt> &lsquo;<samp>cif</samp>&rsquo;</dt>
<dd><p>352x288
</p></dd>
<dt> &lsquo;<samp>4cif</samp>&rsquo;</dt>
<dd><p>704x576
</p></dd>
<dt> &lsquo;<samp>16cif</samp>&rsquo;</dt>
<dd><p>1408x1152
</p></dd>
<dt> &lsquo;<samp>qqvga</samp>&rsquo;</dt>
<dd><p>160x120
</p></dd>
<dt> &lsquo;<samp>qvga</samp>&rsquo;</dt>
<dd><p>320x240
</p></dd>
<dt> &lsquo;<samp>vga</samp>&rsquo;</dt>
<dd><p>640x480
</p></dd>
<dt> &lsquo;<samp>svga</samp>&rsquo;</dt>
<dd><p>800x600
</p></dd>
<dt> &lsquo;<samp>xga</samp>&rsquo;</dt>
<dd><p>1024x768
</p></dd>
<dt> &lsquo;<samp>uxga</samp>&rsquo;</dt>
<dd><p>1600x1200
</p></dd>
<dt> &lsquo;<samp>qxga</samp>&rsquo;</dt>
<dd><p>2048x1536
</p></dd>
<dt> &lsquo;<samp>sxga</samp>&rsquo;</dt>
<dd><p>1280x1024
</p></dd>
<dt> &lsquo;<samp>qsxga</samp>&rsquo;</dt>
<dd><p>2560x2048
</p></dd>
<dt> &lsquo;<samp>hsxga</samp>&rsquo;</dt>
<dd><p>5120x4096
</p></dd>
<dt> &lsquo;<samp>wvga</samp>&rsquo;</dt>
<dd><p>852x480
</p></dd>
<dt> &lsquo;<samp>wxga</samp>&rsquo;</dt>
<dd><p>1366x768
</p></dd>
<dt> &lsquo;<samp>wsxga</samp>&rsquo;</dt>
<dd><p>1600x1024
</p></dd>
<dt> &lsquo;<samp>wuxga</samp>&rsquo;</dt>
<dd><p>1920x1200
</p></dd>
<dt> &lsquo;<samp>woxga</samp>&rsquo;</dt>
<dd><p>2560x1600
</p></dd>
<dt> &lsquo;<samp>wqsxga</samp>&rsquo;</dt>
<dd><p>3200x2048
</p></dd>
<dt> &lsquo;<samp>wquxga</samp>&rsquo;</dt>
<dd><p>3840x2400
</p></dd>
<dt> &lsquo;<samp>whsxga</samp>&rsquo;</dt>
<dd><p>6400x4096
</p></dd>
<dt> &lsquo;<samp>whuxga</samp>&rsquo;</dt>
<dd><p>7680x4800
</p></dd>
<dt> &lsquo;<samp>cga</samp>&rsquo;</dt>
<dd><p>320x200
</p></dd>
<dt> &lsquo;<samp>ega</samp>&rsquo;</dt>
<dd><p>640x350
</p></dd>
<dt> &lsquo;<samp>hd480</samp>&rsquo;</dt>
<dd><p>852x480
</p></dd>
<dt> &lsquo;<samp>hd720</samp>&rsquo;</dt>
<dd><p>1280x720
</p></dd>
<dt> &lsquo;<samp>hd1080</samp>&rsquo;</dt>
<dd><p>1920x1080
</p></dd>
</dl>

</dd>
<dt> &lsquo;<samp>-aspect[:<var>stream_specifier</var>] <var>aspect</var> (<em>output,per-stream</em>)</samp>&rsquo;</dt>
<dd><p>Set the video display aspect ratio specified by <var>aspect</var>.
</p>
<p><var>aspect</var> can be a floating point number string, or a string of the
form <var>num</var>:<var>den</var>, where <var>num</var> and <var>den</var> are the
numerator and denominator of the aspect ratio. For example &quot;4:3&quot;,
&quot;16:9&quot;, &quot;1.3333&quot;, and &quot;1.7777&quot; are valid argument values.
</p>
</dd>
<dt> &lsquo;<samp>-croptop <var>size</var></samp>&rsquo;</dt>
<dt> &lsquo;<samp>-cropbottom <var>size</var></samp>&rsquo;</dt>
<dt> &lsquo;<samp>-cropleft <var>size</var></samp>&rsquo;</dt>
<dt> &lsquo;<samp>-cropright <var>size</var></samp>&rsquo;</dt>
<dd><p>All the crop options have been removed. Use -vf
crop=width:height:x:y instead.
</p>
</dd>
<dt> &lsquo;<samp>-padtop <var>size</var></samp>&rsquo;</dt>
<dt> &lsquo;<samp>-padbottom <var>size</var></samp>&rsquo;</dt>
<dt> &lsquo;<samp>-padleft <var>size</var></samp>&rsquo;</dt>
<dt> &lsquo;<samp>-padright <var>size</var></samp>&rsquo;</dt>
<dt> &lsquo;<samp>-padcolor <var>hex_color</var></samp>&rsquo;</dt>
<dd><p>All the pad options have been removed. Use -vf
pad=width:height:x:y:color instead.
</p>
</dd>
<dt> &lsquo;<samp>-vn (<em>output</em>)</samp>&rsquo;</dt>
<dd><p>Disable video recording.
</p></dd>
<dt> &lsquo;<samp>-bt <var>tolerance</var></samp>&rsquo;</dt>
<dd><p>Set video bitrate tolerance (in bits, default 4000k).
Has a minimum value of: (target_bitrate/target_framerate).
In 1-pass mode, bitrate tolerance specifies how far ratecontrol is
willing to deviate from the target average bitrate value. This is
not related to min/max bitrate. Lowering tolerance too much has
an adverse effect on quality.
</p></dd>
<dt> &lsquo;<samp>-maxrate <var>bitrate</var></samp>&rsquo;</dt>
<dd><p>Set max video bitrate (in bit/s).
Requires -bufsize to be set.
</p></dd>
<dt> &lsquo;<samp>-minrate <var>bitrate</var></samp>&rsquo;</dt>
<dd><p>Set min video bitrate (in bit/s).
Most useful in setting up a CBR encode:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i myfile.avi -b:v 4000k -minrate 4000k -maxrate 4000k -bufsize 1835k out.m2v
</pre></td></tr></table>
<p>It is of little use elsewise.
</p></dd>
<dt> &lsquo;<samp>-bufsize <var>size</var></samp>&rsquo;</dt>
<dd><p>Set video buffer verifier buffer size (in bits).
</p></dd>
<dt> &lsquo;<samp>-vcodec <var>codec</var> (<em>output</em>)</samp>&rsquo;</dt>
<dd><p>Set the video codec. This is an alias for <code>-codec:v</code>.
</p></dd>
<dt> &lsquo;<samp>-same_quant</samp>&rsquo;</dt>
<dd><p>Use same quantizer as source (implies VBR).
</p>
<p>Note that this is NOT SAME QUALITY. Do not use this option unless you know you
need it.
</p>
</dd>
<dt> &lsquo;<samp>-pass <var>n</var></samp>&rsquo;</dt>
<dd><p>Select the pass number (1 or 2). It is used to do two-pass
video encoding. The statistics of the video are recorded in the first
pass into a log file (see also the option -passlogfile),
and in the second pass that log file is used to generate the video
at the exact requested bitrate.
On pass 1, you may just deactivate audio and set output to null,
examples for Windows and Unix:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i foo.mov -c:v libxvid -pass 1 -an -f rawvideo -y NUL
ffmpeg -i foo.mov -c:v libxvid -pass 1 -an -f rawvideo -y /dev/null
</pre></td></tr></table>

</dd>
<dt> &lsquo;<samp>-passlogfile <var>prefix</var> (<em>global</em>)</samp>&rsquo;</dt>
<dd><p>Set two-pass log file name prefix to <var>prefix</var>, the default file name
prefix is &ldquo;ffmpeg2pass&rdquo;. The complete file name will be
&lsquo;<tt>PREFIX-N.log</tt>&rsquo;, where N is a number specific to the output
stream
</p>
</dd>
<dt> &lsquo;<samp>-vlang <var>code</var></samp>&rsquo;</dt>
<dd><p>Set the ISO 639 language code (3 letters) of the current video stream.
</p>
</dd>
<dt> &lsquo;<samp>-vf <var>filter_graph</var> (<em>output</em>)</samp>&rsquo;</dt>
<dd><p><var>filter_graph</var> is a description of the filter graph to apply to
the input video.
Use the option &quot;-filters&quot; to show all the available filters (including
also sources and sinks).  This is an alias for <code>-filter:v</code>.
</p>
</dd>
</dl>

<a name="Advanced-Video-Options"></a>
<h2 class="section"><a href="ffmpeg.html#toc-Advanced-Video-Options">4.6 Advanced Video Options</a></h2>

<dl compact="compact">
<dt> &lsquo;<samp>-pix_fmt[:<var>stream_specifier</var>] <var>format</var> (<em>input/output,per-stream</em>)</samp>&rsquo;</dt>
<dd><p>Set pixel format. Use <code>-pix_fmts</code> to show all the supported
pixel formats.
</p></dd>
<dt> &lsquo;<samp>-sws_flags <var>flags</var> (<em>input/output</em>)</samp>&rsquo;</dt>
<dd><p>Set SwScaler flags.
</p></dd>
<dt> &lsquo;<samp>-g <var>gop_size</var></samp>&rsquo;</dt>
<dd><p>Set the group of pictures size.
</p></dd>
<dt> &lsquo;<samp>-intra</samp>&rsquo;</dt>
<dd><p>deprecated, use -g 1
</p></dd>
<dt> &lsquo;<samp>-vdt <var>n</var></samp>&rsquo;</dt>
<dd><p>Discard threshold.
</p></dd>
<dt> &lsquo;<samp>-qmin <var>q</var></samp>&rsquo;</dt>
<dd><p>minimum video quantizer scale (VBR)
</p></dd>
<dt> &lsquo;<samp>-qmax <var>q</var></samp>&rsquo;</dt>
<dd><p>maximum video quantizer scale (VBR)
</p></dd>
<dt> &lsquo;<samp>-qdiff <var>q</var></samp>&rsquo;</dt>
<dd><p>maximum difference between the quantizer scales (VBR)
</p></dd>
<dt> &lsquo;<samp>-qblur <var>blur</var></samp>&rsquo;</dt>
<dd><p>video quantizer scale blur (VBR) (range 0.0 - 1.0)
</p></dd>
<dt> &lsquo;<samp>-qcomp <var>compression</var></samp>&rsquo;</dt>
<dd><p>video quantizer scale compression (VBR) (default 0.5).
Constant of ratecontrol equation. Recommended range for default rc_eq: 0.0-1.0
</p>
</dd>
<dt> &lsquo;<samp>-lmin <var>lambda</var></samp>&rsquo;</dt>
<dd><p>minimum video lagrange factor (VBR)
</p></dd>
<dt> &lsquo;<samp>-lmax <var>lambda</var></samp>&rsquo;</dt>
<dd><p>max video lagrange factor (VBR)
</p></dd>
<dt> &lsquo;<samp>-mblmin <var>lambda</var></samp>&rsquo;</dt>
<dd><p>minimum macroblock quantizer scale (VBR)
</p></dd>
<dt> &lsquo;<samp>-mblmax <var>lambda</var></samp>&rsquo;</dt>
<dd><p>maximum macroblock quantizer scale (VBR)
</p>
<p>These four options (lmin, lmax, mblmin, mblmax) use &rsquo;lambda&rsquo; units,
but you may use the QP2LAMBDA constant to easily convert from &rsquo;q&rsquo; units:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i src.ext -lmax 21*QP2LAMBDA dst.ext
</pre></td></tr></table>

</dd>
<dt> &lsquo;<samp>-rc_init_cplx <var>complexity</var></samp>&rsquo;</dt>
<dd><p>initial complexity for single pass encoding
</p></dd>
<dt> &lsquo;<samp>-b_qfactor <var>factor</var></samp>&rsquo;</dt>
<dd><p>qp factor between P- and B-frames
</p></dd>
<dt> &lsquo;<samp>-i_qfactor <var>factor</var></samp>&rsquo;</dt>
<dd><p>qp factor between P- and I-frames
</p></dd>
<dt> &lsquo;<samp>-b_qoffset <var>offset</var></samp>&rsquo;</dt>
<dd><p>qp offset between P- and B-frames
</p></dd>
<dt> &lsquo;<samp>-i_qoffset <var>offset</var></samp>&rsquo;</dt>
<dd><p>qp offset between P- and I-frames
</p></dd>
<dt> &lsquo;<samp>-rc_eq <var>equation</var></samp>&rsquo;</dt>
<dd><p>Set rate control equation (see section &quot;Expression Evaluation&quot;)
(default = <code>tex^qComp</code>).
</p>
<p>When computing the rate control equation expression, besides the
standard functions defined in the section &quot;Expression Evaluation&quot;, the
following functions are available:
</p><dl compact="compact">
<dt> <var>bits2qp(bits)</var></dt>
<dt> <var>qp2bits(qp)</var></dt>
</dl>

<p>and the following constants are available:
</p><dl compact="compact">
<dt> <var>iTex</var></dt>
<dt> <var>pTex</var></dt>
<dt> <var>tex</var></dt>
<dt> <var>mv</var></dt>
<dt> <var>fCode</var></dt>
<dt> <var>iCount</var></dt>
<dt> <var>mcVar</var></dt>
<dt> <var>var</var></dt>
<dt> <var>isI</var></dt>
<dt> <var>isP</var></dt>
<dt> <var>isB</var></dt>
<dt> <var>avgQP</var></dt>
<dt> <var>qComp</var></dt>
<dt> <var>avgIITex</var></dt>
<dt> <var>avgPITex</var></dt>
<dt> <var>avgPPTex</var></dt>
<dt> <var>avgBPTex</var></dt>
<dt> <var>avgTex</var></dt>
</dl>

</dd>
<dt> &lsquo;<samp>-rc_override[:<var>stream_specifier</var>] <var>override</var> (<em>output,per-stream</em>)</samp>&rsquo;</dt>
<dd><p>Rate control override for specific intervals, formatted as &quot;int,int,int&quot;
list separated with slashes. Two first values are the beginning and
end frame numbers, last one is quantizer to use if positive, or quality
factor if negative.
</p></dd>
<dt> &lsquo;<samp>-me_method <var>method</var></samp>&rsquo;</dt>
<dd><p>Set motion estimation method to <var>method</var>.
Available methods are (from lowest to best quality):
</p><dl compact="compact">
<dt> &lsquo;<samp>zero</samp>&rsquo;</dt>
<dd><p>Try just the (0, 0) vector.
</p></dd>
<dt> &lsquo;<samp>phods</samp>&rsquo;</dt>
<dt> &lsquo;<samp>log</samp>&rsquo;</dt>
<dt> &lsquo;<samp>x1</samp>&rsquo;</dt>
<dt> &lsquo;<samp>hex</samp>&rsquo;</dt>
<dt> &lsquo;<samp>umh</samp>&rsquo;</dt>
<dt> &lsquo;<samp>epzs</samp>&rsquo;</dt>
<dd><p>(default method)
</p></dd>
<dt> &lsquo;<samp>full</samp>&rsquo;</dt>
<dd><p>exhaustive search (slow and marginally better than epzs)
</p></dd>
</dl>

</dd>
<dt> &lsquo;<samp>-dct_algo <var>algo</var></samp>&rsquo;</dt>
<dd><p>Set DCT algorithm to <var>algo</var>. Available values are:
</p><dl compact="compact">
<dt> &lsquo;<samp>0</samp>&rsquo;</dt>
<dd><p>FF_DCT_AUTO (default)
</p></dd>
<dt> &lsquo;<samp>1</samp>&rsquo;</dt>
<dd><p>FF_DCT_FASTINT
</p></dd>
<dt> &lsquo;<samp>2</samp>&rsquo;</dt>
<dd><p>FF_DCT_INT
</p></dd>
<dt> &lsquo;<samp>3</samp>&rsquo;</dt>
<dd><p>FF_DCT_MMX
</p></dd>
<dt> &lsquo;<samp>4</samp>&rsquo;</dt>
<dd><p>FF_DCT_MLIB
</p></dd>
<dt> &lsquo;<samp>5</samp>&rsquo;</dt>
<dd><p>FF_DCT_ALTIVEC
</p></dd>
</dl>

</dd>
<dt> &lsquo;<samp>-idct_algo <var>algo</var></samp>&rsquo;</dt>
<dd><p>Set IDCT algorithm to <var>algo</var>. Available values are:
</p><dl compact="compact">
<dt> &lsquo;<samp>0</samp>&rsquo;</dt>
<dd><p>FF_IDCT_AUTO (default)
</p></dd>
<dt> &lsquo;<samp>1</samp>&rsquo;</dt>
<dd><p>FF_IDCT_INT
</p></dd>
<dt> &lsquo;<samp>2</samp>&rsquo;</dt>
<dd><p>FF_IDCT_SIMPLE
</p></dd>
<dt> &lsquo;<samp>3</samp>&rsquo;</dt>
<dd><p>FF_IDCT_SIMPLEMMX
</p></dd>
<dt> &lsquo;<samp>4</samp>&rsquo;</dt>
<dd><p>FF_IDCT_LIBMPEG2MMX
</p></dd>
<dt> &lsquo;<samp>5</samp>&rsquo;</dt>
<dd><p>FF_IDCT_PS2
</p></dd>
<dt> &lsquo;<samp>6</samp>&rsquo;</dt>
<dd><p>FF_IDCT_MLIB
</p></dd>
<dt> &lsquo;<samp>7</samp>&rsquo;</dt>
<dd><p>FF_IDCT_ARM
</p></dd>
<dt> &lsquo;<samp>8</samp>&rsquo;</dt>
<dd><p>FF_IDCT_ALTIVEC
</p></dd>
<dt> &lsquo;<samp>9</samp>&rsquo;</dt>
<dd><p>FF_IDCT_SH4
</p></dd>
<dt> &lsquo;<samp>10</samp>&rsquo;</dt>
<dd><p>FF_IDCT_SIMPLEARM
</p></dd>
</dl>

</dd>
<dt> &lsquo;<samp>-er <var>n</var></samp>&rsquo;</dt>
<dd><p>Set error resilience to <var>n</var>.
</p><dl compact="compact">
<dt> &lsquo;<samp>1</samp>&rsquo;</dt>
<dd><p>FF_ER_CAREFUL (default)
</p></dd>
<dt> &lsquo;<samp>2</samp>&rsquo;</dt>
<dd><p>FF_ER_COMPLIANT
</p></dd>
<dt> &lsquo;<samp>3</samp>&rsquo;</dt>
<dd><p>FF_ER_AGGRESSIVE
</p></dd>
<dt> &lsquo;<samp>4</samp>&rsquo;</dt>
<dd><p>FF_ER_VERY_AGGRESSIVE
</p></dd>
</dl>

</dd>
<dt> &lsquo;<samp>-ec <var>bit_mask</var></samp>&rsquo;</dt>
<dd><p>Set error concealment to <var>bit_mask</var>. <var>bit_mask</var> is a bit mask of
the following values:
</p><dl compact="compact">
<dt> &lsquo;<samp>1</samp>&rsquo;</dt>
<dd><p>FF_EC_GUESS_MVS (default = enabled)
</p></dd>
<dt> &lsquo;<samp>2</samp>&rsquo;</dt>
<dd><p>FF_EC_DEBLOCK (default = enabled)
</p></dd>
</dl>

</dd>
<dt> &lsquo;<samp>-bf <var>frames</var></samp>&rsquo;</dt>
<dd><p>Use &rsquo;frames&rsquo; B-frames (supported for MPEG-1, MPEG-2 and MPEG-4).
</p></dd>
<dt> &lsquo;<samp>-mbd <var>mode</var></samp>&rsquo;</dt>
<dd><p>macroblock decision
</p><dl compact="compact">
<dt> &lsquo;<samp>0</samp>&rsquo;</dt>
<dd><p>FF_MB_DECISION_SIMPLE: Use mb_cmp (cannot change it yet in ffmpeg).
</p></dd>
<dt> &lsquo;<samp>1</samp>&rsquo;</dt>
<dd><p>FF_MB_DECISION_BITS: Choose the one which needs the fewest bits.
</p></dd>
<dt> &lsquo;<samp>2</samp>&rsquo;</dt>
<dd><p>FF_MB_DECISION_RD: rate distortion
</p></dd>
</dl>

</dd>
<dt> &lsquo;<samp>-4mv</samp>&rsquo;</dt>
<dd><p>Use four motion vector by macroblock (MPEG-4 only).
</p></dd>
<dt> &lsquo;<samp>-part</samp>&rsquo;</dt>
<dd><p>Use data partitioning (MPEG-4 only).
</p></dd>
<dt> &lsquo;<samp>-bug <var>param</var></samp>&rsquo;</dt>
<dd><p>Work around encoder bugs that are not auto-detected.
</p></dd>
<dt> &lsquo;<samp>-strict <var>strictness</var></samp>&rsquo;</dt>
<dd><p>How strictly to follow the standards.
</p></dd>
<dt> &lsquo;<samp>-aic</samp>&rsquo;</dt>
<dd><p>Enable Advanced intra coding (h263+).
</p></dd>
<dt> &lsquo;<samp>-umv</samp>&rsquo;</dt>
<dd><p>Enable Unlimited Motion Vector (h263+)
</p>
</dd>
<dt> &lsquo;<samp>-deinterlace</samp>&rsquo;</dt>
<dd><p>Deinterlace pictures.
</p></dd>
<dt> &lsquo;<samp>-ilme</samp>&rsquo;</dt>
<dd><p>Force interlacing support in encoder (MPEG-2 and MPEG-4 only).
Use this option if your input file is interlaced and you want
to keep the interlaced format for minimum losses.
The alternative is to deinterlace the input stream with
&lsquo;<samp>-deinterlace</samp>&rsquo;, but deinterlacing introduces losses.
</p></dd>
<dt> &lsquo;<samp>-psnr</samp>&rsquo;</dt>
<dd><p>Calculate PSNR of compressed frames.
</p></dd>
<dt> &lsquo;<samp>-vstats</samp>&rsquo;</dt>
<dd><p>Dump video coding statistics to &lsquo;<tt>vstats_HHMMSS.log</tt>&rsquo;.
</p></dd>
<dt> &lsquo;<samp>-vstats_file <var>file</var></samp>&rsquo;</dt>
<dd><p>Dump video coding statistics to <var>file</var>.
</p></dd>
<dt> &lsquo;<samp>-top[:<var>stream_specifier</var>] <var>n</var> (<em>output,per-stream</em>)</samp>&rsquo;</dt>
<dd><p>top=1/bottom=0/auto=-1 field first
</p></dd>
<dt> &lsquo;<samp>-dc <var>precision</var></samp>&rsquo;</dt>
<dd><p>Intra_dc_precision.
</p></dd>
<dt> &lsquo;<samp>-vtag <var>fourcc/tag</var> (<em>output</em>)</samp>&rsquo;</dt>
<dd><p>Force video tag/fourcc. This is an alias for <code>-tag:v</code>.
</p></dd>
<dt> &lsquo;<samp>-qphist (<em>global</em>)</samp>&rsquo;</dt>
<dd><p>Show QP histogram
</p></dd>
<dt> &lsquo;<samp>-vbsf <var>bitstream_filter</var></samp>&rsquo;</dt>
<dd><p>Deprecated see -bsf
</p></dd>
<dt> &lsquo;<samp>-force_key_frames[:<var>stream_specifier</var>] <var>time</var>[,<var>time</var>...] (<em>output,per-stream</em>)</samp>&rsquo;</dt>
<dd><p>Force key frames at the specified timestamps, more precisely at the first
frames after each specified time.
This option can be useful to ensure that a seek point is present at a
chapter mark or any other designated place in the output file.
The timestamps must be specified in ascending order.
</p>
</dd>
<dt> &lsquo;<samp>-copyinkf[:<var>stream_specifier</var>] (<em>output,per-stream</em>)</samp>&rsquo;</dt>
<dd><p>When doing stream copy, copy also non-key frames found at the
beginning.
</p></dd>
</dl>

<a name="Audio-Options"></a>
<h2 class="section"><a href="ffmpeg.html#toc-Audio-Options">4.7 Audio Options</a></h2>

<dl compact="compact">
<dt> &lsquo;<samp>-aframes <var>number</var> (<em>output</em>)</samp>&rsquo;</dt>
<dd><p>Set the number of audio frames to record. This is an alias for <code>-frames:a</code>.
</p></dd>
<dt> &lsquo;<samp>-ar[:<var>stream_specifier</var>] <var>freq</var> (<em>input/output,per-stream</em>)</samp>&rsquo;</dt>
<dd><p>Set the audio sampling frequency. For output streams it is set by
default to the frequency of the corresponding input stream. For input
streams this option only makes sense for audio grabbing devices and raw
demuxers and is mapped to the corresponding demuxer options.
</p></dd>
<dt> &lsquo;<samp>-aq <var>q</var> (<em>output</em>)</samp>&rsquo;</dt>
<dd><p>Set the audio quality (codec-specific, VBR). This is an alias for -q:a.
</p></dd>
<dt> &lsquo;<samp>-ac[:<var>stream_specifier</var>] <var>channels</var> (<em>input/output,per-stream</em>)</samp>&rsquo;</dt>
<dd><p>Set the number of audio channels. For output streams it is set by
default to the number of input audio channels. For input streams
this option only makes sense for audio grabbing devices and raw demuxers
and is mapped to the corresponding demuxer options.
</p></dd>
<dt> &lsquo;<samp>-an (<em>output</em>)</samp>&rsquo;</dt>
<dd><p>Disable audio recording.
</p></dd>
<dt> &lsquo;<samp>-acodec <var>codec</var> (<em>input/output</em>)</samp>&rsquo;</dt>
<dd><p>Set the audio codec. This is an alias for <code>-codec:a</code>.
</p></dd>
<dt> &lsquo;<samp>-sample_fmt[:<var>stream_specifier</var>] <var>sample_fmt</var> (<em>output,per-stream</em>)</samp>&rsquo;</dt>
<dd><p>Set the audio sample format. Use <code>-sample_fmts</code> to get a list
of supported sample formats.
</p></dd>
</dl>

<a name="Advanced-Audio-options_003a"></a>
<h2 class="section"><a href="ffmpeg.html#toc-Advanced-Audio-options_003a">4.8 Advanced Audio options:</a></h2>

<dl compact="compact">
<dt> &lsquo;<samp>-atag <var>fourcc/tag</var> (<em>output</em>)</samp>&rsquo;</dt>
<dd><p>Force audio tag/fourcc. This is an alias for <code>-tag:a</code>.
</p></dd>
<dt> &lsquo;<samp>-audio_service_type <var>type</var></samp>&rsquo;</dt>
<dd><p>Set the type of service that the audio stream contains.
</p><dl compact="compact">
<dt> &lsquo;<samp>ma</samp>&rsquo;</dt>
<dd><p>Main Audio Service (default)
</p></dd>
<dt> &lsquo;<samp>ef</samp>&rsquo;</dt>
<dd><p>Effects
</p></dd>
<dt> &lsquo;<samp>vi</samp>&rsquo;</dt>
<dd><p>Visually Impaired
</p></dd>
<dt> &lsquo;<samp>hi</samp>&rsquo;</dt>
<dd><p>Hearing Impaired
</p></dd>
<dt> &lsquo;<samp>di</samp>&rsquo;</dt>
<dd><p>Dialogue
</p></dd>
<dt> &lsquo;<samp>co</samp>&rsquo;</dt>
<dd><p>Commentary
</p></dd>
<dt> &lsquo;<samp>em</samp>&rsquo;</dt>
<dd><p>Emergency
</p></dd>
<dt> &lsquo;<samp>vo</samp>&rsquo;</dt>
<dd><p>Voice Over
</p></dd>
<dt> &lsquo;<samp>ka</samp>&rsquo;</dt>
<dd><p>Karaoke
</p></dd>
</dl>
</dd>
<dt> &lsquo;<samp>-absf <var>bitstream_filter</var></samp>&rsquo;</dt>
<dd><p>Deprecated, see -bsf
</p></dd>
</dl>

<a name="Subtitle-options_003a"></a>
<h2 class="section"><a href="ffmpeg.html#toc-Subtitle-options_003a">4.9 Subtitle options:</a></h2>

<dl compact="compact">
<dt> &lsquo;<samp>-slang <var>code</var></samp>&rsquo;</dt>
<dd><p>Set the ISO 639 language code (3 letters) of the current subtitle stream.
</p></dd>
<dt> &lsquo;<samp>-scodec <var>codec</var> (<em>input/output</em>)</samp>&rsquo;</dt>
<dd><p>Set the subtitle codec. This is an alias for <code>-codec:s</code>.
</p></dd>
<dt> &lsquo;<samp>-sn (<em>output</em>)</samp>&rsquo;</dt>
<dd><p>Disable subtitle recording.
</p></dd>
<dt> &lsquo;<samp>-sbsf <var>bitstream_filter</var></samp>&rsquo;</dt>
<dd><p>Deprecated, see -bsf
</p></dd>
</dl>

<a name="Audio_002fVideo-grab-options"></a>
<h2 class="section"><a href="ffmpeg.html#toc-Audio_002fVideo-grab-options">4.10 Audio/Video grab options</a></h2>

<dl compact="compact">
<dt> &lsquo;<samp>-isync (<em>global</em>)</samp>&rsquo;</dt>
<dd><p>Synchronize read on input.
</p></dd>
</dl>

<a name="Advanced-options"></a>
<h2 class="section"><a href="ffmpeg.html#toc-Advanced-options">4.11 Advanced options</a></h2>

<dl compact="compact">
<dt> &lsquo;<samp>-map [-]<var>input_file_id</var>[:<var>stream_specifier</var>][,<var>sync_file_id</var>[:<var>stream_specifier</var>]] (<em>output</em>)</samp>&rsquo;</dt>
<dd>
<p>Designate one or more input streams as a source for the output file. Each input
stream is identified by the input file index <var>input_file_id</var> and
the input stream index <var>input_stream_id</var> within the input
file. Both indices start at 0. If specified,
<var>sync_file_id</var>:<var>stream_specifier</var> sets which input stream
is used as a presentation sync reference.
</p>
<p>The first <code>-map</code> option on the command line specifies the
source for output stream 0, the second <code>-map</code> option specifies
the source for output stream 1, etc.
</p>
<p>A <code>-</code> character before the stream identifier creates a &quot;negative&quot; mapping.
It disables matching streams from already created mappings.
</p>
<p>For example, to map ALL streams from the first input file to output
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -map 0 output
</pre></td></tr></table>

<p>For example, if you have two audio streams in the first input file,
these streams are identified by &quot;0:0&quot; and &quot;0:1&quot;. You can use
<code>-map</code> to select which streams to place in an output file. For
example:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -map 0:1 out.wav
</pre></td></tr></table>
<p>will map the input stream in &lsquo;<tt>INPUT</tt>&rsquo; identified by &quot;0:1&quot; to
the (single) output stream in &lsquo;<tt>out.wav</tt>&rsquo;.
</p>
<p>For example, to select the stream with index 2 from input file
&lsquo;<tt>a.mov</tt>&rsquo; (specified by the identifier &quot;0:2&quot;), and stream with
index 6 from input &lsquo;<tt>b.mov</tt>&rsquo; (specified by the identifier &quot;1:6&quot;),
and copy them to the output file &lsquo;<tt>out.mov</tt>&rsquo;:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i a.mov -i b.mov -c copy -map 0:2 -map 1:6 out.mov
</pre></td></tr></table>

<p>To select all video and the third audio stream from an input file:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -map 0:v -map 0:a:2 OUTPUT
</pre></td></tr></table>

<p>To map all the streams except the second audio, use negative mappings
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -map 0 -map -0:a:1 OUTPUT
</pre></td></tr></table>

<p>Note that using this option disables the default mappings for this output file.
</p>
</dd>
<dt> &lsquo;<samp>-map_channel [<var>input_file_id</var>.<var>stream_specifier</var>.<var>channel_id</var>|-1][:<var>output_file_id</var>.<var>stream_specifier</var>]</samp>&rsquo;</dt>
<dd><p>Map an audio channel from a given input to an output. If
<var>output_file_id</var>.<var>stream_specifier</var> are not set, the audio channel will
be mapped on all the audio streams.
</p>
<p>Using &quot;-1&quot; instead of
<var>input_file_id</var>.<var>stream_specifier</var>.<var>channel_id</var> will map a muted
channel.
</p>
<p>For example, assuming <var>INPUT</var> is a stereo audio file, you can switch the
two audio channels with the following command:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -map_channel 0.0.1 -map_channel 0.0.0 OUTPUT
</pre></td></tr></table>

<p>If you want to mute the first channel and keep the second:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -map_channel -1 -map_channel 0.0.1 OUTPUT
</pre></td></tr></table>

<p>The order of the &quot;-map_channel&quot; option specifies the order of the channels in
the output stream. The output channel layout is guessed from the number of
channels mapped (mono if one &quot;-map_channel&quot;, stereo if two, etc.). Using &quot;-ac&quot;
in combination of &quot;-map_channel&quot; makes the channel gain levels to be updated if
channel layouts don&rsquo;t match (for instance two &quot;-map_channel&quot; options and &quot;-ac
6&quot;).
</p>
<p>You can also extract each channel of an <var>INPUT</var> to specific outputs; the
following command extract each channel of the audio stream (file 0, stream 0)
to the respective <var>OUTPUT_CH0</var> and <var>OUTPUT_CH1</var>:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -map_channel 0.0.0 OUTPUT_CH0 -map_channel 0.0.1 OUTPUT_CH1
</pre></td></tr></table>

<p>The following example split the channels of a stereo input into streams:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i stereo.wav -map 0:0 -map 0:0 -map_channel 0.0.0:0.0 -map_channel 0.0.1:0.1 -y out.ogg
</pre></td></tr></table>

<p>Note that currently each output stream can only contain channels from a single
input stream; you can&rsquo;t for example use &quot;-map_channel&quot; to pick multiple input
audio channels contained in different streams (from the same or different files)
and merge them into a single output stream. It is therefore not currently
possible, for example, to turn two separate mono streams into a single stereo
stream. However spliting a stereo stream into two single channel mono streams
is possible.
</p>
</dd>
<dt> &lsquo;<samp>-map_metadata[:<var>metadata_spec_out</var>] <var>infile</var>[:<var>metadata_spec_in</var>] (<em>output,per-metadata</em>)</samp>&rsquo;</dt>
<dd><p>Set metadata information of the next output file from <var>infile</var>. Note that
those are file indices (zero-based), not filenames.
Optional <var>metadata_spec_in/out</var> parameters specify, which metadata to copy.
A metadata specifier can have the following forms:
</p><dl compact="compact">
<dt> &lsquo;<samp><var>g</var></samp>&rsquo;</dt>
<dd><p>global metadata, i.e. metadata that applies to the whole file
</p>
</dd>
<dt> &lsquo;<samp><var>s</var>[:<var>stream_spec</var>]</samp>&rsquo;</dt>
<dd><p>per-stream metadata. <var>stream_spec</var> is a stream specifier as described
in the <a href="#Stream-specifiers">Stream specifiers</a> chapter. In an input metadata specifier, the first
matching stream is copied from. In an output metadata specifier, all matching
streams are copied to.
</p>
</dd>
<dt> &lsquo;<samp><var>c</var>:<var>chapter_index</var></samp>&rsquo;</dt>
<dd><p>per-chapter metadata. <var>chapter_index</var> is the zero-based chapter index.
</p>
</dd>
<dt> &lsquo;<samp><var>p</var>:<var>program_index</var></samp>&rsquo;</dt>
<dd><p>per-program metadata. <var>program_index</var> is the zero-based program index.
</p></dd>
</dl>
<p>If metadata specifier is omitted, it defaults to global.
</p>
<p>By default, global metadata is copied from the first input file,
per-stream and per-chapter metadata is copied along with streams/chapters. These
default mappings are disabled by creating any mapping of the relevant type. A negative
file index can be used to create a dummy mapping that just disables automatic copying.
</p>
<p>For example to copy metadata from the first stream of the input file to global metadata
of the output file:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.ogg -map_metadata 0:s:0 out.mp3
</pre></td></tr></table>

<p>To do the reverse, i.e. copy global metadata to all audio streams:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.mkv -map_metadata:s:a 0:g out.mkv
</pre></td></tr></table>
<p>Note that simple <code>0</code> would work as well in this example, since global
metadata is assumed by default.
</p>
</dd>
<dt> &lsquo;<samp>-map_chapters <var>input_file_index</var> (<em>output</em>)</samp>&rsquo;</dt>
<dd><p>Copy chapters from input file with index <var>input_file_index</var> to the next
output file. If no chapter mapping is specified, then chapters are copied from
the first input file with at least one chapter. Use a negative file index to
disable any chapter copying.
</p></dd>
<dt> &lsquo;<samp>-debug <var>category</var></samp>&rsquo;</dt>
<dd><p>Print specific debug info.
<var>category</var> is a number or a string containing one of the following values:
</p><dl compact="compact">
<dt> &lsquo;<samp>bitstream</samp>&rsquo;</dt>
<dt> &lsquo;<samp>buffers</samp>&rsquo;</dt>
<dd><p>picture buffer allocations
</p></dd>
<dt> &lsquo;<samp>bugs</samp>&rsquo;</dt>
<dt> &lsquo;<samp>dct_coeff</samp>&rsquo;</dt>
<dt> &lsquo;<samp>er</samp>&rsquo;</dt>
<dd><p>error recognition
</p></dd>
<dt> &lsquo;<samp>mb_type</samp>&rsquo;</dt>
<dd><p>macroblock (MB) type
</p></dd>
<dt> &lsquo;<samp>mmco</samp>&rsquo;</dt>
<dd><p>memory management control operations (H.264)
</p></dd>
<dt> &lsquo;<samp>mv</samp>&rsquo;</dt>
<dd><p>motion vector
</p></dd>
<dt> &lsquo;<samp>pict</samp>&rsquo;</dt>
<dd><p>picture info
</p></dd>
<dt> &lsquo;<samp>pts</samp>&rsquo;</dt>
<dt> &lsquo;<samp>qp</samp>&rsquo;</dt>
<dd><p>per-block quantization parameter (QP)
</p></dd>
<dt> &lsquo;<samp>rc</samp>&rsquo;</dt>
<dd><p>rate control
</p></dd>
<dt> &lsquo;<samp>skip</samp>&rsquo;</dt>
<dt> &lsquo;<samp>startcode</samp>&rsquo;</dt>
<dt> &lsquo;<samp>thread_ops</samp>&rsquo;</dt>
<dd><p>threading operations
</p></dd>
<dt> &lsquo;<samp>vis_mb_type</samp>&rsquo;</dt>
<dd><p>visualize block types
</p></dd>
<dt> &lsquo;<samp>vis_qp</samp>&rsquo;</dt>
<dd><p>visualize quantization parameter (QP), lower QP are tinted greener
</p></dd>
</dl>
</dd>
<dt> &lsquo;<samp>-benchmark (<em>global</em>)</samp>&rsquo;</dt>
<dd><p>Show benchmarking information at the end of an encode.
Shows CPU time used and maximum memory consumption.
Maximum memory consumption is not supported on all systems,
it will usually display as 0 if not supported.
</p></dd>
<dt> &lsquo;<samp>-timelimit <var>duration</var> (<em>global</em>)</samp>&rsquo;</dt>
<dd><p>Exit after ffmpeg has been running for <var>duration</var> seconds.
</p></dd>
<dt> &lsquo;<samp>-dump (<em>global</em>)</samp>&rsquo;</dt>
<dd><p>Dump each input packet to stderr.
</p></dd>
<dt> &lsquo;<samp>-hex (<em>global</em>)</samp>&rsquo;</dt>
<dd><p>When dumping packets, also dump the payload.
</p></dd>
<dt> &lsquo;<samp>-ps <var>size</var></samp>&rsquo;</dt>
<dd><p>Set RTP payload size in bytes.
</p></dd>
<dt> &lsquo;<samp>-re (<em>input</em>)</samp>&rsquo;</dt>
<dd><p>Read input at native frame rate. Mainly used to simulate a grab device.
</p></dd>
<dt> &lsquo;<samp>-loop_input</samp>&rsquo;</dt>
<dd><p>Loop over the input stream. Currently it works only for image
streams. This option is used for automatic FFserver testing.
This option is deprecated, use -loop 1.
</p></dd>
<dt> &lsquo;<samp>-loop_output <var>number_of_times</var></samp>&rsquo;</dt>
<dd><p>Repeatedly loop output for formats that support looping such as animated GIF
(0 will loop the output infinitely).
This option is deprecated, use -loop.
</p></dd>
<dt> &lsquo;<samp>-threads <var>count</var></samp>&rsquo;</dt>
<dd><p>Thread count.
</p></dd>
<dt> &lsquo;<samp>-vsync <var>parameter</var></samp>&rsquo;</dt>
<dd><p>Video sync method.
</p>
<dl compact="compact">
<dt> &lsquo;<samp>0, passthrough</samp>&rsquo;</dt>
<dd><p>Each frame is passed with its timestamp from the demuxer to the muxer.
</p></dd>
<dt> &lsquo;<samp>1, cfr</samp>&rsquo;</dt>
<dd><p>Frames will be duplicated and dropped to achieve exactly the requested
constant framerate.
</p></dd>
<dt> &lsquo;<samp>2, vfr</samp>&rsquo;</dt>
<dd><p>Frames are passed through with their timestamp or dropped so as to
prevent 2 frames from having the same timestamp.
</p></dd>
<dt> &lsquo;<samp>-1, auto</samp>&rsquo;</dt>
<dd><p>Chooses between 1 and 2 depending on muxer capabilities. This is the
default method.
</p></dd>
</dl>

<p>With -map you can select from which stream the timestamps should be
taken. You can leave either video or audio unchanged and sync the
remaining stream(s) to the unchanged one.
</p>
</dd>
<dt> &lsquo;<samp>-async <var>samples_per_second</var></samp>&rsquo;</dt>
<dd><p>Audio sync method. &quot;Stretches/squeezes&quot; the audio stream to match the timestamps,
the parameter is the maximum samples per second by which the audio is changed.
-async 1 is a special case where only the start of the audio stream is corrected
without any later correction.
</p></dd>
<dt> &lsquo;<samp>-copyts</samp>&rsquo;</dt>
<dd><p>Copy timestamps from input to output.
</p></dd>
<dt> &lsquo;<samp>-copytb</samp>&rsquo;</dt>
<dd><p>Copy input stream time base from input to output when stream copying.
</p></dd>
<dt> &lsquo;<samp>-shortest</samp>&rsquo;</dt>
<dd><p>Finish encoding when the shortest input stream ends.
</p></dd>
<dt> &lsquo;<samp>-dts_delta_threshold</samp>&rsquo;</dt>
<dd><p>Timestamp discontinuity delta threshold.
</p></dd>
<dt> &lsquo;<samp>-muxdelay <var>seconds</var> (<em>input</em>)</samp>&rsquo;</dt>
<dd><p>Set the maximum demux-decode delay.
</p></dd>
<dt> &lsquo;<samp>-muxpreload <var>seconds</var> (<em>input</em>)</samp>&rsquo;</dt>
<dd><p>Set the initial demux-decode delay.
</p></dd>
<dt> &lsquo;<samp>-streamid <var>output-stream-index</var>:<var>new-value</var> (<em>output</em>)</samp>&rsquo;</dt>
<dd><p>Assign a new stream-id value to an output stream. This option should be
specified prior to the output filename to which it applies.
For the situation where multiple output files exist, a streamid
may be reassigned to a different value.
</p>
<p>For example, to set the stream 0 PID to 33 and the stream 1 PID to 36 for
an output mpegts file:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i infile -streamid 0:33 -streamid 1:36 out.ts
</pre></td></tr></table>

</dd>
<dt> &lsquo;<samp>-bsf[:<var>stream_specifier</var>] <var>bitstream_filters</var> (<em>output,per-stream</em>)</samp>&rsquo;</dt>
<dd><p>Set bitstream filters for matching streams. <var>bistream_filters</var> is
a comma-separated list of bitstream filters. Use the <code>-bsfs</code> option
to get the list of bitstream filters.
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i h264.mp4 -c:v copy -vbsf h264_mp4toannexb -an out.h264
</pre></td></tr></table>
<table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i file.mov -an -vn -sbsf mov2textsub -c:s copy -f rawvideo sub.txt
</pre></td></tr></table>

</dd>
<dt> &lsquo;<samp>-tag[:<var>stream_specifier</var>] <var>codec_tag</var> (<em>per-stream</em>)</samp>&rsquo;</dt>
<dd><p>Force a tag/fourcc for matching streams.
</p>
</dd>
<dt> &lsquo;<samp>-timecode <var>hh</var>:<var>mm</var>:<var>ss</var>SEP<var>ff</var></samp>&rsquo;</dt>
<dd><p>Specify Timecode for writing. <var>SEP</var> is &rsquo;:&rsquo; for non drop timecode and &rsquo;;&rsquo;
(or &rsquo;.&rsquo;) for drop.
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i input.mpg -timecode 01:02:03.04 -r 30000/1001 -s ntsc output.mpg
</pre></td></tr></table>
</dd>
</dl>

<a name="Preset-files"></a>
<h2 class="section"><a href="ffmpeg.html#toc-Preset-files">4.12 Preset files</a></h2>
<p>A preset file contains a sequence of <var>option</var>=<var>value</var> pairs,
one for each line, specifying a sequence of options which would be
awkward to specify on the command line. Lines starting with the hash
(&rsquo;#&rsquo;) character are ignored and are used to provide comments. Check
the &lsquo;<tt>presets</tt>&rsquo; directory in the FFmpeg source tree for examples.
</p>
<p>Preset files are specified with the <code>vpre</code>, <code>apre</code>,
<code>spre</code>, and <code>fpre</code> options. The <code>fpre</code> option takes the
filename of the preset instead of a preset name as input and can be
used for any kind of codec. For the <code>vpre</code>, <code>apre</code>, and
<code>spre</code> options, the options specified in a preset file are
applied to the currently selected codec of the same type as the preset
option.
</p>
<p>The argument passed to the <code>vpre</code>, <code>apre</code>, and <code>spre</code>
preset options identifies the preset file to use according to the
following rules:
</p>
<p>First ffmpeg searches for a file named <var>arg</var>.ffpreset in the
directories &lsquo;<tt>$FFMPEG_DATADIR</tt>&rsquo; (if set), and &lsquo;<tt>$HOME/.ffmpeg</tt>&rsquo;, and in
the datadir defined at configuration time (usually &lsquo;<tt>PREFIX/share/ffmpeg</tt>&rsquo;)
or in a &lsquo;<tt>ffpresets</tt>&rsquo; folder along the executable on win32,
in that order. For example, if the argument is <code>libx264-max</code>, it will
search for the file &lsquo;<tt>libx264-max.ffpreset</tt>&rsquo;.
</p>
<p>If no such file is found, then ffmpeg will search for a file named
<var>codec_name</var>-<var>arg</var>.ffpreset in the above-mentioned
directories, where <var>codec_name</var> is the name of the codec to which
the preset file options will be applied. For example, if you select
the video codec with <code>-vcodec libx264</code> and use <code>-vpre max</code>,
then it will search for the file &lsquo;<tt>libx264-max.ffpreset</tt>&rsquo;.
</p>
<a name="Tips"></a>
<h1 class="chapter"><a href="ffmpeg.html#toc-Tips">5. Tips</a></h1>

<ul>
<li>
For streaming at very low bitrate application, use a low frame rate
and a small GOP size. This is especially true for RealVideo where
the Linux player does not seem to be very fast, so it can miss
frames. An example is:

<table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -g 3 -r 3 -t 10 -b:v 50k -s qcif -f rv10 /tmp/b.rm
</pre></td></tr></table>

</li><li>
The parameter &rsquo;q&rsquo; which is displayed while encoding is the current
quantizer. The value 1 indicates that a very good quality could
be achieved. The value 31 indicates the worst quality. If q=31 appears
too often, it means that the encoder cannot compress enough to meet
your bitrate. You must either increase the bitrate, decrease the
frame rate or decrease the frame size.

</li><li>
If your computer is not fast enough, you can speed up the
compression at the expense of the compression ratio. You can use
&rsquo;-me zero&rsquo; to speed up motion estimation, and &rsquo;-intra&rsquo; to disable
motion estimation completely (you have only I-frames, which means it
is about as good as JPEG compression).

</li><li>
To have very low audio bitrates, reduce the sampling frequency
(down to 22050 Hz for MPEG audio, 22050 or 11025 for AC-3).

</li><li>
To have a constant quality (but a variable bitrate), use the option
&rsquo;-qscale n&rsquo; when &rsquo;n&rsquo; is between 1 (excellent quality) and 31 (worst
quality).

</li></ul>

<a name="Examples"></a>
<h1 class="chapter"><a href="ffmpeg.html#toc-Examples">6. Examples</a></h1>

<a name="Preset-files-1"></a>
<h2 class="section"><a href="ffmpeg.html#toc-Preset-files-1">6.1 Preset files</a></h2>

<p>A preset file contains a sequence of <var>option=value</var> pairs, one for
each line, specifying a sequence of options which can be specified also on
the command line. Lines starting with the hash (&rsquo;#&rsquo;) character are ignored and
are used to provide comments. Empty lines are also ignored. Check the
&lsquo;<tt>presets</tt>&rsquo; directory in the FFmpeg source tree for examples.
</p>
<p>Preset files are specified with the <code>pre</code> option, this option takes a
preset name as input.  FFmpeg searches for a file named <var>preset_name</var>.avpreset in
the directories &lsquo;<tt>$AVCONV_DATADIR</tt>&rsquo; (if set), and &lsquo;<tt>$HOME/.ffmpeg</tt>&rsquo;, and in
the data directory defined at configuration time (usually &lsquo;<tt>$PREFIX/share/ffmpeg</tt>&rsquo;)
in that order.  For example, if the argument is <code>libx264-max</code>, it will
search for the file &lsquo;<tt>libx264-max.avpreset</tt>&rsquo;.
</p>
<a name="Video-and-Audio-grabbing"></a>
<h2 class="section"><a href="ffmpeg.html#toc-Video-and-Audio-grabbing">6.2 Video and Audio grabbing</a></h2>

<p>If you specify the input format and device then ffmpeg can grab video
and audio directly.
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f oss -i /dev/dsp -f video4linux2 -i /dev/video0 /tmp/out.mpg
</pre></td></tr></table>

<p>Or with an ALSA audio source (mono input, card id 1) instead of OSS:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f alsa -ac 1 -i hw:1 -f video4linux2 -i /dev/video0 /tmp/out.mpg
</pre></td></tr></table>

<p>Note that you must activate the right video source and channel before
launching ffmpeg with any TV viewer such as
<a href="http://linux.bytesex.org/xawtv/">xawtv</a> by Gerd Knorr. You also
have to set the audio recording levels correctly with a
standard mixer.
</p>
<a name="X11-grabbing"></a>
<h2 class="section"><a href="ffmpeg.html#toc-X11-grabbing">6.3 X11 grabbing</a></h2>

<p>Grab the X11 display with ffmpeg via
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f x11grab -s cif -r 25 -i :0.0 /tmp/out.mpg
</pre></td></tr></table>

<p>0.0 is display.screen number of your X11 server, same as
the DISPLAY environment variable.
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f x11grab -s cif -r 25 -i :0.0+10,20 /tmp/out.mpg
</pre></td></tr></table>

<p>0.0 is display.screen number of your X11 server, same as the DISPLAY environment
variable. 10 is the x-offset and 20 the y-offset for the grabbing.
</p>
<a name="Video-and-Audio-file-format-conversion"></a>
<h2 class="section"><a href="ffmpeg.html#toc-Video-and-Audio-file-format-conversion">6.4 Video and Audio file format conversion</a></h2>

<p>Any supported file format and protocol can serve as input to ffmpeg:
</p>
<p>Examples:
</p><ul>
<li>
You can use YUV files as input:

<table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i /tmp/test%d.Y /tmp/out.mpg
</pre></td></tr></table>

<p>It will use the files:
</p><table><tr><td>&nbsp;</td><td><pre class="example">/tmp/test0.Y, /tmp/test0.U, /tmp/test0.V,
/tmp/test1.Y, /tmp/test1.U, /tmp/test1.V, etc...
</pre></td></tr></table>

<p>The Y files use twice the resolution of the U and V files. They are
raw files, without header. They can be generated by all decent video
decoders. You must specify the size of the image with the &lsquo;<samp>-s</samp>&rsquo; option
if ffmpeg cannot guess it.
</p>
</li><li>
You can input from a raw YUV420P file:

<table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i /tmp/test.yuv /tmp/out.avi
</pre></td></tr></table>

<p>test.yuv is a file containing raw YUV planar data. Each frame is composed
of the Y plane followed by the U and V planes at half vertical and
horizontal resolution.
</p>
</li><li>
You can output to a raw YUV420P file:

<table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i mydivx.avi hugefile.yuv
</pre></td></tr></table>

</li><li>
You can set several input files and output files:

<table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i /tmp/a.wav -s 640x480 -i /tmp/a.yuv /tmp/a.mpg
</pre></td></tr></table>

<p>Converts the audio file a.wav and the raw YUV video file a.yuv
to MPEG file a.mpg.
</p>
</li><li>
You can also do audio and video conversions at the same time:

<table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i /tmp/a.wav -ar 22050 /tmp/a.mp2
</pre></td></tr></table>

<p>Converts a.wav to MPEG audio at 22050 Hz sample rate.
</p>
</li><li>
You can encode to several formats at the same time and define a
mapping from input stream to output streams:

<table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i /tmp/a.wav -map 0:a -b:a 64k /tmp/a.mp2 -map 0:a -b:a 128k /tmp/b.mp2
</pre></td></tr></table>

<p>Converts a.wav to a.mp2 at 64 kbits and to b.mp2 at 128 kbits. &rsquo;-map
file:index&rsquo; specifies which input stream is used for each output
stream, in the order of the definition of output streams.
</p>
</li><li>
You can transcode decrypted VOBs:

<table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i snatch_1.vob -f avi -c:v mpeg4 -b:v 800k -g 300 -bf 2 -c:a libmp3lame -b:a 128k snatch.avi
</pre></td></tr></table>

<p>This is a typical DVD ripping example; the input is a VOB file, the
output an AVI file with MPEG-4 video and MP3 audio. Note that in this
command we use B-frames so the MPEG-4 stream is DivX5 compatible, and
GOP size is 300 which means one intra frame every 10 seconds for 29.97fps
input video. Furthermore, the audio stream is MP3-encoded so you need
to enable LAME support by passing <code>--enable-libmp3lame</code> to configure.
The mapping is particularly useful for DVD transcoding
to get the desired audio language.
</p>
<p>NOTE: To see the supported input formats, use <code>ffmpeg -formats</code>.
</p>
</li><li>
You can extract images from a video, or create a video from many images:

<p>For extracting images from a video:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i foo.avi -r 1 -s WxH -f image2 foo-%03d.jpeg
</pre></td></tr></table>

<p>This will extract one video frame per second from the video and will
output them in files named &lsquo;<tt>foo-001.jpeg</tt>&rsquo;, &lsquo;<tt>foo-002.jpeg</tt>&rsquo;,
etc. Images will be rescaled to fit the new WxH values.
</p>
<p>If you want to extract just a limited number of frames, you can use the
above command in combination with the -vframes or -t option, or in
combination with -ss to start extracting from a certain point in time.
</p>
<p>For creating a video from many images:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f image2 -i foo-%03d.jpeg -r 12 -s WxH foo.avi
</pre></td></tr></table>

<p>The syntax <code>foo-%03d.jpeg</code> specifies to use a decimal number
composed of three digits padded with zeroes to express the sequence
number. It is the same syntax supported by the C printf function, but
only formats accepting a normal integer are suitable.
</p>
</li><li>
You can put many streams of the same type in the output:

<table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i test1.avi -i test2.avi -map 0.3 -map 0.2 -map 0.1 -map 0.0 -c copy test12.nut
</pre></td></tr></table>

<p>The resulting output file &lsquo;<tt>test12.avi</tt>&rsquo; will contain first four streams from
the input file in reverse order.
</p>
</li></ul>

<a name="Expression-Evaluation"></a>
<h1 class="chapter"><a href="ffmpeg.html#toc-Expression-Evaluation">7. Expression Evaluation</a></h1>

<p>When evaluating an arithmetic expression, FFmpeg uses an internal
formula evaluator, implemented through the &lsquo;<tt>libavutil/eval.h</tt>&rsquo;
interface.
</p>
<p>An expression may contain unary, binary operators, constants, and
functions.
</p>
<p>Two expressions <var>expr1</var> and <var>expr2</var> can be combined to form
another expression &quot;<var>expr1</var>;<var>expr2</var>&quot;.
<var>expr1</var> and <var>expr2</var> are evaluated in turn, and the new
expression evaluates to the value of <var>expr2</var>.
</p>
<p>The following binary operators are available: <code>+</code>, <code>-</code>,
<code>*</code>, <code>/</code>, <code>^</code>.
</p>
<p>The following unary operators are available: <code>+</code>, <code>-</code>.
</p>
<p>The following functions are available:
</p><dl compact="compact">
<dt> &lsquo;<samp>sinh(x)</samp>&rsquo;</dt>
<dt> &lsquo;<samp>cosh(x)</samp>&rsquo;</dt>
<dt> &lsquo;<samp>tanh(x)</samp>&rsquo;</dt>
<dt> &lsquo;<samp>sin(x)</samp>&rsquo;</dt>
<dt> &lsquo;<samp>cos(x)</samp>&rsquo;</dt>
<dt> &lsquo;<samp>tan(x)</samp>&rsquo;</dt>
<dt> &lsquo;<samp>atan(x)</samp>&rsquo;</dt>
<dt> &lsquo;<samp>asin(x)</samp>&rsquo;</dt>
<dt> &lsquo;<samp>acos(x)</samp>&rsquo;</dt>
<dt> &lsquo;<samp>exp(x)</samp>&rsquo;</dt>
<dt> &lsquo;<samp>log(x)</samp>&rsquo;</dt>
<dt> &lsquo;<samp>abs(x)</samp>&rsquo;</dt>
<dt> &lsquo;<samp>squish(x)</samp>&rsquo;</dt>
<dt> &lsquo;<samp>gauss(x)</samp>&rsquo;</dt>
<dt> &lsquo;<samp>isnan(x)</samp>&rsquo;</dt>
<dd><p>Return 1.0 if <var>x</var> is NAN, 0.0 otherwise.
</p>
</dd>
<dt> &lsquo;<samp>mod(x, y)</samp>&rsquo;</dt>
<dt> &lsquo;<samp>max(x, y)</samp>&rsquo;</dt>
<dt> &lsquo;<samp>min(x, y)</samp>&rsquo;</dt>
<dt> &lsquo;<samp>eq(x, y)</samp>&rsquo;</dt>
<dt> &lsquo;<samp>gte(x, y)</samp>&rsquo;</dt>
<dt> &lsquo;<samp>gt(x, y)</samp>&rsquo;</dt>
<dt> &lsquo;<samp>lte(x, y)</samp>&rsquo;</dt>
<dt> &lsquo;<samp>lt(x, y)</samp>&rsquo;</dt>
<dt> &lsquo;<samp>st(var, expr)</samp>&rsquo;</dt>
<dd><p>Allow to store the value of the expression <var>expr</var> in an internal
variable. <var>var</var> specifies the number of the variable where to
store the value, and it is a value ranging from 0 to 9. The function
returns the value stored in the internal variable.
Note, Variables are currently not shared between expressions.
</p>
</dd>
<dt> &lsquo;<samp>ld(var)</samp>&rsquo;</dt>
<dd><p>Allow to load the value of the internal variable with number
<var>var</var>, which was previously stored with st(<var>var</var>, <var>expr</var>).
The function returns the loaded value.
</p>
</dd>
<dt> &lsquo;<samp>while(cond, expr)</samp>&rsquo;</dt>
<dd><p>Evaluate expression <var>expr</var> while the expression <var>cond</var> is
non-zero, and returns the value of the last <var>expr</var> evaluation, or
NAN if <var>cond</var> was always false.
</p>
</dd>
<dt> &lsquo;<samp>ceil(expr)</samp>&rsquo;</dt>
<dd><p>Round the value of expression <var>expr</var> upwards to the nearest
integer. For example, &quot;ceil(1.5)&quot; is &quot;2.0&quot;.
</p>
</dd>
<dt> &lsquo;<samp>floor(expr)</samp>&rsquo;</dt>
<dd><p>Round the value of expression <var>expr</var> downwards to the nearest
integer. For example, &quot;floor(-1.5)&quot; is &quot;-2.0&quot;.
</p>
</dd>
<dt> &lsquo;<samp>trunc(expr)</samp>&rsquo;</dt>
<dd><p>Round the value of expression <var>expr</var> towards zero to the nearest
integer. For example, &quot;trunc(-1.5)&quot; is &quot;-1.0&quot;.
</p>
</dd>
<dt> &lsquo;<samp>sqrt(expr)</samp>&rsquo;</dt>
<dd><p>Compute the square root of <var>expr</var>. This is equivalent to
&quot;(<var>expr</var>)^.5&quot;.
</p>
</dd>
<dt> &lsquo;<samp>not(expr)</samp>&rsquo;</dt>
<dd><p>Return 1.0 if <var>expr</var> is zero, 0.0 otherwise.
</p>
</dd>
<dt> &lsquo;<samp>pow(x, y)</samp>&rsquo;</dt>
<dd><p>Compute the power of <var>x</var> elevated <var>y</var>, it is equivalent to
&quot;(<var>x</var>)^(<var>y</var>)&quot;.
</p>
</dd>
<dt> &lsquo;<samp>random(x)</samp>&rsquo;</dt>
<dd><p>Return a pseudo random value between 0.0 and 1.0. <var>x</var> is the index of the
internal variable which will be used to save the seed/state.
</p>
</dd>
<dt> &lsquo;<samp>hypot(x, y)</samp>&rsquo;</dt>
<dd><p>This function is similar to the C function with the same name; it returns
&quot;sqrt(<var>x</var>*<var>x</var> + <var>y</var>*<var>y</var>)&quot;, the length of the hypotenuse of a
right triangle with sides of length <var>x</var> and <var>y</var>, or the distance of the
point (<var>x</var>, <var>y</var>) from the origin.
</p>
</dd>
<dt> &lsquo;<samp>gcd(x, y)</samp>&rsquo;</dt>
<dd><p>Return the greatest common divisor of <var>x</var> and <var>y</var>. If both <var>x</var> and
<var>y</var> are 0 or either or both are less than zero then behavior is undefined.
</p>
</dd>
<dt> &lsquo;<samp>if(x, y)</samp>&rsquo;</dt>
<dd><p>Evaluate <var>x</var>, and if the result is non-zero return the result of
the evaluation of <var>y</var>, return 0 otherwise.
</p>
</dd>
<dt> &lsquo;<samp>ifnot(x, y)</samp>&rsquo;</dt>
<dd><p>Evaluate <var>x</var>, and if the result is zero return the result of the
evaluation of <var>y</var>, return 0 otherwise.
</p></dd>
</dl>

<p>The following constants are available:
</p><dl compact="compact">
<dt> &lsquo;<samp>PI</samp>&rsquo;</dt>
<dd><p>area of the unit disc, approximately 3.14
</p></dd>
<dt> &lsquo;<samp>E</samp>&rsquo;</dt>
<dd><p>exp(1) (Euler&rsquo;s number), approximately 2.718
</p></dd>
<dt> &lsquo;<samp>PHI</samp>&rsquo;</dt>
<dd><p>golden ratio (1+sqrt(5))/2, approximately 1.618
</p></dd>
</dl>

<p>Assuming that an expression is considered &quot;true&quot; if it has a non-zero
value, note that:
</p>
<p><code>*</code> works like AND
</p>
<p><code>+</code> works like OR
</p>
<p>and the construct:
</p><table><tr><td>&nbsp;</td><td><pre class="example">if A then B else C
</pre></td></tr></table>
<p>is equivalent to
</p><table><tr><td>&nbsp;</td><td><pre class="example">if(A,B) + ifnot(A,C)
</pre></td></tr></table>

<p>In your C code, you can extend the list of unary and binary functions,
and define recognized constants, so that they are available for your
expressions.
</p>
<p>The evaluator also recognizes the International System number
postfixes. If &rsquo;i&rsquo; is appended after the postfix, powers of 2 are used
instead of powers of 10. The &rsquo;B&rsquo; postfix multiplies the value for 8,
and can be appended after another postfix or used alone. This allows
using for example &rsquo;KB&rsquo;, &rsquo;MiB&rsquo;, &rsquo;G&rsquo; and &rsquo;B&rsquo; as postfix.
</p>
<p>Follows the list of available International System postfixes, with
indication of the corresponding powers of 10 and of 2.
</p><dl compact="compact">
<dt> &lsquo;<samp>y</samp>&rsquo;</dt>
<dd><p>-24 / -80
</p></dd>
<dt> &lsquo;<samp>z</samp>&rsquo;</dt>
<dd><p>-21 / -70
</p></dd>
<dt> &lsquo;<samp>a</samp>&rsquo;</dt>
<dd><p>-18 / -60
</p></dd>
<dt> &lsquo;<samp>f</samp>&rsquo;</dt>
<dd><p>-15 / -50
</p></dd>
<dt> &lsquo;<samp>p</samp>&rsquo;</dt>
<dd><p>-12 / -40
</p></dd>
<dt> &lsquo;<samp>n</samp>&rsquo;</dt>
<dd><p>-9 / -30
</p></dd>
<dt> &lsquo;<samp>u</samp>&rsquo;</dt>
<dd><p>-6 / -20
</p></dd>
<dt> &lsquo;<samp>m</samp>&rsquo;</dt>
<dd><p>-3 / -10
</p></dd>
<dt> &lsquo;<samp>c</samp>&rsquo;</dt>
<dd><p>-2
</p></dd>
<dt> &lsquo;<samp>d</samp>&rsquo;</dt>
<dd><p>-1
</p></dd>
<dt> &lsquo;<samp>h</samp>&rsquo;</dt>
<dd><p>2
</p></dd>
<dt> &lsquo;<samp>k</samp>&rsquo;</dt>
<dd><p>3 / 10
</p></dd>
<dt> &lsquo;<samp>K</samp>&rsquo;</dt>
<dd><p>3 / 10
</p></dd>
<dt> &lsquo;<samp>M</samp>&rsquo;</dt>
<dd><p>6 / 20
</p></dd>
<dt> &lsquo;<samp>G</samp>&rsquo;</dt>
<dd><p>9 / 30
</p></dd>
<dt> &lsquo;<samp>T</samp>&rsquo;</dt>
<dd><p>12 / 40
</p></dd>
<dt> &lsquo;<samp>P</samp>&rsquo;</dt>
<dd><p>15 / 40
</p></dd>
<dt> &lsquo;<samp>E</samp>&rsquo;</dt>
<dd><p>18 / 50
</p></dd>
<dt> &lsquo;<samp>Z</samp>&rsquo;</dt>
<dd><p>21 / 60
</p></dd>
<dt> &lsquo;<samp>Y</samp>&rsquo;</dt>
<dd><p>24 / 70
</p></dd>
</dl>

<a name="Decoders"></a>
<h1 class="chapter"><a href="ffmpeg.html#toc-Decoders">8. Decoders</a></h1>

<p>Decoders are configured elements in FFmpeg which allow the decoding of
multimedia streams.
</p>
<p>When you configure your FFmpeg build, all the supported native decoders
are enabled by default. Decoders requiring an external library must be enabled
manually via the corresponding <code>--enable-lib</code> option. You can list all
available decoders using the configure option <code>--list-decoders</code>.
</p>
<p>You can disable all the decoders with the configure option
<code>--disable-decoders</code> and selectively enable / disable single decoders
with the options <code>--enable-decoder=<var>DECODER</var></code> /
<code>--disable-decoder=<var>DECODER</var></code>.
</p>
<p>The option <code>-codecs</code> of the ff* tools will display the list of
enabled decoders.
</p>

<a name="Video-Decoders"></a>
<h1 class="chapter"><a href="ffmpeg.html#toc-Video-Decoders">9. Video Decoders</a></h1>

<p>A description of some of the currently available video decoders
follows.
</p>
<a name="rawvideo"></a>
<h2 class="section"><a href="ffmpeg.html#toc-rawvideo">9.1 rawvideo</a></h2>

<p>Raw video decoder.
</p>
<p>This decoder decodes rawvideo streams.
</p>
<a name="Options-1"></a>
<h3 class="subsection"><a href="ffmpeg.html#toc-Options-1">9.1.1 Options</a></h3>

<dl compact="compact">
<dt> &lsquo;<samp>top <var>top_field_first</var></samp>&rsquo;</dt>
<dd><p>Specify the assumed field type of the input video.
</p><dl compact="compact">
<dt> &lsquo;<samp>-1</samp>&rsquo;</dt>
<dd><p>the video is assumed to be progressive (default)
</p></dd>
<dt> &lsquo;<samp>0</samp>&rsquo;</dt>
<dd><p>bottom-field-first is assumed
</p></dd>
<dt> &lsquo;<samp>1</samp>&rsquo;</dt>
<dd><p>top-field-first is assumed
</p></dd>
</dl>

</dd>
</dl>


<a name="Audio-Decoders"></a>
<h1 class="chapter"><a href="ffmpeg.html#toc-Audio-Decoders">10. Audio Decoders</a></h1>

<a name="ffwavesynth"></a>
<h2 class="section"><a href="ffmpeg.html#toc-ffwavesynth">10.1 ffwavesynth</a></h2>

<p>Internal wave synthetizer.
</p>
<p>This decoder generates wave patterns according to predefined sequences. Its
use is purely internal and the format of the data it accepts is not publicly
documented.
</p>
<a name="Encoders"></a>
<h1 class="chapter"><a href="ffmpeg.html#toc-Encoders">11. Encoders</a></h1>

<p>Encoders are configured elements in FFmpeg which allow the encoding of
multimedia streams.
</p>
<p>When you configure your FFmpeg build, all the supported native encoders
are enabled by default. Encoders requiring an external library must be enabled
manually via the corresponding <code>--enable-lib</code> option. You can list all
available encoders using the configure option <code>--list-encoders</code>.
</p>
<p>You can disable all the encoders with the configure option
<code>--disable-encoders</code> and selectively enable / disable single encoders
with the options <code>--enable-encoder=<var>ENCODER</var></code> /
<code>--disable-encoder=<var>ENCODER</var></code>.
</p>
<p>The option <code>-codecs</code> of the ff* tools will display the list of
enabled encoders.
</p>

<a name="Audio-Encoders"></a>
<h1 class="chapter"><a href="ffmpeg.html#toc-Audio-Encoders">12. Audio Encoders</a></h1>

<p>A description of some of the currently available audio encoders
follows.
</p>
<a name="ac3-and-ac3_005ffixed"></a>
<h2 class="section"><a href="ffmpeg.html#toc-ac3-and-ac3_005ffixed">12.1 ac3 and ac3_fixed</a></h2>

<p>AC-3 audio encoders.
</p>
<p>These encoders implement part of ATSC A/52:2010 and ETSI TS 102 366, as well as
the undocumented RealAudio 3 (a.k.a. dnet).
</p>
<p>The <var>ac3</var> encoder uses floating-point math, while the <var>ac3_fixed</var>
encoder only uses fixed-point integer math. This does not mean that one is
always faster, just that one or the other may be better suited to a
particular system. The floating-point encoder will generally produce better
quality audio for a given bitrate. The <var>ac3_fixed</var> encoder is not the
default codec for any of the output formats, so it must be specified explicitly
using the option <code>-acodec ac3_fixed</code> in order to use it.
</p>
<a name="AC_002d3-Metadata"></a>
<h3 class="subsection"><a href="ffmpeg.html#toc-AC_002d3-Metadata">12.1.1 AC-3 Metadata</a></h3>

<p>The AC-3 metadata options are used to set parameters that describe the audio,
but in most cases do not affect the audio encoding itself. Some of the options
do directly affect or influence the decoding and playback of the resulting
bitstream, while others are just for informational purposes. A few of the
options will add bits to the output stream that could otherwise be used for
audio data, and will thus affect the quality of the output. Those will be
indicated accordingly with a note in the option list below.
</p>
<p>These parameters are described in detail in several publicly-available
documents.
</p><ul>
<li> <a href="http://www.atsc.org/cms/standards/a_52-2010.pdf">A/52:2010 - Digital Audio Compression (AC-3) (E-AC-3) Standard</a>
</li><li> <a href="http://www.atsc.org/cms/standards/a_54a_with_corr_1.pdf">A/54 - Guide to the Use of the ATSC Digital Television Standard</a>
</li><li> <a href="http://www.dolby.com/uploadedFiles/zz-_Shared_Assets/English_PDFs/Professional/18_Metadata.Guide.pdf">Dolby Metadata Guide</a>
</li><li> <a href="http://www.dolby.com/uploadedFiles/zz-_Shared_Assets/English_PDFs/Professional/46_DDEncodingGuidelines.pdf">Dolby Digital Professional Encoding Guidelines</a>
</li></ul>

<a name="Metadata-Control-Options"></a>
<h4 class="subsubsection"><a href="ffmpeg.html#toc-Metadata-Control-Options">12.1.1.1 Metadata Control Options</a></h4>

<dl compact="compact">
<dt> &lsquo;<samp>-per_frame_metadata <var>boolean</var></samp>&rsquo;</dt>
<dd><p>Allow Per-Frame Metadata. Specifies if the encoder should check for changing
metadata for each frame.
</p><dl compact="compact">
<dt> &lsquo;<samp>0</samp>&rsquo;</dt>
<dd><p>The metadata values set at initialization will be used for every frame in the
stream. (default)
</p></dd>
<dt> &lsquo;<samp>1</samp>&rsquo;</dt>
<dd><p>Metadata values can be changed before encoding each frame.
</p></dd>
</dl>

</dd>
</dl>

<a name="Downmix-Levels"></a>
<h4 class="subsubsection"><a href="ffmpeg.html#toc-Downmix-Levels">12.1.1.2 Downmix Levels</a></h4>

<dl compact="compact">
<dt> &lsquo;<samp>-center_mixlev <var>level</var></samp>&rsquo;</dt>
<dd><p>Center Mix Level. The amount of gain the decoder should apply to the center
channel when downmixing to stereo. This field will only be written to the
bitstream if a center channel is present. The value is specified as a scale
factor. There are 3 valid values:
</p><dl compact="compact">
<dt> &lsquo;<samp>0.707</samp>&rsquo;</dt>
<dd><p>Apply -3dB gain
</p></dd>
<dt> &lsquo;<samp>0.595</samp>&rsquo;</dt>
<dd><p>Apply -4.5dB gain (default)
</p></dd>
<dt> &lsquo;<samp>0.500</samp>&rsquo;</dt>
<dd><p>Apply -6dB gain
</p></dd>
</dl>

</dd>
<dt> &lsquo;<samp>-surround_mixlev <var>level</var></samp>&rsquo;</dt>
<dd><p>Surround Mix Level. The amount of gain the decoder should apply to the surround
channel(s) when downmixing to stereo. This field will only be written to the
bitstream if one or more surround channels are present. The value is specified
as a scale factor.  There are 3 valid values:
</p><dl compact="compact">
<dt> &lsquo;<samp>0.707</samp>&rsquo;</dt>
<dd><p>Apply -3dB gain
</p></dd>
<dt> &lsquo;<samp>0.500</samp>&rsquo;</dt>
<dd><p>Apply -6dB gain (default)
</p></dd>
<dt> &lsquo;<samp>0.000</samp>&rsquo;</dt>
<dd><p>Silence Surround Channel(s)
</p></dd>
</dl>

</dd>
</dl>

<a name="Audio-Production-Information"></a>
<h4 class="subsubsection"><a href="ffmpeg.html#toc-Audio-Production-Information">12.1.1.3 Audio Production Information</a></h4>
<p>Audio Production Information is optional information describing the mixing
environment.  Either none or both of the fields are written to the bitstream.
</p>
<dl compact="compact">
<dt> &lsquo;<samp>-mixing_level <var>number</var></samp>&rsquo;</dt>
<dd><p>Mixing Level. Specifies peak sound pressure level (SPL) in the production
environment when the mix was mastered. Valid values are 80 to 111, or -1 for
unknown or not indicated. The default value is -1, but that value cannot be
used if the Audio Production Information is written to the bitstream. Therefore,
if the <code>room_type</code> option is not the default value, the <code>mixing_level</code>
option must not be -1.
</p>
</dd>
<dt> &lsquo;<samp>-room_type <var>type</var></samp>&rsquo;</dt>
<dd><p>Room Type. Describes the equalization used during the final mixing session at
the studio or on the dubbing stage. A large room is a dubbing stage with the
industry standard X-curve equalization; a small room has flat equalization.
This field will not be written to the bitstream if both the <code>mixing_level</code>
option and the <code>room_type</code> option have the default values.
</p><dl compact="compact">
<dt> &lsquo;<samp>0</samp>&rsquo;</dt>
<dt> &lsquo;<samp>notindicated</samp>&rsquo;</dt>
<dd><p>Not Indicated (default)
</p></dd>
<dt> &lsquo;<samp>1</samp>&rsquo;</dt>
<dt> &lsquo;<samp>large</samp>&rsquo;</dt>
<dd><p>Large Room
</p></dd>
<dt> &lsquo;<samp>2</samp>&rsquo;</dt>
<dt> &lsquo;<samp>small</samp>&rsquo;</dt>
<dd><p>Small Room
</p></dd>
</dl>

</dd>
</dl>

<a name="Other-Metadata-Options"></a>
<h4 class="subsubsection"><a href="ffmpeg.html#toc-Other-Metadata-Options">12.1.1.4 Other Metadata Options</a></h4>

<dl compact="compact">
<dt> &lsquo;<samp>-copyright <var>boolean</var></samp>&rsquo;</dt>
<dd><p>Copyright Indicator. Specifies whether a copyright exists for this audio.
</p><dl compact="compact">
<dt> &lsquo;<samp>0</samp>&rsquo;</dt>
<dt> &lsquo;<samp>off</samp>&rsquo;</dt>
<dd><p>No Copyright Exists (default)
</p></dd>
<dt> &lsquo;<samp>1</samp>&rsquo;</dt>
<dt> &lsquo;<samp>on</samp>&rsquo;</dt>
<dd><p>Copyright Exists
</p></dd>
</dl>

</dd>
<dt> &lsquo;<samp>-dialnorm <var>value</var></samp>&rsquo;</dt>
<dd><p>Dialogue Normalization. Indicates how far the average dialogue level of the
program is below digital 100% full scale (0 dBFS). This parameter determines a
level shift during audio reproduction that sets the average volume of the
dialogue to a preset level. The goal is to match volume level between program
sources. A value of -31dB will result in no volume level change, relative to
the source volume, during audio reproduction. Valid values are whole numbers in
the range -31 to -1, with -31 being the default.
</p>
</dd>
<dt> &lsquo;<samp>-dsur_mode <var>mode</var></samp>&rsquo;</dt>
<dd><p>Dolby Surround Mode. Specifies whether the stereo signal uses Dolby Surround
(Pro Logic). This field will only be written to the bitstream if the audio
stream is stereo. Using this option does <b>NOT</b> mean the encoder will actually
apply Dolby Surround processing.
</p><dl compact="compact">
<dt> &lsquo;<samp>0</samp>&rsquo;</dt>
<dt> &lsquo;<samp>notindicated</samp>&rsquo;</dt>
<dd><p>Not Indicated (default)
</p></dd>
<dt> &lsquo;<samp>1</samp>&rsquo;</dt>
<dt> &lsquo;<samp>off</samp>&rsquo;</dt>
<dd><p>Not Dolby Surround Encoded
</p></dd>
<dt> &lsquo;<samp>2</samp>&rsquo;</dt>
<dt> &lsquo;<samp>on</samp>&rsquo;</dt>
<dd><p>Dolby Surround Encoded
</p></dd>
</dl>

</dd>
<dt> &lsquo;<samp>-original <var>boolean</var></samp>&rsquo;</dt>
<dd><p>Original Bit Stream Indicator. Specifies whether this audio is from the
original source and not a copy.
</p><dl compact="compact">
<dt> &lsquo;<samp>0</samp>&rsquo;</dt>
<dt> &lsquo;<samp>off</samp>&rsquo;</dt>
<dd><p>Not Original Source
</p></dd>
<dt> &lsquo;<samp>1</samp>&rsquo;</dt>
<dt> &lsquo;<samp>on</samp>&rsquo;</dt>
<dd><p>Original Source (default)
</p></dd>
</dl>

</dd>
</dl>

<a name="Extended-Bitstream-Information"></a>
<h3 class="subsection"><a href="ffmpeg.html#toc-Extended-Bitstream-Information">12.1.2 Extended Bitstream Information</a></h3>
<p>The extended bitstream options are part of the Alternate Bit Stream Syntax as
specified in Annex D of the A/52:2010 standard. It is grouped into 2 parts.
If any one parameter in a group is specified, all values in that group will be
written to the bitstream.  Default values are used for those that are written
but have not been specified.  If the mixing levels are written, the decoder
will use these values instead of the ones specified in the <code>center_mixlev</code>
and <code>surround_mixlev</code> options if it supports the Alternate Bit Stream
Syntax.
</p>
<a name="Extended-Bitstream-Information-_002d-Part-1"></a>
<h4 class="subsubsection"><a href="ffmpeg.html#toc-Extended-Bitstream-Information-_002d-Part-1">12.1.2.1 Extended Bitstream Information - Part 1</a></h4>

<dl compact="compact">
<dt> &lsquo;<samp>-dmix_mode <var>mode</var></samp>&rsquo;</dt>
<dd><p>Preferred Stereo Downmix Mode. Allows the user to select either Lt/Rt
(Dolby Surround) or Lo/Ro (normal stereo) as the preferred stereo downmix mode.
</p><dl compact="compact">
<dt> &lsquo;<samp>0</samp>&rsquo;</dt>
<dt> &lsquo;<samp>notindicated</samp>&rsquo;</dt>
<dd><p>Not Indicated (default)
</p></dd>
<dt> &lsquo;<samp>1</samp>&rsquo;</dt>
<dt> &lsquo;<samp>ltrt</samp>&rsquo;</dt>
<dd><p>Lt/Rt Downmix Preferred
</p></dd>
<dt> &lsquo;<samp>2</samp>&rsquo;</dt>
<dt> &lsquo;<samp>loro</samp>&rsquo;</dt>
<dd><p>Lo/Ro Downmix Preferred
</p></dd>
</dl>

</dd>
<dt> &lsquo;<samp>-ltrt_cmixlev <var>level</var></samp>&rsquo;</dt>
<dd><p>Lt/Rt Center Mix Level. The amount of gain the decoder should apply to the
center channel when downmixing to stereo in Lt/Rt mode.
</p><dl compact="compact">
<dt> &lsquo;<samp>1.414</samp>&rsquo;</dt>
<dd><p>Apply +3dB gain
</p></dd>
<dt> &lsquo;<samp>1.189</samp>&rsquo;</dt>
<dd><p>Apply +1.5dB gain
</p></dd>
<dt> &lsquo;<samp>1.000</samp>&rsquo;</dt>
<dd><p>Apply 0dB gain
</p></dd>
<dt> &lsquo;<samp>0.841</samp>&rsquo;</dt>
<dd><p>Apply -1.5dB gain
</p></dd>
<dt> &lsquo;<samp>0.707</samp>&rsquo;</dt>
<dd><p>Apply -3.0dB gain
</p></dd>
<dt> &lsquo;<samp>0.595</samp>&rsquo;</dt>
<dd><p>Apply -4.5dB gain (default)
</p></dd>
<dt> &lsquo;<samp>0.500</samp>&rsquo;</dt>
<dd><p>Apply -6.0dB gain
</p></dd>
<dt> &lsquo;<samp>0.000</samp>&rsquo;</dt>
<dd><p>Silence Center Channel
</p></dd>
</dl>

</dd>
<dt> &lsquo;<samp>-ltrt_surmixlev <var>level</var></samp>&rsquo;</dt>
<dd><p>Lt/Rt Surround Mix Level. The amount of gain the decoder should apply to the
surround channel(s) when downmixing to stereo in Lt/Rt mode.
</p><dl compact="compact">
<dt> &lsquo;<samp>0.841</samp>&rsquo;</dt>
<dd><p>Apply -1.5dB gain
</p></dd>
<dt> &lsquo;<samp>0.707</samp>&rsquo;</dt>
<dd><p>Apply -3.0dB gain
</p></dd>
<dt> &lsquo;<samp>0.595</samp>&rsquo;</dt>
<dd><p>Apply -4.5dB gain
</p></dd>
<dt> &lsquo;<samp>0.500</samp>&rsquo;</dt>
<dd><p>Apply -6.0dB gain (default)
</p></dd>
<dt> &lsquo;<samp>0.000</samp>&rsquo;</dt>
<dd><p>Silence Surround Channel(s)
</p></dd>
</dl>

</dd>
<dt> &lsquo;<samp>-loro_cmixlev <var>level</var></samp>&rsquo;</dt>
<dd><p>Lo/Ro Center Mix Level. The amount of gain the decoder should apply to the
center channel when downmixing to stereo in Lo/Ro mode.
</p><dl compact="compact">
<dt> &lsquo;<samp>1.414</samp>&rsquo;</dt>
<dd><p>Apply +3dB gain
</p></dd>
<dt> &lsquo;<samp>1.189</samp>&rsquo;</dt>
<dd><p>Apply +1.5dB gain
</p></dd>
<dt> &lsquo;<samp>1.000</samp>&rsquo;</dt>
<dd><p>Apply 0dB gain
</p></dd>
<dt> &lsquo;<samp>0.841</samp>&rsquo;</dt>
<dd><p>Apply -1.5dB gain
</p></dd>
<dt> &lsquo;<samp>0.707</samp>&rsquo;</dt>
<dd><p>Apply -3.0dB gain
</p></dd>
<dt> &lsquo;<samp>0.595</samp>&rsquo;</dt>
<dd><p>Apply -4.5dB gain (default)
</p></dd>
<dt> &lsquo;<samp>0.500</samp>&rsquo;</dt>
<dd><p>Apply -6.0dB gain
</p></dd>
<dt> &lsquo;<samp>0.000</samp>&rsquo;</dt>
<dd><p>Silence Center Channel
</p></dd>
</dl>

</dd>
<dt> &lsquo;<samp>-loro_surmixlev <var>level</var></samp>&rsquo;</dt>
<dd><p>Lo/Ro Surround Mix Level. The amount of gain the decoder should apply to the
surround channel(s) when downmixing to stereo in Lo/Ro mode.
</p><dl compact="compact">
<dt> &lsquo;<samp>0.841</samp>&rsquo;</dt>
<dd><p>Apply -1.5dB gain
</p></dd>
<dt> &lsquo;<samp>0.707</samp>&rsquo;</dt>
<dd><p>Apply -3.0dB gain
</p></dd>
<dt> &lsquo;<samp>0.595</samp>&rsquo;</dt>
<dd><p>Apply -4.5dB gain
</p></dd>
<dt> &lsquo;<samp>0.500</samp>&rsquo;</dt>
<dd><p>Apply -6.0dB gain (default)
</p></dd>
<dt> &lsquo;<samp>0.000</samp>&rsquo;</dt>
<dd><p>Silence Surround Channel(s)
</p></dd>
</dl>

</dd>
</dl>

<a name="Extended-Bitstream-Information-_002d-Part-2"></a>
<h4 class="subsubsection"><a href="ffmpeg.html#toc-Extended-Bitstream-Information-_002d-Part-2">12.1.2.2 Extended Bitstream Information - Part 2</a></h4>

<dl compact="compact">
<dt> &lsquo;<samp>-dsurex_mode <var>mode</var></samp>&rsquo;</dt>
<dd><p>Dolby Surround EX Mode. Indicates whether the stream uses Dolby Surround EX
(7.1 matrixed to 5.1). Using this option does <b>NOT</b> mean the encoder will actually
apply Dolby Surround EX processing.
</p><dl compact="compact">
<dt> &lsquo;<samp>0</samp>&rsquo;</dt>
<dt> &lsquo;<samp>notindicated</samp>&rsquo;</dt>
<dd><p>Not Indicated (default)
</p></dd>
<dt> &lsquo;<samp>1</samp>&rsquo;</dt>
<dt> &lsquo;<samp>on</samp>&rsquo;</dt>
<dd><p>Dolby Surround EX Off
</p></dd>
<dt> &lsquo;<samp>2</samp>&rsquo;</dt>
<dt> &lsquo;<samp>off</samp>&rsquo;</dt>
<dd><p>Dolby Surround EX On
</p></dd>
</dl>

</dd>
<dt> &lsquo;<samp>-dheadphone_mode <var>mode</var></samp>&rsquo;</dt>
<dd><p>Dolby Headphone Mode. Indicates whether the stream uses Dolby Headphone
encoding (multi-channel matrixed to 2.0 for use with headphones). Using this
option does <b>NOT</b> mean the encoder will actually apply Dolby Headphone
processing.
</p><dl compact="compact">
<dt> &lsquo;<samp>0</samp>&rsquo;</dt>
<dt> &lsquo;<samp>notindicated</samp>&rsquo;</dt>
<dd><p>Not Indicated (default)
</p></dd>
<dt> &lsquo;<samp>1</samp>&rsquo;</dt>
<dt> &lsquo;<samp>on</samp>&rsquo;</dt>
<dd><p>Dolby Headphone Off
</p></dd>
<dt> &lsquo;<samp>2</samp>&rsquo;</dt>
<dt> &lsquo;<samp>off</samp>&rsquo;</dt>
<dd><p>Dolby Headphone On
</p></dd>
</dl>

</dd>
<dt> &lsquo;<samp>-ad_conv_type <var>type</var></samp>&rsquo;</dt>
<dd><p>A/D Converter Type. Indicates whether the audio has passed through HDCD A/D
conversion.
</p><dl compact="compact">
<dt> &lsquo;<samp>0</samp>&rsquo;</dt>
<dt> &lsquo;<samp>standard</samp>&rsquo;</dt>
<dd><p>Standard A/D Converter (default)
</p></dd>
<dt> &lsquo;<samp>1</samp>&rsquo;</dt>
<dt> &lsquo;<samp>hdcd</samp>&rsquo;</dt>
<dd><p>HDCD A/D Converter
</p></dd>
</dl>

</dd>
</dl>

<a name="Other-AC_002d3-Encoding-Options"></a>
<h3 class="subsection"><a href="ffmpeg.html#toc-Other-AC_002d3-Encoding-Options">12.1.3 Other AC-3 Encoding Options</a></h3>

<dl compact="compact">
<dt> &lsquo;<samp>-stereo_rematrixing <var>boolean</var></samp>&rsquo;</dt>
<dd><p>Stereo Rematrixing. Enables/Disables use of rematrixing for stereo input. This
is an optional AC-3 feature that increases quality by selectively encoding
the left/right channels as mid/side. This option is enabled by default, and it
is highly recommended that it be left as enabled except for testing purposes.
</p>
</dd>
</dl>

<a name="Floating_002dPoint_002dOnly-AC_002d3-Encoding-Options"></a>
<h3 class="subsection"><a href="ffmpeg.html#toc-Floating_002dPoint_002dOnly-AC_002d3-Encoding-Options">12.1.4 Floating-Point-Only AC-3 Encoding Options</a></h3>

<p>These options are only valid for the floating-point encoder and do not exist
for the fixed-point encoder due to the corresponding features not being
implemented in fixed-point.
</p>
<dl compact="compact">
<dt> &lsquo;<samp>-channel_coupling <var>boolean</var></samp>&rsquo;</dt>
<dd><p>Enables/Disables use of channel coupling, which is an optional AC-3 feature
that increases quality by combining high frequency information from multiple
channels into a single channel. The per-channel high frequency information is
sent with less accuracy in both the frequency and time domains. This allows
more bits to be used for lower frequencies while preserving enough information
to reconstruct the high frequencies. This option is enabled by default for the
floating-point encoder and should generally be left as enabled except for
testing purposes or to increase encoding speed.
</p><dl compact="compact">
<dt> &lsquo;<samp>-1</samp>&rsquo;</dt>
<dt> &lsquo;<samp>auto</samp>&rsquo;</dt>
<dd><p>Selected by Encoder (default)
</p></dd>
<dt> &lsquo;<samp>0</samp>&rsquo;</dt>
<dt> &lsquo;<samp>off</samp>&rsquo;</dt>
<dd><p>Disable Channel Coupling
</p></dd>
<dt> &lsquo;<samp>1</samp>&rsquo;</dt>
<dt> &lsquo;<samp>on</samp>&rsquo;</dt>
<dd><p>Enable Channel Coupling
</p></dd>
</dl>

</dd>
<dt> &lsquo;<samp>-cpl_start_band <var>number</var></samp>&rsquo;</dt>
<dd><p>Coupling Start Band. Sets the channel coupling start band, from 1 to 15. If a
value higher than the bandwidth is used, it will be reduced to 1 less than the
coupling end band. If <var>auto</var> is used, the start band will be determined by
the encoder based on the bit rate, sample rate, and channel layout. This option
has no effect if channel coupling is disabled.
</p><dl compact="compact">
<dt> &lsquo;<samp>-1</samp>&rsquo;</dt>
<dt> &lsquo;<samp>auto</samp>&rsquo;</dt>
<dd><p>Selected by Encoder (default)
</p></dd>
</dl>

</dd>
</dl>


<a name="Video-Encoders"></a>
<h1 class="chapter"><a href="ffmpeg.html#toc-Video-Encoders">13. Video Encoders</a></h1>

<p>A description of some of the currently available video encoders
follows.
</p>
<a name="libvpx"></a>
<h2 class="section"><a href="ffmpeg.html#toc-libvpx">13.1 libvpx</a></h2>

<p>VP8 format supported through libvpx.
</p>
<p>Requires the presence of the libvpx headers and library during configuration.
You need to explicitly configure the build with <code>--enable-libvpx</code>.
</p>
<a name="Options-5"></a>
<h3 class="subsection"><a href="ffmpeg.html#toc-Options-5">13.1.1 Options</a></h3>

<p>Mapping from FFmpeg to libvpx options with conversion notes in parentheses.
</p>
<dl compact="compact">
<dt> &lsquo;<samp>threads</samp>&rsquo;</dt>
<dd><p>g_threads
</p>
</dd>
<dt> &lsquo;<samp>profile</samp>&rsquo;</dt>
<dd><p>g_profile
</p>
</dd>
<dt> &lsquo;<samp>vb</samp>&rsquo;</dt>
<dd><p>rc_target_bitrate
</p>
</dd>
<dt> &lsquo;<samp>g</samp>&rsquo;</dt>
<dd><p>kf_max_dist
</p>
</dd>
<dt> &lsquo;<samp>keyint_min</samp>&rsquo;</dt>
<dd><p>kf_min_dist
</p>
</dd>
<dt> &lsquo;<samp>qmin</samp>&rsquo;</dt>
<dd><p>rc_min_quantizer
</p>
</dd>
<dt> &lsquo;<samp>qmax</samp>&rsquo;</dt>
<dd><p>rc_max_quantizer
</p>
</dd>
<dt> &lsquo;<samp>bufsize, vb</samp>&rsquo;</dt>
<dd><p>rc_buf_sz
<code>(bufsize * 1000 / vb)</code>
</p>
<p>rc_buf_optimal_sz
<code>(bufsize * 1000 / vb * 5 / 6)</code>
</p>
</dd>
<dt> &lsquo;<samp>rc_init_occupancy, vb</samp>&rsquo;</dt>
<dd><p>rc_buf_initial_sz
<code>(rc_init_occupancy * 1000 / vb)</code>
</p>
</dd>
<dt> &lsquo;<samp>rc_buffer_aggressivity</samp>&rsquo;</dt>
<dd><p>rc_undershoot_pct
</p>
</dd>
<dt> &lsquo;<samp>skip_threshold</samp>&rsquo;</dt>
<dd><p>rc_dropframe_thresh
</p>
</dd>
<dt> &lsquo;<samp>qcomp</samp>&rsquo;</dt>
<dd><p>rc_2pass_vbr_bias_pct
</p>
</dd>
<dt> &lsquo;<samp>maxrate, vb</samp>&rsquo;</dt>
<dd><p>rc_2pass_vbr_maxsection_pct
<code>(maxrate * 100 / vb)</code>
</p>
</dd>
<dt> &lsquo;<samp>minrate, vb</samp>&rsquo;</dt>
<dd><p>rc_2pass_vbr_minsection_pct
<code>(minrate * 100 / vb)</code>
</p>
</dd>
<dt> &lsquo;<samp>minrate, maxrate, vb</samp>&rsquo;</dt>
<dd><p><code>VPX_CBR</code>
<code>(minrate == maxrate == vb)</code>
</p>
</dd>
<dt> &lsquo;<samp>crf</samp>&rsquo;</dt>
<dd><p><code>VPX_CQ</code>, <code>VP8E_SET_CQ_LEVEL</code>
</p>
</dd>
<dt> &lsquo;<samp>quality</samp>&rsquo;</dt>
<dd><dl compact="compact">
<dt> &lsquo;<samp><var>best</var></samp>&rsquo;</dt>
<dd><p><code>VPX_DL_BEST_QUALITY</code>
</p></dd>
<dt> &lsquo;<samp><var>good</var></samp>&rsquo;</dt>
<dd><p><code>VPX_DL_GOOD_QUALITY</code>
</p></dd>
<dt> &lsquo;<samp><var>realtime</var></samp>&rsquo;</dt>
<dd><p><code>VPX_DL_REALTIME</code>
</p></dd>
</dl>

</dd>
<dt> &lsquo;<samp>speed</samp>&rsquo;</dt>
<dd><p><code>VP8E_SET_CPUUSED</code>
</p>
</dd>
<dt> &lsquo;<samp>nr</samp>&rsquo;</dt>
<dd><p><code>VP8E_SET_NOISE_SENSITIVITY</code>
</p>
</dd>
<dt> &lsquo;<samp>mb_threshold</samp>&rsquo;</dt>
<dd><p><code>VP8E_SET_STATIC_THRESHOLD</code>
</p>
</dd>
<dt> &lsquo;<samp>slices</samp>&rsquo;</dt>
<dd><p><code>VP8E_SET_TOKEN_PARTITIONS</code>
</p>
</dd>
<dt> &lsquo;<samp>Alternate reference frame related</samp>&rsquo;</dt>
<dd><dl compact="compact">
<dt> &lsquo;<samp>vp8flags altref</samp>&rsquo;</dt>
<dd><p><code>VP8E_SET_ENABLEAUTOALTREF</code>
</p></dd>
<dt> &lsquo;<samp><var>arnr_max_frames</var></samp>&rsquo;</dt>
<dd><p><code>VP8E_SET_ARNR_MAXFRAMES</code>
</p></dd>
<dt> &lsquo;<samp><var>arnr_type</var></samp>&rsquo;</dt>
<dd><p><code>VP8E_SET_ARNR_TYPE</code>
</p></dd>
<dt> &lsquo;<samp><var>arnr_strength</var></samp>&rsquo;</dt>
<dd><p><code>VP8E_SET_ARNR_STRENGTH</code>
</p></dd>
<dt> &lsquo;<samp><var>rc_lookahead</var></samp>&rsquo;</dt>
<dd><p>g_lag_in_frames
</p></dd>
</dl>

</dd>
<dt> &lsquo;<samp>vp8flags error_resilient</samp>&rsquo;</dt>
<dd><p>g_error_resilient
</p>
</dd>
</dl>

<p>For more information about libvpx see:
<a href="http://www.webmproject.org/">http://www.webmproject.org/</a>
</p>
<a name="libx264"></a>
<h2 class="section"><a href="ffmpeg.html#toc-libx264">13.2 libx264</a></h2>

<p>H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 format supported through
libx264.
</p>
<p>Requires the presence of the libx264 headers and library during
configuration. You need to explicitly configure the build with
<code>--enable-libx264</code>.
</p>
<a name="Options-4"></a>
<h3 class="subsection"><a href="ffmpeg.html#toc-Options-4">13.2.1 Options</a></h3>

<dl compact="compact">
<dt> &lsquo;<samp>preset <var>preset_name</var></samp>&rsquo;</dt>
<dd><p>Set the encoding preset.
</p>
</dd>
<dt> &lsquo;<samp>tune <var>tune_name</var></samp>&rsquo;</dt>
<dd><p>Tune the encoding params.
</p>
</dd>
<dt> &lsquo;<samp>fastfirstpass <var>bool</var></samp>&rsquo;</dt>
<dd><p>Use fast settings when encoding first pass, default value is 1.
</p>
</dd>
<dt> &lsquo;<samp>profile <var>profile_name</var></samp>&rsquo;</dt>
<dd><p>Set profile restrictions.
</p>
</dd>
<dt> &lsquo;<samp>level <var>level</var></samp>&rsquo;</dt>
<dd><p>Specify level (as defined by Annex A).
Deprecated in favor of <var>x264opts</var>.
</p>
</dd>
<dt> &lsquo;<samp>passlogfile <var>filename</var></samp>&rsquo;</dt>
<dd><p>Specify filename for 2 pass stats.
Deprecated in favor of <var>x264opts</var> (see <var>stats</var> libx264 option).
</p>
</dd>
<dt> &lsquo;<samp>wpredp <var>wpred_type</var></samp>&rsquo;</dt>
<dd><p>Specify Weighted prediction for P-frames.
Deprecated in favor of <var>x264opts</var> (see <var>weightp</var> libx264 option).
</p>
</dd>
<dt> &lsquo;<samp>x264opts <var>options</var></samp>&rsquo;</dt>
<dd><p>Allow to set any x264 option, see x264 &ndash;fullhelp for a list.
</p>
<p><var>options</var> is a list of <var>key</var>=<var>value</var> couples separated by
&quot;:&quot;.
</p></dd>
</dl>

<p>For example to specify libx264 encoding options with <code>ffmpeg</code>:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i foo.mpg -vcodec libx264 -x264opts keyint=123:min-keyint=20 -an out.mkv
</pre></td></tr></table>

<p>For more information about libx264 and the supported options see:
<a href="http://www.videolan.org/developers/x264.html">http://www.videolan.org/developers/x264.html</a>
</p>
<a name="Demuxers"></a>
<h1 class="chapter"><a href="ffmpeg.html#toc-Demuxers">14. Demuxers</a></h1>

<p>Demuxers are configured elements in FFmpeg which allow to read the
multimedia streams from a particular type of file.
</p>
<p>When you configure your FFmpeg build, all the supported demuxers
are enabled by default. You can list all available ones using the
configure option &quot;&ndash;list-demuxers&quot;.
</p>
<p>You can disable all the demuxers using the configure option
&quot;&ndash;disable-demuxers&quot;, and selectively enable a single demuxer with
the option &quot;&ndash;enable-demuxer=<var>DEMUXER</var>&quot;, or disable it
with the option &quot;&ndash;disable-demuxer=<var>DEMUXER</var>&quot;.
</p>
<p>The option &quot;-formats&quot; of the ff* tools will display the list of
enabled demuxers.
</p>
<p>The description of some of the currently available demuxers follows.
</p>
<a name="image2-2"></a>
<h2 class="section"><a href="ffmpeg.html#toc-image2-2">14.1 image2</a></h2>

<p>Image file demuxer.
</p>
<p>This demuxer reads from a list of image files specified by a pattern.
</p>
<p>The pattern may contain the string &quot;%d&quot; or &quot;%0<var>N</var>d&quot;, which
specifies the position of the characters representing a sequential
number in each filename matched by the pattern. If the form
&quot;%d0<var>N</var>d&quot; is used, the string representing the number in each
filename is 0-padded and <var>N</var> is the total number of 0-padded
digits representing the number. The literal character &rsquo;%&rsquo; can be
specified in the pattern with the string &quot;%%&quot;.
</p>
<p>If the pattern contains &quot;%d&quot; or &quot;%0<var>N</var>d&quot;, the first filename of
the file list specified by the pattern must contain a number
inclusively contained between 0 and 4, all the following numbers must
be sequential. This limitation may be hopefully fixed.
</p>
<p>The pattern may contain a suffix which is used to automatically
determine the format of the images contained in the files.
</p>
<p>For example the pattern &quot;img-%03d.bmp&quot; will match a sequence of
filenames of the form &lsquo;<tt>img-001.bmp</tt>&rsquo;, &lsquo;<tt>img-002.bmp</tt>&rsquo;, ...,
&lsquo;<tt>img-010.bmp</tt>&rsquo;, etc.; the pattern &quot;i%%m%%g-%d.jpg&quot; will match a
sequence of filenames of the form &lsquo;<tt>i%m%g-1.jpg</tt>&rsquo;,
&lsquo;<tt>i%m%g-2.jpg</tt>&rsquo;, ..., &lsquo;<tt>i%m%g-10.jpg</tt>&rsquo;, etc.
</p>
<p>The size, the pixel format, and the format of each image must be the
same for all the files in the sequence.
</p>
<p>The following example shows how to use <code>ffmpeg</code> for creating a
video from the images in the file sequence &lsquo;<tt>img-001.jpeg</tt>&rsquo;,
&lsquo;<tt>img-002.jpeg</tt>&rsquo;, ..., assuming an input frame rate of 10 frames per
second:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i 'img-%03d.jpeg' -r 10 out.mkv
</pre></td></tr></table>

<p>Note that the pattern must not necessarily contain &quot;%d&quot; or
&quot;%0<var>N</var>d&quot;, for example to convert a single image file
&lsquo;<tt>img.jpeg</tt>&rsquo; you can employ the command:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i img.jpeg img.png
</pre></td></tr></table>

<a name="applehttp"></a>
<h2 class="section"><a href="ffmpeg.html#toc-applehttp">14.2 applehttp</a></h2>

<p>Apple HTTP Live Streaming demuxer.
</p>
<p>This demuxer presents all AVStreams from all variant streams.
The id field is set to the bitrate variant index number. By setting
the discard flags on AVStreams (by pressing &rsquo;a&rsquo; or &rsquo;v&rsquo; in ffplay),
the caller can decide which variant streams to actually receive.
The total bitrate of the variant that the stream belongs to is
available in a metadata key named &quot;variant_bitrate&quot;.
</p>
<a name="sbg"></a>
<h2 class="section"><a href="ffmpeg.html#toc-sbg">14.3 sbg</a></h2>

<p>SBaGen script demuxer.
</p>
<p>This demuxer reads the script language used by SBaGen
<a href="http://uazu.net/sbagen/">http://uazu.net/sbagen/</a> to generate binaural beats sessions. A SBG
script looks like that:
</p><table><tr><td>&nbsp;</td><td><pre class="example">-SE
a: 300-2.5/3 440+4.5/0
b: 300-2.5/0 440+4.5/3
off: -
NOW      == a
+0:07:00 == b
+0:14:00 == a
+0:21:00 == b
+0:30:00    off
</pre></td></tr></table>

<p>A SBG script can mix absolute and relative timestamps. If the script uses
either only absolute timestamps (including the script start time) or only
relative ones, then its layout is fixed, and the conversion is
straightforward. On the other hand, if the script mixes both kind of
timestamps, then the <var>NOW</var> reference for relative timestamps will be
taken from the current time of day at the time the script is read, and the
script layout will be frozen according to that reference. That means that if
the script is directly played, the actual times will match the absolute
timestamps up to the sound controller&rsquo;s clock accuracy, but if the user
somehow pauses the playback or seeks, all times will be shifted accordingly.
</p>
<a name="Muxers"></a>
<h1 class="chapter"><a href="ffmpeg.html#toc-Muxers">15. Muxers</a></h1>

<p>Muxers are configured elements in FFmpeg which allow writing
multimedia streams to a particular type of file.
</p>
<p>When you configure your FFmpeg build, all the supported muxers
are enabled by default. You can list all available muxers using the
configure option <code>--list-muxers</code>.
</p>
<p>You can disable all the muxers with the configure option
<code>--disable-muxers</code> and selectively enable / disable single muxers
with the options <code>--enable-muxer=<var>MUXER</var></code> /
<code>--disable-muxer=<var>MUXER</var></code>.
</p>
<p>The option <code>-formats</code> of the ff* tools will display the list of
enabled muxers.
</p>
<p>A description of some of the currently available muxers follows.
</p>
<p><a name="crc"></a>
</p><a name="crc-1"></a>
<h2 class="section"><a href="ffmpeg.html#toc-crc-1">15.1 crc</a></h2>

<p>CRC (Cyclic Redundancy Check) testing format.
</p>
<p>This muxer computes and prints the Adler-32 CRC of all the input audio
and video frames. By default audio frames are converted to signed
16-bit raw audio and video frames to raw video before computing the
CRC.
</p>
<p>The output of the muxer consists of a single line of the form:
CRC=0x<var>CRC</var>, where <var>CRC</var> is a hexadecimal number 0-padded to
8 digits containing the CRC for all the decoded input frames.
</p>
<p>For example to compute the CRC of the input, and store it in the file
&lsquo;<tt>out.crc</tt>&rsquo;:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -f crc out.crc
</pre></td></tr></table>

<p>You can print the CRC to stdout with the command:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -f crc -
</pre></td></tr></table>

<p>You can select the output format of each frame with <code>ffmpeg</code> by
specifying the audio and video codec and format. For example to
compute the CRC of the input audio converted to PCM unsigned 8-bit
and the input video converted to MPEG-2 video, use the command:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -c:a pcm_u8 -c:v mpeg2video -f crc -
</pre></td></tr></table>

<p>See also the <a href="#framecrc">framecrc</a> muxer.
</p>
<p><a name="framecrc"></a>
</p><a name="framecrc-1"></a>
<h2 class="section"><a href="ffmpeg.html#toc-framecrc-1">15.2 framecrc</a></h2>

<p>Per-frame CRC (Cyclic Redundancy Check) testing format.
</p>
<p>This muxer computes and prints the Adler-32 CRC for each decoded audio
and video frame. By default audio frames are converted to signed
16-bit raw audio and video frames to raw video before computing the
CRC.
</p>
<p>The output of the muxer consists of a line for each audio and video
frame of the form: <var>stream_index</var>, <var>frame_dts</var>,
<var>frame_size</var>, 0x<var>CRC</var>, where <var>CRC</var> is a hexadecimal
number 0-padded to 8 digits containing the CRC of the decoded frame.
</p>
<p>For example to compute the CRC of each decoded frame in the input, and
store it in the file &lsquo;<tt>out.crc</tt>&rsquo;:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -f framecrc out.crc
</pre></td></tr></table>

<p>You can print the CRC of each decoded frame to stdout with the command:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -f framecrc -
</pre></td></tr></table>

<p>You can select the output format of each frame with <code>ffmpeg</code> by
specifying the audio and video codec and format. For example, to
compute the CRC of each decoded input audio frame converted to PCM
unsigned 8-bit and of each decoded input video frame converted to
MPEG-2 video, use the command:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -c:a pcm_u8 -c:v mpeg2video -f framecrc -
</pre></td></tr></table>

<p>See also the <a href="#crc">crc</a> muxer.
</p>
<p><a name="image2"></a>
</p><a name="image2-1"></a>
<h2 class="section"><a href="ffmpeg.html#toc-image2-1">15.3 image2</a></h2>

<p>Image file muxer.
</p>
<p>The image file muxer writes video frames to image files.
</p>
<p>The output filenames are specified by a pattern, which can be used to
produce sequentially numbered series of files.
The pattern may contain the string &quot;%d&quot; or &quot;%0<var>N</var>d&quot;, this string
specifies the position of the characters representing a numbering in
the filenames. If the form &quot;%0<var>N</var>d&quot; is used, the string
representing the number in each filename is 0-padded to <var>N</var>
digits. The literal character &rsquo;%&rsquo; can be specified in the pattern with
the string &quot;%%&quot;.
</p>
<p>If the pattern contains &quot;%d&quot; or &quot;%0<var>N</var>d&quot;, the first filename of
the file list specified will contain the number 1, all the following
numbers will be sequential.
</p>
<p>The pattern may contain a suffix which is used to automatically
determine the format of the image files to write.
</p>
<p>For example the pattern &quot;img-%03d.bmp&quot; will specify a sequence of
filenames of the form &lsquo;<tt>img-001.bmp</tt>&rsquo;, &lsquo;<tt>img-002.bmp</tt>&rsquo;, ...,
&lsquo;<tt>img-010.bmp</tt>&rsquo;, etc.
The pattern &quot;img%%-%d.jpg&quot; will specify a sequence of filenames of the
form &lsquo;<tt>img%-1.jpg</tt>&rsquo;, &lsquo;<tt>img%-2.jpg</tt>&rsquo;, ..., &lsquo;<tt>img%-10.jpg</tt>&rsquo;,
etc.
</p>
<p>The following example shows how to use <code>ffmpeg</code> for creating a
sequence of files &lsquo;<tt>img-001.jpeg</tt>&rsquo;, &lsquo;<tt>img-002.jpeg</tt>&rsquo;, ...,
taking one image every second from the input video:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.avi -vsync 1 -r 1 -f image2 'img-%03d.jpeg'
</pre></td></tr></table>

<p>Note that with <code>ffmpeg</code>, if the format is not specified with the
<code>-f</code> option and the output filename specifies an image file
format, the image2 muxer is automatically selected, so the previous
command can be written as:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.avi -vsync 1 -r 1 'img-%03d.jpeg'
</pre></td></tr></table>

<p>Note also that the pattern must not necessarily contain &quot;%d&quot; or
&quot;%0<var>N</var>d&quot;, for example to create a single image file
&lsquo;<tt>img.jpeg</tt>&rsquo; from the input video you can employ the command:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.avi -f image2 -frames:v 1 img.jpeg
</pre></td></tr></table>

<p>The image muxer supports the .Y.U.V image file format. This format is
special in that that each image frame consists of three files, for
each of the YUV420P components. To read or write this image file format,
specify the name of the &rsquo;.Y&rsquo; file. The muxer will automatically open the
&rsquo;.U&rsquo; and &rsquo;.V&rsquo; files as required.
</p>
<a name="mov"></a>
<h2 class="section"><a href="ffmpeg.html#toc-mov">15.4 mov</a></h2>

<p>MOV / MP4 muxer
</p>
<p>The muxer options are:
</p>
<dl compact="compact">
<dt> &lsquo;<samp>-moov_size <var>bytes</var></samp>&rsquo;</dt>
<dd><p>Reserves space for the moov atom at the beginning of the file instead of placing the
moov atom at the end. If the space reserved is insufficient, muxing will fail.
</p></dd>
</dl>

<a name="mpegts"></a>
<h2 class="section"><a href="ffmpeg.html#toc-mpegts">15.5 mpegts</a></h2>

<p>MPEG transport stream muxer.
</p>
<p>This muxer implements ISO 13818-1 and part of ETSI EN 300 468.
</p>
<p>The muxer options are:
</p>
<dl compact="compact">
<dt> &lsquo;<samp>-mpegts_original_network_id <var>number</var></samp>&rsquo;</dt>
<dd><p>Set the original_network_id (default 0x0001). This is unique identifier
of a network in DVB. Its main use is in the unique identification of a
service through the path Original_Network_ID, Transport_Stream_ID.
</p></dd>
<dt> &lsquo;<samp>-mpegts_transport_stream_id <var>number</var></samp>&rsquo;</dt>
<dd><p>Set the transport_stream_id (default 0x0001). This identifies a
transponder in DVB.
</p></dd>
<dt> &lsquo;<samp>-mpegts_service_id <var>number</var></samp>&rsquo;</dt>
<dd><p>Set the service_id (default 0x0001) also known as program in DVB.
</p></dd>
<dt> &lsquo;<samp>-mpegts_pmt_start_pid <var>number</var></samp>&rsquo;</dt>
<dd><p>Set the first PID for PMT (default 0x1000, max 0x1f00).
</p></dd>
<dt> &lsquo;<samp>-mpegts_start_pid <var>number</var></samp>&rsquo;</dt>
<dd><p>Set the first PID for data packets (default 0x0100, max 0x0f00).
</p></dd>
</dl>

<p>The recognized metadata settings in mpegts muxer are <code>service_provider</code>
and <code>service_name</code>. If they are not set the default for
<code>service_provider</code> is &quot;FFmpeg&quot; and the default for
<code>service_name</code> is &quot;Service01&quot;.
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i file.mpg -c copy \
     -mpegts_original_network_id 0x1122 \
     -mpegts_transport_stream_id 0x3344 \
     -mpegts_service_id 0x5566 \
     -mpegts_pmt_start_pid 0x1500 \
     -mpegts_start_pid 0x150 \
     -metadata service_provider=&quot;Some provider&quot; \
     -metadata service_name=&quot;Some Channel&quot; \
     -y out.ts
</pre></td></tr></table>

<a name="null"></a>
<h2 class="section"><a href="ffmpeg.html#toc-null">15.6 null</a></h2>

<p>Null muxer.
</p>
<p>This muxer does not generate any output file, it is mainly useful for
testing or benchmarking purposes.
</p>
<p>For example to benchmark decoding with <code>ffmpeg</code> you can use the
command:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -benchmark -i INPUT -f null out.null
</pre></td></tr></table>

<p>Note that the above command does not read or write the &lsquo;<tt>out.null</tt>&rsquo;
file, but specifying the output file is required by the <code>ffmpeg</code>
syntax.
</p>
<p>Alternatively you can write the command as:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -benchmark -i INPUT -f null -
</pre></td></tr></table>

<a name="matroska"></a>
<h2 class="section"><a href="ffmpeg.html#toc-matroska">15.7 matroska</a></h2>

<p>Matroska container muxer.
</p>
<p>This muxer implements the matroska and webm container specs.
</p>
<p>The recognized metadata settings in this muxer are:
</p>
<dl compact="compact">
<dt> &lsquo;<samp>title=<var>title name</var></samp>&rsquo;</dt>
<dd><p>Name provided to a single track
</p></dd>
</dl>

<dl compact="compact">
<dt> &lsquo;<samp>language=<var>language name</var></samp>&rsquo;</dt>
<dd><p>Specifies the language of the track in the Matroska languages form
</p></dd>
</dl>

<dl compact="compact">
<dt> &lsquo;<samp>stereo_mode=<var>mode</var></samp>&rsquo;</dt>
<dd><p>Stereo 3D video layout of two views in a single video track
</p><dl compact="compact">
<dt> &lsquo;<samp>mono</samp>&rsquo;</dt>
<dd><p>video is not stereo
</p></dd>
<dt> &lsquo;<samp>left_right</samp>&rsquo;</dt>
<dd><p>Both views are arranged side by side, Left-eye view is on the left
</p></dd>
<dt> &lsquo;<samp>bottom_top</samp>&rsquo;</dt>
<dd><p>Both views are arranged in top-bottom orientation, Left-eye view is at bottom
</p></dd>
<dt> &lsquo;<samp>top_bottom</samp>&rsquo;</dt>
<dd><p>Both views are arranged in top-bottom orientation, Left-eye view is on top
</p></dd>
<dt> &lsquo;<samp>checkerboard_rl</samp>&rsquo;</dt>
<dd><p>Each view is arranged in a checkerboard interleaved pattern, Left-eye view being first
</p></dd>
<dt> &lsquo;<samp>checkerboard_lr</samp>&rsquo;</dt>
<dd><p>Each view is arranged in a checkerboard interleaved pattern, Right-eye view being first
</p></dd>
<dt> &lsquo;<samp>row_interleaved_rl</samp>&rsquo;</dt>
<dd><p>Each view is constituted by a row based interleaving, Right-eye view is first row
</p></dd>
<dt> &lsquo;<samp>row_interleaved_lr</samp>&rsquo;</dt>
<dd><p>Each view is constituted by a row based interleaving, Left-eye view is first row
</p></dd>
<dt> &lsquo;<samp>col_interleaved_rl</samp>&rsquo;</dt>
<dd><p>Both views are arranged in a column based interleaving manner, Right-eye view is first column
</p></dd>
<dt> &lsquo;<samp>col_interleaved_lr</samp>&rsquo;</dt>
<dd><p>Both views are arranged in a column based interleaving manner, Left-eye view is first column
</p></dd>
<dt> &lsquo;<samp>anaglyph_cyan_red</samp>&rsquo;</dt>
<dd><p>All frames are in anaglyph format viewable through red-cyan filters
</p></dd>
<dt> &lsquo;<samp>right_left</samp>&rsquo;</dt>
<dd><p>Both views are arranged side by side, Right-eye view is on the left
</p></dd>
<dt> &lsquo;<samp>anaglyph_green_magenta</samp>&rsquo;</dt>
<dd><p>All frames are in anaglyph format viewable through green-magenta filters
</p></dd>
<dt> &lsquo;<samp>block_lr</samp>&rsquo;</dt>
<dd><p>Both eyes laced in one Block, Left-eye view is first
</p></dd>
<dt> &lsquo;<samp>block_rl</samp>&rsquo;</dt>
<dd><p>Both eyes laced in one Block, Right-eye view is first
</p></dd>
</dl>
</dd>
</dl>

<p>For example a 3D WebM clip can be created using the following command line:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i sample_left_right_clip.mpg -an -c:v libvpx -metadata stereo_mode=left_right -y stereo_clip.webm
</pre></td></tr></table>

<a name="segment"></a>
<h2 class="section"><a href="ffmpeg.html#toc-segment">15.8 segment</a></h2>

<p>Basic stream segmenter.
</p>
<p>The segmenter muxer outputs streams to a number of separate files of nearly
fixed duration. Output filename pattern can be set in a fashion similar to
<a href="#image2">image2</a>.
</p>
<p>Every segment starts with a video keyframe, if a video stream is present.
The segment muxer works best with a single constant frame rate video.
</p>
<p>Optionally it can generate a flat list of the created segments, one segment
per line.
</p>
<dl compact="compact">
<dt> &lsquo;<samp>segment_format <var>format</var></samp>&rsquo;</dt>
<dd><p>Override the inner container format, by default it is guessed by the filename
extension.
</p></dd>
<dt> &lsquo;<samp>segment_time <var>t</var></samp>&rsquo;</dt>
<dd><p>Set segment duration to <var>t</var> seconds.
</p></dd>
<dt> &lsquo;<samp>segment_list <var>name</var></samp>&rsquo;</dt>
<dd><p>Generate also a listfile named <var>name</var>.
</p></dd>
<dt> &lsquo;<samp>segment_list_size <var>size</var></samp>&rsquo;</dt>
<dd><p>Overwrite the listfile once it reaches <var>size</var> entries.
</p></dd>
</dl>

<table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.mkv -c copy -map 0 -f segment -list out.list out%03d.nut
</pre></td></tr></table>


<a name="Input-Devices"></a>
<h1 class="chapter"><a href="ffmpeg.html#toc-Input-Devices">16. Input Devices</a></h1>

<p>Input devices are configured elements in FFmpeg which allow to access
the data coming from a multimedia device attached to your system.
</p>
<p>When you configure your FFmpeg build, all the supported input devices
are enabled by default. You can list all available ones using the
configure option &quot;&ndash;list-indevs&quot;.
</p>
<p>You can disable all the input devices using the configure option
&quot;&ndash;disable-indevs&quot;, and selectively enable an input device using the
option &quot;&ndash;enable-indev=<var>INDEV</var>&quot;, or you can disable a particular
input device using the option &quot;&ndash;disable-indev=<var>INDEV</var>&quot;.
</p>
<p>The option &quot;-formats&quot; of the ff* tools will display the list of
supported input devices (amongst the demuxers).
</p>
<p>A description of the currently available input devices follows.
</p>
<a name="alsa-1"></a>
<h2 class="section"><a href="ffmpeg.html#toc-alsa-1">16.1 alsa</a></h2>

<p>ALSA (Advanced Linux Sound Architecture) input device.
</p>
<p>To enable this input device during configuration you need libasound
installed on your system.
</p>
<p>This device allows capturing from an ALSA device. The name of the
device to capture has to be an ALSA card identifier.
</p>
<p>An ALSA identifier has the syntax:
</p><table><tr><td>&nbsp;</td><td><pre class="example">hw:<var>CARD</var>[,<var>DEV</var>[,<var>SUBDEV</var>]]
</pre></td></tr></table>

<p>where the <var>DEV</var> and <var>SUBDEV</var> components are optional.
</p>
<p>The three arguments (in order: <var>CARD</var>,<var>DEV</var>,<var>SUBDEV</var>)
specify card number or identifier, device number and subdevice number
(-1 means any).
</p>
<p>To see the list of cards currently recognized by your system check the
files &lsquo;<tt>/proc/asound/cards</tt>&rsquo; and &lsquo;<tt>/proc/asound/devices</tt>&rsquo;.
</p>
<p>For example to capture with <code>ffmpeg</code> from an ALSA device with
card id 0, you may run the command:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f alsa -i hw:0 alsaout.wav
</pre></td></tr></table>

<p>For more information see:
<a href="http://www.alsa-project.org/alsa-doc/alsa-lib/pcm.html">http://www.alsa-project.org/alsa-doc/alsa-lib/pcm.html</a>
</p>
<a name="bktr"></a>
<h2 class="section"><a href="ffmpeg.html#toc-bktr">16.2 bktr</a></h2>

<p>BSD video input device.
</p>
<a name="dshow"></a>
<h2 class="section"><a href="ffmpeg.html#toc-dshow">16.3 dshow</a></h2>

<p>Windows DirectShow input device.
</p>
<p>DirectShow support is enabled when FFmpeg is built with mingw-w64.
Currently only audio and video devices are supported.
</p>
<p>Multiple devices may be opened as separate inputs, but they may also be
opened on the same input, which should improve synchronism between them.
</p>
<p>The input name should be in the format:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example"><var>TYPE</var>=<var>NAME</var>[:<var>TYPE</var>=<var>NAME</var>]
</pre></td></tr></table>

<p>where <var>TYPE</var> can be either <var>audio</var> or <var>video</var>,
and <var>NAME</var> is the device&rsquo;s name.
</p>
<a name="Options-2"></a>
<h3 class="subsection"><a href="ffmpeg.html#toc-Options-2">16.3.1 Options</a></h3>

<p>If no options are specified, the device&rsquo;s defaults are used.
If the device does not support the requested options, it will
fail to open.
</p>
<dl compact="compact">
<dt> &lsquo;<samp>video_size</samp>&rsquo;</dt>
<dd><p>Set the video size in the captured video.
</p>
</dd>
<dt> &lsquo;<samp>framerate</samp>&rsquo;</dt>
<dd><p>Set the framerate in the captured video.
</p>
</dd>
<dt> &lsquo;<samp>sample_rate</samp>&rsquo;</dt>
<dd><p>Set the sample rate (in Hz) of the captured audio.
</p>
</dd>
<dt> &lsquo;<samp>sample_size</samp>&rsquo;</dt>
<dd><p>Set the sample size (in bits) of the captured audio.
</p>
</dd>
<dt> &lsquo;<samp>channels</samp>&rsquo;</dt>
<dd><p>Set the number of channels in the captured audio.
</p>
</dd>
<dt> &lsquo;<samp>list_devices</samp>&rsquo;</dt>
<dd><p>If set to &lsquo;<samp>true</samp>&rsquo;, print a list of devices and exit.
</p>
</dd>
<dt> &lsquo;<samp>list_options</samp>&rsquo;</dt>
<dd><p>If set to &lsquo;<samp>true</samp>&rsquo;, print a list of selected device&rsquo;s options
and exit.
</p>
</dd>
<dt> &lsquo;<samp>video_device_number</samp>&rsquo;</dt>
<dd><p>Set video device number for devices with same name (starts at 0,
defaults to 0).
</p>
</dd>
<dt> &lsquo;<samp>audio_device_number</samp>&rsquo;</dt>
<dd><p>Set audio device number for devices with same name (starts at 0,
defaults to 0).
</p>
</dd>
</dl>

<a name="Examples-8"></a>
<h3 class="subsection"><a href="ffmpeg.html#toc-Examples-8">16.3.2 Examples</a></h3>

<ul>
<li>
Print the list of DirectShow supported devices and exit:
<table><tr><td>&nbsp;</td><td><pre class="example">$ ffmpeg -list_devices true -f dshow -i dummy
</pre></td></tr></table>

</li><li>
Open video device <var>Camera</var>:
<table><tr><td>&nbsp;</td><td><pre class="example">$ ffmpeg -f dshow -i video=&quot;Camera&quot;
</pre></td></tr></table>

</li><li>
Open second video device with name <var>Camera</var>:
<table><tr><td>&nbsp;</td><td><pre class="example">$ ffmpeg -f dshow -video_device_number 1 -i video=&quot;Camera&quot;
</pre></td></tr></table>

</li><li>
Open video device <var>Camera</var> and audio device <var>Microphone</var>:
<table><tr><td>&nbsp;</td><td><pre class="example">$ ffmpeg -f dshow -i video=&quot;Camera&quot;:audio=&quot;Microphone&quot;
</pre></td></tr></table>

</li><li>
Print the list of supported options in selected device and exit:
<table><tr><td>&nbsp;</td><td><pre class="example">$ ffmpeg -list_options true -f dshow -i video=&quot;Camera&quot;
</pre></td></tr></table>

</li></ul>

<a name="dv1394"></a>
<h2 class="section"><a href="ffmpeg.html#toc-dv1394">16.4 dv1394</a></h2>

<p>Linux DV 1394 input device.
</p>
<a name="fbdev"></a>
<h2 class="section"><a href="ffmpeg.html#toc-fbdev">16.5 fbdev</a></h2>

<p>Linux framebuffer input device.
</p>
<p>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
&lsquo;<tt>/dev/fb0</tt>&rsquo;.
</p>
<p>For more detailed information read the file
Documentation/fb/framebuffer.txt included in the Linux source tree.
</p>
<p>To record from the framebuffer device &lsquo;<tt>/dev/fb0</tt>&rsquo; with
<code>ffmpeg</code>:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f fbdev -r 10 -i /dev/fb0 out.avi
</pre></td></tr></table>

<p>You can take a single screenshot image with the command:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f fbdev -frames:v 1 -r 1 -i /dev/fb0 screenshot.jpeg
</pre></td></tr></table>

<p>See also <a href="http://linux-fbdev.sourceforge.net/">http://linux-fbdev.sourceforge.net/</a>, and fbset(1).
</p>
<a name="jack"></a>
<h2 class="section"><a href="ffmpeg.html#toc-jack">16.6 jack</a></h2>

<p>JACK input device.
</p>
<p>To enable this input device during configuration you need libjack
installed on your system.
</p>
<p>A JACK input device creates one or more JACK writable clients, one for
each audio channel, with name <var>client_name</var>:input_<var>N</var>, where
<var>client_name</var> is the name provided by the application, and <var>N</var>
is a number which identifies the channel.
Each writable client will send the acquired data to the FFmpeg input
device.
</p>
<p>Once you have created one or more JACK readable clients, you need to
connect them to one or more JACK writable clients.
</p>
<p>To connect or disconnect JACK clients you can use the <code>jack_connect</code>
and <code>jack_disconnect</code> programs, or do it through a graphical interface,
for example with <code>qjackctl</code>.
</p>
<p>To list the JACK clients and their properties you can invoke the command
<code>jack_lsp</code>.
</p>
<p>Follows an example which shows how to capture a JACK readable client
with <code>ffmpeg</code>.
</p><table><tr><td>&nbsp;</td><td><pre class="example"># Create a JACK writable client with name &quot;ffmpeg&quot;.
$ ffmpeg -f jack -i ffmpeg -y out.wav

# Start the sample jack_metro readable client.
$ jack_metro -b 120 -d 0.2 -f 4000

# List the current JACK clients.
$ jack_lsp -c
system:capture_1
system:capture_2
system:playback_1
system:playback_2
ffmpeg:input_1
metro:120_bpm

# Connect metro to the ffmpeg writable client.
$ jack_connect metro:120_bpm ffmpeg:input_1
</pre></td></tr></table>

<p>For more information read:
<a href="http://jackaudio.org/">http://jackaudio.org/</a>
</p>
<a name="lavfi"></a>
<h2 class="section"><a href="ffmpeg.html#toc-lavfi">16.7 lavfi</a></h2>

<p>Libavfilter input virtual device.
</p>
<p>This input device reads data from the open output pads of a libavfilter
filtergraph.
</p>
<p>For each filtergraph open output, the input device will create a
corresponding stream which is mapped to the generated output. Currently
only video data is supported. The filtergraph is specified through the
option &lsquo;<samp>graph</samp>&rsquo;.
</p>
<a name="Options"></a>
<h3 class="subsection"><a href="ffmpeg.html#toc-Options">16.7.1 Options</a></h3>

<dl compact="compact">
<dt> &lsquo;<samp>graph</samp>&rsquo;</dt>
<dd><p>Specify the filtergraph to use as input. Each video open output must be
labelled by a unique string of the form &quot;out<var>N</var>&quot;, where <var>N</var> is a
number starting from 0 corresponding to the mapped input stream
generated by the device.
The first unlabelled output is automatically assigned to the &quot;out0&quot;
label, but all the others need to be specified explicitly.
</p>
<p>If not specified defaults to the filename specified for the input
device.
</p></dd>
</dl>

<a name="Examples-4"></a>
<h3 class="subsection"><a href="ffmpeg.html#toc-Examples-4">16.7.2 Examples</a></h3>

<ul>
<li>
Create a color video stream and play it back with <code>ffplay</code>:
<table><tr><td>&nbsp;</td><td><pre class="example">ffplay -f lavfi -graph &quot;color=pink [out0]&quot; dummy
</pre></td></tr></table>

</li><li>
As the previous example, but use filename for specifying the graph
description, and omit the &quot;out0&quot; label:
<table><tr><td>&nbsp;</td><td><pre class="example">ffplay -f lavfi color=pink
</pre></td></tr></table>

</li><li>
Create three different video test filtered sources and play them:
<table><tr><td>&nbsp;</td><td><pre class="example">ffplay -f lavfi -graph &quot;testsrc [out0]; testsrc,hflip [out1]; testsrc,negate [out2]&quot; test3
</pre></td></tr></table>

</li><li>
Read an audio stream from a file using the amovie source and play it
back with <code>ffplay</code>:
<table><tr><td>&nbsp;</td><td><pre class="example">ffplay -f lavfi &quot;amovie=test.wav&quot;
</pre></td></tr></table>

</li><li>
Read an audio stream and a video stream and play it back with
<code>ffplay</code>:
<table><tr><td>&nbsp;</td><td><pre class="example">ffplay -f lavfi &quot;movie=test.avi[out0];amovie=test.wav[out1]&quot;
</pre></td></tr></table>

</li></ul>

<a name="libdc1394"></a>
<h2 class="section"><a href="ffmpeg.html#toc-libdc1394">16.8 libdc1394</a></h2>

<p>IIDC1394 input device, based on libdc1394 and libraw1394.
</p>
<a name="openal"></a>
<h2 class="section"><a href="ffmpeg.html#toc-openal">16.9 openal</a></h2>

<p>The OpenAL input device provides audio capture on all systems with a
working OpenAL 1.1 implementation.
</p>
<p>To enable this input device during configuration, you need OpenAL
headers and libraries installed on your system, and need to configure
FFmpeg with <code>--enable-openal</code>.
</p>
<p>OpenAL headers and libraries should be provided as part of your OpenAL
implementation, or as an additional download (an SDK). Depending on your
installation you may need to specify additional flags via the
<code>--extra-cflags</code> and <code>--extra-ldflags</code> for allowing the build
system to locate the OpenAL headers and libraries.
</p>
<p>An incomplete list of OpenAL implementations follows:
</p>
<dl compact="compact">
<dt> <strong>Creative</strong></dt>
<dd><p>The official Windows implementation, providing hardware acceleration
with supported devices and software fallback.
See <a href="http://openal.org/">http://openal.org/</a>.
</p></dd>
<dt> <strong>OpenAL Soft</strong></dt>
<dd><p>Portable, open source (LGPL) software implementation. Includes
backends for the most common sound APIs on the Windows, Linux,
Solaris, and BSD operating systems.
See <a href="http://kcat.strangesoft.net/openal.html">http://kcat.strangesoft.net/openal.html</a>.
</p></dd>
<dt> <strong>Apple</strong></dt>
<dd><p>OpenAL is part of Core Audio, the official Mac OS X Audio interface.
See <a href="http://developer.apple.com/technologies/mac/audio-and-video.html">http://developer.apple.com/technologies/mac/audio-and-video.html</a>
</p></dd>
</dl>

<p>This device allows to capture from an audio input device handled
through OpenAL.
</p>
<p>You need to specify the name of the device to capture in the provided
filename. If the empty string is provided, the device will
automatically select the default device. You can get the list of the
supported devices by using the option <var>list_devices</var>.
</p>
<a name="Options-6"></a>
<h3 class="subsection"><a href="ffmpeg.html#toc-Options-6">16.9.1 Options</a></h3>

<dl compact="compact">
<dt> &lsquo;<samp>channels</samp>&rsquo;</dt>
<dd><p>Set the number of channels in the captured audio. Only the values
&lsquo;<samp>1</samp>&rsquo; (monaural) and &lsquo;<samp>2</samp>&rsquo; (stereo) are currently supported.
Defaults to &lsquo;<samp>2</samp>&rsquo;.
</p>
</dd>
<dt> &lsquo;<samp>sample_size</samp>&rsquo;</dt>
<dd><p>Set the sample size (in bits) of the captured audio. Only the values
&lsquo;<samp>8</samp>&rsquo; and &lsquo;<samp>16</samp>&rsquo; are currently supported. Defaults to
&lsquo;<samp>16</samp>&rsquo;.
</p>
</dd>
<dt> &lsquo;<samp>sample_rate</samp>&rsquo;</dt>
<dd><p>Set the sample rate (in Hz) of the captured audio.
Defaults to &lsquo;<samp>44.1k</samp>&rsquo;.
</p>
</dd>
<dt> &lsquo;<samp>list_devices</samp>&rsquo;</dt>
<dd><p>If set to &lsquo;<samp>true</samp>&rsquo;, print a list of devices and exit.
Defaults to &lsquo;<samp>false</samp>&rsquo;.
</p>
</dd>
</dl>

<a name="Examples-3"></a>
<h3 class="subsection"><a href="ffmpeg.html#toc-Examples-3">16.9.2 Examples</a></h3>

<p>Print the list of OpenAL supported devices and exit:
</p><table><tr><td>&nbsp;</td><td><pre class="example">$ ffmpeg -list_devices true -f openal -i dummy out.ogg
</pre></td></tr></table>

<p>Capture from the OpenAL device &lsquo;<tt>DR-BT101 via PulseAudio</tt>&rsquo;:
</p><table><tr><td>&nbsp;</td><td><pre class="example">$ ffmpeg -f openal -i 'DR-BT101 via PulseAudio' out.ogg
</pre></td></tr></table>

<p>Capture from the default device (note the empty string &rdquo; as filename):
</p><table><tr><td>&nbsp;</td><td><pre class="example">$ ffmpeg -f openal -i '' out.ogg
</pre></td></tr></table>

<p>Capture from two devices simultaneously, writing to two different files,
within the same <code>ffmpeg</code> command:
</p><table><tr><td>&nbsp;</td><td><pre class="example">$ ffmpeg -f openal -i 'DR-BT101 via PulseAudio' out1.ogg -f openal -i 'ALSA Default' out2.ogg
</pre></td></tr></table>
<p>Note: not all OpenAL implementations support multiple simultaneous capture -
try the latest OpenAL Soft if the above does not work.
</p>
<a name="oss"></a>
<h2 class="section"><a href="ffmpeg.html#toc-oss">16.10 oss</a></h2>

<p>Open Sound System input device.
</p>
<p>The filename to provide to the input device is the device node
representing the OSS input device, and is usually set to
&lsquo;<tt>/dev/dsp</tt>&rsquo;.
</p>
<p>For example to grab from &lsquo;<tt>/dev/dsp</tt>&rsquo; using <code>ffmpeg</code> use the
command:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f oss -i /dev/dsp /tmp/oss.wav
</pre></td></tr></table>

<p>For more information about OSS see:
<a href="http://manuals.opensound.com/usersguide/dsp.html">http://manuals.opensound.com/usersguide/dsp.html</a>
</p>
<a name="pulse"></a>
<h2 class="section"><a href="ffmpeg.html#toc-pulse">16.11 pulse</a></h2>

<p>pulseaudio input device.
</p>
<p>To enable this input device during configuration you need libpulse-simple
installed in your system.
</p>
<p>The filename to provide to the input device is a source device or the
string &quot;default&quot;
</p>
<p>To list the pulse source devices and their properties you can invoke
the command <code>pactl list sources</code>.
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f pulse -i default /tmp/pulse.wav
</pre></td></tr></table>

<a name="server-AVOption"></a>
<h3 class="subsection"><a href="ffmpeg.html#toc-server-AVOption">16.11.1 <var>server</var> AVOption</a></h3>

<p>The syntax is:
</p><table><tr><td>&nbsp;</td><td><pre class="example">-server <var>server name</var>
</pre></td></tr></table>

<p>Connects to a specific server.
</p>
<a name="name-AVOption"></a>
<h3 class="subsection"><a href="ffmpeg.html#toc-name-AVOption">16.11.2 <var>name</var> AVOption</a></h3>

<p>The syntax is:
</p><table><tr><td>&nbsp;</td><td><pre class="example">-name <var>application name</var>
</pre></td></tr></table>

<p>Specify the application name pulse will use when showing active clients,
by default it is the LIBAVFORMAT_IDENT string
</p>
<a name="stream_005fname-AVOption"></a>
<h3 class="subsection"><a href="ffmpeg.html#toc-stream_005fname-AVOption">16.11.3 <var>stream_name</var> AVOption</a></h3>

<p>The syntax is:
</p><table><tr><td>&nbsp;</td><td><pre class="example">-stream_name <var>stream name</var>
</pre></td></tr></table>

<p>Specify the stream name pulse will use when showing active streams,
by default it is &quot;record&quot;
</p>
<a name="sample_005frate-AVOption"></a>
<h3 class="subsection"><a href="ffmpeg.html#toc-sample_005frate-AVOption">16.11.4 <var>sample_rate</var> AVOption</a></h3>

<p>The syntax is:
</p><table><tr><td>&nbsp;</td><td><pre class="example">-sample_rate <var>samplerate</var>
</pre></td></tr></table>

<p>Specify the samplerate in Hz, by default 48kHz is used.
</p>
<a name="channels-AVOption"></a>
<h3 class="subsection"><a href="ffmpeg.html#toc-channels-AVOption">16.11.5 <var>channels</var> AVOption</a></h3>

<p>The syntax is:
</p><table><tr><td>&nbsp;</td><td><pre class="example">-channels <var>N</var>
</pre></td></tr></table>

<p>Specify the channels in use, by default 2 (stereo) is set.
</p>
<a name="frame_005fsize-AVOption"></a>
<h3 class="subsection"><a href="ffmpeg.html#toc-frame_005fsize-AVOption">16.11.6 <var>frame_size</var> AVOption</a></h3>

<p>The syntax is:
</p><table><tr><td>&nbsp;</td><td><pre class="example">-frame_size <var>bytes</var>
</pre></td></tr></table>

<p>Specify the number of byte per frame, by default it is set to 1024.
</p>
<a name="fragment_005fsize-AVOption"></a>
<h3 class="subsection"><a href="ffmpeg.html#toc-fragment_005fsize-AVOption">16.11.7 <var>fragment_size</var> AVOption</a></h3>

<p>The syntax is:
</p><table><tr><td>&nbsp;</td><td><pre class="example">-fragment_size <var>bytes</var>
</pre></td></tr></table>

<p>Specify the minimal buffering fragment in pulseaudio, it will affect the
audio latency. By default it is unset.
</p>
<a name="sndio"></a>
<h2 class="section"><a href="ffmpeg.html#toc-sndio">16.12 sndio</a></h2>

<p>sndio input device.
</p>
<p>To enable this input device during configuration you need libsndio
installed on your system.
</p>
<p>The filename to provide to the input device is the device node
representing the sndio input device, and is usually set to
&lsquo;<tt>/dev/audio0</tt>&rsquo;.
</p>
<p>For example to grab from &lsquo;<tt>/dev/audio0</tt>&rsquo; using <code>ffmpeg</code> use the
command:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f sndio -i /dev/audio0 /tmp/oss.wav
</pre></td></tr></table>

<a name="video4linux-and-video4linux2"></a>
<h2 class="section"><a href="ffmpeg.html#toc-video4linux-and-video4linux2">16.13 video4linux and video4linux2</a></h2>

<p>Video4Linux and Video4Linux2 input video devices.
</p>
<p>The name of the device to grab is a file device node, usually Linux
systems tend to automatically create such nodes when the device
(e.g. an USB webcam) is plugged into the system, and has a name of the
kind &lsquo;<tt>/dev/video<var>N</var></tt>&rsquo;, where <var>N</var> is a number associated to
the device.
</p>
<p>Video4Linux and Video4Linux2 devices only support a limited set of
<var>width</var>x<var>height</var> sizes and framerates. You can check which are
supported for example with the command <code>dov4l</code> for Video4Linux
devices and using <code>-list_formats all</code> for Video4Linux2 devices.
</p>
<p>If the size for the device is set to 0x0, the input device will
try to auto-detect the size to use.
Only for the video4linux2 device, if the frame rate is set to 0/0 the
input device will use the frame rate value already set in the driver.
</p>
<p>Video4Linux support is deprecated since Linux 2.6.30, and will be
dropped in later versions.
</p>
<p>Note that if FFmpeg is build with v4l-utils support (&quot;&ndash;enable-libv4l2&quot;
option), it will always be used.
</p>
<p>Follow some usage examples of the video4linux devices with the ff*
tools.
</p><table><tr><td>&nbsp;</td><td><pre class="example"># Grab and show the input of a video4linux device, frame rate is set
# to the default of 25/1.
ffplay -s 320x240 -f video4linux /dev/video0

# Grab and show the input of a video4linux2 device, auto-adjust size.
ffplay -f video4linux2 /dev/video0

# Grab and record the input of a video4linux2 device, auto-adjust size,
# frame rate value defaults to 0/0 so it is read from the video4linux2
# driver.
ffmpeg -f video4linux2 -i /dev/video0 out.mpeg
</pre></td></tr></table>

<p>&quot;v4l&quot; and &quot;v4l2&quot; can be used as aliases for the respective &quot;video4linux&quot; and
&quot;video4linux2&quot;.
</p>
<a name="vfwcap"></a>
<h2 class="section"><a href="ffmpeg.html#toc-vfwcap">16.14 vfwcap</a></h2>

<p>VfW (Video for Windows) capture input device.
</p>
<p>The filename passed as input is the capture driver number, ranging from
0 to 9. You may use &quot;list&quot; as filename to print a list of drivers. Any
other filename will be interpreted as device number 0.
</p>
<a name="x11grab"></a>
<h2 class="section"><a href="ffmpeg.html#toc-x11grab">16.15 x11grab</a></h2>

<p>X11 video input device.
</p>
<p>This device allows to capture a region of an X11 display.
</p>
<p>The filename passed as input has the syntax:
</p><table><tr><td>&nbsp;</td><td><pre class="example">[<var>hostname</var>]:<var>display_number</var>.<var>screen_number</var>[+<var>x_offset</var>,<var>y_offset</var>]
</pre></td></tr></table>

<p><var>hostname</var>:<var>display_number</var>.<var>screen_number</var> specifies the
X11 display name of the screen to grab from. <var>hostname</var> can be
omitted, and defaults to &quot;localhost&quot;. The environment variable
<code>DISPLAY</code> contains the default display name.
</p>
<p><var>x_offset</var> and <var>y_offset</var> specify the offsets of the grabbed
area with respect to the top-left border of the X11 screen. They
default to 0.
</p>
<p>Check the X11 documentation (e.g. man X) for more detailed information.
</p>
<p>Use the <code>dpyinfo</code> program for getting basic information about the
properties of your X11 display (e.g. grep for &quot;name&quot; or &quot;dimensions&quot;).
</p>
<p>For example to grab from &lsquo;<tt>:0.0</tt>&rsquo; using <code>ffmpeg</code>:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f x11grab -r 25 -s cif -i :0.0 out.mpg

# Grab at position 10,20.
ffmpeg -f x11grab -r 25 -s cif -i :0.0+10,20 out.mpg
</pre></td></tr></table>

<a name="follow_005fmouse-AVOption"></a>
<h3 class="subsection"><a href="ffmpeg.html#toc-follow_005fmouse-AVOption">16.15.1 <var>follow_mouse</var> AVOption</a></h3>

<p>The syntax is:
</p><table><tr><td>&nbsp;</td><td><pre class="example">-follow_mouse centered|<var>PIXELS</var>
</pre></td></tr></table>

<p>When it is specified with &quot;centered&quot;, the grabbing region follows the mouse
pointer and keeps the pointer at the center of region; otherwise, the region
follows only when the mouse pointer reaches within <var>PIXELS</var> (greater than
zero) to the edge of region.
</p>
<p>For example:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f x11grab -follow_mouse centered -r 25 -s cif -i :0.0 out.mpg

# Follows only when the mouse pointer reaches within 100 pixels to edge
ffmpeg -f x11grab -follow_mouse 100 -r 25 -s cif -i :0.0 out.mpg
</pre></td></tr></table>

<a name="show_005fregion-AVOption"></a>
<h3 class="subsection"><a href="ffmpeg.html#toc-show_005fregion-AVOption">16.15.2 <var>show_region</var> AVOption</a></h3>

<p>The syntax is:
</p><table><tr><td>&nbsp;</td><td><pre class="example">-show_region 1
</pre></td></tr></table>

<p>If <var>show_region</var> AVOption is specified with <var>1</var>, then the grabbing
region will be indicated on screen. With this option, it&rsquo;s easy to know what is
being grabbed if only a portion of the screen is grabbed.
</p>
<p>For example:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f x11grab -show_region 1 -r 25 -s cif -i :0.0+10,20 out.mpg

# With follow_mouse
ffmpeg -f x11grab -follow_mouse centered -show_region 1  -r 25 -s cif -i :0.0 out.mpg
</pre></td></tr></table>

<a name="Output-Devices"></a>
<h1 class="chapter"><a href="ffmpeg.html#toc-Output-Devices">17. Output Devices</a></h1>

<p>Output devices are configured elements in FFmpeg which allow to write
multimedia data to an output device attached to your system.
</p>
<p>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 &quot;&ndash;list-outdevs&quot;.
</p>
<p>You can disable all the output devices using the configure option
&quot;&ndash;disable-outdevs&quot;, and selectively enable an output device using the
option &quot;&ndash;enable-outdev=<var>OUTDEV</var>&quot;, or you can disable a particular
input device using the option &quot;&ndash;disable-outdev=<var>OUTDEV</var>&quot;.
</p>
<p>The option &quot;-formats&quot; of the ff* tools will display the list of
enabled output devices (amongst the muxers).
</p>
<p>A description of the currently available output devices follows.
</p>
<a name="alsa"></a>
<h2 class="section"><a href="ffmpeg.html#toc-alsa">17.1 alsa</a></h2>

<p>ALSA (Advanced Linux Sound Architecture) output device.
</p>
<a name="oss-1"></a>
<h2 class="section"><a href="ffmpeg.html#toc-oss-1">17.2 oss</a></h2>

<p>OSS (Open Sound System) output device.
</p>
<a name="sdl"></a>
<h2 class="section"><a href="ffmpeg.html#toc-sdl">17.3 sdl</a></h2>

<p>SDL (Simple DirectMedia Layer) output device.
</p>
<p>This output devices 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.
</p>
<p>To enable this output device you need libsdl installed on your system
when configuring your build.
</p>
<p>For more information about SDL, check:
<a href="http://www.libsdl.org/">http://www.libsdl.org/</a>
</p>
<a name="Options-3"></a>
<h3 class="subsection"><a href="ffmpeg.html#toc-Options-3">17.3.1 Options</a></h3>

<dl compact="compact">
<dt> &lsquo;<samp>window_title</samp>&rsquo;</dt>
<dd><p>Set the SDL window title, if not specified default to the filename
specified for the output device.
</p>
</dd>
<dt> &lsquo;<samp>icon_title</samp>&rsquo;</dt>
<dd><p>Set the name of the iconified SDL window, if not specified it is set
to the same value of <var>window_title</var>.
</p>
</dd>
<dt> &lsquo;<samp>window_size</samp>&rsquo;</dt>
<dd><p>Set the SDL window size, can be a string of the form
<var>width</var>x<var>height</var> or a video size abbreviation.
If not specified it defaults to the size of the input video.
</p></dd>
</dl>

<a name="Examples-7"></a>
<h3 class="subsection"><a href="ffmpeg.html#toc-Examples-7">17.3.2 Examples</a></h3>

<p>The following command shows the <code>ffmpeg</code> output is an
SDL window, forcing its size to the qcif format:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -vcodec rawvideo -pix_fmt yuv420p -window_size qcif -f sdl &quot;SDL output&quot;
</pre></td></tr></table>

<a name="sndio-1"></a>
<h2 class="section"><a href="ffmpeg.html#toc-sndio-1">17.4 sndio</a></h2>

<p>sndio audio output device.
</p>
<a name="Protocols"></a>
<h1 class="chapter"><a href="ffmpeg.html#toc-Protocols">18. Protocols</a></h1>

<p>Protocols are configured elements in FFmpeg which allow to access
resources which require the use of a particular protocol.
</p>
<p>When you configure your FFmpeg build, all the supported protocols are
enabled by default. You can list all available ones using the
configure option &quot;&ndash;list-protocols&quot;.
</p>
<p>You can disable all the protocols using the configure option
&quot;&ndash;disable-protocols&quot;, and selectively enable a protocol using the
option &quot;&ndash;enable-protocol=<var>PROTOCOL</var>&quot;, or you can disable a
particular protocol using the option
&quot;&ndash;disable-protocol=<var>PROTOCOL</var>&quot;.
</p>
<p>The option &quot;-protocols&quot; of the ff* tools will display the list of
supported protocols.
</p>
<p>A description of the currently available protocols follows.
</p>
<a name="applehttp-1"></a>
<h2 class="section"><a href="ffmpeg.html#toc-applehttp-1">18.1 applehttp</a></h2>

<p>Read Apple HTTP Live Streaming compliant segmented stream as
a uniform one. The M3U8 playlists describing the segments can be
remote HTTP resources or local files, accessed using the standard
file protocol.
HTTP is default, specific protocol can be declared by specifying
&quot;+<var>proto</var>&quot; after the applehttp URI scheme name, where <var>proto</var>
is either &quot;file&quot; or &quot;http&quot;.
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">applehttp://host/path/to/remote/resource.m3u8
applehttp+http://host/path/to/remote/resource.m3u8
applehttp+file://path/to/local/resource.m3u8
</pre></td></tr></table>

<a name="concat"></a>
<h2 class="section"><a href="ffmpeg.html#toc-concat">18.2 concat</a></h2>

<p>Physical concatenation protocol.
</p>
<p>Allow to read and seek from many resource in sequence as if they were
a unique resource.
</p>
<p>A URL accepted by this protocol has the syntax:
</p><table><tr><td>&nbsp;</td><td><pre class="example">concat:<var>URL1</var>|<var>URL2</var>|...|<var>URLN</var>
</pre></td></tr></table>

<p>where <var>URL1</var>, <var>URL2</var>, ..., <var>URLN</var> are the urls of the
resource to be concatenated, each one possibly specifying a distinct
protocol.
</p>
<p>For example to read a sequence of files &lsquo;<tt>split1.mpeg</tt>&rsquo;,
&lsquo;<tt>split2.mpeg</tt>&rsquo;, &lsquo;<tt>split3.mpeg</tt>&rsquo; with <code>ffplay</code> use the
command:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffplay concat:split1.mpeg\|split2.mpeg\|split3.mpeg
</pre></td></tr></table>

<p>Note that you may need to escape the character &quot;|&quot; which is special for
many shells.
</p>
<a name="file"></a>
<h2 class="section"><a href="ffmpeg.html#toc-file">18.3 file</a></h2>

<p>File access protocol.
</p>
<p>Allow to read from or read to a file.
</p>
<p>For example to read from a file &lsquo;<tt>input.mpeg</tt>&rsquo; with <code>ffmpeg</code>
use the command:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i file:input.mpeg output.mpeg
</pre></td></tr></table>

<p>The ff* tools default to the file protocol, that is a resource
specified with the name &quot;FILE.mpeg&quot; is interpreted as the URL
&quot;file:FILE.mpeg&quot;.
</p>
<a name="gopher"></a>
<h2 class="section"><a href="ffmpeg.html#toc-gopher">18.4 gopher</a></h2>

<p>Gopher protocol.
</p>
<a name="http"></a>
<h2 class="section"><a href="ffmpeg.html#toc-http">18.5 http</a></h2>

<p>HTTP (Hyper Text Transfer Protocol).
</p>
<a name="mmst"></a>
<h2 class="section"><a href="ffmpeg.html#toc-mmst">18.6 mmst</a></h2>

<p>MMS (Microsoft Media Server) protocol over TCP.
</p>
<a name="mmsh"></a>
<h2 class="section"><a href="ffmpeg.html#toc-mmsh">18.7 mmsh</a></h2>

<p>MMS (Microsoft Media Server) protocol over HTTP.
</p>
<p>The required syntax is:
</p><table><tr><td>&nbsp;</td><td><pre class="example">mmsh://<var>server</var>[:<var>port</var>][/<var>app</var>][/<var>playpath</var>]
</pre></td></tr></table>

<a name="md5"></a>
<h2 class="section"><a href="ffmpeg.html#toc-md5">18.8 md5</a></h2>

<p>MD5 output protocol.
</p>
<p>Computes the MD5 hash of the data to be written, and on close writes
this to the designated output or stdout if none is specified. It can
be used to test muxers without writing an actual file.
</p>
<p>Some examples follow.
</p><table><tr><td>&nbsp;</td><td><pre class="example"># Write the MD5 hash of the encoded AVI file to the file output.avi.md5.
ffmpeg -i input.flv -f avi -y md5:output.avi.md5

# Write the MD5 hash of the encoded AVI file to stdout.
ffmpeg -i input.flv -f avi -y md5:
</pre></td></tr></table>

<p>Note that some formats (typically MOV) require the output protocol to
be seekable, so they will fail with the MD5 output protocol.
</p>
<a name="pipe"></a>
<h2 class="section"><a href="ffmpeg.html#toc-pipe">18.9 pipe</a></h2>

<p>UNIX pipe access protocol.
</p>
<p>Allow to read and write from UNIX pipes.
</p>
<p>The accepted syntax is:
</p><table><tr><td>&nbsp;</td><td><pre class="example">pipe:[<var>number</var>]
</pre></td></tr></table>

<p><var>number</var> is the number corresponding to the file descriptor of the
pipe (e.g. 0 for stdin, 1 for stdout, 2 for stderr).  If <var>number</var>
is not specified, by default the stdout file descriptor will be used
for writing, stdin for reading.
</p>
<p>For example to read from stdin with <code>ffmpeg</code>:
</p><table><tr><td>&nbsp;</td><td><pre class="example">cat test.wav | ffmpeg -i pipe:0
# ...this is the same as...
cat test.wav | ffmpeg -i pipe:
</pre></td></tr></table>

<p>For writing to stdout with <code>ffmpeg</code>:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i test.wav -f avi pipe:1 | cat &gt; test.avi
# ...this is the same as...
ffmpeg -i test.wav -f avi pipe: | cat &gt; test.avi
</pre></td></tr></table>

<p>Note that some formats (typically MOV), require the output protocol to
be seekable, so they will fail with the pipe output protocol.
</p>
<a name="rtmp"></a>
<h2 class="section"><a href="ffmpeg.html#toc-rtmp">18.10 rtmp</a></h2>

<p>Real-Time Messaging Protocol.
</p>
<p>The Real-Time Messaging Protocol (RTMP) is used for streaming multimedia
content across a TCP/IP network.
</p>
<p>The required syntax is:
</p><table><tr><td>&nbsp;</td><td><pre class="example">rtmp://<var>server</var>[:<var>port</var>][/<var>app</var>][/<var>playpath</var>]
</pre></td></tr></table>

<p>The accepted parameters are:
</p><dl compact="compact">
<dt> &lsquo;<samp>server</samp>&rsquo;</dt>
<dd><p>The address of the RTMP server.
</p>
</dd>
<dt> &lsquo;<samp>port</samp>&rsquo;</dt>
<dd><p>The number of the TCP port to use (by default is 1935).
</p>
</dd>
<dt> &lsquo;<samp>app</samp>&rsquo;</dt>
<dd><p>It is the name of the application to access. It usually corresponds to
the path where the application is installed on the RTMP server
(e.g. &lsquo;<tt>/ondemand/</tt>&rsquo;, &lsquo;<tt>/flash/live/</tt>&rsquo;, etc.).
</p>
</dd>
<dt> &lsquo;<samp>playpath</samp>&rsquo;</dt>
<dd><p>It is the path or name of the resource to play with reference to the
application specified in <var>app</var>, may be prefixed by &quot;mp4:&quot;.
</p>
</dd>
</dl>

<p>For example to read with <code>ffplay</code> a multimedia resource named
&quot;sample&quot; from the application &quot;vod&quot; from an RTMP server &quot;myserver&quot;:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffplay rtmp://myserver/vod/sample
</pre></td></tr></table>

<a name="rtmp_002c-rtmpe_002c-rtmps_002c-rtmpt_002c-rtmpte"></a>
<h2 class="section"><a href="ffmpeg.html#toc-rtmp_002c-rtmpe_002c-rtmps_002c-rtmpt_002c-rtmpte">18.11 rtmp, rtmpe, rtmps, rtmpt, rtmpte</a></h2>

<p>Real-Time Messaging Protocol and its variants supported through
librtmp.
</p>
<p>Requires the presence of the librtmp headers and library during
configuration. You need to explicitly configure the build with
&quot;&ndash;enable-librtmp&quot;. If enabled this will replace the native RTMP
protocol.
</p>
<p>This protocol provides most client functions and a few server
functions needed to support RTMP, RTMP tunneled in HTTP (RTMPT),
encrypted RTMP (RTMPE), RTMP over SSL/TLS (RTMPS) and tunneled
variants of these encrypted types (RTMPTE, RTMPTS).
</p>
<p>The required syntax is:
</p><table><tr><td>&nbsp;</td><td><pre class="example"><var>rtmp_proto</var>://<var>server</var>[:<var>port</var>][/<var>app</var>][/<var>playpath</var>] <var>options</var>
</pre></td></tr></table>

<p>where <var>rtmp_proto</var> is one of the strings &quot;rtmp&quot;, &quot;rtmpt&quot;, &quot;rtmpe&quot;,
&quot;rtmps&quot;, &quot;rtmpte&quot;, &quot;rtmpts&quot; corresponding to each RTMP variant, and
<var>server</var>, <var>port</var>, <var>app</var> and <var>playpath</var> have the same
meaning as specified for the RTMP native protocol.
<var>options</var> contains a list of space-separated options of the form
<var>key</var>=<var>val</var>.
</p>
<p>See the librtmp manual page (man 3 librtmp) for more information.
</p>
<p>For example, to stream a file in real-time to an RTMP server using
<code>ffmpeg</code>:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -re -i myfile -f flv rtmp://myserver/live/mystream
</pre></td></tr></table>

<p>To play the same stream using <code>ffplay</code>:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffplay &quot;rtmp://myserver/live/mystream live=1&quot;
</pre></td></tr></table>

<a name="rtp"></a>
<h2 class="section"><a href="ffmpeg.html#toc-rtp">18.12 rtp</a></h2>

<p>Real-Time Protocol.
</p>
<a name="rtsp"></a>
<h2 class="section"><a href="ffmpeg.html#toc-rtsp">18.13 rtsp</a></h2>

<p>RTSP is not technically a protocol handler in libavformat, it is a demuxer
and muxer. The demuxer supports both normal RTSP (with data transferred
over RTP; this is used by e.g. Apple and Microsoft) and Real-RTSP (with
data transferred over RDT).
</p>
<p>The muxer can be used to send a stream using RTSP ANNOUNCE to a server
supporting it (currently Darwin Streaming Server and Mischa Spiegelmock&rsquo;s
<a href="http://github.com/revmischa/rtsp-server">RTSP server</a>).
</p>
<p>The required syntax for a RTSP url is:
</p><table><tr><td>&nbsp;</td><td><pre class="example">rtsp://<var>hostname</var>[:<var>port</var>]/<var>path</var>
</pre></td></tr></table>

<p>The following options (set on the <code>ffmpeg</code>/<code>ffplay</code> command
line, or set in code via <code>AVOption</code>s or in <code>avformat_open_input</code>),
are supported:
</p>
<p>Flags for <code>rtsp_transport</code>:
</p>
<dl compact="compact">
<dt> &lsquo;<samp>udp</samp>&rsquo;</dt>
<dd><p>Use UDP as lower transport protocol.
</p>
</dd>
<dt> &lsquo;<samp>tcp</samp>&rsquo;</dt>
<dd><p>Use TCP (interleaving within the RTSP control channel) as lower
transport protocol.
</p>
</dd>
<dt> &lsquo;<samp>udp_multicast</samp>&rsquo;</dt>
<dd><p>Use UDP multicast as lower transport protocol.
</p>
</dd>
<dt> &lsquo;<samp>http</samp>&rsquo;</dt>
<dd><p>Use HTTP tunneling as lower transport protocol, which is useful for
passing proxies.
</p></dd>
</dl>

<p>Multiple lower transport protocols may be specified, in that case they are
tried one at a time (if the setup of one fails, the next one is tried).
For the muxer, only the <code>tcp</code> and <code>udp</code> options are supported.
</p>
<p>Flags for <code>rtsp_flags</code>:
</p>
<dl compact="compact">
<dt> &lsquo;<samp>filter_src</samp>&rsquo;</dt>
<dd><p>Accept packets only from negotiated peer address and port.
</p></dd>
</dl>

<p>When receiving data over UDP, the demuxer tries to reorder received packets
(since they may arrive out of order, or packets may get lost totally). In
order for this to be enabled, a maximum delay must be specified in the
<code>max_delay</code> field of AVFormatContext.
</p>
<p>When watching multi-bitrate Real-RTSP streams with <code>ffplay</code>, the
streams to display can be chosen with <code>-vst</code> <var>n</var> and
<code>-ast</code> <var>n</var> for video and audio respectively, and can be switched
on the fly by pressing <code>v</code> and <code>a</code>.
</p>
<p>Example command lines:
</p>
<p>To watch a stream over UDP, with a max reordering delay of 0.5 seconds:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">ffplay -max_delay 500000 -rtsp_transport udp rtsp://server/video.mp4
</pre></td></tr></table>

<p>To watch a stream tunneled over HTTP:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">ffplay -rtsp_transport http rtsp://server/video.mp4
</pre></td></tr></table>

<p>To send a stream in realtime to a RTSP server, for others to watch:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -re -i <var>input</var> -f rtsp -muxdelay 0.1 rtsp://server/live.sdp
</pre></td></tr></table>

<a name="sap"></a>
<h2 class="section"><a href="ffmpeg.html#toc-sap">18.14 sap</a></h2>

<p>Session Announcement Protocol (RFC 2974). This is not technically a
protocol handler in libavformat, it is a muxer and demuxer.
It is used for signalling of RTP streams, by announcing the SDP for the
streams regularly on a separate port.
</p>
<a name="Muxer"></a>
<h3 class="subsection"><a href="ffmpeg.html#toc-Muxer">18.14.1 Muxer</a></h3>

<p>The syntax for a SAP url given to the muxer is:
</p><table><tr><td>&nbsp;</td><td><pre class="example">sap://<var>destination</var>[:<var>port</var>][?<var>options</var>]
</pre></td></tr></table>

<p>The RTP packets are sent to <var>destination</var> on port <var>port</var>,
or to port 5004 if no port is specified.
<var>options</var> is a <code>&amp;</code>-separated list. The following options
are supported:
</p>
<dl compact="compact">
<dt> &lsquo;<samp>announce_addr=<var>address</var></samp>&rsquo;</dt>
<dd><p>Specify the destination IP address for sending the announcements to.
If omitted, the announcements are sent to the commonly used SAP
announcement multicast address 224.2.127.254 (sap.mcast.net), or
ff0e::2:7ffe if <var>destination</var> is an IPv6 address.
</p>
</dd>
<dt> &lsquo;<samp>announce_port=<var>port</var></samp>&rsquo;</dt>
<dd><p>Specify the port to send the announcements on, defaults to
9875 if not specified.
</p>
</dd>
<dt> &lsquo;<samp>ttl=<var>ttl</var></samp>&rsquo;</dt>
<dd><p>Specify the time to live value for the announcements and RTP packets,
defaults to 255.
</p>
</dd>
<dt> &lsquo;<samp>same_port=<var>0|1</var></samp>&rsquo;</dt>
<dd><p>If set to 1, send all RTP streams on the same port pair. If zero (the
default), all streams are sent on unique ports, with each stream on a
port 2 numbers higher than the previous.
VLC/Live555 requires this to be set to 1, to be able to receive the stream.
The RTP stack in libavformat for receiving requires all streams to be sent
on unique ports.
</p></dd>
</dl>

<p>Example command lines follow.
</p>
<p>To broadcast a stream on the local subnet, for watching in VLC:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -re -i <var>input</var> -f sap sap://224.0.0.255?same_port=1
</pre></td></tr></table>

<p>Similarly, for watching in <code>ffplay</code>:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -re -i <var>input</var> -f sap sap://224.0.0.255
</pre></td></tr></table>

<p>And for watching in <code>ffplay</code>, over IPv6:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -re -i <var>input</var> -f sap sap://[ff0e::1:2:3:4]
</pre></td></tr></table>

<a name="Demuxer"></a>
<h3 class="subsection"><a href="ffmpeg.html#toc-Demuxer">18.14.2 Demuxer</a></h3>

<p>The syntax for a SAP url given to the demuxer is:
</p><table><tr><td>&nbsp;</td><td><pre class="example">sap://[<var>address</var>][:<var>port</var>]
</pre></td></tr></table>

<p><var>address</var> is the multicast address to listen for announcements on,
if omitted, the default 224.2.127.254 (sap.mcast.net) is used. <var>port</var>
is the port that is listened on, 9875 if omitted.
</p>
<p>The demuxers listens for announcements on the given address and port.
Once an announcement is received, it tries to receive that particular stream.
</p>
<p>Example command lines follow.
</p>
<p>To play back the first stream announced on the normal SAP multicast address:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">ffplay sap://
</pre></td></tr></table>

<p>To play back the first stream announced on one the default IPv6 SAP multicast address:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">ffplay sap://[ff0e::2:7ffe]
</pre></td></tr></table>

<a name="tcp"></a>
<h2 class="section"><a href="ffmpeg.html#toc-tcp">18.15 tcp</a></h2>

<p>Trasmission Control Protocol.
</p>
<p>The required syntax for a TCP url is:
</p><table><tr><td>&nbsp;</td><td><pre class="example">tcp://<var>hostname</var>:<var>port</var>[?<var>options</var>]
</pre></td></tr></table>

<dl compact="compact">
<dt> &lsquo;<samp>listen</samp>&rsquo;</dt>
<dd><p>Listen for an incoming connection
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i <var>input</var> -f <var>format</var> tcp://<var>hostname</var>:<var>port</var>?listen
ffplay tcp://<var>hostname</var>:<var>port</var>
</pre></td></tr></table>

</dd>
</dl>

<a name="udp"></a>
<h2 class="section"><a href="ffmpeg.html#toc-udp">18.16 udp</a></h2>

<p>User Datagram Protocol.
</p>
<p>The required syntax for a UDP url is:
</p><table><tr><td>&nbsp;</td><td><pre class="example">udp://<var>hostname</var>:<var>port</var>[?<var>options</var>]
</pre></td></tr></table>

<p><var>options</var> contains a list of &amp;-seperated options of the form <var>key</var>=<var>val</var>.
Follow the list of supported options.
</p>
<dl compact="compact">
<dt> &lsquo;<samp>buffer_size=<var>size</var></samp>&rsquo;</dt>
<dd><p>set the UDP buffer size in bytes
</p>
</dd>
<dt> &lsquo;<samp>localport=<var>port</var></samp>&rsquo;</dt>
<dd><p>override the local UDP port to bind with
</p>
</dd>
<dt> &lsquo;<samp>localaddr=<var>addr</var></samp>&rsquo;</dt>
<dd><p>Choose the local IP address. This is useful e.g. if sending multicast
and the host has multiple interfaces, where the user can choose
which interface to send on by specifying the IP address of that interface.
</p>
</dd>
<dt> &lsquo;<samp>pkt_size=<var>size</var></samp>&rsquo;</dt>
<dd><p>set the size in bytes of UDP packets
</p>
</dd>
<dt> &lsquo;<samp>reuse=<var>1|0</var></samp>&rsquo;</dt>
<dd><p>explicitly allow or disallow reusing UDP sockets
</p>
</dd>
<dt> &lsquo;<samp>ttl=<var>ttl</var></samp>&rsquo;</dt>
<dd><p>set the time to live value (for multicast only)
</p>
</dd>
<dt> &lsquo;<samp>connect=<var>1|0</var></samp>&rsquo;</dt>
<dd><p>Initialize the UDP socket with <code>connect()</code>. In this case, the
destination address can&rsquo;t be changed with ff_udp_set_remote_url later.
If the destination address isn&rsquo;t known at the start, this option can
be specified in ff_udp_set_remote_url, too.
This allows finding out the source address for the packets with getsockname,
and makes writes return with AVERROR(ECONNREFUSED) if &quot;destination
unreachable&quot; is received.
For receiving, this gives the benefit of only receiving packets from
the specified peer address/port.
</p></dd>
</dl>

<p>Some usage examples of the udp protocol with <code>ffmpeg</code> follow.
</p>
<p>To stream over UDP to a remote endpoint:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i <var>input</var> -f <var>format</var> udp://<var>hostname</var>:<var>port</var>
</pre></td></tr></table>

<p>To stream in mpegts format over UDP using 188 sized UDP packets, using a large input buffer:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i <var>input</var> -f mpegts udp://<var>hostname</var>:<var>port</var>?pkt_size=188&amp;buffer_size=65535
</pre></td></tr></table>

<p>To receive over UDP from a remote endpoint:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i udp://[<var>multicast-address</var>]:<var>port</var>
</pre></td></tr></table>

<a name="Bitstream-Filters"></a>
<h1 class="chapter"><a href="ffmpeg.html#toc-Bitstream-Filters">19. Bitstream Filters</a></h1>

<p>When you configure your FFmpeg build, all the supported bitstream
filters are enabled by default. You can list all available ones using
the configure option <code>--list-bsfs</code>.
</p>
<p>You can disable all the bitstream filters using the configure option
<code>--disable-bsfs</code>, and selectively enable any bitstream filter using
the option <code>--enable-bsf=BSF</code>, or you can disable a particular
bitstream filter using the option <code>--disable-bsf=BSF</code>.
</p>
<p>The option <code>-bsfs</code> of the ff* tools will display the list of
all the supported bitstream filters included in your build.
</p>
<p>Below is a description of the currently available bitstream filters.
</p>
<a name="aac_005fadtstoasc"></a>
<h2 class="section"><a href="ffmpeg.html#toc-aac_005fadtstoasc">19.1 aac_adtstoasc</a></h2>

<a name="chomp"></a>
<h2 class="section"><a href="ffmpeg.html#toc-chomp">19.2 chomp</a></h2>

<a name="dump_005fextradata"></a>
<h2 class="section"><a href="ffmpeg.html#toc-dump_005fextradata">19.3 dump_extradata</a></h2>

<a name="h264_005fmp4toannexb"></a>
<h2 class="section"><a href="ffmpeg.html#toc-h264_005fmp4toannexb">19.4 h264_mp4toannexb</a></h2>

<p>Convert an H.264 bitstream from length prefixed mode to start code
prefixed mode (as defined in the Annex B of the ITU-T H.264
specification).
</p>
<p>This is required by some streaming formats, typically the MPEG-2
transport stream format (&quot;mpegts&quot;).
</p>
<p>For example to remux an MP4 file containing an H.264 stream to mpegts
format with <code>ffmpeg</code>, you can use the command:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT.mp4 -codec copy -bsf:v h264_mp4toannexb OUTPUT.ts
</pre></td></tr></table>

<a name="imx_005fdump_005fheader"></a>
<h2 class="section"><a href="ffmpeg.html#toc-imx_005fdump_005fheader">19.5 imx_dump_header</a></h2>

<a name="mjpeg2jpeg"></a>
<h2 class="section"><a href="ffmpeg.html#toc-mjpeg2jpeg">19.6 mjpeg2jpeg</a></h2>

<p>Convert MJPEG/AVI1 packets to full JPEG/JFIF packets.
</p>
<p>MJPEG is a video codec wherein each video frame is essentially a
JPEG image. The individual frames can be extracted without loss,
e.g. by
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i ../some_mjpeg.avi -c:v copy frames_%d.jpg
</pre></td></tr></table>

<p>Unfortunately, these chunks are incomplete JPEG images, because
they lack the DHT segment required for decoding. Quoting from
<a href="http://www.digitalpreservation.gov/formats/fdd/fdd000063.shtml">http://www.digitalpreservation.gov/formats/fdd/fdd000063.shtml</a>:
</p>
<p>Avery Lee, writing in the rec.video.desktop newsgroup in 2001,
commented that &quot;MJPEG, or at least the MJPEG in AVIs having the
MJPG fourcc, is restricted JPEG with a fixed &ndash; and *omitted* &ndash;
Huffman table. The JPEG must be YCbCr colorspace, it must be 4:2:2,
and it must use basic Huffman encoding, not arithmetic or
progressive. . . . You can indeed extract the MJPEG frames and
decode them with a regular JPEG decoder, but you have to prepend
the DHT segment to them, or else the decoder won&rsquo;t have any idea
how to decompress the data. The exact table necessary is given in
the OpenDML spec.&quot;
</p>
<p>This bitstream filter patches the header of frames extracted from an MJPEG
stream (carrying the AVI1 header ID and lacking a DHT segment) to
produce fully qualified JPEG images.
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i mjpeg-movie.avi -c:v copy -vbsf mjpeg2jpeg frame_%d.jpg
exiftran -i -9 frame*.jpg
ffmpeg -i frame_%d.jpg -c:v copy rotated.avi
</pre></td></tr></table>

<a name="mjpega_005fdump_005fheader"></a>
<h2 class="section"><a href="ffmpeg.html#toc-mjpega_005fdump_005fheader">19.7 mjpega_dump_header</a></h2>

<a name="movsub"></a>
<h2 class="section"><a href="ffmpeg.html#toc-movsub">19.8 movsub</a></h2>

<a name="mp3_005fheader_005fcompress"></a>
<h2 class="section"><a href="ffmpeg.html#toc-mp3_005fheader_005fcompress">19.9 mp3_header_compress</a></h2>

<a name="mp3_005fheader_005fdecompress"></a>
<h2 class="section"><a href="ffmpeg.html#toc-mp3_005fheader_005fdecompress">19.10 mp3_header_decompress</a></h2>

<a name="noise"></a>
<h2 class="section"><a href="ffmpeg.html#toc-noise">19.11 noise</a></h2>

<a name="remove_005fextradata"></a>
<h2 class="section"><a href="ffmpeg.html#toc-remove_005fextradata">19.12 remove_extradata</a></h2>

<a name="Filtergraph-description"></a>
<h1 class="chapter"><a href="ffmpeg.html#toc-Filtergraph-description">20. Filtergraph description</a></h1>

<p>A filtergraph is a directed graph of connected filters. It can contain
cycles, and there can be multiple links between a pair of
filters. Each link has one input pad on one side connecting it to one
filter from which it takes its input, and one output pad on the other
side connecting it to the one filter accepting its output.
</p>
<p>Each filter in a filtergraph is an instance of a filter class
registered in the application, which defines the features and the
number of input and output pads of the filter.
</p>
<p>A filter with no input pads is called a &quot;source&quot;, a filter with no
output pads is called a &quot;sink&quot;.
</p>
<a name="Filtergraph-syntax"></a>
<h2 class="section"><a href="ffmpeg.html#toc-Filtergraph-syntax">20.1 Filtergraph syntax</a></h2>

<p>A filtergraph can be represented using a textual representation, which
is recognized by the <code>-vf</code> option of the ff*
tools, and by the <code>avfilter_graph_parse()</code> function defined in
&lsquo;<tt>libavfilter/avfiltergraph.h</tt>&rsquo;.
</p>
<p>A filterchain consists of a sequence of connected filters, each one
connected to the previous one in the sequence. A filterchain is
represented by a list of &quot;,&quot;-separated filter descriptions.
</p>
<p>A filtergraph consists of a sequence of filterchains. A sequence of
filterchains is represented by a list of &quot;;&quot;-separated filterchain
descriptions.
</p>
<p>A filter is represented by a string of the form:
[<var>in_link_1</var>]...[<var>in_link_N</var>]<var>filter_name</var>=<var>arguments</var>[<var>out_link_1</var>]...[<var>out_link_M</var>]
</p>
<p><var>filter_name</var> is the name of the filter class of which the
described filter is an instance of, and has to be the name of one of
the filter classes registered in the program.
The name of the filter class is optionally followed by a string
&quot;=<var>arguments</var>&quot;.
</p>
<p><var>arguments</var> is a string which contains the parameters used to
initialize the filter instance, and are described in the filter
descriptions below.
</p>
<p>The list of arguments can be quoted using the character &quot;&rsquo;&quot; as initial
and ending mark, and the character &rsquo;\&rsquo; for escaping the characters
within the quoted text; otherwise the argument string is considered
terminated when the next special character (belonging to the set
&quot;[]=;,&quot;) is encountered.
</p>
<p>The name and arguments of the filter are optionally preceded and
followed by a list of link labels.
A link label allows to name a link and associate it to a filter output
or input pad. The preceding labels <var>in_link_1</var>
... <var>in_link_N</var>, are associated to the filter input pads,
the following labels <var>out_link_1</var> ... <var>out_link_M</var>, are
associated to the output pads.
</p>
<p>When two link labels with the same name are found in the
filtergraph, a link between the corresponding input and output pad is
created.
</p>
<p>If an output pad is not labelled, it is linked by default to the first
unlabelled input pad of the next filter in the filterchain.
For example in the filterchain:
</p><table><tr><td>&nbsp;</td><td><pre class="example">nullsrc, split[L1], [L2]overlay, nullsink
</pre></td></tr></table>
<p>the split filter instance has two output pads, and the overlay filter
instance two input pads. The first output pad of split is labelled
&quot;L1&quot;, the first input pad of overlay is labelled &quot;L2&quot;, and the second
output pad of split is linked to the second input pad of overlay,
which are both unlabelled.
</p>
<p>In a complete filterchain all the unlabelled filter input and output
pads must be connected. A filtergraph is considered valid if all the
filter input and output pads of all the filterchains are connected.
</p>
<p>Follows a BNF description for the filtergraph syntax:
</p><table><tr><td>&nbsp;</td><td><pre class="example"><var>NAME</var>             ::= sequence of alphanumeric characters and '_'
<var>LINKLABEL</var>        ::= &quot;[&quot; <var>NAME</var> &quot;]&quot;
<var>LINKLABELS</var>       ::= <var>LINKLABEL</var> [<var>LINKLABELS</var>]
<var>FILTER_ARGUMENTS</var> ::= sequence of chars (eventually quoted)
<var>FILTER</var>           ::= [<var>LINKNAMES</var>] <var>NAME</var> [&quot;=&quot; <var>ARGUMENTS</var>] [<var>LINKNAMES</var>]
<var>FILTERCHAIN</var>      ::= <var>FILTER</var> [,<var>FILTERCHAIN</var>]
<var>FILTERGRAPH</var>      ::= <var>FILTERCHAIN</var> [;<var>FILTERGRAPH</var>]
</pre></td></tr></table>


<a name="Audio-Filters"></a>
<h1 class="chapter"><a href="ffmpeg.html#toc-Audio-Filters">21. Audio Filters</a></h1>

<p>When you configure your FFmpeg build, you can disable any of the
existing filters using <code>--disable-filters</code>.
The configure output will show the audio filters included in your
build.
</p>
<p>Below is a description of the currently available audio filters.
</p>
<a name="aconvert"></a>
<h2 class="section"><a href="ffmpeg.html#toc-aconvert">21.1 aconvert</a></h2>

<p>Convert the input audio format to the specified formats.
</p>
<p>The filter accepts a string of the form:
&quot;<var>sample_format</var>:<var>channel_layout</var>:<var>packing_format</var>&quot;.
</p>
<p><var>sample_format</var> specifies the sample format, and can be a string or
the corresponding numeric value defined in &lsquo;<tt>libavutil/samplefmt.h</tt>&rsquo;.
</p>
<p><var>channel_layout</var> specifies the channel layout, and can be a string
or the corresponding number value defined in &lsquo;<tt>libavutil/audioconvert.h</tt>&rsquo;.
</p>
<p><var>packing_format</var> specifies the type of packing in output, can be one
of &quot;planar&quot; or &quot;packed&quot;, or the corresponding numeric values &quot;0&quot; or &quot;1&quot;.
</p>
<p>The special parameter &quot;auto&quot;, signifies that the filter will
automatically select the output format depending on the output filter.
</p>
<p>Some examples follow.
</p>
<ul>
<li>
Convert input to unsigned 8-bit, stereo, packed:
<table><tr><td>&nbsp;</td><td><pre class="example">aconvert=u8:stereo:packed
</pre></td></tr></table>

</li><li>
Convert input to unsigned 8-bit, automatically select out channel layout
and packing format:
<table><tr><td>&nbsp;</td><td><pre class="example">aconvert=u8:auto:auto
</pre></td></tr></table>
</li></ul>

<a name="aformat"></a>
<h2 class="section"><a href="ffmpeg.html#toc-aformat">21.2 aformat</a></h2>

<p>Convert the input audio to one of the specified formats. The framework will
negotiate the most appropriate format to minimize conversions.
</p>
<p>The filter accepts three lists of formats, separated by &quot;:&quot;, in the form:
&quot;<var>sample_formats</var>:<var>channel_layouts</var>:<var>packing_formats</var>&quot;.
</p>
<p>Elements in each list are separated by &quot;,&quot; which has to be escaped in the
filtergraph specification.
</p>
<p>The special parameter &quot;all&quot;, in place of a list of elements, signifies all
supported formats.
</p>
<p>Some examples follow:
</p><table><tr><td>&nbsp;</td><td><pre class="example">aformat=u8\\,s16:mono:packed

aformat=s16:mono\\,stereo:all
</pre></td></tr></table>

<a name="amerge"></a>
<h2 class="section"><a href="ffmpeg.html#toc-amerge">21.3 amerge</a></h2>

<p>Merge two audio streams into a single multi-channel stream.
</p>
<p>This filter does not need any argument.
</p>
<p>If the channel layouts of the inputs are disjoint, and therefore compatible,
the channel layout of the output will be set accordingly and the channels
will be reordered as necessary. If the channel layouts of the inputs are not
disjoint, the output will have all the channels of the first input then all
the channels of the second input, in that order, and the channel layout of
the output will be the default value corresponding to the total number of
channels.
</p>
<p>For example, if the first input is in 2.1 (FL+FR+LF) and the second input
is FC+BL+BR, then the output will be in 5.1, with the channels in the
following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
first input, b1 is the first channel of the second input).
</p>
<p>On the other hand, if both input are in stereo, the output channels will be
in the default order: a1, a2, b1, b2, and the channel layout will be
arbitrarily set to 4.0, which may or may not be the expected value.
</p>
<p>Both inputs must have the same sample rate, format and packing.
</p>
<p>If inputs do not have the same duration, the output will stop with the
shortest.
</p>
<p>Example: merge two mono files into a stereo stream:
</p><table><tr><td>&nbsp;</td><td><pre class="example">amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
</pre></td></tr></table>

<a name="anull"></a>
<h2 class="section"><a href="ffmpeg.html#toc-anull">21.4 anull</a></h2>

<p>Pass the audio source unchanged to the output.
</p>
<a name="aresample"></a>
<h2 class="section"><a href="ffmpeg.html#toc-aresample">21.5 aresample</a></h2>

<p>Resample the input audio to the specified sample rate.
</p>
<p>The filter accepts exactly one parameter, the output sample rate. If not
specified then the filter will automatically convert between its input
and output sample rates.
</p>
<p>For example, to resample the input audio to 44100Hz:
</p><table><tr><td>&nbsp;</td><td><pre class="example">aresample=44100
</pre></td></tr></table>

<a name="ashowinfo"></a>
<h2 class="section"><a href="ffmpeg.html#toc-ashowinfo">21.6 ashowinfo</a></h2>

<p>Show a line containing various information for each input audio frame.
The input audio is not modified.
</p>
<p>The shown line contains a sequence of key/value pairs of the form
<var>key</var>:<var>value</var>.
</p>
<p>A description of each shown parameter follows:
</p>
<dl compact="compact">
<dt> &lsquo;<samp>n</samp>&rsquo;</dt>
<dd><p>sequential number of the input frame, starting from 0
</p>
</dd>
<dt> &lsquo;<samp>pts</samp>&rsquo;</dt>
<dd><p>presentation TimeStamp of the input frame, expressed as a number of
time base units. The time base unit depends on the filter input pad, and
is usually 1/<var>sample_rate</var>.
</p>
</dd>
<dt> &lsquo;<samp>pts_time</samp>&rsquo;</dt>
<dd><p>presentation TimeStamp of the input frame, expressed as a number of
seconds
</p>
</dd>
<dt> &lsquo;<samp>pos</samp>&rsquo;</dt>
<dd><p>position of the frame in the input stream, -1 if this information in
unavailable and/or meaningless (for example in case of synthetic audio)
</p>
</dd>
<dt> &lsquo;<samp>fmt</samp>&rsquo;</dt>
<dd><p>sample format name
</p>
</dd>
<dt> &lsquo;<samp>chlayout</samp>&rsquo;</dt>
<dd><p>channel layout description
</p>
</dd>
<dt> &lsquo;<samp>nb_samples</samp>&rsquo;</dt>
<dd><p>number of samples (per each channel) contained in the filtered frame
</p>
</dd>
<dt> &lsquo;<samp>rate</samp>&rsquo;</dt>
<dd><p>sample rate for the audio frame
</p>
</dd>
<dt> &lsquo;<samp>planar</samp>&rsquo;</dt>
<dd><p>if the packing format is planar, 0 if packed
</p>
</dd>
<dt> &lsquo;<samp>checksum</samp>&rsquo;</dt>
<dd><p>Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame
</p>
</dd>
<dt> &lsquo;<samp>plane_checksum</samp>&rsquo;</dt>
<dd><p>Adler-32 checksum (printed in hexadecimal) for each input frame plane,
expressed in the form &quot;[<var>c0</var> <var>c1</var> <var>c2</var> <var>c3</var> <var>c4</var> <var>c5</var>
<var>c6</var> <var>c7</var>]&quot;
</p></dd>
</dl>

<a name="asplit"></a>
<h2 class="section"><a href="ffmpeg.html#toc-asplit">21.7 asplit</a></h2>

<p>Pass on the input audio to two outputs. Both outputs are identical to
the input audio.
</p>
<p>For example:
</p><table><tr><td>&nbsp;</td><td><pre class="example">[in] asplit[out0], showaudio[out1]
</pre></td></tr></table>

<p>will create two separate outputs from the same input, one cropped and
one padded.
</p>
<a name="astreamsync"></a>
<h2 class="section"><a href="ffmpeg.html#toc-astreamsync">21.8 astreamsync</a></h2>

<p>Forward two audio streams and control the order the buffers are forwarded.
</p>
<p>The argument to the filter is an expression deciding which stream should be
forwarded next: if the result is negative, the first stream is forwarded; if
the result is positive or zero, the second stream is forwarded. It can use
the following variables:
</p>
<dl compact="compact">
<dt> <var>b1 b2</var></dt>
<dd><p>number of buffers forwarded so far on each stream
</p></dd>
<dt> <var>s1 s2</var></dt>
<dd><p>number of samples forwarded so far on each stream
</p></dd>
<dt> <var>t1 t2</var></dt>
<dd><p>current timestamp of each stream
</p></dd>
</dl>

<p>The default value is <code>t1-t2</code>, which means to always forward the stream
that has a smaller timestamp.
</p>
<p>Example: stress-test <code>amerge</code> by randomly sending buffers on the wrong
input, while avoiding too much of a desynchronization:
</p><table><tr><td>&nbsp;</td><td><pre class="example">amovie=file.ogg [a] ; amovie=file.mp3 [b] ;
[a] [b] astreamsync=(2*random(1))-1+tanh(5*(t1-t2)) [a2] [b2] ;
[a2] [b2] amerge
</pre></td></tr></table>

<a name="earwax"></a>
<h2 class="section"><a href="ffmpeg.html#toc-earwax">21.9 earwax</a></h2>

<p>Make audio easier to listen to on headphones.
</p>
<p>This filter adds &lsquo;cues&rsquo; to 44.1kHz stereo (i.e. audio CD format) audio
so that when listened to on headphones the stereo image is moved from
inside your head (standard for headphones) to outside and in front of
the listener (standard for speakers).
</p>
<p>Ported from SoX.
</p>
<a name="pan"></a>
<h2 class="section"><a href="ffmpeg.html#toc-pan">21.10 pan</a></h2>

<p>Mix channels with specific gain levels. The filter accepts the output
channel layout followed by a set of channels definitions.
</p>
<p>This filter is also designed to remap efficiently the channels of an audio
stream.
</p>
<p>The filter accepts parameters of the form:
&quot;<var>l</var>:<var>outdef</var>:<var>outdef</var>:...&quot;
</p>
<dl compact="compact">
<dt> &lsquo;<samp>l</samp>&rsquo;</dt>
<dd><p>output channel layout or number of channels
</p>
</dd>
<dt> &lsquo;<samp>outdef</samp>&rsquo;</dt>
<dd><p>output channel specification, of the form:
&quot;<var>out_name</var>=[<var>gain</var>*]<var>in_name</var>[+[<var>gain</var>*]<var>in_name</var>...]&quot;
</p>
</dd>
<dt> &lsquo;<samp>out_name</samp>&rsquo;</dt>
<dd><p>output channel to define, either a channel name (FL, FR, etc.) or a channel
number (c0, c1, etc.)
</p>
</dd>
<dt> &lsquo;<samp>gain</samp>&rsquo;</dt>
<dd><p>multiplicative coefficient for the channel, 1 leaving the volume unchanged
</p>
</dd>
<dt> &lsquo;<samp>in_name</samp>&rsquo;</dt>
<dd><p>input channel to use, see out_name for details; it is not possible to mix
named and numbered input channels
</p></dd>
</dl>

<p>If the &lsquo;=&rsquo; in a channel specification is replaced by &lsquo;&lt;&rsquo;, then the gains for
that specification will be renormalized so that the total is 1, thus
avoiding clipping noise.
</p>
<a name="Mixing-examples"></a>
<h3 class="subsection"><a href="ffmpeg.html#toc-Mixing-examples">21.10.1 Mixing examples</a></h3>

<p>For example, if you want to down-mix from stereo to mono, but with a bigger
factor for the left channel:
</p><table><tr><td>&nbsp;</td><td><pre class="example">pan=1:c0=0.9*c0+0.1*c1
</pre></td></tr></table>

<p>A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
7-channels surround:
</p><table><tr><td>&nbsp;</td><td><pre class="example">pan=stereo: FL &lt; FL + 0.5*FC + 0.6*BL + 0.6*SL : FR &lt; FR + 0.5*FC + 0.6*BR + 0.6*SR
</pre></td></tr></table>

<p>Note that <code>ffmpeg</code> integrates a default down-mix (and up-mix) system
that should be preferred (see &quot;-ac&quot; option) unless you have very specific
needs.
</p>
<a name="Remapping-examples"></a>
<h3 class="subsection"><a href="ffmpeg.html#toc-Remapping-examples">21.10.2 Remapping examples</a></h3>

<p>The channel remapping will be effective if, and only if:
</p>
<ul>
<li> gain coefficients are zeroes or ones,
</li><li> only one input per channel output,
</li><li> the number of output channels is supported by libswresample (16 at the
      moment)
</li></ul>

<p>If all these conditions are satisfied, the filter will notify the user (&quot;Pure
channel mapping detected&quot;), and use an optimized and lossless method to do the
remapping.
</p>
<p>For example, if you have a 5.1 source and want a stereo audio stream by
dropping the extra channels:
</p><table><tr><td>&nbsp;</td><td><pre class="example">pan=&quot;stereo: c0=FL : c1=FR&quot;
</pre></td></tr></table>

<p>Given the same source, you can also switch front left and front right channels
and keep the input channel layout:
</p><table><tr><td>&nbsp;</td><td><pre class="example">pan=&quot;5.1: c0=c1 : c1=c0 : c2=c2 : c3=c3 : c4=c4 : c5=c5&quot;
</pre></td></tr></table>

<p>If the input is a stereo audio stream, you can mute the front left channel (and
still keep the stereo channel layout) with:
</p><table><tr><td>&nbsp;</td><td><pre class="example">pan=&quot;stereo:c1=c1&quot;
</pre></td></tr></table>

<p>Still with a stereo audio stream input, you can copy the right channel in both
front left and right:
</p><table><tr><td>&nbsp;</td><td><pre class="example">pan=&quot;stereo: c0=FR : c1=FR&quot;
</pre></td></tr></table>

<a name="silencedetect"></a>
<h2 class="section"><a href="ffmpeg.html#toc-silencedetect">21.11 silencedetect</a></h2>

<p>Detect silence in an audio stream.
</p>
<p>This filter logs a message when it detects that the input audio volume is less
or equal to a noise tolerance value for a duration greater or equal to the
minimum detected noise duration.
</p>
<p>The printed times and duration are expressed in seconds.
</p>
<dl compact="compact">
<dt> &lsquo;<samp>duration, d</samp>&rsquo;</dt>
<dd><p>Set silence duration until notification (default is 2 seconds).
</p>
</dd>
<dt> &lsquo;<samp>noise, n</samp>&rsquo;</dt>
<dd><p>Set noise tolerance. Can be specified in dB (in case &quot;dB&quot; is appended to the
specified value) or amplitude ratio. Default is -60dB, or 0.001.
</p></dd>
</dl>

<p>Detect 5 seconds of silence with -50dB noise tolerance:
</p><table><tr><td>&nbsp;</td><td><pre class="example">silencedetect=n=-50dB:d=5
</pre></td></tr></table>

<p>Complete example with <code>ffmpeg</code> to detect silence with 0.0001 noise
tolerance in &lsquo;<tt>silence.mp3</tt>&rsquo;:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f lavfi -i amovie=silence.mp3,silencedetect=noise=0.0001 -f null -
</pre></td></tr></table>

<a name="volume"></a>
<h2 class="section"><a href="ffmpeg.html#toc-volume">21.12 volume</a></h2>

<p>Adjust the input audio volume.
</p>
<p>The filter accepts exactly one parameter <var>vol</var>, which expresses
how the audio volume will be increased or decreased.
</p>
<p>Output values are clipped to the maximum value.
</p>
<p>If <var>vol</var> is expressed as a decimal number, the output audio
volume is given by the relation:
</p><table><tr><td>&nbsp;</td><td><pre class="example"><var>output_volume</var> = <var>vol</var> * <var>input_volume</var>
</pre></td></tr></table>

<p>If <var>vol</var> is expressed as a decimal number followed by the string
&quot;dB&quot;, the value represents the requested change in decibels of the
input audio power, and the output audio volume is given by the
relation:
</p><table><tr><td>&nbsp;</td><td><pre class="example"><var>output_volume</var> = 10^(<var>vol</var>/20) * <var>input_volume</var>
</pre></td></tr></table>

<p>Otherwise <var>vol</var> is considered an expression and its evaluated
value is used for computing the output audio volume according to the
first relation.
</p>
<p>Default value for <var>vol</var> is 1.0.
</p>
<a name="Examples-1"></a>
<h3 class="subsection"><a href="ffmpeg.html#toc-Examples-1">21.12.1 Examples</a></h3>

<ul>
<li>
Half the input audio volume:
<table><tr><td>&nbsp;</td><td><pre class="example">volume=0.5
</pre></td></tr></table>

<p>The above example is equivalent to:
</p><table><tr><td>&nbsp;</td><td><pre class="example">volume=1/2
</pre></td></tr></table>

</li><li>
Decrease input audio power by 12 decibels:
<table><tr><td>&nbsp;</td><td><pre class="example">volume=-12dB
</pre></td></tr></table>
</li></ul>


<a name="Audio-Sources"></a>
<h1 class="chapter"><a href="ffmpeg.html#toc-Audio-Sources">22. Audio Sources</a></h1>

<p>Below is a description of the currently available audio sources.
</p>
<a name="abuffer"></a>
<h2 class="section"><a href="ffmpeg.html#toc-abuffer">22.1 abuffer</a></h2>

<p>Buffer audio frames, and make them available to the filter chain.
</p>
<p>This source is mainly intended for a programmatic use, in particular
through the interface defined in &lsquo;<tt>libavfilter/asrc_abuffer.h</tt>&rsquo;.
</p>
<p>It accepts the following mandatory parameters:
<var>sample_rate</var>:<var>sample_fmt</var>:<var>channel_layout</var>:<var>packing</var>
</p>
<dl compact="compact">
<dt> &lsquo;<samp>sample_rate</samp>&rsquo;</dt>
<dd><p>The sample rate of the incoming audio buffers.
</p>
</dd>
<dt> &lsquo;<samp>sample_fmt</samp>&rsquo;</dt>
<dd><p>The sample format of the incoming audio buffers.
Either a sample format name or its corresponging integer representation from
the enum AVSampleFormat in &lsquo;<tt>libavutil/samplefmt.h</tt>&rsquo;
</p>
</dd>
<dt> &lsquo;<samp>channel_layout</samp>&rsquo;</dt>
<dd><p>The channel layout of the incoming audio buffers.
Either a channel layout name from channel_layout_map in
&lsquo;<tt>libavutil/audioconvert.c</tt>&rsquo; or its corresponding integer representation
from the AV_CH_LAYOUT_* macros in &lsquo;<tt>libavutil/audioconvert.h</tt>&rsquo;
</p>
</dd>
<dt> &lsquo;<samp>packing</samp>&rsquo;</dt>
<dd><p>Either &quot;packed&quot; or &quot;planar&quot;, or their integer representation: 0 or 1
respectively.
</p>
</dd>
</dl>

<p>For example:
</p><table><tr><td>&nbsp;</td><td><pre class="example">abuffer=44100:s16:stereo:planar
</pre></td></tr></table>

<p>will instruct the source to accept planar 16bit signed stereo at 44100Hz.
Since the sample format with name &quot;s16&quot; corresponds to the number
1 and the &quot;stereo&quot; channel layout corresponds to the value 3, this is
equivalent to:
</p><table><tr><td>&nbsp;</td><td><pre class="example">abuffer=44100:1:3:1
</pre></td></tr></table>

<a name="aevalsrc"></a>
<h2 class="section"><a href="ffmpeg.html#toc-aevalsrc">22.2 aevalsrc</a></h2>

<p>Generate an audio signal specified by an expression.
</p>
<p>This source accepts in input one or more expressions (one for each
channel), which are evaluated and used to generate a corresponding
audio signal.
</p>
<p>It accepts the syntax: <var>exprs</var>[::<var>options</var>].
<var>exprs</var> is a list of expressions separated by &quot;:&quot;, one for each
separate channel. The output channel layout depends on the number of
provided expressions, up to 8 channels are supported.
</p>
<p><var>options</var> is an optional sequence of <var>key</var>=<var>value</var> pairs,
separated by &quot;:&quot;.
</p>
<p>The description of the accepted options follows.
</p>
<dl compact="compact">
<dt> &lsquo;<samp>duration, d</samp>&rsquo;</dt>
<dd><p>Set the minimum duration of the sourced audio. See the function
<code>av_parse_time()</code> for the accepted format.
Note that the resulting duration may be greater than the specified
duration, as the generated audio is always cut at the end of a
complete frame.
</p>
<p>If not specified, or the expressed duration is negative, the audio is
supposed to be generated forever.
</p>
</dd>
<dt> &lsquo;<samp>nb_samples, n</samp>&rsquo;</dt>
<dd><p>Set the number of samples per channel per each output frame,
default to 1024.
</p>
</dd>
<dt> &lsquo;<samp>sample_rate, s</samp>&rsquo;</dt>
<dd><p>Specify the sample rate, default to 44100.
</p></dd>
</dl>

<p>Each expression in <var>exprs</var> can contain the following constants:
</p>
<dl compact="compact">
<dt> &lsquo;<samp>n</samp>&rsquo;</dt>
<dd><p>number of the evaluated sample, starting from 0
</p>
</dd>
<dt> &lsquo;<samp>t</samp>&rsquo;</dt>
<dd><p>time of the evaluated sample expressed in seconds, starting from 0
</p>
</dd>
<dt> &lsquo;<samp>s</samp>&rsquo;</dt>
<dd><p>sample rate
</p>
</dd>
</dl>

<a name="Examples-5"></a>
<h3 class="subsection"><a href="ffmpeg.html#toc-Examples-5">22.2.1 Examples</a></h3>

<ul>
<li>
Generate silence:
<table><tr><td>&nbsp;</td><td><pre class="example">aevalsrc=0
</pre></td></tr></table>

</li><li>

Generate a sin signal with frequency of 440 Hz, set sample rate to
8000 Hz:
<table><tr><td>&nbsp;</td><td><pre class="example">aevalsrc=&quot;sin(440*2*PI*t)::s=8000&quot;
</pre></td></tr></table>

</li><li>
Generate white noise:
<table><tr><td>&nbsp;</td><td><pre class="example">aevalsrc=&quot;-2+random(0)&quot;
</pre></td></tr></table>

</li><li>
Generate an amplitude modulated signal:
<table><tr><td>&nbsp;</td><td><pre class="example">aevalsrc=&quot;sin(10*2*PI*t)*sin(880*2*PI*t)&quot;
</pre></td></tr></table>

</li><li>
Generate 2.5 Hz binaural beats on a 360 Hz carrier:
<table><tr><td>&nbsp;</td><td><pre class="example">aevalsrc=&quot;0.1*sin(2*PI*(360-2.5/2)*t) : 0.1*sin(2*PI*(360+2.5/2)*t)&quot;
</pre></td></tr></table>

</li></ul>

<a name="amovie"></a>
<h2 class="section"><a href="ffmpeg.html#toc-amovie">22.3 amovie</a></h2>

<p>Read an audio stream from a movie container.
</p>
<p>It accepts the syntax: <var>movie_name</var>[:<var>options</var>] where
<var>movie_name</var> is the name of the resource to read (not necessarily
a file but also a device or a stream accessed through some protocol),
and <var>options</var> is an optional sequence of <var>key</var>=<var>value</var>
pairs, separated by &quot;:&quot;.
</p>
<p>The description of the accepted options follows.
</p>
<dl compact="compact">
<dt> &lsquo;<samp>format_name, f</samp>&rsquo;</dt>
<dd><p>Specify the format assumed for the movie to read, and can be either
the name of a container or an input device. If not specified the
format is guessed from <var>movie_name</var> or by probing.
</p>
</dd>
<dt> &lsquo;<samp>seek_point, sp</samp>&rsquo;</dt>
<dd><p>Specify the seek point in seconds, the frames will be output
starting from this seek point, the parameter is evaluated with
<code>av_strtod</code> so the numerical value may be suffixed by an IS
postfix. Default value is &quot;0&quot;.
</p>
</dd>
<dt> &lsquo;<samp>stream_index, si</samp>&rsquo;</dt>
<dd><p>Specify the index of the audio stream to read. If the value is -1,
the best suited audio stream will be automatically selected. Default
value is &quot;-1&quot;.
</p>
</dd>
</dl>

<a name="anullsrc"></a>
<h2 class="section"><a href="ffmpeg.html#toc-anullsrc">22.4 anullsrc</a></h2>

<p>Null audio source, return unprocessed audio frames. It is mainly useful
as a template and to be employed in analysis / debugging tools, or as
the source for filters which ignore the input data (for example the sox
synth filter).
</p>
<p>It accepts an optional sequence of <var>key</var>=<var>value</var> pairs,
separated by &quot;:&quot;.
</p>
<p>The description of the accepted options follows.
</p>
<dl compact="compact">
<dt> &lsquo;<samp>sample_rate, s</samp>&rsquo;</dt>
<dd><p>Specify the sample rate, and defaults to 44100.
</p>
</dd>
<dt> &lsquo;<samp>channel_layout, cl</samp>&rsquo;</dt>
<dd>
<p>Specify the channel layout, and can be either an integer or a string
representing a channel layout. The default value of <var>channel_layout</var>
is &quot;stereo&quot;.
</p>
<p>Check the channel_layout_map definition in
&lsquo;<tt>libavcodec/audioconvert.c</tt>&rsquo; for the mapping between strings and
channel layout values.
</p>
</dd>
<dt> &lsquo;<samp>nb_samples, n</samp>&rsquo;</dt>
<dd><p>Set the number of samples per requested frames.
</p>
</dd>
</dl>

<p>Follow some examples:
</p><table><tr><td>&nbsp;</td><td><pre class="example">#  set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
anullsrc=r=48000:cl=4

# same as
anullsrc=r=48000:cl=mono
</pre></td></tr></table>


<a name="Audio-Sinks"></a>
<h1 class="chapter"><a href="ffmpeg.html#toc-Audio-Sinks">23. Audio Sinks</a></h1>

<p>Below is a description of the currently available audio sinks.
</p>
<a name="abuffersink"></a>
<h2 class="section"><a href="ffmpeg.html#toc-abuffersink">23.1 abuffersink</a></h2>

<p>Buffer audio frames, and make them available to the end of filter chain.
</p>
<p>This sink is mainly intended for programmatic use, in particular
through the interface defined in &lsquo;<tt>libavfilter/buffersink.h</tt>&rsquo;.
</p>
<p>It requires a pointer to an AVABufferSinkContext structure, which
defines the incoming buffers&rsquo; formats, to be passed as the opaque
parameter to <code>avfilter_init_filter</code> for initialization.
</p>
<a name="anullsink"></a>
<h2 class="section"><a href="ffmpeg.html#toc-anullsink">23.2 anullsink</a></h2>

<p>Null audio sink, do absolutely nothing with the input audio. It is
mainly useful as a template and to be employed in analysis / debugging
tools.
</p>

<a name="Video-Filters"></a>
<h1 class="chapter"><a href="ffmpeg.html#toc-Video-Filters">24. Video Filters</a></h1>

<p>When you configure your FFmpeg build, you can disable any of the
existing filters using <code>--disable-filters</code>.
The configure output will show the video filters included in your
build.
</p>
<p>Below is a description of the currently available video filters.
</p>
<a name="ass"></a>
<h2 class="section"><a href="ffmpeg.html#toc-ass">24.1 ass</a></h2>

<p>Draw ASS (Advanced Substation Alpha) subtitles on top of input video
using the libass library.
</p>
<p>To enable compilation of this filter you need to configure FFmpeg with
<code>--enable-libass</code>.
</p>
<p>This filter accepts in input the name of the ass file to render.
</p>
<p>For example, to render the file &lsquo;<tt>sub.ass</tt>&rsquo; on top of the input
video, use the command:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ass=sub.ass
</pre></td></tr></table>

<a name="blackframe"></a>
<h2 class="section"><a href="ffmpeg.html#toc-blackframe">24.2 blackframe</a></h2>

<p>Detect frames that are (almost) completely black. Can be useful to
detect chapter transitions or commercials. Output lines consist of
the frame number of the detected frame, the percentage of blackness,
the position in the file if known or -1 and the timestamp in seconds.
</p>
<p>In order to display the output lines, you need to set the loglevel at
least to the AV_LOG_INFO value.
</p>
<p>The filter accepts the syntax:
</p><table><tr><td>&nbsp;</td><td><pre class="example">blackframe[=<var>amount</var>:[<var>threshold</var>]]
</pre></td></tr></table>

<p><var>amount</var> is the percentage of the pixels that have to be below the
threshold, and defaults to 98.
</p>
<p><var>threshold</var> is the threshold below which a pixel value is
considered black, and defaults to 32.
</p>
<a name="boxblur"></a>
<h2 class="section"><a href="ffmpeg.html#toc-boxblur">24.3 boxblur</a></h2>

<p>Apply boxblur algorithm to the input video.
</p>
<p>This filter accepts the parameters:
<var>luma_radius</var>:<var>luma_power</var>:<var>chroma_radius</var>:<var>chroma_power</var>:<var>alpha_radius</var>:<var>alpha_power</var>
</p>
<p>Chroma and alpha parameters are optional, if not specified they default
to the corresponding values set for <var>luma_radius</var> and
<var>luma_power</var>.
</p>
<p><var>luma_radius</var>, <var>chroma_radius</var>, and <var>alpha_radius</var> represent
the radius in pixels of the box used for blurring the corresponding
input plane. They are expressions, and can contain the following
constants:
</p><dl compact="compact">
<dt> &lsquo;<samp>w, h</samp>&rsquo;</dt>
<dd><p>the input width and height in pixels
</p>
</dd>
<dt> &lsquo;<samp>cw, ch</samp>&rsquo;</dt>
<dd><p>the input chroma image width and height in pixels
</p>
</dd>
<dt> &lsquo;<samp>hsub, vsub</samp>&rsquo;</dt>
<dd><p>horizontal and vertical chroma subsample values. For example for the
pixel format &quot;yuv422p&quot; <var>hsub</var> is 2 and <var>vsub</var> is 1.
</p></dd>
</dl>

<p>The radius must be a non-negative number, and must not be greater than
the value of the expression <code>min(w,h)/2</code> for the luma and alpha planes,
and of <code>min(cw,ch)/2</code> for the chroma planes.
</p>
<p><var>luma_power</var>, <var>chroma_power</var>, and <var>alpha_power</var> represent
how many times the boxblur filter is applied to the corresponding
plane.
</p>
<p>Some examples follow:
</p>
<ul>
<li>
Apply a boxblur filter with luma, chroma, and alpha radius
set to 2:
<table><tr><td>&nbsp;</td><td><pre class="example">boxblur=2:1
</pre></td></tr></table>

</li><li>
Set luma radius to 2, alpha and chroma radius to 0
<table><tr><td>&nbsp;</td><td><pre class="example">boxblur=2:1:0:0:0:0
</pre></td></tr></table>

</li><li>
Set luma and chroma radius to a fraction of the video dimension
<table><tr><td>&nbsp;</td><td><pre class="example">boxblur=min(h\,w)/10:1:min(cw\,ch)/10:1
</pre></td></tr></table>

</li></ul>

<a name="copy"></a>
<h2 class="section"><a href="ffmpeg.html#toc-copy">24.4 copy</a></h2>

<p>Copy the input source unchanged to the output. Mainly useful for
testing purposes.
</p>
<a name="crop"></a>
<h2 class="section"><a href="ffmpeg.html#toc-crop">24.5 crop</a></h2>

<p>Crop the input video to <var>out_w</var>:<var>out_h</var>:<var>x</var>:<var>y</var>.
</p>
<p>The parameters are expressions containing the following constants:
</p>
<dl compact="compact">
<dt> &lsquo;<samp>x, y</samp>&rsquo;</dt>
<dd><p>the computed values for <var>x</var> and <var>y</var>. They are evaluated for
each new frame.
</p>
</dd>
<dt> &lsquo;<samp>in_w, in_h</samp>&rsquo;</dt>
<dd><p>the input width and height
</p>
</dd>
<dt> &lsquo;<samp>iw, ih</samp>&rsquo;</dt>
<dd><p>same as <var>in_w</var> and <var>in_h</var>
</p>
</dd>
<dt> &lsquo;<samp>out_w, out_h</samp>&rsquo;</dt>
<dd><p>the output (cropped) width and height
</p>
</dd>
<dt> &lsquo;<samp>ow, oh</samp>&rsquo;</dt>
<dd><p>same as <var>out_w</var> and <var>out_h</var>
</p>
</dd>
<dt> &lsquo;<samp>a</samp>&rsquo;</dt>
<dd><p>same as <var>iw</var> / <var>ih</var>
</p>
</dd>
<dt> &lsquo;<samp>sar</samp>&rsquo;</dt>
<dd><p>input sample aspect ratio
</p>
</dd>
<dt> &lsquo;<samp>dar</samp>&rsquo;</dt>
<dd><p>input display aspect ratio, it is the same as (<var>iw</var> / <var>ih</var>) * <var>sar</var>
</p>
</dd>
<dt> &lsquo;<samp>hsub, vsub</samp>&rsquo;</dt>
<dd><p>horizontal and vertical chroma subsample values. For example for the
pixel format &quot;yuv422p&quot; <var>hsub</var> is 2 and <var>vsub</var> is 1.
</p>
</dd>
<dt> &lsquo;<samp>n</samp>&rsquo;</dt>
<dd><p>the number of input frame, starting from 0
</p>
</dd>
<dt> &lsquo;<samp>pos</samp>&rsquo;</dt>
<dd><p>the position in the file of the input frame, NAN if unknown
</p>
</dd>
<dt> &lsquo;<samp>t</samp>&rsquo;</dt>
<dd><p>timestamp expressed in seconds, NAN if the input timestamp is unknown
</p>
</dd>
</dl>

<p>The <var>out_w</var> and <var>out_h</var> parameters specify the expressions for
the width and height of the output (cropped) video. They are
evaluated just at the configuration of the filter.
</p>
<p>The default value of <var>out_w</var> is &quot;in_w&quot;, and the default value of
<var>out_h</var> is &quot;in_h&quot;.
</p>
<p>The expression for <var>out_w</var> may depend on the value of <var>out_h</var>,
and the expression for <var>out_h</var> may depend on <var>out_w</var>, but they
cannot depend on <var>x</var> and <var>y</var>, as <var>x</var> and <var>y</var> are
evaluated after <var>out_w</var> and <var>out_h</var>.
</p>
<p>The <var>x</var> and <var>y</var> parameters specify the expressions for the
position of the top-left corner of the output (non-cropped) area. They
are evaluated for each frame. If the evaluated value is not valid, it
is approximated to the nearest valid value.
</p>
<p>The default value of <var>x</var> is &quot;(in_w-out_w)/2&quot;, and the default
value for <var>y</var> is &quot;(in_h-out_h)/2&quot;, which set the cropped area at
the center of the input image.
</p>
<p>The expression for <var>x</var> may depend on <var>y</var>, and the expression
for <var>y</var> may depend on <var>x</var>.
</p>
<p>Follow some examples:
</p><table><tr><td>&nbsp;</td><td><pre class="example"># crop the central input area with size 100x100
crop=100:100

# crop the central input area with size 2/3 of the input video
&quot;crop=2/3*in_w:2/3*in_h&quot;

# crop the input video central square
crop=in_h

# delimit the rectangle with the top-left corner placed at position
# 100:100 and the right-bottom corner corresponding to the right-bottom
# corner of the input image.
crop=in_w-100:in_h-100:100:100

# crop 10 pixels from the left and right borders, and 20 pixels from
# the top and bottom borders
&quot;crop=in_w-2*10:in_h-2*20&quot;

# keep only the bottom right quarter of the input image
&quot;crop=in_w/2:in_h/2:in_w/2:in_h/2&quot;

# crop height for getting Greek harmony
&quot;crop=in_w:1/PHI*in_w&quot;

# trembling effect
&quot;crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(n/10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(n/7)&quot;

# erratic camera effect depending on timestamp
&quot;crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(t*10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(t*13)&quot;

# set x depending on the value of y
&quot;crop=in_w/2:in_h/2:y:10+10*sin(n/10)&quot;
</pre></td></tr></table>

<a name="cropdetect"></a>
<h2 class="section"><a href="ffmpeg.html#toc-cropdetect">24.6 cropdetect</a></h2>

<p>Auto-detect crop size.
</p>
<p>Calculate necessary cropping parameters and prints the recommended
parameters through the logging system. The detected dimensions
correspond to the non-black area of the input video.
</p>
<p>It accepts the syntax:
</p><table><tr><td>&nbsp;</td><td><pre class="example">cropdetect[=<var>limit</var>[:<var>round</var>[:<var>reset</var>]]]
</pre></td></tr></table>

<dl compact="compact">
<dt> &lsquo;<samp>limit</samp>&rsquo;</dt>
<dd><p>Threshold, which can be optionally specified from nothing (0) to
everything (255), defaults to 24.
</p>
</dd>
<dt> &lsquo;<samp>round</samp>&rsquo;</dt>
<dd><p>Value which the width/height should be divisible by, defaults to
16. The offset is automatically adjusted to center the video. Use 2 to
get only even dimensions (needed for 4:2:2 video). 16 is best when
encoding to most video codecs.
</p>
</dd>
<dt> &lsquo;<samp>reset</samp>&rsquo;</dt>
<dd><p>Counter that determines after how many frames cropdetect will reset
the previously detected largest video area and start over to detect
the current optimal crop area. Defaults to 0.
</p>
<p>This can be useful when channel logos distort the video area. 0
indicates never reset and return the largest area encountered during
playback.
</p></dd>
</dl>

<a name="delogo"></a>
<h2 class="section"><a href="ffmpeg.html#toc-delogo">24.7 delogo</a></h2>

<p>Suppress a TV station logo by a simple interpolation of the surrounding
pixels. Just set a rectangle covering the logo and watch it disappear
(and sometimes something even uglier appear - your mileage may vary).
</p>
<p>The filter accepts parameters as a string of the form
&quot;<var>x</var>:<var>y</var>:<var>w</var>:<var>h</var>:<var>band</var>&quot;, or as a list of
<var>key</var>=<var>value</var> pairs, separated by &quot;:&quot;.
</p>
<p>The description of the accepted parameters follows.
</p>
<dl compact="compact">
<dt> &lsquo;<samp>x, y</samp>&rsquo;</dt>
<dd><p>Specify the top left corner coordinates of the logo. They must be
specified.
</p>
</dd>
<dt> &lsquo;<samp>w, h</samp>&rsquo;</dt>
<dd><p>Specify the width and height of the logo to clear. They must be
specified.
</p>
</dd>
<dt> &lsquo;<samp>band, t</samp>&rsquo;</dt>
<dd><p>Specify the thickness of the fuzzy edge of the rectangle (added to
<var>w</var> and <var>h</var>). The default value is 4.
</p>
</dd>
<dt> &lsquo;<samp>show</samp>&rsquo;</dt>
<dd><p>When set to 1, a green rectangle is drawn on the screen to simplify
finding the right <var>x</var>, <var>y</var>, <var>w</var>, <var>h</var> parameters, and
<var>band</var> is set to 4. The default value is 0.
</p>
</dd>
</dl>

<p>Some examples follow.
</p>
<ul>
<li>
Set a rectangle covering the area with top left corner coordinates 0,0
and size 100x77, setting a band of size 10:
<table><tr><td>&nbsp;</td><td><pre class="example">delogo=0:0:100:77:10
</pre></td></tr></table>

</li><li>
As the previous example, but use named options:
<table><tr><td>&nbsp;</td><td><pre class="example">delogo=x=0:y=0:w=100:h=77:band=10
</pre></td></tr></table>

</li></ul>

<a name="deshake"></a>
<h2 class="section"><a href="ffmpeg.html#toc-deshake">24.8 deshake</a></h2>

<p>Attempt to fix small changes in horizontal and/or vertical shift. This
filter helps remove camera shake from hand-holding a camera, bumping a
tripod, moving on a vehicle, etc.
</p>
<p>The filter accepts parameters as a string of the form
&quot;<var>x</var>:<var>y</var>:<var>w</var>:<var>h</var>:<var>rx</var>:<var>ry</var>:<var>edge</var>:<var>blocksize</var>:<var>contrast</var>:<var>search</var>:<var>filename</var>&quot;
</p>
<p>A description of the accepted parameters follows.
</p>
<dl compact="compact">
<dt> &lsquo;<samp>x, y, w, h</samp>&rsquo;</dt>
<dd><p>Specify a rectangular area where to limit the search for motion
vectors.
If desired the search for motion vectors can be limited to a
rectangular area of the frame defined by its top left corner, width
and height. These parameters have the same meaning as the drawbox
filter which can be used to visualise the position of the bounding
box.
</p>
<p>This is useful when simultaneous movement of subjects within the frame
might be confused for camera motion by the motion vector search.
</p>
<p>If any or all of <var>x</var>, <var>y</var>, <var>w</var> and <var>h</var> are set to -1
then the full frame is used. This allows later options to be set
without specifying the bounding box for the motion vector search.
</p>
<p>Default - search the whole frame.
</p>
</dd>
<dt> &lsquo;<samp>rx, ry</samp>&rsquo;</dt>
<dd><p>Specify the maximum extent of movement in x and y directions in the
range 0-64 pixels. Default 16.
</p>
</dd>
<dt> &lsquo;<samp>edge</samp>&rsquo;</dt>
<dd><p>Specify how to generate pixels to fill blanks at the edge of the
frame. An integer from 0 to 3 as follows:
</p><dl compact="compact">
<dt> &lsquo;<samp>0</samp>&rsquo;</dt>
<dd><p>Fill zeroes at blank locations
</p></dd>
<dt> &lsquo;<samp>1</samp>&rsquo;</dt>
<dd><p>Original image at blank locations
</p></dd>
<dt> &lsquo;<samp>2</samp>&rsquo;</dt>
<dd><p>Extruded edge value at blank locations
</p></dd>
<dt> &lsquo;<samp>3</samp>&rsquo;</dt>
<dd><p>Mirrored edge at blank locations
</p></dd>
</dl>

<p>The default setting is mirror edge at blank locations.
</p>
</dd>
<dt> &lsquo;<samp>blocksize</samp>&rsquo;</dt>
<dd><p>Specify the blocksize to use for motion search. Range 4-128 pixels,
default 8.
</p>
</dd>
<dt> &lsquo;<samp>contrast</samp>&rsquo;</dt>
<dd><p>Specify the contrast threshold for blocks. Only blocks with more than
the specified contrast (difference between darkest and lightest
pixels) will be considered. Range 1-255, default 125.
</p>
</dd>
<dt> &lsquo;<samp>search</samp>&rsquo;</dt>
<dd><p>Specify the search strategy 0 = exhaustive search, 1 = less exhaustive
search. Default - exhaustive search.
</p>
</dd>
<dt> &lsquo;<samp>filename</samp>&rsquo;</dt>
<dd><p>If set then a detailed log of the motion search is written to the
specified file.
</p>
</dd>
</dl>

<a name="drawbox"></a>
<h2 class="section"><a href="ffmpeg.html#toc-drawbox">24.9 drawbox</a></h2>

<p>Draw a colored box on the input image.
</p>
<p>It accepts the syntax:
</p><table><tr><td>&nbsp;</td><td><pre class="example">drawbox=<var>x</var>:<var>y</var>:<var>width</var>:<var>height</var>:<var>color</var>
</pre></td></tr></table>

<dl compact="compact">
<dt> &lsquo;<samp>x, y</samp>&rsquo;</dt>
<dd><p>Specify the top left corner coordinates of the box. Default to 0.
</p>
</dd>
<dt> &lsquo;<samp>width, height</samp>&rsquo;</dt>
<dd><p>Specify the width and height of the box, if 0 they are interpreted as
the input width and height. Default to 0.
</p>
</dd>
<dt> &lsquo;<samp>color</samp>&rsquo;</dt>
<dd><p>Specify the color of the box to write, it can be the name of a color
(case insensitive match) or a 0xRRGGBB[AA] sequence.
</p></dd>
</dl>

<p>Follow some examples:
</p><table><tr><td>&nbsp;</td><td><pre class="example"># draw a black box around the edge of the input image
drawbox

# draw a box with color red and an opacity of 50%
drawbox=10:20:200:60:red@0.5&quot;
</pre></td></tr></table>

<a name="drawtext"></a>
<h2 class="section"><a href="ffmpeg.html#toc-drawtext">24.10 drawtext</a></h2>

<p>Draw text string or text from specified file on top of video using the
libfreetype library.
</p>
<p>To enable compilation of this filter you need to configure FFmpeg with
<code>--enable-libfreetype</code>.
</p>
<p>The filter also recognizes strftime() sequences in the provided text
and expands them accordingly. Check the documentation of strftime().
</p>
<p>The filter accepts parameters as a list of <var>key</var>=<var>value</var> pairs,
separated by &quot;:&quot;.
</p>
<p>The description of the accepted parameters follows.
</p>
<dl compact="compact">
<dt> &lsquo;<samp>fontfile</samp>&rsquo;</dt>
<dd><p>The font file to be used for drawing text. Path must be included.
This parameter is mandatory.
</p>
</dd>
<dt> &lsquo;<samp>text</samp>&rsquo;</dt>
<dd><p>The text string to be drawn. The text must be a sequence of UTF-8
encoded characters.
This parameter is mandatory if no file is specified with the parameter
<var>textfile</var>.
</p>
</dd>
<dt> &lsquo;<samp>textfile</samp>&rsquo;</dt>
<dd><p>A text file containing text to be drawn. The text must be a sequence
of UTF-8 encoded characters.
</p>
<p>This parameter is mandatory if no text string is specified with the
parameter <var>text</var>.
</p>
<p>If both text and textfile are specified, an error is thrown.
</p>
</dd>
<dt> &lsquo;<samp>x, y</samp>&rsquo;</dt>
<dd><p>The expressions which specify the offsets where text will be drawn
within the video frame. They are relative to the top/left border of the
output image.
</p>
<p>The default value of <var>x</var> and <var>y</var> is &quot;0&quot;.
</p>
<p>See below for the list of accepted constants.
</p>
</dd>
<dt> &lsquo;<samp>fontsize</samp>&rsquo;</dt>
<dd><p>The font size to be used for drawing text.
The default value of <var>fontsize</var> is 16.
</p>
</dd>
<dt> &lsquo;<samp>fontcolor</samp>&rsquo;</dt>
<dd><p>The color to be used for drawing fonts.
Either a string (e.g. &quot;red&quot;) or in 0xRRGGBB[AA] format
(e.g. &quot;0xff000033&quot;), possibly followed by an alpha specifier.
The default value of <var>fontcolor</var> is &quot;black&quot;.
</p>
</dd>
<dt> &lsquo;<samp>boxcolor</samp>&rsquo;</dt>
<dd><p>The color to be used for drawing box around text.
Either a string (e.g. &quot;yellow&quot;) or in 0xRRGGBB[AA] format
(e.g. &quot;0xff00ff&quot;), possibly followed by an alpha specifier.
The default value of <var>boxcolor</var> is &quot;white&quot;.
</p>
</dd>
<dt> &lsquo;<samp>box</samp>&rsquo;</dt>
<dd><p>Used to draw a box around text using background color.
Value should be either 1 (enable) or 0 (disable).
The default value of <var>box</var> is 0.
</p>
</dd>
<dt> &lsquo;<samp>shadowx, shadowy</samp>&rsquo;</dt>
<dd><p>The x and y offsets for the text shadow position with respect to the
position of the text. They can be either positive or negative
values. Default value for both is &quot;0&quot;.
</p>
</dd>
<dt> &lsquo;<samp>shadowcolor</samp>&rsquo;</dt>
<dd><p>The color to be used for drawing a shadow behind the drawn text.  It
can be a color name (e.g. &quot;yellow&quot;) or a string in the 0xRRGGBB[AA]
form (e.g. &quot;0xff00ff&quot;), possibly followed by an alpha specifier.
The default value of <var>shadowcolor</var> is &quot;black&quot;.
</p>
</dd>
<dt> &lsquo;<samp>ft_load_flags</samp>&rsquo;</dt>
<dd><p>Flags to be used for loading the fonts.
</p>
<p>The flags map the corresponding flags supported by libfreetype, and are
a combination of the following values:
</p><dl compact="compact">
<dt> <var>default</var></dt>
<dt> <var>no_scale</var></dt>
<dt> <var>no_hinting</var></dt>
<dt> <var>render</var></dt>
<dt> <var>no_bitmap</var></dt>
<dt> <var>vertical_layout</var></dt>
<dt> <var>force_autohint</var></dt>
<dt> <var>crop_bitmap</var></dt>
<dt> <var>pedantic</var></dt>
<dt> <var>ignore_global_advance_width</var></dt>
<dt> <var>no_recurse</var></dt>
<dt> <var>ignore_transform</var></dt>
<dt> <var>monochrome</var></dt>
<dt> <var>linear_design</var></dt>
<dt> <var>no_autohint</var></dt>
<dt> <var>end table</var></dt>
</dl>

<p>Default value is &quot;render&quot;.
</p>
<p>For more information consult the documentation for the FT_LOAD_*
libfreetype flags.
</p>
</dd>
<dt> &lsquo;<samp>tabsize</samp>&rsquo;</dt>
<dd><p>The size in number of spaces to use for rendering the tab.
Default value is 4.
</p></dd>
</dl>

<p>The parameters for <var>x</var> and <var>y</var> are expressions containing the
following constants:
</p>
<dl compact="compact">
<dt> &lsquo;<samp>W, H</samp>&rsquo;</dt>
<dd><p>the input width and height
</p>
</dd>
<dt> &lsquo;<samp>tw, text_w</samp>&rsquo;</dt>
<dd><p>the width of the rendered text
</p>
</dd>
<dt> &lsquo;<samp>th, text_h</samp>&rsquo;</dt>
<dd><p>the height of the rendered text
</p>
</dd>
<dt> &lsquo;<samp>lh, line_h</samp>&rsquo;</dt>
<dd><p>the height of each text line
</p>
</dd>
<dt> &lsquo;<samp>sar</samp>&rsquo;</dt>
<dd><p>input sample aspect ratio
</p>
</dd>
<dt> &lsquo;<samp>dar</samp>&rsquo;</dt>
<dd><p>input display aspect ratio, it is the same as (<var>w</var> / <var>h</var>) * <var>sar</var>
</p>
</dd>
<dt> &lsquo;<samp>hsub, vsub</samp>&rsquo;</dt>
<dd><p>horizontal and vertical chroma subsample values. For example for the
pixel format &quot;yuv422p&quot; <var>hsub</var> is 2 and <var>vsub</var> is 1.
</p>
</dd>
<dt> &lsquo;<samp>max_glyph_w</samp>&rsquo;</dt>
<dd><p>maximum glyph width, that is the maximum width for all the glyphs
contained in the rendered text
</p>
</dd>
<dt> &lsquo;<samp>max_glyph_h</samp>&rsquo;</dt>
<dd><p>maximum glyph height, that is the maximum height for all the glyphs
contained in the rendered text, it is equivalent to <var>ascent</var> -
<var>descent</var>.
</p>
</dd>
<dt> &lsquo;<samp>max_glyph_a, ascent</samp>&rsquo;</dt>
<dd>
<p>the maximum distance from the baseline to the highest/upper grid
coordinate used to place a glyph outline point, for all the rendered
glyphs.
It is a positive value, due to the grid&rsquo;s orientation with the Y axis
upwards.
</p>
</dd>
<dt> &lsquo;<samp>max_glyph_d, descent</samp>&rsquo;</dt>
<dd><p>the maximum distance from the baseline to the lowest grid coordinate
used to place a glyph outline point, for all the rendered glyphs.
This is a negative value, due to the grid&rsquo;s orientation, with the Y axis
upwards.
</p>
</dd>
<dt> &lsquo;<samp>n</samp>&rsquo;</dt>
<dd><p>the number of input frame, starting from 0
</p>
</dd>
<dt> &lsquo;<samp>t</samp>&rsquo;</dt>
<dd><p>timestamp expressed in seconds, NAN if the input timestamp is unknown
</p>
</dd>
<dt> &lsquo;<samp>timecode</samp>&rsquo;</dt>
<dd><p>initial timecode representation in &quot;hh:mm:ss[:;.]ff&quot; format. It can be used
with or without text parameter. <var>rate</var> option must be specified.
Note that timecode options are <em>not</em> effective if FFmpeg is build with
<code>--disable-avcodec</code>.
</p>
</dd>
<dt> &lsquo;<samp>r, rate</samp>&rsquo;</dt>
<dd><p>frame rate (timecode only)
</p></dd>
</dl>

<p>Some examples follow.
</p>
<ul>
<li>
Draw &quot;Test Text&quot; with font FreeSerif, using the default values for the
optional parameters.

<table><tr><td>&nbsp;</td><td><pre class="example">drawtext=&quot;fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'&quot;
</pre></td></tr></table>

</li><li>
Draw &rsquo;Test Text&rsquo; with font FreeSerif of size 24 at position x=100
and y=50 (counting from the top-left corner of the screen), text is
yellow with a red box around it. Both the text and the box have an
opacity of 20%.

<table><tr><td>&nbsp;</td><td><pre class="example">drawtext=&quot;fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
          x=100: y=50: fontsize=24: fontcolor=yellow@0.2: box=1: boxcolor=red@0.2&quot;
</pre></td></tr></table>

<p>Note that the double quotes are not necessary if spaces are not used
within the parameter list.
</p>
</li><li>
Show the text at the center of the video frame:
<table><tr><td>&nbsp;</td><td><pre class="example">drawtext=fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h-line_h)/2&quot;
</pre></td></tr></table>

</li><li>
Show a text line sliding from right to left in the last row of the video
frame. The file &lsquo;<tt>LONG_LINE</tt>&rsquo; is assumed to contain a single line
with no newlines.
<table><tr><td>&nbsp;</td><td><pre class="example">drawtext=fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t
</pre></td></tr></table>

</li><li>
Show the content of file &lsquo;<tt>CREDITS</tt>&rsquo; off the bottom of the frame and scroll up.
<table><tr><td>&nbsp;</td><td><pre class="example">drawtext=fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t&quot;
</pre></td></tr></table>

</li><li>
Draw a single green letter &quot;g&quot;, at the center of the input video.
The glyph baseline is placed at half screen height.
<table><tr><td>&nbsp;</td><td><pre class="example">drawtext=fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent
</pre></td></tr></table>

</li></ul>

<p>For more information about libfreetype, check:
<a href="http://www.freetype.org/">http://www.freetype.org/</a>.
</p>
<a name="fade"></a>
<h2 class="section"><a href="ffmpeg.html#toc-fade">24.11 fade</a></h2>

<p>Apply fade-in/out effect to input video.
</p>
<p>It accepts the parameters:
<var>type</var>:<var>start_frame</var>:<var>nb_frames</var>[:<var>options</var>]
</p>
<p><var>type</var> specifies if the effect type, can be either &quot;in&quot; for
fade-in, or &quot;out&quot; for a fade-out effect.
</p>
<p><var>start_frame</var> specifies the number of the start frame for starting
to apply the fade effect.
</p>
<p><var>nb_frames</var> specifies the number of frames for which the fade
effect has to last. At the end of the fade-in effect the output video
will have the same intensity as the input video, at the end of the
fade-out transition the output video will be completely black.
</p>
<p><var>options</var> is an optional sequence of <var>key</var>=<var>value</var> pairs,
separated by &quot;:&quot;. The description of the accepted options follows.
</p>
<dl compact="compact">
<dt> &lsquo;<samp>type, t</samp>&rsquo;</dt>
<dd><p>See <var>type</var>.
</p>
</dd>
<dt> &lsquo;<samp>start_frame, s</samp>&rsquo;</dt>
<dd><p>See <var>start_frame</var>.
</p>
</dd>
<dt> &lsquo;<samp>nb_frames, n</samp>&rsquo;</dt>
<dd><p>See <var>nb_frames</var>.
</p>
</dd>
<dt> &lsquo;<samp>alpha</samp>&rsquo;</dt>
<dd><p>If set to 1, fade only alpha channel, if one exists on the input.
Default value is 0.
</p></dd>
</dl>

<p>A few usage examples follow, usable too as test scenarios.
</p><table><tr><td>&nbsp;</td><td><pre class="example"># fade in first 30 frames of video
fade=in:0:30

# fade out last 45 frames of a 200-frame video
fade=out:155:45

# fade in first 25 frames and fade out last 25 frames of a 1000-frame video
fade=in:0:25, fade=out:975:25

# make first 5 frames black, then fade in from frame 5-24
fade=in:5:20

# fade in alpha over first 25 frames of video
fade=in:0:25:alpha=1
</pre></td></tr></table>

<a name="fieldorder"></a>
<h2 class="section"><a href="ffmpeg.html#toc-fieldorder">24.12 fieldorder</a></h2>

<p>Transform the field order of the input video.
</p>
<p>It accepts one parameter which specifies the required field order that
the input interlaced video will be transformed to. The parameter can
assume one of the following values:
</p>
<dl compact="compact">
<dt> &lsquo;<samp>0 or bff</samp>&rsquo;</dt>
<dd><p>output bottom field first
</p></dd>
<dt> &lsquo;<samp>1 or tff</samp>&rsquo;</dt>
<dd><p>output top field first
</p></dd>
</dl>

<p>Default value is &quot;tff&quot;.
</p>
<p>Transformation is achieved by shifting the picture content up or down
by one line, and filling the remaining line with appropriate picture content.
This method is consistent with most broadcast field order converters.
</p>
<p>If the input video is not flagged as being interlaced, or it is already
flagged as being of the required output field order then this filter does
not alter the incoming video.
</p>
<p>This filter is very useful when converting to or from PAL DV material,
which is bottom field first.
</p>
<p>For example:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.vob -vf &quot;fieldorder=bff&quot; out.dv
</pre></td></tr></table>

<a name="fifo"></a>
<h2 class="section"><a href="ffmpeg.html#toc-fifo">24.13 fifo</a></h2>

<p>Buffer input images and send them when they are requested.
</p>
<p>This filter is mainly useful when auto-inserted by the libavfilter
framework.
</p>
<p>The filter does not take parameters.
</p>
<a name="format"></a>
<h2 class="section"><a href="ffmpeg.html#toc-format">24.14 format</a></h2>

<p>Convert the input video to one of the specified pixel formats.
Libavfilter will try to pick one that is supported for the input to
the next filter.
</p>
<p>The filter accepts a list of pixel format names, separated by &quot;:&quot;,
for example &quot;yuv420p:monow:rgb24&quot;.
</p>
<p>Some examples follow:
</p><table><tr><td>&nbsp;</td><td><pre class="example"># convert the input video to the format &quot;yuv420p&quot;
format=yuv420p

# convert the input video to any of the formats in the list
format=yuv420p:yuv444p:yuv410p
</pre></td></tr></table>

<p><a name="frei0r"></a>
</p><a name="frei0r-1"></a>
<h2 class="section"><a href="ffmpeg.html#toc-frei0r-1">24.15 frei0r</a></h2>

<p>Apply a frei0r effect to the input video.
</p>
<p>To enable compilation of this filter you need to install the frei0r
header and configure FFmpeg with <code>--enable-frei0r</code>.
</p>
<p>The filter supports the syntax:
</p><table><tr><td>&nbsp;</td><td><pre class="example"><var>filter_name</var>[{:|=}<var>param1</var>:<var>param2</var>:...:<var>paramN</var>]
</pre></td></tr></table>

<p><var>filter_name</var> is the name to the frei0r effect to load. If the
environment variable <code>FREI0R_PATH</code> is defined, the frei0r effect
is searched in each one of the directories specified by the colon
separated list in <code>FREIOR_PATH</code>, otherwise in the standard frei0r
paths, which are in this order: &lsquo;<tt>HOME/.frei0r-1/lib/</tt>&rsquo;,
&lsquo;<tt>/usr/local/lib/frei0r-1/</tt>&rsquo;, &lsquo;<tt>/usr/lib/frei0r-1/</tt>&rsquo;.
</p>
<p><var>param1</var>, <var>param2</var>, ... , <var>paramN</var> specify the parameters
for the frei0r effect.
</p>
<p>A frei0r effect parameter can be a boolean (whose values are specified
with &quot;y&quot; and &quot;n&quot;), a double, a color (specified by the syntax
<var>R</var>/<var>G</var>/<var>B</var>, <var>R</var>, <var>G</var>, and <var>B</var> being float
numbers from 0.0 to 1.0) or by an <code>av_parse_color()</code> color
description), a position (specified by the syntax <var>X</var>/<var>Y</var>,
<var>X</var> and <var>Y</var> being float numbers) and a string.
</p>
<p>The number and kind of parameters depend on the loaded effect. If an
effect parameter is not specified the default value is set.
</p>
<p>Some examples follow:
</p><table><tr><td>&nbsp;</td><td><pre class="example"># apply the distort0r effect, set the first two double parameters
frei0r=distort0r:0.5:0.01

# apply the colordistance effect, takes a color as first parameter
frei0r=colordistance:0.2/0.3/0.4
frei0r=colordistance:violet
frei0r=colordistance:0x112233

# apply the perspective effect, specify the top left and top right
# image positions
frei0r=perspective:0.2/0.2:0.8/0.2
</pre></td></tr></table>

<p>For more information see:
<a href="http://piksel.org/frei0r">http://piksel.org/frei0r</a>
</p>
<a name="gradfun"></a>
<h2 class="section"><a href="ffmpeg.html#toc-gradfun">24.16 gradfun</a></h2>

<p>Fix the banding artifacts that are sometimes introduced into nearly flat
regions by truncation to 8bit color depth.
Interpolate the gradients that should go where the bands are, and
dither them.
</p>
<p>This filter is designed for playback only.  Do not use it prior to
lossy compression, because compression tends to lose the dither and
bring back the bands.
</p>
<p>The filter takes two optional parameters, separated by &rsquo;:&rsquo;:
<var>strength</var>:<var>radius</var>
</p>
<p><var>strength</var> is the maximum amount by which the filter will change
any one pixel. Also the threshold for detecting nearly flat
regions. Acceptable values range from .51 to 255, default value is
1.2, out-of-range values will be clipped to the valid range.
</p>
<p><var>radius</var> is the neighborhood to fit the gradient to. A larger
radius makes for smoother gradients, but also prevents the filter from
modifying the pixels near detailed regions. Acceptable values are
8-32, default value is 16, out-of-range values will be clipped to the
valid range.
</p>
<table><tr><td>&nbsp;</td><td><pre class="example"># default parameters
gradfun=1.2:16

# omitting radius
gradfun=1.2
</pre></td></tr></table>

<a name="hflip"></a>
<h2 class="section"><a href="ffmpeg.html#toc-hflip">24.17 hflip</a></h2>

<p>Flip the input video horizontally.
</p>
<p>For example to horizontally flip the input video with <code>ffmpeg</code>:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.avi -vf &quot;hflip&quot; out.avi
</pre></td></tr></table>

<a name="hqdn3d"></a>
<h2 class="section"><a href="ffmpeg.html#toc-hqdn3d">24.18 hqdn3d</a></h2>

<p>High precision/quality 3d denoise filter. This filter aims to reduce
image noise producing smooth images and making still images really
still. It should enhance compressibility.
</p>
<p>It accepts the following optional parameters:
<var>luma_spatial</var>:<var>chroma_spatial</var>:<var>luma_tmp</var>:<var>chroma_tmp</var>
</p>
<dl compact="compact">
<dt> &lsquo;<samp>luma_spatial</samp>&rsquo;</dt>
<dd><p>a non-negative float number which specifies spatial luma strength,
defaults to 4.0
</p>
</dd>
<dt> &lsquo;<samp>chroma_spatial</samp>&rsquo;</dt>
<dd><p>a non-negative float number which specifies spatial chroma strength,
defaults to 3.0*<var>luma_spatial</var>/4.0
</p>
</dd>
<dt> &lsquo;<samp>luma_tmp</samp>&rsquo;</dt>
<dd><p>a float number which specifies luma temporal strength, defaults to
6.0*<var>luma_spatial</var>/4.0
</p>
</dd>
<dt> &lsquo;<samp>chroma_tmp</samp>&rsquo;</dt>
<dd><p>a float number which specifies chroma temporal strength, defaults to
<var>luma_tmp</var>*<var>chroma_spatial</var>/<var>luma_spatial</var>
</p></dd>
</dl>

<a name="lut_002c-lutrgb_002c-lutyuv"></a>
<h2 class="section"><a href="ffmpeg.html#toc-lut_002c-lutrgb_002c-lutyuv">24.19 lut, lutrgb, lutyuv</a></h2>

<p>Compute a look-up table for binding each pixel component input value
to an output value, and apply it to input video.
</p>
<p><var>lutyuv</var> applies a lookup table to a YUV input video, <var>lutrgb</var>
to an RGB input video.
</p>
<p>These filters accept in input a &quot;:&quot;-separated list of options, which
specify the expressions used for computing the lookup table for the
corresponding pixel component values.
</p>
<p>The <var>lut</var> filter requires either YUV or RGB pixel formats in
input, and accepts the options:
</p><dl compact="compact">
<dt> &lsquo;<samp>c0</samp>&rsquo;</dt>
<dd><p>first  pixel component
</p></dd>
<dt> &lsquo;<samp>c1</samp>&rsquo;</dt>
<dd><p>second pixel component
</p></dd>
<dt> &lsquo;<samp>c2</samp>&rsquo;</dt>
<dd><p>third  pixel component
</p></dd>
<dt> &lsquo;<samp>c3</samp>&rsquo;</dt>
<dd><p>fourth pixel component, corresponds to the alpha component
</p></dd>
</dl>

<p>The exact component associated to each option depends on the format in
input.
</p>
<p>The <var>lutrgb</var> filter requires RGB pixel formats in input, and
accepts the options:
</p><dl compact="compact">
<dt> &lsquo;<samp>r</samp>&rsquo;</dt>
<dd><p>red component
</p></dd>
<dt> &lsquo;<samp>g</samp>&rsquo;</dt>
<dd><p>green component
</p></dd>
<dt> &lsquo;<samp>b</samp>&rsquo;</dt>
<dd><p>blue component
</p></dd>
<dt> &lsquo;<samp>a</samp>&rsquo;</dt>
<dd><p>alpha component
</p></dd>
</dl>

<p>The <var>lutyuv</var> filter requires YUV pixel formats in input, and
accepts the options:
</p><dl compact="compact">
<dt> &lsquo;<samp>y</samp>&rsquo;</dt>
<dd><p>Y/luminance component
</p></dd>
<dt> &lsquo;<samp>u</samp>&rsquo;</dt>
<dd><p>U/Cb component
</p></dd>
<dt> &lsquo;<samp>v</samp>&rsquo;</dt>
<dd><p>V/Cr component
</p></dd>
<dt> &lsquo;<samp>a</samp>&rsquo;</dt>
<dd><p>alpha component
</p></dd>
</dl>

<p>The expressions can contain the following constants and functions:
</p>
<dl compact="compact">
<dt> &lsquo;<samp>w, h</samp>&rsquo;</dt>
<dd><p>the input width and height
</p>
</dd>
<dt> &lsquo;<samp>val</samp>&rsquo;</dt>
<dd><p>input value for the pixel component
</p>
</dd>
<dt> &lsquo;<samp>clipval</samp>&rsquo;</dt>
<dd><p>the input value clipped in the <var>minval</var>-<var>maxval</var> range
</p>
</dd>
<dt> &lsquo;<samp>maxval</samp>&rsquo;</dt>
<dd><p>maximum value for the pixel component
</p>
</dd>
<dt> &lsquo;<samp>minval</samp>&rsquo;</dt>
<dd><p>minimum value for the pixel component
</p>
</dd>
<dt> &lsquo;<samp>negval</samp>&rsquo;</dt>
<dd><p>the negated value for the pixel component value clipped in the
<var>minval</var>-<var>maxval</var> range , it corresponds to the expression
&quot;maxval-clipval+minval&quot;
</p>
</dd>
<dt> &lsquo;<samp>clip(val)</samp>&rsquo;</dt>
<dd><p>the computed value in <var>val</var> clipped in the
<var>minval</var>-<var>maxval</var> range
</p>
</dd>
<dt> &lsquo;<samp>gammaval(gamma)</samp>&rsquo;</dt>
<dd><p>the computed gamma correction value of the pixel component value
clipped in the <var>minval</var>-<var>maxval</var> range, corresponds to the
expression
&quot;pow((clipval-minval)/(maxval-minval)\,<var>gamma</var>)*(maxval-minval)+minval&quot;
</p>
</dd>
</dl>

<p>All expressions default to &quot;val&quot;.
</p>
<p>Some examples follow:
</p><table><tr><td>&nbsp;</td><td><pre class="example"># negate input video
lutrgb=&quot;r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val&quot;
lutyuv=&quot;y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val&quot;

# the above is the same as
lutrgb=&quot;r=negval:g=negval:b=negval&quot;
lutyuv=&quot;y=negval:u=negval:v=negval&quot;

# negate luminance
lutyuv=y=negval

# remove chroma components, turns the video into a graytone image
lutyuv=&quot;u=128:v=128&quot;

# apply a luma burning effect
lutyuv=&quot;y=2*val&quot;

# remove green and blue components
lutrgb=&quot;g=0:b=0&quot;

# set a constant alpha channel value on input
format=rgba,lutrgb=a=&quot;maxval-minval/2&quot;

# correct luminance gamma by a 0.5 factor
lutyuv=y=gammaval(0.5)
</pre></td></tr></table>

<a name="mp"></a>
<h2 class="section"><a href="ffmpeg.html#toc-mp">24.20 mp</a></h2>

<p>Apply an MPlayer filter to the input video.
</p>
<p>This filter provides a wrapper around most of the filters of
MPlayer/MEncoder.
</p>
<p>This wrapper is considered experimental. Some of the wrapped filters
may not work properly and we may drop support for them, as they will
be implemented natively into FFmpeg. Thus you should avoid
depending on them when writing portable scripts.
</p>
<p>The filters accepts the parameters:
<var>filter_name</var>[:=]<var>filter_params</var>
</p>
<p><var>filter_name</var> is the name of a supported MPlayer filter,
<var>filter_params</var> is a string containing the parameters accepted by
the named filter.
</p>
<p>The list of the currently supported filters follows:
</p><dl compact="compact">
<dt> <var>2xsai</var></dt>
<dt> <var>decimate</var></dt>
<dt> <var>denoise3d</var></dt>
<dt> <var>detc</var></dt>
<dt> <var>dint</var></dt>
<dt> <var>divtc</var></dt>
<dt> <var>down3dright</var></dt>
<dt> <var>dsize</var></dt>
<dt> <var>eq2</var></dt>
<dt> <var>eq</var></dt>
<dt> <var>field</var></dt>
<dt> <var>fil</var></dt>
<dt> <var>fixpts</var></dt>
<dt> <var>framestep</var></dt>
<dt> <var>fspp</var></dt>
<dt> <var>geq</var></dt>
<dt> <var>harddup</var></dt>
<dt> <var>hqdn3d</var></dt>
<dt> <var>hue</var></dt>
<dt> <var>il</var></dt>
<dt> <var>ilpack</var></dt>
<dt> <var>ivtc</var></dt>
<dt> <var>kerndeint</var></dt>
<dt> <var>mcdeint</var></dt>
<dt> <var>mirror</var></dt>
<dt> <var>noise</var></dt>
<dt> <var>ow</var></dt>
<dt> <var>palette</var></dt>
<dt> <var>perspective</var></dt>
<dt> <var>phase</var></dt>
<dt> <var>pp7</var></dt>
<dt> <var>pullup</var></dt>
<dt> <var>qp</var></dt>
<dt> <var>rectangle</var></dt>
<dt> <var>remove-logo</var></dt>
<dt> <var>rotate</var></dt>
<dt> <var>sab</var></dt>
<dt> <var>screenshot</var></dt>
<dt> <var>smartblur</var></dt>
<dt> <var>softpulldown</var></dt>
<dt> <var>softskip</var></dt>
<dt> <var>spp</var></dt>
<dt> <var>swapuv</var></dt>
<dt> <var>telecine</var></dt>
<dt> <var>tile</var></dt>
<dt> <var>tinterlace</var></dt>
<dt> <var>unsharp</var></dt>
<dt> <var>uspp</var></dt>
<dt> <var>yuvcsp</var></dt>
<dt> <var>yvu9</var></dt>
</dl>

<p>The parameter syntax and behavior for the listed filters are the same
of the corresponding MPlayer filters. For detailed instructions check
the &quot;VIDEO FILTERS&quot; section in the MPlayer manual.
</p>
<p>Some examples follow:
</p><table><tr><td>&nbsp;</td><td><pre class="example"># remove a logo by interpolating the surrounding pixels
mp=delogo=200:200:80:20:1

# adjust gamma, brightness, contrast
mp=eq2=1.0:2:0.5

# tweak hue and saturation
mp=hue=100:-10
</pre></td></tr></table>

<p>See also mplayer(1), <a href="http://www.mplayerhq.hu/">http://www.mplayerhq.hu/</a>.
</p>
<a name="negate"></a>
<h2 class="section"><a href="ffmpeg.html#toc-negate">24.21 negate</a></h2>

<p>Negate input video.
</p>
<p>This filter accepts an integer in input, if non-zero it negates the
alpha component (if available). The default value in input is 0.
</p>
<a name="noformat"></a>
<h2 class="section"><a href="ffmpeg.html#toc-noformat">24.22 noformat</a></h2>

<p>Force libavfilter not to use any of the specified pixel formats for the
input to the next filter.
</p>
<p>The filter accepts a list of pixel format names, separated by &quot;:&quot;,
for example &quot;yuv420p:monow:rgb24&quot;.
</p>
<p>Some examples follow:
</p><table><tr><td>&nbsp;</td><td><pre class="example"># force libavfilter to use a format different from &quot;yuv420p&quot; for the
# input to the vflip filter
noformat=yuv420p,vflip

# convert the input video to any of the formats not contained in the list
noformat=yuv420p:yuv444p:yuv410p
</pre></td></tr></table>

<a name="null-1"></a>
<h2 class="section"><a href="ffmpeg.html#toc-null-1">24.23 null</a></h2>

<p>Pass the video source unchanged to the output.
</p>
<a name="ocv"></a>
<h2 class="section"><a href="ffmpeg.html#toc-ocv">24.24 ocv</a></h2>

<p>Apply video transform using libopencv.
</p>
<p>To enable this filter install libopencv library and headers and
configure FFmpeg with <code>--enable-libopencv</code>.
</p>
<p>The filter takes the parameters: <var>filter_name</var>{:=}<var>filter_params</var>.
</p>
<p><var>filter_name</var> is the name of the libopencv filter to apply.
</p>
<p><var>filter_params</var> specifies the parameters to pass to the libopencv
filter. If not specified the default values are assumed.
</p>
<p>Refer to the official libopencv documentation for more precise
information:
<a href="http://opencv.willowgarage.com/documentation/c/image_filtering.html">http://opencv.willowgarage.com/documentation/c/image_filtering.html</a>
</p>
<p>Follows the list of supported libopencv filters.
</p>
<p><a name="dilate"></a>
</p><a name="dilate-1"></a>
<h3 class="subsection"><a href="ffmpeg.html#toc-dilate-1">24.24.1 dilate</a></h3>

<p>Dilate an image by using a specific structuring element.
This filter corresponds to the libopencv function <code>cvDilate</code>.
</p>
<p>It accepts the parameters: <var>struct_el</var>:<var>nb_iterations</var>.
</p>
<p><var>struct_el</var> represents a structuring element, and has the syntax:
<var>cols</var>x<var>rows</var>+<var>anchor_x</var>x<var>anchor_y</var>/<var>shape</var>
</p>
<p><var>cols</var> and <var>rows</var> represent the number of columns and rows of
the structuring element, <var>anchor_x</var> and <var>anchor_y</var> the anchor
point, and <var>shape</var> the shape for the structuring element, and
can be one of the values &quot;rect&quot;, &quot;cross&quot;, &quot;ellipse&quot;, &quot;custom&quot;.
</p>
<p>If the value for <var>shape</var> is &quot;custom&quot;, it must be followed by a
string of the form &quot;=<var>filename</var>&quot;. The file with name
<var>filename</var> is assumed to represent a binary image, with each
printable character corresponding to a bright pixel. When a custom
<var>shape</var> is used, <var>cols</var> and <var>rows</var> are ignored, the number
or columns and rows of the read file are assumed instead.
</p>
<p>The default value for <var>struct_el</var> is &quot;3x3+0x0/rect&quot;.
</p>
<p><var>nb_iterations</var> specifies the number of times the transform is
applied to the image, and defaults to 1.
</p>
<p>Follow some example:
</p><table><tr><td>&nbsp;</td><td><pre class="example"># use the default values
ocv=dilate

# dilate using a structuring element with a 5x5 cross, iterate two times
ocv=dilate=5x5+2x2/cross:2

# read the shape from the file diamond.shape, iterate two times
# the file diamond.shape may contain a pattern of characters like this:
#   *
#  ***
# *****
#  ***
#   *
# the specified cols and rows are ignored (but not the anchor point coordinates)
ocv=0x0+2x2/custom=diamond.shape:2
</pre></td></tr></table>

<a name="erode"></a>
<h3 class="subsection"><a href="ffmpeg.html#toc-erode">24.24.2 erode</a></h3>

<p>Erode an image by using a specific structuring element.
This filter corresponds to the libopencv function <code>cvErode</code>.
</p>
<p>The filter accepts the parameters: <var>struct_el</var>:<var>nb_iterations</var>,
with the same syntax and semantics as the <a href="#dilate">dilate</a> filter.
</p>
<a name="smooth"></a>
<h3 class="subsection"><a href="ffmpeg.html#toc-smooth">24.24.3 smooth</a></h3>

<p>Smooth the input video.
</p>
<p>The filter takes the following parameters:
<var>type</var>:<var>param1</var>:<var>param2</var>:<var>param3</var>:<var>param4</var>.
</p>
<p><var>type</var> is the type of smooth filter to apply, and can be one of
the following values: &quot;blur&quot;, &quot;blur_no_scale&quot;, &quot;median&quot;, &quot;gaussian&quot;,
&quot;bilateral&quot;. The default value is &quot;gaussian&quot;.
</p>
<p><var>param1</var>, <var>param2</var>, <var>param3</var>, and <var>param4</var> are
parameters whose meanings depend on smooth type. <var>param1</var> and
<var>param2</var> accept integer positive values or 0, <var>param3</var> and
<var>param4</var> accept float values.
</p>
<p>The default value for <var>param1</var> is 3, the default value for the
other parameters is 0.
</p>
<p>These parameters correspond to the parameters assigned to the
libopencv function <code>cvSmooth</code>.
</p>
<p><a name="overlay"></a>
</p><a name="overlay-1"></a>
<h2 class="section"><a href="ffmpeg.html#toc-overlay-1">24.25 overlay</a></h2>

<p>Overlay one video on top of another.
</p>
<p>It takes two inputs and one output, the first input is the &quot;main&quot;
video on which the second input is overlayed.
</p>
<p>It accepts the parameters: <var>x</var>:<var>y</var>[:<var>options</var>].
</p>
<p><var>x</var> is the x coordinate of the overlayed video on the main video,
<var>y</var> is the y coordinate. <var>x</var> and <var>y</var> are expressions containing
the following parameters:
</p>
<dl compact="compact">
<dt> &lsquo;<samp>main_w, main_h</samp>&rsquo;</dt>
<dd><p>main input width and height
</p>
</dd>
<dt> &lsquo;<samp>W, H</samp>&rsquo;</dt>
<dd><p>same as <var>main_w</var> and <var>main_h</var>
</p>
</dd>
<dt> &lsquo;<samp>overlay_w, overlay_h</samp>&rsquo;</dt>
<dd><p>overlay input width and height
</p>
</dd>
<dt> &lsquo;<samp>w, h</samp>&rsquo;</dt>
<dd><p>same as <var>overlay_w</var> and <var>overlay_h</var>
</p></dd>
</dl>

<p><var>options</var> is an optional list of <var>key</var>=<var>value</var> pairs,
separated by &quot;:&quot;.
</p>
<p>The description of the accepted options follows.
</p>
<dl compact="compact">
<dt> &lsquo;<samp>rgb</samp>&rsquo;</dt>
<dd><p>If set to 1, force the filter to accept inputs in the RGB
color space. Default value is 0.
</p></dd>
</dl>

<p>Be aware that frames are taken from each input video in timestamp
order, hence, if their initial timestamps differ, it is a a good idea
to pass the two inputs through a <var>setpts=PTS-STARTPTS</var> filter to
have them begin in the same zero timestamp, as it does the example for
the <var>movie</var> filter.
</p>
<p>Follow some examples:
</p><table><tr><td>&nbsp;</td><td><pre class="example"># draw the overlay at 10 pixels from the bottom right
# corner of the main video.
overlay=main_w-overlay_w-10:main_h-overlay_h-10

# insert a transparent PNG logo in the bottom left corner of the input
movie=logo.png [logo];
[in][logo] overlay=10:main_h-overlay_h-10 [out]

# insert 2 different transparent PNG logos (second logo on bottom
# right corner):
movie=logo1.png [logo1];
movie=logo2.png [logo2];
[in][logo1]       overlay=10:H-h-10 [in+logo1];
[in+logo1][logo2] overlay=W-w-10:H-h-10 [out]

# add a transparent color layer on top of the main video,
# WxH specifies the size of the main input to the overlay filter
color=red.3:WxH [over]; [in][over] overlay [out]
</pre></td></tr></table>

<p>You can chain together more overlays but the efficiency of such
approach is yet to be tested.
</p>
<a name="pad"></a>
<h2 class="section"><a href="ffmpeg.html#toc-pad">24.26 pad</a></h2>

<p>Add paddings to the input image, and places the original input at the
given coordinates <var>x</var>, <var>y</var>.
</p>
<p>It accepts the following parameters:
<var>width</var>:<var>height</var>:<var>x</var>:<var>y</var>:<var>color</var>.
</p>
<p>The parameters <var>width</var>, <var>height</var>, <var>x</var>, and <var>y</var> are
expressions containing the following constants:
</p>
<dl compact="compact">
<dt> &lsquo;<samp>in_w, in_h</samp>&rsquo;</dt>
<dd><p>the input video width and height
</p>
</dd>
<dt> &lsquo;<samp>iw, ih</samp>&rsquo;</dt>
<dd><p>same as <var>in_w</var> and <var>in_h</var>
</p>
</dd>
<dt> &lsquo;<samp>out_w, out_h</samp>&rsquo;</dt>
<dd><p>the output width and height, that is the size of the padded area as
specified by the <var>width</var> and <var>height</var> expressions
</p>
</dd>
<dt> &lsquo;<samp>ow, oh</samp>&rsquo;</dt>
<dd><p>same as <var>out_w</var> and <var>out_h</var>
</p>
</dd>
<dt> &lsquo;<samp>x, y</samp>&rsquo;</dt>
<dd><p>x and y offsets as specified by the <var>x</var> and <var>y</var>
expressions, or NAN if not yet specified
</p>
</dd>
<dt> &lsquo;<samp>a</samp>&rsquo;</dt>
<dd><p>same as <var>iw</var> / <var>ih</var>
</p>
</dd>
<dt> &lsquo;<samp>sar</samp>&rsquo;</dt>
<dd><p>input sample aspect ratio
</p>
</dd>
<dt> &lsquo;<samp>dar</samp>&rsquo;</dt>
<dd><p>input display aspect ratio, it is the same as (<var>iw</var> / <var>ih</var>) * <var>sar</var>
</p>
</dd>
<dt> &lsquo;<samp>hsub, vsub</samp>&rsquo;</dt>
<dd><p>horizontal and vertical chroma subsample values. For example for the
pixel format &quot;yuv422p&quot; <var>hsub</var> is 2 and <var>vsub</var> is 1.
</p></dd>
</dl>

<p>Follows the description of the accepted parameters.
</p>
<dl compact="compact">
<dt> &lsquo;<samp>width, height</samp>&rsquo;</dt>
<dd>
<p>Specify the size of the output image with the paddings added. If the
value for <var>width</var> or <var>height</var> is 0, the corresponding input size
is used for the output.
</p>
<p>The <var>width</var> expression can reference the value set by the
<var>height</var> expression, and vice versa.
</p>
<p>The default value of <var>width</var> and <var>height</var> is 0.
</p>
</dd>
<dt> &lsquo;<samp>x, y</samp>&rsquo;</dt>
<dd>
<p>Specify the offsets where to place the input image in the padded area
with respect to the top/left border of the output image.
</p>
<p>The <var>x</var> expression can reference the value set by the <var>y</var>
expression, and vice versa.
</p>
<p>The default value of <var>x</var> and <var>y</var> is 0.
</p>
</dd>
<dt> &lsquo;<samp>color</samp>&rsquo;</dt>
<dd>
<p>Specify the color of the padded area, it can be the name of a color
(case insensitive match) or a 0xRRGGBB[AA] sequence.
</p>
<p>The default value of <var>color</var> is &quot;black&quot;.
</p>
</dd>
</dl>

<p>Some examples follow:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example"># Add paddings with color &quot;violet&quot; to the input video. Output video
# size is 640x480, the top-left corner of the input video is placed at
# column 0, row 40.
pad=640:480:0:40:violet

# pad the input to get an output with dimensions increased bt 3/2,
# and put the input video at the center of the padded area
pad=&quot;3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2&quot;

# pad the input to get a squared output with size equal to the maximum
# value between the input width and height, and put the input video at
# the center of the padded area
pad=&quot;max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2&quot;

# pad the input to get a final w/h ratio of 16:9
pad=&quot;ih*16/9:ih:(ow-iw)/2:(oh-ih)/2&quot;

# for anamorphic video, in order to set the output display aspect ratio,
# it is necessary to use sar in the expression, according to the relation:
# (ih * X / ih) * sar = output_dar
# X = output_dar / sar
pad=&quot;ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2&quot;

# double output size and put the input video in the bottom-right
# corner of the output padded area
pad=&quot;2*iw:2*ih:ow-iw:oh-ih&quot;
</pre></td></tr></table>

<a name="pixdesctest"></a>
<h2 class="section"><a href="ffmpeg.html#toc-pixdesctest">24.27 pixdesctest</a></h2>

<p>Pixel format descriptor test filter, mainly useful for internal
testing. The output video should be equal to the input video.
</p>
<p>For example:
</p><table><tr><td>&nbsp;</td><td><pre class="example">format=monow, pixdesctest
</pre></td></tr></table>

<p>can be used to test the monowhite pixel format descriptor definition.
</p>
<a name="scale"></a>
<h2 class="section"><a href="ffmpeg.html#toc-scale">24.28 scale</a></h2>

<p>Scale the input video to <var>width</var>:<var>height</var>[:<var>interl</var>={1|-1}] and/or convert the image format.
</p>
<p>The parameters <var>width</var> and <var>height</var> are expressions containing
the following constants:
</p>
<dl compact="compact">
<dt> &lsquo;<samp>in_w, in_h</samp>&rsquo;</dt>
<dd><p>the input width and height
</p>
</dd>
<dt> &lsquo;<samp>iw, ih</samp>&rsquo;</dt>
<dd><p>same as <var>in_w</var> and <var>in_h</var>
</p>
</dd>
<dt> &lsquo;<samp>out_w, out_h</samp>&rsquo;</dt>
<dd><p>the output (cropped) width and height
</p>
</dd>
<dt> &lsquo;<samp>ow, oh</samp>&rsquo;</dt>
<dd><p>same as <var>out_w</var> and <var>out_h</var>
</p>
</dd>
<dt> &lsquo;<samp>a</samp>&rsquo;</dt>
<dd><p>same as <var>iw</var> / <var>ih</var>
</p>
</dd>
<dt> &lsquo;<samp>sar</samp>&rsquo;</dt>
<dd><p>input sample aspect ratio
</p>
</dd>
<dt> &lsquo;<samp>dar</samp>&rsquo;</dt>
<dd><p>input display aspect ratio, it is the same as (<var>iw</var> / <var>ih</var>) * <var>sar</var>
</p>
</dd>
<dt> &lsquo;<samp>hsub, vsub</samp>&rsquo;</dt>
<dd><p>horizontal and vertical chroma subsample values. For example for the
pixel format &quot;yuv422p&quot; <var>hsub</var> is 2 and <var>vsub</var> is 1.
</p></dd>
</dl>

<p>If the input image format is different from the format requested by
the next filter, the scale filter will convert the input to the
requested format.
</p>
<p>If the value for <var>width</var> or <var>height</var> is 0, the respective input
size is used for the output.
</p>
<p>If the value for <var>width</var> or <var>height</var> is -1, the scale filter will
use, for the respective output size, a value that maintains the aspect
ratio of the input image.
</p>
<p>The default value of <var>width</var> and <var>height</var> is 0.
</p>
<p>Valid values for the optional parameter <var>interl</var> are:
</p>
<dl compact="compact">
<dt> &lsquo;<samp>1</samp>&rsquo;</dt>
<dd><p>force interlaced aware scaling
</p>
</dd>
<dt> &lsquo;<samp>-1</samp>&rsquo;</dt>
<dd><p>select interlaced aware scaling depending on whether the source frames
are flagged as interlaced or not
</p></dd>
</dl>

<p>Some examples follow:
</p><table><tr><td>&nbsp;</td><td><pre class="example"># scale the input video to a size of 200x100.
scale=200:100

# scale the input to 2x
scale=2*iw:2*ih
# the above is the same as
scale=2*in_w:2*in_h

# scale the input to half size
scale=iw/2:ih/2

# increase the width, and set the height to the same size
scale=3/2*iw:ow

# seek for Greek harmony
scale=iw:1/PHI*iw
scale=ih*PHI:ih

# increase the height, and set the width to 3/2 of the height
scale=3/2*oh:3/5*ih

# increase the size, but make the size a multiple of the chroma
scale=&quot;trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub&quot;

# increase the width to a maximum of 500 pixels, keep the same input aspect ratio
scale='min(500\, iw*3/2):-1'
</pre></td></tr></table>

<a name="select"></a>
<h2 class="section"><a href="ffmpeg.html#toc-select">24.29 select</a></h2>
<p>Select frames to pass in output.
</p>
<p>It accepts in input an expression, which is evaluated for each input
frame. If the expression is evaluated to a non-zero value, the frame
is selected and passed to the output, otherwise it is discarded.
</p>
<p>The expression can contain the following constants:
</p>
<dl compact="compact">
<dt> &lsquo;<samp>n</samp>&rsquo;</dt>
<dd><p>the sequential number of the filtered frame, starting from 0
</p>
</dd>
<dt> &lsquo;<samp>selected_n</samp>&rsquo;</dt>
<dd><p>the sequential number of the selected frame, starting from 0
</p>
</dd>
<dt> &lsquo;<samp>prev_selected_n</samp>&rsquo;</dt>
<dd><p>the sequential number of the last selected frame, NAN if undefined
</p>
</dd>
<dt> &lsquo;<samp>TB</samp>&rsquo;</dt>
<dd><p>timebase of the input timestamps
</p>
</dd>
<dt> &lsquo;<samp>pts</samp>&rsquo;</dt>
<dd><p>the PTS (Presentation TimeStamp) of the filtered video frame,
expressed in <var>TB</var> units, NAN if undefined
</p>
</dd>
<dt> &lsquo;<samp>t</samp>&rsquo;</dt>
<dd><p>the PTS (Presentation TimeStamp) of the filtered video frame,
expressed in seconds, NAN if undefined
</p>
</dd>
<dt> &lsquo;<samp>prev_pts</samp>&rsquo;</dt>
<dd><p>the PTS of the previously filtered video frame, NAN if undefined
</p>
</dd>
<dt> &lsquo;<samp>prev_selected_pts</samp>&rsquo;</dt>
<dd><p>the PTS of the last previously filtered video frame, NAN if undefined
</p>
</dd>
<dt> &lsquo;<samp>prev_selected_t</samp>&rsquo;</dt>
<dd><p>the PTS of the last previously selected video frame, NAN if undefined
</p>
</dd>
<dt> &lsquo;<samp>start_pts</samp>&rsquo;</dt>
<dd><p>the PTS of the first video frame in the video, NAN if undefined
</p>
</dd>
<dt> &lsquo;<samp>start_t</samp>&rsquo;</dt>
<dd><p>the time of the first video frame in the video, NAN if undefined
</p>
</dd>
<dt> &lsquo;<samp>pict_type</samp>&rsquo;</dt>
<dd><p>the type of the filtered frame, can assume one of the following
values:
</p><dl compact="compact">
<dt> &lsquo;<samp>I</samp>&rsquo;</dt>
<dt> &lsquo;<samp>P</samp>&rsquo;</dt>
<dt> &lsquo;<samp>B</samp>&rsquo;</dt>
<dt> &lsquo;<samp>S</samp>&rsquo;</dt>
<dt> &lsquo;<samp>SI</samp>&rsquo;</dt>
<dt> &lsquo;<samp>SP</samp>&rsquo;</dt>
<dt> &lsquo;<samp>BI</samp>&rsquo;</dt>
</dl>

</dd>
<dt> &lsquo;<samp>interlace_type</samp>&rsquo;</dt>
<dd><p>the frame interlace type, can assume one of the following values:
</p><dl compact="compact">
<dt> &lsquo;<samp>PROGRESSIVE</samp>&rsquo;</dt>
<dd><p>the frame is progressive (not interlaced)
</p></dd>
<dt> &lsquo;<samp>TOPFIRST</samp>&rsquo;</dt>
<dd><p>the frame is top-field-first
</p></dd>
<dt> &lsquo;<samp>BOTTOMFIRST</samp>&rsquo;</dt>
<dd><p>the frame is bottom-field-first
</p></dd>
</dl>

</dd>
<dt> &lsquo;<samp>key</samp>&rsquo;</dt>
<dd><p>1 if the filtered frame is a key-frame, 0 otherwise
</p>
</dd>
<dt> &lsquo;<samp>pos</samp>&rsquo;</dt>
<dd><p>the position in the file of the filtered frame, -1 if the information
is not available (e.g. for synthetic video)
</p></dd>
</dl>

<p>The default value of the select expression is &quot;1&quot;.
</p>
<p>Some examples follow:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example"># select all frames in input
select

# the above is the same as:
select=1

# skip all frames:
select=0

# select only I-frames
select='eq(pict_type\,I)'

# select one frame every 100
select='not(mod(n\,100))'

# select only frames contained in the 10-20 time interval
select='gte(t\,10)*lte(t\,20)'

# select only I frames contained in the 10-20 time interval
select='gte(t\,10)*lte(t\,20)*eq(pict_type\,I)'

# select frames with a minimum distance of 10 seconds
select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
</pre></td></tr></table>

<p><a name="setdar"></a>
</p><a name="setdar-1"></a>
<h2 class="section"><a href="ffmpeg.html#toc-setdar-1">24.30 setdar</a></h2>

<p>Set the Display Aspect Ratio for the filter output video.
</p>
<p>This is done by changing the specified Sample (aka Pixel) Aspect
Ratio, according to the following equation:
<em>DAR = HORIZONTAL_RESOLUTION / VERTICAL_RESOLUTION * SAR</em>
</p>
<p>Keep in mind that this filter does not modify the pixel dimensions of
the video frame. Also the display aspect ratio set by this filter may
be changed by later filters in the filterchain, e.g. in case of
scaling or if another &quot;setdar&quot; or a &quot;setsar&quot; filter is applied.
</p>
<p>The filter accepts a parameter string which represents the wanted
display aspect ratio.
The parameter can be a floating point number string, or an expression
of the form <var>num</var>:<var>den</var>, where <var>num</var> and <var>den</var> are the
numerator and denominator of the aspect ratio.
If the parameter is not specified, it is assumed the value &quot;0:1&quot;.
</p>
<p>For example to change the display aspect ratio to 16:9, specify:
</p><table><tr><td>&nbsp;</td><td><pre class="example">setdar=16:9
# the above is equivalent to
setdar=1.77777
</pre></td></tr></table>

<p>See also the <a href="#setsar">setsar</a> filter documentation.
</p>
<a name="setpts"></a>
<h2 class="section"><a href="ffmpeg.html#toc-setpts">24.31 setpts</a></h2>

<p>Change the PTS (presentation timestamp) of the input video frames.
</p>
<p>Accept in input an expression evaluated through the eval API, which
can contain the following constants:
</p>
<dl compact="compact">
<dt> &lsquo;<samp>PTS</samp>&rsquo;</dt>
<dd><p>the presentation timestamp in input
</p>
</dd>
<dt> &lsquo;<samp>N</samp>&rsquo;</dt>
<dd><p>the count of the input frame, starting from 0.
</p>
</dd>
<dt> &lsquo;<samp>STARTPTS</samp>&rsquo;</dt>
<dd><p>the PTS of the first video frame
</p>
</dd>
<dt> &lsquo;<samp>INTERLACED</samp>&rsquo;</dt>
<dd><p>tell if the current frame is interlaced
</p>
</dd>
<dt> &lsquo;<samp>POS</samp>&rsquo;</dt>
<dd><p>original position in the file of the frame, or undefined if undefined
for the current frame
</p>
</dd>
<dt> &lsquo;<samp>PREV_INPTS</samp>&rsquo;</dt>
<dd><p>previous input PTS
</p>
</dd>
<dt> &lsquo;<samp>PREV_OUTPTS</samp>&rsquo;</dt>
<dd><p>previous output PTS
</p>
</dd>
</dl>

<p>Some examples follow:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example"># start counting PTS from zero
setpts=PTS-STARTPTS

# fast motion
setpts=0.5*PTS

# slow motion
setpts=2.0*PTS

# fixed rate 25 fps
setpts=N/(25*TB)

# fixed rate 25 fps with some jitter
setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
</pre></td></tr></table>

<p><a name="setsar"></a>
</p><a name="setsar-1"></a>
<h2 class="section"><a href="ffmpeg.html#toc-setsar-1">24.32 setsar</a></h2>

<p>Set the Sample (aka Pixel) Aspect Ratio for the filter output video.
</p>
<p>Note that as a consequence of the application of this filter, the
output display aspect ratio will change according to the following
equation:
<em>DAR = HORIZONTAL_RESOLUTION / VERTICAL_RESOLUTION * SAR</em>
</p>
<p>Keep in mind that the sample aspect ratio set by this filter may be
changed by later filters in the filterchain, e.g. if another &quot;setsar&quot;
or a &quot;setdar&quot; filter is applied.
</p>
<p>The filter accepts a parameter string which represents the wanted
sample aspect ratio.
The parameter can be a floating point number string, or an expression
of the form <var>num</var>:<var>den</var>, where <var>num</var> and <var>den</var> are the
numerator and denominator of the aspect ratio.
If the parameter is not specified, it is assumed the value &quot;0:1&quot;.
</p>
<p>For example to change the sample aspect ratio to 10:11, specify:
</p><table><tr><td>&nbsp;</td><td><pre class="example">setsar=10:11
</pre></td></tr></table>

<a name="settb"></a>
<h2 class="section"><a href="ffmpeg.html#toc-settb">24.33 settb</a></h2>

<p>Set the timebase to use for the output frames timestamps.
It is mainly useful for testing timebase configuration.
</p>
<p>It accepts in input an arithmetic expression representing a rational.
The expression can contain the constants &quot;AVTB&quot; (the
default timebase), and &quot;intb&quot; (the input timebase).
</p>
<p>The default value for the input is &quot;intb&quot;.
</p>
<p>Follow some examples.
</p>
<table><tr><td>&nbsp;</td><td><pre class="example"># set the timebase to 1/25
settb=1/25

# set the timebase to 1/10
settb=0.1

#set the timebase to 1001/1000
settb=1+0.001

#set the timebase to 2*intb
settb=2*intb

#set the default timebase value
settb=AVTB
</pre></td></tr></table>

<a name="showinfo"></a>
<h2 class="section"><a href="ffmpeg.html#toc-showinfo">24.34 showinfo</a></h2>

<p>Show a line containing various information for each input video frame.
The input video is not modified.
</p>
<p>The shown line contains a sequence of key/value pairs of the form
<var>key</var>:<var>value</var>.
</p>
<p>A description of each shown parameter follows:
</p>
<dl compact="compact">
<dt> &lsquo;<samp>n</samp>&rsquo;</dt>
<dd><p>sequential number of the input frame, starting from 0
</p>
</dd>
<dt> &lsquo;<samp>pts</samp>&rsquo;</dt>
<dd><p>Presentation TimeStamp of the input frame, expressed as a number of
time base units. The time base unit depends on the filter input pad.
</p>
</dd>
<dt> &lsquo;<samp>pts_time</samp>&rsquo;</dt>
<dd><p>Presentation TimeStamp of the input frame, expressed as a number of
seconds
</p>
</dd>
<dt> &lsquo;<samp>pos</samp>&rsquo;</dt>
<dd><p>position of the frame in the input stream, -1 if this information in
unavailable and/or meaningless (for example in case of synthetic video)
</p>
</dd>
<dt> &lsquo;<samp>fmt</samp>&rsquo;</dt>
<dd><p>pixel format name
</p>
</dd>
<dt> &lsquo;<samp>sar</samp>&rsquo;</dt>
<dd><p>sample aspect ratio of the input frame, expressed in the form
<var>num</var>/<var>den</var>
</p>
</dd>
<dt> &lsquo;<samp>s</samp>&rsquo;</dt>
<dd><p>size of the input frame, expressed in the form
<var>width</var>x<var>height</var>
</p>
</dd>
<dt> &lsquo;<samp>i</samp>&rsquo;</dt>
<dd><p>interlaced mode (&quot;P&quot; for &quot;progressive&quot;, &quot;T&quot; for top field first, &quot;B&quot;
for bottom field first)
</p>
</dd>
<dt> &lsquo;<samp>iskey</samp>&rsquo;</dt>
<dd><p>1 if the frame is a key frame, 0 otherwise
</p>
</dd>
<dt> &lsquo;<samp>type</samp>&rsquo;</dt>
<dd><p>picture type of the input frame (&quot;I&quot; for an I-frame, &quot;P&quot; for a
P-frame, &quot;B&quot; for a B-frame, &quot;?&quot; for unknown type).
Check also the documentation of the <code>AVPictureType</code> enum and of
the <code>av_get_picture_type_char</code> function defined in
&lsquo;<tt>libavutil/avutil.h</tt>&rsquo;.
</p>
</dd>
<dt> &lsquo;<samp>checksum</samp>&rsquo;</dt>
<dd><p>Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame
</p>
</dd>
<dt> &lsquo;<samp>plane_checksum</samp>&rsquo;</dt>
<dd><p>Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
expressed in the form &quot;[<var>c0</var> <var>c1</var> <var>c2</var> <var>c3</var>]&quot;
</p></dd>
</dl>

<a name="slicify"></a>
<h2 class="section"><a href="ffmpeg.html#toc-slicify">24.35 slicify</a></h2>

<p>Pass the images of input video on to next video filter as multiple
slices.
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.avi -vf &quot;slicify=32&quot; out.avi
</pre></td></tr></table>

<p>The filter accepts the slice height as parameter. If the parameter is
not specified it will use the default value of 16.
</p>
<p>Adding this in the beginning of filter chains should make filtering
faster due to better use of the memory cache.
</p>
<a name="split"></a>
<h2 class="section"><a href="ffmpeg.html#toc-split">24.36 split</a></h2>

<p>Pass on the input video to two outputs. Both outputs are identical to
the input video.
</p>
<p>For example:
</p><table><tr><td>&nbsp;</td><td><pre class="example">[in] split [splitout1][splitout2];
[splitout1] crop=100:100:0:0    [cropout];
[splitout2] pad=200:200:100:100 [padout];
</pre></td></tr></table>

<p>will create two separate outputs from the same input, one cropped and
one padded.
</p>
<a name="swapuv"></a>
<h2 class="section"><a href="ffmpeg.html#toc-swapuv">24.37 swapuv</a></h2>
<p>Swap U &amp; V plane.
</p>
<a name="thumbnail"></a>
<h2 class="section"><a href="ffmpeg.html#toc-thumbnail">24.38 thumbnail</a></h2>
<p>Select the most representative frame in a given sequence of consecutive frames.
</p>
<p>It accepts as argument the frames batch size to analyze (default <var>N</var>=100);
in a set of <var>N</var> frames, the filter will pick one of them, and then handle
the next batch of <var>N</var> frames until the end.
</p>
<p>Since the filter keeps track of the whole frames sequence, a bigger <var>N</var>
value will result in a higher memory usage, so a high value is not recommended.
</p>
<p>The following example extract one picture each 50 frames:
</p><table><tr><td>&nbsp;</td><td><pre class="example">thumbnail=50
</pre></td></tr></table>

<p>Complete example of a thumbnail creation with <code>ffmpeg</code>:
</p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
</pre></td></tr></table>

<a name="tinterlace"></a>
<h2 class="section"><a href="ffmpeg.html#toc-tinterlace">24.39 tinterlace</a></h2>

<p>Perform various types of temporal field interlacing.
</p>
<p>Frames are counted starting from 1, so the first input frame is
considered odd.
</p>
<p>This filter accepts a single parameter specifying the mode. Available
modes are:
</p>
<dl compact="compact">
<dt> &lsquo;<samp>0</samp>&rsquo;</dt>
<dd><p>Move odd frames into the upper field, even into the lower field,
generating a double height frame at half framerate.
</p>
</dd>
<dt> &lsquo;<samp>1</samp>&rsquo;</dt>
<dd><p>Only output even frames, odd frames are dropped, generating a frame with
unchanged height at half framerate.
</p>
</dd>
<dt> &lsquo;<samp>2</samp>&rsquo;</dt>
<dd><p>Only output odd frames, even frames are dropped, generating a frame with
unchanged height at half framerate.
</p>
</dd>
<dt> &lsquo;<samp>3</samp>&rsquo;</dt>
<dd><p>Expand each frame to full height, but pad alternate lines with black,
generating a frame with double height at the same input framerate.
</p>
</dd>
<dt> &lsquo;<samp>4</samp>&rsquo;</dt>
<dd><p>Interleave the upper field from odd frames with the lower field from
even frames, generating a frame with unchanged height at half framerate.
</p>
</dd>
<dt> &lsquo;<samp>5</samp>&rsquo;</dt>
<dd><p>Interleave the lower field from odd frames with the upper field from
even frames, generating a frame with unchanged height at half framerate.
</p></dd>
</dl>

<p>Default mode is 0.
</p>
<a name="transpose"></a>
<h2 class="section"><a href="ffmpeg.html#toc-transpose">24.40 transpose</a></h2>

<p>Transpose rows with columns in the input video and optionally flip it.
</p>
<p>It accepts a parameter representing an integer, which can assume the
values:
</p>
<dl compact="compact">
<dt> &lsquo;<samp>0</samp>&rsquo;</dt>
<dd><p>Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
</p><table><tr><td>&nbsp;</td><td><pre class="example">L.R     L.l
. . -&gt;  . .
l.r     R.r
</pre></td></tr></table>

</dd>
<dt> &lsquo;<samp>1</samp>&rsquo;</dt>
<dd><p>Rotate by 90 degrees clockwise, that is:
</p><table><tr><td>&nbsp;</td><td><pre class="example">L.R     l.L
. . -&gt;  . .
l.r     r.R
</pre></td></tr></table>

</dd>
<dt> &lsquo;<samp>2</samp>&rsquo;</dt>
<dd><p>Rotate by 90 degrees counterclockwise, that is:
</p><table><tr><td>&nbsp;</td><td><pre class="example">L.R     R.r
. . -&gt;  . .
l.r     L.l
</pre></td></tr></table>

</dd>
<dt> &lsquo;<samp>3</samp>&rsquo;</dt>
<dd><p>Rotate by 90 degrees clockwise and vertically flip, that is:
</p><table><tr><td>&nbsp;</td><td><pre class="example">L.R     r.R
. . -&gt;  . .
l.r     l.L
</pre></td></tr></table>
</dd>
</dl>

<a name="unsharp"></a>
<h2 class="section"><a href="ffmpeg.html#toc-unsharp">24.41 unsharp</a></h2>

<p>Sharpen or blur the input video.
</p>
<p>It accepts the following parameters:
<var>luma_msize_x</var>:<var>luma_msize_y</var>:<var>luma_amount</var>:<var>chroma_msize_x</var>:<var>chroma_msize_y</var>:<var>chroma_amount</var>
</p>
<p>Negative values for the amount will blur the input video, while positive
values will sharpen. All parameters are optional and default to the
equivalent of the string &rsquo;5:5:1.0:5:5:0.0&rsquo;.
</p>
<dl compact="compact">
<dt> &lsquo;<samp>luma_msize_x</samp>&rsquo;</dt>
<dd><p>Set the luma matrix horizontal size. It can be an integer between 3
and 13, default value is 5.
</p>
</dd>
<dt> &lsquo;<samp>luma_msize_y</samp>&rsquo;</dt>
<dd><p>Set the luma matrix vertical size. It can be an integer between 3
and 13, default value is 5.
</p>
</dd>
<dt> &lsquo;<samp>luma_amount</samp>&rsquo;</dt>
<dd><p>Set the luma effect strength. It can be a float number between -2.0
and 5.0, default value is 1.0.
</p>
</dd>
<dt> &lsquo;<samp>chroma_msize_x</samp>&rsquo;</dt>
<dd><p>Set the chroma matrix horizontal size. It can be an integer between 3
and 13, default value is 5.
</p>
</dd>
<dt> &lsquo;<samp>chroma_msize_y</samp>&rsquo;</dt>
<dd><p>Set the chroma matrix vertical size. It can be an integer between 3
and 13, default value is 5.
</p>
</dd>
<dt> &lsquo;<samp>chroma_amount</samp>&rsquo;</dt>
<dd><p>Set the chroma effect strength. It can be a float number between -2.0
and 5.0, default value is 0.0.
</p>
</dd>
</dl>

<table><tr><td>&nbsp;</td><td><pre class="example"># Strong luma sharpen effect parameters
unsharp=7:7:2.5

# Strong blur of both luma and chroma parameters
unsharp=7:7:-2:7:7:-2

# Use the default values with <code>ffmpeg</code>
ffmpeg -i in.avi -vf &quot;unsharp&quot; out.mp4
</pre></td></tr></table>

<a name="vflip"></a>
<h2 class="section"><a href="ffmpeg.html#toc-vflip">24.42 vflip</a></h2>

<p>Flip the input video vertically.
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.avi -vf &quot;vflip&quot; out.avi
</pre></td></tr></table>

<a name="yadif"></a>
<h2 class="section"><a href="ffmpeg.html#toc-yadif">24.43 yadif</a></h2>

<p>Deinterlace the input video (&quot;yadif&quot; means &quot;yet another deinterlacing
filter&quot;).
</p>
<p>It accepts the optional parameters: <var>mode</var>:<var>parity</var>:<var>auto</var>.
</p>
<p><var>mode</var> specifies the interlacing mode to adopt, accepts one of the
following values:
</p>
<dl compact="compact">
<dt> &lsquo;<samp>0</samp>&rsquo;</dt>
<dd><p>output 1 frame for each frame
</p></dd>
<dt> &lsquo;<samp>1</samp>&rsquo;</dt>
<dd><p>output 1 frame for each field
</p></dd>
<dt> &lsquo;<samp>2</samp>&rsquo;</dt>
<dd><p>like 0 but skips spatial interlacing check
</p></dd>
<dt> &lsquo;<samp>3</samp>&rsquo;</dt>
<dd><p>like 1 but skips spatial interlacing check
</p></dd>
</dl>

<p>Default value is 0.
</p>
<p><var>parity</var> specifies the picture field parity assumed for the input
interlaced video, accepts one of the following values:
</p>
<dl compact="compact">
<dt> &lsquo;<samp>0</samp>&rsquo;</dt>
<dd><p>assume top field first
</p></dd>
<dt> &lsquo;<samp>1</samp>&rsquo;</dt>
<dd><p>assume bottom field first
</p></dd>
<dt> &lsquo;<samp>-1</samp>&rsquo;</dt>
<dd><p>enable automatic detection
</p></dd>
</dl>

<p>Default value is -1.
If interlacing is unknown or decoder does not export this information,
top field first will be assumed.
</p>
<p><var>auto</var> specifies if deinterlacer should trust the interlaced flag
and only deinterlace frames marked as interlaced
</p>
<dl compact="compact">
<dt> &lsquo;<samp>0</samp>&rsquo;</dt>
<dd><p>deinterlace all frames
</p></dd>
<dt> &lsquo;<samp>1</samp>&rsquo;</dt>
<dd><p>only deinterlace frames marked as interlaced
</p></dd>
</dl>

<p>Default value is 0.
</p>

<a name="Video-Sources"></a>
<h1 class="chapter"><a href="ffmpeg.html#toc-Video-Sources">25. Video Sources</a></h1>

<p>Below is a description of the currently available video sources.
</p>
<a name="buffer"></a>
<h2 class="section"><a href="ffmpeg.html#toc-buffer">25.1 buffer</a></h2>

<p>Buffer video frames, and make them available to the filter chain.
</p>
<p>This source is mainly intended for a programmatic use, in particular
through the interface defined in &lsquo;<tt>libavfilter/vsrc_buffer.h</tt>&rsquo;.
</p>
<p>It accepts the following parameters:
<var>width</var>:<var>height</var>:<var>pix_fmt_string</var>:<var>timebase_num</var>:<var>timebase_den</var>:<var>sample_aspect_ratio_num</var>:<var>sample_aspect_ratio.den</var>:<var>scale_params</var>
</p>
<p>All the parameters but <var>scale_params</var> need to be explicitly
defined.
</p>
<p>Follows the list of the accepted parameters.
</p>
<dl compact="compact">
<dt> &lsquo;<samp>width, height</samp>&rsquo;</dt>
<dd><p>Specify the width and height of the buffered video frames.
</p>
</dd>
<dt> &lsquo;<samp>pix_fmt_string</samp>&rsquo;</dt>
<dd><p>A string representing the pixel format of the buffered video frames.
It may be a number corresponding to a pixel format, or a pixel format
name.
</p>
</dd>
<dt> &lsquo;<samp>timebase_num, timebase_den</samp>&rsquo;</dt>
<dd><p>Specify numerator and denomitor of the timebase assumed by the
timestamps of the buffered frames.
</p>
</dd>
<dt> &lsquo;<samp>sample_aspect_ratio.num, sample_aspect_ratio.den</samp>&rsquo;</dt>
<dd><p>Specify numerator and denominator of the sample aspect ratio assumed
by the video frames.
</p>
</dd>
<dt> &lsquo;<samp>scale_params</samp>&rsquo;</dt>
<dd><p>Specify the optional parameters to be used for the scale filter which
is automatically inserted when an input change is detected in the
input size or format.
</p></dd>
</dl>

<p>For example:
</p><table><tr><td>&nbsp;</td><td><pre class="example">buffer=320:240:yuv410p:1:24:1:1
</pre></td></tr></table>

<p>will instruct the source to accept video frames with size 320x240 and
with format &quot;yuv410p&quot;, assuming 1/24 as the timestamps timebase and
square pixels (1:1 sample aspect ratio).
Since the pixel format with name &quot;yuv410p&quot; corresponds to the number 6
(check the enum PixelFormat definition in &lsquo;<tt>libavutil/pixfmt.h</tt>&rsquo;),
this example corresponds to:
</p><table><tr><td>&nbsp;</td><td><pre class="example">buffer=320:240:6:1:24:1:1
</pre></td></tr></table>

<a name="cellauto"></a>
<h2 class="section"><a href="ffmpeg.html#toc-cellauto">25.2 cellauto</a></h2>

<p>Create a pattern generated by an elementary cellular automaton.
</p>
<p>The initial state of the cellular automaton can be defined through the
&lsquo;<samp>filename</samp>&rsquo;, and &lsquo;<samp>pattern</samp>&rsquo; options. If such options are
not specified an initial state is created randomly.
</p>
<p>At each new frame a new row in the video is filled with the result of
the cellular automaton next generation. The behavior when the whole
frame is filled is defined by the &lsquo;<samp>scroll</samp>&rsquo; option.
</p>
<p>This source accepts a list of options in the form of
<var>key</var>=<var>value</var> pairs separated by &quot;:&quot;. A description of the
accepted options follows.
</p>
<dl compact="compact">
<dt> &lsquo;<samp>filename, f</samp>&rsquo;</dt>
<dd><p>Read the initial cellular automaton state, i.e. the starting row, from
the specified file.
In the file, each non-whitespace character is considered an alive
cell, a newline will terminate the row, and further characters in the
file will be ignored.
</p>
</dd>
<dt> &lsquo;<samp>pattern, p</samp>&rsquo;</dt>
<dd><p>Read the initial cellular automaton state, i.e. the starting row, from
the specified string.
</p>
<p>Each non-whitespace character in the string is considered an alive
cell, a newline will terminate the row, and further characters in the
string will be ignored.
</p>
</dd>
<dt> &lsquo;<samp>rate, r</samp>&rsquo;</dt>
<dd><p>Set the video rate, that is the number of frames generated per second.
Default is 25.
</p>
</dd>
<dt> &lsquo;<samp>random_fill_ratio, ratio</samp>&rsquo;</dt>
<dd><p>Set the random fill ratio for the initial cellular automaton row. It
is a floating point number value ranging from 0 to 1, defaults to
1/PHI.
</p>
<p>This option is ignored when a file or a pattern is specified.
</p>
</dd>
<dt> &lsquo;<samp>random_seed, seed</samp>&rsquo;</dt>
<dd><p>Set the seed for filling randomly the initial row, must be an integer
included between 0 and UINT32_MAX. If not specified, or if explicitly
set to -1, the filter will try to use a good random seed on a best
effort basis.
</p>
</dd>
<dt> &lsquo;<samp>rule</samp>&rsquo;</dt>
<dd><p>Set the cellular automaton rule, it is a number ranging from 0 to 255.
Default value is 110.
</p>
</dd>
<dt> &lsquo;<samp>size, s</samp>&rsquo;</dt>
<dd><p>Set the size of the output video.
</p>
<p>If &lsquo;<samp>filename</samp>&rsquo; or &lsquo;<samp>pattern</samp>&rsquo; is specified, the size is set
by default to the width of the specified initial state row, and the
height is set to <var>width</var> * PHI.
</p>
<p>If &lsquo;<samp>size</samp>&rsquo; is set, it must contain the width of the specified
pattern string, and the specified pattern will be centered in the
larger row.
</p>
<p>If a filename or a pattern string is not specified, the size value
defaults to &quot;320x518&quot; (used for a randomly generated initial state).
</p>
</dd>
<dt> &lsquo;<samp>scroll</samp>&rsquo;</dt>
<dd><p>If set to 1, scroll the output upward when all the rows in the output
have been already filled. If set to 0, the new generated row will be
written over the top row just after the bottom row is filled.
Defaults to 1.
</p>
</dd>
<dt> &lsquo;<samp>start_full, full</samp>&rsquo;</dt>
<dd><p>If set to 1, completely fill the output with generated rows before
outputting the first frame.
This is the default behavior, for disabling set the value to 0.
</p>
</dd>
<dt> &lsquo;<samp>stitch</samp>&rsquo;</dt>
<dd><p>If set to 1, stitch the left and right row edges together.
This is the default behavior, for disabling set the value to 0.
</p></dd>
</dl>

<a name="Examples-2"></a>
<h3 class="subsection"><a href="ffmpeg.html#toc-Examples-2">25.2.1 Examples</a></h3>

<ul>
<li>
Read the initial state from &lsquo;<tt>pattern</tt>&rsquo;, and specify an output of
size 200x400.
<table><tr><td>&nbsp;</td><td><pre class="example">cellauto=f=pattern:s=200x400
</pre></td></tr></table>

</li><li>
Generate a random initial row with a width of 200 cells, with a fill
ratio of 2/3:
<table><tr><td>&nbsp;</td><td><pre class="example">cellauto=ratio=2/3:s=200x200
</pre></td></tr></table>

</li><li>
Create a pattern generated by rule 18 starting by a single alive cell
centered on an initial row with width 100:
<table><tr><td>&nbsp;</td><td><pre class="example">cellauto=p=@:s=100x400:full=0:rule=18
</pre></td></tr></table>

</li><li>
Specify a more elaborated initial pattern:
<table><tr><td>&nbsp;</td><td><pre class="example">cellauto=p='@@ @ @@':s=100x400:full=0:rule=18
</pre></td></tr></table>

</li></ul>

<a name="color"></a>
<h2 class="section"><a href="ffmpeg.html#toc-color">25.3 color</a></h2>

<p>Provide an uniformly colored input.
</p>
<p>It accepts the following parameters:
<var>color</var>:<var>frame_size</var>:<var>frame_rate</var>
</p>
<p>Follows the description of the accepted parameters.
</p>
<dl compact="compact">
<dt> &lsquo;<samp>color</samp>&rsquo;</dt>
<dd><p>Specify the color of the source. It can be the name of a color (case
insensitive match) or a 0xRRGGBB[AA] sequence, possibly followed by an
alpha specifier. The default value is &quot;black&quot;.
</p>
</dd>
<dt> &lsquo;<samp>frame_size</samp>&rsquo;</dt>
<dd><p>Specify the size of the sourced video, it may be a string of the form
<var>width</var>x<var>height</var>, or the name of a size abbreviation. The
default value is &quot;320x240&quot;.
</p>
</dd>
<dt> &lsquo;<samp>frame_rate</samp>&rsquo;</dt>
<dd><p>Specify the frame rate of the sourced video, as the number of frames
generated per second. It has to be a string in the format
<var>frame_rate_num</var>/<var>frame_rate_den</var>, an integer number, a float
number or a valid video frame rate abbreviation. The default value is
&quot;25&quot;.
</p>
</dd>
</dl>

<p>For example the following graph description will generate a red source
with an opacity of 0.2, with size &quot;qcif&quot; and a frame rate of 10
frames per second, which will be overlayed over the source connected
to the pad with identifier &quot;in&quot;.
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">&quot;color=red@0.2:qcif:10 [color]; [in][color] overlay [out]&quot;
</pre></td></tr></table>

<a name="movie"></a>
<h2 class="section"><a href="ffmpeg.html#toc-movie">25.4 movie</a></h2>

<p>Read a video stream from a movie container.
</p>
<p>It accepts the syntax: <var>movie_name</var>[:<var>options</var>] where
<var>movie_name</var> is the name of the resource to read (not necessarily
a file but also a device or a stream accessed through some protocol),
and <var>options</var> is an optional sequence of <var>key</var>=<var>value</var>
pairs, separated by &quot;:&quot;.
</p>
<p>The description of the accepted options follows.
</p>
<dl compact="compact">
<dt> &lsquo;<samp>format_name, f</samp>&rsquo;</dt>
<dd><p>Specifies the format assumed for the movie to read, and can be either
the name of a container or an input device. If not specified the
format is guessed from <var>movie_name</var> or by probing.
</p>
</dd>
<dt> &lsquo;<samp>seek_point, sp</samp>&rsquo;</dt>
<dd><p>Specifies the seek point in seconds, the frames will be output
starting from this seek point, the parameter is evaluated with
<code>av_strtod</code> so the numerical value may be suffixed by an IS
postfix. Default value is &quot;0&quot;.
</p>
</dd>
<dt> &lsquo;<samp>stream_index, si</samp>&rsquo;</dt>
<dd><p>Specifies the index of the video stream to read. If the value is -1,
the best suited video stream will be automatically selected. Default
value is &quot;-1&quot;.
</p>
</dd>
</dl>

<p>This filter allows to overlay a second video on top of main input of
a filtergraph as shown in this graph:
</p><table><tr><td>&nbsp;</td><td><pre class="example">input -----------&gt; deltapts0 --&gt; overlay --&gt; output
                                    ^
                                    |
movie --&gt; scale--&gt; deltapts1 -------+
</pre></td></tr></table>

<p>Some examples follow:
</p><table><tr><td>&nbsp;</td><td><pre class="example"># skip 3.2 seconds from the start of the avi file in.avi, and overlay it
# on top of the input labelled as &quot;in&quot;.
movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [movie];
[in] setpts=PTS-STARTPTS, [movie] overlay=16:16 [out]

# read from a video4linux2 device, and overlay it on top of the input
# labelled as &quot;in&quot;
movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [movie];
[in] setpts=PTS-STARTPTS, [movie] overlay=16:16 [out]

</pre></td></tr></table>

<a name="mptestsrc"></a>
<h2 class="section"><a href="ffmpeg.html#toc-mptestsrc">25.5 mptestsrc</a></h2>

<p>Generate various test patterns, as generated by the MPlayer test filter.
</p>
<p>The size of the generated video is fixed, and is 256x256.
This source is useful in particular for testing encoding features.
</p>
<p>This source accepts an optional sequence of <var>key</var>=<var>value</var> pairs,
separated by &quot;:&quot;. The description of the accepted options follows.
</p>
<dl compact="compact">
<dt> &lsquo;<samp>rate, r</samp>&rsquo;</dt>
<dd><p>Specify the frame rate of the sourced video, as the number of frames
generated per second. It has to be a string in the format
<var>frame_rate_num</var>/<var>frame_rate_den</var>, an integer number, a float
number or a valid video frame rate abbreviation. The default value is
&quot;25&quot;.
</p>
</dd>
<dt> &lsquo;<samp>duration, d</samp>&rsquo;</dt>
<dd><p>Set the video duration of the sourced video. The accepted syntax is:
</p><table><tr><td>&nbsp;</td><td><pre class="example">[-]HH[:MM[:SS[.m...]]]
[-]S+[.m...]
</pre></td></tr></table>
<p>See also the function <code>av_parse_time()</code>.
</p>
<p>If not specified, or the expressed duration is negative, the video is
supposed to be generated forever.
</p>
</dd>
<dt> &lsquo;<samp>test, t</samp>&rsquo;</dt>
<dd>
<p>Set the number or the name of the test to perform. Supported tests are:
</p><dl compact="compact">
<dt> &lsquo;<samp>dc_luma</samp>&rsquo;</dt>
<dt> &lsquo;<samp>dc_chroma</samp>&rsquo;</dt>
<dt> &lsquo;<samp>freq_luma</samp>&rsquo;</dt>
<dt> &lsquo;<samp>freq_chroma</samp>&rsquo;</dt>
<dt> &lsquo;<samp>amp_luma</samp>&rsquo;</dt>
<dt> &lsquo;<samp>amp_chroma</samp>&rsquo;</dt>
<dt> &lsquo;<samp>cbp</samp>&rsquo;</dt>
<dt> &lsquo;<samp>mv</samp>&rsquo;</dt>
<dt> &lsquo;<samp>ring1</samp>&rsquo;</dt>
<dt> &lsquo;<samp>ring2</samp>&rsquo;</dt>
<dt> &lsquo;<samp>all</samp>&rsquo;</dt>
</dl>

<p>Default value is &quot;all&quot;, which will cycle through the list of all tests.
</p></dd>
</dl>

<p>For example the following:
</p><table><tr><td>&nbsp;</td><td><pre class="example">testsrc=t=dc_luma
</pre></td></tr></table>

<p>will generate a &quot;dc_luma&quot; test pattern.
</p>
<a name="frei0r_005fsrc"></a>
<h2 class="section"><a href="ffmpeg.html#toc-frei0r_005fsrc">25.6 frei0r_src</a></h2>

<p>Provide a frei0r source.
</p>
<p>To enable compilation of this filter you need to install the frei0r
header and configure FFmpeg with <code>--enable-frei0r</code>.
</p>
<p>The source supports the syntax:
</p><table><tr><td>&nbsp;</td><td><pre class="example"><var>size</var>:<var>rate</var>:<var>src_name</var>[{=|:}<var>param1</var>:<var>param2</var>:...:<var>paramN</var>]
</pre></td></tr></table>

<p><var>size</var> is the size of the video to generate, may be a string of the
form <var>width</var>x<var>height</var> or a frame size abbreviation.
<var>rate</var> is the rate of the video to generate, may be a string of
the form <var>num</var>/<var>den</var> or a frame rate abbreviation.
<var>src_name</var> is the name to the frei0r source to load. For more
information regarding frei0r and how to set the parameters read the
section <a href="#frei0r">frei0r</a> in the description of the video filters.
</p>
<p>Some examples follow:
</p><table><tr><td>&nbsp;</td><td><pre class="example"># generate a frei0r partik0l source with size 200x200 and frame rate 10
# which is overlayed on the overlay filter main input
frei0r_src=200x200:10:partik0l=1234 [overlay]; [in][overlay] overlay
</pre></td></tr></table>

<a name="life"></a>
<h2 class="section"><a href="ffmpeg.html#toc-life">25.7 life</a></h2>

<p>Generate a life pattern.
</p>
<p>This source is based on a generalization of John Conway&rsquo;s life game.
</p>
<p>The sourced input represents a life grid, each pixel represents a cell
which can be in one of two possible states, alive or dead. Every cell
interacts with its eight neighbours, which are the cells that are
horizontally, vertically, or diagonally adjacent.
</p>
<p>At each interaction the grid evolves according to the adopted rule,
which specifies the number of neighbor alive cells which will make a
cell stay alive or born. The &lsquo;<samp>rule</samp>&rsquo; option allows to specify
the rule to adopt.
</p>
<p>This source accepts a list of options in the form of
<var>key</var>=<var>value</var> pairs separated by &quot;:&quot;. A description of the
accepted options follows.
</p>
<dl compact="compact">
<dt> &lsquo;<samp>filename, f</samp>&rsquo;</dt>
<dd><p>Set the file from which to read the initial grid state. In the file,
each non-whitespace character is considered an alive cell, and newline
is used to delimit the end of each row.
</p>
<p>If this option is not specified, the initial grid is generated
randomly.
</p>
</dd>
<dt> &lsquo;<samp>rate, r</samp>&rsquo;</dt>
<dd><p>Set the video rate, that is the number of frames generated per second.
Default is 25.
</p>
</dd>
<dt> &lsquo;<samp>random_fill_ratio, ratio</samp>&rsquo;</dt>
<dd><p>Set the random fill ratio for the initial random grid. It is a
floating point number value ranging from 0 to 1, defaults to 1/PHI.
It is ignored when a file is specified.
</p>
</dd>
<dt> &lsquo;<samp>random_seed, seed</samp>&rsquo;</dt>
<dd><p>Set the seed for filling the initial random grid, must be an integer
included between 0 and UINT32_MAX. If not specified, or if explicitly
set to -1, the filter will try to use a good random seed on a best
effort basis.
</p>
</dd>
<dt> &lsquo;<samp>rule</samp>&rsquo;</dt>
<dd><p>Set the life rule.
</p>
<p>A rule can be specified with a code of the kind &quot;S<var>NS</var>/B<var>NB</var>&quot;,
where <var>NS</var> and <var>NB</var> are sequences of numbers in the range 0-8,
<var>NS</var> specifies the number of alive neighbor cells which make a
live cell stay alive, and <var>NB</var> the number of alive neighbor cells
which make a dead cell to become alive (i.e. to &quot;born&quot;).
&quot;s&quot; and &quot;b&quot; can be used in place of &quot;S&quot; and &quot;B&quot;, respectively.
</p>
<p>Alternatively a rule can be specified by an 18-bits integer. The 9
high order bits are used to encode the next cell state if it is alive
for each number of neighbor alive cells, the low order bits specify
the rule for &quot;borning&quot; new cells. Higher order bits encode for an
higher number of neighbor cells.
For example the number 6153 = <code>(12&lt;&lt;9)+9</code> specifies a stay alive
rule of 12 and a born rule of 9, which corresponds to &quot;S23/B03&quot;.
</p>
<p>Default value is &quot;S23/B3&quot;, which is the original Conway&rsquo;s game of life
rule, and will keep a cell alive if it has 2 or 3 neighbor alive
cells, and will born a new cell if there are three alive cells around
a dead cell.
</p>
</dd>
<dt> &lsquo;<samp>size, s</samp>&rsquo;</dt>
<dd><p>Set the size of the output video.
</p>
<p>If &lsquo;<samp>filename</samp>&rsquo; is specified, the size is set by default to the
same size of the input file. If &lsquo;<samp>size</samp>&rsquo; is set, it must contain
the size specified in the input file, and the initial grid defined in
that file is centered in the larger resulting area.
</p>
<p>If a filename is not specified, the size value defaults to &quot;320x240&quot;
(used for a randomly generated initial grid).
</p>
</dd>
<dt> &lsquo;<samp>stitch</samp>&rsquo;</dt>
<dd><p>If set to 1, stitch the left and right grid edges together, and the
top and bottom edges also. Defaults to 1.
</p>
</dd>
<dt> &lsquo;<samp>mold</samp>&rsquo;</dt>
<dd><p>Set cell mold speed. If set, a dead cell will go from &lsquo;<samp>death_color</samp>&rsquo; to
&lsquo;<samp>mold_color</samp>&rsquo; with a step of &lsquo;<samp>mold</samp>&rsquo;. &lsquo;<samp>mold</samp>&rsquo; can have a
value from 0 to 255.
</p>
</dd>
<dt> &lsquo;<samp>life_color</samp>&rsquo;</dt>
<dd><p>Set the color of living (or new born) cells.
</p>
</dd>
<dt> &lsquo;<samp>death_color</samp>&rsquo;</dt>
<dd><p>Set the color of dead cells. If &lsquo;<samp>mold</samp>&rsquo; is set, this is the first color
used to represent a dead cell.
</p>
</dd>
<dt> &lsquo;<samp>mold_color</samp>&rsquo;</dt>
<dd><p>Set mold color, for definitely dead and moldy cells.
</p></dd>
</dl>

<a name="Examples-6"></a>
<h3 class="subsection"><a href="ffmpeg.html#toc-Examples-6">25.7.1 Examples</a></h3>

<ul>
<li>
Read a grid from &lsquo;<tt>pattern</tt>&rsquo;, and center it on a grid of size
300x300 pixels:
<table><tr><td>&nbsp;</td><td><pre class="example">life=f=pattern:s=300x300
</pre></td></tr></table>

</li><li>
Generate a random grid of size 200x200, with a fill ratio of 2/3:
<table><tr><td>&nbsp;</td><td><pre class="example">life=ratio=2/3:s=200x200
</pre></td></tr></table>

</li><li>
Specify a custom rule for evolving a randomly generated grid:
<table><tr><td>&nbsp;</td><td><pre class="example">life=rule=S14/B34
</pre></td></tr></table>

</li><li>
Full example with slow death effect (mold) using <code>ffplay</code>:
<table><tr><td>&nbsp;</td><td><pre class="example">ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
</pre></td></tr></table>
</li></ul>

<a name="nullsrc_002c-rgbtestsrc_002c-testsrc"></a>
<h2 class="section"><a href="ffmpeg.html#toc-nullsrc_002c-rgbtestsrc_002c-testsrc">25.8 nullsrc, rgbtestsrc, testsrc</a></h2>

<p>The <code>nullsrc</code> source returns unprocessed video frames. It is
mainly useful to be employed in analysis / debugging tools, or as the
source for filters which ignore the input data.
</p>
<p>The <code>rgbtestsrc</code> source generates an RGB test pattern useful for
detecting RGB vs BGR issues. You should see a red, green and blue
stripe from top to bottom.
</p>
<p>The <code>testsrc</code> source generates a test video pattern, showing a
color pattern, a scrolling gradient and a timestamp. This is mainly
intended for testing purposes.
</p>
<p>These sources accept an optional sequence of <var>key</var>=<var>value</var> pairs,
separated by &quot;:&quot;. The description of the accepted options follows.
</p>
<dl compact="compact">
<dt> &lsquo;<samp>size, s</samp>&rsquo;</dt>
<dd><p>Specify the size of the sourced video, it may be a string of the form
<var>width</var>x<var>height</var>, or the name of a size abbreviation. The
default value is &quot;320x240&quot;.
</p>
</dd>
<dt> &lsquo;<samp>rate, r</samp>&rsquo;</dt>
<dd><p>Specify the frame rate of the sourced video, as the number of frames
generated per second. It has to be a string in the format
<var>frame_rate_num</var>/<var>frame_rate_den</var>, an integer number, a float
number or a valid video frame rate abbreviation. The default value is
&quot;25&quot;.
</p>
</dd>
<dt> &lsquo;<samp>sar</samp>&rsquo;</dt>
<dd><p>Set the sample aspect ratio of the sourced video.
</p>
</dd>
<dt> &lsquo;<samp>duration, d</samp>&rsquo;</dt>
<dd><p>Set the video duration of the sourced video. The accepted syntax is:
</p><table><tr><td>&nbsp;</td><td><pre class="example">[-]HH[:MM[:SS[.m...]]]
[-]S+[.m...]
</pre></td></tr></table>
<p>See also the function <code>av_parse_time()</code>.
</p>
<p>If not specified, or the expressed duration is negative, the video is
supposed to be generated forever.
</p>
</dd>
<dt> &lsquo;<samp>decimals, n</samp>&rsquo;</dt>
<dd><p>Set the number of decimals to show in the timestamp, only used in the
<code>testsrc</code> source.
</p>
<p>The displayed timestamp value will correspond to the original
timestamp value multiplied by the power of 10 of the specified
value. Default value is 0.
</p></dd>
</dl>

<p>For example the following:
</p><table><tr><td>&nbsp;</td><td><pre class="example">testsrc=duration=5.3:size=qcif:rate=10
</pre></td></tr></table>

<p>will generate a video with a duration of 5.3 seconds, with size
176x144 and a frame rate of 10 frames per second.
</p>
<p>If the input content is to be ignored, <code>nullsrc</code> can be used. The
following command generates noise in the luminance plane by employing
the <code>mp=geq</code> filter:
</p><table><tr><td>&nbsp;</td><td><pre class="example">nullsrc=s=256x256, mp=geq=random(1)*255:128:128
</pre></td></tr></table>


<a name="Video-Sinks"></a>
<h1 class="chapter"><a href="ffmpeg.html#toc-Video-Sinks">26. Video Sinks</a></h1>

<p>Below is a description of the currently available video sinks.
</p>
<a name="buffersink"></a>
<h2 class="section"><a href="ffmpeg.html#toc-buffersink">26.1 buffersink</a></h2>

<p>Buffer video frames, and make them available to the end of the filter
graph.
</p>
<p>This sink is mainly intended for a programmatic use, in particular
through the interface defined in &lsquo;<tt>libavfilter/buffersink.h</tt>&rsquo;.
</p>
<p>It does not require a string parameter in input, but you need to
specify a pointer to a list of supported pixel formats terminated by
-1 in the opaque parameter provided to <code>avfilter_init_filter</code>
when initializing this sink.
</p>
<a name="nullsink"></a>
<h2 class="section"><a href="ffmpeg.html#toc-nullsink">26.2 nullsink</a></h2>

<p>Null video sink, do absolutely nothing with the input video. It is
mainly useful as a template and to be employed in analysis / debugging
tools.
</p>

<a name="Metadata"></a>
<h1 class="chapter"><a href="ffmpeg.html#toc-Metadata">27. Metadata</a></h1>

<p>FFmpeg is able to dump metadata from media files into a simple UTF-8-encoded
INI-like text file and then load it back using the metadata muxer/demuxer.
</p>
<p>The file format is as follows:
</p><ol>
<li>
A file consists of a header and a number of metadata tags divided into sections,
each on its own line.

</li><li>
The header is a &rsquo;;FFMETADATA&rsquo; string, followed by a version number (now 1).

</li><li>
Metadata tags are of the form &rsquo;key=value&rsquo;

</li><li>
Immediately after header follows global metadata

</li><li>
After global metadata there may be sections with per-stream/per-chapter
metadata.

</li><li>
A section starts with the section name in uppercase (i.e. STREAM or CHAPTER) in
brackets (&rsquo;[&rsquo;, &rsquo;]&rsquo;) and ends with next section or end of file.

</li><li>
At the beginning of a chapter section there may be an optional timebase to be
used for start/end values. It must be in form &rsquo;TIMEBASE=num/den&rsquo;, where num and
den are integers. If the timebase is missing then start/end times are assumed to
be in milliseconds.
Next a chapter section must contain chapter start and end times in form
&rsquo;START=num&rsquo;, &rsquo;END=num&rsquo;, where num is a positive integer.

</li><li>
Empty lines and lines starting with &rsquo;;&rsquo; or &rsquo;#&rsquo; are ignored.

</li><li>
Metadata keys or values containing special characters (&rsquo;=&rsquo;, &rsquo;;&rsquo;, &rsquo;#&rsquo;, &rsquo;\&rsquo; and a
newline) must be escaped with a backslash &rsquo;\&rsquo;.

</li><li>
Note that whitespace in metadata (e.g. foo = bar) is considered to be a part of
the tag (in the example above key is &rsquo;foo &rsquo;, value is &rsquo; bar&rsquo;).
</li></ol>

<p>A ffmetadata file might look like this:
</p><table><tr><td>&nbsp;</td><td><pre class="example">;FFMETADATA1
title=bike\\shed
;this is a comment
artist=FFmpeg troll team

[CHAPTER]
TIMEBASE=1/1000
START=0
#chapter ends at 0:01:00
END=60000
title=chapter \#1
[STREAM]
title=multi\
line
</pre></td></tr></table>


<div id="footer">
<p>
 <font size="-1">
  This document was generated on <i>June 16, 2012</i> using <a href="http://www.nongnu.org/texi2html/"><i>texi2html 1.82</i></a>.
 </font>
 <br>
</div></div>
</p>
</body>
</html>
</div>