ffmpeg-formats.html 194 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Created by GNU Texinfo 6.8, https://www.gnu.org/software/texinfo/ -->
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <title>FFmpeg Formats Documentation</title>
  7. <meta name="description" content="FFmpeg Formats Documentation">
  8. <meta name="keywords" content="FFmpeg Formats Documentation">
  9. <meta name="resource-type" content="document">
  10. <meta name="distribution" content="global">
  11. <meta name="Generator" content="makeinfo">
  12. <meta name="viewport" content="width=device-width,initial-scale=1">
  13. <link href="#SEC_Contents" rel="contents" title="Table of Contents">
  14. <style type="text/css">
  15. <!--
  16. a.copiable-anchor {visibility: hidden; text-decoration: none; line-height: 0em}
  17. a.summary-letter {text-decoration: none}
  18. blockquote.indentedblock {margin-right: 0em}
  19. div.display {margin-left: 3.2em}
  20. div.example {margin-left: 3.2em}
  21. kbd {font-style: oblique}
  22. pre.display {font-family: inherit}
  23. pre.format {font-family: inherit}
  24. pre.menu-comment {font-family: serif}
  25. pre.menu-preformatted {font-family: serif}
  26. span.nolinebreak {white-space: nowrap}
  27. span.roman {font-family: initial; font-weight: normal}
  28. span.sansserif {font-family: sans-serif; font-weight: normal}
  29. span:hover a.copiable-anchor {visibility: visible}
  30. ul.no-bullet {list-style: none}
  31. -->
  32. </style>
  33. </head>
  34. <body lang="en">
  35. <h1 class="settitle" align="center">FFmpeg Formats Documentation</h1>
  36. <a name="SEC_Top"></a>
  37. <a name="Description"></a>
  38. <h2 class="chapter">1 Description<span class="pull-right"><a class="anchor hidden-xs" href="#Description" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Description" aria-hidden="true">TOC</a></span></h2>
  39. <p>This document describes the supported formats (muxers and demuxers)
  40. provided by the libavformat library.
  41. </p>
  42. <a name="Format-Options"></a>
  43. <h2 class="chapter">2 Format Options<span class="pull-right"><a class="anchor hidden-xs" href="#Format-Options" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Format-Options" aria-hidden="true">TOC</a></span></h2>
  44. <p>The libavformat library provides some generic global options, which
  45. can be set on all the muxers and demuxers. In addition each muxer or
  46. demuxer may support so-called private options, which are specific for
  47. that component.
  48. </p>
  49. <p>Options may be set by specifying -<var>option</var> <var>value</var> in the
  50. FFmpeg tools, or by setting the value explicitly in the
  51. <code>AVFormatContext</code> options or using the <samp>libavutil/opt.h</samp> API
  52. for programmatic use.
  53. </p>
  54. <p>The list of supported options follows:
  55. </p>
  56. <dl compact="compact">
  57. <dt><span><samp>avioflags <var>flags</var> (<em>input/output</em>)</samp></span></dt>
  58. <dd><p>Possible values:
  59. </p><dl compact="compact">
  60. <dt><span>&lsquo;<samp>direct</samp>&rsquo;</span></dt>
  61. <dd><p>Reduce buffering.
  62. </p></dd>
  63. </dl>
  64. </dd>
  65. <dt><span><samp>probesize <var>integer</var> (<em>input</em>)</samp></span></dt>
  66. <dd><p>Set probing size in bytes, i.e. the size of the data to analyze to get
  67. stream information. A higher value will enable detecting more
  68. information in case it is dispersed into the stream, but will increase
  69. latency. Must be an integer not lesser than 32. It is 5000000 by default.
  70. </p>
  71. </dd>
  72. <dt><span><samp>max_probe_packets <var>integer</var> (<em>input</em>)</samp></span></dt>
  73. <dd><p>Set the maximum number of buffered packets when probing a codec.
  74. Default is 2500 packets.
  75. </p>
  76. </dd>
  77. <dt><span><samp>packetsize <var>integer</var> (<em>output</em>)</samp></span></dt>
  78. <dd><p>Set packet size.
  79. </p>
  80. </dd>
  81. <dt><span><samp>fflags <var>flags</var></samp></span></dt>
  82. <dd><p>Set format flags. Some are implemented for a limited number of formats.
  83. </p>
  84. <p>Possible values for input files:
  85. </p><dl compact="compact">
  86. <dt><span>&lsquo;<samp>discardcorrupt</samp>&rsquo;</span></dt>
  87. <dd><p>Discard corrupted packets.
  88. </p></dd>
  89. <dt><span>&lsquo;<samp>fastseek</samp>&rsquo;</span></dt>
  90. <dd><p>Enable fast, but inaccurate seeks for some formats.
  91. </p></dd>
  92. <dt><span>&lsquo;<samp>genpts</samp>&rsquo;</span></dt>
  93. <dd><p>Generate missing PTS if DTS is present.
  94. </p></dd>
  95. <dt><span>&lsquo;<samp>igndts</samp>&rsquo;</span></dt>
  96. <dd><p>Ignore DTS if PTS is set. Inert when nofillin is set.
  97. </p></dd>
  98. <dt><span>&lsquo;<samp>ignidx</samp>&rsquo;</span></dt>
  99. <dd><p>Ignore index.
  100. </p></dd>
  101. <dt><span>&lsquo;<samp>keepside (<em>deprecated</em>,<em>inert</em>)</samp>&rsquo;</span></dt>
  102. <dt><span>&lsquo;<samp>nobuffer</samp>&rsquo;</span></dt>
  103. <dd><p>Reduce the latency introduced by buffering during initial input streams analysis.
  104. </p></dd>
  105. <dt><span>&lsquo;<samp>nofillin</samp>&rsquo;</span></dt>
  106. <dd><p>Do not fill in missing values in packet fields that can be exactly calculated.
  107. </p></dd>
  108. <dt><span>&lsquo;<samp>noparse</samp>&rsquo;</span></dt>
  109. <dd><p>Disable AVParsers, this needs <code>+nofillin</code> too.
  110. </p></dd>
  111. <dt><span>&lsquo;<samp>sortdts</samp>&rsquo;</span></dt>
  112. <dd><p>Try to interleave output packets by DTS. At present, available only for AVIs with an index.
  113. </p></dd>
  114. </dl>
  115. <p>Possible values for output files:
  116. </p><dl compact="compact">
  117. <dt><span>&lsquo;<samp>autobsf</samp>&rsquo;</span></dt>
  118. <dd><p>Automatically apply bitstream filters as required by the output format. Enabled by default.
  119. </p></dd>
  120. <dt><span>&lsquo;<samp>bitexact</samp>&rsquo;</span></dt>
  121. <dd><p>Only write platform-, build- and time-independent data.
  122. This ensures that file and data checksums are reproducible and match between
  123. platforms. Its primary use is for regression testing.
  124. </p></dd>
  125. <dt><span>&lsquo;<samp>flush_packets</samp>&rsquo;</span></dt>
  126. <dd><p>Write out packets immediately.
  127. </p></dd>
  128. <dt><span>&lsquo;<samp>latm (<em>deprecated</em>,<em>inert</em>)</samp>&rsquo;</span></dt>
  129. <dt><span>&lsquo;<samp>shortest</samp>&rsquo;</span></dt>
  130. <dd><p>Stop muxing at the end of the shortest stream.
  131. It may be needed to increase max_interleave_delta to avoid flushing the longer
  132. streams before EOF.
  133. </p></dd>
  134. </dl>
  135. </dd>
  136. <dt><span><samp>seek2any <var>integer</var> (<em>input</em>)</samp></span></dt>
  137. <dd><p>Allow seeking to non-keyframes on demuxer level when supported if set to 1.
  138. Default is 0.
  139. </p>
  140. </dd>
  141. <dt><span><samp>analyzeduration <var>integer</var> (<em>input</em>)</samp></span></dt>
  142. <dd><p>Specify how many microseconds are analyzed to probe the input. A
  143. higher value will enable detecting more accurate information, but will
  144. increase latency. It defaults to 5,000,000 microseconds = 5 seconds.
  145. </p>
  146. </dd>
  147. <dt><span><samp>cryptokey <var>hexadecimal string</var> (<em>input</em>)</samp></span></dt>
  148. <dd><p>Set decryption key.
  149. </p>
  150. </dd>
  151. <dt><span><samp>indexmem <var>integer</var> (<em>input</em>)</samp></span></dt>
  152. <dd><p>Set max memory used for timestamp index (per stream).
  153. </p>
  154. </dd>
  155. <dt><span><samp>rtbufsize <var>integer</var> (<em>input</em>)</samp></span></dt>
  156. <dd><p>Set max memory used for buffering real-time frames.
  157. </p>
  158. </dd>
  159. <dt><span><samp>fdebug <var>flags</var> (<em>input/output</em>)</samp></span></dt>
  160. <dd><p>Print specific debug info.
  161. </p>
  162. <p>Possible values:
  163. </p><dl compact="compact">
  164. <dt><span>&lsquo;<samp>ts</samp>&rsquo;</span></dt>
  165. </dl>
  166. </dd>
  167. <dt><span><samp>max_delay <var>integer</var> (<em>input/output</em>)</samp></span></dt>
  168. <dd><p>Set maximum muxing or demuxing delay in microseconds.
  169. </p>
  170. </dd>
  171. <dt><span><samp>fpsprobesize <var>integer</var> (<em>input</em>)</samp></span></dt>
  172. <dd><p>Set number of frames used to probe fps.
  173. </p>
  174. </dd>
  175. <dt><span><samp>audio_preload <var>integer</var> (<em>output</em>)</samp></span></dt>
  176. <dd><p>Set microseconds by which audio packets should be interleaved earlier.
  177. </p>
  178. </dd>
  179. <dt><span><samp>chunk_duration <var>integer</var> (<em>output</em>)</samp></span></dt>
  180. <dd><p>Set microseconds for each chunk.
  181. </p>
  182. </dd>
  183. <dt><span><samp>chunk_size <var>integer</var> (<em>output</em>)</samp></span></dt>
  184. <dd><p>Set size in bytes for each chunk.
  185. </p>
  186. </dd>
  187. <dt><span><samp>err_detect, f_err_detect <var>flags</var> (<em>input</em>)</samp></span></dt>
  188. <dd><p>Set error detection flags. <code>f_err_detect</code> is deprecated and
  189. should be used only via the <code>ffmpeg</code> tool.
  190. </p>
  191. <p>Possible values:
  192. </p><dl compact="compact">
  193. <dt><span>&lsquo;<samp>crccheck</samp>&rsquo;</span></dt>
  194. <dd><p>Verify embedded CRCs.
  195. </p></dd>
  196. <dt><span>&lsquo;<samp>bitstream</samp>&rsquo;</span></dt>
  197. <dd><p>Detect bitstream specification deviations.
  198. </p></dd>
  199. <dt><span>&lsquo;<samp>buffer</samp>&rsquo;</span></dt>
  200. <dd><p>Detect improper bitstream length.
  201. </p></dd>
  202. <dt><span>&lsquo;<samp>explode</samp>&rsquo;</span></dt>
  203. <dd><p>Abort decoding on minor error detection.
  204. </p></dd>
  205. <dt><span>&lsquo;<samp>careful</samp>&rsquo;</span></dt>
  206. <dd><p>Consider things that violate the spec and have not been seen in the
  207. wild as errors.
  208. </p></dd>
  209. <dt><span>&lsquo;<samp>compliant</samp>&rsquo;</span></dt>
  210. <dd><p>Consider all spec non compliancies as errors.
  211. </p></dd>
  212. <dt><span>&lsquo;<samp>aggressive</samp>&rsquo;</span></dt>
  213. <dd><p>Consider things that a sane encoder should not do as an error.
  214. </p></dd>
  215. </dl>
  216. </dd>
  217. <dt><span><samp>max_interleave_delta <var>integer</var> (<em>output</em>)</samp></span></dt>
  218. <dd><p>Set maximum buffering duration for interleaving. The duration is
  219. expressed in microseconds, and defaults to 10000000 (10 seconds).
  220. </p>
  221. <p>To ensure all the streams are interleaved correctly, libavformat will
  222. wait until it has at least one packet for each stream before actually
  223. writing any packets to the output file. When some streams are
  224. &quot;sparse&quot; (i.e. there are large gaps between successive packets), this
  225. can result in excessive buffering.
  226. </p>
  227. <p>This field specifies the maximum difference between the timestamps of the
  228. first and the last packet in the muxing queue, above which libavformat
  229. will output a packet regardless of whether it has queued a packet for all
  230. the streams.
  231. </p>
  232. <p>If set to 0, libavformat will continue buffering packets until it has
  233. a packet for each stream, regardless of the maximum timestamp
  234. difference between the buffered packets.
  235. </p>
  236. </dd>
  237. <dt><span><samp>use_wallclock_as_timestamps <var>integer</var> (<em>input</em>)</samp></span></dt>
  238. <dd><p>Use wallclock as timestamps if set to 1. Default is 0.
  239. </p>
  240. </dd>
  241. <dt><span><samp>avoid_negative_ts <var>integer</var> (<em>output</em>)</samp></span></dt>
  242. <dd>
  243. <p>Possible values:
  244. </p><dl compact="compact">
  245. <dt><span>&lsquo;<samp>make_non_negative</samp>&rsquo;</span></dt>
  246. <dd><p>Shift timestamps to make them non-negative.
  247. Also note that this affects only leading negative timestamps, and not
  248. non-monotonic negative timestamps.
  249. </p></dd>
  250. <dt><span>&lsquo;<samp>make_zero</samp>&rsquo;</span></dt>
  251. <dd><p>Shift timestamps so that the first timestamp is 0.
  252. </p></dd>
  253. <dt><span>&lsquo;<samp>auto (default)</samp>&rsquo;</span></dt>
  254. <dd><p>Enables shifting when required by the target format.
  255. </p></dd>
  256. <dt><span>&lsquo;<samp>disabled</samp>&rsquo;</span></dt>
  257. <dd><p>Disables shifting of timestamp.
  258. </p></dd>
  259. </dl>
  260. <p>When shifting is enabled, all output timestamps are shifted by the
  261. same amount. Audio, video, and subtitles desynching and relative
  262. timestamp differences are preserved compared to how they would have
  263. been without shifting.
  264. </p>
  265. </dd>
  266. <dt><span><samp>skip_initial_bytes <var>integer</var> (<em>input</em>)</samp></span></dt>
  267. <dd><p>Set number of bytes to skip before reading header and frames if set to 1.
  268. Default is 0.
  269. </p>
  270. </dd>
  271. <dt><span><samp>correct_ts_overflow <var>integer</var> (<em>input</em>)</samp></span></dt>
  272. <dd><p>Correct single timestamp overflows if set to 1. Default is 1.
  273. </p>
  274. </dd>
  275. <dt><span><samp>flush_packets <var>integer</var> (<em>output</em>)</samp></span></dt>
  276. <dd><p>Flush the underlying I/O stream after each packet. Default is -1 (auto), which
  277. means that the underlying protocol will decide, 1 enables it, and has the
  278. effect of reducing the latency, 0 disables it and may increase IO throughput in
  279. some cases.
  280. </p>
  281. </dd>
  282. <dt><span><samp>output_ts_offset <var>offset</var> (<em>output</em>)</samp></span></dt>
  283. <dd><p>Set the output time offset.
  284. </p>
  285. <p><var>offset</var> must be a time duration specification,
  286. see <a data-manual="ffmpeg-utils" href="ffmpeg-utils.html#time-duration-syntax">(ffmpeg-utils)the Time duration section in the ffmpeg-utils(1) manual</a>.
  287. </p>
  288. <p>The offset is added by the muxer to the output timestamps.
  289. </p>
  290. <p>Specifying a positive offset means that the corresponding streams are
  291. delayed bt the time duration specified in <var>offset</var>. Default value
  292. is <code>0</code> (meaning that no offset is applied).
  293. </p>
  294. </dd>
  295. <dt><span><samp>format_whitelist <var>list</var> (<em>input</em>)</samp></span></dt>
  296. <dd><p>&quot;,&quot; separated list of allowed demuxers. By default all are allowed.
  297. </p>
  298. </dd>
  299. <dt><span><samp>dump_separator <var>string</var> (<em>input</em>)</samp></span></dt>
  300. <dd><p>Separator used to separate the fields printed on the command line about the
  301. Stream parameters.
  302. For example, to separate the fields with newlines and indentation:
  303. </p><div class="example">
  304. <pre class="example">ffprobe -dump_separator &quot;
  305. &quot; -i ~/videos/matrixbench_mpeg2.mpg
  306. </pre></div>
  307. </dd>
  308. <dt><span><samp>max_streams <var>integer</var> (<em>input</em>)</samp></span></dt>
  309. <dd><p>Specifies the maximum number of streams. This can be used to reject files that
  310. would require too many resources due to a large number of streams.
  311. </p>
  312. </dd>
  313. <dt><span><samp>skip_estimate_duration_from_pts <var>bool</var> (<em>input</em>)</samp></span></dt>
  314. <dd><p>Skip estimation of input duration when calculated using PTS.
  315. At present, applicable for MPEG-PS and MPEG-TS.
  316. </p>
  317. </dd>
  318. <dt><span><samp>strict, f_strict <var>integer</var> (<em>input/output</em>)</samp></span></dt>
  319. <dd><p>Specify how strictly to follow the standards. <code>f_strict</code> is deprecated and
  320. should be used only via the <code>ffmpeg</code> tool.
  321. </p>
  322. <p>Possible values:
  323. </p><dl compact="compact">
  324. <dt><span>&lsquo;<samp>very</samp>&rsquo;</span></dt>
  325. <dd><p>strictly conform to an older more strict version of the spec or reference software
  326. </p></dd>
  327. <dt><span>&lsquo;<samp>strict</samp>&rsquo;</span></dt>
  328. <dd><p>strictly conform to all the things in the spec no matter what consequences
  329. </p></dd>
  330. <dt><span>&lsquo;<samp>normal</samp>&rsquo;</span></dt>
  331. <dt><span>&lsquo;<samp>unofficial</samp>&rsquo;</span></dt>
  332. <dd><p>allow unofficial extensions
  333. </p></dd>
  334. <dt><span>&lsquo;<samp>experimental</samp>&rsquo;</span></dt>
  335. <dd><p>allow non standardized experimental things, experimental
  336. (unfinished/work in progress/not well tested) decoders and encoders.
  337. Note: experimental decoders can pose a security risk, do not use this for
  338. decoding untrusted input.
  339. </p></dd>
  340. </dl>
  341. </dd>
  342. </dl>
  343. <span id="Format-stream-specifiers"></span><a name="Format-stream-specifiers-1"></a>
  344. <h3 class="section">2.1 Format stream specifiers<span class="pull-right"><a class="anchor hidden-xs" href="#Format-stream-specifiers-1" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Format-stream-specifiers-1" aria-hidden="true">TOC</a></span></h3>
  345. <p>Format stream specifiers allow selection of one or more streams that
  346. match specific properties.
  347. </p>
  348. <p>The exact semantics of stream specifiers is defined by the
  349. <code>avformat_match_stream_specifier()</code> function declared in the
  350. <samp>libavformat/avformat.h</samp> header and documented in the
  351. <a data-manual="ffmpeg" href="ffmpeg.html#Stream-specifiers">(ffmpeg)Stream specifiers section in the ffmpeg(1) manual</a>.
  352. </p>
  353. <a name="Demuxers"></a>
  354. <h2 class="chapter">3 Demuxers<span class="pull-right"><a class="anchor hidden-xs" href="#Demuxers" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Demuxers" aria-hidden="true">TOC</a></span></h2>
  355. <p>Demuxers are configured elements in FFmpeg that can read the
  356. multimedia streams from a particular type of file.
  357. </p>
  358. <p>When you configure your FFmpeg build, all the supported demuxers
  359. are enabled by default. You can list all available ones using the
  360. configure option <code>--list-demuxers</code>.
  361. </p>
  362. <p>You can disable all the demuxers using the configure option
  363. <code>--disable-demuxers</code>, and selectively enable a single demuxer with
  364. the option <code>--enable-demuxer=<var>DEMUXER</var></code>, or disable it
  365. with the option <code>--disable-demuxer=<var>DEMUXER</var></code>.
  366. </p>
  367. <p>The option <code>-demuxers</code> of the ff* tools will display the list of
  368. enabled demuxers. Use <code>-formats</code> to view a combined list of
  369. enabled demuxers and muxers.
  370. </p>
  371. <p>The description of some of the currently available demuxers follows.
  372. </p>
  373. <a name="aa"></a>
  374. <h3 class="section">3.1 aa<span class="pull-right"><a class="anchor hidden-xs" href="#aa" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-aa" aria-hidden="true">TOC</a></span></h3>
  375. <p>Audible Format 2, 3, and 4 demuxer.
  376. </p>
  377. <p>This demuxer is used to demux Audible Format 2, 3, and 4 (.aa) files.
  378. </p>
  379. <a name="apng"></a>
  380. <h3 class="section">3.2 apng<span class="pull-right"><a class="anchor hidden-xs" href="#apng" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-apng" aria-hidden="true">TOC</a></span></h3>
  381. <p>Animated Portable Network Graphics demuxer.
  382. </p>
  383. <p>This demuxer is used to demux APNG files.
  384. All headers, but the PNG signature, up to (but not including) the first
  385. fcTL chunk are transmitted as extradata.
  386. Frames are then split as being all the chunks between two fcTL ones, or
  387. between the last fcTL and IEND chunks.
  388. </p>
  389. <dl compact="compact">
  390. <dt><span><samp>-ignore_loop <var>bool</var></samp></span></dt>
  391. <dd><p>Ignore the loop variable in the file if set.
  392. </p></dd>
  393. <dt><span><samp>-max_fps <var>int</var></samp></span></dt>
  394. <dd><p>Maximum framerate in frames per second (0 for no limit).
  395. </p></dd>
  396. <dt><span><samp>-default_fps <var>int</var></samp></span></dt>
  397. <dd><p>Default framerate in frames per second when none is specified in the file
  398. (0 meaning as fast as possible).
  399. </p></dd>
  400. </dl>
  401. <a name="asf-1"></a>
  402. <h3 class="section">3.3 asf<span class="pull-right"><a class="anchor hidden-xs" href="#asf-1" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-asf-1" aria-hidden="true">TOC</a></span></h3>
  403. <p>Advanced Systems Format demuxer.
  404. </p>
  405. <p>This demuxer is used to demux ASF files and MMS network streams.
  406. </p>
  407. <dl compact="compact">
  408. <dt><span><samp>-no_resync_search <var>bool</var></samp></span></dt>
  409. <dd><p>Do not try to resynchronize by looking for a certain optional start code.
  410. </p></dd>
  411. </dl>
  412. <span id="concat"></span><a name="concat-1"></a>
  413. <h3 class="section">3.4 concat<span class="pull-right"><a class="anchor hidden-xs" href="#concat-1" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-concat-1" aria-hidden="true">TOC</a></span></h3>
  414. <p>Virtual concatenation script demuxer.
  415. </p>
  416. <p>This demuxer reads a list of files and other directives from a text file and
  417. demuxes them one after the other, as if all their packets had been muxed
  418. together.
  419. </p>
  420. <p>The timestamps in the files are adjusted so that the first file starts at 0
  421. and each next file starts where the previous one finishes. Note that it is
  422. done globally and may cause gaps if all streams do not have exactly the same
  423. length.
  424. </p>
  425. <p>All files must have the same streams (same codecs, same time base, etc.).
  426. </p>
  427. <p>The duration of each file is used to adjust the timestamps of the next file:
  428. if the duration is incorrect (because it was computed using the bit-rate or
  429. because the file is truncated, for example), it can cause artifacts. The
  430. <code>duration</code> directive can be used to override the duration stored in
  431. each file.
  432. </p>
  433. <a name="Syntax"></a>
  434. <h4 class="subsection">3.4.1 Syntax<span class="pull-right"><a class="anchor hidden-xs" href="#Syntax" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Syntax" aria-hidden="true">TOC</a></span></h4>
  435. <p>The script is a text file in extended-ASCII, with one directive per line.
  436. Empty lines, leading spaces and lines starting with &rsquo;#&rsquo; are ignored. The
  437. following directive is recognized:
  438. </p>
  439. <dl compact="compact">
  440. <dt><span><samp><code>file <var>path</var></code></samp></span></dt>
  441. <dd><p>Path to a file to read; special characters and spaces must be escaped with
  442. backslash or single quotes.
  443. </p>
  444. <p>All subsequent file-related directives apply to that file.
  445. </p>
  446. </dd>
  447. <dt><span><samp><code>ffconcat version 1.0</code></samp></span></dt>
  448. <dd><p>Identify the script type and version. It also sets the <samp>safe</samp> option
  449. to 1 if it was -1.
  450. </p>
  451. <p>To make FFmpeg recognize the format automatically, this directive must
  452. appear exactly as is (no extra space or byte-order-mark) on the very first
  453. line of the script.
  454. </p>
  455. </dd>
  456. <dt><span><samp><code>duration <var>dur</var></code></samp></span></dt>
  457. <dd><p>Duration of the file. This information can be specified from the file;
  458. specifying it here may be more efficient or help if the information from the
  459. file is not available or accurate.
  460. </p>
  461. <p>If the duration is set for all files, then it is possible to seek in the
  462. whole concatenated video.
  463. </p>
  464. </dd>
  465. <dt><span><samp><code>inpoint <var>timestamp</var></code></samp></span></dt>
  466. <dd><p>In point of the file. When the demuxer opens the file it instantly seeks to the
  467. specified timestamp. Seeking is done so that all streams can be presented
  468. successfully at In point.
  469. </p>
  470. <p>This directive works best with intra frame codecs, because for non-intra frame
  471. ones you will usually get extra packets before the actual In point and the
  472. decoded content will most likely contain frames before In point too.
  473. </p>
  474. <p>For each file, packets before the file In point will have timestamps less than
  475. the calculated start timestamp of the file (negative in case of the first
  476. file), and the duration of the files (if not specified by the <code>duration</code>
  477. directive) will be reduced based on their specified In point.
  478. </p>
  479. <p>Because of potential packets before the specified In point, packet timestamps
  480. may overlap between two concatenated files.
  481. </p>
  482. </dd>
  483. <dt><span><samp><code>outpoint <var>timestamp</var></code></samp></span></dt>
  484. <dd><p>Out point of the file. When the demuxer reaches the specified decoding
  485. timestamp in any of the streams, it handles it as an end of file condition and
  486. skips the current and all the remaining packets from all streams.
  487. </p>
  488. <p>Out point is exclusive, which means that the demuxer will not output packets
  489. with a decoding timestamp greater or equal to Out point.
  490. </p>
  491. <p>This directive works best with intra frame codecs and formats where all streams
  492. are tightly interleaved. For non-intra frame codecs you will usually get
  493. additional packets with presentation timestamp after Out point therefore the
  494. decoded content will most likely contain frames after Out point too. If your
  495. streams are not tightly interleaved you may not get all the packets from all
  496. streams before Out point and you may only will be able to decode the earliest
  497. stream until Out point.
  498. </p>
  499. <p>The duration of the files (if not specified by the <code>duration</code>
  500. directive) will be reduced based on their specified Out point.
  501. </p>
  502. </dd>
  503. <dt><span><samp><code>file_packet_metadata <var>key=value</var></code></samp></span></dt>
  504. <dd><p>Metadata of the packets of the file. The specified metadata will be set for
  505. each file packet. You can specify this directive multiple times to add multiple
  506. metadata entries.
  507. </p>
  508. </dd>
  509. <dt><span><samp><code>stream</code></samp></span></dt>
  510. <dd><p>Introduce a stream in the virtual file.
  511. All subsequent stream-related directives apply to the last introduced
  512. stream.
  513. Some streams properties must be set in order to allow identifying the
  514. matching streams in the subfiles.
  515. If no streams are defined in the script, the streams from the first file are
  516. copied.
  517. </p>
  518. </dd>
  519. <dt><span><samp><code>exact_stream_id <var>id</var></code></samp></span></dt>
  520. <dd><p>Set the id of the stream.
  521. If this directive is given, the string with the corresponding id in the
  522. subfiles will be used.
  523. This is especially useful for MPEG-PS (VOB) files, where the order of the
  524. streams is not reliable.
  525. </p>
  526. </dd>
  527. </dl>
  528. <a name="Options"></a>
  529. <h4 class="subsection">3.4.2 Options<span class="pull-right"><a class="anchor hidden-xs" href="#Options" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Options" aria-hidden="true">TOC</a></span></h4>
  530. <p>This demuxer accepts the following option:
  531. </p>
  532. <dl compact="compact">
  533. <dt><span><samp>safe</samp></span></dt>
  534. <dd><p>If set to 1, reject unsafe file paths. A file path is considered safe if it
  535. does not contain a protocol specification and is relative and all components
  536. only contain characters from the portable character set (letters, digits,
  537. period, underscore and hyphen) and have no period at the beginning of a
  538. component.
  539. </p>
  540. <p>If set to 0, any file name is accepted.
  541. </p>
  542. <p>The default is 1.
  543. </p>
  544. <p>-1 is equivalent to 1 if the format was automatically
  545. probed and 0 otherwise.
  546. </p>
  547. </dd>
  548. <dt><span><samp>auto_convert</samp></span></dt>
  549. <dd><p>If set to 1, try to perform automatic conversions on packet data to make the
  550. streams concatenable.
  551. The default is 1.
  552. </p>
  553. <p>Currently, the only conversion is adding the h264_mp4toannexb bitstream
  554. filter to H.264 streams in MP4 format. This is necessary in particular if
  555. there are resolution changes.
  556. </p>
  557. </dd>
  558. <dt><span><samp>segment_time_metadata</samp></span></dt>
  559. <dd><p>If set to 1, every packet will contain the <var>lavf.concat.start_time</var> and the
  560. <var>lavf.concat.duration</var> packet metadata values which are the start_time and
  561. the duration of the respective file segments in the concatenated output
  562. expressed in microseconds. The duration metadata is only set if it is known
  563. based on the concat file.
  564. The default is 0.
  565. </p>
  566. </dd>
  567. </dl>
  568. <a name="Examples"></a>
  569. <h4 class="subsection">3.4.3 Examples<span class="pull-right"><a class="anchor hidden-xs" href="#Examples" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Examples" aria-hidden="true">TOC</a></span></h4>
  570. <ul>
  571. <li> Use absolute filenames and include some comments:
  572. <div class="example">
  573. <pre class="example"># my first filename
  574. file /mnt/share/file-1.wav
  575. # my second filename including whitespace
  576. file '/mnt/share/file 2.wav'
  577. # my third filename including whitespace plus single quote
  578. file '/mnt/share/file 3'\''.wav'
  579. </pre></div>
  580. </li><li> Allow for input format auto-probing, use safe filenames and set the duration of
  581. the first file:
  582. <div class="example">
  583. <pre class="example">ffconcat version 1.0
  584. file file-1.wav
  585. duration 20.0
  586. file subdir/file-2.wav
  587. </pre></div>
  588. </li></ul>
  589. <a name="dash-1"></a>
  590. <h3 class="section">3.5 dash<span class="pull-right"><a class="anchor hidden-xs" href="#dash-1" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-dash-1" aria-hidden="true">TOC</a></span></h3>
  591. <p>Dynamic Adaptive Streaming over HTTP demuxer.
  592. </p>
  593. <p>This demuxer presents all AVStreams found in the manifest.
  594. By setting the discard flags on AVStreams the caller can decide
  595. which streams to actually receive.
  596. Each stream mirrors the <code>id</code> and <code>bandwidth</code> properties from the
  597. <code>&lt;Representation&gt;</code> as metadata keys named &quot;id&quot; and &quot;variant_bitrate&quot; respectively.
  598. </p>
  599. <a name="flv_002c-live_005fflv"></a>
  600. <h3 class="section">3.6 flv, live_flv<span class="pull-right"><a class="anchor hidden-xs" href="#flv_002c-live_005fflv" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-flv_002c-live_005fflv" aria-hidden="true">TOC</a></span></h3>
  601. <p>Adobe Flash Video Format demuxer.
  602. </p>
  603. <p>This demuxer is used to demux FLV files and RTMP network streams. In case of live network streams, if you force format, you may use live_flv option instead of flv to survive timestamp discontinuities.
  604. </p>
  605. <div class="example">
  606. <pre class="example">ffmpeg -f flv -i myfile.flv ...
  607. ffmpeg -f live_flv -i rtmp://&lt;any.server&gt;/anything/key ....
  608. </pre></div>
  609. <dl compact="compact">
  610. <dt><span><samp>-flv_metadata <var>bool</var></samp></span></dt>
  611. <dd><p>Allocate the streams according to the onMetaData array content.
  612. </p>
  613. </dd>
  614. <dt><span><samp>-flv_ignore_prevtag <var>bool</var></samp></span></dt>
  615. <dd><p>Ignore the size of previous tag value.
  616. </p>
  617. </dd>
  618. <dt><span><samp>-flv_full_metadata <var>bool</var></samp></span></dt>
  619. <dd><p>Output all context of the onMetadata.
  620. </p></dd>
  621. </dl>
  622. <a name="gif-1"></a>
  623. <h3 class="section">3.7 gif<span class="pull-right"><a class="anchor hidden-xs" href="#gif-1" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-gif-1" aria-hidden="true">TOC</a></span></h3>
  624. <p>Animated GIF demuxer.
  625. </p>
  626. <p>It accepts the following options:
  627. </p>
  628. <dl compact="compact">
  629. <dt><span><samp>min_delay</samp></span></dt>
  630. <dd><p>Set the minimum valid delay between frames in hundredths of seconds.
  631. Range is 0 to 6000. Default value is 2.
  632. </p>
  633. </dd>
  634. <dt><span><samp>max_gif_delay</samp></span></dt>
  635. <dd><p>Set the maximum valid delay between frames in hundredth of seconds.
  636. Range is 0 to 65535. Default value is 65535 (nearly eleven minutes),
  637. the maximum value allowed by the specification.
  638. </p>
  639. </dd>
  640. <dt><span><samp>default_delay</samp></span></dt>
  641. <dd><p>Set the default delay between frames in hundredths of seconds.
  642. Range is 0 to 6000. Default value is 10.
  643. </p>
  644. </dd>
  645. <dt><span><samp>ignore_loop</samp></span></dt>
  646. <dd><p>GIF files can contain information to loop a certain number of times (or
  647. infinitely). If <samp>ignore_loop</samp> is set to 1, then the loop setting
  648. from the input will be ignored and looping will not occur. If set to 0,
  649. then looping will occur and will cycle the number of times according to
  650. the GIF. Default value is 1.
  651. </p></dd>
  652. </dl>
  653. <p>For example, with the overlay filter, place an infinitely looping GIF
  654. over another video:
  655. </p><div class="example">
  656. <pre class="example">ffmpeg -i input.mp4 -ignore_loop 0 -i input.gif -filter_complex overlay=shortest=1 out.mkv
  657. </pre></div>
  658. <p>Note that in the above example the shortest option for overlay filter is
  659. used to end the output video at the length of the shortest input file,
  660. which in this case is <samp>input.mp4</samp> as the GIF in this example loops
  661. infinitely.
  662. </p>
  663. <a name="hls-1"></a>
  664. <h3 class="section">3.8 hls<span class="pull-right"><a class="anchor hidden-xs" href="#hls-1" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-hls-1" aria-hidden="true">TOC</a></span></h3>
  665. <p>HLS demuxer
  666. </p>
  667. <p>Apple HTTP Live Streaming demuxer.
  668. </p>
  669. <p>This demuxer presents all AVStreams from all variant streams.
  670. The id field is set to the bitrate variant index number. By setting
  671. the discard flags on AVStreams (by pressing &rsquo;a&rsquo; or &rsquo;v&rsquo; in ffplay),
  672. the caller can decide which variant streams to actually receive.
  673. The total bitrate of the variant that the stream belongs to is
  674. available in a metadata key named &quot;variant_bitrate&quot;.
  675. </p>
  676. <p>It accepts the following options:
  677. </p>
  678. <dl compact="compact">
  679. <dt><span><samp>live_start_index</samp></span></dt>
  680. <dd><p>segment index to start live streams at (negative values are from the end).
  681. </p>
  682. </dd>
  683. <dt><span><samp>allowed_extensions</samp></span></dt>
  684. <dd><p>&rsquo;,&rsquo; separated list of file extensions that hls is allowed to access.
  685. </p>
  686. </dd>
  687. <dt><span><samp>max_reload</samp></span></dt>
  688. <dd><p>Maximum number of times a insufficient list is attempted to be reloaded.
  689. Default value is 1000.
  690. </p>
  691. </dd>
  692. <dt><span><samp>m3u8_hold_counters</samp></span></dt>
  693. <dd><p>The maximum number of times to load m3u8 when it refreshes without new segments.
  694. Default value is 1000.
  695. </p>
  696. </dd>
  697. <dt><span><samp>http_persistent</samp></span></dt>
  698. <dd><p>Use persistent HTTP connections. Applicable only for HTTP streams.
  699. Enabled by default.
  700. </p>
  701. </dd>
  702. <dt><span><samp>http_multiple</samp></span></dt>
  703. <dd><p>Use multiple HTTP connections for downloading HTTP segments.
  704. Enabled by default for HTTP/1.1 servers.
  705. </p>
  706. </dd>
  707. <dt><span><samp>http_seekable</samp></span></dt>
  708. <dd><p>Use HTTP partial requests for downloading HTTP segments.
  709. 0 = disable, 1 = enable, -1 = auto, Default is auto.
  710. </p></dd>
  711. </dl>
  712. <a name="image2-1"></a>
  713. <h3 class="section">3.9 image2<span class="pull-right"><a class="anchor hidden-xs" href="#image2-1" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-image2-1" aria-hidden="true">TOC</a></span></h3>
  714. <p>Image file demuxer.
  715. </p>
  716. <p>This demuxer reads from a list of image files specified by a pattern.
  717. The syntax and meaning of the pattern is specified by the
  718. option <var>pattern_type</var>.
  719. </p>
  720. <p>The pattern may contain a suffix which is used to automatically
  721. determine the format of the images contained in the files.
  722. </p>
  723. <p>The size, the pixel format, and the format of each image must be the
  724. same for all the files in the sequence.
  725. </p>
  726. <p>This demuxer accepts the following options:
  727. </p><dl compact="compact">
  728. <dt><span><samp>framerate</samp></span></dt>
  729. <dd><p>Set the frame rate for the video stream. It defaults to 25.
  730. </p></dd>
  731. <dt><span><samp>loop</samp></span></dt>
  732. <dd><p>If set to 1, loop over the input. Default value is 0.
  733. </p></dd>
  734. <dt><span><samp>pattern_type</samp></span></dt>
  735. <dd><p>Select the pattern type used to interpret the provided filename.
  736. </p>
  737. <p><var>pattern_type</var> accepts one of the following values.
  738. </p><dl compact="compact">
  739. <dt><span><samp>none</samp></span></dt>
  740. <dd><p>Disable pattern matching, therefore the video will only contain the specified
  741. image. You should use this option if you do not want to create sequences from
  742. multiple images and your filenames may contain special pattern characters.
  743. </p></dd>
  744. <dt><span><samp>sequence</samp></span></dt>
  745. <dd><p>Select a sequence pattern type, used to specify a sequence of files
  746. indexed by sequential numbers.
  747. </p>
  748. <p>A sequence pattern may contain the string &quot;%d&quot; or &quot;%0<var>N</var>d&quot;, which
  749. specifies the position of the characters representing a sequential
  750. number in each filename matched by the pattern. If the form
  751. &quot;%d0<var>N</var>d&quot; is used, the string representing the number in each
  752. filename is 0-padded and <var>N</var> is the total number of 0-padded
  753. digits representing the number. The literal character &rsquo;%&rsquo; can be
  754. specified in the pattern with the string &quot;%%&quot;.
  755. </p>
  756. <p>If the sequence pattern contains &quot;%d&quot; or &quot;%0<var>N</var>d&quot;, the first filename of
  757. the file list specified by the pattern must contain a number
  758. inclusively contained between <var>start_number</var> and
  759. <var>start_number</var>+<var>start_number_range</var>-1, and all the following
  760. numbers must be sequential.
  761. </p>
  762. <p>For example the pattern &quot;img-%03d.bmp&quot; will match a sequence of
  763. filenames of the form <samp>img-001.bmp</samp>, <samp>img-002.bmp</samp>, ...,
  764. <samp>img-010.bmp</samp>, etc.; the pattern &quot;i%%m%%g-%d.jpg&quot; will match a
  765. sequence of filenames of the form <samp>i%m%g-1.jpg</samp>,
  766. <samp>i%m%g-2.jpg</samp>, ..., <samp>i%m%g-10.jpg</samp>, etc.
  767. </p>
  768. <p>Note that the pattern must not necessarily contain &quot;%d&quot; or
  769. &quot;%0<var>N</var>d&quot;, for example to convert a single image file
  770. <samp>img.jpeg</samp> you can employ the command:
  771. </p><div class="example">
  772. <pre class="example">ffmpeg -i img.jpeg img.png
  773. </pre></div>
  774. </dd>
  775. <dt><span><samp>glob</samp></span></dt>
  776. <dd><p>Select a glob wildcard pattern type.
  777. </p>
  778. <p>The pattern is interpreted like a <code>glob()</code> pattern. This is only
  779. selectable if libavformat was compiled with globbing support.
  780. </p>
  781. </dd>
  782. <dt><span><samp>glob_sequence <em>(deprecated, will be removed)</em></samp></span></dt>
  783. <dd><p>Select a mixed glob wildcard/sequence pattern.
  784. </p>
  785. <p>If your version of libavformat was compiled with globbing support, and
  786. the provided pattern contains at least one glob meta character among
  787. <code>%*?[]{}</code> that is preceded by an unescaped &quot;%&quot;, the pattern is
  788. interpreted like a <code>glob()</code> pattern, otherwise it is interpreted
  789. like a sequence pattern.
  790. </p>
  791. <p>All glob special characters <code>%*?[]{}</code> must be prefixed
  792. with &quot;%&quot;. To escape a literal &quot;%&quot; you shall use &quot;%%&quot;.
  793. </p>
  794. <p>For example the pattern <code>foo-%*.jpeg</code> will match all the
  795. filenames prefixed by &quot;foo-&quot; and terminating with &quot;.jpeg&quot;, and
  796. <code>foo-%?%?%?.jpeg</code> will match all the filenames prefixed with
  797. &quot;foo-&quot;, followed by a sequence of three characters, and terminating
  798. with &quot;.jpeg&quot;.
  799. </p>
  800. <p>This pattern type is deprecated in favor of <var>glob</var> and
  801. <var>sequence</var>.
  802. </p></dd>
  803. </dl>
  804. <p>Default value is <var>glob_sequence</var>.
  805. </p></dd>
  806. <dt><span><samp>pixel_format</samp></span></dt>
  807. <dd><p>Set the pixel format of the images to read. If not specified the pixel
  808. format is guessed from the first image file in the sequence.
  809. </p></dd>
  810. <dt><span><samp>start_number</samp></span></dt>
  811. <dd><p>Set the index of the file matched by the image file pattern to start
  812. to read from. Default value is 0.
  813. </p></dd>
  814. <dt><span><samp>start_number_range</samp></span></dt>
  815. <dd><p>Set the index interval range to check when looking for the first image
  816. file in the sequence, starting from <var>start_number</var>. Default value
  817. is 5.
  818. </p></dd>
  819. <dt><span><samp>ts_from_file</samp></span></dt>
  820. <dd><p>If set to 1, will set frame timestamp to modification time of image file. Note
  821. that monotonity of timestamps is not provided: images go in the same order as
  822. without this option. Default value is 0.
  823. If set to 2, will set frame timestamp to the modification time of the image file in
  824. nanosecond precision.
  825. </p></dd>
  826. <dt><span><samp>video_size</samp></span></dt>
  827. <dd><p>Set the video size of the images to read. If not specified the video
  828. size is guessed from the first image file in the sequence.
  829. </p></dd>
  830. <dt><span><samp>export_path_metadata</samp></span></dt>
  831. <dd><p>If set to 1, will add two extra fields to the metadata found in input, making them
  832. also available for other filters (see <var>drawtext</var> filter for examples). Default
  833. value is 0. The extra fields are described below:
  834. </p><dl compact="compact">
  835. <dt><span><samp>lavf.image2dec.source_path</samp></span></dt>
  836. <dd><p>Corresponds to the full path to the input file being read.
  837. </p></dd>
  838. <dt><span><samp>lavf.image2dec.source_basename</samp></span></dt>
  839. <dd><p>Corresponds to the name of the file being read.
  840. </p></dd>
  841. </dl>
  842. </dd>
  843. </dl>
  844. <a name="Examples-1"></a>
  845. <h4 class="subsection">3.9.1 Examples<span class="pull-right"><a class="anchor hidden-xs" href="#Examples-1" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Examples-1" aria-hidden="true">TOC</a></span></h4>
  846. <ul>
  847. <li> Use <code>ffmpeg</code> for creating a video from the images in the file
  848. sequence <samp>img-001.jpeg</samp>, <samp>img-002.jpeg</samp>, ..., assuming an
  849. input frame rate of 10 frames per second:
  850. <div class="example">
  851. <pre class="example">ffmpeg -framerate 10 -i 'img-%03d.jpeg' out.mkv
  852. </pre></div>
  853. </li><li> As above, but start by reading from a file with index 100 in the sequence:
  854. <div class="example">
  855. <pre class="example">ffmpeg -framerate 10 -start_number 100 -i 'img-%03d.jpeg' out.mkv
  856. </pre></div>
  857. </li><li> Read images matching the &quot;*.png&quot; glob pattern , that is all the files
  858. terminating with the &quot;.png&quot; suffix:
  859. <div class="example">
  860. <pre class="example">ffmpeg -framerate 10 -pattern_type glob -i &quot;*.png&quot; out.mkv
  861. </pre></div>
  862. </li></ul>
  863. <a name="libgme"></a>
  864. <h3 class="section">3.10 libgme<span class="pull-right"><a class="anchor hidden-xs" href="#libgme" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-libgme" aria-hidden="true">TOC</a></span></h3>
  865. <p>The Game Music Emu library is a collection of video game music file emulators.
  866. </p>
  867. <p>See <a href="https://bitbucket.org/mpyne/game-music-emu/overview">https://bitbucket.org/mpyne/game-music-emu/overview</a> for more information.
  868. </p>
  869. <p>It accepts the following options:
  870. </p>
  871. <dl compact="compact">
  872. <dt><span><samp>track_index</samp></span></dt>
  873. <dd><p>Set the index of which track to demux. The demuxer can only export one track.
  874. Track indexes start at 0. Default is to pick the first track. Number of tracks
  875. is exported as <var>tracks</var> metadata entry.
  876. </p>
  877. </dd>
  878. <dt><span><samp>sample_rate</samp></span></dt>
  879. <dd><p>Set the sampling rate of the exported track. Range is 1000 to 999999. Default is 44100.
  880. </p>
  881. </dd>
  882. <dt><span><samp>max_size <em>(bytes)</em></samp></span></dt>
  883. <dd><p>The demuxer buffers the entire file into memory. Adjust this value to set the maximum buffer size,
  884. which in turn, acts as a ceiling for the size of files that can be read.
  885. Default is 50 MiB.
  886. </p>
  887. </dd>
  888. </dl>
  889. <a name="libmodplug"></a>
  890. <h3 class="section">3.11 libmodplug<span class="pull-right"><a class="anchor hidden-xs" href="#libmodplug" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-libmodplug" aria-hidden="true">TOC</a></span></h3>
  891. <p>ModPlug based module demuxer
  892. </p>
  893. <p>See <a href="https://github.com/Konstanty/libmodplug">https://github.com/Konstanty/libmodplug</a>
  894. </p>
  895. <p>It will export one 2-channel 16-bit 44.1 kHz audio stream.
  896. Optionally, a <code>pal8</code> 16-color video stream can be exported with or without printed metadata.
  897. </p>
  898. <p>It accepts the following options:
  899. </p>
  900. <dl compact="compact">
  901. <dt><span><samp>noise_reduction</samp></span></dt>
  902. <dd><p>Apply a simple low-pass filter. Can be 1 (on) or 0 (off). Default is 0.
  903. </p>
  904. </dd>
  905. <dt><span><samp>reverb_depth</samp></span></dt>
  906. <dd><p>Set amount of reverb. Range 0-100. Default is 0.
  907. </p>
  908. </dd>
  909. <dt><span><samp>reverb_delay</samp></span></dt>
  910. <dd><p>Set delay in ms, clamped to 40-250 ms. Default is 0.
  911. </p>
  912. </dd>
  913. <dt><span><samp>bass_amount</samp></span></dt>
  914. <dd><p>Apply bass expansion a.k.a. XBass or megabass. Range is 0 (quiet) to 100 (loud). Default is 0.
  915. </p>
  916. </dd>
  917. <dt><span><samp>bass_range</samp></span></dt>
  918. <dd><p>Set cutoff i.e. upper-bound for bass frequencies. Range is 10-100 Hz. Default is 0.
  919. </p>
  920. </dd>
  921. <dt><span><samp>surround_depth</samp></span></dt>
  922. <dd><p>Apply a Dolby Pro-Logic surround effect. Range is 0 (quiet) to 100 (heavy). Default is 0.
  923. </p>
  924. </dd>
  925. <dt><span><samp>surround_delay</samp></span></dt>
  926. <dd><p>Set surround delay in ms, clamped to 5-40 ms. Default is 0.
  927. </p>
  928. </dd>
  929. <dt><span><samp>max_size</samp></span></dt>
  930. <dd><p>The demuxer buffers the entire file into memory. Adjust this value to set the maximum buffer size,
  931. which in turn, acts as a ceiling for the size of files that can be read. Range is 0 to 100 MiB.
  932. 0 removes buffer size limit (not recommended). Default is 5 MiB.
  933. </p>
  934. </dd>
  935. <dt><span><samp>video_stream_expr</samp></span></dt>
  936. <dd><p>String which is evaluated using the eval API to assign colors to the generated video stream.
  937. Variables which can be used are <code>x</code>, <code>y</code>, <code>w</code>, <code>h</code>, <code>t</code>, <code>speed</code>,
  938. <code>tempo</code>, <code>order</code>, <code>pattern</code> and <code>row</code>.
  939. </p>
  940. </dd>
  941. <dt><span><samp>video_stream</samp></span></dt>
  942. <dd><p>Generate video stream. Can be 1 (on) or 0 (off). Default is 0.
  943. </p>
  944. </dd>
  945. <dt><span><samp>video_stream_w</samp></span></dt>
  946. <dd><p>Set video frame width in &rsquo;chars&rsquo; where one char indicates 8 pixels. Range is 20-512. Default is 30.
  947. </p>
  948. </dd>
  949. <dt><span><samp>video_stream_h</samp></span></dt>
  950. <dd><p>Set video frame height in &rsquo;chars&rsquo; where one char indicates 8 pixels. Range is 20-512. Default is 30.
  951. </p>
  952. </dd>
  953. <dt><span><samp>video_stream_ptxt</samp></span></dt>
  954. <dd><p>Print metadata on video stream. Includes <code>speed</code>, <code>tempo</code>, <code>order</code>, <code>pattern</code>,
  955. <code>row</code> and <code>ts</code> (time in ms). Can be 1 (on) or 0 (off). Default is 1.
  956. </p>
  957. </dd>
  958. </dl>
  959. <a name="libopenmpt"></a>
  960. <h3 class="section">3.12 libopenmpt<span class="pull-right"><a class="anchor hidden-xs" href="#libopenmpt" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-libopenmpt" aria-hidden="true">TOC</a></span></h3>
  961. <p>libopenmpt based module demuxer
  962. </p>
  963. <p>See <a href="https://lib.openmpt.org/libopenmpt/">https://lib.openmpt.org/libopenmpt/</a> for more information.
  964. </p>
  965. <p>Some files have multiple subsongs (tracks) this can be set with the <samp>subsong</samp>
  966. option.
  967. </p>
  968. <p>It accepts the following options:
  969. </p>
  970. <dl compact="compact">
  971. <dt><span><samp>subsong</samp></span></dt>
  972. <dd><p>Set the subsong index. This can be either &rsquo;all&rsquo;, &rsquo;auto&rsquo;, or the index of the
  973. subsong. Subsong indexes start at 0. The default is &rsquo;auto&rsquo;.
  974. </p>
  975. <p>The default value is to let libopenmpt choose.
  976. </p>
  977. </dd>
  978. <dt><span><samp>layout</samp></span></dt>
  979. <dd><p>Set the channel layout. Valid values are 1, 2, and 4 channel layouts.
  980. The default value is STEREO.
  981. </p>
  982. </dd>
  983. <dt><span><samp>sample_rate</samp></span></dt>
  984. <dd><p>Set the sample rate for libopenmpt to output.
  985. Range is from 1000 to INT_MAX. The value default is 48000.
  986. </p></dd>
  987. </dl>
  988. <a name="mov_002fmp4_002f3gp"></a>
  989. <h3 class="section">3.13 mov/mp4/3gp<span class="pull-right"><a class="anchor hidden-xs" href="#mov_002fmp4_002f3gp" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-mov_002fmp4_002f3gp" aria-hidden="true">TOC</a></span></h3>
  990. <p>Demuxer for Quicktime File Format &amp; ISO/IEC Base Media File Format (ISO/IEC 14496-12 or MPEG-4 Part 12, ISO/IEC 15444-12 or JPEG 2000 Part 12).
  991. </p>
  992. <p>Registered extensions: mov, mp4, m4a, 3gp, 3g2, mj2, psp, m4b, ism, ismv, isma, f4v
  993. </p>
  994. <a name="Options-1"></a>
  995. <h4 class="subsection">3.13.1 Options<span class="pull-right"><a class="anchor hidden-xs" href="#Options-1" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Options-1" aria-hidden="true">TOC</a></span></h4>
  996. <p>This demuxer accepts the following options:
  997. </p><dl compact="compact">
  998. <dt><span><samp>enable_drefs</samp></span></dt>
  999. <dd><p>Enable loading of external tracks, disabled by default.
  1000. Enabling this can theoretically leak information in some use cases.
  1001. </p>
  1002. </dd>
  1003. <dt><span><samp>use_absolute_path</samp></span></dt>
  1004. <dd><p>Allows loading of external tracks via absolute paths, disabled by default.
  1005. Enabling this poses a security risk. It should only be enabled if the source
  1006. is known to be non-malicious.
  1007. </p>
  1008. </dd>
  1009. <dt><span><samp>seek_streams_individually</samp></span></dt>
  1010. <dd><p>When seeking, identify the closest point in each stream individually and demux packets in
  1011. that stream from identified point. This can lead to a different sequence of packets compared
  1012. to demuxing linearly from the beginning. Default is true.
  1013. </p>
  1014. </dd>
  1015. <dt><span><samp>ignore_editlist</samp></span></dt>
  1016. <dd><p>Ignore any edit list atoms. The demuxer, by default, modifies the stream index to reflect the
  1017. timeline described by the edit list. Default is false.
  1018. </p>
  1019. </dd>
  1020. <dt><span><samp>advanced_editlist</samp></span></dt>
  1021. <dd><p>Modify the stream index to reflect the timeline described by the edit list. <code>ignore_editlist</code>
  1022. must be set to false for this option to be effective.
  1023. If both <code>ignore_editlist</code> and this option are set to false, then only the
  1024. start of the stream index is modified to reflect initial dwell time or starting timestamp
  1025. described by the edit list. Default is true.
  1026. </p>
  1027. </dd>
  1028. <dt><span><samp>ignore_chapters</samp></span></dt>
  1029. <dd><p>Don&rsquo;t parse chapters. This includes GoPro &rsquo;HiLight&rsquo; tags/moments. Note that chapters are
  1030. only parsed when input is seekable. Default is false.
  1031. </p>
  1032. </dd>
  1033. <dt><span><samp>use_mfra_for</samp></span></dt>
  1034. <dd><p>For seekable fragmented input, set fragment&rsquo;s starting timestamp from media fragment random access box, if present.
  1035. </p>
  1036. <p>Following options are available:
  1037. </p><dl compact="compact">
  1038. <dt><span>&lsquo;<samp>auto</samp>&rsquo;</span></dt>
  1039. <dd><p>Auto-detect whether to set mfra timestamps as PTS or DTS <em>(default)</em>
  1040. </p>
  1041. </dd>
  1042. <dt><span>&lsquo;<samp>dts</samp>&rsquo;</span></dt>
  1043. <dd><p>Set mfra timestamps as DTS
  1044. </p>
  1045. </dd>
  1046. <dt><span>&lsquo;<samp>pts</samp>&rsquo;</span></dt>
  1047. <dd><p>Set mfra timestamps as PTS
  1048. </p>
  1049. </dd>
  1050. <dt><span>&lsquo;<samp>0</samp>&rsquo;</span></dt>
  1051. <dd><p>Don&rsquo;t use mfra box to set timestamps
  1052. </p></dd>
  1053. </dl>
  1054. </dd>
  1055. <dt><span><samp>export_all</samp></span></dt>
  1056. <dd><p>Export unrecognized boxes within the <var>udta</var> box as metadata entries. The first four
  1057. characters of the box type are set as the key. Default is false.
  1058. </p>
  1059. </dd>
  1060. <dt><span><samp>export_xmp</samp></span></dt>
  1061. <dd><p>Export entire contents of <var>XMP_</var> box and <var>uuid</var> box as a string with key <code>xmp</code>. Note that
  1062. if <code>export_all</code> is set and this option isn&rsquo;t, the contents of <var>XMP_</var> box are still exported
  1063. but with key <code>XMP_</code>. Default is false.
  1064. </p>
  1065. </dd>
  1066. <dt><span><samp>activation_bytes</samp></span></dt>
  1067. <dd><p>4-byte key required to decrypt Audible AAX and AAX+ files. See Audible AAX subsection below.
  1068. </p>
  1069. </dd>
  1070. <dt><span><samp>audible_fixed_key</samp></span></dt>
  1071. <dd><p>Fixed key used for handling Audible AAX/AAX+ files. It has been pre-set so should not be necessary to
  1072. specify.
  1073. </p>
  1074. </dd>
  1075. <dt><span><samp>decryption_key</samp></span></dt>
  1076. <dd><p>16-byte key, in hex, to decrypt files encrypted using ISO Common Encryption (CENC/AES-128 CTR; ISO/IEC 23001-7).
  1077. </p></dd>
  1078. </dl>
  1079. <a name="Audible-AAX"></a>
  1080. <h4 class="subsection">3.13.2 Audible AAX<span class="pull-right"><a class="anchor hidden-xs" href="#Audible-AAX" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Audible-AAX" aria-hidden="true">TOC</a></span></h4>
  1081. <p>Audible AAX files are encrypted M4B files, and they can be decrypted by specifying a 4 byte activation secret.
  1082. </p><div class="example">
  1083. <pre class="example">ffmpeg -activation_bytes 1CEB00DA -i test.aax -vn -c:a copy output.mp4
  1084. </pre></div>
  1085. <a name="mpegts"></a>
  1086. <h3 class="section">3.14 mpegts<span class="pull-right"><a class="anchor hidden-xs" href="#mpegts" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-mpegts" aria-hidden="true">TOC</a></span></h3>
  1087. <p>MPEG-2 transport stream demuxer.
  1088. </p>
  1089. <p>This demuxer accepts the following options:
  1090. </p><dl compact="compact">
  1091. <dt><span><samp>resync_size</samp></span></dt>
  1092. <dd><p>Set size limit for looking up a new synchronization. Default value is
  1093. 65536.
  1094. </p>
  1095. </dd>
  1096. <dt><span><samp>skip_unknown_pmt</samp></span></dt>
  1097. <dd><p>Skip PMTs for programs not defined in the PAT. Default value is 0.
  1098. </p>
  1099. </dd>
  1100. <dt><span><samp>fix_teletext_pts</samp></span></dt>
  1101. <dd><p>Override teletext packet PTS and DTS values with the timestamps calculated
  1102. from the PCR of the first program which the teletext stream is part of and is
  1103. not discarded. Default value is 1, set this option to 0 if you want your
  1104. teletext packet PTS and DTS values untouched.
  1105. </p>
  1106. </dd>
  1107. <dt><span><samp>ts_packetsize</samp></span></dt>
  1108. <dd><p>Output option carrying the raw packet size in bytes.
  1109. Show the detected raw packet size, cannot be set by the user.
  1110. </p>
  1111. </dd>
  1112. <dt><span><samp>scan_all_pmts</samp></span></dt>
  1113. <dd><p>Scan and combine all PMTs. The value is an integer with value from -1
  1114. to 1 (-1 means automatic setting, 1 means enabled, 0 means
  1115. disabled). Default value is -1.
  1116. </p>
  1117. </dd>
  1118. <dt><span><samp>merge_pmt_versions</samp></span></dt>
  1119. <dd><p>Re-use existing streams when a PMT&rsquo;s version is updated and elementary
  1120. streams move to different PIDs. Default value is 0.
  1121. </p></dd>
  1122. </dl>
  1123. <a name="mpjpeg"></a>
  1124. <h3 class="section">3.15 mpjpeg<span class="pull-right"><a class="anchor hidden-xs" href="#mpjpeg" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-mpjpeg" aria-hidden="true">TOC</a></span></h3>
  1125. <p>MJPEG encapsulated in multi-part MIME demuxer.
  1126. </p>
  1127. <p>This demuxer allows reading of MJPEG, where each frame is represented as a part of
  1128. multipart/x-mixed-replace stream.
  1129. </p><dl compact="compact">
  1130. <dt><span><samp>strict_mime_boundary</samp></span></dt>
  1131. <dd><p>Default implementation applies a relaxed standard to multi-part MIME boundary detection,
  1132. to prevent regression with numerous existing endpoints not generating a proper MIME
  1133. MJPEG stream. Turning this option on by setting it to 1 will result in a stricter check
  1134. of the boundary value.
  1135. </p></dd>
  1136. </dl>
  1137. <a name="rawvideo"></a>
  1138. <h3 class="section">3.16 rawvideo<span class="pull-right"><a class="anchor hidden-xs" href="#rawvideo" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-rawvideo" aria-hidden="true">TOC</a></span></h3>
  1139. <p>Raw video demuxer.
  1140. </p>
  1141. <p>This demuxer allows one to read raw video data. Since there is no header
  1142. specifying the assumed video parameters, the user must specify them
  1143. in order to be able to decode the data correctly.
  1144. </p>
  1145. <p>This demuxer accepts the following options:
  1146. </p><dl compact="compact">
  1147. <dt><span><samp>framerate</samp></span></dt>
  1148. <dd><p>Set input video frame rate. Default value is 25.
  1149. </p>
  1150. </dd>
  1151. <dt><span><samp>pixel_format</samp></span></dt>
  1152. <dd><p>Set the input video pixel format. Default value is <code>yuv420p</code>.
  1153. </p>
  1154. </dd>
  1155. <dt><span><samp>video_size</samp></span></dt>
  1156. <dd><p>Set the input video size. This value must be specified explicitly.
  1157. </p></dd>
  1158. </dl>
  1159. <p>For example to read a rawvideo file <samp>input.raw</samp> with
  1160. <code>ffplay</code>, assuming a pixel format of <code>rgb24</code>, a video
  1161. size of <code>320x240</code>, and a frame rate of 10 images per second, use
  1162. the command:
  1163. </p><div class="example">
  1164. <pre class="example">ffplay -f rawvideo -pixel_format rgb24 -video_size 320x240 -framerate 10 input.raw
  1165. </pre></div>
  1166. <a name="sbg"></a>
  1167. <h3 class="section">3.17 sbg<span class="pull-right"><a class="anchor hidden-xs" href="#sbg" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-sbg" aria-hidden="true">TOC</a></span></h3>
  1168. <p>SBaGen script demuxer.
  1169. </p>
  1170. <p>This demuxer reads the script language used by SBaGen
  1171. <a href="http://uazu.net/sbagen/">http://uazu.net/sbagen/</a> to generate binaural beats sessions. A SBG
  1172. script looks like that:
  1173. </p><div class="example">
  1174. <pre class="example">-SE
  1175. a: 300-2.5/3 440+4.5/0
  1176. b: 300-2.5/0 440+4.5/3
  1177. off: -
  1178. NOW == a
  1179. +0:07:00 == b
  1180. +0:14:00 == a
  1181. +0:21:00 == b
  1182. +0:30:00 off
  1183. </pre></div>
  1184. <p>A SBG script can mix absolute and relative timestamps. If the script uses
  1185. either only absolute timestamps (including the script start time) or only
  1186. relative ones, then its layout is fixed, and the conversion is
  1187. straightforward. On the other hand, if the script mixes both kind of
  1188. timestamps, then the <var>NOW</var> reference for relative timestamps will be
  1189. taken from the current time of day at the time the script is read, and the
  1190. script layout will be frozen according to that reference. That means that if
  1191. the script is directly played, the actual times will match the absolute
  1192. timestamps up to the sound controller&rsquo;s clock accuracy, but if the user
  1193. somehow pauses the playback or seeks, all times will be shifted accordingly.
  1194. </p>
  1195. <a name="tedcaptions"></a>
  1196. <h3 class="section">3.18 tedcaptions<span class="pull-right"><a class="anchor hidden-xs" href="#tedcaptions" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-tedcaptions" aria-hidden="true">TOC</a></span></h3>
  1197. <p>JSON captions used for <a href="http://www.ted.com/">TED Talks</a>.
  1198. </p>
  1199. <p>TED does not provide links to the captions, but they can be guessed from the
  1200. page. The file <samp>tools/bookmarklets.html</samp> from the FFmpeg source tree
  1201. contains a bookmarklet to expose them.
  1202. </p>
  1203. <p>This demuxer accepts the following option:
  1204. </p><dl compact="compact">
  1205. <dt><span><samp>start_time</samp></span></dt>
  1206. <dd><p>Set the start time of the TED talk, in milliseconds. The default is 15000
  1207. (15s). It is used to sync the captions with the downloadable videos, because
  1208. they include a 15s intro.
  1209. </p></dd>
  1210. </dl>
  1211. <p>Example: convert the captions to a format most players understand:
  1212. </p><div class="example">
  1213. <pre class="example">ffmpeg -i http://www.ted.com/talks/subtitles/id/1/lang/en talk1-en.srt
  1214. </pre></div>
  1215. <a name="vapoursynth"></a>
  1216. <h3 class="section">3.19 vapoursynth<span class="pull-right"><a class="anchor hidden-xs" href="#vapoursynth" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-vapoursynth" aria-hidden="true">TOC</a></span></h3>
  1217. <p>Vapoursynth wrapper.
  1218. </p>
  1219. <p>Due to security concerns, Vapoursynth scripts will not
  1220. be autodetected so the input format has to be forced. For ff* CLI tools,
  1221. add <code>-f vapoursynth</code> before the input <code>-i yourscript.vpy</code>.
  1222. </p>
  1223. <p>This demuxer accepts the following option:
  1224. </p><dl compact="compact">
  1225. <dt><span><samp>max_script_size</samp></span></dt>
  1226. <dd><p>The demuxer buffers the entire script into memory. Adjust this value to set the maximum buffer size,
  1227. which in turn, acts as a ceiling for the size of scripts that can be read.
  1228. Default is 1 MiB.
  1229. </p></dd>
  1230. </dl>
  1231. <a name="Muxers"></a>
  1232. <h2 class="chapter">4 Muxers<span class="pull-right"><a class="anchor hidden-xs" href="#Muxers" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Muxers" aria-hidden="true">TOC</a></span></h2>
  1233. <p>Muxers are configured elements in FFmpeg which allow writing
  1234. multimedia streams to a particular type of file.
  1235. </p>
  1236. <p>When you configure your FFmpeg build, all the supported muxers
  1237. are enabled by default. You can list all available muxers using the
  1238. configure option <code>--list-muxers</code>.
  1239. </p>
  1240. <p>You can disable all the muxers with the configure option
  1241. <code>--disable-muxers</code> and selectively enable / disable single muxers
  1242. with the options <code>--enable-muxer=<var>MUXER</var></code> /
  1243. <code>--disable-muxer=<var>MUXER</var></code>.
  1244. </p>
  1245. <p>The option <code>-muxers</code> of the ff* tools will display the list of
  1246. enabled muxers. Use <code>-formats</code> to view a combined list of
  1247. enabled demuxers and muxers.
  1248. </p>
  1249. <p>A description of some of the currently available muxers follows.
  1250. </p>
  1251. <span id="aiff"></span><a name="aiff-1"></a>
  1252. <h3 class="section">4.1 aiff<span class="pull-right"><a class="anchor hidden-xs" href="#aiff-1" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-aiff-1" aria-hidden="true">TOC</a></span></h3>
  1253. <p>Audio Interchange File Format muxer.
  1254. </p>
  1255. <a name="Options-2"></a>
  1256. <h4 class="subsection">4.1.1 Options<span class="pull-right"><a class="anchor hidden-xs" href="#Options-2" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Options-2" aria-hidden="true">TOC</a></span></h4>
  1257. <p>It accepts the following options:
  1258. </p>
  1259. <dl compact="compact">
  1260. <dt><span><samp>write_id3v2</samp></span></dt>
  1261. <dd><p>Enable ID3v2 tags writing when set to 1. Default is 0 (disabled).
  1262. </p>
  1263. </dd>
  1264. <dt><span><samp>id3v2_version</samp></span></dt>
  1265. <dd><p>Select ID3v2 version to write. Currently only version 3 and 4 (aka.
  1266. ID3v2.3 and ID3v2.4) are supported. The default is version 4.
  1267. </p>
  1268. </dd>
  1269. </dl>
  1270. <span id="asf"></span><a name="asf-2"></a>
  1271. <h3 class="section">4.2 asf<span class="pull-right"><a class="anchor hidden-xs" href="#asf-2" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-asf-2" aria-hidden="true">TOC</a></span></h3>
  1272. <p>Advanced Systems Format muxer.
  1273. </p>
  1274. <p>Note that Windows Media Audio (wma) and Windows Media Video (wmv) use this
  1275. muxer too.
  1276. </p>
  1277. <a name="Options-3"></a>
  1278. <h4 class="subsection">4.2.1 Options<span class="pull-right"><a class="anchor hidden-xs" href="#Options-3" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Options-3" aria-hidden="true">TOC</a></span></h4>
  1279. <p>It accepts the following options:
  1280. </p>
  1281. <dl compact="compact">
  1282. <dt><span><samp>packet_size</samp></span></dt>
  1283. <dd><p>Set the muxer packet size. By tuning this setting you may reduce data
  1284. fragmentation or muxer overhead depending on your source. Default value is
  1285. 3200, minimum is 100, maximum is 64k.
  1286. </p>
  1287. </dd>
  1288. </dl>
  1289. <span id="avi"></span><a name="avi-1"></a>
  1290. <h3 class="section">4.3 avi<span class="pull-right"><a class="anchor hidden-xs" href="#avi-1" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-avi-1" aria-hidden="true">TOC</a></span></h3>
  1291. <p>Audio Video Interleaved muxer.
  1292. </p>
  1293. <a name="Options-4"></a>
  1294. <h4 class="subsection">4.3.1 Options<span class="pull-right"><a class="anchor hidden-xs" href="#Options-4" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Options-4" aria-hidden="true">TOC</a></span></h4>
  1295. <p>It accepts the following options:
  1296. </p>
  1297. <dl compact="compact">
  1298. <dt><span><samp>reserve_index_space</samp></span></dt>
  1299. <dd><p>Reserve the specified amount of bytes for the OpenDML master index of each
  1300. stream within the file header. By default additional master indexes are
  1301. embedded within the data packets if there is no space left in the first master
  1302. index and are linked together as a chain of indexes. This index structure can
  1303. cause problems for some use cases, e.g. third-party software strictly relying
  1304. on the OpenDML index specification or when file seeking is slow. Reserving
  1305. enough index space in the file header avoids these problems.
  1306. </p>
  1307. <p>The required index space depends on the output file size and should be about 16
  1308. bytes per gigabyte. When this option is omitted or set to zero the necessary
  1309. index space is guessed.
  1310. </p>
  1311. </dd>
  1312. <dt><span><samp>write_channel_mask</samp></span></dt>
  1313. <dd><p>Write the channel layout mask into the audio stream header.
  1314. </p>
  1315. <p>This option is enabled by default. Disabling the channel mask can be useful in
  1316. specific scenarios, e.g. when merging multiple audio streams into one for
  1317. compatibility with software that only supports a single audio stream in AVI
  1318. (see <a data-manual="ffmpeg-filters" href="ffmpeg-filters.html#amerge">(ffmpeg-filters)the &quot;amerge&quot; section in the ffmpeg-filters manual</a>).
  1319. </p>
  1320. </dd>
  1321. <dt><span><samp>flipped_raw_rgb</samp></span></dt>
  1322. <dd><p>If set to true, store positive height for raw RGB bitmaps, which indicates
  1323. bitmap is stored bottom-up. Note that this option does not flip the bitmap
  1324. which has to be done manually beforehand, e.g. by using the vflip filter.
  1325. Default is <var>false</var> and indicates bitmap is stored top down.
  1326. </p>
  1327. </dd>
  1328. </dl>
  1329. <span id="chromaprint"></span><a name="chromaprint-1"></a>
  1330. <h3 class="section">4.4 chromaprint<span class="pull-right"><a class="anchor hidden-xs" href="#chromaprint-1" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-chromaprint-1" aria-hidden="true">TOC</a></span></h3>
  1331. <p>Chromaprint fingerprinter.
  1332. </p>
  1333. <p>This muxer feeds audio data to the Chromaprint library,
  1334. which generates a fingerprint for the provided audio data. See <a href="https://acoustid.org/chromaprint">https://acoustid.org/chromaprint</a>
  1335. </p>
  1336. <p>It takes a single signed native-endian 16-bit raw audio stream of at most 2 channels.
  1337. </p>
  1338. <a name="Options-5"></a>
  1339. <h4 class="subsection">4.4.1 Options<span class="pull-right"><a class="anchor hidden-xs" href="#Options-5" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Options-5" aria-hidden="true">TOC</a></span></h4>
  1340. <dl compact="compact">
  1341. <dt><span><samp>silence_threshold</samp></span></dt>
  1342. <dd><p>Threshold for detecting silence. Range is from -1 to 32767, where -1 disables
  1343. silence detection. Silence detection can only be used with version 3 of the
  1344. algorithm.
  1345. Silence detection must be disabled for use with the AcoustID service. Default is -1.
  1346. </p>
  1347. </dd>
  1348. <dt><span><samp>algorithm</samp></span></dt>
  1349. <dd><p>Version of algorithm to fingerprint with. Range is 0 to 4.
  1350. Version 3 enables silence detection. Default is 1.
  1351. </p>
  1352. </dd>
  1353. <dt><span><samp>fp_format</samp></span></dt>
  1354. <dd><p>Format to output the fingerprint as. Accepts the following options:
  1355. </p><dl compact="compact">
  1356. <dt><span>&lsquo;<samp>raw</samp>&rsquo;</span></dt>
  1357. <dd><p>Binary raw fingerprint
  1358. </p>
  1359. </dd>
  1360. <dt><span>&lsquo;<samp>compressed</samp>&rsquo;</span></dt>
  1361. <dd><p>Binary compressed fingerprint
  1362. </p>
  1363. </dd>
  1364. <dt><span>&lsquo;<samp>base64</samp>&rsquo;</span></dt>
  1365. <dd><p>Base64 compressed fingerprint <em>(default)</em>
  1366. </p>
  1367. </dd>
  1368. </dl>
  1369. </dd>
  1370. </dl>
  1371. <span id="crc"></span><a name="crc-1"></a>
  1372. <h3 class="section">4.5 crc<span class="pull-right"><a class="anchor hidden-xs" href="#crc-1" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-crc-1" aria-hidden="true">TOC</a></span></h3>
  1373. <p>CRC (Cyclic Redundancy Check) testing format.
  1374. </p>
  1375. <p>This muxer computes and prints the Adler-32 CRC of all the input audio
  1376. and video frames. By default audio frames are converted to signed
  1377. 16-bit raw audio and video frames to raw video before computing the
  1378. CRC.
  1379. </p>
  1380. <p>The output of the muxer consists of a single line of the form:
  1381. CRC=0x<var>CRC</var>, where <var>CRC</var> is a hexadecimal number 0-padded to
  1382. 8 digits containing the CRC for all the decoded input frames.
  1383. </p>
  1384. <p>See also the <a href="#framecrc">framecrc</a> muxer.
  1385. </p>
  1386. <a name="Examples-2"></a>
  1387. <h4 class="subsection">4.5.1 Examples<span class="pull-right"><a class="anchor hidden-xs" href="#Examples-2" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Examples-2" aria-hidden="true">TOC</a></span></h4>
  1388. <p>For example to compute the CRC of the input, and store it in the file
  1389. <samp>out.crc</samp>:
  1390. </p><div class="example">
  1391. <pre class="example">ffmpeg -i INPUT -f crc out.crc
  1392. </pre></div>
  1393. <p>You can print the CRC to stdout with the command:
  1394. </p><div class="example">
  1395. <pre class="example">ffmpeg -i INPUT -f crc -
  1396. </pre></div>
  1397. <p>You can select the output format of each frame with <code>ffmpeg</code> by
  1398. specifying the audio and video codec and format. For example to
  1399. compute the CRC of the input audio converted to PCM unsigned 8-bit
  1400. and the input video converted to MPEG-2 video, use the command:
  1401. </p><div class="example">
  1402. <pre class="example">ffmpeg -i INPUT -c:a pcm_u8 -c:v mpeg2video -f crc -
  1403. </pre></div>
  1404. <a name="flv"></a>
  1405. <h3 class="section">4.6 flv<span class="pull-right"><a class="anchor hidden-xs" href="#flv" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-flv" aria-hidden="true">TOC</a></span></h3>
  1406. <p>Adobe Flash Video Format muxer.
  1407. </p>
  1408. <p>This muxer accepts the following options:
  1409. </p>
  1410. <dl compact="compact">
  1411. <dt><span><samp>flvflags <var>flags</var></samp></span></dt>
  1412. <dd><p>Possible values:
  1413. </p>
  1414. <dl compact="compact">
  1415. <dt><span>&lsquo;<samp>aac_seq_header_detect</samp>&rsquo;</span></dt>
  1416. <dd><p>Place AAC sequence header based on audio stream data.
  1417. </p>
  1418. </dd>
  1419. <dt><span>&lsquo;<samp>no_sequence_end</samp>&rsquo;</span></dt>
  1420. <dd><p>Disable sequence end tag.
  1421. </p>
  1422. </dd>
  1423. <dt><span>&lsquo;<samp>no_metadata</samp>&rsquo;</span></dt>
  1424. <dd><p>Disable metadata tag.
  1425. </p>
  1426. </dd>
  1427. <dt><span>&lsquo;<samp>no_duration_filesize</samp>&rsquo;</span></dt>
  1428. <dd><p>Disable duration and filesize in metadata when they are equal to zero
  1429. at the end of stream. (Be used to non-seekable living stream).
  1430. </p>
  1431. </dd>
  1432. <dt><span>&lsquo;<samp>add_keyframe_index</samp>&rsquo;</span></dt>
  1433. <dd><p>Used to facilitate seeking; particularly for HTTP pseudo streaming.
  1434. </p></dd>
  1435. </dl>
  1436. </dd>
  1437. </dl>
  1438. <span id="dash"></span><a name="dash-2"></a>
  1439. <h3 class="section">4.7 dash<span class="pull-right"><a class="anchor hidden-xs" href="#dash-2" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-dash-2" aria-hidden="true">TOC</a></span></h3>
  1440. <p>Dynamic Adaptive Streaming over HTTP (DASH) muxer that creates segments
  1441. and manifest files according to the MPEG-DASH standard ISO/IEC 23009-1:2014.
  1442. </p>
  1443. <p>For more information see:
  1444. </p>
  1445. <ul>
  1446. <li> ISO DASH Specification: <a href="http://standards.iso.org/ittf/PubliclyAvailableStandards/c065274_ISO_IEC_23009-1_2014.zip">http://standards.iso.org/ittf/PubliclyAvailableStandards/c065274_ISO_IEC_23009-1_2014.zip</a>
  1447. </li><li> WebM DASH Specification: <a href="https://sites.google.com/a/webmproject.org/wiki/adaptive-streaming/webm-dash-specification">https://sites.google.com/a/webmproject.org/wiki/adaptive-streaming/webm-dash-specification</a>
  1448. </li></ul>
  1449. <p>It creates a MPD manifest file and segment files for each stream.
  1450. </p>
  1451. <p>The segment filename might contain pre-defined identifiers used with SegmentTemplate
  1452. as defined in section 5.3.9.4.4 of the standard. Available identifiers are &quot;$RepresentationID$&quot;,
  1453. &quot;$Number$&quot;, &quot;$Bandwidth$&quot; and &quot;$Time$&quot;.
  1454. In addition to the standard identifiers, an ffmpeg-specific &quot;$ext$&quot; identifier is also supported.
  1455. When specified ffmpeg will replace $ext$ in the file name with muxing format&rsquo;s extensions such as mp4, webm etc.,
  1456. </p>
  1457. <div class="example">
  1458. <pre class="example">ffmpeg -re -i &lt;input&gt; -map 0 -map 0 -c:a libfdk_aac -c:v libx264 \
  1459. -b:v:0 800k -b:v:1 300k -s:v:1 320x170 -profile:v:1 baseline \
  1460. -profile:v:0 main -bf 1 -keyint_min 120 -g 120 -sc_threshold 0 \
  1461. -b_strategy 0 -ar:a:1 22050 -use_timeline 1 -use_template 1 \
  1462. -window_size 5 -adaptation_sets &quot;id=0,streams=v id=1,streams=a&quot; \
  1463. -f dash /path/to/out.mpd
  1464. </pre></div>
  1465. <dl compact="compact">
  1466. <dt><span><samp>min_seg_duration <var>microseconds</var></samp></span></dt>
  1467. <dd><p>This is a deprecated option to set the segment length in microseconds, use <var>seg_duration</var> instead.
  1468. </p></dd>
  1469. <dt><span><samp>seg_duration <var>duration</var></samp></span></dt>
  1470. <dd><p>Set the segment length in seconds (fractional value can be set). The value is
  1471. treated as average segment duration when <var>use_template</var> is enabled and
  1472. <var>use_timeline</var> is disabled and as minimum segment duration for all the other
  1473. use cases.
  1474. </p></dd>
  1475. <dt><span><samp>frag_duration <var>duration</var></samp></span></dt>
  1476. <dd><p>Set the length in seconds of fragments within segments (fractional value can be set).
  1477. </p></dd>
  1478. <dt><span><samp>frag_type <var>type</var></samp></span></dt>
  1479. <dd><p>Set the type of interval for fragmentation.
  1480. </p></dd>
  1481. <dt><span><samp>window_size <var>size</var></samp></span></dt>
  1482. <dd><p>Set the maximum number of segments kept in the manifest.
  1483. </p></dd>
  1484. <dt><span><samp>extra_window_size <var>size</var></samp></span></dt>
  1485. <dd><p>Set the maximum number of segments kept outside of the manifest before removing from disk.
  1486. </p></dd>
  1487. <dt><span><samp>remove_at_exit <var>remove</var></samp></span></dt>
  1488. <dd><p>Enable (1) or disable (0) removal of all segments when finished.
  1489. </p></dd>
  1490. <dt><span><samp>use_template <var>template</var></samp></span></dt>
  1491. <dd><p>Enable (1) or disable (0) use of SegmentTemplate instead of SegmentList.
  1492. </p></dd>
  1493. <dt><span><samp>use_timeline <var>timeline</var></samp></span></dt>
  1494. <dd><p>Enable (1) or disable (0) use of SegmentTimeline in SegmentTemplate.
  1495. </p></dd>
  1496. <dt><span><samp>single_file <var>single_file</var></samp></span></dt>
  1497. <dd><p>Enable (1) or disable (0) storing all segments in one file, accessed using byte ranges.
  1498. </p></dd>
  1499. <dt><span><samp>single_file_name <var>file_name</var></samp></span></dt>
  1500. <dd><p>DASH-templated name to be used for baseURL. Implies <var>single_file</var> set to &quot;1&quot;. In the template, &quot;$ext$&quot; is replaced with the file name extension specific for the segment format.
  1501. </p></dd>
  1502. <dt><span><samp>init_seg_name <var>init_name</var></samp></span></dt>
  1503. <dd><p>DASH-templated name to used for the initialization segment. Default is &quot;init-stream$RepresentationID$.$ext$&quot;. &quot;$ext$&quot; is replaced with the file name extension specific for the segment format.
  1504. </p></dd>
  1505. <dt><span><samp>media_seg_name <var>segment_name</var></samp></span></dt>
  1506. <dd><p>DASH-templated name to used for the media segments. Default is &quot;chunk-stream$RepresentationID$-$Number%05d$.$ext$&quot;. &quot;$ext$&quot; is replaced with the file name extension specific for the segment format.
  1507. </p></dd>
  1508. <dt><span><samp>utc_timing_url <var>utc_url</var></samp></span></dt>
  1509. <dd><p>URL of the page that will return the UTC timestamp in ISO format. Example: &quot;https://time.akamai.com/?iso&quot;
  1510. </p></dd>
  1511. <dt><span><samp>method <var>method</var></samp></span></dt>
  1512. <dd><p>Use the given HTTP method to create output files. Generally set to PUT or POST.
  1513. </p></dd>
  1514. <dt><span><samp>http_user_agent <var>user_agent</var></samp></span></dt>
  1515. <dd><p>Override User-Agent field in HTTP header. Applicable only for HTTP output.
  1516. </p></dd>
  1517. <dt><span><samp>http_persistent <var>http_persistent</var></samp></span></dt>
  1518. <dd><p>Use persistent HTTP connections. Applicable only for HTTP output.
  1519. </p></dd>
  1520. <dt><span><samp>hls_playlist <var>hls_playlist</var></samp></span></dt>
  1521. <dd><p>Generate HLS playlist files as well. The master playlist is generated with the filename <var>hls_master_name</var>.
  1522. One media playlist file is generated for each stream with filenames media_0.m3u8, media_1.m3u8, etc.
  1523. </p></dd>
  1524. <dt><span><samp>hls_master_name <var>file_name</var></samp></span></dt>
  1525. <dd><p>HLS master playlist name. Default is &quot;master.m3u8&quot;.
  1526. </p></dd>
  1527. <dt><span><samp>streaming <var>streaming</var></samp></span></dt>
  1528. <dd><p>Enable (1) or disable (0) chunk streaming mode of output. In chunk streaming
  1529. mode, each frame will be a moof fragment which forms a chunk.
  1530. </p></dd>
  1531. <dt><span><samp>adaptation_sets <var>adaptation_sets</var></samp></span></dt>
  1532. <dd><p>Assign streams to AdaptationSets. Syntax is &quot;id=x,streams=a,b,c id=y,streams=d,e&quot; with x and y being the IDs
  1533. of the adaptation sets and a,b,c,d and e are the indices of the mapped streams.
  1534. </p>
  1535. <p>To map all video (or audio) streams to an AdaptationSet, &quot;v&quot; (or &quot;a&quot;) can be used as stream identifier instead of IDs.
  1536. </p>
  1537. <p>When no assignment is defined, this defaults to an AdaptationSet for each stream.
  1538. </p>
  1539. <p>Optional syntax is &quot;id=x,seg_duration=x,frag_duration=x,frag_type=type,descriptor=descriptor_string,streams=a,b,c id=y,seg_duration=y,frag_type=type,streams=d,e&quot; and so on,
  1540. descriptor is useful to the scheme defined by ISO/IEC 23009-1:2014/Amd.2:2015.
  1541. For example, -adaptation_sets &quot;id=0,descriptor=&lt;SupplementalProperty schemeIdUri=\&quot;urn:mpeg:dash:srd:2014\&quot; value=\&quot;0,0,0,1,1,2,2\&quot;/&gt;,streams=v&quot;.
  1542. Please note that descriptor string should be a self-closing xml tag.
  1543. seg_duration, frag_duration and frag_type override the global option values for each adaptation set.
  1544. For example, -adaptation_sets &quot;id=0,seg_duration=2,frag_duration=1,frag_type=duration,streams=v id=1,seg_duration=2,frag_type=none,streams=a&quot;
  1545. type_id marks an adaptation set as containing streams meant to be used for Trick Mode for the referenced adaptation set.
  1546. For example, -adaptation_sets &quot;id=0,seg_duration=2,frag_type=none,streams=0 id=1,seg_duration=10,frag_type=none,trick_id=0,streams=1&quot;
  1547. </p></dd>
  1548. <dt><span><samp>timeout <var>timeout</var></samp></span></dt>
  1549. <dd><p>Set timeout for socket I/O operations. Applicable only for HTTP output.
  1550. </p></dd>
  1551. <dt><span><samp>index_correction <var>index_correction</var></samp></span></dt>
  1552. <dd><p>Enable (1) or Disable (0) segment index correction logic. Applicable only when
  1553. <var>use_template</var> is enabled and <var>use_timeline</var> is disabled.
  1554. </p>
  1555. <p>When enabled, the logic monitors the flow of segment indexes. If a streams&rsquo;s
  1556. segment index value is not at the expected real time position, then the logic
  1557. corrects that index value.
  1558. </p>
  1559. <p>Typically this logic is needed in live streaming use cases. The network bandwidth
  1560. fluctuations are common during long run streaming. Each fluctuation can cause
  1561. the segment indexes fall behind the expected real time position.
  1562. </p></dd>
  1563. <dt><span><samp>format_options <var>options_list</var></samp></span></dt>
  1564. <dd><p>Set container format (mp4/webm) options using a <code>:</code> separated list of
  1565. key=value parameters. Values containing <code>:</code> special characters must be
  1566. escaped.
  1567. </p>
  1568. </dd>
  1569. <dt><span><samp>global_sidx <var>global_sidx</var></samp></span></dt>
  1570. <dd><p>Write global SIDX atom. Applicable only for single file, mp4 output, non-streaming mode.
  1571. </p>
  1572. </dd>
  1573. <dt><span><samp>dash_segment_type <var>dash_segment_type</var></samp></span></dt>
  1574. <dd><p>Possible values:
  1575. </p><dl compact="compact">
  1576. <dt><span><samp>auto</samp></span></dt>
  1577. <dd><p>If this flag is set, the dash segment files format will be selected based on the stream codec. This is the default mode.
  1578. </p>
  1579. </dd>
  1580. <dt><span><samp>mp4</samp></span></dt>
  1581. <dd><p>If this flag is set, the dash segment files will be in in ISOBMFF format.
  1582. </p>
  1583. </dd>
  1584. <dt><span><samp>webm</samp></span></dt>
  1585. <dd><p>If this flag is set, the dash segment files will be in in WebM format.
  1586. </p></dd>
  1587. </dl>
  1588. </dd>
  1589. <dt><span><samp>ignore_io_errors <var>ignore_io_errors</var></samp></span></dt>
  1590. <dd><p>Ignore IO errors during open and write. Useful for long-duration runs with network output.
  1591. </p>
  1592. </dd>
  1593. <dt><span><samp>lhls <var>lhls</var></samp></span></dt>
  1594. <dd><p>Enable Low-latency HLS(LHLS). Adds #EXT-X-PREFETCH tag with current segment&rsquo;s URI.
  1595. Apple doesn&rsquo;t have an official spec for LHLS. Meanwhile hls.js player folks are
  1596. trying to standardize a open LHLS spec. The draft spec is available in https://github.com/video-dev/hlsjs-rfcs/blob/lhls-spec/proposals/0001-lhls.md
  1597. This option will also try to comply with the above open spec, till Apple&rsquo;s spec officially supports it.
  1598. Applicable only when <var>streaming</var> and <var>hls_playlist</var> options are enabled.
  1599. This is an experimental feature.
  1600. </p>
  1601. </dd>
  1602. <dt><span><samp>ldash <var>ldash</var></samp></span></dt>
  1603. <dd><p>Enable Low-latency Dash by constraining the presence and values of some elements.
  1604. </p>
  1605. </dd>
  1606. <dt><span><samp>master_m3u8_publish_rate <var>master_m3u8_publish_rate</var></samp></span></dt>
  1607. <dd><p>Publish master playlist repeatedly every after specified number of segment intervals.
  1608. </p>
  1609. </dd>
  1610. <dt><span><samp>write_prft <var>write_prft</var></samp></span></dt>
  1611. <dd><p>Write Producer Reference Time elements on supported streams. This also enables writing
  1612. prft boxes in the underlying muxer. Applicable only when the <var>utc_url</var> option is enabled.
  1613. It&rsquo;s set to auto by default, in which case the muxer will attempt to enable it only in modes
  1614. that require it.
  1615. </p>
  1616. </dd>
  1617. <dt><span><samp>mpd_profile <var>mpd_profile</var></samp></span></dt>
  1618. <dd><p>Set one or more manifest profiles.
  1619. </p>
  1620. </dd>
  1621. <dt><span><samp>http_opts <var>http_opts</var></samp></span></dt>
  1622. <dd><p>A :-separated list of key=value options to pass to the underlying HTTP
  1623. protocol. Applicable only for HTTP output.
  1624. </p>
  1625. </dd>
  1626. <dt><span><samp>target_latency <var>target_latency</var></samp></span></dt>
  1627. <dd><p>Set an intended target latency in seconds (fractional value can be set) for serving. Applicable only when <var>streaming</var> and <var>write_prft</var> options are enabled.
  1628. This is an informative fields clients can use to measure the latency of the service.
  1629. </p>
  1630. </dd>
  1631. <dt><span><samp>min_playback_rate <var>min_playback_rate</var></samp></span></dt>
  1632. <dd><p>Set the minimum playback rate indicated as appropriate for the purposes of automatically
  1633. adjusting playback latency and buffer occupancy during normal playback by clients.
  1634. </p>
  1635. </dd>
  1636. <dt><span><samp>max_playback_rate <var>max_playback_rate</var></samp></span></dt>
  1637. <dd><p>Set the maximum playback rate indicated as appropriate for the purposes of automatically
  1638. adjusting playback latency and buffer occupancy during normal playback by clients.
  1639. </p>
  1640. </dd>
  1641. <dt><span><samp>update_period <var>update_period</var></samp></span></dt>
  1642. <dd><p>Set the mpd update period ,for dynamic content.
  1643. The unit is second.
  1644. </p>
  1645. </dd>
  1646. </dl>
  1647. <span id="framecrc"></span><a name="framecrc-1"></a>
  1648. <h3 class="section">4.8 framecrc<span class="pull-right"><a class="anchor hidden-xs" href="#framecrc-1" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-framecrc-1" aria-hidden="true">TOC</a></span></h3>
  1649. <p>Per-packet CRC (Cyclic Redundancy Check) testing format.
  1650. </p>
  1651. <p>This muxer computes and prints the Adler-32 CRC for each audio
  1652. and video packet. By default audio frames are converted to signed
  1653. 16-bit raw audio and video frames to raw video before computing the
  1654. CRC.
  1655. </p>
  1656. <p>The output of the muxer consists of a line for each audio and video
  1657. packet of the form:
  1658. </p><div class="example">
  1659. <pre class="example"><var>stream_index</var>, <var>packet_dts</var>, <var>packet_pts</var>, <var>packet_duration</var>, <var>packet_size</var>, 0x<var>CRC</var>
  1660. </pre></div>
  1661. <p><var>CRC</var> is a hexadecimal number 0-padded to 8 digits containing the
  1662. CRC of the packet.
  1663. </p>
  1664. <a name="Examples-3"></a>
  1665. <h4 class="subsection">4.8.1 Examples<span class="pull-right"><a class="anchor hidden-xs" href="#Examples-3" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Examples-3" aria-hidden="true">TOC</a></span></h4>
  1666. <p>For example to compute the CRC of the audio and video frames in
  1667. <samp>INPUT</samp>, converted to raw audio and video packets, and store it
  1668. in the file <samp>out.crc</samp>:
  1669. </p><div class="example">
  1670. <pre class="example">ffmpeg -i INPUT -f framecrc out.crc
  1671. </pre></div>
  1672. <p>To print the information to stdout, use the command:
  1673. </p><div class="example">
  1674. <pre class="example">ffmpeg -i INPUT -f framecrc -
  1675. </pre></div>
  1676. <p>With <code>ffmpeg</code>, you can select the output format to which the
  1677. audio and video frames are encoded before computing the CRC for each
  1678. packet by specifying the audio and video codec. For example, to
  1679. compute the CRC of each decoded input audio frame converted to PCM
  1680. unsigned 8-bit and of each decoded input video frame converted to
  1681. MPEG-2 video, use the command:
  1682. </p><div class="example">
  1683. <pre class="example">ffmpeg -i INPUT -c:a pcm_u8 -c:v mpeg2video -f framecrc -
  1684. </pre></div>
  1685. <p>See also the <a href="#crc">crc</a> muxer.
  1686. </p>
  1687. <span id="framehash"></span><a name="framehash-1"></a>
  1688. <h3 class="section">4.9 framehash<span class="pull-right"><a class="anchor hidden-xs" href="#framehash-1" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-framehash-1" aria-hidden="true">TOC</a></span></h3>
  1689. <p>Per-packet hash testing format.
  1690. </p>
  1691. <p>This muxer computes and prints a cryptographic hash for each audio
  1692. and video packet. This can be used for packet-by-packet equality
  1693. checks without having to individually do a binary comparison on each.
  1694. </p>
  1695. <p>By default audio frames are converted to signed 16-bit raw audio and
  1696. video frames to raw video before computing the hash, but the output
  1697. of explicit conversions to other codecs can also be used. It uses the
  1698. SHA-256 cryptographic hash function by default, but supports several
  1699. other algorithms.
  1700. </p>
  1701. <p>The output of the muxer consists of a line for each audio and video
  1702. packet of the form:
  1703. </p><div class="example">
  1704. <pre class="example"><var>stream_index</var>, <var>packet_dts</var>, <var>packet_pts</var>, <var>packet_duration</var>, <var>packet_size</var>, <var>hash</var>
  1705. </pre></div>
  1706. <p><var>hash</var> is a hexadecimal number representing the computed hash
  1707. for the packet.
  1708. </p>
  1709. <dl compact="compact">
  1710. <dt><span><samp>hash <var>algorithm</var></samp></span></dt>
  1711. <dd><p>Use the cryptographic hash function specified by the string <var>algorithm</var>.
  1712. Supported values include <code>MD5</code>, <code>murmur3</code>, <code>RIPEMD128</code>,
  1713. <code>RIPEMD160</code>, <code>RIPEMD256</code>, <code>RIPEMD320</code>, <code>SHA160</code>,
  1714. <code>SHA224</code>, <code>SHA256</code> (default), <code>SHA512/224</code>, <code>SHA512/256</code>,
  1715. <code>SHA384</code>, <code>SHA512</code>, <code>CRC32</code> and <code>adler32</code>.
  1716. </p>
  1717. </dd>
  1718. </dl>
  1719. <a name="Examples-4"></a>
  1720. <h4 class="subsection">4.9.1 Examples<span class="pull-right"><a class="anchor hidden-xs" href="#Examples-4" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Examples-4" aria-hidden="true">TOC</a></span></h4>
  1721. <p>To compute the SHA-256 hash of the audio and video frames in <samp>INPUT</samp>,
  1722. converted to raw audio and video packets, and store it in the file
  1723. <samp>out.sha256</samp>:
  1724. </p><div class="example">
  1725. <pre class="example">ffmpeg -i INPUT -f framehash out.sha256
  1726. </pre></div>
  1727. <p>To print the information to stdout, using the MD5 hash function, use
  1728. the command:
  1729. </p><div class="example">
  1730. <pre class="example">ffmpeg -i INPUT -f framehash -hash md5 -
  1731. </pre></div>
  1732. <p>See also the <a href="#hash">hash</a> muxer.
  1733. </p>
  1734. <span id="framemd5"></span><a name="framemd5-1"></a>
  1735. <h3 class="section">4.10 framemd5<span class="pull-right"><a class="anchor hidden-xs" href="#framemd5-1" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-framemd5-1" aria-hidden="true">TOC</a></span></h3>
  1736. <p>Per-packet MD5 testing format.
  1737. </p>
  1738. <p>This is a variant of the <a href="#framehash">framehash</a> muxer. Unlike that muxer,
  1739. it defaults to using the MD5 hash function.
  1740. </p>
  1741. <a name="Examples-5"></a>
  1742. <h4 class="subsection">4.10.1 Examples<span class="pull-right"><a class="anchor hidden-xs" href="#Examples-5" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Examples-5" aria-hidden="true">TOC</a></span></h4>
  1743. <p>To compute the MD5 hash of the audio and video frames in <samp>INPUT</samp>,
  1744. converted to raw audio and video packets, and store it in the file
  1745. <samp>out.md5</samp>:
  1746. </p><div class="example">
  1747. <pre class="example">ffmpeg -i INPUT -f framemd5 out.md5
  1748. </pre></div>
  1749. <p>To print the information to stdout, use the command:
  1750. </p><div class="example">
  1751. <pre class="example">ffmpeg -i INPUT -f framemd5 -
  1752. </pre></div>
  1753. <p>See also the <a href="#framehash">framehash</a> and <a href="#md5">md5</a> muxers.
  1754. </p>
  1755. <span id="gif"></span><a name="gif-2"></a>
  1756. <h3 class="section">4.11 gif<span class="pull-right"><a class="anchor hidden-xs" href="#gif-2" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-gif-2" aria-hidden="true">TOC</a></span></h3>
  1757. <p>Animated GIF muxer.
  1758. </p>
  1759. <p>It accepts the following options:
  1760. </p>
  1761. <dl compact="compact">
  1762. <dt><span><samp>loop</samp></span></dt>
  1763. <dd><p>Set the number of times to loop the output. Use <code>-1</code> for no loop, <code>0</code>
  1764. for looping indefinitely (default).
  1765. </p>
  1766. </dd>
  1767. <dt><span><samp>final_delay</samp></span></dt>
  1768. <dd><p>Force the delay (expressed in centiseconds) after the last frame. Each frame
  1769. ends with a delay until the next frame. The default is <code>-1</code>, which is a
  1770. special value to tell the muxer to re-use the previous delay. In case of a
  1771. loop, you might want to customize this value to mark a pause for instance.
  1772. </p></dd>
  1773. </dl>
  1774. <p>For example, to encode a gif looping 10 times, with a 5 seconds delay between
  1775. the loops:
  1776. </p><div class="example">
  1777. <pre class="example">ffmpeg -i INPUT -loop 10 -final_delay 500 out.gif
  1778. </pre></div>
  1779. <p>Note 1: if you wish to extract the frames into separate GIF files, you need to
  1780. force the <a href="#image2">image2</a> muxer:
  1781. </p><div class="example">
  1782. <pre class="example">ffmpeg -i INPUT -c:v gif -f image2 &quot;out%d.gif&quot;
  1783. </pre></div>
  1784. <p>Note 2: the GIF format has a very large time base: the delay between two frames
  1785. can therefore not be smaller than one centi second.
  1786. </p>
  1787. <span id="hash"></span><a name="hash-1"></a>
  1788. <h3 class="section">4.12 hash<span class="pull-right"><a class="anchor hidden-xs" href="#hash-1" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-hash-1" aria-hidden="true">TOC</a></span></h3>
  1789. <p>Hash testing format.
  1790. </p>
  1791. <p>This muxer computes and prints a cryptographic hash of all the input
  1792. audio and video frames. This can be used for equality checks without
  1793. having to do a complete binary comparison.
  1794. </p>
  1795. <p>By default audio frames are converted to signed 16-bit raw audio and
  1796. video frames to raw video before computing the hash, but the output
  1797. of explicit conversions to other codecs can also be used. Timestamps
  1798. are ignored. It uses the SHA-256 cryptographic hash function by default,
  1799. but supports several other algorithms.
  1800. </p>
  1801. <p>The output of the muxer consists of a single line of the form:
  1802. <var>algo</var>=<var>hash</var>, where <var>algo</var> is a short string representing
  1803. the hash function used, and <var>hash</var> is a hexadecimal number
  1804. representing the computed hash.
  1805. </p>
  1806. <dl compact="compact">
  1807. <dt><span><samp>hash <var>algorithm</var></samp></span></dt>
  1808. <dd><p>Use the cryptographic hash function specified by the string <var>algorithm</var>.
  1809. Supported values include <code>MD5</code>, <code>murmur3</code>, <code>RIPEMD128</code>,
  1810. <code>RIPEMD160</code>, <code>RIPEMD256</code>, <code>RIPEMD320</code>, <code>SHA160</code>,
  1811. <code>SHA224</code>, <code>SHA256</code> (default), <code>SHA512/224</code>, <code>SHA512/256</code>,
  1812. <code>SHA384</code>, <code>SHA512</code>, <code>CRC32</code> and <code>adler32</code>.
  1813. </p>
  1814. </dd>
  1815. </dl>
  1816. <a name="Examples-6"></a>
  1817. <h4 class="subsection">4.12.1 Examples<span class="pull-right"><a class="anchor hidden-xs" href="#Examples-6" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Examples-6" aria-hidden="true">TOC</a></span></h4>
  1818. <p>To compute the SHA-256 hash of the input converted to raw audio and
  1819. video, and store it in the file <samp>out.sha256</samp>:
  1820. </p><div class="example">
  1821. <pre class="example">ffmpeg -i INPUT -f hash out.sha256
  1822. </pre></div>
  1823. <p>To print an MD5 hash to stdout use the command:
  1824. </p><div class="example">
  1825. <pre class="example">ffmpeg -i INPUT -f hash -hash md5 -
  1826. </pre></div>
  1827. <p>See also the <a href="#framehash">framehash</a> muxer.
  1828. </p>
  1829. <span id="hls"></span><a name="hls-2"></a>
  1830. <h3 class="section">4.13 hls<span class="pull-right"><a class="anchor hidden-xs" href="#hls-2" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-hls-2" aria-hidden="true">TOC</a></span></h3>
  1831. <p>Apple HTTP Live Streaming muxer that segments MPEG-TS according to
  1832. the HTTP Live Streaming (HLS) specification.
  1833. </p>
  1834. <p>It creates a playlist file, and one or more segment files. The output filename
  1835. specifies the playlist filename.
  1836. </p>
  1837. <p>By default, the muxer creates a file for each segment produced. These files
  1838. have the same name as the playlist, followed by a sequential number and a
  1839. .ts extension.
  1840. </p>
  1841. <p>Make sure to require a closed GOP when encoding and to set the GOP
  1842. size to fit your segment time constraint.
  1843. </p>
  1844. <p>For example, to convert an input file with <code>ffmpeg</code>:
  1845. </p><div class="example">
  1846. <pre class="example">ffmpeg -i in.mkv -c:v h264 -flags +cgop -g 30 -hls_time 1 out.m3u8
  1847. </pre></div>
  1848. <p>This example will produce the playlist, <samp>out.m3u8</samp>, and segment files:
  1849. <samp>out0.ts</samp>, <samp>out1.ts</samp>, <samp>out2.ts</samp>, etc.
  1850. </p>
  1851. <p>See also the <a href="#segment">segment</a> muxer, which provides a more generic and
  1852. flexible implementation of a segmenter, and can be used to perform HLS
  1853. segmentation.
  1854. </p>
  1855. <a name="Options-6"></a>
  1856. <h4 class="subsection">4.13.1 Options<span class="pull-right"><a class="anchor hidden-xs" href="#Options-6" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Options-6" aria-hidden="true">TOC</a></span></h4>
  1857. <p>This muxer supports the following options:
  1858. </p>
  1859. <dl compact="compact">
  1860. <dt><span><samp>hls_init_time <var>duration</var></samp></span></dt>
  1861. <dd><p>Set the initial target segment length. Default value is <var>0</var>.
  1862. </p>
  1863. <p><var>duration</var> must be a time duration specification,
  1864. see <a data-manual="ffmpeg-utils" href="ffmpeg-utils.html#time-duration-syntax">(ffmpeg-utils)the Time duration section in the ffmpeg-utils(1) manual</a>.
  1865. </p>
  1866. <p>Segment will be cut on the next key frame after this time has passed on the first m3u8 list.
  1867. After the initial playlist is filled <code>ffmpeg</code> will cut segments
  1868. at duration equal to <code>hls_time</code>
  1869. </p>
  1870. </dd>
  1871. <dt><span><samp>hls_time <var>duration</var></samp></span></dt>
  1872. <dd><p>Set the target segment length. Default value is 2.
  1873. </p>
  1874. <p><var>duration</var> must be a time duration specification,
  1875. see <a data-manual="ffmpeg-utils" href="ffmpeg-utils.html#time-duration-syntax">(ffmpeg-utils)the Time duration section in the ffmpeg-utils(1) manual</a>.
  1876. Segment will be cut on the next key frame after this time has passed.
  1877. </p>
  1878. </dd>
  1879. <dt><span><samp>hls_list_size <var>size</var></samp></span></dt>
  1880. <dd><p>Set the maximum number of playlist entries. If set to 0 the list file
  1881. will contain all the segments. Default value is 5.
  1882. </p>
  1883. </dd>
  1884. <dt><span><samp>hls_delete_threshold <var>size</var></samp></span></dt>
  1885. <dd><p>Set the number of unreferenced segments to keep on disk before <code>hls_flags delete_segments</code>
  1886. deletes them. Increase this to allow continue clients to download segments which
  1887. were recently referenced in the playlist. Default value is 1, meaning segments older than
  1888. <code>hls_list_size+1</code> will be deleted.
  1889. </p>
  1890. </dd>
  1891. <dt><span><samp>hls_ts_options <var>options_list</var></samp></span></dt>
  1892. <dd><p>Set output format options using a :-separated list of key=value
  1893. parameters. Values containing <code>:</code> special characters must be
  1894. escaped.
  1895. </p>
  1896. </dd>
  1897. <dt><span><samp>hls_wrap <var>wrap</var></samp></span></dt>
  1898. <dd><p>This is a deprecated option, you can use <code>hls_list_size</code>
  1899. and <code>hls_flags delete_segments</code> instead it
  1900. </p>
  1901. <p>This option is useful to avoid to fill the disk with many segment
  1902. files, and limits the maximum number of segment files written to disk
  1903. to <var>wrap</var>.
  1904. </p>
  1905. </dd>
  1906. <dt><span><samp>hls_start_number_source</samp></span></dt>
  1907. <dd><p>Start the playlist sequence number (<code>#EXT-X-MEDIA-SEQUENCE</code>) according to the specified source.
  1908. Unless <code>hls_flags single_file</code> is set, it also specifies source of starting sequence numbers of
  1909. segment and subtitle filenames. In any case, if <code>hls_flags append_list</code>
  1910. is set and read playlist sequence number is greater than the specified start sequence number,
  1911. then that value will be used as start value.
  1912. </p>
  1913. <p>It accepts the following values:
  1914. </p>
  1915. <dl compact="compact">
  1916. <dt><span><samp>generic (default)</samp></span></dt>
  1917. <dd><p>Set the starting sequence numbers according to <var>start_number</var> option value.
  1918. </p>
  1919. </dd>
  1920. <dt><span><samp>epoch</samp></span></dt>
  1921. <dd><p>The start number will be the seconds since epoch (1970-01-01 00:00:00)
  1922. </p>
  1923. </dd>
  1924. <dt><span><samp>epoch_us</samp></span></dt>
  1925. <dd><p>The start number will be the microseconds since epoch (1970-01-01 00:00:00)
  1926. </p>
  1927. </dd>
  1928. <dt><span><samp>datetime</samp></span></dt>
  1929. <dd><p>The start number will be based on the current date/time as YYYYmmddHHMMSS. e.g. 20161231235759.
  1930. </p>
  1931. </dd>
  1932. </dl>
  1933. </dd>
  1934. <dt><span><samp>start_number <var>number</var></samp></span></dt>
  1935. <dd><p>Start the playlist sequence number (<code>#EXT-X-MEDIA-SEQUENCE</code>) from the specified <var>number</var>
  1936. when <var>hls_start_number_source</var> value is <var>generic</var>. (This is the default case.)
  1937. Unless <code>hls_flags single_file</code> is set, it also specifies starting sequence numbers of segment and subtitle filenames.
  1938. Default value is 0.
  1939. </p>
  1940. </dd>
  1941. <dt><span><samp>hls_allow_cache <var>allowcache</var></samp></span></dt>
  1942. <dd><p>Explicitly set whether the client MAY (1) or MUST NOT (0) cache media segments.
  1943. </p>
  1944. </dd>
  1945. <dt><span><samp>hls_base_url <var>baseurl</var></samp></span></dt>
  1946. <dd><p>Append <var>baseurl</var> to every entry in the playlist.
  1947. Useful to generate playlists with absolute paths.
  1948. </p>
  1949. <p>Note that the playlist sequence number must be unique for each segment
  1950. and it is not to be confused with the segment filename sequence number
  1951. which can be cyclic, for example if the <samp>wrap</samp> option is
  1952. specified.
  1953. </p>
  1954. </dd>
  1955. <dt><span><samp>hls_segment_filename <var>filename</var></samp></span></dt>
  1956. <dd><p>Set the segment filename. Unless <code>hls_flags single_file</code> is set,
  1957. <var>filename</var> is used as a string format with the segment number:
  1958. </p><div class="example">
  1959. <pre class="example">ffmpeg -i in.nut -hls_segment_filename 'file%03d.ts' out.m3u8
  1960. </pre></div>
  1961. <p>This example will produce the playlist, <samp>out.m3u8</samp>, and segment files:
  1962. <samp>file000.ts</samp>, <samp>file001.ts</samp>, <samp>file002.ts</samp>, etc.
  1963. </p>
  1964. <p><var>filename</var> may contain full path or relative path specification,
  1965. but only the file name part without any path info will be contained in the m3u8 segment list.
  1966. Should a relative path be specified, the path of the created segment
  1967. files will be relative to the current working directory.
  1968. When strftime_mkdir is set, the whole expanded value of <var>filename</var> will be written into the m3u8 segment list.
  1969. </p>
  1970. <p>When <code>var_stream_map</code> is set with two or more variant streams, the
  1971. <var>filename</var> pattern must contain the string &quot;%v&quot;, this string specifies
  1972. the position of variant stream index in the generated segment file names.
  1973. </p><div class="example">
  1974. <pre class="example">ffmpeg -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \
  1975. -map 0:v -map 0:a -map 0:v -map 0:a -f hls -var_stream_map &quot;v:0,a:0 v:1,a:1&quot; \
  1976. -hls_segment_filename 'file_%v_%03d.ts' out_%v.m3u8
  1977. </pre></div>
  1978. <p>This example will produce the playlists segment file sets:
  1979. <samp>file_0_000.ts</samp>, <samp>file_0_001.ts</samp>, <samp>file_0_002.ts</samp>, etc. and
  1980. <samp>file_1_000.ts</samp>, <samp>file_1_001.ts</samp>, <samp>file_1_002.ts</samp>, etc.
  1981. </p>
  1982. <p>The string &quot;%v&quot; may be present in the filename or in the last directory name
  1983. containing the file, but only in one of them. (Additionally, %v may appear multiple times in the last
  1984. sub-directory or filename.) If the string %v is present in the directory name, then
  1985. sub-directories are created after expanding the directory name pattern. This
  1986. enables creation of segments corresponding to different variant streams in
  1987. subdirectories.
  1988. </p><div class="example">
  1989. <pre class="example">ffmpeg -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \
  1990. -map 0:v -map 0:a -map 0:v -map 0:a -f hls -var_stream_map &quot;v:0,a:0 v:1,a:1&quot; \
  1991. -hls_segment_filename 'vs%v/file_%03d.ts' vs%v/out.m3u8
  1992. </pre></div>
  1993. <p>This example will produce the playlists segment file sets:
  1994. <samp>vs0/file_000.ts</samp>, <samp>vs0/file_001.ts</samp>, <samp>vs0/file_002.ts</samp>, etc. and
  1995. <samp>vs1/file_000.ts</samp>, <samp>vs1/file_001.ts</samp>, <samp>vs1/file_002.ts</samp>, etc.
  1996. </p>
  1997. </dd>
  1998. <dt><span><samp>use_localtime</samp></span></dt>
  1999. <dd><p>Same as strftime option, will be deprecated.
  2000. </p>
  2001. </dd>
  2002. <dt><span><samp>strftime</samp></span></dt>
  2003. <dd><p>Use strftime() on <var>filename</var> to expand the segment filename with localtime.
  2004. The segment number is also available in this mode, but to use it, you need to specify second_level_segment_index
  2005. hls_flag and %%d will be the specifier.
  2006. </p><div class="example">
  2007. <pre class="example">ffmpeg -i in.nut -strftime 1 -hls_segment_filename 'file-%Y%m%d-%s.ts' out.m3u8
  2008. </pre></div>
  2009. <p>This example will produce the playlist, <samp>out.m3u8</samp>, and segment files:
  2010. <samp>file-20160215-1455569023.ts</samp>, <samp>file-20160215-1455569024.ts</samp>, etc.
  2011. Note: On some systems/environments, the <code>%s</code> specifier is not available. See
  2012. <code>strftime()</code> documentation.
  2013. </p><div class="example">
  2014. <pre class="example">ffmpeg -i in.nut -strftime 1 -hls_flags second_level_segment_index -hls_segment_filename 'file-%Y%m%d-%%04d.ts' out.m3u8
  2015. </pre></div>
  2016. <p>This example will produce the playlist, <samp>out.m3u8</samp>, and segment files:
  2017. <samp>file-20160215-0001.ts</samp>, <samp>file-20160215-0002.ts</samp>, etc.
  2018. </p>
  2019. </dd>
  2020. <dt><span><samp>use_localtime_mkdir</samp></span></dt>
  2021. <dd><p>Same as strftime_mkdir option, will be deprecated .
  2022. </p>
  2023. </dd>
  2024. <dt><span><samp>strftime_mkdir</samp></span></dt>
  2025. <dd><p>Used together with -strftime_mkdir, it will create all subdirectories which
  2026. is expanded in <var>filename</var>.
  2027. </p><div class="example">
  2028. <pre class="example">ffmpeg -i in.nut -strftime 1 -strftime_mkdir 1 -hls_segment_filename '%Y%m%d/file-%Y%m%d-%s.ts' out.m3u8
  2029. </pre></div>
  2030. <p>This example will create a directory 201560215 (if it does not exist), and then
  2031. produce the playlist, <samp>out.m3u8</samp>, and segment files:
  2032. <samp>20160215/file-20160215-1455569023.ts</samp>, <samp>20160215/file-20160215-1455569024.ts</samp>, etc.
  2033. </p>
  2034. <div class="example">
  2035. <pre class="example">ffmpeg -i in.nut -strftime 1 -strftime_mkdir 1 -hls_segment_filename '%Y/%m/%d/file-%Y%m%d-%s.ts' out.m3u8
  2036. </pre></div>
  2037. <p>This example will create a directory hierarchy 2016/02/15 (if any of them do not exist), and then
  2038. produce the playlist, <samp>out.m3u8</samp>, and segment files:
  2039. <samp>2016/02/15/file-20160215-1455569023.ts</samp>, <samp>2016/02/15/file-20160215-1455569024.ts</samp>, etc.
  2040. </p>
  2041. </dd>
  2042. <dt><span><samp>hls_key_info_file <var>key_info_file</var></samp></span></dt>
  2043. <dd><p>Use the information in <var>key_info_file</var> for segment encryption. The first
  2044. line of <var>key_info_file</var> specifies the key URI written to the playlist. The
  2045. key URL is used to access the encryption key during playback. The second line
  2046. specifies the path to the key file used to obtain the key during the encryption
  2047. process. The key file is read as a single packed array of 16 octets in binary
  2048. format. The optional third line specifies the initialization vector (IV) as a
  2049. hexadecimal string to be used instead of the segment sequence number (default)
  2050. for encryption. Changes to <var>key_info_file</var> will result in segment
  2051. encryption with the new key/IV and an entry in the playlist for the new key
  2052. URI/IV if <code>hls_flags periodic_rekey</code> is enabled.
  2053. </p>
  2054. <p>Key info file format:
  2055. </p><div class="example">
  2056. <pre class="example"><var>key URI</var>
  2057. <var>key file path</var>
  2058. <var>IV</var> (optional)
  2059. </pre></div>
  2060. <p>Example key URIs:
  2061. </p><div class="example">
  2062. <pre class="example">http://server/file.key
  2063. /path/to/file.key
  2064. file.key
  2065. </pre></div>
  2066. <p>Example key file paths:
  2067. </p><div class="example">
  2068. <pre class="example">file.key
  2069. /path/to/file.key
  2070. </pre></div>
  2071. <p>Example IV:
  2072. </p><div class="example">
  2073. <pre class="example">0123456789ABCDEF0123456789ABCDEF
  2074. </pre></div>
  2075. <p>Key info file example:
  2076. </p><div class="example">
  2077. <pre class="example">http://server/file.key
  2078. /path/to/file.key
  2079. 0123456789ABCDEF0123456789ABCDEF
  2080. </pre></div>
  2081. <p>Example shell script:
  2082. </p><div class="example">
  2083. <pre class="example">#!/bin/sh
  2084. BASE_URL=${1:-'.'}
  2085. openssl rand 16 &gt; file.key
  2086. echo $BASE_URL/file.key &gt; file.keyinfo
  2087. echo file.key &gt;&gt; file.keyinfo
  2088. echo $(openssl rand -hex 16) &gt;&gt; file.keyinfo
  2089. ffmpeg -f lavfi -re -i testsrc -c:v h264 -hls_flags delete_segments \
  2090. -hls_key_info_file file.keyinfo out.m3u8
  2091. </pre></div>
  2092. </dd>
  2093. <dt><span><samp>-hls_enc <var>enc</var></samp></span></dt>
  2094. <dd><p>Enable (1) or disable (0) the AES128 encryption.
  2095. When enabled every segment generated is encrypted and the encryption key
  2096. is saved as <var>playlist name</var>.key.
  2097. </p>
  2098. </dd>
  2099. <dt><span><samp>-hls_enc_key <var>key</var></samp></span></dt>
  2100. <dd><p>16-octet key to encrypt the segments, by default it
  2101. is randomly generated.
  2102. </p>
  2103. </dd>
  2104. <dt><span><samp>-hls_enc_key_url <var>keyurl</var></samp></span></dt>
  2105. <dd><p>If set, <var>keyurl</var> is prepended instead of <var>baseurl</var> to the key filename
  2106. in the playlist.
  2107. </p>
  2108. </dd>
  2109. <dt><span><samp>-hls_enc_iv <var>iv</var></samp></span></dt>
  2110. <dd><p>16-octet initialization vector for every segment instead
  2111. of the autogenerated ones.
  2112. </p>
  2113. </dd>
  2114. <dt><span><samp>hls_segment_type <var>flags</var></samp></span></dt>
  2115. <dd><p>Possible values:
  2116. </p>
  2117. <dl compact="compact">
  2118. <dt><span>&lsquo;<samp>mpegts</samp>&rsquo;</span></dt>
  2119. <dd><p>Output segment files in MPEG-2 Transport Stream format. This is
  2120. compatible with all HLS versions.
  2121. </p>
  2122. </dd>
  2123. <dt><span>&lsquo;<samp>fmp4</samp>&rsquo;</span></dt>
  2124. <dd><p>Output segment files in fragmented MP4 format, similar to MPEG-DASH.
  2125. fmp4 files may be used in HLS version 7 and above.
  2126. </p>
  2127. </dd>
  2128. </dl>
  2129. </dd>
  2130. <dt><span><samp>hls_fmp4_init_filename <var>filename</var></samp></span></dt>
  2131. <dd><p>Set filename to the fragment files header file, default filename is <samp>init.mp4</samp>.
  2132. </p>
  2133. <p>Use <code>-strftime 1</code> on <var>filename</var> to expand the segment filename with localtime.
  2134. </p><div class="example">
  2135. <pre class="example">ffmpeg -i in.nut -hls_segment_type fmp4 -strftime 1 -hls_fmp4_init_filename &quot;%s_init.mp4&quot; out.m3u8
  2136. </pre></div>
  2137. <p>This will produce init like this
  2138. <samp>1602678741_init.mp4</samp>
  2139. </p>
  2140. </dd>
  2141. <dt><span><samp>hls_fmp4_init_resend</samp></span></dt>
  2142. <dd><p>Resend init file after m3u8 file refresh every time, default is <var>0</var>.
  2143. </p>
  2144. <p>When <code>var_stream_map</code> is set with two or more variant streams, the
  2145. <var>filename</var> pattern must contain the string &quot;%v&quot;, this string specifies
  2146. the position of variant stream index in the generated init file names.
  2147. The string &quot;%v&quot; may be present in the filename or in the last directory name
  2148. containing the file. If the string is present in the directory name, then
  2149. sub-directories are created after expanding the directory name pattern. This
  2150. enables creation of init files corresponding to different variant streams in
  2151. subdirectories.
  2152. </p>
  2153. </dd>
  2154. <dt><span><samp>hls_flags <var>flags</var></samp></span></dt>
  2155. <dd><p>Possible values:
  2156. </p>
  2157. <dl compact="compact">
  2158. <dt><span>&lsquo;<samp>single_file</samp>&rsquo;</span></dt>
  2159. <dd><p>If this flag is set, the muxer will store all segments in a single MPEG-TS
  2160. file, and will use byte ranges in the playlist. HLS playlists generated with
  2161. this way will have the version number 4.
  2162. For example:
  2163. </p><div class="example">
  2164. <pre class="example">ffmpeg -i in.nut -hls_flags single_file out.m3u8
  2165. </pre></div>
  2166. <p>Will produce the playlist, <samp>out.m3u8</samp>, and a single segment file,
  2167. <samp>out.ts</samp>.
  2168. </p>
  2169. </dd>
  2170. <dt><span>&lsquo;<samp>delete_segments</samp>&rsquo;</span></dt>
  2171. <dd><p>Segment files removed from the playlist are deleted after a period of time
  2172. equal to the duration of the segment plus the duration of the playlist.
  2173. </p>
  2174. </dd>
  2175. <dt><span>&lsquo;<samp>append_list</samp>&rsquo;</span></dt>
  2176. <dd><p>Append new segments into the end of old segment list,
  2177. and remove the <code>#EXT-X-ENDLIST</code> from the old segment list.
  2178. </p>
  2179. </dd>
  2180. <dt><span>&lsquo;<samp>round_durations</samp>&rsquo;</span></dt>
  2181. <dd><p>Round the duration info in the playlist file segment info to integer
  2182. values, instead of using floating point.
  2183. </p>
  2184. </dd>
  2185. <dt><span>&lsquo;<samp>discont_start</samp>&rsquo;</span></dt>
  2186. <dd><p>Add the <code>#EXT-X-DISCONTINUITY</code> tag to the playlist, before the
  2187. first segment&rsquo;s information.
  2188. </p>
  2189. </dd>
  2190. <dt><span>&lsquo;<samp>omit_endlist</samp>&rsquo;</span></dt>
  2191. <dd><p>Do not append the <code>EXT-X-ENDLIST</code> tag at the end of the playlist.
  2192. </p>
  2193. </dd>
  2194. <dt><span>&lsquo;<samp>periodic_rekey</samp>&rsquo;</span></dt>
  2195. <dd><p>The file specified by <code>hls_key_info_file</code> will be checked periodically and
  2196. detect updates to the encryption info. Be sure to replace this file atomically,
  2197. including the file containing the AES encryption key.
  2198. </p>
  2199. </dd>
  2200. <dt><span>&lsquo;<samp>independent_segments</samp>&rsquo;</span></dt>
  2201. <dd><p>Add the <code>#EXT-X-INDEPENDENT-SEGMENTS</code> to playlists that has video segments
  2202. and when all the segments of that playlist are guaranteed to start with a Key frame.
  2203. </p>
  2204. </dd>
  2205. <dt><span>&lsquo;<samp>iframes_only</samp>&rsquo;</span></dt>
  2206. <dd><p>Add the <code>#EXT-X-I-FRAMES-ONLY</code> to playlists that has video segments
  2207. and can play only I-frames in the <code>#EXT-X-BYTERANGE</code> mode.
  2208. </p>
  2209. </dd>
  2210. <dt><span>&lsquo;<samp>split_by_time</samp>&rsquo;</span></dt>
  2211. <dd><p>Allow segments to start on frames other than keyframes. This improves
  2212. behavior on some players when the time between keyframes is inconsistent,
  2213. but may make things worse on others, and can cause some oddities during
  2214. seeking. This flag should be used with the <code>hls_time</code> option.
  2215. </p>
  2216. </dd>
  2217. <dt><span>&lsquo;<samp>program_date_time</samp>&rsquo;</span></dt>
  2218. <dd><p>Generate <code>EXT-X-PROGRAM-DATE-TIME</code> tags.
  2219. </p>
  2220. </dd>
  2221. <dt><span>&lsquo;<samp>second_level_segment_index</samp>&rsquo;</span></dt>
  2222. <dd><p>Makes it possible to use segment indexes as %%d in hls_segment_filename expression
  2223. besides date/time values when strftime is on.
  2224. To get fixed width numbers with trailing zeroes, %%0xd format is available where x is the required width.
  2225. </p>
  2226. </dd>
  2227. <dt><span>&lsquo;<samp>second_level_segment_size</samp>&rsquo;</span></dt>
  2228. <dd><p>Makes it possible to use segment sizes (counted in bytes) as %%s in hls_segment_filename
  2229. expression besides date/time values when strftime is on.
  2230. To get fixed width numbers with trailing zeroes, %%0xs format is available where x is the required width.
  2231. </p>
  2232. </dd>
  2233. <dt><span>&lsquo;<samp>second_level_segment_duration</samp>&rsquo;</span></dt>
  2234. <dd><p>Makes it possible to use segment duration (calculated in microseconds) as %%t in hls_segment_filename
  2235. expression besides date/time values when strftime is on.
  2236. To get fixed width numbers with trailing zeroes, %%0xt format is available where x is the required width.
  2237. </p>
  2238. <div class="example">
  2239. <pre class="example">ffmpeg -i sample.mpeg \
  2240. -f hls -hls_time 3 -hls_list_size 5 \
  2241. -hls_flags second_level_segment_index+second_level_segment_size+second_level_segment_duration \
  2242. -strftime 1 -strftime_mkdir 1 -hls_segment_filename &quot;segment_%Y%m%d%H%M%S_%%04d_%%08s_%%013t.ts&quot; stream.m3u8
  2243. </pre></div>
  2244. <p>This will produce segments like this:
  2245. <samp>segment_20170102194334_0003_00122200_0000003000000.ts</samp>, <samp>segment_20170102194334_0004_00120072_0000003000000.ts</samp> etc.
  2246. </p>
  2247. </dd>
  2248. <dt><span>&lsquo;<samp>temp_file</samp>&rsquo;</span></dt>
  2249. <dd><p>Write segment data to filename.tmp and rename to filename only once the segment is complete. A webserver
  2250. serving up segments can be configured to reject requests to *.tmp to prevent access to in-progress segments
  2251. before they have been added to the m3u8 playlist. This flag also affects how m3u8 playlist files are created.
  2252. If this flag is set, all playlist files will written into temporary file and renamed after they are complete, similarly as segments are handled.
  2253. But playlists with <code>file</code> protocol and with type (<code>hls_playlist_type</code>) other than <code>vod</code>
  2254. are always written into temporary file regardless of this flag. Master playlist files (<code>master_pl_name</code>), if any, with <code>file</code> protocol,
  2255. are always written into temporary file regardless of this flag if <code>master_pl_publish_rate</code> value is other than zero.
  2256. </p>
  2257. </dd>
  2258. </dl>
  2259. </dd>
  2260. <dt><span><samp>hls_playlist_type event</samp></span></dt>
  2261. <dd><p>Emit <code>#EXT-X-PLAYLIST-TYPE:EVENT</code> in the m3u8 header. Forces
  2262. <samp>hls_list_size</samp> to 0; the playlist can only be appended to.
  2263. </p>
  2264. </dd>
  2265. <dt><span><samp>hls_playlist_type vod</samp></span></dt>
  2266. <dd><p>Emit <code>#EXT-X-PLAYLIST-TYPE:VOD</code> in the m3u8 header. Forces
  2267. <samp>hls_list_size</samp> to 0; the playlist must not change.
  2268. </p>
  2269. </dd>
  2270. <dt><span><samp>method</samp></span></dt>
  2271. <dd><p>Use the given HTTP method to create the hls files.
  2272. </p><div class="example">
  2273. <pre class="example">ffmpeg -re -i in.ts -f hls -method PUT http://example.com/live/out.m3u8
  2274. </pre></div>
  2275. <p>This example will upload all the mpegts segment files to the HTTP
  2276. server using the HTTP PUT method, and update the m3u8 files every
  2277. <code>refresh</code> times using the same method.
  2278. Note that the HTTP server must support the given method for uploading
  2279. files.
  2280. </p>
  2281. </dd>
  2282. <dt><span><samp>http_user_agent</samp></span></dt>
  2283. <dd><p>Override User-Agent field in HTTP header. Applicable only for HTTP output.
  2284. </p>
  2285. </dd>
  2286. <dt><span><samp>var_stream_map</samp></span></dt>
  2287. <dd><p>Map string which specifies how to group the audio, video and subtitle streams
  2288. into different variant streams. The variant stream groups are separated
  2289. by space.
  2290. Expected string format is like this &quot;a:0,v:0 a:1,v:1 ....&quot;. Here a:, v:, s: are
  2291. the keys to specify audio, video and subtitle streams respectively.
  2292. Allowed values are 0 to 9 (limited just based on practical usage).
  2293. </p>
  2294. <p>When there are two or more variant streams, the output filename pattern must
  2295. contain the string &quot;%v&quot;, this string specifies the position of variant stream
  2296. index in the output media playlist filenames. The string &quot;%v&quot; may be present in
  2297. the filename or in the last directory name containing the file. If the string is
  2298. present in the directory name, then sub-directories are created after expanding
  2299. the directory name pattern. This enables creation of variant streams in
  2300. subdirectories.
  2301. </p>
  2302. <div class="example">
  2303. <pre class="example">ffmpeg -re -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \
  2304. -map 0:v -map 0:a -map 0:v -map 0:a -f hls -var_stream_map &quot;v:0,a:0 v:1,a:1&quot; \
  2305. http://example.com/live/out_%v.m3u8
  2306. </pre></div>
  2307. <p>This example creates two hls variant streams. The first variant stream will
  2308. contain video stream of bitrate 1000k and audio stream of bitrate 64k and the
  2309. second variant stream will contain video stream of bitrate 256k and audio
  2310. stream of bitrate 32k. Here, two media playlist with file names out_0.m3u8 and
  2311. out_1.m3u8 will be created. If you want something meaningful text instead of indexes
  2312. in result names, you may specify names for each or some of the variants
  2313. as in the following example.
  2314. </p>
  2315. <div class="example">
  2316. <pre class="example">ffmpeg -re -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \
  2317. -map 0:v -map 0:a -map 0:v -map 0:a -f hls -var_stream_map &quot;v:0,a:0,name:my_hd v:1,a:1,name:my_sd&quot; \
  2318. http://example.com/live/out_%v.m3u8
  2319. </pre></div>
  2320. <p>This example creates two hls variant streams as in the previous one.
  2321. But here, the two media playlist with file names out_my_hd.m3u8 and
  2322. out_my_sd.m3u8 will be created.
  2323. </p>
  2324. <div class="example">
  2325. <pre class="example">ffmpeg -re -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k \
  2326. -map 0:v -map 0:a -map 0:v -f hls -var_stream_map &quot;v:0 a:0 v:1&quot; \
  2327. http://example.com/live/out_%v.m3u8
  2328. </pre></div>
  2329. <p>This example creates three hls variant streams. The first variant stream will
  2330. be a video only stream with video bitrate 1000k, the second variant stream will
  2331. be an audio only stream with bitrate 64k and the third variant stream will be a
  2332. video only stream with bitrate 256k. Here, three media playlist with file names
  2333. out_0.m3u8, out_1.m3u8 and out_2.m3u8 will be created.
  2334. </p><div class="example">
  2335. <pre class="example">ffmpeg -re -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \
  2336. -map 0:v -map 0:a -map 0:v -map 0:a -f hls -var_stream_map &quot;v:0,a:0 v:1,a:1&quot; \
  2337. http://example.com/live/vs_%v/out.m3u8
  2338. </pre></div>
  2339. <p>This example creates the variant streams in subdirectories. Here, the first
  2340. media playlist is created at <samp>http://example.com/live/vs_0/out.m3u8</samp> and
  2341. the second one at <samp>http://example.com/live/vs_1/out.m3u8</samp>.
  2342. </p><div class="example">
  2343. <pre class="example">ffmpeg -re -i in.ts -b:a:0 32k -b:a:1 64k -b:v:0 1000k -b:v:1 3000k \
  2344. -map 0:a -map 0:a -map 0:v -map 0:v -f hls \
  2345. -var_stream_map &quot;a:0,agroup:aud_low a:1,agroup:aud_high v:0,agroup:aud_low v:1,agroup:aud_high&quot; \
  2346. -master_pl_name master.m3u8 \
  2347. http://example.com/live/out_%v.m3u8
  2348. </pre></div>
  2349. <p>This example creates two audio only and two video only variant streams. In
  2350. addition to the #EXT-X-STREAM-INF tag for each variant stream in the master
  2351. playlist, #EXT-X-MEDIA tag is also added for the two audio only variant streams
  2352. and they are mapped to the two video only variant streams with audio group names
  2353. &rsquo;aud_low&rsquo; and &rsquo;aud_high&rsquo;.
  2354. </p>
  2355. <p>By default, a single hls variant containing all the encoded streams is created.
  2356. </p>
  2357. <div class="example">
  2358. <pre class="example">ffmpeg -re -i in.ts -b:a:0 32k -b:a:1 64k -b:v:0 1000k \
  2359. -map 0:a -map 0:a -map 0:v -f hls \
  2360. -var_stream_map &quot;a:0,agroup:aud_low,default:yes a:1,agroup:aud_low v:0,agroup:aud_low&quot; \
  2361. -master_pl_name master.m3u8 \
  2362. http://example.com/live/out_%v.m3u8
  2363. </pre></div>
  2364. <p>This example creates two audio only and one video only variant streams. In
  2365. addition to the #EXT-X-STREAM-INF tag for each variant stream in the master
  2366. playlist, #EXT-X-MEDIA tag is also added for the two audio only variant streams
  2367. and they are mapped to the one video only variant streams with audio group name
  2368. &rsquo;aud_low&rsquo;, and the audio group have default stat is NO or YES.
  2369. </p>
  2370. <p>By default, a single hls variant containing all the encoded streams is created.
  2371. </p>
  2372. <div class="example">
  2373. <pre class="example">ffmpeg -re -i in.ts -b:a:0 32k -b:a:1 64k -b:v:0 1000k \
  2374. -map 0:a -map 0:a -map 0:v -f hls \
  2375. -var_stream_map &quot;a:0,agroup:aud_low,default:yes,language:ENG a:1,agroup:aud_low,language:CHN v:0,agroup:aud_low&quot; \
  2376. -master_pl_name master.m3u8 \
  2377. http://example.com/live/out_%v.m3u8
  2378. </pre></div>
  2379. <p>This example creates two audio only and one video only variant streams. In
  2380. addition to the #EXT-X-STREAM-INF tag for each variant stream in the master
  2381. playlist, #EXT-X-MEDIA tag is also added for the two audio only variant streams
  2382. and they are mapped to the one video only variant streams with audio group name
  2383. &rsquo;aud_low&rsquo;, and the audio group have default stat is NO or YES, and one audio
  2384. have and language is named ENG, the other audio language is named CHN.
  2385. </p>
  2386. <p>By default, a single hls variant containing all the encoded streams is created.
  2387. </p>
  2388. <div class="example">
  2389. <pre class="example">ffmpeg -y -i input_with_subtitle.mkv \
  2390. -b:v:0 5250k -c:v h264 -pix_fmt yuv420p -profile:v main -level 4.1 \
  2391. -b:a:0 256k \
  2392. -c:s webvtt -c:a mp2 -ar 48000 -ac 2 -map 0:v -map 0:a:0 -map 0:s:0 \
  2393. -f hls -var_stream_map &quot;v:0,a:0,s:0,sgroup:subtitle&quot; \
  2394. -master_pl_name master.m3u8 -t 300 -hls_time 10 -hls_init_time 4 -hls_list_size \
  2395. 10 -master_pl_publish_rate 10 -hls_flags \
  2396. delete_segments+discont_start+split_by_time ./tmp/video.m3u8
  2397. </pre></div>
  2398. <p>This example adds <code>#EXT-X-MEDIA</code> tag with <code>TYPE=SUBTITLES</code> in
  2399. the master playlist with webvtt subtitle group name &rsquo;subtitle&rsquo;. Please make sure
  2400. the input file has one text subtitle stream at least.
  2401. </p>
  2402. </dd>
  2403. <dt><span><samp>cc_stream_map</samp></span></dt>
  2404. <dd><p>Map string which specifies different closed captions groups and their
  2405. attributes. The closed captions stream groups are separated by space.
  2406. Expected string format is like this
  2407. &quot;ccgroup:&lt;group name&gt;,instreamid:&lt;INSTREAM-ID&gt;,language:&lt;language code&gt; ....&quot;.
  2408. &rsquo;ccgroup&rsquo; and &rsquo;instreamid&rsquo; are mandatory attributes. &rsquo;language&rsquo; is an optional
  2409. attribute.
  2410. The closed captions groups configured using this option are mapped to different
  2411. variant streams by providing the same &rsquo;ccgroup&rsquo; name in the
  2412. <code>var_stream_map</code> string. If <code>var_stream_map</code> is not set, then the
  2413. first available ccgroup in <code>cc_stream_map</code> is mapped to the output variant
  2414. stream. The examples for these two use cases are given below.
  2415. </p>
  2416. <div class="example">
  2417. <pre class="example">ffmpeg -re -i in.ts -b:v 1000k -b:a 64k -a53cc 1 -f hls \
  2418. -cc_stream_map &quot;ccgroup:cc,instreamid:CC1,language:en&quot; \
  2419. -master_pl_name master.m3u8 \
  2420. http://example.com/live/out.m3u8
  2421. </pre></div>
  2422. <p>This example adds <code>#EXT-X-MEDIA</code> tag with <code>TYPE=CLOSED-CAPTIONS</code> in
  2423. the master playlist with group name &rsquo;cc&rsquo;, language &rsquo;en&rsquo; (english) and
  2424. INSTREAM-ID &rsquo;CC1&rsquo;. Also, it adds <code>CLOSED-CAPTIONS</code> attribute with group
  2425. name &rsquo;cc&rsquo; for the output variant stream.
  2426. </p><div class="example">
  2427. <pre class="example">ffmpeg -re -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \
  2428. -a53cc:0 1 -a53cc:1 1\
  2429. -map 0:v -map 0:a -map 0:v -map 0:a -f hls \
  2430. -cc_stream_map &quot;ccgroup:cc,instreamid:CC1,language:en ccgroup:cc,instreamid:CC2,language:sp&quot; \
  2431. -var_stream_map &quot;v:0,a:0,ccgroup:cc v:1,a:1,ccgroup:cc&quot; \
  2432. -master_pl_name master.m3u8 \
  2433. http://example.com/live/out_%v.m3u8
  2434. </pre></div>
  2435. <p>This example adds two <code>#EXT-X-MEDIA</code> tags with <code>TYPE=CLOSED-CAPTIONS</code> in
  2436. the master playlist for the INSTREAM-IDs &rsquo;CC1&rsquo; and &rsquo;CC2&rsquo;. Also, it adds
  2437. <code>CLOSED-CAPTIONS</code> attribute with group name &rsquo;cc&rsquo; for the two output variant
  2438. streams.
  2439. </p>
  2440. </dd>
  2441. <dt><span><samp>master_pl_name</samp></span></dt>
  2442. <dd><p>Create HLS master playlist with the given name.
  2443. </p>
  2444. <div class="example">
  2445. <pre class="example">ffmpeg -re -i in.ts -f hls -master_pl_name master.m3u8 http://example.com/live/out.m3u8
  2446. </pre></div>
  2447. <p>This example creates HLS master playlist with name master.m3u8 and it is
  2448. published at http://example.com/live/
  2449. </p>
  2450. </dd>
  2451. <dt><span><samp>master_pl_publish_rate</samp></span></dt>
  2452. <dd><p>Publish master play list repeatedly every after specified number of segment intervals.
  2453. </p>
  2454. <div class="example">
  2455. <pre class="example">ffmpeg -re -i in.ts -f hls -master_pl_name master.m3u8 \
  2456. -hls_time 2 -master_pl_publish_rate 30 http://example.com/live/out.m3u8
  2457. </pre></div>
  2458. <p>This example creates HLS master playlist with name master.m3u8 and keep
  2459. publishing it repeatedly every after 30 segments i.e. every after 60s.
  2460. </p>
  2461. </dd>
  2462. <dt><span><samp>http_persistent</samp></span></dt>
  2463. <dd><p>Use persistent HTTP connections. Applicable only for HTTP output.
  2464. </p>
  2465. </dd>
  2466. <dt><span><samp>timeout</samp></span></dt>
  2467. <dd><p>Set timeout for socket I/O operations. Applicable only for HTTP output.
  2468. </p>
  2469. </dd>
  2470. <dt><span><samp>-ignore_io_errors</samp></span></dt>
  2471. <dd><p>Ignore IO errors during open, write and delete. Useful for long-duration runs with network output.
  2472. </p>
  2473. </dd>
  2474. <dt><span><samp>headers</samp></span></dt>
  2475. <dd><p>Set custom HTTP headers, can override built in default headers. Applicable only for HTTP output.
  2476. </p>
  2477. </dd>
  2478. </dl>
  2479. <span id="ico"></span><a name="ico-1"></a>
  2480. <h3 class="section">4.14 ico<span class="pull-right"><a class="anchor hidden-xs" href="#ico-1" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-ico-1" aria-hidden="true">TOC</a></span></h3>
  2481. <p>ICO file muxer.
  2482. </p>
  2483. <p>Microsoft&rsquo;s icon file format (ICO) has some strict limitations that should be noted:
  2484. </p>
  2485. <ul>
  2486. <li> Size cannot exceed 256 pixels in any dimension
  2487. </li><li> Only BMP and PNG images can be stored
  2488. </li><li> If a BMP image is used, it must be one of the following pixel formats:
  2489. <div class="example">
  2490. <pre class="example">BMP Bit Depth FFmpeg Pixel Format
  2491. 1bit pal8
  2492. 4bit pal8
  2493. 8bit pal8
  2494. 16bit rgb555le
  2495. 24bit bgr24
  2496. 32bit bgra
  2497. </pre></div>
  2498. </li><li> If a BMP image is used, it must use the BITMAPINFOHEADER DIB header
  2499. </li><li> If a PNG image is used, it must use the rgba pixel format
  2500. </li></ul>
  2501. <span id="image2"></span><a name="image2-2"></a>
  2502. <h3 class="section">4.15 image2<span class="pull-right"><a class="anchor hidden-xs" href="#image2-2" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-image2-2" aria-hidden="true">TOC</a></span></h3>
  2503. <p>Image file muxer.
  2504. </p>
  2505. <p>The image file muxer writes video frames to image files.
  2506. </p>
  2507. <p>The output filenames are specified by a pattern, which can be used to
  2508. produce sequentially numbered series of files.
  2509. The pattern may contain the string &quot;%d&quot; or &quot;%0<var>N</var>d&quot;, this string
  2510. specifies the position of the characters representing a numbering in
  2511. the filenames. If the form &quot;%0<var>N</var>d&quot; is used, the string
  2512. representing the number in each filename is 0-padded to <var>N</var>
  2513. digits. The literal character &rsquo;%&rsquo; can be specified in the pattern with
  2514. the string &quot;%%&quot;.
  2515. </p>
  2516. <p>If the pattern contains &quot;%d&quot; or &quot;%0<var>N</var>d&quot;, the first filename of
  2517. the file list specified will contain the number 1, all the following
  2518. numbers will be sequential.
  2519. </p>
  2520. <p>The pattern may contain a suffix which is used to automatically
  2521. determine the format of the image files to write.
  2522. </p>
  2523. <p>For example the pattern &quot;img-%03d.bmp&quot; will specify a sequence of
  2524. filenames of the form <samp>img-001.bmp</samp>, <samp>img-002.bmp</samp>, ...,
  2525. <samp>img-010.bmp</samp>, etc.
  2526. The pattern &quot;img%%-%d.jpg&quot; will specify a sequence of filenames of the
  2527. form <samp>img%-1.jpg</samp>, <samp>img%-2.jpg</samp>, ..., <samp>img%-10.jpg</samp>,
  2528. etc.
  2529. </p>
  2530. <p>The image muxer supports the .Y.U.V image file format. This format is
  2531. special in that that each image frame consists of three files, for
  2532. each of the YUV420P components. To read or write this image file format,
  2533. specify the name of the &rsquo;.Y&rsquo; file. The muxer will automatically open the
  2534. &rsquo;.U&rsquo; and &rsquo;.V&rsquo; files as required.
  2535. </p>
  2536. <a name="Options-7"></a>
  2537. <h4 class="subsection">4.15.1 Options<span class="pull-right"><a class="anchor hidden-xs" href="#Options-7" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Options-7" aria-hidden="true">TOC</a></span></h4>
  2538. <dl compact="compact">
  2539. <dt><span><samp>frame_pts</samp></span></dt>
  2540. <dd><p>If set to 1, expand the filename with pts from pkt-&gt;pts.
  2541. Default value is 0.
  2542. </p>
  2543. </dd>
  2544. <dt><span><samp>start_number</samp></span></dt>
  2545. <dd><p>Start the sequence from the specified number. Default value is 1.
  2546. </p>
  2547. </dd>
  2548. <dt><span><samp>update</samp></span></dt>
  2549. <dd><p>If set to 1, the filename will always be interpreted as just a
  2550. filename, not a pattern, and the corresponding file will be continuously
  2551. overwritten with new images. Default value is 0.
  2552. </p>
  2553. </dd>
  2554. <dt><span><samp>strftime</samp></span></dt>
  2555. <dd><p>If set to 1, expand the filename with date and time information from
  2556. <code>strftime()</code>. Default value is 0.
  2557. </p>
  2558. </dd>
  2559. <dt><span><samp>protocol_opts <var>options_list</var></samp></span></dt>
  2560. <dd><p>Set protocol options as a :-separated list of key=value parameters. Values
  2561. containing the <code>:</code> special character must be escaped.
  2562. </p>
  2563. </dd>
  2564. </dl>
  2565. <a name="Examples-7"></a>
  2566. <h4 class="subsection">4.15.2 Examples<span class="pull-right"><a class="anchor hidden-xs" href="#Examples-7" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Examples-7" aria-hidden="true">TOC</a></span></h4>
  2567. <p>The following example shows how to use <code>ffmpeg</code> for creating a
  2568. sequence of files <samp>img-001.jpeg</samp>, <samp>img-002.jpeg</samp>, ...,
  2569. taking one image every second from the input video:
  2570. </p><div class="example">
  2571. <pre class="example">ffmpeg -i in.avi -vsync cfr -r 1 -f image2 'img-%03d.jpeg'
  2572. </pre></div>
  2573. <p>Note that with <code>ffmpeg</code>, if the format is not specified with the
  2574. <code>-f</code> option and the output filename specifies an image file
  2575. format, the image2 muxer is automatically selected, so the previous
  2576. command can be written as:
  2577. </p><div class="example">
  2578. <pre class="example">ffmpeg -i in.avi -vsync cfr -r 1 'img-%03d.jpeg'
  2579. </pre></div>
  2580. <p>Note also that the pattern must not necessarily contain &quot;%d&quot; or
  2581. &quot;%0<var>N</var>d&quot;, for example to create a single image file
  2582. <samp>img.jpeg</samp> from the start of the input video you can employ the command:
  2583. </p><div class="example">
  2584. <pre class="example">ffmpeg -i in.avi -f image2 -frames:v 1 img.jpeg
  2585. </pre></div>
  2586. <p>The <samp>strftime</samp> option allows you to expand the filename with
  2587. date and time information. Check the documentation of
  2588. the <code>strftime()</code> function for the syntax.
  2589. </p>
  2590. <p>For example to generate image files from the <code>strftime()</code>
  2591. &quot;%Y-%m-%d_%H-%M-%S&quot; pattern, the following <code>ffmpeg</code> command
  2592. can be used:
  2593. </p><div class="example">
  2594. <pre class="example">ffmpeg -f v4l2 -r 1 -i /dev/video0 -f image2 -strftime 1 &quot;%Y-%m-%d_%H-%M-%S.jpg&quot;
  2595. </pre></div>
  2596. <p>You can set the file name with current frame&rsquo;s PTS:
  2597. </p><div class="example">
  2598. <pre class="example">ffmpeg -f v4l2 -r 1 -i /dev/video0 -copyts -f image2 -frame_pts true %d.jpg&quot;
  2599. </pre></div>
  2600. <p>A more complex example is to publish contents of your desktop directly to a
  2601. WebDAV server every second:
  2602. </p><div class="example">
  2603. <pre class="example">ffmpeg -f x11grab -framerate 1 -i :0.0 -q:v 6 -update 1 -protocol_opts method=PUT http://example.com/desktop.jpg
  2604. </pre></div>
  2605. <a name="matroska"></a>
  2606. <h3 class="section">4.16 matroska<span class="pull-right"><a class="anchor hidden-xs" href="#matroska" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-matroska" aria-hidden="true">TOC</a></span></h3>
  2607. <p>Matroska container muxer.
  2608. </p>
  2609. <p>This muxer implements the matroska and webm container specs.
  2610. </p>
  2611. <a name="Metadata"></a>
  2612. <h4 class="subsection">4.16.1 Metadata<span class="pull-right"><a class="anchor hidden-xs" href="#Metadata" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Metadata" aria-hidden="true">TOC</a></span></h4>
  2613. <p>The recognized metadata settings in this muxer are:
  2614. </p>
  2615. <dl compact="compact">
  2616. <dt><span><samp>title</samp></span></dt>
  2617. <dd><p>Set title name provided to a single track. This gets mapped to
  2618. the FileDescription element for a stream written as attachment.
  2619. </p>
  2620. </dd>
  2621. <dt><span><samp>language</samp></span></dt>
  2622. <dd><p>Specify the language of the track in the Matroska languages form.
  2623. </p>
  2624. <p>The language can be either the 3 letters bibliographic ISO-639-2 (ISO
  2625. 639-2/B) form (like &quot;fre&quot; for French), or a language code mixed with a
  2626. country code for specialities in languages (like &quot;fre-ca&quot; for Canadian
  2627. French).
  2628. </p>
  2629. </dd>
  2630. <dt><span><samp>stereo_mode</samp></span></dt>
  2631. <dd><p>Set stereo 3D video layout of two views in a single video track.
  2632. </p>
  2633. <p>The following values are recognized:
  2634. </p><dl compact="compact">
  2635. <dt><span>&lsquo;<samp>mono</samp>&rsquo;</span></dt>
  2636. <dd><p>video is not stereo
  2637. </p></dd>
  2638. <dt><span>&lsquo;<samp>left_right</samp>&rsquo;</span></dt>
  2639. <dd><p>Both views are arranged side by side, Left-eye view is on the left
  2640. </p></dd>
  2641. <dt><span>&lsquo;<samp>bottom_top</samp>&rsquo;</span></dt>
  2642. <dd><p>Both views are arranged in top-bottom orientation, Left-eye view is at bottom
  2643. </p></dd>
  2644. <dt><span>&lsquo;<samp>top_bottom</samp>&rsquo;</span></dt>
  2645. <dd><p>Both views are arranged in top-bottom orientation, Left-eye view is on top
  2646. </p></dd>
  2647. <dt><span>&lsquo;<samp>checkerboard_rl</samp>&rsquo;</span></dt>
  2648. <dd><p>Each view is arranged in a checkerboard interleaved pattern, Left-eye view being first
  2649. </p></dd>
  2650. <dt><span>&lsquo;<samp>checkerboard_lr</samp>&rsquo;</span></dt>
  2651. <dd><p>Each view is arranged in a checkerboard interleaved pattern, Right-eye view being first
  2652. </p></dd>
  2653. <dt><span>&lsquo;<samp>row_interleaved_rl</samp>&rsquo;</span></dt>
  2654. <dd><p>Each view is constituted by a row based interleaving, Right-eye view is first row
  2655. </p></dd>
  2656. <dt><span>&lsquo;<samp>row_interleaved_lr</samp>&rsquo;</span></dt>
  2657. <dd><p>Each view is constituted by a row based interleaving, Left-eye view is first row
  2658. </p></dd>
  2659. <dt><span>&lsquo;<samp>col_interleaved_rl</samp>&rsquo;</span></dt>
  2660. <dd><p>Both views are arranged in a column based interleaving manner, Right-eye view is first column
  2661. </p></dd>
  2662. <dt><span>&lsquo;<samp>col_interleaved_lr</samp>&rsquo;</span></dt>
  2663. <dd><p>Both views are arranged in a column based interleaving manner, Left-eye view is first column
  2664. </p></dd>
  2665. <dt><span>&lsquo;<samp>anaglyph_cyan_red</samp>&rsquo;</span></dt>
  2666. <dd><p>All frames are in anaglyph format viewable through red-cyan filters
  2667. </p></dd>
  2668. <dt><span>&lsquo;<samp>right_left</samp>&rsquo;</span></dt>
  2669. <dd><p>Both views are arranged side by side, Right-eye view is on the left
  2670. </p></dd>
  2671. <dt><span>&lsquo;<samp>anaglyph_green_magenta</samp>&rsquo;</span></dt>
  2672. <dd><p>All frames are in anaglyph format viewable through green-magenta filters
  2673. </p></dd>
  2674. <dt><span>&lsquo;<samp>block_lr</samp>&rsquo;</span></dt>
  2675. <dd><p>Both eyes laced in one Block, Left-eye view is first
  2676. </p></dd>
  2677. <dt><span>&lsquo;<samp>block_rl</samp>&rsquo;</span></dt>
  2678. <dd><p>Both eyes laced in one Block, Right-eye view is first
  2679. </p></dd>
  2680. </dl>
  2681. </dd>
  2682. </dl>
  2683. <p>For example a 3D WebM clip can be created using the following command line:
  2684. </p><div class="example">
  2685. <pre class="example">ffmpeg -i sample_left_right_clip.mpg -an -c:v libvpx -metadata stereo_mode=left_right -y stereo_clip.webm
  2686. </pre></div>
  2687. <a name="Options-8"></a>
  2688. <h4 class="subsection">4.16.2 Options<span class="pull-right"><a class="anchor hidden-xs" href="#Options-8" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Options-8" aria-hidden="true">TOC</a></span></h4>
  2689. <p>This muxer supports the following options:
  2690. </p>
  2691. <dl compact="compact">
  2692. <dt><span><samp>reserve_index_space</samp></span></dt>
  2693. <dd><p>By default, this muxer writes the index for seeking (called cues in Matroska
  2694. terms) at the end of the file, because it cannot know in advance how much space
  2695. to leave for the index at the beginning of the file. However for some use cases
  2696. &ndash; e.g. streaming where seeking is possible but slow &ndash; it is useful to put the
  2697. index at the beginning of the file.
  2698. </p>
  2699. <p>If this option is set to a non-zero value, the muxer will reserve a given amount
  2700. of space in the file header and then try to write the cues there when the muxing
  2701. finishes. If the reserved space does not suffice, no Cues will be written, the
  2702. file will be finalized and writing the trailer will return an error.
  2703. A safe size for most use cases should be about 50kB per hour of video.
  2704. </p>
  2705. <p>Note that cues are only written if the output is seekable and this option will
  2706. have no effect if it is not.
  2707. </p></dd>
  2708. <dt><span><samp>default_mode</samp></span></dt>
  2709. <dd><p>This option controls how the FlagDefault of the output tracks will be set.
  2710. It influences which tracks players should play by default. The default mode
  2711. is &lsquo;<samp>infer</samp>&rsquo;.
  2712. </p><dl compact="compact">
  2713. <dt><span>&lsquo;<samp>infer</samp>&rsquo;</span></dt>
  2714. <dd><p>In this mode, for each type of track (audio, video or subtitle), if there is
  2715. a track with disposition default of this type, then the first such track
  2716. (i.e. the one with the lowest index) will be marked as default; if no such
  2717. track exists, the first track of this type will be marked as default instead
  2718. (if existing). This ensures that the default flag is set in a sensible way even
  2719. if the input originated from containers that lack the concept of default tracks.
  2720. </p></dd>
  2721. <dt><span>&lsquo;<samp>infer_no_subs</samp>&rsquo;</span></dt>
  2722. <dd><p>This mode is the same as infer except that if no subtitle track with
  2723. disposition default exists, no subtitle track will be marked as default.
  2724. </p></dd>
  2725. <dt><span>&lsquo;<samp>passthrough</samp>&rsquo;</span></dt>
  2726. <dd><p>In this mode the FlagDefault is set if and only if the AV_DISPOSITION_DEFAULT
  2727. flag is set in the disposition of the corresponding stream.
  2728. </p></dd>
  2729. </dl>
  2730. </dd>
  2731. <dt><span><samp>flipped_raw_rgb</samp></span></dt>
  2732. <dd><p>If set to true, store positive height for raw RGB bitmaps, which indicates
  2733. bitmap is stored bottom-up. Note that this option does not flip the bitmap
  2734. which has to be done manually beforehand, e.g. by using the vflip filter.
  2735. Default is <var>false</var> and indicates bitmap is stored top down.
  2736. </p>
  2737. </dd>
  2738. </dl>
  2739. <span id="md5"></span><a name="md5-1"></a>
  2740. <h3 class="section">4.17 md5<span class="pull-right"><a class="anchor hidden-xs" href="#md5-1" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-md5-1" aria-hidden="true">TOC</a></span></h3>
  2741. <p>MD5 testing format.
  2742. </p>
  2743. <p>This is a variant of the <a href="#hash">hash</a> muxer. Unlike that muxer, it
  2744. defaults to using the MD5 hash function.
  2745. </p>
  2746. <a name="Examples-8"></a>
  2747. <h4 class="subsection">4.17.1 Examples<span class="pull-right"><a class="anchor hidden-xs" href="#Examples-8" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Examples-8" aria-hidden="true">TOC</a></span></h4>
  2748. <p>To compute the MD5 hash of the input converted to raw
  2749. audio and video, and store it in the file <samp>out.md5</samp>:
  2750. </p><div class="example">
  2751. <pre class="example">ffmpeg -i INPUT -f md5 out.md5
  2752. </pre></div>
  2753. <p>You can print the MD5 to stdout with the command:
  2754. </p><div class="example">
  2755. <pre class="example">ffmpeg -i INPUT -f md5 -
  2756. </pre></div>
  2757. <p>See also the <a href="#hash">hash</a> and <a href="#framemd5">framemd5</a> muxers.
  2758. </p>
  2759. <a name="mov_002c-mp4_002c-ismv"></a>
  2760. <h3 class="section">4.18 mov, mp4, ismv<span class="pull-right"><a class="anchor hidden-xs" href="#mov_002c-mp4_002c-ismv" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-mov_002c-mp4_002c-ismv" aria-hidden="true">TOC</a></span></h3>
  2761. <p>MOV/MP4/ISMV (Smooth Streaming) muxer.
  2762. </p>
  2763. <p>The mov/mp4/ismv muxer supports fragmentation. Normally, a MOV/MP4
  2764. file has all the metadata about all packets stored in one location
  2765. (written at the end of the file, it can be moved to the start for
  2766. better playback by adding <var>faststart</var> to the <var>movflags</var>, or
  2767. using the <code>qt-faststart</code> tool). A fragmented
  2768. file consists of a number of fragments, where packets and metadata
  2769. about these packets are stored together. Writing a fragmented
  2770. file has the advantage that the file is decodable even if the
  2771. writing is interrupted (while a normal MOV/MP4 is undecodable if
  2772. it is not properly finished), and it requires less memory when writing
  2773. very long files (since writing normal MOV/MP4 files stores info about
  2774. every single packet in memory until the file is closed). The downside
  2775. is that it is less compatible with other applications.
  2776. </p>
  2777. <a name="Options-9"></a>
  2778. <h4 class="subsection">4.18.1 Options<span class="pull-right"><a class="anchor hidden-xs" href="#Options-9" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Options-9" aria-hidden="true">TOC</a></span></h4>
  2779. <p>Fragmentation is enabled by setting one of the AVOptions that define
  2780. how to cut the file into fragments:
  2781. </p>
  2782. <dl compact="compact">
  2783. <dt><span><samp>-moov_size <var>bytes</var></samp></span></dt>
  2784. <dd><p>Reserves space for the moov atom at the beginning of the file instead of placing the
  2785. moov atom at the end. If the space reserved is insufficient, muxing will fail.
  2786. </p></dd>
  2787. <dt><span><samp>-movflags frag_keyframe</samp></span></dt>
  2788. <dd><p>Start a new fragment at each video keyframe.
  2789. </p></dd>
  2790. <dt><span><samp>-frag_duration <var>duration</var></samp></span></dt>
  2791. <dd><p>Create fragments that are <var>duration</var> microseconds long.
  2792. </p></dd>
  2793. <dt><span><samp>-frag_size <var>size</var></samp></span></dt>
  2794. <dd><p>Create fragments that contain up to <var>size</var> bytes of payload data.
  2795. </p></dd>
  2796. <dt><span><samp>-movflags frag_custom</samp></span></dt>
  2797. <dd><p>Allow the caller to manually choose when to cut fragments, by
  2798. calling <code>av_write_frame(ctx, NULL)</code> to write a fragment with
  2799. the packets written so far. (This is only useful with other
  2800. applications integrating libavformat, not from <code>ffmpeg</code>.)
  2801. </p></dd>
  2802. <dt><span><samp>-min_frag_duration <var>duration</var></samp></span></dt>
  2803. <dd><p>Don&rsquo;t create fragments that are shorter than <var>duration</var> microseconds long.
  2804. </p></dd>
  2805. </dl>
  2806. <p>If more than one condition is specified, fragments are cut when
  2807. one of the specified conditions is fulfilled. The exception to this is
  2808. <code>-min_frag_duration</code>, which has to be fulfilled for any of the other
  2809. conditions to apply.
  2810. </p>
  2811. <p>Additionally, the way the output file is written can be adjusted
  2812. through a few other options:
  2813. </p>
  2814. <dl compact="compact">
  2815. <dt><span><samp>-movflags empty_moov</samp></span></dt>
  2816. <dd><p>Write an initial moov atom directly at the start of the file, without
  2817. describing any samples in it. Generally, an mdat/moov pair is written
  2818. at the start of the file, as a normal MOV/MP4 file, containing only
  2819. a short portion of the file. With this option set, there is no initial
  2820. mdat atom, and the moov atom only describes the tracks but has
  2821. a zero duration.
  2822. </p>
  2823. <p>This option is implicitly set when writing ismv (Smooth Streaming) files.
  2824. </p></dd>
  2825. <dt><span><samp>-movflags separate_moof</samp></span></dt>
  2826. <dd><p>Write a separate moof (movie fragment) atom for each track. Normally,
  2827. packets for all tracks are written in a moof atom (which is slightly
  2828. more efficient), but with this option set, the muxer writes one moof/mdat
  2829. pair for each track, making it easier to separate tracks.
  2830. </p>
  2831. <p>This option is implicitly set when writing ismv (Smooth Streaming) files.
  2832. </p></dd>
  2833. <dt><span><samp>-movflags skip_sidx</samp></span></dt>
  2834. <dd><p>Skip writing of sidx atom. When bitrate overhead due to sidx atom is high,
  2835. this option could be used for cases where sidx atom is not mandatory.
  2836. When global_sidx flag is enabled, this option will be ignored.
  2837. </p></dd>
  2838. <dt><span><samp>-movflags faststart</samp></span></dt>
  2839. <dd><p>Run a second pass moving the index (moov atom) to the beginning of the file.
  2840. This operation can take a while, and will not work in various situations such
  2841. as fragmented output, thus it is not enabled by default.
  2842. </p></dd>
  2843. <dt><span><samp>-movflags rtphint</samp></span></dt>
  2844. <dd><p>Add RTP hinting tracks to the output file.
  2845. </p></dd>
  2846. <dt><span><samp>-movflags disable_chpl</samp></span></dt>
  2847. <dd><p>Disable Nero chapter markers (chpl atom). Normally, both Nero chapters
  2848. and a QuickTime chapter track are written to the file. With this option
  2849. set, only the QuickTime chapter track will be written. Nero chapters can
  2850. cause failures when the file is reprocessed with certain tagging programs, like
  2851. mp3Tag 2.61a and iTunes 11.3, most likely other versions are affected as well.
  2852. </p></dd>
  2853. <dt><span><samp>-movflags omit_tfhd_offset</samp></span></dt>
  2854. <dd><p>Do not write any absolute base_data_offset in tfhd atoms. This avoids
  2855. tying fragments to absolute byte positions in the file/streams.
  2856. </p></dd>
  2857. <dt><span><samp>-movflags default_base_moof</samp></span></dt>
  2858. <dd><p>Similarly to the omit_tfhd_offset, this flag avoids writing the
  2859. absolute base_data_offset field in tfhd atoms, but does so by using
  2860. the new default-base-is-moof flag instead. This flag is new from
  2861. 14496-12:2012. This may make the fragments easier to parse in certain
  2862. circumstances (avoiding basing track fragment location calculations
  2863. on the implicit end of the previous track fragment).
  2864. </p></dd>
  2865. <dt><span><samp>-write_tmcd</samp></span></dt>
  2866. <dd><p>Specify <code>on</code> to force writing a timecode track, <code>off</code> to disable it
  2867. and <code>auto</code> to write a timecode track only for mov and mp4 output (default).
  2868. </p></dd>
  2869. <dt><span><samp>-movflags negative_cts_offsets</samp></span></dt>
  2870. <dd><p>Enables utilization of version 1 of the CTTS box, in which the CTS offsets can
  2871. be negative. This enables the initial sample to have DTS/CTS of zero, and
  2872. reduces the need for edit lists for some cases such as video tracks with
  2873. B-frames. Additionally, eases conformance with the DASH-IF interoperability
  2874. guidelines.
  2875. </p>
  2876. <p>This option is implicitly set when writing ismv (Smooth Streaming) files.
  2877. </p></dd>
  2878. <dt><span><samp>-write_prft</samp></span></dt>
  2879. <dd><p>Write producer time reference box (PRFT) with a specified time source for the
  2880. NTP field in the PRFT box. Set value as &lsquo;<samp>wallclock</samp>&rsquo; to specify timesource
  2881. as wallclock time and &lsquo;<samp>pts</samp>&rsquo; to specify timesource as input packets&rsquo; PTS
  2882. values.
  2883. </p>
  2884. <p>Setting value to &lsquo;<samp>pts</samp>&rsquo; is applicable only for a live encoding use case,
  2885. where PTS values are set as as wallclock time at the source. For example, an
  2886. encoding use case with decklink capture source where <samp>video_pts</samp> and
  2887. <samp>audio_pts</samp> are set to &lsquo;<samp>abs_wallclock</samp>&rsquo;.
  2888. </p></dd>
  2889. </dl>
  2890. <a name="Example"></a>
  2891. <h4 class="subsection">4.18.2 Example<span class="pull-right"><a class="anchor hidden-xs" href="#Example" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Example" aria-hidden="true">TOC</a></span></h4>
  2892. <p>Smooth Streaming content can be pushed in real time to a publishing
  2893. point on IIS with this muxer. Example:
  2894. </p><div class="example">
  2895. <pre class="example">ffmpeg -re <var>&lt;normal input/transcoding options&gt;</var> -movflags isml+frag_keyframe -f ismv http://server/publishingpoint.isml/Streams(Encoder1)
  2896. </pre></div>
  2897. <a name="mp3"></a>
  2898. <h3 class="section">4.19 mp3<span class="pull-right"><a class="anchor hidden-xs" href="#mp3" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-mp3" aria-hidden="true">TOC</a></span></h3>
  2899. <p>The MP3 muxer writes a raw MP3 stream with the following optional features:
  2900. </p><ul>
  2901. <li> An ID3v2 metadata header at the beginning (enabled by default). Versions 2.3 and
  2902. 2.4 are supported, the <code>id3v2_version</code> private option controls which one is
  2903. used (3 or 4). Setting <code>id3v2_version</code> to 0 disables the ID3v2 header
  2904. completely.
  2905. <p>The muxer supports writing attached pictures (APIC frames) to the ID3v2 header.
  2906. The pictures are supplied to the muxer in form of a video stream with a single
  2907. packet. There can be any number of those streams, each will correspond to a
  2908. single APIC frame. The stream metadata tags <var>title</var> and <var>comment</var> map
  2909. to APIC <var>description</var> and <var>picture type</var> respectively. See
  2910. <a href="http://id3.org/id3v2.4.0-frames">http://id3.org/id3v2.4.0-frames</a> for allowed picture types.
  2911. </p>
  2912. <p>Note that the APIC frames must be written at the beginning, so the muxer will
  2913. buffer the audio frames until it gets all the pictures. It is therefore advised
  2914. to provide the pictures as soon as possible to avoid excessive buffering.
  2915. </p>
  2916. </li><li> A Xing/LAME frame right after the ID3v2 header (if present). It is enabled by
  2917. default, but will be written only if the output is seekable. The
  2918. <code>write_xing</code> private option can be used to disable it. The frame contains
  2919. various information that may be useful to the decoder, like the audio duration
  2920. or encoder delay.
  2921. </li><li> A legacy ID3v1 tag at the end of the file (disabled by default). It may be
  2922. enabled with the <code>write_id3v1</code> private option, but as its capabilities are
  2923. very limited, its usage is not recommended.
  2924. </li></ul>
  2925. <p>Examples:
  2926. </p>
  2927. <p>Write an mp3 with an ID3v2.3 header and an ID3v1 footer:
  2928. </p><div class="example">
  2929. <pre class="example">ffmpeg -i INPUT -id3v2_version 3 -write_id3v1 1 out.mp3
  2930. </pre></div>
  2931. <p>To attach a picture to an mp3 file select both the audio and the picture stream
  2932. with <code>map</code>:
  2933. </p><div class="example">
  2934. <pre class="example">ffmpeg -i input.mp3 -i cover.png -c copy -map 0 -map 1
  2935. -metadata:s:v title=&quot;Album cover&quot; -metadata:s:v comment=&quot;Cover (Front)&quot; out.mp3
  2936. </pre></div>
  2937. <p>Write a &quot;clean&quot; MP3 without any extra features:
  2938. </p><div class="example">
  2939. <pre class="example">ffmpeg -i input.wav -write_xing 0 -id3v2_version 0 out.mp3
  2940. </pre></div>
  2941. <a name="mpegts-1"></a>
  2942. <h3 class="section">4.20 mpegts<span class="pull-right"><a class="anchor hidden-xs" href="#mpegts-1" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-mpegts-1" aria-hidden="true">TOC</a></span></h3>
  2943. <p>MPEG transport stream muxer.
  2944. </p>
  2945. <p>This muxer implements ISO 13818-1 and part of ETSI EN 300 468.
  2946. </p>
  2947. <p>The recognized metadata settings in mpegts muxer are <code>service_provider</code>
  2948. and <code>service_name</code>. If they are not set the default for
  2949. <code>service_provider</code> is &lsquo;<samp>FFmpeg</samp>&rsquo; and the default for
  2950. <code>service_name</code> is &lsquo;<samp>Service01</samp>&rsquo;.
  2951. </p>
  2952. <a name="Options-10"></a>
  2953. <h4 class="subsection">4.20.1 Options<span class="pull-right"><a class="anchor hidden-xs" href="#Options-10" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Options-10" aria-hidden="true">TOC</a></span></h4>
  2954. <p>The muxer options are:
  2955. </p>
  2956. <dl compact="compact">
  2957. <dt><span><samp>mpegts_transport_stream_id <var>integer</var></samp></span></dt>
  2958. <dd><p>Set the &lsquo;<samp>transport_stream_id</samp>&rsquo;. This identifies a transponder in DVB.
  2959. Default is <code>0x0001</code>.
  2960. </p>
  2961. </dd>
  2962. <dt><span><samp>mpegts_original_network_id <var>integer</var></samp></span></dt>
  2963. <dd><p>Set the &lsquo;<samp>original_network_id</samp>&rsquo;. This is unique identifier of a
  2964. network in DVB. Its main use is in the unique identification of a service
  2965. through the path &lsquo;<samp>Original_Network_ID, Transport_Stream_ID</samp>&rsquo;. Default
  2966. is <code>0x0001</code>.
  2967. </p>
  2968. </dd>
  2969. <dt><span><samp>mpegts_service_id <var>integer</var></samp></span></dt>
  2970. <dd><p>Set the &lsquo;<samp>service_id</samp>&rsquo;, also known as program in DVB. Default is
  2971. <code>0x0001</code>.
  2972. </p>
  2973. </dd>
  2974. <dt><span><samp>mpegts_service_type <var>integer</var></samp></span></dt>
  2975. <dd><p>Set the program &lsquo;<samp>service_type</samp>&rsquo;. Default is <code>digital_tv</code>.
  2976. Accepts the following options:
  2977. </p><dl compact="compact">
  2978. <dt><span>&lsquo;<samp>hex_value</samp>&rsquo;</span></dt>
  2979. <dd><p>Any hexadecimal value between <code>0x01</code> and <code>0xff</code> as defined in
  2980. ETSI 300 468.
  2981. </p></dd>
  2982. <dt><span>&lsquo;<samp>digital_tv</samp>&rsquo;</span></dt>
  2983. <dd><p>Digital TV service.
  2984. </p></dd>
  2985. <dt><span>&lsquo;<samp>digital_radio</samp>&rsquo;</span></dt>
  2986. <dd><p>Digital Radio service.
  2987. </p></dd>
  2988. <dt><span>&lsquo;<samp>teletext</samp>&rsquo;</span></dt>
  2989. <dd><p>Teletext service.
  2990. </p></dd>
  2991. <dt><span>&lsquo;<samp>advanced_codec_digital_radio</samp>&rsquo;</span></dt>
  2992. <dd><p>Advanced Codec Digital Radio service.
  2993. </p></dd>
  2994. <dt><span>&lsquo;<samp>mpeg2_digital_hdtv</samp>&rsquo;</span></dt>
  2995. <dd><p>MPEG2 Digital HDTV service.
  2996. </p></dd>
  2997. <dt><span>&lsquo;<samp>advanced_codec_digital_sdtv</samp>&rsquo;</span></dt>
  2998. <dd><p>Advanced Codec Digital SDTV service.
  2999. </p></dd>
  3000. <dt><span>&lsquo;<samp>advanced_codec_digital_hdtv</samp>&rsquo;</span></dt>
  3001. <dd><p>Advanced Codec Digital HDTV service.
  3002. </p></dd>
  3003. </dl>
  3004. </dd>
  3005. <dt><span><samp>mpegts_pmt_start_pid <var>integer</var></samp></span></dt>
  3006. <dd><p>Set the first PID for PMTs. Default is <code>0x1000</code>, minimum is <code>0x0020</code>,
  3007. maximum is <code>0x1ffa</code>. This option has no effect in m2ts mode where the PMT
  3008. PID is fixed <code>0x0100</code>.
  3009. </p>
  3010. </dd>
  3011. <dt><span><samp>mpegts_start_pid <var>integer</var></samp></span></dt>
  3012. <dd><p>Set the first PID for elementary streams. Default is <code>0x0100</code>, minimum is
  3013. <code>0x0020</code>, maximum is <code>0x1ffa</code>. This option has no effect in m2ts mode
  3014. where the elementary stream PIDs are fixed.
  3015. </p>
  3016. </dd>
  3017. <dt><span><samp>mpegts_m2ts_mode <var>boolean</var></samp></span></dt>
  3018. <dd><p>Enable m2ts mode if set to <code>1</code>. Default value is <code>-1</code> which
  3019. disables m2ts mode.
  3020. </p>
  3021. </dd>
  3022. <dt><span><samp>muxrate <var>integer</var></samp></span></dt>
  3023. <dd><p>Set a constant muxrate. Default is VBR.
  3024. </p>
  3025. </dd>
  3026. <dt><span><samp>pes_payload_size <var>integer</var></samp></span></dt>
  3027. <dd><p>Set minimum PES packet payload in bytes. Default is <code>2930</code>.
  3028. </p>
  3029. </dd>
  3030. <dt><span><samp>mpegts_flags <var>flags</var></samp></span></dt>
  3031. <dd><p>Set mpegts flags. Accepts the following options:
  3032. </p><dl compact="compact">
  3033. <dt><span>&lsquo;<samp>resend_headers</samp>&rsquo;</span></dt>
  3034. <dd><p>Reemit PAT/PMT before writing the next packet.
  3035. </p></dd>
  3036. <dt><span>&lsquo;<samp>latm</samp>&rsquo;</span></dt>
  3037. <dd><p>Use LATM packetization for AAC.
  3038. </p></dd>
  3039. <dt><span>&lsquo;<samp>pat_pmt_at_frames</samp>&rsquo;</span></dt>
  3040. <dd><p>Reemit PAT and PMT at each video frame.
  3041. </p></dd>
  3042. <dt><span>&lsquo;<samp>system_b</samp>&rsquo;</span></dt>
  3043. <dd><p>Conform to System B (DVB) instead of System A (ATSC).
  3044. </p></dd>
  3045. <dt><span>&lsquo;<samp>initial_discontinuity</samp>&rsquo;</span></dt>
  3046. <dd><p>Mark the initial packet of each stream as discontinuity.
  3047. </p></dd>
  3048. </dl>
  3049. </dd>
  3050. <dt><span><samp>mpegts_copyts <var>boolean</var></samp></span></dt>
  3051. <dd><p>Preserve original timestamps, if value is set to <code>1</code>. Default value
  3052. is <code>-1</code>, which results in shifting timestamps so that they start from 0.
  3053. </p>
  3054. </dd>
  3055. <dt><span><samp>omit_video_pes_length <var>boolean</var></samp></span></dt>
  3056. <dd><p>Omit the PES packet length for video packets. Default is <code>1</code> (true).
  3057. </p>
  3058. </dd>
  3059. <dt><span><samp>pcr_period <var>integer</var></samp></span></dt>
  3060. <dd><p>Override the default PCR retransmission time in milliseconds. Default is
  3061. <code>-1</code> which means that the PCR interval will be determined automatically:
  3062. 20 ms is used for CBR streams, the highest multiple of the frame duration which
  3063. is less than 100 ms is used for VBR streams.
  3064. </p>
  3065. </dd>
  3066. <dt><span><samp>pat_period <var>duration</var></samp></span></dt>
  3067. <dd><p>Maximum time in seconds between PAT/PMT tables. Default is <code>0.1</code>.
  3068. </p>
  3069. </dd>
  3070. <dt><span><samp>sdt_period <var>duration</var></samp></span></dt>
  3071. <dd><p>Maximum time in seconds between SDT tables. Default is <code>0.5</code>.
  3072. </p>
  3073. </dd>
  3074. <dt><span><samp>tables_version <var>integer</var></samp></span></dt>
  3075. <dd><p>Set PAT, PMT and SDT version (default <code>0</code>, valid values are from 0 to 31, inclusively).
  3076. This option allows updating stream structure so that standard consumer may
  3077. detect the change. To do so, reopen output <code>AVFormatContext</code> (in case of API
  3078. usage) or restart <code>ffmpeg</code> instance, cyclically changing
  3079. <samp>tables_version</samp> value:
  3080. </p>
  3081. <div class="example">
  3082. <pre class="example">ffmpeg -i source1.ts -codec copy -f mpegts -tables_version 0 udp://1.1.1.1:1111
  3083. ffmpeg -i source2.ts -codec copy -f mpegts -tables_version 1 udp://1.1.1.1:1111
  3084. ...
  3085. ffmpeg -i source3.ts -codec copy -f mpegts -tables_version 31 udp://1.1.1.1:1111
  3086. ffmpeg -i source1.ts -codec copy -f mpegts -tables_version 0 udp://1.1.1.1:1111
  3087. ffmpeg -i source2.ts -codec copy -f mpegts -tables_version 1 udp://1.1.1.1:1111
  3088. ...
  3089. </pre></div>
  3090. </dd>
  3091. </dl>
  3092. <a name="Example-1"></a>
  3093. <h4 class="subsection">4.20.2 Example<span class="pull-right"><a class="anchor hidden-xs" href="#Example-1" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Example-1" aria-hidden="true">TOC</a></span></h4>
  3094. <div class="example">
  3095. <pre class="example">ffmpeg -i file.mpg -c copy \
  3096. -mpegts_original_network_id 0x1122 \
  3097. -mpegts_transport_stream_id 0x3344 \
  3098. -mpegts_service_id 0x5566 \
  3099. -mpegts_pmt_start_pid 0x1500 \
  3100. -mpegts_start_pid 0x150 \
  3101. -metadata service_provider=&quot;Some provider&quot; \
  3102. -metadata service_name=&quot;Some Channel&quot; \
  3103. out.ts
  3104. </pre></div>
  3105. <a name="mxf_002c-mxf_005fd10_002c-mxf_005fopatom"></a>
  3106. <h3 class="section">4.21 mxf, mxf_d10, mxf_opatom<span class="pull-right"><a class="anchor hidden-xs" href="#mxf_002c-mxf_005fd10_002c-mxf_005fopatom" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-mxf_002c-mxf_005fd10_002c-mxf_005fopatom" aria-hidden="true">TOC</a></span></h3>
  3107. <p>MXF muxer.
  3108. </p>
  3109. <a name="Options-11"></a>
  3110. <h4 class="subsection">4.21.1 Options<span class="pull-right"><a class="anchor hidden-xs" href="#Options-11" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Options-11" aria-hidden="true">TOC</a></span></h4>
  3111. <p>The muxer options are:
  3112. </p>
  3113. <dl compact="compact">
  3114. <dt><span><samp>store_user_comments <var>bool</var></samp></span></dt>
  3115. <dd><p>Set if user comments should be stored if available or never.
  3116. IRT D-10 does not allow user comments. The default is thus to write them for
  3117. mxf and mxf_opatom but not for mxf_d10
  3118. </p></dd>
  3119. </dl>
  3120. <a name="null"></a>
  3121. <h3 class="section">4.22 null<span class="pull-right"><a class="anchor hidden-xs" href="#null" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-null" aria-hidden="true">TOC</a></span></h3>
  3122. <p>Null muxer.
  3123. </p>
  3124. <p>This muxer does not generate any output file, it is mainly useful for
  3125. testing or benchmarking purposes.
  3126. </p>
  3127. <p>For example to benchmark decoding with <code>ffmpeg</code> you can use the
  3128. command:
  3129. </p><div class="example">
  3130. <pre class="example">ffmpeg -benchmark -i INPUT -f null out.null
  3131. </pre></div>
  3132. <p>Note that the above command does not read or write the <samp>out.null</samp>
  3133. file, but specifying the output file is required by the <code>ffmpeg</code>
  3134. syntax.
  3135. </p>
  3136. <p>Alternatively you can write the command as:
  3137. </p><div class="example">
  3138. <pre class="example">ffmpeg -benchmark -i INPUT -f null -
  3139. </pre></div>
  3140. <a name="nut"></a>
  3141. <h3 class="section">4.23 nut<span class="pull-right"><a class="anchor hidden-xs" href="#nut" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-nut" aria-hidden="true">TOC</a></span></h3>
  3142. <dl compact="compact">
  3143. <dt><span><samp>-syncpoints <var>flags</var></samp></span></dt>
  3144. <dd><p>Change the syncpoint usage in nut:
  3145. </p><dl compact="compact">
  3146. <dt><span><samp><var>default</var> use the normal low-overhead seeking aids.</samp></span></dt>
  3147. <dt><span><samp><var>none</var> do not use the syncpoints at all, reducing the overhead but making the stream non-seekable;</samp></span></dt>
  3148. <dd><p>Use of this option is not recommended, as the resulting files are very damage
  3149. sensitive and seeking is not possible. Also in general the overhead from
  3150. syncpoints is negligible. Note, -<code>write_index</code> 0 can be used to disable
  3151. all growing data tables, allowing to mux endless streams with limited memory
  3152. and without these disadvantages.
  3153. </p></dd>
  3154. <dt><span><samp><var>timestamped</var> extend the syncpoint with a wallclock field.</samp></span></dt>
  3155. </dl>
  3156. <p>The <var>none</var> and <var>timestamped</var> flags are experimental.
  3157. </p></dd>
  3158. <dt><span><samp>-write_index <var>bool</var></samp></span></dt>
  3159. <dd><p>Write index at the end, the default is to write an index.
  3160. </p></dd>
  3161. </dl>
  3162. <div class="example">
  3163. <pre class="example">ffmpeg -i INPUT -f_strict experimental -syncpoints none - | processor
  3164. </pre></div>
  3165. <a name="ogg"></a>
  3166. <h3 class="section">4.24 ogg<span class="pull-right"><a class="anchor hidden-xs" href="#ogg" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-ogg" aria-hidden="true">TOC</a></span></h3>
  3167. <p>Ogg container muxer.
  3168. </p>
  3169. <dl compact="compact">
  3170. <dt><span><samp>-page_duration <var>duration</var></samp></span></dt>
  3171. <dd><p>Preferred page duration, in microseconds. The muxer will attempt to create
  3172. pages that are approximately <var>duration</var> microseconds long. This allows the
  3173. user to compromise between seek granularity and container overhead. The default
  3174. is 1 second. A value of 0 will fill all segments, making pages as large as
  3175. possible. A value of 1 will effectively use 1 packet-per-page in most
  3176. situations, giving a small seek granularity at the cost of additional container
  3177. overhead.
  3178. </p></dd>
  3179. <dt><span><samp>-serial_offset <var>value</var></samp></span></dt>
  3180. <dd><p>Serial value from which to set the streams serial number.
  3181. Setting it to different and sufficiently large values ensures that the produced
  3182. ogg files can be safely chained.
  3183. </p>
  3184. </dd>
  3185. </dl>
  3186. <span id="segment"></span><a name="segment_002c-stream_005fsegment_002c-ssegment"></a>
  3187. <h3 class="section">4.25 segment, stream_segment, ssegment<span class="pull-right"><a class="anchor hidden-xs" href="#segment_002c-stream_005fsegment_002c-ssegment" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-segment_002c-stream_005fsegment_002c-ssegment" aria-hidden="true">TOC</a></span></h3>
  3188. <p>Basic stream segmenter.
  3189. </p>
  3190. <p>This muxer outputs streams to a number of separate files of nearly
  3191. fixed duration. Output filename pattern can be set in a fashion
  3192. similar to <a href="#image2">image2</a>, or by using a <code>strftime</code> template if
  3193. the <samp>strftime</samp> option is enabled.
  3194. </p>
  3195. <p><code>stream_segment</code> is a variant of the muxer used to write to
  3196. streaming output formats, i.e. which do not require global headers,
  3197. and is recommended for outputting e.g. to MPEG transport stream segments.
  3198. <code>ssegment</code> is a shorter alias for <code>stream_segment</code>.
  3199. </p>
  3200. <p>Every segment starts with a keyframe of the selected reference stream,
  3201. which is set through the <samp>reference_stream</samp> option.
  3202. </p>
  3203. <p>Note that if you want accurate splitting for a video file, you need to
  3204. make the input key frames correspond to the exact splitting times
  3205. expected by the segmenter, or the segment muxer will start the new
  3206. segment with the key frame found next after the specified start
  3207. time.
  3208. </p>
  3209. <p>The segment muxer works best with a single constant frame rate video.
  3210. </p>
  3211. <p>Optionally it can generate a list of the created segments, by setting
  3212. the option <var>segment_list</var>. The list type is specified by the
  3213. <var>segment_list_type</var> option. The entry filenames in the segment
  3214. list are set by default to the basename of the corresponding segment
  3215. files.
  3216. </p>
  3217. <p>See also the <a href="#hls">hls</a> muxer, which provides a more specific
  3218. implementation for HLS segmentation.
  3219. </p>
  3220. <a name="Options-12"></a>
  3221. <h4 class="subsection">4.25.1 Options<span class="pull-right"><a class="anchor hidden-xs" href="#Options-12" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Options-12" aria-hidden="true">TOC</a></span></h4>
  3222. <p>The segment muxer supports the following options:
  3223. </p>
  3224. <dl compact="compact">
  3225. <dt><span><samp>increment_tc <var>1|0</var></samp></span></dt>
  3226. <dd><p>if set to <code>1</code>, increment timecode between each segment
  3227. If this is selected, the input need to have
  3228. a timecode in the first video stream. Default value is
  3229. <code>0</code>.
  3230. </p>
  3231. </dd>
  3232. <dt><span><samp>reference_stream <var>specifier</var></samp></span></dt>
  3233. <dd><p>Set the reference stream, as specified by the string <var>specifier</var>.
  3234. If <var>specifier</var> is set to <code>auto</code>, the reference is chosen
  3235. automatically. Otherwise it must be a stream specifier (see the &ldquo;Stream
  3236. specifiers&rdquo; chapter in the ffmpeg manual) which specifies the
  3237. reference stream. The default value is <code>auto</code>.
  3238. </p>
  3239. </dd>
  3240. <dt><span><samp>segment_format <var>format</var></samp></span></dt>
  3241. <dd><p>Override the inner container format, by default it is guessed by the filename
  3242. extension.
  3243. </p>
  3244. </dd>
  3245. <dt><span><samp>segment_format_options <var>options_list</var></samp></span></dt>
  3246. <dd><p>Set output format options using a :-separated list of key=value
  3247. parameters. Values containing the <code>:</code> special character must be
  3248. escaped.
  3249. </p>
  3250. </dd>
  3251. <dt><span><samp>segment_list <var>name</var></samp></span></dt>
  3252. <dd><p>Generate also a listfile named <var>name</var>. If not specified no
  3253. listfile is generated.
  3254. </p>
  3255. </dd>
  3256. <dt><span><samp>segment_list_flags <var>flags</var></samp></span></dt>
  3257. <dd><p>Set flags affecting the segment list generation.
  3258. </p>
  3259. <p>It currently supports the following flags:
  3260. </p><dl compact="compact">
  3261. <dt><span>&lsquo;<samp>cache</samp>&rsquo;</span></dt>
  3262. <dd><p>Allow caching (only affects M3U8 list files).
  3263. </p>
  3264. </dd>
  3265. <dt><span>&lsquo;<samp>live</samp>&rsquo;</span></dt>
  3266. <dd><p>Allow live-friendly file generation.
  3267. </p></dd>
  3268. </dl>
  3269. </dd>
  3270. <dt><span><samp>segment_list_size <var>size</var></samp></span></dt>
  3271. <dd><p>Update the list file so that it contains at most <var>size</var>
  3272. segments. If 0 the list file will contain all the segments. Default
  3273. value is 0.
  3274. </p>
  3275. </dd>
  3276. <dt><span><samp>segment_list_entry_prefix <var>prefix</var></samp></span></dt>
  3277. <dd><p>Prepend <var>prefix</var> to each entry. Useful to generate absolute paths.
  3278. By default no prefix is applied.
  3279. </p>
  3280. </dd>
  3281. <dt><span><samp>segment_list_type <var>type</var></samp></span></dt>
  3282. <dd><p>Select the listing format.
  3283. </p>
  3284. <p>The following values are recognized:
  3285. </p><dl compact="compact">
  3286. <dt><span>&lsquo;<samp>flat</samp>&rsquo;</span></dt>
  3287. <dd><p>Generate a flat list for the created segments, one segment per line.
  3288. </p>
  3289. </dd>
  3290. <dt><span>&lsquo;<samp>csv, ext</samp>&rsquo;</span></dt>
  3291. <dd><p>Generate a list for the created segments, one segment per line,
  3292. each line matching the format (comma-separated values):
  3293. </p><div class="example">
  3294. <pre class="example"><var>segment_filename</var>,<var>segment_start_time</var>,<var>segment_end_time</var>
  3295. </pre></div>
  3296. <p><var>segment_filename</var> is the name of the output file generated by the
  3297. muxer according to the provided pattern. CSV escaping (according to
  3298. RFC4180) is applied if required.
  3299. </p>
  3300. <p><var>segment_start_time</var> and <var>segment_end_time</var> specify
  3301. the segment start and end time expressed in seconds.
  3302. </p>
  3303. <p>A list file with the suffix <code>&quot;.csv&quot;</code> or <code>&quot;.ext&quot;</code> will
  3304. auto-select this format.
  3305. </p>
  3306. <p>&lsquo;<samp>ext</samp>&rsquo; is deprecated in favor or &lsquo;<samp>csv</samp>&rsquo;.
  3307. </p>
  3308. </dd>
  3309. <dt><span>&lsquo;<samp>ffconcat</samp>&rsquo;</span></dt>
  3310. <dd><p>Generate an ffconcat file for the created segments. The resulting file
  3311. can be read using the FFmpeg <a href="#concat">concat</a> demuxer.
  3312. </p>
  3313. <p>A list file with the suffix <code>&quot;.ffcat&quot;</code> or <code>&quot;.ffconcat&quot;</code> will
  3314. auto-select this format.
  3315. </p>
  3316. </dd>
  3317. <dt><span>&lsquo;<samp>m3u8</samp>&rsquo;</span></dt>
  3318. <dd><p>Generate an extended M3U8 file, version 3, compliant with
  3319. <a href="http://tools.ietf.org/id/draft-pantos-http-live-streaming">http://tools.ietf.org/id/draft-pantos-http-live-streaming</a>.
  3320. </p>
  3321. <p>A list file with the suffix <code>&quot;.m3u8&quot;</code> will auto-select this format.
  3322. </p></dd>
  3323. </dl>
  3324. <p>If not specified the type is guessed from the list file name suffix.
  3325. </p>
  3326. </dd>
  3327. <dt><span><samp>segment_time <var>time</var></samp></span></dt>
  3328. <dd><p>Set segment duration to <var>time</var>, the value must be a duration
  3329. specification. Default value is &quot;2&quot;. See also the
  3330. <samp>segment_times</samp> option.
  3331. </p>
  3332. <p>Note that splitting may not be accurate, unless you force the
  3333. reference stream key-frames at the given time. See the introductory
  3334. notice and the examples below.
  3335. </p>
  3336. </dd>
  3337. <dt><span><samp>segment_atclocktime <var>1|0</var></samp></span></dt>
  3338. <dd><p>If set to &quot;1&quot; split at regular clock time intervals starting from 00:00
  3339. o&rsquo;clock. The <var>time</var> value specified in <samp>segment_time</samp> is
  3340. used for setting the length of the splitting interval.
  3341. </p>
  3342. <p>For example with <samp>segment_time</samp> set to &quot;900&quot; this makes it possible
  3343. to create files at 12:00 o&rsquo;clock, 12:15, 12:30, etc.
  3344. </p>
  3345. <p>Default value is &quot;0&quot;.
  3346. </p>
  3347. </dd>
  3348. <dt><span><samp>segment_clocktime_offset <var>duration</var></samp></span></dt>
  3349. <dd><p>Delay the segment splitting times with the specified duration when using
  3350. <samp>segment_atclocktime</samp>.
  3351. </p>
  3352. <p>For example with <samp>segment_time</samp> set to &quot;900&quot; and
  3353. <samp>segment_clocktime_offset</samp> set to &quot;300&quot; this makes it possible to
  3354. create files at 12:05, 12:20, 12:35, etc.
  3355. </p>
  3356. <p>Default value is &quot;0&quot;.
  3357. </p>
  3358. </dd>
  3359. <dt><span><samp>segment_clocktime_wrap_duration <var>duration</var></samp></span></dt>
  3360. <dd><p>Force the segmenter to only start a new segment if a packet reaches the muxer
  3361. within the specified duration after the segmenting clock time. This way you
  3362. can make the segmenter more resilient to backward local time jumps, such as
  3363. leap seconds or transition to standard time from daylight savings time.
  3364. </p>
  3365. <p>Default is the maximum possible duration which means starting a new segment
  3366. regardless of the elapsed time since the last clock time.
  3367. </p>
  3368. </dd>
  3369. <dt><span><samp>segment_time_delta <var>delta</var></samp></span></dt>
  3370. <dd><p>Specify the accuracy time when selecting the start time for a
  3371. segment, expressed as a duration specification. Default value is &quot;0&quot;.
  3372. </p>
  3373. <p>When delta is specified a key-frame will start a new segment if its
  3374. PTS satisfies the relation:
  3375. </p><div class="example">
  3376. <pre class="example">PTS &gt;= start_time - time_delta
  3377. </pre></div>
  3378. <p>This option is useful when splitting video content, which is always
  3379. split at GOP boundaries, in case a key frame is found just before the
  3380. specified split time.
  3381. </p>
  3382. <p>In particular may be used in combination with the <samp>ffmpeg</samp> option
  3383. <var>force_key_frames</var>. The key frame times specified by
  3384. <var>force_key_frames</var> may not be set accurately because of rounding
  3385. issues, with the consequence that a key frame time may result set just
  3386. before the specified time. For constant frame rate videos a value of
  3387. 1/(2*<var>frame_rate</var>) should address the worst case mismatch between
  3388. the specified time and the time set by <var>force_key_frames</var>.
  3389. </p>
  3390. </dd>
  3391. <dt><span><samp>segment_times <var>times</var></samp></span></dt>
  3392. <dd><p>Specify a list of split points. <var>times</var> contains a list of comma
  3393. separated duration specifications, in increasing order. See also
  3394. the <samp>segment_time</samp> option.
  3395. </p>
  3396. </dd>
  3397. <dt><span><samp>segment_frames <var>frames</var></samp></span></dt>
  3398. <dd><p>Specify a list of split video frame numbers. <var>frames</var> contains a
  3399. list of comma separated integer numbers, in increasing order.
  3400. </p>
  3401. <p>This option specifies to start a new segment whenever a reference
  3402. stream key frame is found and the sequential number (starting from 0)
  3403. of the frame is greater or equal to the next value in the list.
  3404. </p>
  3405. </dd>
  3406. <dt><span><samp>segment_wrap <var>limit</var></samp></span></dt>
  3407. <dd><p>Wrap around segment index once it reaches <var>limit</var>.
  3408. </p>
  3409. </dd>
  3410. <dt><span><samp>segment_start_number <var>number</var></samp></span></dt>
  3411. <dd><p>Set the sequence number of the first segment. Defaults to <code>0</code>.
  3412. </p>
  3413. </dd>
  3414. <dt><span><samp>strftime <var>1|0</var></samp></span></dt>
  3415. <dd><p>Use the <code>strftime</code> function to define the name of the new
  3416. segments to write. If this is selected, the output segment name must
  3417. contain a <code>strftime</code> function template. Default value is
  3418. <code>0</code>.
  3419. </p>
  3420. </dd>
  3421. <dt><span><samp>break_non_keyframes <var>1|0</var></samp></span></dt>
  3422. <dd><p>If enabled, allow segments to start on frames other than keyframes. This
  3423. improves behavior on some players when the time between keyframes is
  3424. inconsistent, but may make things worse on others, and can cause some oddities
  3425. during seeking. Defaults to <code>0</code>.
  3426. </p>
  3427. </dd>
  3428. <dt><span><samp>reset_timestamps <var>1|0</var></samp></span></dt>
  3429. <dd><p>Reset timestamps at the beginning of each segment, so that each segment
  3430. will start with near-zero timestamps. It is meant to ease the playback
  3431. of the generated segments. May not work with some combinations of
  3432. muxers/codecs. It is set to <code>0</code> by default.
  3433. </p>
  3434. </dd>
  3435. <dt><span><samp>initial_offset <var>offset</var></samp></span></dt>
  3436. <dd><p>Specify timestamp offset to apply to the output packet timestamps. The
  3437. argument must be a time duration specification, and defaults to 0.
  3438. </p>
  3439. </dd>
  3440. <dt><span><samp>write_empty_segments <var>1|0</var></samp></span></dt>
  3441. <dd><p>If enabled, write an empty segment if there are no packets during the period a
  3442. segment would usually span. Otherwise, the segment will be filled with the next
  3443. packet written. Defaults to <code>0</code>.
  3444. </p></dd>
  3445. </dl>
  3446. <p>Make sure to require a closed GOP when encoding and to set the GOP
  3447. size to fit your segment time constraint.
  3448. </p>
  3449. <a name="Examples-9"></a>
  3450. <h4 class="subsection">4.25.2 Examples<span class="pull-right"><a class="anchor hidden-xs" href="#Examples-9" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Examples-9" aria-hidden="true">TOC</a></span></h4>
  3451. <ul>
  3452. <li> Remux the content of file <samp>in.mkv</samp> to a list of segments
  3453. <samp>out-000.nut</samp>, <samp>out-001.nut</samp>, etc., and write the list of
  3454. generated segments to <samp>out.list</samp>:
  3455. <div class="example">
  3456. <pre class="example">ffmpeg -i in.mkv -codec hevc -flags +cgop -g 60 -map 0 -f segment -segment_list out.list out%03d.nut
  3457. </pre></div>
  3458. </li><li> Segment input and set output format options for the output segments:
  3459. <div class="example">
  3460. <pre class="example">ffmpeg -i in.mkv -f segment -segment_time 10 -segment_format_options movflags=+faststart out%03d.mp4
  3461. </pre></div>
  3462. </li><li> Segment the input file according to the split points specified by the
  3463. <var>segment_times</var> option:
  3464. <div class="example">
  3465. <pre class="example">ffmpeg -i in.mkv -codec copy -map 0 -f segment -segment_list out.csv -segment_times 1,2,3,5,8,13,21 out%03d.nut
  3466. </pre></div>
  3467. </li><li> Use the <code>ffmpeg</code> <samp>force_key_frames</samp>
  3468. option to force key frames in the input at the specified location, together
  3469. with the segment option <samp>segment_time_delta</samp> to account for
  3470. possible roundings operated when setting key frame times.
  3471. <div class="example">
  3472. <pre class="example">ffmpeg -i in.mkv -force_key_frames 1,2,3,5,8,13,21 -codec:v mpeg4 -codec:a pcm_s16le -map 0 \
  3473. -f segment -segment_list out.csv -segment_times 1,2,3,5,8,13,21 -segment_time_delta 0.05 out%03d.nut
  3474. </pre></div>
  3475. <p>In order to force key frames on the input file, transcoding is
  3476. required.
  3477. </p>
  3478. </li><li> Segment the input file by splitting the input file according to the
  3479. frame numbers sequence specified with the <samp>segment_frames</samp> option:
  3480. <div class="example">
  3481. <pre class="example">ffmpeg -i in.mkv -codec copy -map 0 -f segment -segment_list out.csv -segment_frames 100,200,300,500,800 out%03d.nut
  3482. </pre></div>
  3483. </li><li> Convert the <samp>in.mkv</samp> to TS segments using the <code>libx264</code>
  3484. and <code>aac</code> encoders:
  3485. <div class="example">
  3486. <pre class="example">ffmpeg -i in.mkv -map 0 -codec:v libx264 -codec:a aac -f ssegment -segment_list out.list out%03d.ts
  3487. </pre></div>
  3488. </li><li> Segment the input file, and create an M3U8 live playlist (can be used
  3489. as live HLS source):
  3490. <div class="example">
  3491. <pre class="example">ffmpeg -re -i in.mkv -codec copy -map 0 -f segment -segment_list playlist.m3u8 \
  3492. -segment_list_flags +live -segment_time 10 out%03d.mkv
  3493. </pre></div>
  3494. </li></ul>
  3495. <a name="smoothstreaming"></a>
  3496. <h3 class="section">4.26 smoothstreaming<span class="pull-right"><a class="anchor hidden-xs" href="#smoothstreaming" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-smoothstreaming" aria-hidden="true">TOC</a></span></h3>
  3497. <p>Smooth Streaming muxer generates a set of files (Manifest, chunks) suitable for serving with conventional web server.
  3498. </p>
  3499. <dl compact="compact">
  3500. <dt><span><samp>window_size</samp></span></dt>
  3501. <dd><p>Specify the number of fragments kept in the manifest. Default 0 (keep all).
  3502. </p>
  3503. </dd>
  3504. <dt><span><samp>extra_window_size</samp></span></dt>
  3505. <dd><p>Specify the number of fragments kept outside of the manifest before removing from disk. Default 5.
  3506. </p>
  3507. </dd>
  3508. <dt><span><samp>lookahead_count</samp></span></dt>
  3509. <dd><p>Specify the number of lookahead fragments. Default 2.
  3510. </p>
  3511. </dd>
  3512. <dt><span><samp>min_frag_duration</samp></span></dt>
  3513. <dd><p>Specify the minimum fragment duration (in microseconds). Default 5000000.
  3514. </p>
  3515. </dd>
  3516. <dt><span><samp>remove_at_exit</samp></span></dt>
  3517. <dd><p>Specify whether to remove all fragments when finished. Default 0 (do not remove).
  3518. </p>
  3519. </dd>
  3520. </dl>
  3521. <span id="streamhash"></span><a name="streamhash-1"></a>
  3522. <h3 class="section">4.27 streamhash<span class="pull-right"><a class="anchor hidden-xs" href="#streamhash-1" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-streamhash-1" aria-hidden="true">TOC</a></span></h3>
  3523. <p>Per stream hash testing format.
  3524. </p>
  3525. <p>This muxer computes and prints a cryptographic hash of all the input frames,
  3526. on a per-stream basis. This can be used for equality checks without having
  3527. to do a complete binary comparison.
  3528. </p>
  3529. <p>By default audio frames are converted to signed 16-bit raw audio and
  3530. video frames to raw video before computing the hash, but the output
  3531. of explicit conversions to other codecs can also be used. Timestamps
  3532. are ignored. It uses the SHA-256 cryptographic hash function by default,
  3533. but supports several other algorithms.
  3534. </p>
  3535. <p>The output of the muxer consists of one line per stream of the form:
  3536. <var>streamindex</var>,<var>streamtype</var>,<var>algo</var>=<var>hash</var>, where
  3537. <var>streamindex</var> is the index of the mapped stream, <var>streamtype</var> is a
  3538. single character indicating the type of stream, <var>algo</var> is a short string
  3539. representing the hash function used, and <var>hash</var> is a hexadecimal number
  3540. representing the computed hash.
  3541. </p>
  3542. <dl compact="compact">
  3543. <dt><span><samp>hash <var>algorithm</var></samp></span></dt>
  3544. <dd><p>Use the cryptographic hash function specified by the string <var>algorithm</var>.
  3545. Supported values include <code>MD5</code>, <code>murmur3</code>, <code>RIPEMD128</code>,
  3546. <code>RIPEMD160</code>, <code>RIPEMD256</code>, <code>RIPEMD320</code>, <code>SHA160</code>,
  3547. <code>SHA224</code>, <code>SHA256</code> (default), <code>SHA512/224</code>, <code>SHA512/256</code>,
  3548. <code>SHA384</code>, <code>SHA512</code>, <code>CRC32</code> and <code>adler32</code>.
  3549. </p>
  3550. </dd>
  3551. </dl>
  3552. <a name="Examples-10"></a>
  3553. <h4 class="subsection">4.27.1 Examples<span class="pull-right"><a class="anchor hidden-xs" href="#Examples-10" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Examples-10" aria-hidden="true">TOC</a></span></h4>
  3554. <p>To compute the SHA-256 hash of the input converted to raw audio and
  3555. video, and store it in the file <samp>out.sha256</samp>:
  3556. </p><div class="example">
  3557. <pre class="example">ffmpeg -i INPUT -f streamhash out.sha256
  3558. </pre></div>
  3559. <p>To print an MD5 hash to stdout use the command:
  3560. </p><div class="example">
  3561. <pre class="example">ffmpeg -i INPUT -f streamhash -hash md5 -
  3562. </pre></div>
  3563. <p>See also the <a href="#hash">hash</a> and <a href="#framehash">framehash</a> muxers.
  3564. </p>
  3565. <span id="fifo"></span><a name="fifo-1"></a>
  3566. <h3 class="section">4.28 fifo<span class="pull-right"><a class="anchor hidden-xs" href="#fifo-1" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-fifo-1" aria-hidden="true">TOC</a></span></h3>
  3567. <p>The fifo pseudo-muxer allows the separation of encoding and muxing by using
  3568. first-in-first-out queue and running the actual muxer in a separate thread. This
  3569. is especially useful in combination with the <a href="#tee">tee</a> muxer and can be used to
  3570. send data to several destinations with different reliability/writing speed/latency.
  3571. </p>
  3572. <p>API users should be aware that callback functions (interrupt_callback,
  3573. io_open and io_close) used within its AVFormatContext must be thread-safe.
  3574. </p>
  3575. <p>The behavior of the fifo muxer if the queue fills up or if the output fails is
  3576. selectable,
  3577. </p>
  3578. <ul>
  3579. <li> output can be transparently restarted with configurable delay between retries
  3580. based on real time or time of the processed stream.
  3581. </li><li> encoding can be blocked during temporary failure, or continue transparently
  3582. dropping packets in case fifo queue fills up.
  3583. </li></ul>
  3584. <dl compact="compact">
  3585. <dt><span><samp>fifo_format</samp></span></dt>
  3586. <dd><p>Specify the format name. Useful if it cannot be guessed from the
  3587. output name suffix.
  3588. </p>
  3589. </dd>
  3590. <dt><span><samp>queue_size</samp></span></dt>
  3591. <dd><p>Specify size of the queue (number of packets). Default value is 60.
  3592. </p>
  3593. </dd>
  3594. <dt><span><samp>format_opts</samp></span></dt>
  3595. <dd><p>Specify format options for the underlying muxer. Muxer options can be specified
  3596. as a list of <var>key</var>=<var>value</var> pairs separated by &rsquo;:&rsquo;.
  3597. </p>
  3598. </dd>
  3599. <dt><span><samp>drop_pkts_on_overflow <var>bool</var></samp></span></dt>
  3600. <dd><p>If set to 1 (true), in case the fifo queue fills up, packets will be dropped
  3601. rather than blocking the encoder. This makes it possible to continue streaming without
  3602. delaying the input, at the cost of omitting part of the stream. By default
  3603. this option is set to 0 (false), so in such cases the encoder will be blocked
  3604. until the muxer processes some of the packets and none of them is lost.
  3605. </p>
  3606. </dd>
  3607. <dt><span><samp>attempt_recovery <var>bool</var></samp></span></dt>
  3608. <dd><p>If failure occurs, attempt to recover the output. This is especially useful
  3609. when used with network output, since it makes it possible to restart streaming transparently.
  3610. By default this option is set to 0 (false).
  3611. </p>
  3612. </dd>
  3613. <dt><span><samp>max_recovery_attempts</samp></span></dt>
  3614. <dd><p>Sets maximum number of successive unsuccessful recovery attempts after which
  3615. the output fails permanently. By default this option is set to 0 (unlimited).
  3616. </p>
  3617. </dd>
  3618. <dt><span><samp>recovery_wait_time <var>duration</var></samp></span></dt>
  3619. <dd><p>Waiting time before the next recovery attempt after previous unsuccessful
  3620. recovery attempt. Default value is 5 seconds.
  3621. </p>
  3622. </dd>
  3623. <dt><span><samp>recovery_wait_streamtime <var>bool</var></samp></span></dt>
  3624. <dd><p>If set to 0 (false), the real time is used when waiting for the recovery
  3625. attempt (i.e. the recovery will be attempted after at least
  3626. recovery_wait_time seconds).
  3627. If set to 1 (true), the time of the processed stream is taken into account
  3628. instead (i.e. the recovery will be attempted after at least <var>recovery_wait_time</var>
  3629. seconds of the stream is omitted).
  3630. By default, this option is set to 0 (false).
  3631. </p>
  3632. </dd>
  3633. <dt><span><samp>recover_any_error <var>bool</var></samp></span></dt>
  3634. <dd><p>If set to 1 (true), recovery will be attempted regardless of type of the error
  3635. causing the failure. By default this option is set to 0 (false) and in case of
  3636. certain (usually permanent) errors the recovery is not attempted even when
  3637. <var>attempt_recovery</var> is set to 1.
  3638. </p>
  3639. </dd>
  3640. <dt><span><samp>restart_with_keyframe <var>bool</var></samp></span></dt>
  3641. <dd><p>Specify whether to wait for the keyframe after recovering from
  3642. queue overflow or failure. This option is set to 0 (false) by default.
  3643. </p>
  3644. </dd>
  3645. <dt><span><samp>timeshift <var>duration</var></samp></span></dt>
  3646. <dd><p>Buffer the specified amount of packets and delay writing the output. Note that
  3647. <var>queue_size</var> must be big enough to store the packets for timeshift. At the
  3648. end of the input the fifo buffer is flushed at realtime speed.
  3649. </p>
  3650. </dd>
  3651. </dl>
  3652. <a name="Examples-11"></a>
  3653. <h4 class="subsection">4.28.1 Examples<span class="pull-right"><a class="anchor hidden-xs" href="#Examples-11" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Examples-11" aria-hidden="true">TOC</a></span></h4>
  3654. <ul>
  3655. <li> Stream something to rtmp server, continue processing the stream at real-time
  3656. rate even in case of temporary failure (network outage) and attempt to recover
  3657. streaming every second indefinitely.
  3658. <div class="example">
  3659. <pre class="example">ffmpeg -re -i ... -c:v libx264 -c:a aac -f fifo -fifo_format flv -map 0:v -map 0:a
  3660. -drop_pkts_on_overflow 1 -attempt_recovery 1 -recovery_wait_time 1 rtmp://example.com/live/stream_name
  3661. </pre></div>
  3662. </li></ul>
  3663. <span id="tee"></span><a name="tee-1"></a>
  3664. <h3 class="section">4.29 tee<span class="pull-right"><a class="anchor hidden-xs" href="#tee-1" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-tee-1" aria-hidden="true">TOC</a></span></h3>
  3665. <p>The tee muxer can be used to write the same data to several outputs, such as files or streams.
  3666. It can be used, for example, to stream a video over a network and save it to disk at the same time.
  3667. </p>
  3668. <p>It is different from specifying several outputs to the <code>ffmpeg</code>
  3669. command-line tool. With the tee muxer, the audio and video data will be encoded only once.
  3670. With conventional multiple outputs, multiple encoding operations in parallel are initiated,
  3671. which can be a very expensive process. The tee muxer is not useful when using the libavformat API
  3672. directly because it is then possible to feed the same packets to several muxers directly.
  3673. </p>
  3674. <p>Since the tee muxer does not represent any particular output format, ffmpeg cannot auto-select
  3675. output streams. So all streams intended for output must be specified using <code>-map</code>. See
  3676. the examples below.
  3677. </p>
  3678. <p>Some encoders may need different options depending on the output format;
  3679. the auto-detection of this can not work with the tee muxer, so they need to be explicitly specified.
  3680. The main example is the <samp>global_header</samp> flag.
  3681. </p>
  3682. <p>The slave outputs are specified in the file name given to the muxer,
  3683. separated by &rsquo;|&rsquo;. If any of the slave name contains the &rsquo;|&rsquo; separator,
  3684. leading or trailing spaces or any special character, those must be
  3685. escaped (see <a data-manual="ffmpeg-utils" href="ffmpeg-utils.html#quoting_005fand_005fescaping">(ffmpeg-utils)the &quot;Quoting and escaping&quot;
  3686. section in the ffmpeg-utils(1) manual</a>).
  3687. </p>
  3688. <a name="Options-13"></a>
  3689. <h4 class="subsection">4.29.1 Options<span class="pull-right"><a class="anchor hidden-xs" href="#Options-13" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Options-13" aria-hidden="true">TOC</a></span></h4>
  3690. <dl compact="compact">
  3691. <dt><span><samp>use_fifo <var>bool</var></samp></span></dt>
  3692. <dd><p>If set to 1, slave outputs will be processed in separate threads using the <a href="#fifo">fifo</a>
  3693. muxer. This allows to compensate for different speed/latency/reliability of
  3694. outputs and setup transparent recovery. By default this feature is turned off.
  3695. </p>
  3696. </dd>
  3697. <dt><span><samp>fifo_options</samp></span></dt>
  3698. <dd><p>Options to pass to fifo pseudo-muxer instances. See <a href="#fifo">fifo</a>.
  3699. </p>
  3700. </dd>
  3701. </dl>
  3702. <p>Muxer options can be specified for each slave by prepending them as a list of
  3703. <var>key</var>=<var>value</var> pairs separated by &rsquo;:&rsquo;, between square brackets. If
  3704. the options values contain a special character or the &rsquo;:&rsquo; separator, they
  3705. must be escaped; note that this is a second level escaping.
  3706. </p>
  3707. <p>The following special options are also recognized:
  3708. </p><dl compact="compact">
  3709. <dt><span><samp>f</samp></span></dt>
  3710. <dd><p>Specify the format name. Required if it cannot be guessed from the
  3711. output URL.
  3712. </p>
  3713. </dd>
  3714. <dt><span><samp>bsfs[/<var>spec</var>]</samp></span></dt>
  3715. <dd><p>Specify a list of bitstream filters to apply to the specified
  3716. output.
  3717. </p>
  3718. <p>It is possible to specify to which streams a given bitstream filter
  3719. applies, by appending a stream specifier to the option separated by
  3720. <code>/</code>. <var>spec</var> must be a stream specifier (see <a href="#Format-stream-specifiers">Format stream specifiers</a>).
  3721. </p>
  3722. <p>If the stream specifier is not specified, the bitstream filters will be
  3723. applied to all streams in the output. This will cause that output operation
  3724. to fail if the output contains streams to which the bitstream filter cannot
  3725. be applied e.g. <code>h264_mp4toannexb</code> being applied to an output containing an audio stream.
  3726. </p>
  3727. <p>Options for a bitstream filter must be specified in the form of <code>opt=value</code>.
  3728. </p>
  3729. <p>Several bitstream filters can be specified, separated by &quot;,&quot;.
  3730. </p>
  3731. </dd>
  3732. <dt><span><samp>use_fifo <var>bool</var></samp></span></dt>
  3733. <dd><p>This allows to override tee muxer use_fifo option for individual slave muxer.
  3734. </p>
  3735. </dd>
  3736. <dt><span><samp>fifo_options</samp></span></dt>
  3737. <dd><p>This allows to override tee muxer fifo_options for individual slave muxer.
  3738. See <a href="#fifo">fifo</a>.
  3739. </p>
  3740. </dd>
  3741. <dt><span><samp>select</samp></span></dt>
  3742. <dd><p>Select the streams that should be mapped to the slave output,
  3743. specified by a stream specifier. If not specified, this defaults to
  3744. all the mapped streams. This will cause that output operation to fail
  3745. if the output format does not accept all mapped streams.
  3746. </p>
  3747. <p>You may use multiple stream specifiers separated by commas (<code>,</code>) e.g.: <code>a:0,v</code>
  3748. </p>
  3749. </dd>
  3750. <dt><span><samp>onfail</samp></span></dt>
  3751. <dd><p>Specify behaviour on output failure. This can be set to either <code>abort</code> (which is
  3752. default) or <code>ignore</code>. <code>abort</code> will cause whole process to fail in case of failure
  3753. on this slave output. <code>ignore</code> will ignore failure on this output, so other outputs
  3754. will continue without being affected.
  3755. </p></dd>
  3756. </dl>
  3757. <a name="Examples-12"></a>
  3758. <h4 class="subsection">4.29.2 Examples<span class="pull-right"><a class="anchor hidden-xs" href="#Examples-12" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Examples-12" aria-hidden="true">TOC</a></span></h4>
  3759. <ul>
  3760. <li> Encode something and both archive it in a WebM file and stream it
  3761. as MPEG-TS over UDP:
  3762. <div class="example">
  3763. <pre class="example">ffmpeg -i ... -c:v libx264 -c:a mp2 -f tee -map 0:v -map 0:a
  3764. &quot;archive-20121107.mkv|[f=mpegts]udp://10.0.1.255:1234/&quot;
  3765. </pre></div>
  3766. </li><li> As above, but continue streaming even if output to local file fails
  3767. (for example local drive fills up):
  3768. <div class="example">
  3769. <pre class="example">ffmpeg -i ... -c:v libx264 -c:a mp2 -f tee -map 0:v -map 0:a
  3770. &quot;[onfail=ignore]archive-20121107.mkv|[f=mpegts]udp://10.0.1.255:1234/&quot;
  3771. </pre></div>
  3772. </li><li> Use <code>ffmpeg</code> to encode the input, and send the output
  3773. to three different destinations. The <code>dump_extra</code> bitstream
  3774. filter is used to add extradata information to all the output video
  3775. keyframes packets, as requested by the MPEG-TS format. The select
  3776. option is applied to <samp>out.aac</samp> in order to make it contain only
  3777. audio packets.
  3778. <div class="example">
  3779. <pre class="example">ffmpeg -i ... -map 0 -flags +global_header -c:v libx264 -c:a aac
  3780. -f tee &quot;[bsfs/v=dump_extra=freq=keyframe]out.ts|[movflags=+faststart]out.mp4|[select=a]out.aac&quot;
  3781. </pre></div>
  3782. </li><li> As above, but select only stream <code>a:1</code> for the audio output. Note
  3783. that a second level escaping must be performed, as &quot;:&quot; is a special
  3784. character used to separate options.
  3785. <div class="example">
  3786. <pre class="example">ffmpeg -i ... -map 0 -flags +global_header -c:v libx264 -c:a aac
  3787. -f tee &quot;[bsfs/v=dump_extra=freq=keyframe]out.ts|[movflags=+faststart]out.mp4|[select=\'a:1\']out.aac&quot;
  3788. </pre></div>
  3789. </li></ul>
  3790. <a name="webm_005fdash_005fmanifest"></a>
  3791. <h3 class="section">4.30 webm_dash_manifest<span class="pull-right"><a class="anchor hidden-xs" href="#webm_005fdash_005fmanifest" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-webm_005fdash_005fmanifest" aria-hidden="true">TOC</a></span></h3>
  3792. <p>WebM DASH Manifest muxer.
  3793. </p>
  3794. <p>This muxer implements the WebM DASH Manifest specification to generate the DASH
  3795. manifest XML. It also supports manifest generation for DASH live streams.
  3796. </p>
  3797. <p>For more information see:
  3798. </p>
  3799. <ul>
  3800. <li> WebM DASH Specification: <a href="https://sites.google.com/a/webmproject.org/wiki/adaptive-streaming/webm-dash-specification">https://sites.google.com/a/webmproject.org/wiki/adaptive-streaming/webm-dash-specification</a>
  3801. </li><li> ISO DASH Specification: <a href="http://standards.iso.org/ittf/PubliclyAvailableStandards/c065274_ISO_IEC_23009-1_2014.zip">http://standards.iso.org/ittf/PubliclyAvailableStandards/c065274_ISO_IEC_23009-1_2014.zip</a>
  3802. </li></ul>
  3803. <a name="Options-14"></a>
  3804. <h4 class="subsection">4.30.1 Options<span class="pull-right"><a class="anchor hidden-xs" href="#Options-14" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Options-14" aria-hidden="true">TOC</a></span></h4>
  3805. <p>This muxer supports the following options:
  3806. </p>
  3807. <dl compact="compact">
  3808. <dt><span><samp>adaptation_sets</samp></span></dt>
  3809. <dd><p>This option has the following syntax: &quot;id=x,streams=a,b,c id=y,streams=d,e&quot; where x and y are the
  3810. unique identifiers of the adaptation sets and a,b,c,d and e are the indices of the corresponding
  3811. audio and video streams. Any number of adaptation sets can be added using this option.
  3812. </p>
  3813. </dd>
  3814. <dt><span><samp>live</samp></span></dt>
  3815. <dd><p>Set this to 1 to create a live stream DASH Manifest. Default: 0.
  3816. </p>
  3817. </dd>
  3818. <dt><span><samp>chunk_start_index</samp></span></dt>
  3819. <dd><p>Start index of the first chunk. This will go in the &lsquo;<samp>startNumber</samp>&rsquo; attribute
  3820. of the &lsquo;<samp>SegmentTemplate</samp>&rsquo; element in the manifest. Default: 0.
  3821. </p>
  3822. </dd>
  3823. <dt><span><samp>chunk_duration_ms</samp></span></dt>
  3824. <dd><p>Duration of each chunk in milliseconds. This will go in the &lsquo;<samp>duration</samp>&rsquo;
  3825. attribute of the &lsquo;<samp>SegmentTemplate</samp>&rsquo; element in the manifest. Default: 1000.
  3826. </p>
  3827. </dd>
  3828. <dt><span><samp>utc_timing_url</samp></span></dt>
  3829. <dd><p>URL of the page that will return the UTC timestamp in ISO format. This will go
  3830. in the &lsquo;<samp>value</samp>&rsquo; attribute of the &lsquo;<samp>UTCTiming</samp>&rsquo; element in the manifest.
  3831. Default: None.
  3832. </p>
  3833. </dd>
  3834. <dt><span><samp>time_shift_buffer_depth</samp></span></dt>
  3835. <dd><p>Smallest time (in seconds) shifting buffer for which any Representation is
  3836. guaranteed to be available. This will go in the &lsquo;<samp>timeShiftBufferDepth</samp>&rsquo;
  3837. attribute of the &lsquo;<samp>MPD</samp>&rsquo; element. Default: 60.
  3838. </p>
  3839. </dd>
  3840. <dt><span><samp>minimum_update_period</samp></span></dt>
  3841. <dd><p>Minimum update period (in seconds) of the manifest. This will go in the
  3842. &lsquo;<samp>minimumUpdatePeriod</samp>&rsquo; attribute of the &lsquo;<samp>MPD</samp>&rsquo; element. Default: 0.
  3843. </p>
  3844. </dd>
  3845. </dl>
  3846. <a name="Example-2"></a>
  3847. <h4 class="subsection">4.30.2 Example<span class="pull-right"><a class="anchor hidden-xs" href="#Example-2" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Example-2" aria-hidden="true">TOC</a></span></h4>
  3848. <div class="example">
  3849. <pre class="example">ffmpeg -f webm_dash_manifest -i video1.webm \
  3850. -f webm_dash_manifest -i video2.webm \
  3851. -f webm_dash_manifest -i audio1.webm \
  3852. -f webm_dash_manifest -i audio2.webm \
  3853. -map 0 -map 1 -map 2 -map 3 \
  3854. -c copy \
  3855. -f webm_dash_manifest \
  3856. -adaptation_sets &quot;id=0,streams=0,1 id=1,streams=2,3&quot; \
  3857. manifest.xml
  3858. </pre></div>
  3859. <a name="webm_005fchunk"></a>
  3860. <h3 class="section">4.31 webm_chunk<span class="pull-right"><a class="anchor hidden-xs" href="#webm_005fchunk" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-webm_005fchunk" aria-hidden="true">TOC</a></span></h3>
  3861. <p>WebM Live Chunk Muxer.
  3862. </p>
  3863. <p>This muxer writes out WebM headers and chunks as separate files which can be
  3864. consumed by clients that support WebM Live streams via DASH.
  3865. </p>
  3866. <a name="Options-15"></a>
  3867. <h4 class="subsection">4.31.1 Options<span class="pull-right"><a class="anchor hidden-xs" href="#Options-15" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Options-15" aria-hidden="true">TOC</a></span></h4>
  3868. <p>This muxer supports the following options:
  3869. </p>
  3870. <dl compact="compact">
  3871. <dt><span><samp>chunk_start_index</samp></span></dt>
  3872. <dd><p>Index of the first chunk (defaults to 0).
  3873. </p>
  3874. </dd>
  3875. <dt><span><samp>header</samp></span></dt>
  3876. <dd><p>Filename of the header where the initialization data will be written.
  3877. </p>
  3878. </dd>
  3879. <dt><span><samp>audio_chunk_duration</samp></span></dt>
  3880. <dd><p>Duration of each audio chunk in milliseconds (defaults to 5000).
  3881. </p></dd>
  3882. </dl>
  3883. <a name="Example-3"></a>
  3884. <h4 class="subsection">4.31.2 Example<span class="pull-right"><a class="anchor hidden-xs" href="#Example-3" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Example-3" aria-hidden="true">TOC</a></span></h4>
  3885. <div class="example">
  3886. <pre class="example">ffmpeg -f v4l2 -i /dev/video0 \
  3887. -f alsa -i hw:0 \
  3888. -map 0:0 \
  3889. -c:v libvpx-vp9 \
  3890. -s 640x360 -keyint_min 30 -g 30 \
  3891. -f webm_chunk \
  3892. -header webm_live_video_360.hdr \
  3893. -chunk_start_index 1 \
  3894. webm_live_video_360_%d.chk \
  3895. -map 1:0 \
  3896. -c:a libvorbis \
  3897. -b:a 128k \
  3898. -f webm_chunk \
  3899. -header webm_live_audio_128.hdr \
  3900. -chunk_start_index 1 \
  3901. -audio_chunk_duration 1000 \
  3902. webm_live_audio_128_%d.chk
  3903. </pre></div>
  3904. <a name="Metadata-1"></a>
  3905. <h2 class="chapter">5 Metadata<span class="pull-right"><a class="anchor hidden-xs" href="#Metadata-1" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Metadata-1" aria-hidden="true">TOC</a></span></h2>
  3906. <p>FFmpeg is able to dump metadata from media files into a simple UTF-8-encoded
  3907. INI-like text file and then load it back using the metadata muxer/demuxer.
  3908. </p>
  3909. <p>The file format is as follows:
  3910. </p><ol>
  3911. <li> A file consists of a header and a number of metadata tags divided into sections,
  3912. each on its own line.
  3913. </li><li> The header is a &lsquo;<samp>;FFMETADATA</samp>&rsquo; string, followed by a version number (now 1).
  3914. </li><li> Metadata tags are of the form &lsquo;<samp>key=value</samp>&rsquo;
  3915. </li><li> Immediately after header follows global metadata
  3916. </li><li> After global metadata there may be sections with per-stream/per-chapter
  3917. metadata.
  3918. </li><li> A section starts with the section name in uppercase (i.e. STREAM or CHAPTER) in
  3919. brackets (&lsquo;<samp>[</samp>&rsquo;, &lsquo;<samp>]</samp>&rsquo;) and ends with next section or end of file.
  3920. </li><li> At the beginning of a chapter section there may be an optional timebase to be
  3921. used for start/end values. It must be in form
  3922. &lsquo;<samp>TIMEBASE=<var>num</var>/<var>den</var></samp>&rsquo;, where <var>num</var> and <var>den</var> are
  3923. integers. If the timebase is missing then start/end times are assumed to
  3924. be in nanoseconds.
  3925. <p>Next a chapter section must contain chapter start and end times in form
  3926. &lsquo;<samp>START=<var>num</var></samp>&rsquo;, &lsquo;<samp>END=<var>num</var></samp>&rsquo;, where <var>num</var> is a positive
  3927. integer.
  3928. </p>
  3929. </li><li> Empty lines and lines starting with &lsquo;<samp>;</samp>&rsquo; or &lsquo;<samp>#</samp>&rsquo; are ignored.
  3930. </li><li> Metadata keys or values containing special characters (&lsquo;<samp>=</samp>&rsquo;, &lsquo;<samp>;</samp>&rsquo;,
  3931. &lsquo;<samp>#</samp>&rsquo;, &lsquo;<samp>\</samp>&rsquo; and a newline) must be escaped with a backslash &lsquo;<samp>\</samp>&rsquo;.
  3932. </li><li> Note that whitespace in metadata (e.g. &lsquo;<samp>foo = bar</samp>&rsquo;) is considered to be
  3933. a part of the tag (in the example above key is &lsquo;<samp>foo </samp>&rsquo;, value is
  3934. &lsquo;<samp> bar</samp>&rsquo;).
  3935. </li></ol>
  3936. <p>A ffmetadata file might look like this:
  3937. </p><div class="example">
  3938. <pre class="example">;FFMETADATA1
  3939. title=bike\\shed
  3940. ;this is a comment
  3941. artist=FFmpeg troll team
  3942. [CHAPTER]
  3943. TIMEBASE=1/1000
  3944. START=0
  3945. #chapter ends at 0:01:00
  3946. END=60000
  3947. title=chapter \#1
  3948. [STREAM]
  3949. title=multi\
  3950. line
  3951. </pre></div>
  3952. <p>By using the ffmetadata muxer and demuxer it is possible to extract
  3953. metadata from an input file to an ffmetadata file, and then transcode
  3954. the file into an output file with the edited ffmetadata file.
  3955. </p>
  3956. <p>Extracting an ffmetadata file with <samp>ffmpeg</samp> goes as follows:
  3957. </p><div class="example">
  3958. <pre class="example">ffmpeg -i INPUT -f ffmetadata FFMETADATAFILE
  3959. </pre></div>
  3960. <p>Reinserting edited metadata information from the FFMETADATAFILE file can
  3961. be done as:
  3962. </p><div class="example">
  3963. <pre class="example">ffmpeg -i INPUT -i FFMETADATAFILE -map_metadata 1 -codec copy OUTPUT
  3964. </pre></div>
  3965. <a name="See-Also"></a>
  3966. <h2 class="chapter">6 See Also<span class="pull-right"><a class="anchor hidden-xs" href="#See-Also" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-See-Also" aria-hidden="true">TOC</a></span></h2>
  3967. <p><a href="ffmpeg.html">ffmpeg</a>, <a href="ffplay.html">ffplay</a>, <a href="ffprobe.html">ffprobe</a>,
  3968. <a href="libavformat.html">libavformat</a>
  3969. </p>
  3970. <a name="Authors"></a>
  3971. <h2 class="chapter">7 Authors<span class="pull-right"><a class="anchor hidden-xs" href="#Authors" aria-hidden="true">#</a> <a class="anchor hidden-xs"href="#toc-Authors" aria-hidden="true">TOC</a></span></h2>
  3972. <p>The FFmpeg developers.
  3973. </p>
  3974. <p>For details about the authorship, see the Git history of the project
  3975. (https://git.ffmpeg.org/ffmpeg), e.g. by typing the command
  3976. <code>git log</code> in the FFmpeg source directory, or browsing the
  3977. online repository at <a href="https://git.ffmpeg.org/ffmpeg">https://git.ffmpeg.org/ffmpeg</a>.
  3978. </p>
  3979. <p>Maintainers for the specific components are listed in the file
  3980. <samp>MAINTAINERS</samp> in the source code tree.
  3981. </p>
  3982. </body>
  3983. </html>