ffmpeg.1 122 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922
  1. .\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35)
  2. .\"
  3. .\" Standard preamble:
  4. .\" ========================================================================
  5. .de Sp \" Vertical space (when we can't use .PP)
  6. .if t .sp .5v
  7. .if n .sp
  8. ..
  9. .de Vb \" Begin verbatim text
  10. .ft CW
  11. .nf
  12. .ne \\$1
  13. ..
  14. .de Ve \" End verbatim text
  15. .ft R
  16. .fi
  17. ..
  18. .\" Set up some character translations and predefined strings. \*(-- will
  19. .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
  20. .\" double quote, and \*(R" will give a right double quote. \*(C+ will
  21. .\" give a nicer C++. Capital omega is used to do unbreakable dashes and
  22. .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
  23. .\" nothing in troff, for use with C<>.
  24. .tr \(*W-
  25. .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
  26. .ie n \{\
  27. . ds -- \(*W-
  28. . ds PI pi
  29. . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
  30. . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
  31. . ds L" ""
  32. . ds R" ""
  33. . ds C` ""
  34. . ds C' ""
  35. 'br\}
  36. .el\{\
  37. . ds -- \|\(em\|
  38. . ds PI \(*p
  39. . ds L" ``
  40. . ds R" ''
  41. . ds C`
  42. . ds C'
  43. 'br\}
  44. .\"
  45. .\" Escape single quotes in literal strings from groff's Unicode transform.
  46. .ie \n(.g .ds Aq \(aq
  47. .el .ds Aq '
  48. .\"
  49. .\" If the F register is >0, we'll generate index entries on stderr for
  50. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  51. .\" entries marked with X<> in POD. Of course, you'll have to process the
  52. .\" output yourself in some meaningful fashion.
  53. .\"
  54. .\" Avoid warning from groff about undefined register 'F'.
  55. .de IX
  56. ..
  57. .nr rF 0
  58. .if \n(.g .if rF .nr rF 1
  59. .if (\n(rF:(\n(.g==0)) \{\
  60. . if \nF \{\
  61. . de IX
  62. . tm Index:\\$1\t\\n%\t"\\$2"
  63. ..
  64. . if !\nF==2 \{\
  65. . nr % 0
  66. . nr F 2
  67. . \}
  68. . \}
  69. .\}
  70. .rr rF
  71. .\"
  72. .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
  73. .\" Fear. Run. Save yourself. No user-serviceable parts.
  74. . \" fudge factors for nroff and troff
  75. .if n \{\
  76. . ds #H 0
  77. . ds #V .8m
  78. . ds #F .3m
  79. . ds #[ \f1
  80. . ds #] \fP
  81. .\}
  82. .if t \{\
  83. . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
  84. . ds #V .6m
  85. . ds #F 0
  86. . ds #[ \&
  87. . ds #] \&
  88. .\}
  89. . \" simple accents for nroff and troff
  90. .if n \{\
  91. . ds ' \&
  92. . ds ` \&
  93. . ds ^ \&
  94. . ds , \&
  95. . ds ~ ~
  96. . ds /
  97. .\}
  98. .if t \{\
  99. . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
  100. . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
  101. . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
  102. . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
  103. . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
  104. . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
  105. .\}
  106. . \" troff and (daisy-wheel) nroff accents
  107. .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
  108. .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
  109. .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
  110. .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
  111. .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
  112. .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
  113. .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
  114. .ds ae a\h'-(\w'a'u*4/10)'e
  115. .ds Ae A\h'-(\w'A'u*4/10)'E
  116. . \" corrections for vroff
  117. .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
  118. .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
  119. . \" for low resolution devices (crt and lpr)
  120. .if \n(.H>23 .if \n(.V>19 \
  121. \{\
  122. . ds : e
  123. . ds 8 ss
  124. . ds o a
  125. . ds d- d\h'-1'\(ga
  126. . ds D- D\h'-1'\(hy
  127. . ds th \o'bp'
  128. . ds Th \o'LP'
  129. . ds ae ae
  130. . ds Ae AE
  131. .\}
  132. .rm #[ #] #H #V #F C
  133. .\" ========================================================================
  134. .\"
  135. .IX Title "FFMPEG 1"
  136. .TH FFMPEG 1 " " " " " "
  137. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  138. .\" way too many mistakes in technical documents.
  139. .if n .ad l
  140. .nh
  141. .SH "NAME"
  142. ffmpeg \- ffmpeg video converter
  143. .SH "SYNOPSIS"
  144. .IX Header "SYNOPSIS"
  145. ffmpeg [\fIglobal_options\fR] {[\fIinput_file_options\fR] \-i \fIinput_url\fR} ... {[\fIoutput_file_options\fR] \fIoutput_url\fR} ...
  146. .SH "DESCRIPTION"
  147. .IX Header "DESCRIPTION"
  148. \&\fBffmpeg\fR is a very fast video and audio converter that can also grab from
  149. a live audio/video source. It can also convert between arbitrary sample
  150. rates and resize video on the fly with a high quality polyphase filter.
  151. .PP
  152. \&\fBffmpeg\fR reads from an arbitrary number of input \*(L"files\*(R" (which can be regular
  153. files, pipes, network streams, grabbing devices, etc.), specified by the
  154. \&\f(CW\*(C`\-i\*(C'\fR option, and writes to an arbitrary number of output \*(L"files\*(R", which are
  155. specified by a plain output url. Anything found on the command line which
  156. cannot be interpreted as an option is considered to be an output url.
  157. .PP
  158. Each input or output url can, in principle, contain any number of streams of
  159. different types (video/audio/subtitle/attachment/data). The allowed number and/or
  160. types of streams may be limited by the container format. Selecting which
  161. streams from which inputs will go into which output is either done automatically
  162. or with the \f(CW\*(C`\-map\*(C'\fR option (see the Stream selection chapter).
  163. .PP
  164. To refer to input files in options, you must use their indices (0\-based). E.g.
  165. the first input file is \f(CW0\fR, the second is \f(CW1\fR, etc. Similarly, streams
  166. within a file are referred to by their indices. E.g. \f(CW\*(C`2:3\*(C'\fR refers to the
  167. fourth stream in the third input file. Also see the Stream specifiers chapter.
  168. .PP
  169. As a general rule, options are applied to the next specified
  170. file. Therefore, order is important, and you can have the same
  171. option on the command line multiple times. Each occurrence is
  172. then applied to the next input or output file.
  173. Exceptions from this rule are the global options (e.g. verbosity level),
  174. which should be specified first.
  175. .PP
  176. Do not mix input and output files \*(-- first specify all input files, then all
  177. output files. Also do not mix options which belong to different files. All
  178. options apply \s-1ONLY\s0 to the next input or output file and are reset between files.
  179. .IP "\(bu" 4
  180. To set the video bitrate of the output file to 64 kbit/s:
  181. .Sp
  182. .Vb 1
  183. \& ffmpeg \-i input.avi \-b:v 64k \-bufsize 64k output.avi
  184. .Ve
  185. .IP "\(bu" 4
  186. To force the frame rate of the output file to 24 fps:
  187. .Sp
  188. .Vb 1
  189. \& ffmpeg \-i input.avi \-r 24 output.avi
  190. .Ve
  191. .IP "\(bu" 4
  192. To force the frame rate of the input file (valid for raw formats only)
  193. to 1 fps and the frame rate of the output file to 24 fps:
  194. .Sp
  195. .Vb 1
  196. \& ffmpeg \-r 1 \-i input.m2v \-r 24 output.avi
  197. .Ve
  198. .PP
  199. The format option may be needed for raw input files.
  200. .SH "DETAILED DESCRIPTION"
  201. .IX Header "DETAILED DESCRIPTION"
  202. The transcoding process in \fBffmpeg\fR for each output can be described by
  203. the following diagram:
  204. .PP
  205. .Vb 10
  206. \& _\|_\|_\|_\|_\|_\|_ _\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_
  207. \& | | | |
  208. \& | input | demuxer | encoded data | decoder
  209. \& | file | \-\-\-\-\-\-\-\-\-> | packets | \-\-\-\-\-+
  210. \& |_\|_\|_\|_\|_\|_\|_| |_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_| |
  211. \& v
  212. \& _\|_\|_\|_\|_\|_\|_\|_\|_
  213. \& | |
  214. \& | decoded |
  215. \& | frames |
  216. \& |_\|_\|_\|_\|_\|_\|_\|_\|_|
  217. \& _\|_\|_\|_\|_\|_\|_\|_ _\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_ |
  218. \& | | | | |
  219. \& | output | <\-\-\-\-\-\-\-\- | encoded data | <\-\-\-\-+
  220. \& | file | muxer | packets | encoder
  221. \& |_\|_\|_\|_\|_\|_\|_\|_| |_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_|
  222. .Ve
  223. .PP
  224. \&\fBffmpeg\fR calls the libavformat library (containing demuxers) to read
  225. input files and get packets containing encoded data from them. When there are
  226. multiple input files, \fBffmpeg\fR tries to keep them synchronized by
  227. tracking lowest timestamp on any active input stream.
  228. .PP
  229. Encoded packets are then passed to the decoder (unless streamcopy is selected
  230. for the stream, see further for a description). The decoder produces
  231. uncompressed frames (raw video/PCM audio/...) which can be processed further by
  232. filtering (see next section). After filtering, the frames are passed to the
  233. encoder, which encodes them and outputs encoded packets. Finally those are
  234. passed to the muxer, which writes the encoded packets to the output file.
  235. .SS "Filtering"
  236. .IX Subsection "Filtering"
  237. Before encoding, \fBffmpeg\fR can process raw audio and video frames using
  238. filters from the libavfilter library. Several chained filters form a filter
  239. graph. \fBffmpeg\fR distinguishes between two types of filtergraphs:
  240. simple and complex.
  241. .PP
  242. \fISimple filtergraphs\fR
  243. .IX Subsection "Simple filtergraphs"
  244. .PP
  245. Simple filtergraphs are those that have exactly one input and output, both of
  246. the same type. In the above diagram they can be represented by simply inserting
  247. an additional step between decoding and encoding:
  248. .PP
  249. .Vb 10
  250. \& _\|_\|_\|_\|_\|_\|_\|_\|_ _\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_
  251. \& | | | |
  252. \& | decoded | | encoded data |
  253. \& | frames |\e _ | packets |
  254. \& |_\|_\|_\|_\|_\|_\|_\|_\|_| \e /||_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_|
  255. \& \e _\|_\|_\|_\|_\|_\|_\|_\|_\|_ /
  256. \& simple _\e|| | / encoder
  257. \& filtergraph | filtered |/
  258. \& | frames |
  259. \& |_\|_\|_\|_\|_\|_\|_\|_\|_\|_|
  260. .Ve
  261. .PP
  262. Simple filtergraphs are configured with the per-stream \fB\-filter\fR option
  263. (with \fB\-vf\fR and \fB\-af\fR aliases for video and audio respectively).
  264. A simple filtergraph for video can look for example like this:
  265. .PP
  266. .Vb 4
  267. \& _\|_\|_\|_\|_\|_\|_ _\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_ _\|_\|_\|_\|_\|_\|_ _\|_\|_\|_\|_\|_\|_\|_
  268. \& | | | | | | | |
  269. \& | input | \-\-\-> | deinterlace | \-\-\-> | scale | \-\-\-> | output |
  270. \& |_\|_\|_\|_\|_\|_\|_| |_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_| |_\|_\|_\|_\|_\|_\|_| |_\|_\|_\|_\|_\|_\|_\|_|
  271. .Ve
  272. .PP
  273. Note that some filters change frame properties but not frame contents. E.g. the
  274. \&\f(CW\*(C`fps\*(C'\fR filter in the example above changes number of frames, but does not
  275. touch the frame contents. Another example is the \f(CW\*(C`setpts\*(C'\fR filter, which
  276. only sets timestamps and otherwise passes the frames unchanged.
  277. .PP
  278. \fIComplex filtergraphs\fR
  279. .IX Subsection "Complex filtergraphs"
  280. .PP
  281. Complex filtergraphs are those which cannot be described as simply a linear
  282. processing chain applied to one stream. This is the case, for example, when the graph has
  283. more than one input and/or output, or when output stream type is different from
  284. input. They can be represented with the following diagram:
  285. .PP
  286. .Vb 10
  287. \& _\|_\|_\|_\|_\|_\|_\|_\|_
  288. \& | |
  289. \& | input 0 |\e _\|_\|_\|_\|_\|_\|_\|_\|_\|_
  290. \& |_\|_\|_\|_\|_\|_\|_\|_\|_| \e | |
  291. \& \e _\|_\|_\|_\|_\|_\|_\|_\|_ /| output 0 |
  292. \& \e | | / |_\|_\|_\|_\|_\|_\|_\|_\|_\|_|
  293. \& _\|_\|_\|_\|_\|_\|_\|_\|_ \e| complex | /
  294. \& | | | |/
  295. \& | input 1 |\-\-\-\->| filter |\e
  296. \& |_\|_\|_\|_\|_\|_\|_\|_\|_| | | \e _\|_\|_\|_\|_\|_\|_\|_\|_\|_
  297. \& /| graph | \e | |
  298. \& / | | \e| output 1 |
  299. \& _\|_\|_\|_\|_\|_\|_\|_\|_ / |_\|_\|_\|_\|_\|_\|_\|_\|_| |_\|_\|_\|_\|_\|_\|_\|_\|_\|_|
  300. \& | | /
  301. \& | input 2 |/
  302. \& |_\|_\|_\|_\|_\|_\|_\|_\|_|
  303. .Ve
  304. .PP
  305. Complex filtergraphs are configured with the \fB\-filter_complex\fR option.
  306. Note that this option is global, since a complex filtergraph, by its nature,
  307. cannot be unambiguously associated with a single stream or file.
  308. .PP
  309. The \fB\-lavfi\fR option is equivalent to \fB\-filter_complex\fR.
  310. .PP
  311. A trivial example of a complex filtergraph is the \f(CW\*(C`overlay\*(C'\fR filter, which
  312. has two video inputs and one video output, containing one video overlaid on top
  313. of the other. Its audio counterpart is the \f(CW\*(C`amix\*(C'\fR filter.
  314. .SS "Stream copy"
  315. .IX Subsection "Stream copy"
  316. Stream copy is a mode selected by supplying the \f(CW\*(C`copy\*(C'\fR parameter to the
  317. \&\fB\-codec\fR option. It makes \fBffmpeg\fR omit the decoding and encoding
  318. step for the specified stream, so it does only demuxing and muxing. It is useful
  319. for changing the container format or modifying container-level metadata. The
  320. diagram above will, in this case, simplify to this:
  321. .PP
  322. .Vb 5
  323. \& _\|_\|_\|_\|_\|_\|_ _\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_ _\|_\|_\|_\|_\|_\|_\|_
  324. \& | | | | | |
  325. \& | input | demuxer | encoded data | muxer | output |
  326. \& | file | \-\-\-\-\-\-\-\-\-> | packets | \-\-\-\-\-\-\-> | file |
  327. \& |_\|_\|_\|_\|_\|_\|_| |_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_| |_\|_\|_\|_\|_\|_\|_\|_|
  328. .Ve
  329. .PP
  330. Since there is no decoding or encoding, it is very fast and there is no quality
  331. loss. However, it might not work in some cases because of many factors. Applying
  332. filters is obviously also impossible, since filters work on uncompressed data.
  333. .SH "STREAM SELECTION"
  334. .IX Header "STREAM SELECTION"
  335. \&\fBffmpeg\fR provides the \f(CW\*(C`\-map\*(C'\fR option for manual control of stream selection in each
  336. output file. Users can skip \f(CW\*(C`\-map\*(C'\fR and let ffmpeg perform automatic stream selection as
  337. described below. The \f(CW\*(C`\-vn / \-an / \-sn / \-dn\*(C'\fR options can be used to skip inclusion of
  338. video, audio, subtitle and data streams respectively, whether manually mapped or automatically
  339. selected, except for those streams which are outputs of complex filtergraphs.
  340. .SS "Description"
  341. .IX Subsection "Description"
  342. The sub-sections that follow describe the various rules that are involved in stream selection.
  343. The examples that follow next show how these rules are applied in practice.
  344. .PP
  345. While every effort is made to accurately reflect the behavior of the program, FFmpeg is under
  346. continuous development and the code may have changed since the time of this writing.
  347. .PP
  348. \fIAutomatic stream selection\fR
  349. .IX Subsection "Automatic stream selection"
  350. .PP
  351. In the absence of any map options for a particular output file, ffmpeg inspects the output
  352. format to check which type of streams can be included in it, viz. video, audio and/or
  353. subtitles. For each acceptable stream type, ffmpeg will pick one stream, when available,
  354. from among all the inputs.
  355. .PP
  356. It will select that stream based upon the following criteria:
  357. .IP "\(bu" 4
  358. for video, it is the stream with the highest resolution,
  359. .IP "\(bu" 4
  360. for audio, it is the stream with the most channels,
  361. .IP "\(bu" 4
  362. for subtitles, it is the first subtitle stream found but there's a caveat.
  363. The output format's default subtitle encoder can be either text-based or image-based,
  364. and only a subtitle stream of the same type will be chosen.
  365. .PP
  366. In the case where several streams of the same type rate equally, the stream with the lowest
  367. index is chosen.
  368. .PP
  369. Data or attachment streams are not automatically selected and can only be included
  370. using \f(CW\*(C`\-map\*(C'\fR.
  371. .PP
  372. \fIManual stream selection\fR
  373. .IX Subsection "Manual stream selection"
  374. .PP
  375. When \f(CW\*(C`\-map\*(C'\fR is used, only user-mapped streams are included in that output file,
  376. with one possible exception for filtergraph outputs described below.
  377. .PP
  378. \fIComplex filtergraphs\fR
  379. .IX Subsection "Complex filtergraphs"
  380. .PP
  381. If there are any complex filtergraph output streams with unlabeled pads, they will be added
  382. to the first output file. This will lead to a fatal error if the stream type is not supported
  383. by the output format. In the absence of the map option, the inclusion of these streams leads
  384. to the automatic stream selection of their types being skipped. If map options are present,
  385. these filtergraph streams are included in addition to the mapped streams.
  386. .PP
  387. Complex filtergraph output streams with labeled pads must be mapped once and exactly once.
  388. .PP
  389. \fIStream handling\fR
  390. .IX Subsection "Stream handling"
  391. .PP
  392. Stream handling is independent of stream selection, with an exception for subtitles described
  393. below. Stream handling is set via the \f(CW\*(C`\-codec\*(C'\fR option addressed to streams within a
  394. specific \fIoutput\fR file. In particular, codec options are applied by ffmpeg after the
  395. stream selection process and thus do not influence the latter. If no \f(CW\*(C`\-codec\*(C'\fR option is
  396. specified for a stream type, ffmpeg will select the default encoder registered by the output
  397. file muxer.
  398. .PP
  399. An exception exists for subtitles. If a subtitle encoder is specified for an output file, the
  400. first subtitle stream found of any type, text or image, will be included. ffmpeg does not validate
  401. if the specified encoder can convert the selected stream or if the converted stream is acceptable
  402. within the output format. This applies generally as well: when the user sets an encoder manually,
  403. the stream selection process cannot check if the encoded stream can be muxed into the output file.
  404. If it cannot, ffmpeg will abort and \fIall\fR output files will fail to be processed.
  405. .SS "Examples"
  406. .IX Subsection "Examples"
  407. The following examples illustrate the behavior, quirks and limitations of ffmpeg's stream
  408. selection methods.
  409. .PP
  410. They assume the following three input files.
  411. .PP
  412. .Vb 3
  413. \& input file \*(AqA.avi\*(Aq
  414. \& stream 0: video 640x360
  415. \& stream 1: audio 2 channels
  416. \&
  417. \& input file \*(AqB.mp4\*(Aq
  418. \& stream 0: video 1920x1080
  419. \& stream 1: audio 2 channels
  420. \& stream 2: subtitles (text)
  421. \& stream 3: audio 5.1 channels
  422. \& stream 4: subtitles (text)
  423. \&
  424. \& input file \*(AqC.mkv\*(Aq
  425. \& stream 0: video 1280x720
  426. \& stream 1: audio 2 channels
  427. \& stream 2: subtitles (image)
  428. .Ve
  429. .PP
  430. Example: automatic stream selection
  431. .IX Subsection "Example: automatic stream selection"
  432. .PP
  433. .Vb 1
  434. \& ffmpeg \-i A.avi \-i B.mp4 out1.mkv out2.wav \-map 1:a \-c:a copy out3.mov
  435. .Ve
  436. .PP
  437. There are three output files specified, and for the first two, no \f(CW\*(C`\-map\*(C'\fR options
  438. are set, so ffmpeg will select streams for these two files automatically.
  439. .PP
  440. \&\fIout1.mkv\fR is a Matroska container file and accepts video, audio and subtitle streams,
  441. so ffmpeg will try to select one of each type.For video, it will select \f(CW\*(C`stream 0\*(C'\fR from \fIB.mp4\fR, which has the highest
  442. resolution among all the input video streams.For audio, it will select \f(CW\*(C`stream 3\*(C'\fR from \fIB.mp4\fR, since it has the greatest
  443. number of channels.For subtitles, it will select \f(CW\*(C`stream 2\*(C'\fR from \fIB.mp4\fR, which is the first subtitle
  444. stream from among \fIA.avi\fR and \fIB.mp4\fR.
  445. .PP
  446. \&\fIout2.wav\fR accepts only audio streams, so only \f(CW\*(C`stream 3\*(C'\fR from \fIB.mp4\fR is
  447. selected.
  448. .PP
  449. For \fIout3.mov\fR, since a \f(CW\*(C`\-map\*(C'\fR option is set, no automatic stream selection will
  450. occur. The \f(CW\*(C`\-map 1:a\*(C'\fR option will select all audio streams from the second input
  451. \&\fIB.mp4\fR. No other streams will be included in this output file.
  452. .PP
  453. For the first two outputs, all included streams will be transcoded. The encoders chosen will
  454. be the default ones registered by each output format, which may not match the codec of the
  455. selected input streams.
  456. .PP
  457. For the third output, codec option for audio streams has been set
  458. to \f(CW\*(C`copy\*(C'\fR, so no decoding-filtering-encoding operations will occur, or \fIcan\fR occur.
  459. Packets of selected streams shall be conveyed from the input file and muxed within the output
  460. file.
  461. .PP
  462. Example: automatic subtitles selection
  463. .IX Subsection "Example: automatic subtitles selection"
  464. .PP
  465. .Vb 1
  466. \& ffmpeg \-i C.mkv out1.mkv \-c:s dvdsub \-an out2.mkv
  467. .Ve
  468. .PP
  469. Although \fIout1.mkv\fR is a Matroska container file which accepts subtitle streams, only a
  470. video and audio stream shall be selected. The subtitle stream of \fIC.mkv\fR is image-based
  471. and the default subtitle encoder of the Matroska muxer is text-based, so a transcode operation
  472. for the subtitles is expected to fail and hence the stream isn't selected. However, in
  473. \&\fIout2.mkv\fR, a subtitle encoder is specified in the command and so, the subtitle stream is
  474. selected, in addition to the video stream. The presence of \f(CW\*(C`\-an\*(C'\fR disables audio stream
  475. selection for \fIout2.mkv\fR.
  476. .PP
  477. Example: unlabeled filtergraph outputs
  478. .IX Subsection "Example: unlabeled filtergraph outputs"
  479. .PP
  480. .Vb 1
  481. \& ffmpeg \-i A.avi \-i C.mkv \-i B.mp4 \-filter_complex "overlay" out1.mp4 out2.srt
  482. .Ve
  483. .PP
  484. A filtergraph is setup here using the \f(CW\*(C`\-filter_complex\*(C'\fR option and consists of a single
  485. video filter. The \f(CW\*(C`overlay\*(C'\fR filter requires exactly two video inputs, but none are
  486. specified, so the first two available video streams are used, those of \fIA.avi\fR and
  487. \&\fIC.mkv\fR. The output pad of the filter has no label and so is sent to the first output file
  488. \&\fIout1.mp4\fR. Due to this, automatic selection of the video stream is skipped, which would
  489. have selected the stream in \fIB.mp4\fR. The audio stream with most channels viz. \f(CW\*(C`stream 3\*(C'\fR
  490. in \fIB.mp4\fR, is chosen automatically. No subtitle stream is chosen however, since the \s-1MP4\s0
  491. format has no default subtitle encoder registered, and the user hasn't specified a subtitle encoder.
  492. .PP
  493. The 2nd output file, \fIout2.srt\fR, only accepts text-based subtitle streams. So, even though
  494. the first subtitle stream available belongs to \fIC.mkv\fR, it is image-based and hence skipped.
  495. The selected stream, \f(CW\*(C`stream 2\*(C'\fR in \fIB.mp4\fR, is the first text-based subtitle stream.
  496. .PP
  497. Example: labeled filtergraph outputs
  498. .IX Subsection "Example: labeled filtergraph outputs"
  499. .PP
  500. .Vb 4
  501. \& ffmpeg \-i A.avi \-i B.mp4 \-i C.mkv \-filter_complex "[1:v]hue=s=0[outv];overlay;aresample" \e
  502. \& \-map \*(Aq[outv]\*(Aq \-an out1.mp4 \e
  503. \& out2.mkv \e
  504. \& \-map \*(Aq[outv]\*(Aq \-map 1:a:0 out3.mkv
  505. .Ve
  506. .PP
  507. The above command will fail, as the output pad labelled \f(CW\*(C`[outv]\*(C'\fR has been mapped twice.
  508. None of the output files shall be processed.
  509. .PP
  510. .Vb 4
  511. \& ffmpeg \-i A.avi \-i B.mp4 \-i C.mkv \-filter_complex "[1:v]hue=s=0[outv];overlay;aresample" \e
  512. \& \-an out1.mp4 \e
  513. \& out2.mkv \e
  514. \& \-map 1:a:0 out3.mkv
  515. .Ve
  516. .PP
  517. This command above will also fail as the hue filter output has a label, \f(CW\*(C`[outv]\*(C'\fR,
  518. and hasn't been mapped anywhere.
  519. .PP
  520. The command should be modified as follows,
  521. .PP
  522. .Vb 4
  523. \& ffmpeg \-i A.avi \-i B.mp4 \-i C.mkv \-filter_complex "[1:v]hue=s=0,split=2[outv1][outv2];overlay;aresample" \e
  524. \& \-map \*(Aq[outv1]\*(Aq \-an out1.mp4 \e
  525. \& out2.mkv \e
  526. \& \-map \*(Aq[outv2]\*(Aq \-map 1:a:0 out3.mkv
  527. .Ve
  528. .PP
  529. The video stream from \fIB.mp4\fR is sent to the hue filter, whose output is cloned once using
  530. the split filter, and both outputs labelled. Then a copy each is mapped to the first and third
  531. output files.
  532. .PP
  533. The overlay filter, requiring two video inputs, uses the first two unused video streams. Those
  534. are the streams from \fIA.avi\fR and \fIC.mkv\fR. The overlay output isn't labelled, so it is
  535. sent to the first output file \fIout1.mp4\fR, regardless of the presence of the \f(CW\*(C`\-map\*(C'\fR option.
  536. .PP
  537. The aresample filter is sent the first unused audio stream, that of \fIA.avi\fR. Since this filter
  538. output is also unlabelled, it too is mapped to the first output file. The presence of \f(CW\*(C`\-an\*(C'\fR
  539. only suppresses automatic or manual stream selection of audio streams, not outputs sent from
  540. filtergraphs. Both these mapped streams shall be ordered before the mapped stream in \fIout1.mp4\fR.
  541. .PP
  542. The video, audio and subtitle streams mapped to \f(CW\*(C`out2.mkv\*(C'\fR are entirely determined by
  543. automatic stream selection.
  544. .PP
  545. \&\fIout3.mkv\fR consists of the cloned video output from the hue filter and the first audio
  546. stream from \fIB.mp4\fR.
  547. .SH "OPTIONS"
  548. .IX Header "OPTIONS"
  549. All the numerical options, if not specified otherwise, accept a string
  550. representing a number as input, which may be followed by one of the \s-1SI\s0
  551. unit prefixes, for example: 'K', 'M', or 'G'.
  552. .PP
  553. If 'i' is appended to the \s-1SI\s0 unit prefix, the complete prefix will be
  554. interpreted as a unit prefix for binary multiples, which are based on
  555. powers of 1024 instead of powers of 1000. Appending 'B' to the \s-1SI\s0 unit
  556. prefix multiplies the value by 8. This allows using, for example:
  557. \&'\s-1KB\s0', 'MiB', 'G' and 'B' as number suffixes.
  558. .PP
  559. Options which do not take arguments are boolean options, and set the
  560. corresponding value to true. They can be set to false by prefixing
  561. the option name with \*(L"no\*(R". For example using \*(L"\-nofoo\*(R"
  562. will set the boolean option with name \*(L"foo\*(R" to false.
  563. .SS "Stream specifiers"
  564. .IX Subsection "Stream specifiers"
  565. Some options are applied per-stream, e.g. bitrate or codec. Stream specifiers
  566. are used to precisely specify which stream(s) a given option belongs to.
  567. .PP
  568. A stream specifier is a string generally appended to the option name and
  569. separated from it by a colon. E.g. \f(CW\*(C`\-codec:a:1 ac3\*(C'\fR contains the
  570. \&\f(CW\*(C`a:1\*(C'\fR stream specifier, which matches the second audio stream. Therefore, it
  571. would select the ac3 codec for the second audio stream.
  572. .PP
  573. A stream specifier can match several streams, so that the option is applied to all
  574. of them. E.g. the stream specifier in \f(CW\*(C`\-b:a 128k\*(C'\fR matches all audio
  575. streams.
  576. .PP
  577. An empty stream specifier matches all streams. For example, \f(CW\*(C`\-codec copy\*(C'\fR
  578. or \f(CW\*(C`\-codec: copy\*(C'\fR would copy all the streams without reencoding.
  579. .PP
  580. Possible forms of stream specifiers are:
  581. .IP "\fIstream_index\fR" 4
  582. .IX Item "stream_index"
  583. Matches the stream with this index. E.g. \f(CW\*(C`\-threads:1 4\*(C'\fR would set the
  584. thread count for the second stream to 4. If \fIstream_index\fR is used as an
  585. additional stream specifier (see below), then it selects stream number
  586. \&\fIstream_index\fR from the matching streams. Stream numbering is based on the
  587. order of the streams as detected by libavformat except when a program \s-1ID\s0 is
  588. also specified. In this case it is based on the ordering of the streams in the
  589. program.
  590. .IP "\fIstream_type\fR\fB[:\fR\fIadditional_stream_specifier\fR\fB]\fR" 4
  591. .IX Item "stream_type[:additional_stream_specifier]"
  592. \&\fIstream_type\fR is one of following: 'v' or 'V' for video, 'a' for audio, 's'
  593. for subtitle, 'd' for data, and 't' for attachments. 'v' matches all video
  594. streams, 'V' only matches video streams which are not attached pictures, video
  595. thumbnails or cover arts. If \fIadditional_stream_specifier\fR is used, then
  596. it matches streams which both have this type and match the
  597. \&\fIadditional_stream_specifier\fR. Otherwise, it matches all streams of the
  598. specified type.
  599. .IP "\fBp:\fR\fIprogram_id\fR\fB[:\fR\fIadditional_stream_specifier\fR\fB]\fR" 4
  600. .IX Item "p:program_id[:additional_stream_specifier]"
  601. Matches streams which are in the program with the id \fIprogram_id\fR. If
  602. \&\fIadditional_stream_specifier\fR is used, then it matches streams which both
  603. are part of the program and match the \fIadditional_stream_specifier\fR.
  604. .IP "\fB#\fR\fIstream_id\fR \fBor i:\fR\fIstream_id\fR" 4
  605. .IX Item "#stream_id or i:stream_id"
  606. Match the stream by stream id (e.g. \s-1PID\s0 in MPEG-TS container).
  607. .IP "\fBm:\fR\fIkey\fR\fB[:\fR\fIvalue\fR\fB]\fR" 4
  608. .IX Item "m:key[:value]"
  609. Matches streams with the metadata tag \fIkey\fR having the specified value. If
  610. \&\fIvalue\fR is not given, matches streams that contain the given tag with any
  611. value.
  612. .IP "\fBu\fR" 4
  613. .IX Item "u"
  614. Matches streams with usable configuration, the codec must be defined and the
  615. essential information such as video dimension or audio sample rate must be present.
  616. .Sp
  617. Note that in \fBffmpeg\fR, matching by metadata will only work properly for
  618. input files.
  619. .SS "Generic options"
  620. .IX Subsection "Generic options"
  621. These options are shared amongst the ff* tools.
  622. .IP "\fB\-L\fR" 4
  623. .IX Item "-L"
  624. Show license.
  625. .IP "\fB\-h, \-?, \-help, \-\-help [\fR\fIarg\fR\fB]\fR" 4
  626. .IX Item "-h, -?, -help, --help [arg]"
  627. Show help. An optional parameter may be specified to print help about a specific
  628. item. If no argument is specified, only basic (non advanced) tool
  629. options are shown.
  630. .Sp
  631. Possible values of \fIarg\fR are:
  632. .RS 4
  633. .IP "\fBlong\fR" 4
  634. .IX Item "long"
  635. Print advanced tool options in addition to the basic tool options.
  636. .IP "\fBfull\fR" 4
  637. .IX Item "full"
  638. Print complete list of options, including shared and private options
  639. for encoders, decoders, demuxers, muxers, filters, etc.
  640. .IP "\fBdecoder=\fR\fIdecoder_name\fR" 4
  641. .IX Item "decoder=decoder_name"
  642. Print detailed information about the decoder named \fIdecoder_name\fR. Use the
  643. \&\fB\-decoders\fR option to get a list of all decoders.
  644. .IP "\fBencoder=\fR\fIencoder_name\fR" 4
  645. .IX Item "encoder=encoder_name"
  646. Print detailed information about the encoder named \fIencoder_name\fR. Use the
  647. \&\fB\-encoders\fR option to get a list of all encoders.
  648. .IP "\fBdemuxer=\fR\fIdemuxer_name\fR" 4
  649. .IX Item "demuxer=demuxer_name"
  650. Print detailed information about the demuxer named \fIdemuxer_name\fR. Use the
  651. \&\fB\-formats\fR option to get a list of all demuxers and muxers.
  652. .IP "\fBmuxer=\fR\fImuxer_name\fR" 4
  653. .IX Item "muxer=muxer_name"
  654. Print detailed information about the muxer named \fImuxer_name\fR. Use the
  655. \&\fB\-formats\fR option to get a list of all muxers and demuxers.
  656. .IP "\fBfilter=\fR\fIfilter_name\fR" 4
  657. .IX Item "filter=filter_name"
  658. Print detailed information about the filter named \fIfilter_name\fR. Use the
  659. \&\fB\-filters\fR option to get a list of all filters.
  660. .IP "\fBbsf=\fR\fIbitstream_filter_name\fR" 4
  661. .IX Item "bsf=bitstream_filter_name"
  662. Print detailed information about the bitstream filter named \fIbitstream_filter_name\fR.
  663. Use the \fB\-bsfs\fR option to get a list of all bitstream filters.
  664. .IP "\fBprotocol=\fR\fIprotocol_name\fR" 4
  665. .IX Item "protocol=protocol_name"
  666. Print detailed information about the protocol named \fIprotocol_name\fR.
  667. Use the \fB\-protocols\fR option to get a list of all protocols.
  668. .RE
  669. .RS 4
  670. .RE
  671. .IP "\fB\-version\fR" 4
  672. .IX Item "-version"
  673. Show version.
  674. .IP "\fB\-buildconf\fR" 4
  675. .IX Item "-buildconf"
  676. Show the build configuration, one option per line.
  677. .IP "\fB\-formats\fR" 4
  678. .IX Item "-formats"
  679. Show available formats (including devices).
  680. .IP "\fB\-demuxers\fR" 4
  681. .IX Item "-demuxers"
  682. Show available demuxers.
  683. .IP "\fB\-muxers\fR" 4
  684. .IX Item "-muxers"
  685. Show available muxers.
  686. .IP "\fB\-devices\fR" 4
  687. .IX Item "-devices"
  688. Show available devices.
  689. .IP "\fB\-codecs\fR" 4
  690. .IX Item "-codecs"
  691. Show all codecs known to libavcodec.
  692. .Sp
  693. Note that the term 'codec' is used throughout this documentation as a shortcut
  694. for what is more correctly called a media bitstream format.
  695. .IP "\fB\-decoders\fR" 4
  696. .IX Item "-decoders"
  697. Show available decoders.
  698. .IP "\fB\-encoders\fR" 4
  699. .IX Item "-encoders"
  700. Show all available encoders.
  701. .IP "\fB\-bsfs\fR" 4
  702. .IX Item "-bsfs"
  703. Show available bitstream filters.
  704. .IP "\fB\-protocols\fR" 4
  705. .IX Item "-protocols"
  706. Show available protocols.
  707. .IP "\fB\-filters\fR" 4
  708. .IX Item "-filters"
  709. Show available libavfilter filters.
  710. .IP "\fB\-pix_fmts\fR" 4
  711. .IX Item "-pix_fmts"
  712. Show available pixel formats.
  713. .IP "\fB\-sample_fmts\fR" 4
  714. .IX Item "-sample_fmts"
  715. Show available sample formats.
  716. .IP "\fB\-layouts\fR" 4
  717. .IX Item "-layouts"
  718. Show channel names and standard channel layouts.
  719. .IP "\fB\-colors\fR" 4
  720. .IX Item "-colors"
  721. Show recognized color names.
  722. .IP "\fB\-sources\fR \fIdevice\fR\fB[,\fR\fIopt1\fR\fB=\fR\fIval1\fR\fB[,\fR\fIopt2\fR\fB=\fR\fIval2\fR\fB]...]\fR" 4
  723. .IX Item "-sources device[,opt1=val1[,opt2=val2]...]"
  724. Show autodetected sources of the input device.
  725. Some devices may provide system-dependent source names that cannot be autodetected.
  726. The returned list cannot be assumed to be always complete.
  727. .Sp
  728. .Vb 1
  729. \& ffmpeg \-sources pulse,server=192.168.0.4
  730. .Ve
  731. .IP "\fB\-sinks\fR \fIdevice\fR\fB[,\fR\fIopt1\fR\fB=\fR\fIval1\fR\fB[,\fR\fIopt2\fR\fB=\fR\fIval2\fR\fB]...]\fR" 4
  732. .IX Item "-sinks device[,opt1=val1[,opt2=val2]...]"
  733. Show autodetected sinks of the output device.
  734. Some devices may provide system-dependent sink names that cannot be autodetected.
  735. The returned list cannot be assumed to be always complete.
  736. .Sp
  737. .Vb 1
  738. \& ffmpeg \-sinks pulse,server=192.168.0.4
  739. .Ve
  740. .IP "\fB\-loglevel [\fR\fIflags\fR\fB+]\fR\fIloglevel\fR \fB| \-v [\fR\fIflags\fR\fB+]\fR\fIloglevel\fR" 4
  741. .IX Item "-loglevel [flags+]loglevel | -v [flags+]loglevel"
  742. Set logging level and flags used by the library.
  743. .Sp
  744. The optional \fIflags\fR prefix can consist of the following values:
  745. .RS 4
  746. .IP "\fBrepeat\fR" 4
  747. .IX Item "repeat"
  748. Indicates that repeated log output should not be compressed to the first line
  749. and the \*(L"Last message repeated n times\*(R" line will be omitted.
  750. .IP "\fBlevel\fR" 4
  751. .IX Item "level"
  752. Indicates that log output should add a \f(CW\*(C`[level]\*(C'\fR prefix to each message
  753. line. This can be used as an alternative to log coloring, e.g. when dumping the
  754. log to file.
  755. .RE
  756. .RS 4
  757. .Sp
  758. Flags can also be used alone by adding a '+'/'\-' prefix to set/reset a single
  759. flag without affecting other \fIflags\fR or changing \fIloglevel\fR. When
  760. setting both \fIflags\fR and \fIloglevel\fR, a '+' separator is expected
  761. between the last \fIflags\fR value and before \fIloglevel\fR.
  762. .Sp
  763. \&\fIloglevel\fR is a string or a number containing one of the following values:
  764. .IP "\fBquiet, \-8\fR" 4
  765. .IX Item "quiet, -8"
  766. Show nothing at all; be silent.
  767. .IP "\fBpanic, 0\fR" 4
  768. .IX Item "panic, 0"
  769. Only show fatal errors which could lead the process to crash, such as
  770. an assertion failure. This is not currently used for anything.
  771. .IP "\fBfatal, 8\fR" 4
  772. .IX Item "fatal, 8"
  773. Only show fatal errors. These are errors after which the process absolutely
  774. cannot continue.
  775. .IP "\fBerror, 16\fR" 4
  776. .IX Item "error, 16"
  777. Show all errors, including ones which can be recovered from.
  778. .IP "\fBwarning, 24\fR" 4
  779. .IX Item "warning, 24"
  780. Show all warnings and errors. Any message related to possibly
  781. incorrect or unexpected events will be shown.
  782. .IP "\fBinfo, 32\fR" 4
  783. .IX Item "info, 32"
  784. Show informative messages during processing. This is in addition to
  785. warnings and errors. This is the default value.
  786. .IP "\fBverbose, 40\fR" 4
  787. .IX Item "verbose, 40"
  788. Same as \f(CW\*(C`info\*(C'\fR, except more verbose.
  789. .IP "\fBdebug, 48\fR" 4
  790. .IX Item "debug, 48"
  791. Show everything, including debugging information.
  792. .IP "\fBtrace, 56\fR" 4
  793. .IX Item "trace, 56"
  794. .RE
  795. .RS 4
  796. .Sp
  797. For example to enable repeated log output, add the \f(CW\*(C`level\*(C'\fR prefix, and set
  798. \&\fIloglevel\fR to \f(CW\*(C`verbose\*(C'\fR:
  799. .Sp
  800. .Vb 1
  801. \& ffmpeg \-loglevel repeat+level+verbose \-i input output
  802. .Ve
  803. .Sp
  804. Another example that enables repeated log output without affecting current
  805. state of \f(CW\*(C`level\*(C'\fR prefix flag or \fIloglevel\fR:
  806. .Sp
  807. .Vb 1
  808. \& ffmpeg [...] \-loglevel +repeat
  809. .Ve
  810. .Sp
  811. By default the program logs to stderr. If coloring is supported by the
  812. terminal, colors are used to mark errors and warnings. Log coloring
  813. can be disabled setting the environment variable
  814. \&\fB\s-1AV_LOG_FORCE_NOCOLOR\s0\fR, or can be forced setting
  815. the environment variable \fB\s-1AV_LOG_FORCE_COLOR\s0\fR.
  816. .RE
  817. .IP "\fB\-report\fR" 4
  818. .IX Item "-report"
  819. Dump full command line and log output to a file named
  820. \&\f(CW\*(C`\f(CIprogram\f(CW\-\f(CIYYYYMMDD\f(CW\-\f(CIHHMMSS\f(CW.log\*(C'\fR in the current
  821. directory.
  822. This file can be useful for bug reports.
  823. It also implies \f(CW\*(C`\-loglevel debug\*(C'\fR.
  824. .Sp
  825. Setting the environment variable \fB\s-1FFREPORT\s0\fR to any value has the
  826. same effect. If the value is a ':'\-separated key=value sequence, these
  827. options will affect the report; option values must be escaped if they
  828. contain special characters or the options delimiter ':' (see the
  829. ``Quoting and escaping'' section in the ffmpeg-utils manual).
  830. .Sp
  831. The following options are recognized:
  832. .RS 4
  833. .IP "\fBfile\fR" 4
  834. .IX Item "file"
  835. set the file name to use for the report; \f(CW%p\fR is expanded to the name
  836. of the program, \f(CW%t\fR is expanded to a timestamp, \f(CW\*(C`%%\*(C'\fR is expanded
  837. to a plain \f(CW\*(C`%\*(C'\fR
  838. .IP "\fBlevel\fR" 4
  839. .IX Item "level"
  840. set the log verbosity level using a numerical value (see \f(CW\*(C`\-loglevel\*(C'\fR).
  841. .RE
  842. .RS 4
  843. .Sp
  844. For example, to output a report to a file named \fIffreport.log\fR
  845. using a log level of \f(CW32\fR (alias for log level \f(CW\*(C`info\*(C'\fR):
  846. .Sp
  847. .Vb 1
  848. \& FFREPORT=file=ffreport.log:level=32 ffmpeg \-i input output
  849. .Ve
  850. .Sp
  851. Errors in parsing the environment variable are not fatal, and will not
  852. appear in the report.
  853. .RE
  854. .IP "\fB\-hide_banner\fR" 4
  855. .IX Item "-hide_banner"
  856. Suppress printing banner.
  857. .Sp
  858. All FFmpeg tools will normally show a copyright notice, build options
  859. and library versions. This option can be used to suppress printing
  860. this information.
  861. .IP "\fB\-cpuflags flags (\fR\fIglobal\fR\fB)\fR" 4
  862. .IX Item "-cpuflags flags (global)"
  863. Allows setting and clearing cpu flags. This option is intended
  864. for testing. Do not use it unless you know what you're doing.
  865. .Sp
  866. .Vb 3
  867. \& ffmpeg \-cpuflags \-sse+mmx ...
  868. \& ffmpeg \-cpuflags mmx ...
  869. \& ffmpeg \-cpuflags 0 ...
  870. .Ve
  871. .Sp
  872. Possible flags for this option are:
  873. .RS 4
  874. .IP "\fBx86\fR" 4
  875. .IX Item "x86"
  876. .RS 4
  877. .PD 0
  878. .IP "\fBmmx\fR" 4
  879. .IX Item "mmx"
  880. .IP "\fBmmxext\fR" 4
  881. .IX Item "mmxext"
  882. .IP "\fBsse\fR" 4
  883. .IX Item "sse"
  884. .IP "\fBsse2\fR" 4
  885. .IX Item "sse2"
  886. .IP "\fBsse2slow\fR" 4
  887. .IX Item "sse2slow"
  888. .IP "\fBsse3\fR" 4
  889. .IX Item "sse3"
  890. .IP "\fBsse3slow\fR" 4
  891. .IX Item "sse3slow"
  892. .IP "\fBssse3\fR" 4
  893. .IX Item "ssse3"
  894. .IP "\fBatom\fR" 4
  895. .IX Item "atom"
  896. .IP "\fBsse4.1\fR" 4
  897. .IX Item "sse4.1"
  898. .IP "\fBsse4.2\fR" 4
  899. .IX Item "sse4.2"
  900. .IP "\fBavx\fR" 4
  901. .IX Item "avx"
  902. .IP "\fBavx2\fR" 4
  903. .IX Item "avx2"
  904. .IP "\fBxop\fR" 4
  905. .IX Item "xop"
  906. .IP "\fBfma3\fR" 4
  907. .IX Item "fma3"
  908. .IP "\fBfma4\fR" 4
  909. .IX Item "fma4"
  910. .IP "\fB3dnow\fR" 4
  911. .IX Item "3dnow"
  912. .IP "\fB3dnowext\fR" 4
  913. .IX Item "3dnowext"
  914. .IP "\fBbmi1\fR" 4
  915. .IX Item "bmi1"
  916. .IP "\fBbmi2\fR" 4
  917. .IX Item "bmi2"
  918. .IP "\fBcmov\fR" 4
  919. .IX Item "cmov"
  920. .RE
  921. .RS 4
  922. .RE
  923. .IP "\fB\s-1ARM\s0\fR" 4
  924. .IX Item "ARM"
  925. .RS 4
  926. .IP "\fBarmv5te\fR" 4
  927. .IX Item "armv5te"
  928. .IP "\fBarmv6\fR" 4
  929. .IX Item "armv6"
  930. .IP "\fBarmv6t2\fR" 4
  931. .IX Item "armv6t2"
  932. .IP "\fBvfp\fR" 4
  933. .IX Item "vfp"
  934. .IP "\fBvfpv3\fR" 4
  935. .IX Item "vfpv3"
  936. .IP "\fBneon\fR" 4
  937. .IX Item "neon"
  938. .IP "\fBsetend\fR" 4
  939. .IX Item "setend"
  940. .RE
  941. .RS 4
  942. .RE
  943. .IP "\fBAArch64\fR" 4
  944. .IX Item "AArch64"
  945. .RS 4
  946. .IP "\fBarmv8\fR" 4
  947. .IX Item "armv8"
  948. .IP "\fBvfp\fR" 4
  949. .IX Item "vfp"
  950. .IP "\fBneon\fR" 4
  951. .IX Item "neon"
  952. .RE
  953. .RS 4
  954. .RE
  955. .IP "\fBPowerPC\fR" 4
  956. .IX Item "PowerPC"
  957. .RS 4
  958. .IP "\fBaltivec\fR" 4
  959. .IX Item "altivec"
  960. .RE
  961. .RS 4
  962. .RE
  963. .IP "\fBSpecific Processors\fR" 4
  964. .IX Item "Specific Processors"
  965. .RS 4
  966. .IP "\fBpentium2\fR" 4
  967. .IX Item "pentium2"
  968. .IP "\fBpentium3\fR" 4
  969. .IX Item "pentium3"
  970. .IP "\fBpentium4\fR" 4
  971. .IX Item "pentium4"
  972. .IP "\fBk6\fR" 4
  973. .IX Item "k6"
  974. .IP "\fBk62\fR" 4
  975. .IX Item "k62"
  976. .IP "\fBathlon\fR" 4
  977. .IX Item "athlon"
  978. .IP "\fBathlonxp\fR" 4
  979. .IX Item "athlonxp"
  980. .IP "\fBk8\fR" 4
  981. .IX Item "k8"
  982. .RE
  983. .RS 4
  984. .RE
  985. .RE
  986. .RS 4
  987. .RE
  988. .IP "\fB\-max_alloc\fR \fIbytes\fR" 4
  989. .IX Item "-max_alloc bytes"
  990. .PD
  991. Set the maximum size limit for allocating a block on the heap by ffmpeg's
  992. family of malloc functions. Exercise \fBextreme caution\fR when using
  993. this option. Don't use if you do not understand the full consequence of doing so.
  994. Default is \s-1INT_MAX.\s0
  995. .SS "AVOptions"
  996. .IX Subsection "AVOptions"
  997. These options are provided directly by the libavformat, libavdevice and
  998. libavcodec libraries. To see the list of available AVOptions, use the
  999. \&\fB\-help\fR option. They are separated into two categories:
  1000. .IP "\fBgeneric\fR" 4
  1001. .IX Item "generic"
  1002. These options can be set for any container, codec or device. Generic options
  1003. are listed under AVFormatContext options for containers/devices and under
  1004. AVCodecContext options for codecs.
  1005. .IP "\fBprivate\fR" 4
  1006. .IX Item "private"
  1007. These options are specific to the given container, device or codec. Private
  1008. options are listed under their corresponding containers/devices/codecs.
  1009. .PP
  1010. For example to write an ID3v2.3 header instead of a default ID3v2.4 to
  1011. an \s-1MP3\s0 file, use the \fBid3v2_version\fR private option of the \s-1MP3\s0
  1012. muxer:
  1013. .PP
  1014. .Vb 1
  1015. \& ffmpeg \-i input.flac \-id3v2_version 3 out.mp3
  1016. .Ve
  1017. .PP
  1018. All codec AVOptions are per-stream, and thus a stream specifier
  1019. should be attached to them:
  1020. .PP
  1021. .Vb 1
  1022. \& ffmpeg \-i multichannel.mxf \-map 0:v:0 \-map 0:a:0 \-map 0:a:0 \-c:a:0 ac3 \-b:a:0 640k \-ac:a:1 2 \-c:a:1 aac \-b:2 128k out.mp4
  1023. .Ve
  1024. .PP
  1025. In the above example, a multichannel audio stream is mapped twice for output.
  1026. The first instance is encoded with codec ac3 and bitrate 640k.
  1027. The second instance is downmixed to 2 channels and encoded with codec aac. A bitrate of 128k is specified for it using
  1028. absolute index of the output stream.
  1029. .PP
  1030. Note: the \fB\-nooption\fR syntax cannot be used for boolean
  1031. AVOptions, use \fB\-option 0\fR/\fB\-option 1\fR.
  1032. .PP
  1033. Note: the old undocumented way of specifying per-stream AVOptions by
  1034. prepending v/a/s to the options name is now obsolete and will be
  1035. removed soon.
  1036. .SS "Main options"
  1037. .IX Subsection "Main options"
  1038. .IP "\fB\-f\fR \fIfmt\fR \fB(\fR\fIinput/output\fR\fB)\fR" 4
  1039. .IX Item "-f fmt (input/output)"
  1040. Force input or output file format. The format is normally auto detected for input
  1041. files and guessed from the file extension for output files, so this option is not
  1042. needed in most cases.
  1043. .IP "\fB\-i\fR \fIurl\fR \fB(\fR\fIinput\fR\fB)\fR" 4
  1044. .IX Item "-i url (input)"
  1045. input file url
  1046. .IP "\fB\-y (\fR\fIglobal\fR\fB)\fR" 4
  1047. .IX Item "-y (global)"
  1048. Overwrite output files without asking.
  1049. .IP "\fB\-n (\fR\fIglobal\fR\fB)\fR" 4
  1050. .IX Item "-n (global)"
  1051. Do not overwrite output files, and exit immediately if a specified
  1052. output file already exists.
  1053. .IP "\fB\-stream_loop\fR \fInumber\fR \fB(\fR\fIinput\fR\fB)\fR" 4
  1054. .IX Item "-stream_loop number (input)"
  1055. Set number of times input stream shall be looped. Loop 0 means no loop,
  1056. loop \-1 means infinite loop.
  1057. .IP "\fB\-c[:\fR\fIstream_specifier\fR\fB]\fR \fIcodec\fR \fB(\fR\fIinput/output,per\-stream\fR\fB)\fR" 4
  1058. .IX Item "-c[:stream_specifier] codec (input/output,per-stream)"
  1059. .PD 0
  1060. .IP "\fB\-codec[:\fR\fIstream_specifier\fR\fB]\fR \fIcodec\fR \fB(\fR\fIinput/output,per\-stream\fR\fB)\fR" 4
  1061. .IX Item "-codec[:stream_specifier] codec (input/output,per-stream)"
  1062. .PD
  1063. Select an encoder (when used before an output file) or a decoder (when used
  1064. before an input file) for one or more streams. \fIcodec\fR is the name of a
  1065. decoder/encoder or a special value \f(CW\*(C`copy\*(C'\fR (output only) to indicate that
  1066. the stream is not to be re-encoded.
  1067. .Sp
  1068. For example
  1069. .Sp
  1070. .Vb 1
  1071. \& ffmpeg \-i INPUT \-map 0 \-c:v libx264 \-c:a copy OUTPUT
  1072. .Ve
  1073. .Sp
  1074. encodes all video streams with libx264 and copies all audio streams.
  1075. .Sp
  1076. For each stream, the last matching \f(CW\*(C`c\*(C'\fR option is applied, so
  1077. .Sp
  1078. .Vb 1
  1079. \& ffmpeg \-i INPUT \-map 0 \-c copy \-c:v:1 libx264 \-c:a:137 libvorbis OUTPUT
  1080. .Ve
  1081. .Sp
  1082. will copy all the streams except the second video, which will be encoded with
  1083. libx264, and the 138th audio, which will be encoded with libvorbis.
  1084. .IP "\fB\-t\fR \fIduration\fR \fB(\fR\fIinput/output\fR\fB)\fR" 4
  1085. .IX Item "-t duration (input/output)"
  1086. When used as an input option (before \f(CW\*(C`\-i\*(C'\fR), limit the \fIduration\fR of
  1087. data read from the input file.
  1088. .Sp
  1089. When used as an output option (before an output url), stop writing the
  1090. output after its duration reaches \fIduration\fR.
  1091. .Sp
  1092. \&\fIduration\fR must be a time duration specification,
  1093. see \fBthe Time duration section in the \fBffmpeg\-utils\fB\|(1) manual\fR.
  1094. .Sp
  1095. \&\-to and \-t are mutually exclusive and \-t has priority.
  1096. .IP "\fB\-to\fR \fIposition\fR \fB(\fR\fIinput/output\fR\fB)\fR" 4
  1097. .IX Item "-to position (input/output)"
  1098. Stop writing the output or reading the input at \fIposition\fR.
  1099. \&\fIposition\fR must be a time duration specification,
  1100. see \fBthe Time duration section in the \fBffmpeg\-utils\fB\|(1) manual\fR.
  1101. .Sp
  1102. \&\-to and \-t are mutually exclusive and \-t has priority.
  1103. .IP "\fB\-fs\fR \fIlimit_size\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
  1104. .IX Item "-fs limit_size (output)"
  1105. Set the file size limit, expressed in bytes. No further chunk of bytes is written
  1106. after the limit is exceeded. The size of the output file is slightly more than the
  1107. requested file size.
  1108. .IP "\fB\-ss\fR \fIposition\fR \fB(\fR\fIinput/output\fR\fB)\fR" 4
  1109. .IX Item "-ss position (input/output)"
  1110. When used as an input option (before \f(CW\*(C`\-i\*(C'\fR), seeks in this input file to
  1111. \&\fIposition\fR. Note that in most formats it is not possible to seek exactly,
  1112. so \fBffmpeg\fR will seek to the closest seek point before \fIposition\fR.
  1113. When transcoding and \fB\-accurate_seek\fR is enabled (the default), this
  1114. extra segment between the seek point and \fIposition\fR will be decoded and
  1115. discarded. When doing stream copy or when \fB\-noaccurate_seek\fR is used, it
  1116. will be preserved.
  1117. .Sp
  1118. When used as an output option (before an output url), decodes but discards
  1119. input until the timestamps reach \fIposition\fR.
  1120. .Sp
  1121. \&\fIposition\fR must be a time duration specification,
  1122. see \fBthe Time duration section in the \fBffmpeg\-utils\fB\|(1) manual\fR.
  1123. .IP "\fB\-sseof\fR \fIposition\fR \fB(\fR\fIinput\fR\fB)\fR" 4
  1124. .IX Item "-sseof position (input)"
  1125. Like the \f(CW\*(C`\-ss\*(C'\fR option but relative to the \*(L"end of file\*(R". That is negative
  1126. values are earlier in the file, 0 is at \s-1EOF.\s0
  1127. .IP "\fB\-itsoffset\fR \fIoffset\fR \fB(\fR\fIinput\fR\fB)\fR" 4
  1128. .IX Item "-itsoffset offset (input)"
  1129. Set the input time offset.
  1130. .Sp
  1131. \&\fIoffset\fR must be a time duration specification,
  1132. see \fBthe Time duration section in the \fBffmpeg\-utils\fB\|(1) manual\fR.
  1133. .Sp
  1134. The offset is added to the timestamps of the input files. Specifying
  1135. a positive offset means that the corresponding streams are delayed by
  1136. the time duration specified in \fIoffset\fR.
  1137. .IP "\fB\-itsscale\fR \fIscale\fR \fB(\fR\fIinput,per\-stream\fR\fB)\fR" 4
  1138. .IX Item "-itsscale scale (input,per-stream)"
  1139. Rescale input timestamps. \fIscale\fR should be a floating point number.
  1140. .IP "\fB\-timestamp\fR \fIdate\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
  1141. .IX Item "-timestamp date (output)"
  1142. Set the recording timestamp in the container.
  1143. .Sp
  1144. \&\fIdate\fR must be a date specification,
  1145. see \fBthe Date section in the \fBffmpeg\-utils\fB\|(1) manual\fR.
  1146. .IP "\fB\-metadata[:metadata_specifier]\fR \fIkey\fR\fB=\fR\fIvalue\fR \fB(\fR\fIoutput,per\-metadata\fR\fB)\fR" 4
  1147. .IX Item "-metadata[:metadata_specifier] key=value (output,per-metadata)"
  1148. Set a metadata key/value pair.
  1149. .Sp
  1150. An optional \fImetadata_specifier\fR may be given to set metadata
  1151. on streams, chapters or programs. See \f(CW\*(C`\-map_metadata\*(C'\fR
  1152. documentation for details.
  1153. .Sp
  1154. This option overrides metadata set with \f(CW\*(C`\-map_metadata\*(C'\fR. It is
  1155. also possible to delete metadata by using an empty value.
  1156. .Sp
  1157. For example, for setting the title in the output file:
  1158. .Sp
  1159. .Vb 1
  1160. \& ffmpeg \-i in.avi \-metadata title="my title" out.flv
  1161. .Ve
  1162. .Sp
  1163. To set the language of the first audio stream:
  1164. .Sp
  1165. .Vb 1
  1166. \& ffmpeg \-i INPUT \-metadata:s:a:0 language=eng OUTPUT
  1167. .Ve
  1168. .IP "\fB\-disposition[:stream_specifier]\fR \fIvalue\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4
  1169. .IX Item "-disposition[:stream_specifier] value (output,per-stream)"
  1170. Sets the disposition for a stream.
  1171. .Sp
  1172. This option overrides the disposition copied from the input stream. It is also
  1173. possible to delete the disposition by setting it to 0.
  1174. .Sp
  1175. The following dispositions are recognized:
  1176. .RS 4
  1177. .IP "\fBdefault\fR" 4
  1178. .IX Item "default"
  1179. .PD 0
  1180. .IP "\fBdub\fR" 4
  1181. .IX Item "dub"
  1182. .IP "\fBoriginal\fR" 4
  1183. .IX Item "original"
  1184. .IP "\fBcomment\fR" 4
  1185. .IX Item "comment"
  1186. .IP "\fBlyrics\fR" 4
  1187. .IX Item "lyrics"
  1188. .IP "\fBkaraoke\fR" 4
  1189. .IX Item "karaoke"
  1190. .IP "\fBforced\fR" 4
  1191. .IX Item "forced"
  1192. .IP "\fBhearing_impaired\fR" 4
  1193. .IX Item "hearing_impaired"
  1194. .IP "\fBvisual_impaired\fR" 4
  1195. .IX Item "visual_impaired"
  1196. .IP "\fBclean_effects\fR" 4
  1197. .IX Item "clean_effects"
  1198. .IP "\fBattached_pic\fR" 4
  1199. .IX Item "attached_pic"
  1200. .IP "\fBcaptions\fR" 4
  1201. .IX Item "captions"
  1202. .IP "\fBdescriptions\fR" 4
  1203. .IX Item "descriptions"
  1204. .IP "\fBdependent\fR" 4
  1205. .IX Item "dependent"
  1206. .IP "\fBmetadata\fR" 4
  1207. .IX Item "metadata"
  1208. .RE
  1209. .RS 4
  1210. .PD
  1211. .Sp
  1212. For example, to make the second audio stream the default stream:
  1213. .Sp
  1214. .Vb 1
  1215. \& ffmpeg \-i in.mkv \-c copy \-disposition:a:1 default out.mkv
  1216. .Ve
  1217. .Sp
  1218. To make the second subtitle stream the default stream and remove the default
  1219. disposition from the first subtitle stream:
  1220. .Sp
  1221. .Vb 1
  1222. \& ffmpeg \-i in.mkv \-c copy \-disposition:s:0 0 \-disposition:s:1 default out.mkv
  1223. .Ve
  1224. .Sp
  1225. To add an embedded cover/thumbnail:
  1226. .Sp
  1227. .Vb 1
  1228. \& ffmpeg \-i in.mp4 \-i IMAGE \-map 0 \-map 1 \-c copy \-c:v:1 png \-disposition:v:1 attached_pic out.mp4
  1229. .Ve
  1230. .Sp
  1231. Not all muxers support embedded thumbnails, and those who do, only support a few formats, like \s-1JPEG\s0 or \s-1PNG.\s0
  1232. .RE
  1233. .IP "\fB\-program [title=\fR\fItitle\fR\fB:][program_num=\fR\fIprogram_num\fR\fB:]st=\fR\fIstream\fR\fB[:st=\fR\fIstream\fR\fB...] (\fR\fIoutput\fR\fB)\fR" 4
  1234. .IX Item "-program [title=title:][program_num=program_num:]st=stream[:st=stream...] (output)"
  1235. Creates a program with the specified \fItitle\fR, \fIprogram_num\fR and adds the specified
  1236. \&\fIstream\fR(s) to it.
  1237. .IP "\fB\-target\fR \fItype\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
  1238. .IX Item "-target type (output)"
  1239. Specify target file type (\f(CW\*(C`vcd\*(C'\fR, \f(CW\*(C`svcd\*(C'\fR, \f(CW\*(C`dvd\*(C'\fR, \f(CW\*(C`dv\*(C'\fR,
  1240. \&\f(CW\*(C`dv50\*(C'\fR). \fItype\fR may be prefixed with \f(CW\*(C`pal\-\*(C'\fR, \f(CW\*(C`ntsc\-\*(C'\fR or
  1241. \&\f(CW\*(C`film\-\*(C'\fR to use the corresponding standard. All the format options
  1242. (bitrate, codecs, buffer sizes) are then set automatically. You can just type:
  1243. .Sp
  1244. .Vb 1
  1245. \& ffmpeg \-i myfile.avi \-target vcd /tmp/vcd.mpg
  1246. .Ve
  1247. .Sp
  1248. Nevertheless you can specify additional options as long as you know
  1249. they do not conflict with the standard, as in:
  1250. .Sp
  1251. .Vb 1
  1252. \& ffmpeg \-i myfile.avi \-target vcd \-bf 2 /tmp/vcd.mpg
  1253. .Ve
  1254. .Sp
  1255. The parameters set for each target are as follows.
  1256. .Sp
  1257. \&\fB\s-1VCD\s0\fR
  1258. .Sp
  1259. .Vb 6
  1260. \& <pal>:
  1261. \& \-f vcd \-muxrate 1411200 \-muxpreload 0.44 \-packetsize 2324
  1262. \& \-s 352x288 \-r 25
  1263. \& \-codec:v mpeg1video \-g 15 \-b:v 1150k \-maxrate:v 1150v \-minrate:v 1150k \-bufsize:v 327680
  1264. \& \-ar 44100 \-ac 2
  1265. \& \-codec:a mp2 \-b:a 224k
  1266. \&
  1267. \& <ntsc>:
  1268. \& \-f vcd \-muxrate 1411200 \-muxpreload 0.44 \-packetsize 2324
  1269. \& \-s 352x240 \-r 30000/1001
  1270. \& \-codec:v mpeg1video \-g 18 \-b:v 1150k \-maxrate:v 1150v \-minrate:v 1150k \-bufsize:v 327680
  1271. \& \-ar 44100 \-ac 2
  1272. \& \-codec:a mp2 \-b:a 224k
  1273. \&
  1274. \& <film>:
  1275. \& \-f vcd \-muxrate 1411200 \-muxpreload 0.44 \-packetsize 2324
  1276. \& \-s 352x240 \-r 24000/1001
  1277. \& \-codec:v mpeg1video \-g 18 \-b:v 1150k \-maxrate:v 1150v \-minrate:v 1150k \-bufsize:v 327680
  1278. \& \-ar 44100 \-ac 2
  1279. \& \-codec:a mp2 \-b:a 224k
  1280. .Ve
  1281. .Sp
  1282. \&\fB\s-1SVCD\s0\fR
  1283. .Sp
  1284. .Vb 6
  1285. \& <pal>:
  1286. \& \-f svcd \-packetsize 2324
  1287. \& \-s 480x576 \-pix_fmt yuv420p \-r 25
  1288. \& \-codec:v mpeg2video \-g 15 \-b:v 2040k \-maxrate:v 2516k \-minrate:v 0 \-bufsize:v 1835008 \-scan_offset 1
  1289. \& \-ar 44100
  1290. \& \-codec:a mp2 \-b:a 224k
  1291. \&
  1292. \& <ntsc>:
  1293. \& \-f svcd \-packetsize 2324
  1294. \& \-s 480x480 \-pix_fmt yuv420p \-r 30000/1001
  1295. \& \-codec:v mpeg2video \-g 18 \-b:v 2040k \-maxrate:v 2516k \-minrate:v 0 \-bufsize:v 1835008 \-scan_offset 1
  1296. \& \-ar 44100
  1297. \& \-codec:a mp2 \-b:a 224k
  1298. \&
  1299. \& <film>:
  1300. \& \-f svcd \-packetsize 2324
  1301. \& \-s 480x480 \-pix_fmt yuv420p \-r 24000/1001
  1302. \& \-codec:v mpeg2video \-g 18 \-b:v 2040k \-maxrate:v 2516k \-minrate:v 0 \-bufsize:v 1835008 \-scan_offset 1
  1303. \& \-ar 44100
  1304. \& \-codec:a mp2 \-b:a 224k
  1305. .Ve
  1306. .Sp
  1307. \&\fB\s-1DVD\s0\fR
  1308. .Sp
  1309. .Vb 6
  1310. \& <pal>:
  1311. \& \-f dvd \-muxrate 10080k \-packetsize 2048
  1312. \& \-s 720x576 \-pix_fmt yuv420p \-r 25
  1313. \& \-codec:v mpeg2video \-g 15 \-b:v 6000k \-maxrate:v 9000k \-minrate:v 0 \-bufsize:v 1835008
  1314. \& \-ar 48000
  1315. \& \-codec:a ac3 \-b:a 448k
  1316. \&
  1317. \& <ntsc>:
  1318. \& \-f dvd \-muxrate 10080k \-packetsize 2048
  1319. \& \-s 720x480 \-pix_fmt yuv420p \-r 30000/1001
  1320. \& \-codec:v mpeg2video \-g 18 \-b:v 6000k \-maxrate:v 9000k \-minrate:v 0 \-bufsize:v 1835008
  1321. \& \-ar 48000
  1322. \& \-codec:a ac3 \-b:a 448k
  1323. \&
  1324. \& <film>:
  1325. \& \-f dvd \-muxrate 10080k \-packetsize 2048
  1326. \& \-s 720x480 \-pix_fmt yuv420p \-r 24000/1001
  1327. \& \-codec:v mpeg2video \-g 18 \-b:v 6000k \-maxrate:v 9000k \-minrate:v 0 \-bufsize:v 1835008
  1328. \& \-ar 48000
  1329. \& \-codec:a ac3 \-b:a 448k
  1330. .Ve
  1331. .Sp
  1332. \&\fB\s-1DV\s0\fR
  1333. .Sp
  1334. .Vb 4
  1335. \& <pal>:
  1336. \& \-f dv
  1337. \& \-s 720x576 \-pix_fmt yuv420p \-r 25
  1338. \& \-ar 48000 \-ac 2
  1339. \&
  1340. \& <ntsc>:
  1341. \& \-f dv
  1342. \& \-s 720x480 \-pix_fmt yuv411p \-r 30000/1001
  1343. \& \-ar 48000 \-ac 2
  1344. \&
  1345. \& <film>:
  1346. \& \-f dv
  1347. \& \-s 720x480 \-pix_fmt yuv411p \-r 24000/1001
  1348. \& \-ar 48000 \-ac 2
  1349. .Ve
  1350. .Sp
  1351. The \f(CW\*(C`dv50\*(C'\fR target is identical to the \f(CW\*(C`dv\*(C'\fR target except that the pixel format set is \f(CW\*(C`yuv422p\*(C'\fR for all three standards.
  1352. .Sp
  1353. Any user-set value for a parameter above will override the target preset value. In that case, the output may
  1354. not comply with the target standard.
  1355. .IP "\fB\-dn (\fR\fIinput/output\fR\fB)\fR" 4
  1356. .IX Item "-dn (input/output)"
  1357. As an input option, blocks all data streams of a file from being filtered or
  1358. being automatically selected or mapped for any output. See \f(CW\*(C`\-discard\*(C'\fR
  1359. option to disable streams individually.
  1360. .Sp
  1361. As an output option, disables data recording i.e. automatic selection or
  1362. mapping of any data stream. For full manual control see the \f(CW\*(C`\-map\*(C'\fR
  1363. option.
  1364. .IP "\fB\-dframes\fR \fInumber\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
  1365. .IX Item "-dframes number (output)"
  1366. Set the number of data frames to output. This is an obsolete alias for
  1367. \&\f(CW\*(C`\-frames:d\*(C'\fR, which you should use instead.
  1368. .IP "\fB\-frames[:\fR\fIstream_specifier\fR\fB]\fR \fIframecount\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4
  1369. .IX Item "-frames[:stream_specifier] framecount (output,per-stream)"
  1370. Stop writing to the stream after \fIframecount\fR frames.
  1371. .IP "\fB\-q[:\fR\fIstream_specifier\fR\fB]\fR \fIq\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4
  1372. .IX Item "-q[:stream_specifier] q (output,per-stream)"
  1373. .PD 0
  1374. .IP "\fB\-qscale[:\fR\fIstream_specifier\fR\fB]\fR \fIq\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4
  1375. .IX Item "-qscale[:stream_specifier] q (output,per-stream)"
  1376. .PD
  1377. Use fixed quality scale (\s-1VBR\s0). The meaning of \fIq\fR/\fIqscale\fR is
  1378. codec-dependent.
  1379. If \fIqscale\fR is used without a \fIstream_specifier\fR then it applies only
  1380. to the video stream, this is to maintain compatibility with previous behavior
  1381. and as specifying the same codec specific value to 2 different codecs that is
  1382. audio and video generally is not what is intended when no stream_specifier is
  1383. used.
  1384. .IP "\fB\-filter[:\fR\fIstream_specifier\fR\fB]\fR \fIfiltergraph\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4
  1385. .IX Item "-filter[:stream_specifier] filtergraph (output,per-stream)"
  1386. Create the filtergraph specified by \fIfiltergraph\fR and use it to
  1387. filter the stream.
  1388. .Sp
  1389. \&\fIfiltergraph\fR is a description of the filtergraph to apply to
  1390. the stream, and must have a single input and a single output of the
  1391. same type of the stream. In the filtergraph, the input is associated
  1392. to the label \f(CW\*(C`in\*(C'\fR, and the output to the label \f(CW\*(C`out\*(C'\fR. See
  1393. the ffmpeg-filters manual for more information about the filtergraph
  1394. syntax.
  1395. .Sp
  1396. See the \fB\-filter_complex option\fR if you
  1397. want to create filtergraphs with multiple inputs and/or outputs.
  1398. .IP "\fB\-filter_script[:\fR\fIstream_specifier\fR\fB]\fR \fIfilename\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4
  1399. .IX Item "-filter_script[:stream_specifier] filename (output,per-stream)"
  1400. This option is similar to \fB\-filter\fR, the only difference is that its
  1401. argument is the name of the file from which a filtergraph description is to be
  1402. read.
  1403. .IP "\fB\-filter_threads\fR \fInb_threads\fR \fB(\fR\fIglobal\fR\fB)\fR" 4
  1404. .IX Item "-filter_threads nb_threads (global)"
  1405. Defines how many threads are used to process a filter pipeline. Each pipeline
  1406. will produce a thread pool with this many threads available for parallel processing.
  1407. The default is the number of available CPUs.
  1408. .IP "\fB\-pre[:\fR\fIstream_specifier\fR\fB]\fR \fIpreset_name\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4
  1409. .IX Item "-pre[:stream_specifier] preset_name (output,per-stream)"
  1410. Specify the preset for matching stream(s).
  1411. .IP "\fB\-stats (\fR\fIglobal\fR\fB)\fR" 4
  1412. .IX Item "-stats (global)"
  1413. Print encoding progress/statistics. It is on by default, to explicitly
  1414. disable it you need to specify \f(CW\*(C`\-nostats\*(C'\fR.
  1415. .IP "\fB\-stats_period\fR \fItime\fR \fB(\fR\fIglobal\fR\fB)\fR" 4
  1416. .IX Item "-stats_period time (global)"
  1417. Set period at which encoding progress/statistics are updated. Default is 0.5 seconds.
  1418. .IP "\fB\-progress\fR \fIurl\fR \fB(\fR\fIglobal\fR\fB)\fR" 4
  1419. .IX Item "-progress url (global)"
  1420. Send program-friendly progress information to \fIurl\fR.
  1421. .Sp
  1422. Progress information is written periodically and at the end of
  1423. the encoding process. It is made of "\fIkey\fR=\fIvalue\fR" lines. \fIkey\fR
  1424. consists of only alphanumeric characters. The last key of a sequence of
  1425. progress information is always \*(L"progress\*(R".
  1426. .Sp
  1427. The update period is set using \f(CW\*(C`\-stats_period\*(C'\fR.
  1428. .IP "\fB\-stdin\fR" 4
  1429. .IX Item "-stdin"
  1430. Enable interaction on standard input. On by default unless standard input is
  1431. used as an input. To explicitly disable interaction you need to specify
  1432. \&\f(CW\*(C`\-nostdin\*(C'\fR.
  1433. .Sp
  1434. Disabling interaction on standard input is useful, for example, if
  1435. ffmpeg is in the background process group. Roughly the same result can
  1436. be achieved with \f(CW\*(C`ffmpeg ... < /dev/null\*(C'\fR but it requires a
  1437. shell.
  1438. .IP "\fB\-debug_ts (\fR\fIglobal\fR\fB)\fR" 4
  1439. .IX Item "-debug_ts (global)"
  1440. Print timestamp information. It is off by default. This option is
  1441. mostly useful for testing and debugging purposes, and the output
  1442. format may change from one version to another, so it should not be
  1443. employed by portable scripts.
  1444. .Sp
  1445. See also the option \f(CW\*(C`\-fdebug ts\*(C'\fR.
  1446. .IP "\fB\-attach\fR \fIfilename\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
  1447. .IX Item "-attach filename (output)"
  1448. Add an attachment to the output file. This is supported by a few formats
  1449. like Matroska for e.g. fonts used in rendering subtitles. Attachments
  1450. are implemented as a specific type of stream, so this option will add
  1451. a new stream to the file. It is then possible to use per-stream options
  1452. on this stream in the usual way. Attachment streams created with this
  1453. option will be created after all the other streams (i.e. those created
  1454. with \f(CW\*(C`\-map\*(C'\fR or automatic mappings).
  1455. .Sp
  1456. Note that for Matroska you also have to set the mimetype metadata tag:
  1457. .Sp
  1458. .Vb 1
  1459. \& ffmpeg \-i INPUT \-attach DejaVuSans.ttf \-metadata:s:2 mimetype=application/x\-truetype\-font out.mkv
  1460. .Ve
  1461. .Sp
  1462. (assuming that the attachment stream will be third in the output file).
  1463. .IP "\fB\-dump_attachment[:\fR\fIstream_specifier\fR\fB]\fR \fIfilename\fR \fB(\fR\fIinput,per\-stream\fR\fB)\fR" 4
  1464. .IX Item "-dump_attachment[:stream_specifier] filename (input,per-stream)"
  1465. Extract the matching attachment stream into a file named \fIfilename\fR. If
  1466. \&\fIfilename\fR is empty, then the value of the \f(CW\*(C`filename\*(C'\fR metadata tag
  1467. will be used.
  1468. .Sp
  1469. E.g. to extract the first attachment to a file named 'out.ttf':
  1470. .Sp
  1471. .Vb 1
  1472. \& ffmpeg \-dump_attachment:t:0 out.ttf \-i INPUT
  1473. .Ve
  1474. .Sp
  1475. To extract all attachments to files determined by the \f(CW\*(C`filename\*(C'\fR tag:
  1476. .Sp
  1477. .Vb 1
  1478. \& ffmpeg \-dump_attachment:t "" \-i INPUT
  1479. .Ve
  1480. .Sp
  1481. Technical note \*(-- attachments are implemented as codec extradata, so this
  1482. option can actually be used to extract extradata from any stream, not just
  1483. attachments.
  1484. .SS "Video Options"
  1485. .IX Subsection "Video Options"
  1486. .IP "\fB\-vframes\fR \fInumber\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
  1487. .IX Item "-vframes number (output)"
  1488. Set the number of video frames to output. This is an obsolete alias for
  1489. \&\f(CW\*(C`\-frames:v\*(C'\fR, which you should use instead.
  1490. .IP "\fB\-r[:\fR\fIstream_specifier\fR\fB]\fR \fIfps\fR \fB(\fR\fIinput/output,per\-stream\fR\fB)\fR" 4
  1491. .IX Item "-r[:stream_specifier] fps (input/output,per-stream)"
  1492. Set frame rate (Hz value, fraction or abbreviation).
  1493. .Sp
  1494. As an input option, ignore any timestamps stored in the file and instead
  1495. generate timestamps assuming constant frame rate \fIfps\fR.
  1496. This is not the same as the \fB\-framerate\fR option used for some input formats
  1497. like image2 or v4l2 (it used to be the same in older versions of FFmpeg).
  1498. If in doubt use \fB\-framerate\fR instead of the input option \fB\-r\fR.
  1499. .Sp
  1500. As an output option, duplicate or drop input frames to achieve constant output
  1501. frame rate \fIfps\fR.
  1502. .IP "\fB\-fpsmax[:\fR\fIstream_specifier\fR\fB]\fR \fIfps\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4
  1503. .IX Item "-fpsmax[:stream_specifier] fps (output,per-stream)"
  1504. Set maximum frame rate (Hz value, fraction or abbreviation).
  1505. .Sp
  1506. Clamps output frame rate when output framerate is auto-set and is higher than this value.
  1507. Useful in batch processing or when input framerate is wrongly detected as very high.
  1508. It cannot be set together with \f(CW\*(C`\-r\*(C'\fR. It is ignored during streamcopy.
  1509. .IP "\fB\-s[:\fR\fIstream_specifier\fR\fB]\fR \fIsize\fR \fB(\fR\fIinput/output,per\-stream\fR\fB)\fR" 4
  1510. .IX Item "-s[:stream_specifier] size (input/output,per-stream)"
  1511. Set frame size.
  1512. .Sp
  1513. As an input option, this is a shortcut for the \fBvideo_size\fR private
  1514. option, recognized by some demuxers for which the frame size is either not
  1515. stored in the file or is configurable \*(-- e.g. raw video or video grabbers.
  1516. .Sp
  1517. As an output option, this inserts the \f(CW\*(C`scale\*(C'\fR video filter to the
  1518. \&\fIend\fR of the corresponding filtergraph. Please use the \f(CW\*(C`scale\*(C'\fR filter
  1519. directly to insert it at the beginning or some other place.
  1520. .Sp
  1521. The format is \fBwxh\fR (default \- same as source).
  1522. .IP "\fB\-aspect[:\fR\fIstream_specifier\fR\fB]\fR \fIaspect\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4
  1523. .IX Item "-aspect[:stream_specifier] aspect (output,per-stream)"
  1524. Set the video display aspect ratio specified by \fIaspect\fR.
  1525. .Sp
  1526. \&\fIaspect\fR can be a floating point number string, or a string of the
  1527. form \fInum\fR:\fIden\fR, where \fInum\fR and \fIden\fR are the
  1528. numerator and denominator of the aspect ratio. For example \*(L"4:3\*(R",
  1529. \&\*(L"16:9\*(R", \*(L"1.3333\*(R", and \*(L"1.7777\*(R" are valid argument values.
  1530. .Sp
  1531. If used together with \fB\-vcodec copy\fR, it will affect the aspect ratio
  1532. stored at container level, but not the aspect ratio stored in encoded
  1533. frames, if it exists.
  1534. .IP "\fB\-vn (\fR\fIinput/output\fR\fB)\fR" 4
  1535. .IX Item "-vn (input/output)"
  1536. As an input option, blocks all video streams of a file from being filtered or
  1537. being automatically selected or mapped for any output. See \f(CW\*(C`\-discard\*(C'\fR
  1538. option to disable streams individually.
  1539. .Sp
  1540. As an output option, disables video recording i.e. automatic selection or
  1541. mapping of any video stream. For full manual control see the \f(CW\*(C`\-map\*(C'\fR
  1542. option.
  1543. .IP "\fB\-vcodec\fR \fIcodec\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
  1544. .IX Item "-vcodec codec (output)"
  1545. Set the video codec. This is an alias for \f(CW\*(C`\-codec:v\*(C'\fR.
  1546. .IP "\fB\-pass[:\fR\fIstream_specifier\fR\fB]\fR \fIn\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4
  1547. .IX Item "-pass[:stream_specifier] n (output,per-stream)"
  1548. Select the pass number (1 or 2). It is used to do two-pass
  1549. video encoding. The statistics of the video are recorded in the first
  1550. pass into a log file (see also the option \-passlogfile),
  1551. and in the second pass that log file is used to generate the video
  1552. at the exact requested bitrate.
  1553. On pass 1, you may just deactivate audio and set output to null,
  1554. examples for Windows and Unix:
  1555. .Sp
  1556. .Vb 2
  1557. \& ffmpeg \-i foo.mov \-c:v libxvid \-pass 1 \-an \-f rawvideo \-y NUL
  1558. \& ffmpeg \-i foo.mov \-c:v libxvid \-pass 1 \-an \-f rawvideo \-y /dev/null
  1559. .Ve
  1560. .IP "\fB\-passlogfile[:\fR\fIstream_specifier\fR\fB]\fR \fIprefix\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4
  1561. .IX Item "-passlogfile[:stream_specifier] prefix (output,per-stream)"
  1562. Set two-pass log file name prefix to \fIprefix\fR, the default file name
  1563. prefix is ``ffmpeg2pass''. The complete file name will be
  1564. \&\fI\s-1PREFIX\-N\s0.log\fR, where N is a number specific to the output
  1565. stream
  1566. .IP "\fB\-vf\fR \fIfiltergraph\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
  1567. .IX Item "-vf filtergraph (output)"
  1568. Create the filtergraph specified by \fIfiltergraph\fR and use it to
  1569. filter the stream.
  1570. .Sp
  1571. This is an alias for \f(CW\*(C`\-filter:v\*(C'\fR, see the \fB\-filter option\fR.
  1572. .IP "\fB\-autorotate\fR" 4
  1573. .IX Item "-autorotate"
  1574. Automatically rotate the video according to file metadata. Enabled by
  1575. default, use \fB\-noautorotate\fR to disable it.
  1576. .IP "\fB\-autoscale\fR" 4
  1577. .IX Item "-autoscale"
  1578. Automatically scale the video according to the resolution of first frame.
  1579. Enabled by default, use \fB\-noautoscale\fR to disable it. When autoscale is
  1580. disabled, all output frames of filter graph might not be in the same resolution
  1581. and may be inadequate for some encoder/muxer. Therefore, it is not recommended
  1582. to disable it unless you really know what you are doing.
  1583. Disable autoscale at your own risk.
  1584. .SS "Advanced Video options"
  1585. .IX Subsection "Advanced Video options"
  1586. .IP "\fB\-pix_fmt[:\fR\fIstream_specifier\fR\fB]\fR \fIformat\fR \fB(\fR\fIinput/output,per\-stream\fR\fB)\fR" 4
  1587. .IX Item "-pix_fmt[:stream_specifier] format (input/output,per-stream)"
  1588. Set pixel format. Use \f(CW\*(C`\-pix_fmts\*(C'\fR to show all the supported
  1589. pixel formats.
  1590. If the selected pixel format can not be selected, ffmpeg will print a
  1591. warning and select the best pixel format supported by the encoder.
  1592. If \fIpix_fmt\fR is prefixed by a \f(CW\*(C`+\*(C'\fR, ffmpeg will exit with an error
  1593. if the requested pixel format can not be selected, and automatic conversions
  1594. inside filtergraphs are disabled.
  1595. If \fIpix_fmt\fR is a single \f(CW\*(C`+\*(C'\fR, ffmpeg selects the same pixel format
  1596. as the input (or graph output) and automatic conversions are disabled.
  1597. .IP "\fB\-sws_flags\fR \fIflags\fR \fB(\fR\fIinput/output\fR\fB)\fR" 4
  1598. .IX Item "-sws_flags flags (input/output)"
  1599. Set SwScaler flags.
  1600. .IP "\fB\-rc_override[:\fR\fIstream_specifier\fR\fB]\fR \fIoverride\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4
  1601. .IX Item "-rc_override[:stream_specifier] override (output,per-stream)"
  1602. Rate control override for specific intervals, formatted as \*(L"int,int,int\*(R"
  1603. list separated with slashes. Two first values are the beginning and
  1604. end frame numbers, last one is quantizer to use if positive, or quality
  1605. factor if negative.
  1606. .IP "\fB\-ilme\fR" 4
  1607. .IX Item "-ilme"
  1608. Force interlacing support in encoder (\s-1MPEG\-2\s0 and \s-1MPEG\-4\s0 only).
  1609. Use this option if your input file is interlaced and you want
  1610. to keep the interlaced format for minimum losses.
  1611. The alternative is to deinterlace the input stream by use of a filter
  1612. such as \f(CW\*(C`yadif\*(C'\fR or \f(CW\*(C`bwdif\*(C'\fR, but deinterlacing introduces losses.
  1613. .IP "\fB\-psnr\fR" 4
  1614. .IX Item "-psnr"
  1615. Calculate \s-1PSNR\s0 of compressed frames.
  1616. .IP "\fB\-vstats\fR" 4
  1617. .IX Item "-vstats"
  1618. Dump video coding statistics to \fIvstats_HHMMSS.log\fR.
  1619. .IP "\fB\-vstats_file\fR \fIfile\fR" 4
  1620. .IX Item "-vstats_file file"
  1621. Dump video coding statistics to \fIfile\fR.
  1622. .IP "\fB\-vstats_version\fR \fIfile\fR" 4
  1623. .IX Item "-vstats_version file"
  1624. Specifies which version of the vstats format to use. Default is 2.
  1625. .Sp
  1626. version = 1 :
  1627. .Sp
  1628. \&\f(CW\*(C`frame= %5d q= %2.1f PSNR= %6.2f f_size= %6d s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s\*(C'\fR
  1629. .Sp
  1630. version > 1:
  1631. .Sp
  1632. \&\f(CW\*(C`out= %2d st= %2d frame= %5d q= %2.1f PSNR= %6.2f f_size= %6d s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s\*(C'\fR
  1633. .IP "\fB\-top[:\fR\fIstream_specifier\fR\fB]\fR \fIn\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4
  1634. .IX Item "-top[:stream_specifier] n (output,per-stream)"
  1635. top=1/bottom=0/auto=\-1 field first
  1636. .IP "\fB\-dc\fR \fIprecision\fR" 4
  1637. .IX Item "-dc precision"
  1638. Intra_dc_precision.
  1639. .IP "\fB\-vtag\fR \fIfourcc/tag\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
  1640. .IX Item "-vtag fourcc/tag (output)"
  1641. Force video tag/fourcc. This is an alias for \f(CW\*(C`\-tag:v\*(C'\fR.
  1642. .IP "\fB\-qphist (\fR\fIglobal\fR\fB)\fR" 4
  1643. .IX Item "-qphist (global)"
  1644. Show \s-1QP\s0 histogram
  1645. .IP "\fB\-vbsf\fR \fIbitstream_filter\fR" 4
  1646. .IX Item "-vbsf bitstream_filter"
  1647. Deprecated see \-bsf
  1648. .IP "\fB\-force_key_frames[:\fR\fIstream_specifier\fR\fB]\fR \fItime\fR\fB[,\fR\fItime\fR\fB...] (\fR\fIoutput,per\-stream\fR\fB)\fR" 4
  1649. .IX Item "-force_key_frames[:stream_specifier] time[,time...] (output,per-stream)"
  1650. .PD 0
  1651. .IP "\fB\-force_key_frames[:\fR\fIstream_specifier\fR\fB] expr:\fR\fIexpr\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4
  1652. .IX Item "-force_key_frames[:stream_specifier] expr:expr (output,per-stream)"
  1653. .IP "\fB\-force_key_frames[:\fR\fIstream_specifier\fR\fB] source (\fR\fIoutput,per\-stream\fR\fB)\fR" 4
  1654. .IX Item "-force_key_frames[:stream_specifier] source (output,per-stream)"
  1655. .PD
  1656. \&\fIforce_key_frames\fR can take arguments of the following form:
  1657. .RS 4
  1658. .IP "\fItime\fR\fB[,\fR\fItime\fR\fB...]\fR" 4
  1659. .IX Item "time[,time...]"
  1660. If the argument consists of timestamps, ffmpeg will round the specified times to the nearest
  1661. output timestamp as per the encoder time base and force a keyframe at the first frame having
  1662. timestamp equal or greater than the computed timestamp. Note that if the encoder time base is too
  1663. coarse, then the keyframes may be forced on frames with timestamps lower than the specified time.
  1664. The default encoder time base is the inverse of the output framerate but may be set otherwise
  1665. via \f(CW\*(C`\-enc_time_base\*(C'\fR.
  1666. .Sp
  1667. If one of the times is "\f(CW\*(C`chapters\*(C'\fR[\fIdelta\fR]", it is expanded into
  1668. the time of the beginning of all chapters in the file, shifted by
  1669. \&\fIdelta\fR, expressed as a time in seconds.
  1670. This option can be useful to ensure that a seek point is present at a
  1671. chapter mark or any other designated place in the output file.
  1672. .Sp
  1673. For example, to insert a key frame at 5 minutes, plus key frames 0.1 second
  1674. before the beginning of every chapter:
  1675. .Sp
  1676. .Vb 1
  1677. \& \-force_key_frames 0:05:00,chapters\-0.1
  1678. .Ve
  1679. .IP "\fBexpr:\fR\fIexpr\fR" 4
  1680. .IX Item "expr:expr"
  1681. If the argument is prefixed with \f(CW\*(C`expr:\*(C'\fR, the string \fIexpr\fR
  1682. is interpreted like an expression and is evaluated for each frame. A
  1683. key frame is forced in case the evaluation is non-zero.
  1684. .Sp
  1685. The expression in \fIexpr\fR can contain the following constants:
  1686. .RS 4
  1687. .IP "\fBn\fR" 4
  1688. .IX Item "n"
  1689. the number of current processed frame, starting from 0
  1690. .IP "\fBn_forced\fR" 4
  1691. .IX Item "n_forced"
  1692. the number of forced frames
  1693. .IP "\fBprev_forced_n\fR" 4
  1694. .IX Item "prev_forced_n"
  1695. the number of the previous forced frame, it is \f(CW\*(C`NAN\*(C'\fR when no
  1696. keyframe was forced yet
  1697. .IP "\fBprev_forced_t\fR" 4
  1698. .IX Item "prev_forced_t"
  1699. the time of the previous forced frame, it is \f(CW\*(C`NAN\*(C'\fR when no
  1700. keyframe was forced yet
  1701. .IP "\fBt\fR" 4
  1702. .IX Item "t"
  1703. the time of the current processed frame
  1704. .RE
  1705. .RS 4
  1706. .Sp
  1707. For example to force a key frame every 5 seconds, you can specify:
  1708. .Sp
  1709. .Vb 1
  1710. \& \-force_key_frames expr:gte(t,n_forced*5)
  1711. .Ve
  1712. .Sp
  1713. To force a key frame 5 seconds after the time of the last forced one,
  1714. starting from second 13:
  1715. .Sp
  1716. .Vb 1
  1717. \& \-force_key_frames expr:if(isnan(prev_forced_t),gte(t,13),gte(t,prev_forced_t+5))
  1718. .Ve
  1719. .RE
  1720. .IP "\fBsource\fR" 4
  1721. .IX Item "source"
  1722. If the argument is \f(CW\*(C`source\*(C'\fR, ffmpeg will force a key frame if
  1723. the current frame being encoded is marked as a key frame in its source.
  1724. .RE
  1725. .RS 4
  1726. .Sp
  1727. Note that forcing too many keyframes is very harmful for the lookahead
  1728. algorithms of certain encoders: using fixed-GOP options or similar
  1729. would be more efficient.
  1730. .RE
  1731. .IP "\fB\-copyinkf[:\fR\fIstream_specifier\fR\fB] (\fR\fIoutput,per\-stream\fR\fB)\fR" 4
  1732. .IX Item "-copyinkf[:stream_specifier] (output,per-stream)"
  1733. When doing stream copy, copy also non-key frames found at the
  1734. beginning.
  1735. .IP "\fB\-init_hw_device\fR \fItype\fR\fB[=\fR\fIname\fR\fB][:\fR\fIdevice\fR\fB[,\fR\fIkey=value\fR\fB...]]\fR" 4
  1736. .IX Item "-init_hw_device type[=name][:device[,key=value...]]"
  1737. Initialise a new hardware device of type \fItype\fR called \fIname\fR, using the
  1738. given device parameters.
  1739. If no name is specified it will receive a default name of the form "\fItype\fR\f(CW%d\fR".
  1740. .Sp
  1741. The meaning of \fIdevice\fR and the following arguments depends on the
  1742. device type:
  1743. .RS 4
  1744. .IP "\fBcuda\fR" 4
  1745. .IX Item "cuda"
  1746. \&\fIdevice\fR is the number of the \s-1CUDA\s0 device.
  1747. .IP "\fBdxva2\fR" 4
  1748. .IX Item "dxva2"
  1749. \&\fIdevice\fR is the number of the Direct3D 9 display adapter.
  1750. .IP "\fBvaapi\fR" 4
  1751. .IX Item "vaapi"
  1752. \&\fIdevice\fR is either an X11 display name or a \s-1DRM\s0 render node.
  1753. If not specified, it will attempt to open the default X11 display (\fI\f(CI$DISPLAY\fI\fR)
  1754. and then the first \s-1DRM\s0 render node (\fI/dev/dri/renderD128\fR).
  1755. .IP "\fBvdpau\fR" 4
  1756. .IX Item "vdpau"
  1757. \&\fIdevice\fR is an X11 display name.
  1758. If not specified, it will attempt to open the default X11 display (\fI\f(CI$DISPLAY\fI\fR).
  1759. .IP "\fBqsv\fR" 4
  1760. .IX Item "qsv"
  1761. \&\fIdevice\fR selects a value in \fBMFX_IMPL_*\fR. Allowed values are:
  1762. .RS 4
  1763. .IP "\fBauto\fR" 4
  1764. .IX Item "auto"
  1765. .PD 0
  1766. .IP "\fBsw\fR" 4
  1767. .IX Item "sw"
  1768. .IP "\fBhw\fR" 4
  1769. .IX Item "hw"
  1770. .IP "\fBauto_any\fR" 4
  1771. .IX Item "auto_any"
  1772. .IP "\fBhw_any\fR" 4
  1773. .IX Item "hw_any"
  1774. .IP "\fBhw2\fR" 4
  1775. .IX Item "hw2"
  1776. .IP "\fBhw3\fR" 4
  1777. .IX Item "hw3"
  1778. .IP "\fBhw4\fR" 4
  1779. .IX Item "hw4"
  1780. .RE
  1781. .RS 4
  1782. .PD
  1783. .Sp
  1784. If not specified, \fBauto_any\fR is used.
  1785. (Note that it may be easier to achieve the desired result for \s-1QSV\s0 by creating the
  1786. platform-appropriate subdevice (\fBdxva2\fR or \fBvaapi\fR) and then deriving a
  1787. \&\s-1QSV\s0 device from that.)
  1788. .RE
  1789. .IP "\fBopencl\fR" 4
  1790. .IX Item "opencl"
  1791. \&\fIdevice\fR selects the platform and device as \fIplatform_index.device_index\fR.
  1792. .Sp
  1793. The set of devices can also be filtered using the key-value pairs to find only
  1794. devices matching particular platform or device strings.
  1795. .Sp
  1796. The strings usable as filters are:
  1797. .RS 4
  1798. .IP "\fBplatform_profile\fR" 4
  1799. .IX Item "platform_profile"
  1800. .PD 0
  1801. .IP "\fBplatform_version\fR" 4
  1802. .IX Item "platform_version"
  1803. .IP "\fBplatform_name\fR" 4
  1804. .IX Item "platform_name"
  1805. .IP "\fBplatform_vendor\fR" 4
  1806. .IX Item "platform_vendor"
  1807. .IP "\fBplatform_extensions\fR" 4
  1808. .IX Item "platform_extensions"
  1809. .IP "\fBdevice_name\fR" 4
  1810. .IX Item "device_name"
  1811. .IP "\fBdevice_vendor\fR" 4
  1812. .IX Item "device_vendor"
  1813. .IP "\fBdriver_version\fR" 4
  1814. .IX Item "driver_version"
  1815. .IP "\fBdevice_version\fR" 4
  1816. .IX Item "device_version"
  1817. .IP "\fBdevice_profile\fR" 4
  1818. .IX Item "device_profile"
  1819. .IP "\fBdevice_extensions\fR" 4
  1820. .IX Item "device_extensions"
  1821. .IP "\fBdevice_type\fR" 4
  1822. .IX Item "device_type"
  1823. .RE
  1824. .RS 4
  1825. .PD
  1826. .Sp
  1827. The indices and filters must together uniquely select a device.
  1828. .Sp
  1829. Examples:
  1830. .IP "\fI\-init_hw_device opencl:0.1\fR" 4
  1831. .IX Item "-init_hw_device opencl:0.1"
  1832. Choose the second device on the first platform.
  1833. .IP "\fI\-init_hw_device opencl:,device_name=Foo9000\fR" 4
  1834. .IX Item "-init_hw_device opencl:,device_name=Foo9000"
  1835. Choose the device with a name containing the string \fIFoo9000\fR.
  1836. .IP "\fI\-init_hw_device opencl:1,device_type=gpu,device_extensions=cl_khr_fp16\fR" 4
  1837. .IX Item "-init_hw_device opencl:1,device_type=gpu,device_extensions=cl_khr_fp16"
  1838. Choose the \s-1GPU\s0 device on the second platform supporting the \fIcl_khr_fp16\fR
  1839. extension.
  1840. .RE
  1841. .RS 4
  1842. .RE
  1843. .IP "\fBvulkan\fR" 4
  1844. .IX Item "vulkan"
  1845. If \fIdevice\fR is an integer, it selects the device by its index in a
  1846. system-dependent list of devices. If \fIdevice\fR is any other string, it
  1847. selects the first device with a name containing that string as a substring.
  1848. .Sp
  1849. The following options are recognized:
  1850. .RS 4
  1851. .IP "\fBdebug\fR" 4
  1852. .IX Item "debug"
  1853. If set to 1, enables the validation layer, if installed.
  1854. .IP "\fBlinear_images\fR" 4
  1855. .IX Item "linear_images"
  1856. If set to 1, images allocated by the hwcontext will be linear and locally mappable.
  1857. .IP "\fBinstance_extensions\fR" 4
  1858. .IX Item "instance_extensions"
  1859. A plus separated list of additional instance extensions to enable.
  1860. .IP "\fBdevice_extensions\fR" 4
  1861. .IX Item "device_extensions"
  1862. A plus separated list of additional device extensions to enable.
  1863. .RE
  1864. .RS 4
  1865. .Sp
  1866. Examples:
  1867. .IP "\fI\-init_hw_device vulkan:1\fR" 4
  1868. .IX Item "-init_hw_device vulkan:1"
  1869. Choose the second device on the system.
  1870. .IP "\fI\-init_hw_device vulkan:RADV\fR" 4
  1871. .IX Item "-init_hw_device vulkan:RADV"
  1872. Choose the first device with a name containing the string \fI\s-1RADV\s0\fR.
  1873. .IP "\fI\-init_hw_device vulkan:0,instance_extensions=VK_KHR_wayland_surface+VK_KHR_xcb_surface\fR" 4
  1874. .IX Item "-init_hw_device vulkan:0,instance_extensions=VK_KHR_wayland_surface+VK_KHR_xcb_surface"
  1875. Choose the first device and enable the Wayland and \s-1XCB\s0 instance extensions.
  1876. .RE
  1877. .RS 4
  1878. .RE
  1879. .RE
  1880. .RS 4
  1881. .RE
  1882. .IP "\fB\-init_hw_device\fR \fItype\fR\fB[=\fR\fIname\fR\fB]@\fR\fIsource\fR" 4
  1883. .IX Item "-init_hw_device type[=name]@source"
  1884. Initialise a new hardware device of type \fItype\fR called \fIname\fR,
  1885. deriving it from the existing device with the name \fIsource\fR.
  1886. .IP "\fB\-init_hw_device list\fR" 4
  1887. .IX Item "-init_hw_device list"
  1888. List all hardware device types supported in this build of ffmpeg.
  1889. .IP "\fB\-filter_hw_device\fR \fIname\fR" 4
  1890. .IX Item "-filter_hw_device name"
  1891. Pass the hardware device called \fIname\fR to all filters in any filter graph.
  1892. This can be used to set the device to upload to with the \f(CW\*(C`hwupload\*(C'\fR filter,
  1893. or the device to map to with the \f(CW\*(C`hwmap\*(C'\fR filter. Other filters may also
  1894. make use of this parameter when they require a hardware device. Note that this
  1895. is typically only required when the input is not already in hardware frames \-
  1896. when it is, filters will derive the device they require from the context of the
  1897. frames they receive as input.
  1898. .Sp
  1899. This is a global setting, so all filters will receive the same device.
  1900. .IP "\fB\-hwaccel[:\fR\fIstream_specifier\fR\fB]\fR \fIhwaccel\fR \fB(\fR\fIinput,per\-stream\fR\fB)\fR" 4
  1901. .IX Item "-hwaccel[:stream_specifier] hwaccel (input,per-stream)"
  1902. Use hardware acceleration to decode the matching stream(s). The allowed values
  1903. of \fIhwaccel\fR are:
  1904. .RS 4
  1905. .IP "\fBnone\fR" 4
  1906. .IX Item "none"
  1907. Do not use any hardware acceleration (the default).
  1908. .IP "\fBauto\fR" 4
  1909. .IX Item "auto"
  1910. Automatically select the hardware acceleration method.
  1911. .IP "\fBvdpau\fR" 4
  1912. .IX Item "vdpau"
  1913. Use \s-1VDPAU\s0 (Video Decode and Presentation \s-1API\s0 for Unix) hardware acceleration.
  1914. .IP "\fBdxva2\fR" 4
  1915. .IX Item "dxva2"
  1916. Use \s-1DXVA2\s0 (DirectX Video Acceleration) hardware acceleration.
  1917. .IP "\fBvaapi\fR" 4
  1918. .IX Item "vaapi"
  1919. Use \s-1VAAPI\s0 (Video Acceleration \s-1API\s0) hardware acceleration.
  1920. .IP "\fBqsv\fR" 4
  1921. .IX Item "qsv"
  1922. Use the Intel QuickSync Video acceleration for video transcoding.
  1923. .Sp
  1924. Unlike most other values, this option does not enable accelerated decoding (that
  1925. is used automatically whenever a qsv decoder is selected), but accelerated
  1926. transcoding, without copying the frames into the system memory.
  1927. .Sp
  1928. For it to work, both the decoder and the encoder must support \s-1QSV\s0 acceleration
  1929. and no filters must be used.
  1930. .RE
  1931. .RS 4
  1932. .Sp
  1933. This option has no effect if the selected hwaccel is not available or not
  1934. supported by the chosen decoder.
  1935. .Sp
  1936. Note that most acceleration methods are intended for playback and will not be
  1937. faster than software decoding on modern CPUs. Additionally, \fBffmpeg\fR
  1938. will usually need to copy the decoded frames from the \s-1GPU\s0 memory into the system
  1939. memory, resulting in further performance loss. This option is thus mainly
  1940. useful for testing.
  1941. .RE
  1942. .IP "\fB\-hwaccel_device[:\fR\fIstream_specifier\fR\fB]\fR \fIhwaccel_device\fR \fB(\fR\fIinput,per\-stream\fR\fB)\fR" 4
  1943. .IX Item "-hwaccel_device[:stream_specifier] hwaccel_device (input,per-stream)"
  1944. Select a device to use for hardware acceleration.
  1945. .Sp
  1946. This option only makes sense when the \fB\-hwaccel\fR option is also specified.
  1947. It can either refer to an existing device created with \fB\-init_hw_device\fR
  1948. by name, or it can create a new device as if
  1949. \&\fB\-init_hw_device\fR \fItype\fR:\fIhwaccel_device\fR
  1950. were called immediately before.
  1951. .IP "\fB\-hwaccels\fR" 4
  1952. .IX Item "-hwaccels"
  1953. List all hardware acceleration methods supported in this build of ffmpeg.
  1954. .SS "Audio Options"
  1955. .IX Subsection "Audio Options"
  1956. .IP "\fB\-aframes\fR \fInumber\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
  1957. .IX Item "-aframes number (output)"
  1958. Set the number of audio frames to output. This is an obsolete alias for
  1959. \&\f(CW\*(C`\-frames:a\*(C'\fR, which you should use instead.
  1960. .IP "\fB\-ar[:\fR\fIstream_specifier\fR\fB]\fR \fIfreq\fR \fB(\fR\fIinput/output,per\-stream\fR\fB)\fR" 4
  1961. .IX Item "-ar[:stream_specifier] freq (input/output,per-stream)"
  1962. Set the audio sampling frequency. For output streams it is set by
  1963. default to the frequency of the corresponding input stream. For input
  1964. streams this option only makes sense for audio grabbing devices and raw
  1965. demuxers and is mapped to the corresponding demuxer options.
  1966. .IP "\fB\-aq\fR \fIq\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
  1967. .IX Item "-aq q (output)"
  1968. Set the audio quality (codec-specific, \s-1VBR\s0). This is an alias for \-q:a.
  1969. .IP "\fB\-ac[:\fR\fIstream_specifier\fR\fB]\fR \fIchannels\fR \fB(\fR\fIinput/output,per\-stream\fR\fB)\fR" 4
  1970. .IX Item "-ac[:stream_specifier] channels (input/output,per-stream)"
  1971. Set the number of audio channels. For output streams it is set by
  1972. default to the number of input audio channels. For input streams
  1973. this option only makes sense for audio grabbing devices and raw demuxers
  1974. and is mapped to the corresponding demuxer options.
  1975. .IP "\fB\-an (\fR\fIinput/output\fR\fB)\fR" 4
  1976. .IX Item "-an (input/output)"
  1977. As an input option, blocks all audio streams of a file from being filtered or
  1978. being automatically selected or mapped for any output. See \f(CW\*(C`\-discard\*(C'\fR
  1979. option to disable streams individually.
  1980. .Sp
  1981. As an output option, disables audio recording i.e. automatic selection or
  1982. mapping of any audio stream. For full manual control see the \f(CW\*(C`\-map\*(C'\fR
  1983. option.
  1984. .IP "\fB\-acodec\fR \fIcodec\fR \fB(\fR\fIinput/output\fR\fB)\fR" 4
  1985. .IX Item "-acodec codec (input/output)"
  1986. Set the audio codec. This is an alias for \f(CW\*(C`\-codec:a\*(C'\fR.
  1987. .IP "\fB\-sample_fmt[:\fR\fIstream_specifier\fR\fB]\fR \fIsample_fmt\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4
  1988. .IX Item "-sample_fmt[:stream_specifier] sample_fmt (output,per-stream)"
  1989. Set the audio sample format. Use \f(CW\*(C`\-sample_fmts\*(C'\fR to get a list
  1990. of supported sample formats.
  1991. .IP "\fB\-af\fR \fIfiltergraph\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
  1992. .IX Item "-af filtergraph (output)"
  1993. Create the filtergraph specified by \fIfiltergraph\fR and use it to
  1994. filter the stream.
  1995. .Sp
  1996. This is an alias for \f(CW\*(C`\-filter:a\*(C'\fR, see the \fB\-filter option\fR.
  1997. .SS "Advanced Audio options"
  1998. .IX Subsection "Advanced Audio options"
  1999. .IP "\fB\-atag\fR \fIfourcc/tag\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
  2000. .IX Item "-atag fourcc/tag (output)"
  2001. Force audio tag/fourcc. This is an alias for \f(CW\*(C`\-tag:a\*(C'\fR.
  2002. .IP "\fB\-absf\fR \fIbitstream_filter\fR" 4
  2003. .IX Item "-absf bitstream_filter"
  2004. Deprecated, see \-bsf
  2005. .IP "\fB\-guess_layout_max\fR \fIchannels\fR \fB(\fR\fIinput,per\-stream\fR\fB)\fR" 4
  2006. .IX Item "-guess_layout_max channels (input,per-stream)"
  2007. If some input channel layout is not known, try to guess only if it
  2008. corresponds to at most the specified number of channels. For example, 2
  2009. tells to \fBffmpeg\fR to recognize 1 channel as mono and 2 channels as
  2010. stereo but not 6 channels as 5.1. The default is to always try to guess. Use
  2011. 0 to disable all guessing.
  2012. .SS "Subtitle options"
  2013. .IX Subsection "Subtitle options"
  2014. .IP "\fB\-scodec\fR \fIcodec\fR \fB(\fR\fIinput/output\fR\fB)\fR" 4
  2015. .IX Item "-scodec codec (input/output)"
  2016. Set the subtitle codec. This is an alias for \f(CW\*(C`\-codec:s\*(C'\fR.
  2017. .IP "\fB\-sn (\fR\fIinput/output\fR\fB)\fR" 4
  2018. .IX Item "-sn (input/output)"
  2019. As an input option, blocks all subtitle streams of a file from being filtered or
  2020. being automatically selected or mapped for any output. See \f(CW\*(C`\-discard\*(C'\fR
  2021. option to disable streams individually.
  2022. .Sp
  2023. As an output option, disables subtitle recording i.e. automatic selection or
  2024. mapping of any subtitle stream. For full manual control see the \f(CW\*(C`\-map\*(C'\fR
  2025. option.
  2026. .IP "\fB\-sbsf\fR \fIbitstream_filter\fR" 4
  2027. .IX Item "-sbsf bitstream_filter"
  2028. Deprecated, see \-bsf
  2029. .SS "Advanced Subtitle options"
  2030. .IX Subsection "Advanced Subtitle options"
  2031. .IP "\fB\-fix_sub_duration\fR" 4
  2032. .IX Item "-fix_sub_duration"
  2033. Fix subtitles durations. For each subtitle, wait for the next packet in the
  2034. same stream and adjust the duration of the first to avoid overlap. This is
  2035. necessary with some subtitles codecs, especially \s-1DVB\s0 subtitles, because the
  2036. duration in the original packet is only a rough estimate and the end is
  2037. actually marked by an empty subtitle frame. Failing to use this option when
  2038. necessary can result in exaggerated durations or muxing failures due to
  2039. non-monotonic timestamps.
  2040. .Sp
  2041. Note that this option will delay the output of all data until the next
  2042. subtitle packet is decoded: it may increase memory consumption and latency a
  2043. lot.
  2044. .IP "\fB\-canvas_size\fR \fIsize\fR" 4
  2045. .IX Item "-canvas_size size"
  2046. Set the size of the canvas used to render subtitles.
  2047. .SS "Advanced options"
  2048. .IX Subsection "Advanced options"
  2049. .IP "\fB\-map [\-]\fR\fIinput_file_id\fR\fB[:\fR\fIstream_specifier\fR\fB][?][,\fR\fIsync_file_id\fR\fB[:\fR\fIstream_specifier\fR\fB]] |\fR \fI[linklabel]\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
  2050. .IX Item "-map [-]input_file_id[:stream_specifier][?][,sync_file_id[:stream_specifier]] | [linklabel] (output)"
  2051. Designate one or more input streams as a source for the output file. Each input
  2052. stream is identified by the input file index \fIinput_file_id\fR and
  2053. the input stream index \fIinput_stream_id\fR within the input
  2054. file. Both indices start at 0. If specified,
  2055. \&\fIsync_file_id\fR:\fIstream_specifier\fR sets which input stream
  2056. is used as a presentation sync reference.
  2057. .Sp
  2058. The first \f(CW\*(C`\-map\*(C'\fR option on the command line specifies the
  2059. source for output stream 0, the second \f(CW\*(C`\-map\*(C'\fR option specifies
  2060. the source for output stream 1, etc.
  2061. .Sp
  2062. A \f(CW\*(C`\-\*(C'\fR character before the stream identifier creates a \*(L"negative\*(R" mapping.
  2063. It disables matching streams from already created mappings.
  2064. .Sp
  2065. A trailing \f(CW\*(C`?\*(C'\fR after the stream index will allow the map to be
  2066. optional: if the map matches no streams the map will be ignored instead
  2067. of failing. Note the map will still fail if an invalid input file index
  2068. is used; such as if the map refers to a non-existent input.
  2069. .Sp
  2070. An alternative \fI[linklabel]\fR form will map outputs from complex filter
  2071. graphs (see the \fB\-filter_complex\fR option) to the output file.
  2072. \&\fIlinklabel\fR must correspond to a defined output link label in the graph.
  2073. .Sp
  2074. For example, to map \s-1ALL\s0 streams from the first input file to output
  2075. .Sp
  2076. .Vb 1
  2077. \& ffmpeg \-i INPUT \-map 0 output
  2078. .Ve
  2079. .Sp
  2080. For example, if you have two audio streams in the first input file,
  2081. these streams are identified by \*(L"0:0\*(R" and \*(L"0:1\*(R". You can use
  2082. \&\f(CW\*(C`\-map\*(C'\fR to select which streams to place in an output file. For
  2083. example:
  2084. .Sp
  2085. .Vb 1
  2086. \& ffmpeg \-i INPUT \-map 0:1 out.wav
  2087. .Ve
  2088. .Sp
  2089. will map the input stream in \fI\s-1INPUT\s0\fR identified by \*(L"0:1\*(R" to
  2090. the (single) output stream in \fIout.wav\fR.
  2091. .Sp
  2092. For example, to select the stream with index 2 from input file
  2093. \&\fIa.mov\fR (specified by the identifier \*(L"0:2\*(R"), and stream with
  2094. index 6 from input \fIb.mov\fR (specified by the identifier \*(L"1:6\*(R"),
  2095. and copy them to the output file \fIout.mov\fR:
  2096. .Sp
  2097. .Vb 1
  2098. \& ffmpeg \-i a.mov \-i b.mov \-c copy \-map 0:2 \-map 1:6 out.mov
  2099. .Ve
  2100. .Sp
  2101. To select all video and the third audio stream from an input file:
  2102. .Sp
  2103. .Vb 1
  2104. \& ffmpeg \-i INPUT \-map 0:v \-map 0:a:2 OUTPUT
  2105. .Ve
  2106. .Sp
  2107. To map all the streams except the second audio, use negative mappings
  2108. .Sp
  2109. .Vb 1
  2110. \& ffmpeg \-i INPUT \-map 0 \-map \-0:a:1 OUTPUT
  2111. .Ve
  2112. .Sp
  2113. To map the video and audio streams from the first input, and using the
  2114. trailing \f(CW\*(C`?\*(C'\fR, ignore the audio mapping if no audio streams exist in
  2115. the first input:
  2116. .Sp
  2117. .Vb 1
  2118. \& ffmpeg \-i INPUT \-map 0:v \-map 0:a? OUTPUT
  2119. .Ve
  2120. .Sp
  2121. To pick the English audio stream:
  2122. .Sp
  2123. .Vb 1
  2124. \& ffmpeg \-i INPUT \-map 0:m:language:eng OUTPUT
  2125. .Ve
  2126. .Sp
  2127. Note that using this option disables the default mappings for this output file.
  2128. .IP "\fB\-ignore_unknown\fR" 4
  2129. .IX Item "-ignore_unknown"
  2130. Ignore input streams with unknown type instead of failing if copying
  2131. such streams is attempted.
  2132. .IP "\fB\-copy_unknown\fR" 4
  2133. .IX Item "-copy_unknown"
  2134. Allow input streams with unknown type to be copied instead of failing if copying
  2135. such streams is attempted.
  2136. .IP "\fB\-map_channel [\fR\fIinput_file_id\fR\fB.\fR\fIstream_specifier\fR\fB.\fR\fIchannel_id\fR\fB|\-1][?][:\fR\fIoutput_file_id\fR\fB.\fR\fIstream_specifier\fR\fB]\fR" 4
  2137. .IX Item "-map_channel [input_file_id.stream_specifier.channel_id|-1][?][:output_file_id.stream_specifier]"
  2138. Map an audio channel from a given input to an output. If
  2139. \&\fIoutput_file_id\fR.\fIstream_specifier\fR is not set, the audio channel will
  2140. be mapped on all the audio streams.
  2141. .Sp
  2142. Using \*(L"\-1\*(R" instead of
  2143. \&\fIinput_file_id\fR.\fIstream_specifier\fR.\fIchannel_id\fR will map a muted
  2144. channel.
  2145. .Sp
  2146. A trailing \f(CW\*(C`?\*(C'\fR will allow the map_channel to be
  2147. optional: if the map_channel matches no channel the map_channel will be ignored instead
  2148. of failing.
  2149. .Sp
  2150. For example, assuming \fI\s-1INPUT\s0\fR is a stereo audio file, you can switch the
  2151. two audio channels with the following command:
  2152. .Sp
  2153. .Vb 1
  2154. \& ffmpeg \-i INPUT \-map_channel 0.0.1 \-map_channel 0.0.0 OUTPUT
  2155. .Ve
  2156. .Sp
  2157. If you want to mute the first channel and keep the second:
  2158. .Sp
  2159. .Vb 1
  2160. \& ffmpeg \-i INPUT \-map_channel \-1 \-map_channel 0.0.1 OUTPUT
  2161. .Ve
  2162. .Sp
  2163. The order of the \*(L"\-map_channel\*(R" option specifies the order of the channels in
  2164. the output stream. The output channel layout is guessed from the number of
  2165. channels mapped (mono if one \*(L"\-map_channel\*(R", stereo if two, etc.). Using \*(L"\-ac\*(R"
  2166. in combination of \*(L"\-map_channel\*(R" makes the channel gain levels to be updated if
  2167. input and output channel layouts don't match (for instance two \*(L"\-map_channel\*(R"
  2168. options and \*(L"\-ac 6\*(R").
  2169. .Sp
  2170. You can also extract each channel of an input to specific outputs; the following
  2171. command extracts two channels of the \fI\s-1INPUT\s0\fR audio stream (file 0, stream 0)
  2172. to the respective \fI\s-1OUTPUT_CH0\s0\fR and \fI\s-1OUTPUT_CH1\s0\fR outputs:
  2173. .Sp
  2174. .Vb 1
  2175. \& ffmpeg \-i INPUT \-map_channel 0.0.0 OUTPUT_CH0 \-map_channel 0.0.1 OUTPUT_CH1
  2176. .Ve
  2177. .Sp
  2178. The following example splits the channels of a stereo input into two separate
  2179. streams, which are put into the same output file:
  2180. .Sp
  2181. .Vb 1
  2182. \& 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
  2183. .Ve
  2184. .Sp
  2185. Note that currently each output stream can only contain channels from a single
  2186. input stream; you can't for example use \*(L"\-map_channel\*(R" to pick multiple input
  2187. audio channels contained in different streams (from the same or different files)
  2188. and merge them into a single output stream. It is therefore not currently
  2189. possible, for example, to turn two separate mono streams into a single stereo
  2190. stream. However splitting a stereo stream into two single channel mono streams
  2191. is possible.
  2192. .Sp
  2193. If you need this feature, a possible workaround is to use the \fIamerge\fR
  2194. filter. For example, if you need to merge a media (here \fIinput.mkv\fR) with 2
  2195. mono audio streams into one single stereo channel audio stream (and keep the
  2196. video stream), you can use the following command:
  2197. .Sp
  2198. .Vb 1
  2199. \& ffmpeg \-i input.mkv \-filter_complex "[0:1] [0:2] amerge" \-c:a pcm_s16le \-c:v copy output.mkv
  2200. .Ve
  2201. .Sp
  2202. To map the first two audio channels from the first input, and using the
  2203. trailing \f(CW\*(C`?\*(C'\fR, ignore the audio channel mapping if the first input is
  2204. mono instead of stereo:
  2205. .Sp
  2206. .Vb 1
  2207. \& ffmpeg \-i INPUT \-map_channel 0.0.0 \-map_channel 0.0.1? OUTPUT
  2208. .Ve
  2209. .IP "\fB\-map_metadata[:\fR\fImetadata_spec_out\fR\fB]\fR \fIinfile\fR\fB[:\fR\fImetadata_spec_in\fR\fB] (\fR\fIoutput,per\-metadata\fR\fB)\fR" 4
  2210. .IX Item "-map_metadata[:metadata_spec_out] infile[:metadata_spec_in] (output,per-metadata)"
  2211. Set metadata information of the next output file from \fIinfile\fR. Note that
  2212. those are file indices (zero-based), not filenames.
  2213. Optional \fImetadata_spec_in/out\fR parameters specify, which metadata to copy.
  2214. A metadata specifier can have the following forms:
  2215. .RS 4
  2216. .IP "\fIg\fR" 4
  2217. .IX Item "g"
  2218. global metadata, i.e. metadata that applies to the whole file
  2219. .IP "\fIs\fR\fB[:\fR\fIstream_spec\fR\fB]\fR" 4
  2220. .IX Item "s[:stream_spec]"
  2221. per-stream metadata. \fIstream_spec\fR is a stream specifier as described
  2222. in the \fBStream specifiers\fR chapter. In an input metadata specifier, the first
  2223. matching stream is copied from. In an output metadata specifier, all matching
  2224. streams are copied to.
  2225. .IP "\fIc\fR\fB:\fR\fIchapter_index\fR" 4
  2226. .IX Item "c:chapter_index"
  2227. per-chapter metadata. \fIchapter_index\fR is the zero-based chapter index.
  2228. .IP "\fIp\fR\fB:\fR\fIprogram_index\fR" 4
  2229. .IX Item "p:program_index"
  2230. per-program metadata. \fIprogram_index\fR is the zero-based program index.
  2231. .RE
  2232. .RS 4
  2233. .Sp
  2234. If metadata specifier is omitted, it defaults to global.
  2235. .Sp
  2236. By default, global metadata is copied from the first input file,
  2237. per-stream and per-chapter metadata is copied along with streams/chapters. These
  2238. default mappings are disabled by creating any mapping of the relevant type. A negative
  2239. file index can be used to create a dummy mapping that just disables automatic copying.
  2240. .Sp
  2241. For example to copy metadata from the first stream of the input file to global metadata
  2242. of the output file:
  2243. .Sp
  2244. .Vb 1
  2245. \& ffmpeg \-i in.ogg \-map_metadata 0:s:0 out.mp3
  2246. .Ve
  2247. .Sp
  2248. To do the reverse, i.e. copy global metadata to all audio streams:
  2249. .Sp
  2250. .Vb 1
  2251. \& ffmpeg \-i in.mkv \-map_metadata:s:a 0:g out.mkv
  2252. .Ve
  2253. .Sp
  2254. Note that simple \f(CW0\fR would work as well in this example, since global
  2255. metadata is assumed by default.
  2256. .RE
  2257. .IP "\fB\-map_chapters\fR \fIinput_file_index\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
  2258. .IX Item "-map_chapters input_file_index (output)"
  2259. Copy chapters from input file with index \fIinput_file_index\fR to the next
  2260. output file. If no chapter mapping is specified, then chapters are copied from
  2261. the first input file with at least one chapter. Use a negative file index to
  2262. disable any chapter copying.
  2263. .IP "\fB\-benchmark (\fR\fIglobal\fR\fB)\fR" 4
  2264. .IX Item "-benchmark (global)"
  2265. Show benchmarking information at the end of an encode.
  2266. Shows real, system and user time used and maximum memory consumption.
  2267. Maximum memory consumption is not supported on all systems,
  2268. it will usually display as 0 if not supported.
  2269. .IP "\fB\-benchmark_all (\fR\fIglobal\fR\fB)\fR" 4
  2270. .IX Item "-benchmark_all (global)"
  2271. Show benchmarking information during the encode.
  2272. Shows real, system and user time used in various steps (audio/video encode/decode).
  2273. .IP "\fB\-timelimit\fR \fIduration\fR \fB(\fR\fIglobal\fR\fB)\fR" 4
  2274. .IX Item "-timelimit duration (global)"
  2275. Exit after ffmpeg has been running for \fIduration\fR seconds in \s-1CPU\s0 user time.
  2276. .IP "\fB\-dump (\fR\fIglobal\fR\fB)\fR" 4
  2277. .IX Item "-dump (global)"
  2278. Dump each input packet to stderr.
  2279. .IP "\fB\-hex (\fR\fIglobal\fR\fB)\fR" 4
  2280. .IX Item "-hex (global)"
  2281. When dumping packets, also dump the payload.
  2282. .IP "\fB\-re (\fR\fIinput\fR\fB)\fR" 4
  2283. .IX Item "-re (input)"
  2284. Read input at native frame rate. Mainly used to simulate a grab device,
  2285. or live input stream (e.g. when reading from a file). Should not be used
  2286. with actual grab devices or live input streams (where it can cause packet
  2287. loss).
  2288. By default \fBffmpeg\fR attempts to read the input(s) as fast as possible.
  2289. This option will slow down the reading of the input(s) to the native frame rate
  2290. of the input(s). It is useful for real-time output (e.g. live streaming).
  2291. .IP "\fB\-vsync\fR \fIparameter\fR" 4
  2292. .IX Item "-vsync parameter"
  2293. Video sync method.
  2294. For compatibility reasons old values can be specified as numbers.
  2295. Newly added values will have to be specified as strings always.
  2296. .RS 4
  2297. .IP "\fB0, passthrough\fR" 4
  2298. .IX Item "0, passthrough"
  2299. Each frame is passed with its timestamp from the demuxer to the muxer.
  2300. .IP "\fB1, cfr\fR" 4
  2301. .IX Item "1, cfr"
  2302. Frames will be duplicated and dropped to achieve exactly the requested
  2303. constant frame rate.
  2304. .IP "\fB2, vfr\fR" 4
  2305. .IX Item "2, vfr"
  2306. Frames are passed through with their timestamp or dropped so as to
  2307. prevent 2 frames from having the same timestamp.
  2308. .IP "\fBdrop\fR" 4
  2309. .IX Item "drop"
  2310. As passthrough but destroys all timestamps, making the muxer generate
  2311. fresh timestamps based on frame-rate.
  2312. .IP "\fB\-1, auto\fR" 4
  2313. .IX Item "-1, auto"
  2314. Chooses between 1 and 2 depending on muxer capabilities. This is the
  2315. default method.
  2316. .RE
  2317. .RS 4
  2318. .Sp
  2319. Note that the timestamps may be further modified by the muxer, after this.
  2320. For example, in the case that the format option \fBavoid_negative_ts\fR
  2321. is enabled.
  2322. .Sp
  2323. With \-map you can select from which stream the timestamps should be
  2324. taken. You can leave either video or audio unchanged and sync the
  2325. remaining stream(s) to the unchanged one.
  2326. .RE
  2327. .IP "\fB\-frame_drop_threshold\fR \fIparameter\fR" 4
  2328. .IX Item "-frame_drop_threshold parameter"
  2329. Frame drop threshold, which specifies how much behind video frames can
  2330. be before they are dropped. In frame rate units, so 1.0 is one frame.
  2331. The default is \-1.1. One possible usecase is to avoid framedrops in case
  2332. of noisy timestamps or to increase frame drop precision in case of exact
  2333. timestamps.
  2334. .IP "\fB\-async\fR \fIsamples_per_second\fR" 4
  2335. .IX Item "-async samples_per_second"
  2336. Audio sync method. \*(L"Stretches/squeezes\*(R" the audio stream to match the timestamps,
  2337. the parameter is the maximum samples per second by which the audio is changed.
  2338. \&\-async 1 is a special case where only the start of the audio stream is corrected
  2339. without any later correction.
  2340. .Sp
  2341. Note that the timestamps may be further modified by the muxer, after this.
  2342. For example, in the case that the format option \fBavoid_negative_ts\fR
  2343. is enabled.
  2344. .Sp
  2345. This option has been deprecated. Use the \f(CW\*(C`aresample\*(C'\fR audio filter instead.
  2346. .IP "\fB\-adrift_threshold\fR \fItime\fR" 4
  2347. .IX Item "-adrift_threshold time"
  2348. Set the minimum difference between timestamps and audio data (in seconds) to trigger
  2349. adding/dropping samples to make it match the timestamps. This option effectively is
  2350. a threshold to select between hard (add/drop) and soft (squeeze/stretch) compensation.
  2351. \&\f(CW\*(C`\-async\*(C'\fR must be set to a positive value.
  2352. .IP "\fB\-apad\fR \fIparameters\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4
  2353. .IX Item "-apad parameters (output,per-stream)"
  2354. Pad the output audio stream(s). This is the same as applying \f(CW\*(C`\-af apad\*(C'\fR.
  2355. Argument is a string of filter parameters composed the same as with the \f(CW\*(C`apad\*(C'\fR filter.
  2356. \&\f(CW\*(C`\-shortest\*(C'\fR must be set for this output for the option to take effect.
  2357. .IP "\fB\-copyts\fR" 4
  2358. .IX Item "-copyts"
  2359. Do not process input timestamps, but keep their values without trying
  2360. to sanitize them. In particular, do not remove the initial start time
  2361. offset value.
  2362. .Sp
  2363. Note that, depending on the \fBvsync\fR option or on specific muxer
  2364. processing (e.g. in case the format option \fBavoid_negative_ts\fR
  2365. is enabled) the output timestamps may mismatch with the input
  2366. timestamps even when this option is selected.
  2367. .IP "\fB\-start_at_zero\fR" 4
  2368. .IX Item "-start_at_zero"
  2369. When used with \fBcopyts\fR, shift input timestamps so they start at zero.
  2370. .Sp
  2371. This means that using e.g. \f(CW\*(C`\-ss 50\*(C'\fR will make output timestamps start at
  2372. 50 seconds, regardless of what timestamp the input file started at.
  2373. .IP "\fB\-copytb\fR \fImode\fR" 4
  2374. .IX Item "-copytb mode"
  2375. Specify how to set the encoder timebase when stream copying. \fImode\fR is an
  2376. integer numeric value, and can assume one of the following values:
  2377. .RS 4
  2378. .IP "\fB1\fR" 4
  2379. .IX Item "1"
  2380. Use the demuxer timebase.
  2381. .Sp
  2382. The time base is copied to the output encoder from the corresponding input
  2383. demuxer. This is sometimes required to avoid non monotonically increasing
  2384. timestamps when copying video streams with variable frame rate.
  2385. .IP "\fB0\fR" 4
  2386. .IX Item "0"
  2387. Use the decoder timebase.
  2388. .Sp
  2389. The time base is copied to the output encoder from the corresponding input
  2390. decoder.
  2391. .IP "\fB\-1\fR" 4
  2392. .IX Item "-1"
  2393. Try to make the choice automatically, in order to generate a sane output.
  2394. .RE
  2395. .RS 4
  2396. .Sp
  2397. Default value is \-1.
  2398. .RE
  2399. .IP "\fB\-enc_time_base[:\fR\fIstream_specifier\fR\fB]\fR \fItimebase\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4
  2400. .IX Item "-enc_time_base[:stream_specifier] timebase (output,per-stream)"
  2401. Set the encoder timebase. \fItimebase\fR is a floating point number,
  2402. and can assume one of the following values:
  2403. .RS 4
  2404. .IP "\fB0\fR" 4
  2405. .IX Item "0"
  2406. Assign a default value according to the media type.
  2407. .Sp
  2408. For video \- use 1/framerate, for audio \- use 1/samplerate.
  2409. .IP "\fB\-1\fR" 4
  2410. .IX Item "-1"
  2411. Use the input stream timebase when possible.
  2412. .Sp
  2413. If an input stream is not available, the default timebase will be used.
  2414. .IP "\fB>0\fR" 4
  2415. .IX Item ">0"
  2416. Use the provided number as the timebase.
  2417. .Sp
  2418. This field can be provided as a ratio of two integers (e.g. 1:24, 1:48000)
  2419. or as a floating point number (e.g. 0.04166, 2.0833e\-5)
  2420. .RE
  2421. .RS 4
  2422. .Sp
  2423. Default value is 0.
  2424. .RE
  2425. .IP "\fB\-bitexact (\fR\fIinput/output\fR\fB)\fR" 4
  2426. .IX Item "-bitexact (input/output)"
  2427. Enable bitexact mode for (de)muxer and (de/en)coder
  2428. .IP "\fB\-shortest (\fR\fIoutput\fR\fB)\fR" 4
  2429. .IX Item "-shortest (output)"
  2430. Finish encoding when the shortest input stream ends.
  2431. .IP "\fB\-dts_delta_threshold\fR" 4
  2432. .IX Item "-dts_delta_threshold"
  2433. Timestamp discontinuity delta threshold.
  2434. .IP "\fB\-dts_error_threshold\fR \fIseconds\fR" 4
  2435. .IX Item "-dts_error_threshold seconds"
  2436. Timestamp error delta threshold. This threshold use to discard crazy/damaged
  2437. timestamps and the default is 30 hours which is arbitrarily picked and quite
  2438. conservative.
  2439. .IP "\fB\-muxdelay\fR \fIseconds\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
  2440. .IX Item "-muxdelay seconds (output)"
  2441. Set the maximum demux-decode delay.
  2442. .IP "\fB\-muxpreload\fR \fIseconds\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
  2443. .IX Item "-muxpreload seconds (output)"
  2444. Set the initial demux-decode delay.
  2445. .IP "\fB\-streamid\fR \fIoutput-stream-index\fR\fB:\fR\fInew-value\fR \fB(\fR\fIoutput\fR\fB)\fR" 4
  2446. .IX Item "-streamid output-stream-index:new-value (output)"
  2447. Assign a new stream-id value to an output stream. This option should be
  2448. specified prior to the output filename to which it applies.
  2449. For the situation where multiple output files exist, a streamid
  2450. may be reassigned to a different value.
  2451. .Sp
  2452. For example, to set the stream 0 \s-1PID\s0 to 33 and the stream 1 \s-1PID\s0 to 36 for
  2453. an output mpegts file:
  2454. .Sp
  2455. .Vb 1
  2456. \& ffmpeg \-i inurl \-streamid 0:33 \-streamid 1:36 out.ts
  2457. .Ve
  2458. .IP "\fB\-bsf[:\fR\fIstream_specifier\fR\fB]\fR \fIbitstream_filters\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4
  2459. .IX Item "-bsf[:stream_specifier] bitstream_filters (output,per-stream)"
  2460. Set bitstream filters for matching streams. \fIbitstream_filters\fR is
  2461. a comma-separated list of bitstream filters. Use the \f(CW\*(C`\-bsfs\*(C'\fR option
  2462. to get the list of bitstream filters.
  2463. .Sp
  2464. .Vb 1
  2465. \& ffmpeg \-i h264.mp4 \-c:v copy \-bsf:v h264_mp4toannexb \-an out.h264
  2466. \&
  2467. \&
  2468. \& ffmpeg \-i file.mov \-an \-vn \-bsf:s mov2textsub \-c:s copy \-f rawvideo sub.txt
  2469. .Ve
  2470. .IP "\fB\-tag[:\fR\fIstream_specifier\fR\fB]\fR \fIcodec_tag\fR \fB(\fR\fIinput/output,per\-stream\fR\fB)\fR" 4
  2471. .IX Item "-tag[:stream_specifier] codec_tag (input/output,per-stream)"
  2472. Force a tag/fourcc for matching streams.
  2473. .IP "\fB\-timecode\fR \fIhh\fR\fB:\fR\fImm\fR\fB:\fR\fIss\fR\fB\s-1SEP\s0\fR\fIff\fR" 4
  2474. .IX Item "-timecode hh:mm:ssSEPff"
  2475. Specify Timecode for writing. \fI\s-1SEP\s0\fR is ':' for non drop timecode and ';'
  2476. (or '.') for drop.
  2477. .Sp
  2478. .Vb 1
  2479. \& ffmpeg \-i input.mpg \-timecode 01:02:03.04 \-r 30000/1001 \-s ntsc output.mpg
  2480. .Ve
  2481. .IP "\fB\-filter_complex\fR \fIfiltergraph\fR \fB(\fR\fIglobal\fR\fB)\fR" 4
  2482. .IX Item "-filter_complex filtergraph (global)"
  2483. Define a complex filtergraph, i.e. one with arbitrary number of inputs and/or
  2484. outputs. For simple graphs \*(-- those with one input and one output of the same
  2485. type \*(-- see the \fB\-filter\fR options. \fIfiltergraph\fR is a description of
  2486. the filtergraph, as described in the ``Filtergraph syntax'' section of the
  2487. ffmpeg-filters manual.
  2488. .Sp
  2489. Input link labels must refer to input streams using the
  2490. \&\f(CW\*(C`[file_index:stream_specifier]\*(C'\fR syntax (i.e. the same as \fB\-map\fR
  2491. uses). If \fIstream_specifier\fR matches multiple streams, the first one will be
  2492. used. An unlabeled input will be connected to the first unused input stream of
  2493. the matching type.
  2494. .Sp
  2495. Output link labels are referred to with \fB\-map\fR. Unlabeled outputs are
  2496. added to the first output file.
  2497. .Sp
  2498. Note that with this option it is possible to use only lavfi sources without
  2499. normal input files.
  2500. .Sp
  2501. For example, to overlay an image over video
  2502. .Sp
  2503. .Vb 2
  2504. \& ffmpeg \-i video.mkv \-i image.png \-filter_complex \*(Aq[0:v][1:v]overlay[out]\*(Aq \-map
  2505. \& \*(Aq[out]\*(Aq out.mkv
  2506. .Ve
  2507. .Sp
  2508. Here \f(CW\*(C`[0:v]\*(C'\fR refers to the first video stream in the first input file,
  2509. which is linked to the first (main) input of the overlay filter. Similarly the
  2510. first video stream in the second input is linked to the second (overlay) input
  2511. of overlay.
  2512. .Sp
  2513. Assuming there is only one video stream in each input file, we can omit input
  2514. labels, so the above is equivalent to
  2515. .Sp
  2516. .Vb 2
  2517. \& ffmpeg \-i video.mkv \-i image.png \-filter_complex \*(Aqoverlay[out]\*(Aq \-map
  2518. \& \*(Aq[out]\*(Aq out.mkv
  2519. .Ve
  2520. .Sp
  2521. Furthermore we can omit the output label and the single output from the filter
  2522. graph will be added to the output file automatically, so we can simply write
  2523. .Sp
  2524. .Vb 1
  2525. \& ffmpeg \-i video.mkv \-i image.png \-filter_complex \*(Aqoverlay\*(Aq out.mkv
  2526. .Ve
  2527. .Sp
  2528. As a special exception, you can use a bitmap subtitle stream as input: it
  2529. will be converted into a video with the same size as the largest video in
  2530. the file, or 720x576 if no video is present. Note that this is an
  2531. experimental and temporary solution. It will be removed once libavfilter has
  2532. proper support for subtitles.
  2533. .Sp
  2534. For example, to hardcode subtitles on top of a DVB-T recording stored in
  2535. MPEG-TS format, delaying the subtitles by 1 second:
  2536. .Sp
  2537. .Vb 3
  2538. \& ffmpeg \-i input.ts \-filter_complex \e
  2539. \& \*(Aq[#0x2ef] setpts=PTS+1/TB [sub] ; [#0x2d0] [sub] overlay\*(Aq \e
  2540. \& \-sn \-map \*(Aq#0x2dc\*(Aq output.mkv
  2541. .Ve
  2542. .Sp
  2543. (0x2d0, 0x2dc and 0x2ef are the MPEG-TS PIDs of respectively the video,
  2544. audio and subtitles streams; 0:0, 0:3 and 0:7 would have worked too)
  2545. .Sp
  2546. To generate 5 seconds of pure red video using lavfi \f(CW\*(C`color\*(C'\fR source:
  2547. .Sp
  2548. .Vb 1
  2549. \& ffmpeg \-filter_complex \*(Aqcolor=c=red\*(Aq \-t 5 out.mkv
  2550. .Ve
  2551. .IP "\fB\-filter_complex_threads\fR \fInb_threads\fR \fB(\fR\fIglobal\fR\fB)\fR" 4
  2552. .IX Item "-filter_complex_threads nb_threads (global)"
  2553. Defines how many threads are used to process a filter_complex graph.
  2554. Similar to filter_threads but used for \f(CW\*(C`\-filter_complex\*(C'\fR graphs only.
  2555. The default is the number of available CPUs.
  2556. .IP "\fB\-lavfi\fR \fIfiltergraph\fR \fB(\fR\fIglobal\fR\fB)\fR" 4
  2557. .IX Item "-lavfi filtergraph (global)"
  2558. Define a complex filtergraph, i.e. one with arbitrary number of inputs and/or
  2559. outputs. Equivalent to \fB\-filter_complex\fR.
  2560. .IP "\fB\-filter_complex_script\fR \fIfilename\fR \fB(\fR\fIglobal\fR\fB)\fR" 4
  2561. .IX Item "-filter_complex_script filename (global)"
  2562. This option is similar to \fB\-filter_complex\fR, the only difference is that
  2563. its argument is the name of the file from which a complex filtergraph
  2564. description is to be read.
  2565. .IP "\fB\-accurate_seek (\fR\fIinput\fR\fB)\fR" 4
  2566. .IX Item "-accurate_seek (input)"
  2567. This option enables or disables accurate seeking in input files with the
  2568. \&\fB\-ss\fR option. It is enabled by default, so seeking is accurate when
  2569. transcoding. Use \fB\-noaccurate_seek\fR to disable it, which may be useful
  2570. e.g. when copying some streams and transcoding the others.
  2571. .IP "\fB\-seek_timestamp (\fR\fIinput\fR\fB)\fR" 4
  2572. .IX Item "-seek_timestamp (input)"
  2573. This option enables or disables seeking by timestamp in input files with the
  2574. \&\fB\-ss\fR option. It is disabled by default. If enabled, the argument
  2575. to the \fB\-ss\fR option is considered an actual timestamp, and is not
  2576. offset by the start time of the file. This matters only for files which do
  2577. not start from timestamp 0, such as transport streams.
  2578. .IP "\fB\-thread_queue_size\fR \fIsize\fR \fB(\fR\fIinput\fR\fB)\fR" 4
  2579. .IX Item "-thread_queue_size size (input)"
  2580. This option sets the maximum number of queued packets when reading from the
  2581. file or device. With low latency / high rate live streams, packets may be
  2582. discarded if they are not read in a timely manner; setting this value can
  2583. force ffmpeg to use a separate input thread and read packets as soon as they
  2584. arrive. By default ffmpeg only do this if multiple inputs are specified.
  2585. .IP "\fB\-sdp_file\fR \fIfile\fR \fB(\fR\fIglobal\fR\fB)\fR" 4
  2586. .IX Item "-sdp_file file (global)"
  2587. Print sdp information for an output stream to \fIfile\fR.
  2588. This allows dumping sdp information when at least one output isn't an
  2589. rtp stream. (Requires at least one of the output formats to be rtp).
  2590. .IP "\fB\-discard (\fR\fIinput\fR\fB)\fR" 4
  2591. .IX Item "-discard (input)"
  2592. Allows discarding specific streams or frames from streams.
  2593. Any input stream can be fully discarded, using value \f(CW\*(C`all\*(C'\fR whereas
  2594. selective discarding of frames from a stream occurs at the demuxer
  2595. and is not supported by all demuxers.
  2596. .RS 4
  2597. .IP "\fBnone\fR" 4
  2598. .IX Item "none"
  2599. Discard no frame.
  2600. .IP "\fBdefault\fR" 4
  2601. .IX Item "default"
  2602. Default, which discards no frames.
  2603. .IP "\fBnoref\fR" 4
  2604. .IX Item "noref"
  2605. Discard all non-reference frames.
  2606. .IP "\fBbidir\fR" 4
  2607. .IX Item "bidir"
  2608. Discard all bidirectional frames.
  2609. .IP "\fBnokey\fR" 4
  2610. .IX Item "nokey"
  2611. Discard all frames excepts keyframes.
  2612. .IP "\fBall\fR" 4
  2613. .IX Item "all"
  2614. Discard all frames.
  2615. .RE
  2616. .RS 4
  2617. .RE
  2618. .IP "\fB\-abort_on\fR \fIflags\fR \fB(\fR\fIglobal\fR\fB)\fR" 4
  2619. .IX Item "-abort_on flags (global)"
  2620. Stop and abort on various conditions. The following flags are available:
  2621. .RS 4
  2622. .IP "\fBempty_output\fR" 4
  2623. .IX Item "empty_output"
  2624. No packets were passed to the muxer, the output is empty.
  2625. .IP "\fBempty_output_stream\fR" 4
  2626. .IX Item "empty_output_stream"
  2627. No packets were passed to the muxer in some of the output streams.
  2628. .RE
  2629. .RS 4
  2630. .RE
  2631. .IP "\fB\-max_error_rate (\fR\fIglobal\fR\fB)\fR" 4
  2632. .IX Item "-max_error_rate (global)"
  2633. Set fraction of decoding frame failures across all inputs which when crossed
  2634. ffmpeg will return exit code 69. Crossing this threshold does not terminate
  2635. processing. Range is a floating-point number between 0 to 1. Default is 2/3.
  2636. .IP "\fB\-xerror (\fR\fIglobal\fR\fB)\fR" 4
  2637. .IX Item "-xerror (global)"
  2638. Stop and exit on error
  2639. .IP "\fB\-max_muxing_queue_size\fR \fIpackets\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4
  2640. .IX Item "-max_muxing_queue_size packets (output,per-stream)"
  2641. When transcoding audio and/or video streams, ffmpeg will not begin writing into
  2642. the output until it has one packet for each such stream. While waiting for that
  2643. to happen, packets for other streams are buffered. This option sets the size of
  2644. this buffer, in packets, for the matching output stream.
  2645. .Sp
  2646. The default value of this option should be high enough for most uses, so only
  2647. touch this option if you are sure that you need it.
  2648. .IP "\fB\-muxing_queue_data_threshold\fR \fIbytes\fR \fB(\fR\fIoutput,per\-stream\fR\fB)\fR" 4
  2649. .IX Item "-muxing_queue_data_threshold bytes (output,per-stream)"
  2650. This is a minimum threshold until which the muxing queue size is not taken into
  2651. account. Defaults to 50 megabytes per stream, and is based on the overall size
  2652. of packets passed to the muxer.
  2653. .IP "\fB\-auto_conversion_filters (\fR\fIglobal\fR\fB)\fR" 4
  2654. .IX Item "-auto_conversion_filters (global)"
  2655. Enable automatically inserting format conversion filters in all filter
  2656. graphs, including those defined by \fB\-vf\fR, \fB\-af\fR,
  2657. \&\fB\-filter_complex\fR and \fB\-lavfi\fR. If filter format negotiation
  2658. requires a conversion, the initialization of the filters will fail.
  2659. Conversions can still be performed by inserting the relevant conversion
  2660. filter (scale, aresample) in the graph.
  2661. On by default, to explicitly disable it you need to specify
  2662. \&\f(CW\*(C`\-noauto_conversion_filters\*(C'\fR.
  2663. .SS "Preset files"
  2664. .IX Subsection "Preset files"
  2665. A preset file contains a sequence of \fIoption\fR=\fIvalue\fR pairs,
  2666. one for each line, specifying a sequence of options which would be
  2667. awkward to specify on the command line. Lines starting with the hash
  2668. ('#') character are ignored and are used to provide comments. Check
  2669. the \fIpresets\fR directory in the FFmpeg source tree for examples.
  2670. .PP
  2671. There are two types of preset files: ffpreset and avpreset files.
  2672. .PP
  2673. \fIffpreset files\fR
  2674. .IX Subsection "ffpreset files"
  2675. .PP
  2676. ffpreset files are specified with the \f(CW\*(C`vpre\*(C'\fR, \f(CW\*(C`apre\*(C'\fR,
  2677. \&\f(CW\*(C`spre\*(C'\fR, and \f(CW\*(C`fpre\*(C'\fR options. The \f(CW\*(C`fpre\*(C'\fR option takes the
  2678. filename of the preset instead of a preset name as input and can be
  2679. used for any kind of codec. For the \f(CW\*(C`vpre\*(C'\fR, \f(CW\*(C`apre\*(C'\fR, and
  2680. \&\f(CW\*(C`spre\*(C'\fR options, the options specified in a preset file are
  2681. applied to the currently selected codec of the same type as the preset
  2682. option.
  2683. .PP
  2684. The argument passed to the \f(CW\*(C`vpre\*(C'\fR, \f(CW\*(C`apre\*(C'\fR, and \f(CW\*(C`spre\*(C'\fR
  2685. preset options identifies the preset file to use according to the
  2686. following rules:
  2687. .PP
  2688. First ffmpeg searches for a file named \fIarg\fR.ffpreset in the
  2689. directories \fI\f(CI$FFMPEG_DATADIR\fI\fR (if set), and \fI\f(CI$HOME\fI/.ffmpeg\fR, and in
  2690. the datadir defined at configuration time (usually \fIPREFIX/share/ffmpeg\fR)
  2691. or in a \fIffpresets\fR folder along the executable on win32,
  2692. in that order. For example, if the argument is \f(CW\*(C`libvpx\-1080p\*(C'\fR, it will
  2693. search for the file \fIlibvpx\-1080p.ffpreset\fR.
  2694. .PP
  2695. If no such file is found, then ffmpeg will search for a file named
  2696. \&\fIcodec_name\fR\-\fIarg\fR.ffpreset in the above-mentioned
  2697. directories, where \fIcodec_name\fR is the name of the codec to which
  2698. the preset file options will be applied. For example, if you select
  2699. the video codec with \f(CW\*(C`\-vcodec libvpx\*(C'\fR and use \f(CW\*(C`\-vpre 1080p\*(C'\fR,
  2700. then it will search for the file \fIlibvpx\-1080p.ffpreset\fR.
  2701. .PP
  2702. \fIavpreset files\fR
  2703. .IX Subsection "avpreset files"
  2704. .PP
  2705. avpreset files are specified with the \f(CW\*(C`pre\*(C'\fR option. They work similar to
  2706. ffpreset files, but they only allow encoder\- specific options. Therefore, an
  2707. \&\fIoption\fR=\fIvalue\fR pair specifying an encoder cannot be used.
  2708. .PP
  2709. When the \f(CW\*(C`pre\*(C'\fR option is specified, ffmpeg will look for files with the
  2710. suffix .avpreset in the directories \fI\f(CI$AVCONV_DATADIR\fI\fR (if set), and
  2711. \&\fI\f(CI$HOME\fI/.avconv\fR, and in the datadir defined at configuration time (usually
  2712. \&\fIPREFIX/share/ffmpeg\fR), in that order.
  2713. .PP
  2714. First ffmpeg searches for a file named \fIcodec_name\fR\-\fIarg\fR.avpreset in
  2715. the above-mentioned directories, where \fIcodec_name\fR is the name of the codec
  2716. to which the preset file options will be applied. For example, if you select the
  2717. video codec with \f(CW\*(C`\-vcodec libvpx\*(C'\fR and use \f(CW\*(C`\-pre 1080p\*(C'\fR, then it will
  2718. search for the file \fIlibvpx\-1080p.avpreset\fR.
  2719. .PP
  2720. If no such file is found, then ffmpeg will search for a file named
  2721. \&\fIarg\fR.avpreset in the same directories.
  2722. .SH "EXAMPLES"
  2723. .IX Header "EXAMPLES"
  2724. .SS "Video and Audio grabbing"
  2725. .IX Subsection "Video and Audio grabbing"
  2726. If you specify the input format and device then ffmpeg can grab video
  2727. and audio directly.
  2728. .PP
  2729. .Vb 1
  2730. \& ffmpeg \-f oss \-i /dev/dsp \-f video4linux2 \-i /dev/video0 /tmp/out.mpg
  2731. .Ve
  2732. .PP
  2733. Or with an \s-1ALSA\s0 audio source (mono input, card id 1) instead of \s-1OSS:\s0
  2734. .PP
  2735. .Vb 1
  2736. \& ffmpeg \-f alsa \-ac 1 \-i hw:1 \-f video4linux2 \-i /dev/video0 /tmp/out.mpg
  2737. .Ve
  2738. .PP
  2739. Note that you must activate the right video source and channel before
  2740. launching ffmpeg with any \s-1TV\s0 viewer such as
  2741. <\fBhttp://linux.bytesex.org/xawtv/\fR> by Gerd Knorr. You also
  2742. have to set the audio recording levels correctly with a
  2743. standard mixer.
  2744. .SS "X11 grabbing"
  2745. .IX Subsection "X11 grabbing"
  2746. Grab the X11 display with ffmpeg via
  2747. .PP
  2748. .Vb 1
  2749. \& ffmpeg \-f x11grab \-video_size cif \-framerate 25 \-i :0.0 /tmp/out.mpg
  2750. .Ve
  2751. .PP
  2752. 0.0 is display.screen number of your X11 server, same as
  2753. the \s-1DISPLAY\s0 environment variable.
  2754. .PP
  2755. .Vb 1
  2756. \& ffmpeg \-f x11grab \-video_size cif \-framerate 25 \-i :0.0+10,20 /tmp/out.mpg
  2757. .Ve
  2758. .PP
  2759. 0.0 is display.screen number of your X11 server, same as the \s-1DISPLAY\s0 environment
  2760. variable. 10 is the x\-offset and 20 the y\-offset for the grabbing.
  2761. .SS "Video and Audio file format conversion"
  2762. .IX Subsection "Video and Audio file format conversion"
  2763. Any supported file format and protocol can serve as input to ffmpeg:
  2764. .PP
  2765. Examples:
  2766. .IP "\(bu" 4
  2767. You can use \s-1YUV\s0 files as input:
  2768. .Sp
  2769. .Vb 1
  2770. \& ffmpeg \-i /tmp/test%d.Y /tmp/out.mpg
  2771. .Ve
  2772. .Sp
  2773. It will use the files:
  2774. .Sp
  2775. .Vb 2
  2776. \& /tmp/test0.Y, /tmp/test0.U, /tmp/test0.V,
  2777. \& /tmp/test1.Y, /tmp/test1.U, /tmp/test1.V, etc...
  2778. .Ve
  2779. .Sp
  2780. The Y files use twice the resolution of the U and V files. They are
  2781. raw files, without header. They can be generated by all decent video
  2782. decoders. You must specify the size of the image with the \fB\-s\fR option
  2783. if ffmpeg cannot guess it.
  2784. .IP "\(bu" 4
  2785. You can input from a raw \s-1YUV420P\s0 file:
  2786. .Sp
  2787. .Vb 1
  2788. \& ffmpeg \-i /tmp/test.yuv /tmp/out.avi
  2789. .Ve
  2790. .Sp
  2791. test.yuv is a file containing raw \s-1YUV\s0 planar data. Each frame is composed
  2792. of the Y plane followed by the U and V planes at half vertical and
  2793. horizontal resolution.
  2794. .IP "\(bu" 4
  2795. You can output to a raw \s-1YUV420P\s0 file:
  2796. .Sp
  2797. .Vb 1
  2798. \& ffmpeg \-i mydivx.avi hugefile.yuv
  2799. .Ve
  2800. .IP "\(bu" 4
  2801. You can set several input files and output files:
  2802. .Sp
  2803. .Vb 1
  2804. \& ffmpeg \-i /tmp/a.wav \-s 640x480 \-i /tmp/a.yuv /tmp/a.mpg
  2805. .Ve
  2806. .Sp
  2807. Converts the audio file a.wav and the raw \s-1YUV\s0 video file a.yuv
  2808. to \s-1MPEG\s0 file a.mpg.
  2809. .IP "\(bu" 4
  2810. You can also do audio and video conversions at the same time:
  2811. .Sp
  2812. .Vb 1
  2813. \& ffmpeg \-i /tmp/a.wav \-ar 22050 /tmp/a.mp2
  2814. .Ve
  2815. .Sp
  2816. Converts a.wav to \s-1MPEG\s0 audio at 22050 Hz sample rate.
  2817. .IP "\(bu" 4
  2818. You can encode to several formats at the same time and define a
  2819. mapping from input stream to output streams:
  2820. .Sp
  2821. .Vb 1
  2822. \& ffmpeg \-i /tmp/a.wav \-map 0:a \-b:a 64k /tmp/a.mp2 \-map 0:a \-b:a 128k /tmp/b.mp2
  2823. .Ve
  2824. .Sp
  2825. Converts a.wav to a.mp2 at 64 kbits and to b.mp2 at 128 kbits. '\-map
  2826. file:index' specifies which input stream is used for each output
  2827. stream, in the order of the definition of output streams.
  2828. .IP "\(bu" 4
  2829. You can transcode decrypted VOBs:
  2830. .Sp
  2831. .Vb 1
  2832. \& 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
  2833. .Ve
  2834. .Sp
  2835. This is a typical \s-1DVD\s0 ripping example; the input is a \s-1VOB\s0 file, the
  2836. output an \s-1AVI\s0 file with \s-1MPEG\-4\s0 video and \s-1MP3\s0 audio. Note that in this
  2837. command we use B\-frames so the \s-1MPEG\-4\s0 stream is DivX5 compatible, and
  2838. \&\s-1GOP\s0 size is 300 which means one intra frame every 10 seconds for 29.97fps
  2839. input video. Furthermore, the audio stream is MP3\-encoded so you need
  2840. to enable \s-1LAME\s0 support by passing \f(CW\*(C`\-\-enable\-libmp3lame\*(C'\fR to configure.
  2841. The mapping is particularly useful for \s-1DVD\s0 transcoding
  2842. to get the desired audio language.
  2843. .Sp
  2844. \&\s-1NOTE:\s0 To see the supported input formats, use \f(CW\*(C`ffmpeg \-demuxers\*(C'\fR.
  2845. .IP "\(bu" 4
  2846. You can extract images from a video, or create a video from many images:
  2847. .Sp
  2848. For extracting images from a video:
  2849. .Sp
  2850. .Vb 1
  2851. \& ffmpeg \-i foo.avi \-r 1 \-s WxH \-f image2 foo\-%03d.jpeg
  2852. .Ve
  2853. .Sp
  2854. This will extract one video frame per second from the video and will
  2855. output them in files named \fIfoo\-001.jpeg\fR, \fIfoo\-002.jpeg\fR,
  2856. etc. Images will be rescaled to fit the new WxH values.
  2857. .Sp
  2858. If you want to extract just a limited number of frames, you can use the
  2859. above command in combination with the \f(CW\*(C`\-frames:v\*(C'\fR or \f(CW\*(C`\-t\*(C'\fR option,
  2860. or in combination with \-ss to start extracting from a certain point in time.
  2861. .Sp
  2862. For creating a video from many images:
  2863. .Sp
  2864. .Vb 1
  2865. \& ffmpeg \-f image2 \-framerate 12 \-i foo\-%03d.jpeg \-s WxH foo.avi
  2866. .Ve
  2867. .Sp
  2868. The syntax \f(CW\*(C`foo\-%03d.jpeg\*(C'\fR specifies to use a decimal number
  2869. composed of three digits padded with zeroes to express the sequence
  2870. number. It is the same syntax supported by the C printf function, but
  2871. only formats accepting a normal integer are suitable.
  2872. .Sp
  2873. When importing an image sequence, \-i also supports expanding
  2874. shell-like wildcard patterns (globbing) internally, by selecting the
  2875. image2\-specific \f(CW\*(C`\-pattern_type glob\*(C'\fR option.
  2876. .Sp
  2877. For example, for creating a video from filenames matching the glob pattern
  2878. \&\f(CW\*(C`foo\-*.jpeg\*(C'\fR:
  2879. .Sp
  2880. .Vb 1
  2881. \& ffmpeg \-f image2 \-pattern_type glob \-framerate 12 \-i \*(Aqfoo\-*.jpeg\*(Aq \-s WxH foo.avi
  2882. .Ve
  2883. .IP "\(bu" 4
  2884. You can put many streams of the same type in the output:
  2885. .Sp
  2886. .Vb 1
  2887. \& ffmpeg \-i test1.avi \-i test2.avi \-map 1:1 \-map 1:0 \-map 0:1 \-map 0:0 \-c copy \-y test12.nut
  2888. .Ve
  2889. .Sp
  2890. The resulting output file \fItest12.nut\fR will contain the first four streams
  2891. from the input files in reverse order.
  2892. .IP "\(bu" 4
  2893. To force \s-1CBR\s0 video output:
  2894. .Sp
  2895. .Vb 1
  2896. \& ffmpeg \-i myfile.avi \-b 4000k \-minrate 4000k \-maxrate 4000k \-bufsize 1835k out.m2v
  2897. .Ve
  2898. .IP "\(bu" 4
  2899. The four options lmin, lmax, mblmin and mblmax use 'lambda' units,
  2900. but you may use the \s-1QP2LAMBDA\s0 constant to easily convert from 'q' units:
  2901. .Sp
  2902. .Vb 1
  2903. \& ffmpeg \-i src.ext \-lmax 21*QP2LAMBDA dst.ext
  2904. .Ve
  2905. .SH "SEE ALSO"
  2906. .IX Header "SEE ALSO"
  2907. \&\fBffmpeg\-all\fR\|(1),
  2908. \&\fBffplay\fR\|(1), \fBffprobe\fR\|(1),
  2909. \&\fBffmpeg\-utils\fR\|(1), \fBffmpeg\-scaler\fR\|(1), \fBffmpeg\-resampler\fR\|(1),
  2910. \&\fBffmpeg\-codecs\fR\|(1), \fBffmpeg\-bitstream\-filters\fR\|(1), \fBffmpeg\-formats\fR\|(1),
  2911. \&\fBffmpeg\-devices\fR\|(1), \fBffmpeg\-protocols\fR\|(1), \fBffmpeg\-filters\fR\|(1)
  2912. .SH "AUTHORS"
  2913. .IX Header "AUTHORS"
  2914. The FFmpeg developers.
  2915. .PP
  2916. For details about the authorship, see the Git history of the project
  2917. (https://git.ffmpeg.org/ffmpeg), e.g. by typing the command
  2918. \&\fBgit log\fR in the FFmpeg source directory, or browsing the
  2919. online repository at <\fBhttps://git.ffmpeg.org/ffmpeg\fR>.
  2920. .PP
  2921. Maintainers for the specific components are listed in the file
  2922. \&\fI\s-1MAINTAINERS\s0\fR in the source code tree.