muxers.texi 126 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677
  1. @chapter Muxers
  2. @c man begin MUXERS
  3. Muxers are configured elements in FFmpeg which allow writing
  4. multimedia streams to a particular type of file.
  5. When you configure your FFmpeg build, all the supported muxers
  6. are enabled by default. You can list all available muxers using the
  7. configure option @code{--list-muxers}.
  8. You can disable all the muxers with the configure option
  9. @code{--disable-muxers} and selectively enable / disable single muxers
  10. with the options @code{--enable-muxer=@var{MUXER}} /
  11. @code{--disable-muxer=@var{MUXER}}.
  12. The option @code{-muxers} of the ff* tools will display the list of
  13. enabled muxers. Use @code{-formats} to view a combined list of
  14. enabled demuxers and muxers.
  15. A description of some of the currently available muxers follows.
  16. @anchor{raw muxers}
  17. @section Raw muxers
  18. This section covers raw muxers. They accept a single stream matching
  19. the designated codec. They do not store timestamps or metadata. The
  20. recognized extension is the same as the muxer name unless indicated
  21. otherwise.
  22. It comprises the following muxers. The media type and the eventual
  23. extensions used to automatically selects the muxer from the output
  24. extensions are also shown.
  25. @table @samp
  26. @item ac3 @emph{audio}
  27. Dolby Digital, also known as AC-3.
  28. @item adx @emph{audio}
  29. CRI Middleware ADX audio.
  30. This muxer will write out the total sample count near the start of the
  31. first packet when the output is seekable and the count can be stored
  32. in 32 bits.
  33. @item aptx @emph{audio}
  34. aptX (Audio Processing Technology for Bluetooth)
  35. @item aptx_hd @emph{audio} (aptxdh)
  36. aptX HD (Audio Processing Technology for Bluetooth) audio
  37. @item avs2 @emph{video} (avs, avs2)
  38. AVS2-P2 (Audio Video Standard - Second generation - Part 2) /
  39. IEEE 1857.4 video
  40. @item avs3 @emph{video} (avs3)
  41. AVS3-P2 (Audio Video Standard - Third generation - Part 2) /
  42. IEEE 1857.10 video
  43. @item cavsvideo @emph{video} (cavs)
  44. Chinese AVS (Audio Video Standard - First generation)
  45. @item codec2raw @emph{audio}
  46. Codec 2 audio.
  47. No extension is registered so format name has to be supplied e.g. with
  48. the ffmpeg CLI tool @code{-f codec2raw}.
  49. @item data @emph{any}
  50. Generic data muxer.
  51. This muxer accepts a single stream with any codec of any type. The
  52. input stream has to be selected using the @code{-map} option with the
  53. @command{ffmpeg} CLI tool.
  54. No extension is registered so format name has to be supplied e.g. with
  55. the @command{ffmpeg} CLI tool @code{-f data}.
  56. @item dfpwm @emph{audio} (dfpwm)
  57. Raw DFPWM1a (Dynamic Filter Pulse With Modulation) audio muxer.
  58. @item dirac @emph{video} (drc, vc2)
  59. BBC Dirac video.
  60. The Dirac Pro codec is a subset and is standardized as SMPTE VC-2.
  61. @item dnxhd @emph{video} (dnxhd, dnxhr)
  62. Avid DNxHD video.
  63. It is standardized as SMPTE VC-3. Accepts DNxHR streams.
  64. @item dts @emph{audio}
  65. DTS Coherent Acoustics (DCA) audio
  66. @item eac3 @emph{audio}
  67. Dolby Digital Plus, also known as Enhanced AC-3
  68. @item evc @emph{video} (evc)
  69. MPEG-5 Essential Video Coding (EVC) / EVC / MPEG-5 Part 1 EVC video
  70. @item g722 @emph{audio}
  71. ITU-T G.722 audio
  72. @item g723_1 @emph{audio} (tco, rco)
  73. ITU-T G.723.1 audio
  74. @item g726 @emph{audio}
  75. ITU-T G.726 big-endian ("left-justified") audio.
  76. No extension is registered so format name has to be supplied e.g. with
  77. the @command{ffmpeg} CLI tool @code{-f g726}.
  78. @item g726le @emph{audio}
  79. ITU-T G.726 little-endian ("right-justified") audio.
  80. No extension is registered so format name has to be supplied e.g. with
  81. the @command{ffmpeg} CLI tool @code{-f g726le}.
  82. @item gsm @emph{audio}
  83. Global System for Mobile Communications audio
  84. @item h261 @emph{video}
  85. ITU-T H.261 video
  86. @item h263 @emph{video}
  87. ITU-T H.263 / H.263-1996, H.263+ / H.263-1998 / H.263 version 2 video
  88. @item h264 @emph{video} (h264, 264)
  89. ITU-T H.264 / MPEG-4 Part 10 AVC video. Bitstream shall be converted
  90. to Annex B syntax if it's in length-prefixed mode.
  91. @item hevc @emph{video} (hevc, h265, 265)
  92. ITU-T H.265 / MPEG-H Part 2 HEVC video. Bitstream shall be converted
  93. to Annex B syntax if it's in length-prefixed mode.
  94. @item m4v @emph{video}
  95. MPEG-4 Part 2 video
  96. @item mjpeg @emph{video} (mjpg, mjpeg)
  97. Motion JPEG video
  98. @item mlp @emph{audio}
  99. Meridian Lossless Packing, also known as Packed PCM
  100. @item mp2 @emph{audio} (mp2, m2a, mpa)
  101. MPEG-1 Audio Layer II audio
  102. @item mpeg1video @emph{video} (mpg, mpeg, m1v)
  103. MPEG-1 Part 2 video.
  104. @item mpeg2video @emph{video} (m2v)
  105. ITU-T H.262 / MPEG-2 Part 2 video
  106. @item obu @emph{video}
  107. AV1 low overhead Open Bitstream Units muxer.
  108. Temporal delimiter OBUs will be inserted in all temporal units of the
  109. stream.
  110. @item rawvideo @emph{video} (yuv, rgb)
  111. Raw uncompressed video.
  112. @item sbc @emph{audio} (sbc, msbc)
  113. Bluetooth SIG low-complexity subband codec audio
  114. @item truehd @emph{audio} (thd)
  115. Dolby TrueHD audio
  116. @item vc1 @emph{video}
  117. SMPTE 421M / VC-1 video
  118. @end table
  119. @subsection Examples
  120. @itemize
  121. @item
  122. Store raw video frames with the @samp{rawvideo} muxer using @command{ffmpeg}:
  123. @example
  124. ffmpeg -f lavfi -i testsrc -t 10 -s hd1080p testsrc.yuv
  125. @end example
  126. Since the rawvideo muxer do not store the information related to size
  127. and format, this information must be provided when demuxing the file:
  128. @example
  129. ffplay -video_size 1920x1080 -pixel_format rgb24 -f rawvideo testsrc.rgb
  130. @end example
  131. @end itemize
  132. @section Raw PCM muxers
  133. This section covers raw PCM (Pulse-Code Modulation) audio muxers.
  134. They accept a single stream matching the designated codec. They do not
  135. store timestamps or metadata. The recognized extension is the same as
  136. the muxer name.
  137. It comprises the following muxers. The optional additional extension
  138. used to automatically select the muxer from the output extension is
  139. also shown in parentheses.
  140. @table @samp
  141. @item alaw (al)
  142. PCM A-law
  143. @item f32be
  144. PCM 32-bit floating-point big-endian
  145. @item f32le
  146. PCM 32-bit floating-point little-endian
  147. @item f64be
  148. PCM 64-bit floating-point big-endian
  149. @item f64le
  150. PCM 64-bit floating-point little-endian
  151. @item mulaw (ul)
  152. PCM mu-law
  153. @item s16be
  154. PCM signed 16-bit big-endian
  155. @item s16le
  156. PCM signed 16-bit little-endian
  157. @item s24be
  158. PCM signed 24-bit big-endian
  159. @item s24le
  160. PCM signed 24-bit little-endian
  161. @item s32be
  162. PCM signed 32-bit big-endian
  163. @item s32le
  164. PCM signed 32-bit little-endian
  165. @item s8 (sb)
  166. PCM signed 8-bit
  167. @item u16be
  168. PCM unsigned 16-bit big-endian
  169. @item u16le
  170. PCM unsigned 16-bit little-endian
  171. @item u24be
  172. PCM unsigned 24-bit big-endian
  173. @item u24le
  174. PCM unsigned 24-bit little-endian
  175. @item u32be
  176. PCM unsigned 32-bit big-endian
  177. @item u32le
  178. PCM unsigned 32-bit little-endian
  179. @item u8 (ub)
  180. PCM unsigned 8-bit
  181. @item vidc
  182. PCM Archimedes VIDC
  183. @end table
  184. @section MPEG-1/MPEG-2 program stream muxers
  185. This section covers formats belonging to the MPEG-1 and MPEG-2 Systems
  186. family.
  187. The MPEG-1 Systems format (also known as ISO/IEEC 11172-1 or MPEG-1
  188. program stream) has been adopted for the format of media track stored
  189. in VCD (Video Compact Disc).
  190. The MPEG-2 Systems standard (also known as ISO/IEEC 13818-1) covers
  191. two containers formats, one known as transport stream and one known as
  192. program stream; only the latter is covered here.
  193. The MPEG-2 program stream format (also known as VOB due to the
  194. corresponding file extension) is an extension of MPEG-1 program
  195. stream: in addition to support different codecs for the audio and
  196. video streams, it also stores subtitles and navigation metadata.
  197. MPEG-2 program stream has been adopted for storing media streams in
  198. SVCD and DVD storage devices.
  199. This section comprises the following muxers.
  200. @table @samp
  201. @item mpeg (mpg,mpeg)
  202. MPEG-1 Systems / MPEG-1 program stream muxer.
  203. @item vcd
  204. MPEG-1 Systems / MPEG-1 program stream (VCD) muxer.
  205. This muxer can be used to generate tracks in the format accepted by
  206. the VCD (Video Compact Disc) storage devices.
  207. It is the same as the @samp{mpeg} muxer with a few differences.
  208. @item vob
  209. MPEG-2 program stream (VOB) muxer.
  210. @item dvd
  211. MPEG-2 program stream (DVD VOB) muxer.
  212. This muxer can be used to generate tracks in the format accepted by
  213. the DVD (Digital Versatile Disc) storage devices.
  214. This is the same as the @samp{vob} muxer with a few differences.
  215. @item svcd (vob)
  216. MPEG-2 program stream (SVCD VOB) muxer.
  217. This muxer can be used to generate tracks in the format accepted by
  218. the SVCD (Super Video Compact Disc) storage devices.
  219. This is the same as the @samp{vob} muxer with a few differences.
  220. @end table
  221. @subsection Options
  222. @table @option
  223. @item muxrate @var{rate}
  224. Set user-defined mux rate expressed as a number of bits/s. If not
  225. specied the automatically computed mux rate is employed. Default value
  226. is @code{0}.
  227. @item preload @var{delay}
  228. Set initial demux-decode delay in microseconds. Default value is
  229. @code{500000}.
  230. @end table
  231. @section MOV/MPEG-4/ISOMBFF muxers
  232. This section covers formats belonging to the QuickTime / MOV family,
  233. including the MPEG-4 Part 14 format and ISO base media file format
  234. (ISOBMFF). These formats share a common structure based on the ISO
  235. base media file format (ISOBMFF).
  236. The MOV format was originally developed for use with Apple QuickTime.
  237. It was later used as the basis for the MPEG-4 Part 1 (later Part 14)
  238. format, also known as ISO/IEC 14496-1. That format was then
  239. generalized into ISOBMFF, also named MPEG-4 Part 12 format, ISO/IEC
  240. 14496-12, or ISO/IEC 15444-12.
  241. It comprises the following muxers.
  242. @table @samp
  243. @item 3gp
  244. Third Generation Partnership Project (3GPP) format for 3G UMTS
  245. multimedia services
  246. @item 3g2
  247. Third Generation Partnership Project 2 (3GP2 or 3GPP2) format for 3G
  248. CDMA2000 multimedia services, similar to @samp{3gp} with extensions
  249. and limitations
  250. @item f4v
  251. Adobe Flash Video format
  252. @item ipod
  253. MPEG-4 audio file format, as MOV/MP4 but limited to contain only audio
  254. streams, typically played with the Apple ipod device
  255. @item ismv
  256. Microsoft IIS (Internet Information Services) Smooth Streaming
  257. Audio/Video (ISMV or ISMA) format. This is based on MPEG-4 Part 14
  258. format with a few incompatible variants, used to stream media files
  259. for the Microsoft IIS server.
  260. @item mov
  261. QuickTime player format identified by the @code{.mov} extension
  262. @item mp4
  263. MP4 or MPEG-4 Part 14 format
  264. @item psp
  265. PlayStation Portable MP4/MPEG-4 Part 14 format variant. This is based
  266. on MPEG-4 Part 14 format with a few incompatible variants, used to
  267. play files on PlayStation devices.
  268. @end table
  269. @subsection Fragmentation
  270. The @samp{mov}, @samp{mp4}, and @samp{ismv} muxers support
  271. fragmentation. Normally, a MOV/MP4 file has all the metadata about all
  272. packets stored in one location.
  273. This data is usually written at the end of the file, but it can be
  274. moved to the start for better playback by adding @code{+faststart} to
  275. the @code{-movflags}, or using the @command{qt-faststart} tool).
  276. A fragmented file consists of a number of fragments, where packets and
  277. metadata about these packets are stored together. Writing a fragmented
  278. file has the advantage that the file is decodable even if the writing
  279. is interrupted (while a normal MOV/MP4 is undecodable if it is not
  280. properly finished), and it requires less memory when writing very long
  281. files (since writing normal MOV/MP4 files stores info about every
  282. single packet in memory until the file is closed). The downside is
  283. that it is less compatible with other applications.
  284. Fragmentation is enabled by setting one of the options that define
  285. how to cut the file into fragments:
  286. @table @option
  287. @item frag_duration
  288. @item frag_size
  289. @item min_frag_duration
  290. @item movflags +frag_keyframe
  291. @item movflags +frag_custom
  292. @end table
  293. If more than one condition is specified, fragments are cut when one of
  294. the specified conditions is fulfilled. The exception to this is the
  295. option @option{min_frag_duration}, which has to be fulfilled for any
  296. of the other conditions to apply.
  297. @subsection Options
  298. @table @option
  299. @item brand @var{brand_string}
  300. Override major brand.
  301. @item empty_hdlr_name @var{bool}
  302. Enable to skip writing the name inside a @code{hdlr} box.
  303. Default is @code{false}.
  304. @item encryption_key @var{key}
  305. set the media encryption key in hexadecimal format
  306. @item encryption_kid @var{kid}
  307. set the media encryption key identifier in hexadecimal format
  308. @item encryption_scheme @var{scheme}
  309. configure the encryption scheme, allowed values are @samp{none}, and
  310. @samp{cenc-aes-ctr}
  311. @item frag_duration @var{duration}
  312. Create fragments that are @var{duration} microseconds long.
  313. @item frag_interleave @var{number}
  314. Interleave samples within fragments (max number of consecutive
  315. samples, lower is tighter interleaving, but with more overhead. It is
  316. set to @code{0} by default.
  317. @item frag_size @var{size}
  318. create fragments that contain up to @var{size} bytes of payload data
  319. @item iods_audio_profile @var{profile}
  320. specify iods number for the audio profile atom (from -1 to 255),
  321. default is @code{-1}
  322. @item iods_video_profile @var{profile}
  323. specify iods number for the video profile atom (from -1 to 255),
  324. default is @code{-1}
  325. @item ism_lookahead @var{num_entries}
  326. specify number of lookahead entries for ISM files (from 0 to 255),
  327. default is @code{0}
  328. @item min_frag_duration @var{duration}
  329. do not create fragments that are shorter than @var{duration} microseconds long
  330. @item moov_size @var{bytes}
  331. Reserves space for the moov atom at the beginning of the file instead of placing the
  332. moov atom at the end. If the space reserved is insufficient, muxing will fail.
  333. @item mov_gamma @var{gamma}
  334. specify gamma value for gama atom (as a decimal number from 0 to 10),
  335. default is @code{0.0}, must be set together with @code{+ movflags}
  336. @item movflags @var{flags}
  337. Set various muxing switches. The following flags can be used:
  338. @table @samp
  339. @item cmaf
  340. write CMAF (Common Media Application Format) compatible fragmented
  341. MP4 output
  342. @item dash
  343. write DASH (Dynamic Adaptive Streaming over HTTP) compatible fragmented
  344. MP4 output
  345. @item default_base_moof
  346. Similarly to the @samp{omit_tfhd_offset} flag, this flag avoids
  347. writing the absolute base_data_offset field in tfhd atoms, but does so
  348. by using the new default-base-is-moof flag instead. This flag is new
  349. from 14496-12:2012. This may make the fragments easier to parse in
  350. certain circumstances (avoiding basing track fragment location
  351. calculations on the implicit end of the previous track fragment).
  352. @item delay_moov
  353. delay writing the initial moov until the first fragment is cut, or
  354. until the first fragment flush
  355. @item disable_chpl
  356. Disable Nero chapter markers (chpl atom). Normally, both Nero chapters
  357. and a QuickTime chapter track are written to the file. With this
  358. option set, only the QuickTime chapter track will be written. Nero
  359. chapters can cause failures when the file is reprocessed with certain
  360. tagging programs, like mp3Tag 2.61a and iTunes 11.3, most likely other
  361. versions are affected as well.
  362. @item faststart
  363. Run a second pass moving the index (moov atom) to the beginning of the
  364. file. This operation can take a while, and will not work in various
  365. situations such as fragmented output, thus it is not enabled by
  366. default.
  367. @item frag_custom
  368. Allow the caller to manually choose when to cut fragments, by calling
  369. @code{av_write_frame(ctx, NULL)} to write a fragment with the packets
  370. written so far. (This is only useful with other applications
  371. integrating libavformat, not from @command{ffmpeg}.)
  372. @item frag_discont
  373. signal that the next fragment is discontinuous from earlier ones
  374. @item frag_every_frame
  375. fragment at every frame
  376. @item frag_keyframe
  377. start a new fragment at each video keyframe
  378. @item global_sidx
  379. write a global sidx index at the start of the file
  380. @item isml
  381. create a live smooth streaming feed (for pushing to a publishing point)
  382. @item negative_cts_offsets
  383. Enables utilization of version 1 of the CTTS box, in which the CTS offsets can
  384. be negative. This enables the initial sample to have DTS/CTS of zero, and
  385. reduces the need for edit lists for some cases such as video tracks with
  386. B-frames. Additionally, eases conformance with the DASH-IF interoperability
  387. guidelines.
  388. This option is implicitly set when writing @samp{ismv} (Smooth
  389. Streaming) files.
  390. @item omit_tfhd_offset
  391. Do not write any absolute base_data_offset in tfhd atoms. This avoids
  392. tying fragments to absolute byte positions in the file/streams.
  393. @item prefer_icc
  394. If writing colr atom prioritise usage of ICC profile if it exists in
  395. stream packet side data.
  396. @item rtphint
  397. add RTP hinting tracks to the output file
  398. @item separate_moof
  399. Write a separate moof (movie fragment) atom for each track. Normally,
  400. packets for all tracks are written in a moof atom (which is slightly
  401. more efficient), but with this option set, the muxer writes one
  402. moof/mdat pair for each track, making it easier to separate tracks.
  403. @item skip_sidx
  404. Skip writing of sidx atom. When bitrate overhead due to sidx atom is
  405. high, this option could be used for cases where sidx atom is not
  406. mandatory. When the @samp{global_sidx} flag is enabled, this option
  407. is ignored.
  408. @item skip_trailer
  409. skip writing the mfra/tfra/mfro trailer for fragmented files
  410. @item use_metadata_tags
  411. use mdta atom for metadata
  412. @item write_colr
  413. write colr atom even if the color info is unspecified. This flag is
  414. experimental, may be renamed or changed, do not use from scripts.
  415. @item write_gama
  416. write deprecated gama atom
  417. @end table
  418. @item movie_timescale @var{scale}
  419. Set the timescale written in the movie header box (@code{mvhd}).
  420. Range is 1 to INT_MAX. Default is @code{1000}.
  421. @item rtpflags @var{flags}
  422. Add RTP hinting tracks to the output file.
  423. The following flags can be used:
  424. @table @samp
  425. @item h264_mode0
  426. use mode 0 for H.264 in RTP
  427. @item latm
  428. use MP4A-LATM packetization instead of MPEG4-GENERIC for AAC
  429. @item rfc2190
  430. use RFC 2190 packetization instead of RFC 4629 for H.263
  431. @item send_bye
  432. send RTCP BYE packets when finishing
  433. @item skip_rtcp
  434. do not send RTCP sender reports
  435. @end table
  436. @item skip_iods @var{bool}
  437. skip writing iods atom (default value is @code{true})
  438. @item use_editlist @var{bool}
  439. use edit list (default value is @code{auto})
  440. @item use_stream_ids_as_track_ids @var{bool}
  441. use stream ids as track ids (default value is @code{false})
  442. @item video_track_timescale @var{scale}
  443. Set the timescale used for video tracks. Range is @code{0} to INT_MAX. If
  444. set to @code{0}, the timescale is automatically set based on the
  445. native stream time base. Default is @code{0}.
  446. @item write_btrt @var{bool}
  447. Force or disable writing bitrate box inside stsd box of a track. The
  448. box contains decoding buffer size (in bytes), maximum bitrate and
  449. average bitrate for the track. The box will be skipped if none of
  450. these values can be computed. Default is @code{-1} or @code{auto},
  451. which will write the box only in MP4 mode.
  452. @item write_prft @var{option}
  453. Write producer time reference box (PRFT) with a specified time source for the
  454. NTP field in the PRFT box. Set value as @samp{wallclock} to specify timesource
  455. as wallclock time and @samp{pts} to specify timesource as input packets' PTS
  456. values.
  457. @item write_tmcd @var{bool}
  458. Specify @code{on} to force writing a timecode track, @code{off} to disable it
  459. and @code{auto} to write a timecode track only for mov and mp4 output (default).
  460. Setting value to @samp{pts} is applicable only for a live encoding use case,
  461. where PTS values are set as as wallclock time at the source. For example, an
  462. encoding use case with decklink capture source where @option{video_pts} and
  463. @option{audio_pts} are set to @samp{abs_wallclock}.
  464. @end table
  465. @subsection Examples
  466. @itemize
  467. @item
  468. Push Smooth Streaming content in real time to a publishing point on
  469. IIS with the @samp{ismv} muxer using @command{ffmpeg}:
  470. @example
  471. ffmpeg -re @var{<normal input/transcoding options>} -movflags isml+frag_keyframe -f ismv http://server/publishingpoint.isml/Streams(Encoder1)
  472. @end example
  473. @end itemize
  474. @anchor{a64}
  475. @section a64
  476. A64 Commodore 64 video muxer.
  477. This muxer accepts a single @code{a64_multi} or @code{a64_multi5}
  478. codec video stream.
  479. @section ac4
  480. Raw AC-4 audio muxer.
  481. This muxer accepts a single @code{ac4} audio stream.
  482. @subsection Options
  483. @table @option
  484. @item write_crc @var{bool}
  485. when enabled, write a CRC checksum for each packet to the output,
  486. default is @code{false}
  487. @end table
  488. @anchor{adts}
  489. @section adts
  490. Audio Data Transport Stream muxer.
  491. It accepts a single AAC stream.
  492. @subsection Options
  493. @table @option
  494. @item write_id3v2 @var{bool}
  495. Enable to write ID3v2.4 tags at the start of the stream. Default is
  496. disabled.
  497. @item write_apetag @var{bool}
  498. Enable to write APE tags at the end of the stream. Default is
  499. disabled.
  500. @item write_mpeg2 @var{bool}
  501. Enable to set MPEG version bit in the ADTS frame header to 1 which
  502. indicates MPEG-2. Default is 0, which indicates MPEG-4.
  503. @end table
  504. @anchor{aea}
  505. @section aea
  506. MD STUDIO audio muxer.
  507. This muxer accepts a single ATRAC1 audio stream with either one or two channels
  508. and a sample rate of 44100Hz.
  509. As AEA supports storing the track title, this muxer will also write
  510. the title from stream's metadata to the container.
  511. @anchor{aiff}
  512. @section aiff
  513. Audio Interchange File Format muxer.
  514. @subsection Options
  515. @table @option
  516. @item write_id3v2 @var{bool}
  517. Enable ID3v2 tags writing when set to 1. Default is 0 (disabled).
  518. @item id3v2_version @var{bool}
  519. Select ID3v2 version to write. Currently only version 3 and 4 (aka.
  520. ID3v2.3 and ID3v2.4) are supported. The default is version 4.
  521. @end table
  522. @anchor{alp}
  523. @section alp
  524. High Voltage Software's Lego Racers game audio muxer.
  525. It accepts a single ADPCM_IMA_ALP stream with no more than 2 channels
  526. and a sample rate not greater than 44100 Hz.
  527. Extensions: @code{tun}, @code{pcm}
  528. @subsection Options
  529. @table @option
  530. @item type @var{type}
  531. Set file type.
  532. @var{type} accepts the following values:
  533. @table @samp
  534. @item tun
  535. Set file type as music. Must have a sample rate of 22050 Hz.
  536. @item pcm
  537. Set file type as sfx.
  538. @item auto
  539. Set file type as per output file extension. @code{.pcm} results in
  540. type @code{pcm} else type @code{tun} is set. @var{(default)}
  541. @end table
  542. @end table
  543. @section amr
  544. 3GPP AMR (Adaptive Multi-Rate) audio muxer.
  545. It accepts a single audio stream containing an AMR NB stream.
  546. @section amv
  547. AMV (Actions Media Video) format muxer.
  548. @section apm
  549. Ubisoft Rayman 2 APM audio muxer.
  550. It accepts a single ADPCM IMA APM audio stream.
  551. @section apng
  552. Animated Portable Network Graphics muxer.
  553. It accepts a single APNG video stream.
  554. @subsection Options
  555. @table @option
  556. @item final_delay @var{delay}
  557. Force a delay expressed in seconds after the last frame of each
  558. repetition. Default value is @code{0.0}.
  559. @item plays @var{repetitions}
  560. specify how many times to play the content, @code{0} causes an infinte
  561. loop, with @code{1} there is no loop
  562. @end table
  563. @subsection Examples
  564. @itemize
  565. @item
  566. Use @command{ffmpeg} to generate an APNG output with 2 repetitions,
  567. and with a delay of half a second after the first repetition:
  568. @example
  569. ffmpeg -i INPUT -final_delay 0.5 -plays 2 out.apng
  570. @end example
  571. @end itemize
  572. @section argo_asf
  573. Argonaut Games ASF audio muxer.
  574. It accepts a single ADPCM audio stream.
  575. @subsection Options
  576. @table @option
  577. @item version_major @var{version}
  578. override file major version, specified as an integer, default value is
  579. @code{2}
  580. @item version_minor @var{version}
  581. override file minor version, specified as an integer, default value is
  582. @code{1}
  583. @item name @var{name}
  584. Embed file name into file, if not specified use the output file
  585. name. The name is truncated to 8 characters.
  586. @end table
  587. @section argo_cvg
  588. Argonaut Games CVG audio muxer.
  589. It accepts a single one-channel ADPCM 22050Hz audio stream.
  590. The @option{loop} and @option{reverb} options set the corresponding
  591. flags in the header which can be later retrieved to process the audio
  592. stream accordingly.
  593. @subsection Options
  594. @table @option
  595. @item skip_rate_check @var{bool}
  596. skip sample rate check (default is @code{false})
  597. @item loop @var{bool}
  598. set loop flag (default is @code{false})
  599. @item reverb @var{boolean}
  600. set reverb flag (default is @code{true})
  601. @end table
  602. @anchor{asf}
  603. @section asf, asf_stream
  604. Advanced / Active Systems (or Streaming) Format audio muxer.
  605. The @samp{asf_stream} variant should be selected for streaming.
  606. Note that Windows Media Audio (wma) and Windows Media Video (wmv) use this
  607. muxer too.
  608. @subsection Options
  609. @table @option
  610. @item packet_size @var{size}
  611. Set the muxer packet size as a number of bytes. By tuning this setting
  612. you may reduce data fragmentation or muxer overhead depending on your
  613. source. Default value is @code{3200}, minimum is @code{100}, maximum
  614. is @code{64Ki}.
  615. @end table
  616. @section ass
  617. ASS/SSA (SubStation Alpha) subtitles muxer.
  618. It accepts a single ASS subtitles stream.
  619. @subsection Options
  620. @table @option
  621. @item ignore_readorder @var{bool}
  622. Write dialogue events immediately, even if they are out-of-order,
  623. default is @code{false}, otherwise they are cached until the expected
  624. time event is found.
  625. @end table
  626. @section ast
  627. AST (Audio Stream) muxer.
  628. This format is used to play audio on some Nintendo Wii games.
  629. It accepts a single audio stream.
  630. The @option{loopstart} and @option{loopend} options can be used to
  631. define a section of the file to loop for players honoring such
  632. options.
  633. @subsection Options
  634. @table @option
  635. @item loopstart @var{start}
  636. Specify loop start position expressesd in milliseconds, from @code{-1}
  637. to @code{INT_MAX}, in case @code{-1} is set then no loop is specified
  638. (default -1) and the @option{loopend} value is ignored.
  639. @item loopend @var{end}
  640. Specify loop end position expressed in milliseconds, from @code{0} to
  641. @code{INT_MAX}, default is @code{0}, in case @code{0} is set it
  642. assumes the total stream duration.
  643. @end table
  644. @section au
  645. SUN AU audio muxer.
  646. It accepts a single audio stream.
  647. @anchor{avi}
  648. @section avi
  649. Audio Video Interleaved muxer.
  650. AVI is a proprietary format developed by Microsoft, and later formally specified
  651. through the Open DML specification.
  652. Because of differences in players implementations, it might be required to set
  653. some options to make sure that the generated output can be correctly played by
  654. the target player.
  655. @subsection Options
  656. @table @option
  657. @item flipped_raw_rgb @var{bool}
  658. If set to @code{true}, store positive height for raw RGB bitmaps, which
  659. indicates bitmap is stored bottom-up. Note that this option does not flip the
  660. bitmap which has to be done manually beforehand, e.g. by using the @samp{vflip}
  661. filter. Default is @code{false} and indicates bitmap is stored top down.
  662. @item reserve_index_space @var{size}
  663. Reserve the specified amount of bytes for the OpenDML master index of each
  664. stream within the file header. By default additional master indexes are
  665. embedded within the data packets if there is no space left in the first master
  666. index and are linked together as a chain of indexes. This index structure can
  667. cause problems for some use cases, e.g. third-party software strictly relying
  668. on the OpenDML index specification or when file seeking is slow. Reserving
  669. enough index space in the file header avoids these problems.
  670. The required index space depends on the output file size and should be about 16
  671. bytes per gigabyte. When this option is omitted or set to zero the necessary
  672. index space is guessed.
  673. Default value is @code{0}.
  674. @item write_channel_mask @var{bool}
  675. Write the channel layout mask into the audio stream header.
  676. This option is enabled by default. Disabling the channel mask can be useful in
  677. specific scenarios, e.g. when merging multiple audio streams into one for
  678. compatibility with software that only supports a single audio stream in AVI
  679. (see @ref{amerge,,the "amerge" section in the ffmpeg-filters manual,ffmpeg-filters}).
  680. @end table
  681. @section avif
  682. AV1 (Alliance for Open Media Video codec 1) image format muxer.
  683. This muxers stores images encoded using the AV1 codec.
  684. It accepts one or two video streams. In case two video streams are
  685. provided, the second one shall contain a single plane storing the
  686. alpha mask.
  687. In case more than one image is provided, the generated output is
  688. considered an animated AVIF and the number of loops can be specified
  689. with the @option{loop} option.
  690. This is based on the specification by Alliance for Open Media at url
  691. @url{https://aomediacodec.github.io/av1-avif}.
  692. @subsection Options
  693. @table @option
  694. @item loop @var{count}
  695. number of times to loop an animated AVIF, @code{0} specify an infinite
  696. loop, default is @code{0}
  697. @item movie_timescale @var{timescale}
  698. Set the timescale written in the movie header box (@code{mvhd}).
  699. Range is 1 to INT_MAX. Default is @code{1000}.
  700. @end table
  701. @section avm2
  702. ShockWave Flash (SWF) / ActionScript Virtual Machine 2 (AVM2) format muxer.
  703. It accepts one audio stream, one video stream, or both.
  704. @section bit
  705. G.729 (.bit) file format muxer.
  706. It accepts a single G.729 audio stream.
  707. @section caf
  708. Apple CAF (Core Audio Format) muxer.
  709. It accepts a single audio stream.
  710. @section codec2
  711. Codec2 audio audio muxer.
  712. It accepts a single codec2 audio stream.
  713. @anchor{chromaprint}
  714. @section chromaprint
  715. Chromaprint fingerprinter muxers.
  716. To enable compilation of this filter you need to configure FFmpeg with
  717. @code{--enable-chromaprint}.
  718. This muxer feeds audio data to the Chromaprint library, which
  719. generates a fingerprint for the provided audio data. See:
  720. @url{https://acoustid.org/chromaprint}
  721. It takes a single signed native-endian 16-bit raw audio stream of at
  722. most 2 channels.
  723. @subsection Options
  724. @table @option
  725. @item algorithm @var{version}
  726. Select version of algorithm to fingerprint with. Range is @code{0} to
  727. @code{4}. Version @code{3} enables silence detection. Default is @code{1}.
  728. @item fp_format @var{format}
  729. Format to output the fingerprint as. Accepts the following options:
  730. @table @samp
  731. @item base64
  732. Base64 compressed fingerprint @emph{(default)}
  733. @item compressed
  734. Binary compressed fingerprint
  735. @item raw
  736. Binary raw fingerprint
  737. @end table
  738. @item silence_threshold @var{threshold}
  739. Threshold for detecting silence. Range is from @code{-1} to
  740. @code{32767}, where @code{-1} disables silence detection. Silence
  741. detection can only be used with version @code{3} of the algorithm.
  742. Silence detection must be disabled for use with the AcoustID
  743. service. Default is @code{-1}.
  744. @end table
  745. @anchor{crc}
  746. @section crc
  747. CRC (Cyclic Redundancy Check) muxer.
  748. This muxer computes and prints the Adler-32 CRC of all the input audio
  749. and video frames. By default audio frames are converted to signed
  750. 16-bit raw audio and video frames to raw video before computing the
  751. CRC.
  752. The output of the muxer consists of a single line of the form:
  753. CRC=0x@var{CRC}, where @var{CRC} is a hexadecimal number 0-padded to
  754. 8 digits containing the CRC for all the decoded input frames.
  755. See also the @ref{framecrc} muxer.
  756. @subsection Examples
  757. @itemize
  758. @item
  759. Use @command{ffmpeg} to compute the CRC of the input, and store it in
  760. the file @file{out.crc}:
  761. @example
  762. ffmpeg -i INPUT -f crc out.crc
  763. @end example
  764. @item
  765. Use @command{ffmpeg} to print the CRC to stdout with the command:
  766. @example
  767. ffmpeg -i INPUT -f crc -
  768. @end example
  769. @item
  770. You can select the output format of each frame with @command{ffmpeg} by
  771. specifying the audio and video codec and format. For example, to
  772. compute the CRC of the input audio converted to PCM unsigned 8-bit
  773. and the input video converted to MPEG-2 video, use the command:
  774. @example
  775. ffmpeg -i INPUT -c:a pcm_u8 -c:v mpeg2video -f crc -
  776. @end example
  777. @end itemize
  778. @anchor{dash}
  779. @section dash
  780. Dynamic Adaptive Streaming over HTTP (DASH) muxer.
  781. This muxer creates segments and manifest files according to the
  782. MPEG-DASH standard ISO/IEC 23009-1:2014 and following standard
  783. updates.
  784. For more information see:
  785. @itemize @bullet
  786. @item
  787. ISO DASH Specification: @url{http://standards.iso.org/ittf/PubliclyAvailableStandards/c065274_ISO_IEC_23009-1_2014.zip}
  788. @item
  789. WebM DASH Specification: @url{https://sites.google.com/a/webmproject.org/wiki/adaptive-streaming/webm-dash-specification}
  790. @end itemize
  791. This muxer creates an MPD (Media Presentation Description) manifest
  792. file and segment files for each stream. Segment files are placed in
  793. the same directory of the MPD manifest file.
  794. The segment filename might contain pre-defined identifiers used in the
  795. manifest @code{SegmentTemplate} section as defined in section
  796. 5.3.9.4.4 of the standard.
  797. Available identifiers are @code{$RepresentationID$}, @code{$Number$},
  798. @code{$Bandwidth$}, and @code{$Time$}. In addition to the standard
  799. identifiers, an ffmpeg-specific @code{$ext$} identifier is also
  800. supported. When specified, @command{ffmpeg} will replace @code{$ext$}
  801. in the file name with muxing format's extensions such as @code{mp4},
  802. @code{webm} etc.
  803. @subsection Options
  804. @table @option
  805. @item adaptation_sets @var{adaptation_sets}
  806. Assign streams to adaptation sets, specified in the MPD manifest
  807. @code{AdaptationSets} section.
  808. An adaptation set contains a set of one or more streams accessed as a
  809. single subset, e.g. corresponding streams encoded at different size
  810. selectable by the user depending on the available bandwidth, or to
  811. different audio streams with a different language.
  812. Each adaptation set is specified with the syntax:
  813. @example
  814. id=@var{index},streams=@var{streams}
  815. @end example
  816. where @var{index} must be a numerical index, and @var{streams} is a
  817. sequence of @code{,}-separated stream indices. Multiple adaptation
  818. sets can be specified, separated by spaces.
  819. To map all video (or audio) streams to an adaptation set, @code{v} (or
  820. @code{a}) can be used as stream identifier instead of IDs.
  821. When no assignment is defined, this defaults to an adaptation set for
  822. each stream.
  823. The following optional fields can also be specified:
  824. @table @option
  825. @item descriptor
  826. Define the descriptor as defined by ISO/IEC 23009-1:2014/Amd.2:2015.
  827. For example:
  828. @example
  829. <SupplementalProperty schemeIdUri=\"urn:mpeg:dash:srd:2014\" value=\"0,0,0,1,1,2,2\"/>
  830. @end example
  831. The descriptor string should be a self-closing XML tag.
  832. @item frag_duration
  833. Override the global fragment duration specified with the
  834. @option{frag_duration} option.
  835. @item frag_type
  836. Override the global fragment type specified with the
  837. @option{frag_type} option.
  838. @item seg_duration
  839. Override the global segment duration specified with the
  840. @option{seg_duration} option.
  841. @item trick_id
  842. Mark an adaptation set as containing streams meant to be used for
  843. Trick Mode for the referenced adaptation set.
  844. @end table
  845. A few examples of possible values for the @option{adaptation_sets}
  846. option follow:
  847. @example
  848. id=0,seg_duration=2,frag_duration=1,frag_type=duration,streams=v id=1,seg_duration=2,frag_type=none,streams=a
  849. @end example
  850. @example
  851. id=0,seg_duration=2,frag_type=none,streams=0 id=1,seg_duration=10,frag_type=none,trick_id=0,streams=1
  852. @end example
  853. @item dash_segment_type @var{type}
  854. Set DASH segment files type.
  855. Possible values:
  856. @table @samp
  857. @item auto
  858. The dash segment files format will be selected based on the stream
  859. codec. This is the default mode.
  860. @item mp4
  861. the dash segment files will be in ISOBMFF/MP4 format
  862. @item webm
  863. the dash segment files will be in WebM format
  864. @end table
  865. @item extra_window_size @var{size}
  866. Set the maximum number of segments kept outside of the manifest before
  867. removing from disk.
  868. @item format_options @var{options_list}
  869. Set container format (mp4/webm) options using a @code{:}-separated list of
  870. key=value parameters. Values containing @code{:} special characters must be
  871. escaped.
  872. @item frag_duration @var{duration}
  873. Set the length in seconds of fragments within segments, fractional
  874. value can also be set.
  875. @item frag_type @var{type}
  876. Set the type of interval for fragmentation.
  877. Possible values:
  878. @table @samp
  879. @item auto
  880. set one fragment per segment
  881. @item every_frame
  882. fragment at every frame
  883. @item duration
  884. fragment at specific time intervals
  885. @item pframes
  886. fragment at keyframes and following P-Frame reordering (Video only,
  887. experimental)
  888. @end table
  889. @item global_sidx @var{bool}
  890. Write global @code{SIDX} atom. Applicable only for single file, mp4
  891. output, non-streaming mode.
  892. @item hls_master_name @var{file_name}
  893. HLS master playlist name. Default is @file{master.m3u8}.
  894. @item hls_playlist @var{bool}
  895. Generate HLS playlist files. The master playlist is generated with
  896. filename specified by the @option{hls_master_name} option. One media
  897. playlist file is generated for each stream with filenames
  898. @file{media_0.m3u8}, @file{media_1.m3u8}, etc.
  899. @item http_opts @var{http_opts}
  900. Specify a list of @code{:}-separated key=value options to pass to the
  901. underlying HTTP protocol. Applicable only for HTTP output.
  902. @item http_persistent @var{bool}
  903. Use persistent HTTP connections. Applicable only for HTTP output.
  904. @item http_user_agent @var{user_agent}
  905. Override User-Agent field in HTTP header. Applicable only for HTTP
  906. output.
  907. @item ignore_io_errors @var{bool}
  908. Ignore IO errors during open and write. Useful for long-duration runs
  909. with network output. This is disabled by default.
  910. @item index_correction @var{bool}
  911. Enable or disable segment index correction logic. Applicable only when
  912. @option{use_template} is enabled and @option{use_timeline} is
  913. disabled. This is disabled by default.
  914. When enabled, the logic monitors the flow of segment indexes. If a
  915. streams's segment index value is not at the expected real time
  916. position, then the logic corrects that index value.
  917. Typically this logic is needed in live streaming use cases. The
  918. network bandwidth fluctuations are common during long run
  919. streaming. Each fluctuation can cause the segment indexes fall behind
  920. the expected real time position.
  921. @item init_seg_name @var{init_name}
  922. DASH-templated name to use for the initialization segment. Default is
  923. @code{init-stream$RepresentationID$.$ext$}. @code{$ext$} is replaced
  924. with the file name extension specific for the segment format.
  925. @item ldash @var{bool}
  926. Enable Low-latency Dash by constraining the presence and values of
  927. some elements. This is disabled by default.
  928. @item lhls @var{bool}
  929. Enable Low-latency HLS (LHLS). Add @code{#EXT-X-PREFETCH} tag with
  930. current segment's URI. hls.js player folks are trying to standardize
  931. an open LHLS spec. The draft spec is available at
  932. @url{https://github.com/video-dev/hlsjs-rfcs/blob/lhls-spec/proposals/0001-lhls.md}.
  933. This option tries to comply with the above open spec. It enables
  934. @option{streaming} and @option{hls_playlist} options automatically.
  935. This is an experimental feature.
  936. Note: This is not Apple's version LHLS. See
  937. @url{https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis}
  938. @item master_m3u8_publish_rate @var{segment_intervals_count}
  939. Publish master playlist repeatedly every after specified number of
  940. segment intervals.
  941. @item max_playback_rate @var{rate}
  942. Set the maximum playback rate indicated as appropriate for the
  943. purposes of automatically adjusting playback latency and buffer
  944. occupancy during normal playback by clients.
  945. @item media_seg_name @var{segment_name}
  946. DASH-templated name to use for the media segments. Default is
  947. @code{chunk-stream$RepresentationID$-$Number%05d$.$ext$}. @code{$ext$}
  948. is replaced with the file name extension specific for the segment
  949. format.
  950. @item method @var{method}
  951. Use the given HTTP method to create output files. Generally set to @code{PUT}
  952. or @code{POST}.
  953. @item min_playback_rate @var{rate}
  954. Set the minimum playback rate indicated as appropriate for the
  955. purposes of automatically adjusting playback latency and buffer
  956. occupancy during normal playback by clients.
  957. @item mpd_profile @var{flags}
  958. Set one or more MPD manifest profiles.
  959. Possible values:
  960. @table @samp
  961. @item dash
  962. MPEG-DASH ISO Base media file format live profile
  963. @item dvb_dash
  964. DVB-DASH profile
  965. @end table
  966. Default value is @code{dash}.
  967. @item remove_at_exit @var{bool}
  968. Enable or disable removal of all segments when finished. This is
  969. disabled by default.
  970. @item seg_duration @var{duration}
  971. Set the segment length in seconds (fractional value can be set). The
  972. value is treated as average segment duration when the
  973. @option{use_template} option is enabled and the @option{use_timeline}
  974. option is disabled and as minimum segment duration for all the other
  975. use cases.
  976. Default value is @code{5}.
  977. @item single_file @var{bool}
  978. Enable or disable storing all segments in one file, accessed using
  979. byte ranges. This is disabled by default.
  980. The name of the single file can be specified with the
  981. @option{single_file_name} option, if not specified assume the basename
  982. of the manifest file with the output format extension.
  983. @item single_file_name @var{file_name}
  984. DASH-templated name to use for the manifest @code{baseURL}
  985. element. Imply that the @option{single_file} option is set to
  986. @var{true}. In the template, @code{$ext$} is replaced with the file
  987. name extension specific for the segment format.
  988. @item streaming @var{bool}
  989. Enable or disable chunk streaming mode of output. In chunk streaming
  990. mode, each frame will be a @code{moof} fragment which forms a
  991. chunk. This is disabled by default.
  992. @item target_latency @var{target_latency}
  993. Set an intended target latency in seconds for serving (fractional
  994. value can be set). Applicable only when the @option{streaming} and
  995. @option{write_prft} options are enabled. This is an informative fields
  996. clients can use to measure the latency of the service.
  997. @item timeout @var{timeout}
  998. Set timeout for socket I/O operations expressed in seconds (fractional
  999. value can be set). Applicable only for HTTP output.
  1000. @item update_period @var{period}
  1001. Set the MPD update period, for dynamic content. The unit is
  1002. second. If set to @code{0}, the period is automatically computed.
  1003. Default value is @code{0}.
  1004. @item use_template @var{bool}
  1005. Enable or disable use of @code{SegmentTemplate} instead of
  1006. @code{SegmentList} in the manifest. This is enabled by default.
  1007. @item use_timeline @var{bool}
  1008. Enable or disable use of @code{SegmentTimeline} within the
  1009. @code{SegmentTemplate} manifest section. This is enabled by default.
  1010. @item utc_timing_url @var{url}
  1011. URL of the page that will return the UTC timestamp in ISO
  1012. format, for example @code{https://time.akamai.com/?iso}
  1013. @item window_size @var{size}
  1014. Set the maximum number of segments kept in the manifest, discard the
  1015. oldest one. This is useful for live streaming.
  1016. If the value is @code{0}, all segments are kept in the
  1017. manifest. Default value is @code{0}.
  1018. @item write_prft @var{write_prft}
  1019. Write Producer Reference Time elements on supported streams. This also
  1020. enables writing prft boxes in the underlying muxer. Applicable only
  1021. when the @var{utc_url} option is enabled. It is set to @var{auto} by
  1022. default, in which case the muxer will attempt to enable it only in
  1023. modes that require it.
  1024. @end table
  1025. @subsection Example
  1026. Generate a DASH output reading from an input source in realtime using
  1027. @command{ffmpeg}.
  1028. Two multimedia streams are generated from the input file, both
  1029. containing a video stream encoded through @samp{libx264}, and an audio
  1030. stream encoded with @samp{libfdk_aac}. The first multimedia stream
  1031. contains video with a bitrate of 800k and audio at the default rate,
  1032. the second with video scaled to 320x170 pixels at 300k and audio
  1033. resampled at 22005 Hz.
  1034. The @option{window_size} option keeps only the latest 5 segments with
  1035. the default duration of 5 seconds.
  1036. @example
  1037. ffmpeg -re -i <input> -map 0 -map 0 -c:a libfdk_aac -c:v libx264 \
  1038. -b:v:0 800k -profile:v:0 main \
  1039. -b:v:1 300k -s:v:1 320x170 -profile:v:1 baseline -ar:a:1 22050 \
  1040. -bf 1 -keyint_min 120 -g 120 -sc_threshold 0 -b_strategy 0 \
  1041. -use_timeline 1 -use_template 1 -window_size 5 \
  1042. -adaptation_sets "id=0,streams=v id=1,streams=a" \
  1043. -f dash /path/to/out.mpd
  1044. @end example
  1045. @section daud
  1046. D-Cinema audio muxer.
  1047. It accepts a single 6-channels audio stream resampled at 96000 Hz
  1048. encoded with the @samp{pcm_24daud} codec.
  1049. @subsection Example
  1050. Use @command{ffmpeg} to mux input audio to a @samp{5.1} channel layout
  1051. resampled at 96000Hz:
  1052. @example
  1053. ffmpeg -i INPUT -af aresample=96000,pan=5.1 slow.302
  1054. @end example
  1055. For ffmpeg versions before 7.0 you might have to use the @samp{asetnsamples}
  1056. filter to limit the muxed packet size, because this format does not support
  1057. muxing packets larger than 65535 bytes (3640 samples). For newer ffmpeg
  1058. versions audio is automatically packetized to 36000 byte (2000 sample) packets.
  1059. @section dv
  1060. DV (Digital Video) muxer.
  1061. It accepts exactly one @samp{dvvideo} video stream and at most two
  1062. @samp{pcm_s16} audio streams. More constraints are defined by the
  1063. property of the video, which must correspond to a DV video supported
  1064. profile, and on the framerate.
  1065. @subsection Example
  1066. Use @command{ffmpeg} to convert the input:
  1067. @example
  1068. ffmpeg -i INPUT -s:v 720x480 -pix_fmt yuv411p -r 29.97 -ac 2 -ar 48000 -y out.dv
  1069. @end example
  1070. @section ffmetadata
  1071. FFmpeg metadata muxer.
  1072. This muxer writes the streams metadata in the @samp{ffmetadata}
  1073. format.
  1074. See @ref{metadata,,the Metadata chapter,ffmpeg-formats} for
  1075. information about the format.
  1076. @subsection Example
  1077. Use @command{ffmpeg} to extract metadata from an input file to a @file{metadata.ffmeta}
  1078. file in @samp{ffmetadata} format:
  1079. @example
  1080. ffmpeg -i INPUT -f ffmetadata metadata.ffmeta
  1081. @end example
  1082. @anchor{fifo}
  1083. @section fifo
  1084. FIFO (First-In First-Out) muxer.
  1085. The @samp{fifo} pseudo-muxer allows the separation of encoding and
  1086. muxing by using a first-in-first-out queue and running the actual muxer
  1087. in a separate thread.
  1088. This is especially useful in combination with
  1089. the @ref{tee} muxer and can be used to send data to several
  1090. destinations with different reliability/writing speed/latency.
  1091. The target muxer is either selected from the output name or specified
  1092. through the @option{fifo_format} option.
  1093. The behavior of the @samp{fifo} muxer if the queue fills up or if the
  1094. output fails (e.g. if a packet cannot be written to the output) is
  1095. selectable:
  1096. @itemize @bullet
  1097. @item
  1098. Output can be transparently restarted with configurable delay between
  1099. retries based on real time or time of the processed stream.
  1100. @item
  1101. Encoding can be blocked during temporary failure, or continue transparently
  1102. dropping packets in case the FIFO queue fills up.
  1103. @end itemize
  1104. API users should be aware that callback functions
  1105. (@code{interrupt_callback}, @code{io_open} and @code{io_close}) used
  1106. within its @code{AVFormatContext} must be thread-safe.
  1107. @subsection Options
  1108. @table @option
  1109. @item attempt_recovery @var{bool}
  1110. If failure occurs, attempt to recover the output. This is especially
  1111. useful when used with network output, since it makes it possible to
  1112. restart streaming transparently. By default this option is set to
  1113. @code{false}.
  1114. @item drop_pkts_on_overflow @var{bool}
  1115. If set to @code{true}, in case the fifo queue fills up, packets will
  1116. be dropped rather than blocking the encoder. This makes it possible to
  1117. continue streaming without delaying the input, at the cost of omitting
  1118. part of the stream. By default this option is set to @code{false}, so in
  1119. such cases the encoder will be blocked until the muxer processes some
  1120. of the packets and none of them is lost.
  1121. @item fifo_format @var{format_name}
  1122. Specify the format name. Useful if it cannot be guessed from the
  1123. output name suffix.
  1124. @item format_opts @var{options}
  1125. Specify format options for the underlying muxer. Muxer options can be
  1126. specified as a list of @var{key}=@var{value} pairs separated by ':'.
  1127. @item max_recovery_attempts @var{count}
  1128. Set maximum number of successive unsuccessful recovery attempts after
  1129. which the output fails permanently. By default this option is set to
  1130. @code{0} (unlimited).
  1131. @item queue_size @var{size}
  1132. Specify size of the queue as a number of packets. Default value is
  1133. @code{60}.
  1134. @item recover_any_error @var{bool}
  1135. If set to @code{true}, recovery will be attempted regardless of type
  1136. of the error causing the failure. By default this option is set to
  1137. @code{false} and in case of certain (usually permanent) errors the
  1138. recovery is not attempted even when the @option{attempt_recovery}
  1139. option is set to @code{true}.
  1140. @item recovery_wait_streamtime @var{bool}
  1141. If set to @code{false}, the real time is used when waiting for the
  1142. recovery attempt (i.e. the recovery will be attempted after the time
  1143. specified by the @option{recovery_wait_time} option).
  1144. If set to @code{true}, the time of the processed stream is taken into
  1145. account instead (i.e. the recovery will be attempted after discarding
  1146. the packets corresponding to the @option{recovery_wait_time} option).
  1147. By default this option is set to @code{false}.
  1148. @item recovery_wait_time @var{duration}
  1149. Specify waiting time in seconds before the next recovery attempt after
  1150. previous unsuccessful recovery attempt. Default value is @code{5}.
  1151. @item restart_with_keyframe @var{bool}
  1152. Specify whether to wait for the keyframe after recovering from
  1153. queue overflow or failure. This option is set to @code{false} by default.
  1154. @item timeshift @var{duration}
  1155. Buffer the specified amount of packets and delay writing the
  1156. output. Note that the value of the @option{queue_size} option must be
  1157. big enough to store the packets for timeshift. At the end of the input
  1158. the fifo buffer is flushed at realtime speed.
  1159. @end table
  1160. @subsection Example
  1161. Use @command{ffmpeg} to stream to an RTMP server, continue processing
  1162. the stream at real-time rate even in case of temporary failure
  1163. (network outage) and attempt to recover streaming every second
  1164. indefinitely:
  1165. @example
  1166. ffmpeg -re -i ... -c:v libx264 -c:a aac -f fifo -fifo_format flv \
  1167. -drop_pkts_on_overflow 1 -attempt_recovery 1 -recovery_wait_time 1 \
  1168. -map 0:v -map 0:a rtmp://example.com/live/stream_name
  1169. @end example
  1170. @section film_cpk
  1171. Sega film (.cpk) muxer.
  1172. This format was used as internal format for several Sega games.
  1173. For more information regarding the Sega film file format, visit
  1174. @url{http://wiki.multimedia.cx/index.php?title=Sega_FILM}.
  1175. It accepts at maximum one @samp{cinepak} or raw video stream, and at
  1176. maximum one audio stream.
  1177. @section filmstrip
  1178. Adobe Filmstrip muxer.
  1179. This format is used by several Adobe tools to store a generated filmstrip export. It
  1180. accepts a single raw video stream.
  1181. @section fits
  1182. Flexible Image Transport System (FITS) muxer.
  1183. This image format is used to store astronomical data.
  1184. For more information regarding the format, visit
  1185. @url{https://fits.gsfc.nasa.gov}.
  1186. @section flac
  1187. Raw FLAC audio muxer.
  1188. This muxer accepts exactly one FLAC audio stream. Additionally, it is possible to add
  1189. images with disposition @samp{attached_pic}.
  1190. @subsection Options
  1191. @table @option
  1192. @item write_header @var{bool}
  1193. write the file header if set to @code{true}, default is @code{true}
  1194. @end table
  1195. @subsection Example
  1196. Use @command{ffmpeg} to store the audio stream from an input file,
  1197. together with several pictures used with @samp{attached_pic}
  1198. disposition:
  1199. @example
  1200. ffmpeg -i INPUT -i pic1.png -i pic2.jpg -map 0:a -map 1 -map 2 -disposition:v attached_pic OUTPUT
  1201. @end example
  1202. @section flv
  1203. Adobe Flash Video Format muxer.
  1204. @subsection Options
  1205. @table @option
  1206. @item flvflags @var{flags}
  1207. Possible values:
  1208. @table @samp
  1209. @item aac_seq_header_detect
  1210. Place AAC sequence header based on audio stream data.
  1211. @item no_sequence_end
  1212. Disable sequence end tag.
  1213. @item no_metadata
  1214. Disable metadata tag.
  1215. @item no_duration_filesize
  1216. Disable duration and filesize in metadata when they are equal to zero
  1217. at the end of stream. (Be used to non-seekable living stream).
  1218. @item add_keyframe_index
  1219. Used to facilitate seeking; particularly for HTTP pseudo streaming.
  1220. @end table
  1221. @end table
  1222. @anchor{framecrc}
  1223. @section framecrc
  1224. Per-packet CRC (Cyclic Redundancy Check) testing format.
  1225. This muxer computes and prints the Adler-32 CRC for each audio
  1226. and video packet. By default audio frames are converted to signed
  1227. 16-bit raw audio and video frames to raw video before computing the
  1228. CRC.
  1229. The output of the muxer consists of a line for each audio and video
  1230. packet of the form:
  1231. @example
  1232. @var{stream_index}, @var{packet_dts}, @var{packet_pts}, @var{packet_duration}, @var{packet_size}, 0x@var{CRC}
  1233. @end example
  1234. @var{CRC} is a hexadecimal number 0-padded to 8 digits containing the
  1235. CRC of the packet.
  1236. @subsection Examples
  1237. For example to compute the CRC of the audio and video frames in
  1238. @file{INPUT}, converted to raw audio and video packets, and store it
  1239. in the file @file{out.crc}:
  1240. @example
  1241. ffmpeg -i INPUT -f framecrc out.crc
  1242. @end example
  1243. To print the information to stdout, use the command:
  1244. @example
  1245. ffmpeg -i INPUT -f framecrc -
  1246. @end example
  1247. With @command{ffmpeg}, you can select the output format to which the
  1248. audio and video frames are encoded before computing the CRC for each
  1249. packet by specifying the audio and video codec. For example, to
  1250. compute the CRC of each decoded input audio frame converted to PCM
  1251. unsigned 8-bit and of each decoded input video frame converted to
  1252. MPEG-2 video, use the command:
  1253. @example
  1254. ffmpeg -i INPUT -c:a pcm_u8 -c:v mpeg2video -f framecrc -
  1255. @end example
  1256. See also the @ref{crc} muxer.
  1257. @anchor{framehash}
  1258. @section framehash
  1259. Per-packet hash testing format.
  1260. This muxer computes and prints a cryptographic hash for each audio
  1261. and video packet. This can be used for packet-by-packet equality
  1262. checks without having to individually do a binary comparison on each.
  1263. By default audio frames are converted to signed 16-bit raw audio and
  1264. video frames to raw video before computing the hash, but the output
  1265. of explicit conversions to other codecs can also be used. It uses the
  1266. SHA-256 cryptographic hash function by default, but supports several
  1267. other algorithms.
  1268. The output of the muxer consists of a line for each audio and video
  1269. packet of the form:
  1270. @example
  1271. @var{stream_index}, @var{packet_dts}, @var{packet_pts}, @var{packet_duration}, @var{packet_size}, @var{hash}
  1272. @end example
  1273. @var{hash} is a hexadecimal number representing the computed hash
  1274. for the packet.
  1275. @table @option
  1276. @item hash @var{algorithm}
  1277. Use the cryptographic hash function specified by the string @var{algorithm}.
  1278. Supported values include @code{MD5}, @code{murmur3}, @code{RIPEMD128},
  1279. @code{RIPEMD160}, @code{RIPEMD256}, @code{RIPEMD320}, @code{SHA160},
  1280. @code{SHA224}, @code{SHA256} (default), @code{SHA512/224}, @code{SHA512/256},
  1281. @code{SHA384}, @code{SHA512}, @code{CRC32} and @code{adler32}.
  1282. @end table
  1283. @subsection Examples
  1284. To compute the SHA-256 hash of the audio and video frames in @file{INPUT},
  1285. converted to raw audio and video packets, and store it in the file
  1286. @file{out.sha256}:
  1287. @example
  1288. ffmpeg -i INPUT -f framehash out.sha256
  1289. @end example
  1290. To print the information to stdout, using the MD5 hash function, use
  1291. the command:
  1292. @example
  1293. ffmpeg -i INPUT -f framehash -hash md5 -
  1294. @end example
  1295. See also the @ref{hash} muxer.
  1296. @anchor{framemd5}
  1297. @section framemd5
  1298. Per-packet MD5 testing format.
  1299. This is a variant of the @ref{framehash} muxer. Unlike that muxer,
  1300. it defaults to using the MD5 hash function.
  1301. @subsection Examples
  1302. To compute the MD5 hash of the audio and video frames in @file{INPUT},
  1303. converted to raw audio and video packets, and store it in the file
  1304. @file{out.md5}:
  1305. @example
  1306. ffmpeg -i INPUT -f framemd5 out.md5
  1307. @end example
  1308. To print the information to stdout, use the command:
  1309. @example
  1310. ffmpeg -i INPUT -f framemd5 -
  1311. @end example
  1312. See also the @ref{framehash} and @ref{md5} muxers.
  1313. @anchor{gif}
  1314. @section gif
  1315. Animated GIF muxer.
  1316. Note that the GIF format has a very large time base: the delay between two frames can
  1317. therefore not be smaller than one centi second.
  1318. @subsection Options
  1319. @table @option
  1320. @item loop @var{bool}
  1321. Set the number of times to loop the output. Use @code{-1} for no loop, @code{0}
  1322. for looping indefinitely (default).
  1323. @item final_delay @var{delay}
  1324. Force the delay (expressed in centiseconds) after the last frame. Each frame
  1325. ends with a delay until the next frame. The default is @code{-1}, which is a
  1326. special value to tell the muxer to re-use the previous delay. In case of a
  1327. loop, you might want to customize this value to mark a pause for instance.
  1328. @end table
  1329. @subsection Example
  1330. Encode a gif looping 10 times, with a 5 seconds delay between
  1331. the loops:
  1332. @example
  1333. ffmpeg -i INPUT -loop 10 -final_delay 500 out.gif
  1334. @end example
  1335. Note 1: if you wish to extract the frames into separate GIF files, you need to
  1336. force the @ref{image2} muxer:
  1337. @example
  1338. ffmpeg -i INPUT -c:v gif -f image2 "out%d.gif"
  1339. @end example
  1340. @section gxf
  1341. General eXchange Format (GXF) muxer.
  1342. GXF was developed by Grass Valley Group, then standardized by SMPTE as SMPTE
  1343. 360M and was extended in SMPTE RDD 14-2007 to include high-definition video
  1344. resolutions.
  1345. It accepts at most one video stream with codec @samp{mjpeg}, or
  1346. @samp{mpeg1video}, or @samp{mpeg2video}, or @samp{dvvideo} with resolution
  1347. @samp{512x480} or @samp{608x576}, and several audio streams with rate 48000Hz
  1348. and codec @samp{pcm16_le}.
  1349. @anchor{hash}
  1350. @section hash
  1351. Hash testing format.
  1352. This muxer computes and prints a cryptographic hash of all the input
  1353. audio and video frames. This can be used for equality checks without
  1354. having to do a complete binary comparison.
  1355. By default audio frames are converted to signed 16-bit raw audio and
  1356. video frames to raw video before computing the hash, but the output
  1357. of explicit conversions to other codecs can also be used. Timestamps
  1358. are ignored. It uses the SHA-256 cryptographic hash function by default,
  1359. but supports several other algorithms.
  1360. The output of the muxer consists of a single line of the form:
  1361. @var{algo}=@var{hash}, where @var{algo} is a short string representing
  1362. the hash function used, and @var{hash} is a hexadecimal number
  1363. representing the computed hash.
  1364. @table @option
  1365. @item hash @var{algorithm}
  1366. Use the cryptographic hash function specified by the string @var{algorithm}.
  1367. Supported values include @code{MD5}, @code{murmur3}, @code{RIPEMD128},
  1368. @code{RIPEMD160}, @code{RIPEMD256}, @code{RIPEMD320}, @code{SHA160},
  1369. @code{SHA224}, @code{SHA256} (default), @code{SHA512/224}, @code{SHA512/256},
  1370. @code{SHA384}, @code{SHA512}, @code{CRC32} and @code{adler32}.
  1371. @end table
  1372. @subsection Examples
  1373. To compute the SHA-256 hash of the input converted to raw audio and
  1374. video, and store it in the file @file{out.sha256}:
  1375. @example
  1376. ffmpeg -i INPUT -f hash out.sha256
  1377. @end example
  1378. To print an MD5 hash to stdout use the command:
  1379. @example
  1380. ffmpeg -i INPUT -f hash -hash md5 -
  1381. @end example
  1382. See also the @ref{framehash} muxer.
  1383. @anchor{hds}
  1384. @section hds
  1385. HTTP Dynamic Streaming (HDS) muxer.
  1386. HTTP dynamic streaming, or HDS, is an adaptive bitrate streaming method
  1387. developed by Adobe. HDS delivers MP4 video content over HTTP connections. HDS
  1388. can be used for on-demand streaming or live streaming.
  1389. This muxer creates an .f4m (Adobe Flash Media Manifest File) manifest, an .abst
  1390. (Adobe Bootstrap File) for each stream, and segment files in a directory
  1391. specified as the output.
  1392. These needs to be accessed by an HDS player throuhg HTTPS for it to be able to
  1393. perform playback on the generated stream.
  1394. @subsection Options
  1395. @table @option
  1396. @item extra_window_size @var{int}
  1397. number of fragments kept outside of the manifest before removing from disk
  1398. @item min_frag_duration @var{microseconds}
  1399. minimum fragment duration (in microseconds), default value is 1 second
  1400. (@code{10000000})
  1401. @item remove_at_exit @var{bool}
  1402. remove all fragments when finished when set to @code{true}
  1403. @item window_size @var{int}
  1404. number of fragments kept in the manifest, if set to a value different from
  1405. @code{0}. By default all segments are kept in the output directory.
  1406. @end table
  1407. @subsection Example
  1408. Use @command{ffmpeg} to generate HDS files to the @file{output.hds} directory in
  1409. real-time rate:
  1410. @example
  1411. ffmpeg -re -i INPUT -f hds -b:v 200k output.hds
  1412. @end example
  1413. @anchor{hls}
  1414. @section hls
  1415. Apple HTTP Live Streaming muxer that segments MPEG-TS according to
  1416. the HTTP Live Streaming (HLS) specification.
  1417. It creates a playlist file, and one or more segment files. The output filename
  1418. specifies the playlist filename.
  1419. By default, the muxer creates a file for each segment produced. These files
  1420. have the same name as the playlist, followed by a sequential number and a
  1421. .ts extension.
  1422. Make sure to require a closed GOP when encoding and to set the GOP
  1423. size to fit your segment time constraint.
  1424. For example, to convert an input file with @command{ffmpeg}:
  1425. @example
  1426. ffmpeg -i in.mkv -c:v h264 -flags +cgop -g 30 -hls_time 1 out.m3u8
  1427. @end example
  1428. This example will produce the playlist, @file{out.m3u8}, and segment files:
  1429. @file{out0.ts}, @file{out1.ts}, @file{out2.ts}, etc.
  1430. See also the @ref{segment} muxer, which provides a more generic and
  1431. flexible implementation of a segmenter, and can be used to perform HLS
  1432. segmentation.
  1433. @subsection Options
  1434. This muxer supports the following options:
  1435. @table @option
  1436. @item hls_init_time @var{duration}
  1437. Set the initial target segment length. Default value is @var{0}.
  1438. @var{duration} must be a time duration specification,
  1439. see @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1440. Segment will be cut on the next key frame after this time has passed on the first m3u8 list.
  1441. After the initial playlist is filled @command{ffmpeg} will cut segments
  1442. at duration equal to @code{hls_time}
  1443. @item hls_time @var{duration}
  1444. Set the target segment length. Default value is 2.
  1445. @var{duration} must be a time duration specification,
  1446. see @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1447. Segment will be cut on the next key frame after this time has passed.
  1448. @item hls_list_size @var{size}
  1449. Set the maximum number of playlist entries. If set to 0 the list file
  1450. will contain all the segments. Default value is 5.
  1451. @item hls_delete_threshold @var{size}
  1452. Set the number of unreferenced segments to keep on disk before @code{hls_flags delete_segments}
  1453. deletes them. Increase this to allow continue clients to download segments which
  1454. were recently referenced in the playlist. Default value is 1, meaning segments older than
  1455. @code{hls_list_size+1} will be deleted.
  1456. @item hls_start_number_source
  1457. Start the playlist sequence number (@code{#EXT-X-MEDIA-SEQUENCE}) according to the specified source.
  1458. Unless @code{hls_flags single_file} is set, it also specifies source of starting sequence numbers of
  1459. segment and subtitle filenames. In any case, if @code{hls_flags append_list}
  1460. is set and read playlist sequence number is greater than the specified start sequence number,
  1461. then that value will be used as start value.
  1462. It accepts the following values:
  1463. @table @option
  1464. @item generic (default)
  1465. Set the starting sequence numbers according to @var{start_number} option value.
  1466. @item epoch
  1467. The start number will be the seconds since epoch (1970-01-01 00:00:00)
  1468. @item epoch_us
  1469. The start number will be the microseconds since epoch (1970-01-01 00:00:00)
  1470. @item datetime
  1471. The start number will be based on the current date/time as YYYYmmddHHMMSS. e.g. 20161231235759.
  1472. @end table
  1473. @item start_number @var{number}
  1474. Start the playlist sequence number (@code{#EXT-X-MEDIA-SEQUENCE}) from the specified @var{number}
  1475. when @var{hls_start_number_source} value is @var{generic}. (This is the default case.)
  1476. Unless @code{hls_flags single_file} is set, it also specifies starting sequence numbers of segment and subtitle filenames.
  1477. Default value is 0.
  1478. @item hls_allow_cache @var{allowcache}
  1479. Explicitly set whether the client MAY (1) or MUST NOT (0) cache media segments.
  1480. @item hls_base_url @var{baseurl}
  1481. Append @var{baseurl} to every entry in the playlist.
  1482. Useful to generate playlists with absolute paths.
  1483. Note that the playlist sequence number must be unique for each segment
  1484. and it is not to be confused with the segment filename sequence number
  1485. which can be cyclic, for example if the @option{wrap} option is
  1486. specified.
  1487. @item hls_segment_filename @var{filename}
  1488. Set the segment filename. Unless @code{hls_flags single_file} is set,
  1489. @var{filename} is used as a string format with the segment number:
  1490. @example
  1491. ffmpeg -i in.nut -hls_segment_filename 'file%03d.ts' out.m3u8
  1492. @end example
  1493. This example will produce the playlist, @file{out.m3u8}, and segment files:
  1494. @file{file000.ts}, @file{file001.ts}, @file{file002.ts}, etc.
  1495. @var{filename} may contain full path or relative path specification,
  1496. but only the file name part without any path info will be contained in the m3u8 segment list.
  1497. Should a relative path be specified, the path of the created segment
  1498. files will be relative to the current working directory.
  1499. When strftime_mkdir is set, the whole expanded value of @var{filename} will be written into the m3u8 segment list.
  1500. When @code{var_stream_map} is set with two or more variant streams, the
  1501. @var{filename} pattern must contain the string "%v", this string specifies
  1502. the position of variant stream index in the generated segment file names.
  1503. @example
  1504. ffmpeg -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \
  1505. -map 0:v -map 0:a -map 0:v -map 0:a -f hls -var_stream_map "v:0,a:0 v:1,a:1" \
  1506. -hls_segment_filename 'file_%v_%03d.ts' out_%v.m3u8
  1507. @end example
  1508. This example will produce the playlists segment file sets:
  1509. @file{file_0_000.ts}, @file{file_0_001.ts}, @file{file_0_002.ts}, etc. and
  1510. @file{file_1_000.ts}, @file{file_1_001.ts}, @file{file_1_002.ts}, etc.
  1511. The string "%v" may be present in the filename or in the last directory name
  1512. containing the file, but only in one of them. (Additionally, %v may appear multiple times in the last
  1513. sub-directory or filename.) If the string %v is present in the directory name, then
  1514. sub-directories are created after expanding the directory name pattern. This
  1515. enables creation of segments corresponding to different variant streams in
  1516. subdirectories.
  1517. @example
  1518. ffmpeg -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \
  1519. -map 0:v -map 0:a -map 0:v -map 0:a -f hls -var_stream_map "v:0,a:0 v:1,a:1" \
  1520. -hls_segment_filename 'vs%v/file_%03d.ts' vs%v/out.m3u8
  1521. @end example
  1522. This example will produce the playlists segment file sets:
  1523. @file{vs0/file_000.ts}, @file{vs0/file_001.ts}, @file{vs0/file_002.ts}, etc. and
  1524. @file{vs1/file_000.ts}, @file{vs1/file_001.ts}, @file{vs1/file_002.ts}, etc.
  1525. @item strftime
  1526. Use strftime() on @var{filename} to expand the segment filename with localtime.
  1527. The segment number is also available in this mode, but to use it, you need to specify second_level_segment_index
  1528. hls_flag and %%d will be the specifier.
  1529. @example
  1530. ffmpeg -i in.nut -strftime 1 -hls_segment_filename 'file-%Y%m%d-%s.ts' out.m3u8
  1531. @end example
  1532. This example will produce the playlist, @file{out.m3u8}, and segment files:
  1533. @file{file-20160215-1455569023.ts}, @file{file-20160215-1455569024.ts}, etc.
  1534. Note: On some systems/environments, the @code{%s} specifier is not available. See
  1535. @code{strftime()} documentation.
  1536. @example
  1537. ffmpeg -i in.nut -strftime 1 -hls_flags second_level_segment_index -hls_segment_filename 'file-%Y%m%d-%%04d.ts' out.m3u8
  1538. @end example
  1539. This example will produce the playlist, @file{out.m3u8}, and segment files:
  1540. @file{file-20160215-0001.ts}, @file{file-20160215-0002.ts}, etc.
  1541. @item strftime_mkdir
  1542. Used together with -strftime_mkdir, it will create all subdirectories which
  1543. is expanded in @var{filename}.
  1544. @example
  1545. ffmpeg -i in.nut -strftime 1 -strftime_mkdir 1 -hls_segment_filename '%Y%m%d/file-%Y%m%d-%s.ts' out.m3u8
  1546. @end example
  1547. This example will create a directory 201560215 (if it does not exist), and then
  1548. produce the playlist, @file{out.m3u8}, and segment files:
  1549. @file{20160215/file-20160215-1455569023.ts}, @file{20160215/file-20160215-1455569024.ts}, etc.
  1550. @example
  1551. ffmpeg -i in.nut -strftime 1 -strftime_mkdir 1 -hls_segment_filename '%Y/%m/%d/file-%Y%m%d-%s.ts' out.m3u8
  1552. @end example
  1553. This example will create a directory hierarchy 2016/02/15 (if any of them do not exist), and then
  1554. produce the playlist, @file{out.m3u8}, and segment files:
  1555. @file{2016/02/15/file-20160215-1455569023.ts}, @file{2016/02/15/file-20160215-1455569024.ts}, etc.
  1556. @item hls_segment_options @var{options_list}
  1557. Set output format options using a :-separated list of key=value
  1558. parameters. Values containing @code{:} special characters must be
  1559. escaped.
  1560. @item hls_key_info_file @var{key_info_file}
  1561. Use the information in @var{key_info_file} for segment encryption. The first
  1562. line of @var{key_info_file} specifies the key URI written to the playlist. The
  1563. key URL is used to access the encryption key during playback. The second line
  1564. specifies the path to the key file used to obtain the key during the encryption
  1565. process. The key file is read as a single packed array of 16 octets in binary
  1566. format. The optional third line specifies the initialization vector (IV) as a
  1567. hexadecimal string to be used instead of the segment sequence number (default)
  1568. for encryption. Changes to @var{key_info_file} will result in segment
  1569. encryption with the new key/IV and an entry in the playlist for the new key
  1570. URI/IV if @code{hls_flags periodic_rekey} is enabled.
  1571. Key info file format:
  1572. @example
  1573. @var{key URI}
  1574. @var{key file path}
  1575. @var{IV} (optional)
  1576. @end example
  1577. Example key URIs:
  1578. @example
  1579. http://server/file.key
  1580. /path/to/file.key
  1581. file.key
  1582. @end example
  1583. Example key file paths:
  1584. @example
  1585. file.key
  1586. /path/to/file.key
  1587. @end example
  1588. Example IV:
  1589. @example
  1590. 0123456789ABCDEF0123456789ABCDEF
  1591. @end example
  1592. Key info file example:
  1593. @example
  1594. http://server/file.key
  1595. /path/to/file.key
  1596. 0123456789ABCDEF0123456789ABCDEF
  1597. @end example
  1598. Example shell script:
  1599. @example
  1600. #!/bin/sh
  1601. BASE_URL=$@{1:-'.'@}
  1602. openssl rand 16 > file.key
  1603. echo $BASE_URL/file.key > file.keyinfo
  1604. echo file.key >> file.keyinfo
  1605. echo $(openssl rand -hex 16) >> file.keyinfo
  1606. ffmpeg -f lavfi -re -i testsrc -c:v h264 -hls_flags delete_segments \
  1607. -hls_key_info_file file.keyinfo out.m3u8
  1608. @end example
  1609. @item -hls_enc @var{enc}
  1610. Enable (1) or disable (0) the AES128 encryption.
  1611. When enabled every segment generated is encrypted and the encryption key
  1612. is saved as @var{playlist name}.key.
  1613. @item -hls_enc_key @var{key}
  1614. 16-octet key to encrypt the segments, by default it
  1615. is randomly generated.
  1616. @item -hls_enc_key_url @var{keyurl}
  1617. If set, @var{keyurl} is prepended instead of @var{baseurl} to the key filename
  1618. in the playlist.
  1619. @item -hls_enc_iv @var{iv}
  1620. 16-octet initialization vector for every segment instead
  1621. of the autogenerated ones.
  1622. @item hls_segment_type @var{flags}
  1623. Possible values:
  1624. @table @samp
  1625. @item mpegts
  1626. Output segment files in MPEG-2 Transport Stream format. This is
  1627. compatible with all HLS versions.
  1628. @item fmp4
  1629. Output segment files in fragmented MP4 format, similar to MPEG-DASH.
  1630. fmp4 files may be used in HLS version 7 and above.
  1631. @end table
  1632. @item hls_fmp4_init_filename @var{filename}
  1633. Set filename to the fragment files header file, default filename is @file{init.mp4}.
  1634. Use @code{-strftime 1} on @var{filename} to expand the segment filename with localtime.
  1635. @example
  1636. ffmpeg -i in.nut -hls_segment_type fmp4 -strftime 1 -hls_fmp4_init_filename "%s_init.mp4" out.m3u8
  1637. @end example
  1638. This will produce init like this
  1639. @file{1602678741_init.mp4}
  1640. @item hls_fmp4_init_resend
  1641. Resend init file after m3u8 file refresh every time, default is @var{0}.
  1642. When @code{var_stream_map} is set with two or more variant streams, the
  1643. @var{filename} pattern must contain the string "%v", this string specifies
  1644. the position of variant stream index in the generated init file names.
  1645. The string "%v" may be present in the filename or in the last directory name
  1646. containing the file. If the string is present in the directory name, then
  1647. sub-directories are created after expanding the directory name pattern. This
  1648. enables creation of init files corresponding to different variant streams in
  1649. subdirectories.
  1650. @item hls_flags @var{flags}
  1651. Possible values:
  1652. @table @samp
  1653. @item single_file
  1654. If this flag is set, the muxer will store all segments in a single MPEG-TS
  1655. file, and will use byte ranges in the playlist. HLS playlists generated with
  1656. this way will have the version number 4.
  1657. For example:
  1658. @example
  1659. ffmpeg -i in.nut -hls_flags single_file out.m3u8
  1660. @end example
  1661. Will produce the playlist, @file{out.m3u8}, and a single segment file,
  1662. @file{out.ts}.
  1663. @item delete_segments
  1664. Segment files removed from the playlist are deleted after a period of time
  1665. equal to the duration of the segment plus the duration of the playlist.
  1666. @item append_list
  1667. Append new segments into the end of old segment list,
  1668. and remove the @code{#EXT-X-ENDLIST} from the old segment list.
  1669. @item round_durations
  1670. Round the duration info in the playlist file segment info to integer
  1671. values, instead of using floating point.
  1672. If there are no other features requiring higher HLS versions be used,
  1673. then this will allow ffmpeg to output a HLS version 2 m3u8.
  1674. @item discont_start
  1675. Add the @code{#EXT-X-DISCONTINUITY} tag to the playlist, before the
  1676. first segment's information.
  1677. @item omit_endlist
  1678. Do not append the @code{EXT-X-ENDLIST} tag at the end of the playlist.
  1679. @item periodic_rekey
  1680. The file specified by @code{hls_key_info_file} will be checked periodically and
  1681. detect updates to the encryption info. Be sure to replace this file atomically,
  1682. including the file containing the AES encryption key.
  1683. @item independent_segments
  1684. Add the @code{#EXT-X-INDEPENDENT-SEGMENTS} to playlists that has video segments
  1685. and when all the segments of that playlist are guaranteed to start with a Key frame.
  1686. @item iframes_only
  1687. Add the @code{#EXT-X-I-FRAMES-ONLY} to playlists that has video segments
  1688. and can play only I-frames in the @code{#EXT-X-BYTERANGE} mode.
  1689. @item split_by_time
  1690. Allow segments to start on frames other than keyframes. This improves
  1691. behavior on some players when the time between keyframes is inconsistent,
  1692. but may make things worse on others, and can cause some oddities during
  1693. seeking. This flag should be used with the @code{hls_time} option.
  1694. @item program_date_time
  1695. Generate @code{EXT-X-PROGRAM-DATE-TIME} tags.
  1696. @item second_level_segment_index
  1697. Makes it possible to use segment indexes as %%d in hls_segment_filename expression
  1698. besides date/time values when strftime is on.
  1699. To get fixed width numbers with trailing zeroes, %%0xd format is available where x is the required width.
  1700. @item second_level_segment_size
  1701. Makes it possible to use segment sizes (counted in bytes) as %%s in hls_segment_filename
  1702. expression besides date/time values when strftime is on.
  1703. To get fixed width numbers with trailing zeroes, %%0xs format is available where x is the required width.
  1704. @item second_level_segment_duration
  1705. Makes it possible to use segment duration (calculated in microseconds) as %%t in hls_segment_filename
  1706. expression besides date/time values when strftime is on.
  1707. To get fixed width numbers with trailing zeroes, %%0xt format is available where x is the required width.
  1708. @example
  1709. ffmpeg -i sample.mpeg \
  1710. -f hls -hls_time 3 -hls_list_size 5 \
  1711. -hls_flags second_level_segment_index+second_level_segment_size+second_level_segment_duration \
  1712. -strftime 1 -strftime_mkdir 1 -hls_segment_filename "segment_%Y%m%d%H%M%S_%%04d_%%08s_%%013t.ts" stream.m3u8
  1713. @end example
  1714. This will produce segments like this:
  1715. @file{segment_20170102194334_0003_00122200_0000003000000.ts}, @file{segment_20170102194334_0004_00120072_0000003000000.ts} etc.
  1716. @item temp_file
  1717. Write segment data to filename.tmp and rename to filename only once the segment is complete. A webserver
  1718. serving up segments can be configured to reject requests to *.tmp to prevent access to in-progress segments
  1719. before they have been added to the m3u8 playlist. This flag also affects how m3u8 playlist files are created.
  1720. If this flag is set, all playlist files will written into temporary file and renamed after they are complete, similarly as segments are handled.
  1721. But playlists with @code{file} protocol and with type (@code{hls_playlist_type}) other than @code{vod}
  1722. are always written into temporary file regardless of this flag. Master playlist files (@code{master_pl_name}), if any, with @code{file} protocol,
  1723. are always written into temporary file regardless of this flag if @code{master_pl_publish_rate} value is other than zero.
  1724. @end table
  1725. @item hls_playlist_type event
  1726. Emit @code{#EXT-X-PLAYLIST-TYPE:EVENT} in the m3u8 header. Forces
  1727. @option{hls_list_size} to 0; the playlist can only be appended to.
  1728. @item hls_playlist_type vod
  1729. Emit @code{#EXT-X-PLAYLIST-TYPE:VOD} in the m3u8 header. Forces
  1730. @option{hls_list_size} to 0; the playlist must not change.
  1731. @item method
  1732. Use the given HTTP method to create the hls files.
  1733. @example
  1734. ffmpeg -re -i in.ts -f hls -method PUT http://example.com/live/out.m3u8
  1735. @end example
  1736. This example will upload all the mpegts segment files to the HTTP
  1737. server using the HTTP PUT method, and update the m3u8 files every
  1738. @code{refresh} times using the same method.
  1739. Note that the HTTP server must support the given method for uploading
  1740. files.
  1741. @item http_user_agent
  1742. Override User-Agent field in HTTP header. Applicable only for HTTP output.
  1743. @item var_stream_map
  1744. Map string which specifies how to group the audio, video and subtitle streams
  1745. into different variant streams. The variant stream groups are separated
  1746. by space.
  1747. Expected string format is like this "a:0,v:0 a:1,v:1 ....". Here a:, v:, s: are
  1748. the keys to specify audio, video and subtitle streams respectively.
  1749. Allowed values are 0 to 9 (limited just based on practical usage).
  1750. When there are two or more variant streams, the output filename pattern must
  1751. contain the string "%v", this string specifies the position of variant stream
  1752. index in the output media playlist filenames. The string "%v" may be present in
  1753. the filename or in the last directory name containing the file. If the string is
  1754. present in the directory name, then sub-directories are created after expanding
  1755. the directory name pattern. This enables creation of variant streams in
  1756. subdirectories.
  1757. @example
  1758. ffmpeg -re -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \
  1759. -map 0:v -map 0:a -map 0:v -map 0:a -f hls -var_stream_map "v:0,a:0 v:1,a:1" \
  1760. http://example.com/live/out_%v.m3u8
  1761. @end example
  1762. This example creates two hls variant streams. The first variant stream will
  1763. contain video stream of bitrate 1000k and audio stream of bitrate 64k and the
  1764. second variant stream will contain video stream of bitrate 256k and audio
  1765. stream of bitrate 32k. Here, two media playlist with file names out_0.m3u8 and
  1766. out_1.m3u8 will be created. If you want something meaningful text instead of indexes
  1767. in result names, you may specify names for each or some of the variants
  1768. as in the following example.
  1769. @example
  1770. ffmpeg -re -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \
  1771. -map 0:v -map 0:a -map 0:v -map 0:a -f hls -var_stream_map "v:0,a:0,name:my_hd v:1,a:1,name:my_sd" \
  1772. http://example.com/live/out_%v.m3u8
  1773. @end example
  1774. This example creates two hls variant streams as in the previous one.
  1775. But here, the two media playlist with file names out_my_hd.m3u8 and
  1776. out_my_sd.m3u8 will be created.
  1777. @example
  1778. ffmpeg -re -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k \
  1779. -map 0:v -map 0:a -map 0:v -f hls -var_stream_map "v:0 a:0 v:1" \
  1780. http://example.com/live/out_%v.m3u8
  1781. @end example
  1782. This example creates three hls variant streams. The first variant stream will
  1783. be a video only stream with video bitrate 1000k, the second variant stream will
  1784. be an audio only stream with bitrate 64k and the third variant stream will be a
  1785. video only stream with bitrate 256k. Here, three media playlist with file names
  1786. out_0.m3u8, out_1.m3u8 and out_2.m3u8 will be created.
  1787. @example
  1788. ffmpeg -re -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \
  1789. -map 0:v -map 0:a -map 0:v -map 0:a -f hls -var_stream_map "v:0,a:0 v:1,a:1" \
  1790. http://example.com/live/vs_%v/out.m3u8
  1791. @end example
  1792. This example creates the variant streams in subdirectories. Here, the first
  1793. media playlist is created at @file{http://example.com/live/vs_0/out.m3u8} and
  1794. the second one at @file{http://example.com/live/vs_1/out.m3u8}.
  1795. @example
  1796. ffmpeg -re -i in.ts -b:a:0 32k -b:a:1 64k -b:v:0 1000k -b:v:1 3000k \
  1797. -map 0:a -map 0:a -map 0:v -map 0:v -f hls \
  1798. -var_stream_map "a:0,agroup:aud_low a:1,agroup:aud_high v:0,agroup:aud_low v:1,agroup:aud_high" \
  1799. -master_pl_name master.m3u8 \
  1800. http://example.com/live/out_%v.m3u8
  1801. @end example
  1802. This example creates two audio only and two video only variant streams. In
  1803. addition to the #EXT-X-STREAM-INF tag for each variant stream in the master
  1804. playlist, #EXT-X-MEDIA tag is also added for the two audio only variant streams
  1805. and they are mapped to the two video only variant streams with audio group names
  1806. 'aud_low' and 'aud_high'.
  1807. By default, a single hls variant containing all the encoded streams is created.
  1808. @example
  1809. ffmpeg -re -i in.ts -b:a:0 32k -b:a:1 64k -b:v:0 1000k \
  1810. -map 0:a -map 0:a -map 0:v -f hls \
  1811. -var_stream_map "a:0,agroup:aud_low,default:yes a:1,agroup:aud_low v:0,agroup:aud_low" \
  1812. -master_pl_name master.m3u8 \
  1813. http://example.com/live/out_%v.m3u8
  1814. @end example
  1815. This example creates two audio only and one video only variant streams. In
  1816. addition to the #EXT-X-STREAM-INF tag for each variant stream in the master
  1817. playlist, #EXT-X-MEDIA tag is also added for the two audio only variant streams
  1818. and they are mapped to the one video only variant streams with audio group name
  1819. 'aud_low', and the audio group have default stat is NO or YES.
  1820. By default, a single hls variant containing all the encoded streams is created.
  1821. @example
  1822. ffmpeg -re -i in.ts -b:a:0 32k -b:a:1 64k -b:v:0 1000k \
  1823. -map 0:a -map 0:a -map 0:v -f hls \
  1824. -var_stream_map "a:0,agroup:aud_low,default:yes,language:ENG a:1,agroup:aud_low,language:CHN v:0,agroup:aud_low" \
  1825. -master_pl_name master.m3u8 \
  1826. http://example.com/live/out_%v.m3u8
  1827. @end example
  1828. This example creates two audio only and one video only variant streams. In
  1829. addition to the #EXT-X-STREAM-INF tag for each variant stream in the master
  1830. playlist, #EXT-X-MEDIA tag is also added for the two audio only variant streams
  1831. and they are mapped to the one video only variant streams with audio group name
  1832. 'aud_low', and the audio group have default stat is NO or YES, and one audio
  1833. have and language is named ENG, the other audio language is named CHN.
  1834. By default, a single hls variant containing all the encoded streams is created.
  1835. @example
  1836. ffmpeg -y -i input_with_subtitle.mkv \
  1837. -b:v:0 5250k -c:v h264 -pix_fmt yuv420p -profile:v main -level 4.1 \
  1838. -b:a:0 256k \
  1839. -c:s webvtt -c:a mp2 -ar 48000 -ac 2 -map 0:v -map 0:a:0 -map 0:s:0 \
  1840. -f hls -var_stream_map "v:0,a:0,s:0,sgroup:subtitle" \
  1841. -master_pl_name master.m3u8 -t 300 -hls_time 10 -hls_init_time 4 -hls_list_size \
  1842. 10 -master_pl_publish_rate 10 -hls_flags \
  1843. delete_segments+discont_start+split_by_time ./tmp/video.m3u8
  1844. @end example
  1845. This example adds @code{#EXT-X-MEDIA} tag with @code{TYPE=SUBTITLES} in
  1846. the master playlist with webvtt subtitle group name 'subtitle'. Please make sure
  1847. the input file has one text subtitle stream at least.
  1848. @item cc_stream_map
  1849. Map string which specifies different closed captions groups and their
  1850. attributes. The closed captions stream groups are separated by space.
  1851. Expected string format is like this
  1852. "ccgroup:<group name>,instreamid:<INSTREAM-ID>,language:<language code> ....".
  1853. 'ccgroup' and 'instreamid' are mandatory attributes. 'language' is an optional
  1854. attribute.
  1855. The closed captions groups configured using this option are mapped to different
  1856. variant streams by providing the same 'ccgroup' name in the
  1857. @code{var_stream_map} string. If @code{var_stream_map} is not set, then the
  1858. first available ccgroup in @code{cc_stream_map} is mapped to the output variant
  1859. stream. The examples for these two use cases are given below.
  1860. @example
  1861. ffmpeg -re -i in.ts -b:v 1000k -b:a 64k -a53cc 1 -f hls \
  1862. -cc_stream_map "ccgroup:cc,instreamid:CC1,language:en" \
  1863. -master_pl_name master.m3u8 \
  1864. http://example.com/live/out.m3u8
  1865. @end example
  1866. This example adds @code{#EXT-X-MEDIA} tag with @code{TYPE=CLOSED-CAPTIONS} in
  1867. the master playlist with group name 'cc', language 'en' (english) and
  1868. INSTREAM-ID 'CC1'. Also, it adds @code{CLOSED-CAPTIONS} attribute with group
  1869. name 'cc' for the output variant stream.
  1870. @example
  1871. ffmpeg -re -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \
  1872. -a53cc:0 1 -a53cc:1 1\
  1873. -map 0:v -map 0:a -map 0:v -map 0:a -f hls \
  1874. -cc_stream_map "ccgroup:cc,instreamid:CC1,language:en ccgroup:cc,instreamid:CC2,language:sp" \
  1875. -var_stream_map "v:0,a:0,ccgroup:cc v:1,a:1,ccgroup:cc" \
  1876. -master_pl_name master.m3u8 \
  1877. http://example.com/live/out_%v.m3u8
  1878. @end example
  1879. This example adds two @code{#EXT-X-MEDIA} tags with @code{TYPE=CLOSED-CAPTIONS} in
  1880. the master playlist for the INSTREAM-IDs 'CC1' and 'CC2'. Also, it adds
  1881. @code{CLOSED-CAPTIONS} attribute with group name 'cc' for the two output variant
  1882. streams.
  1883. @item master_pl_name
  1884. Create HLS master playlist with the given name.
  1885. @example
  1886. ffmpeg -re -i in.ts -f hls -master_pl_name master.m3u8 http://example.com/live/out.m3u8
  1887. @end example
  1888. This example creates HLS master playlist with name master.m3u8 and it is
  1889. published at http://example.com/live/
  1890. @item master_pl_publish_rate
  1891. Publish master play list repeatedly every after specified number of segment intervals.
  1892. @example
  1893. ffmpeg -re -i in.ts -f hls -master_pl_name master.m3u8 \
  1894. -hls_time 2 -master_pl_publish_rate 30 http://example.com/live/out.m3u8
  1895. @end example
  1896. This example creates HLS master playlist with name master.m3u8 and keep
  1897. publishing it repeatedly every after 30 segments i.e. every after 60s.
  1898. @item http_persistent
  1899. Use persistent HTTP connections. Applicable only for HTTP output.
  1900. @item timeout
  1901. Set timeout for socket I/O operations. Applicable only for HTTP output.
  1902. @item ignore_io_errors
  1903. Ignore IO errors during open, write and delete. Useful for long-duration runs with network output.
  1904. @item headers
  1905. Set custom HTTP headers, can override built in default headers. Applicable only for HTTP output.
  1906. @end table
  1907. @anchor{ico}
  1908. @section ico
  1909. ICO file muxer.
  1910. Microsoft's icon file format (ICO) has some strict limitations that should be noted:
  1911. @itemize
  1912. @item
  1913. Size cannot exceed 256 pixels in any dimension
  1914. @item
  1915. Only BMP and PNG images can be stored
  1916. @item
  1917. If a BMP image is used, it must be one of the following pixel formats:
  1918. @example
  1919. BMP Bit Depth FFmpeg Pixel Format
  1920. 1bit pal8
  1921. 4bit pal8
  1922. 8bit pal8
  1923. 16bit rgb555le
  1924. 24bit bgr24
  1925. 32bit bgra
  1926. @end example
  1927. @item
  1928. If a BMP image is used, it must use the BITMAPINFOHEADER DIB header
  1929. @item
  1930. If a PNG image is used, it must use the rgba pixel format
  1931. @end itemize
  1932. @anchor{image2}
  1933. @section image2
  1934. Image file muxer.
  1935. The image file muxer writes video frames to image files.
  1936. The output filenames are specified by a pattern, which can be used to
  1937. produce sequentially numbered series of files.
  1938. The pattern may contain the string "%d" or "%0@var{N}d", this string
  1939. specifies the position of the characters representing a numbering in
  1940. the filenames. If the form "%0@var{N}d" is used, the string
  1941. representing the number in each filename is 0-padded to @var{N}
  1942. digits. The literal character '%' can be specified in the pattern with
  1943. the string "%%".
  1944. If the pattern contains "%d" or "%0@var{N}d", the first filename of
  1945. the file list specified will contain the number 1, all the following
  1946. numbers will be sequential.
  1947. The pattern may contain a suffix which is used to automatically
  1948. determine the format of the image files to write.
  1949. For example the pattern "img-%03d.bmp" will specify a sequence of
  1950. filenames of the form @file{img-001.bmp}, @file{img-002.bmp}, ...,
  1951. @file{img-010.bmp}, etc.
  1952. The pattern "img%%-%d.jpg" will specify a sequence of filenames of the
  1953. form @file{img%-1.jpg}, @file{img%-2.jpg}, ..., @file{img%-10.jpg},
  1954. etc.
  1955. The image muxer supports the .Y.U.V image file format. This format is
  1956. special in that each image frame consists of three files, for
  1957. each of the YUV420P components. To read or write this image file format,
  1958. specify the name of the '.Y' file. The muxer will automatically open the
  1959. '.U' and '.V' files as required.
  1960. @subsection Options
  1961. @table @option
  1962. @item frame_pts
  1963. If set to 1, expand the filename with pts from pkt->pts.
  1964. Default value is 0.
  1965. @item start_number
  1966. Start the sequence from the specified number. Default value is 1.
  1967. @item update
  1968. If set to 1, the filename will always be interpreted as just a
  1969. filename, not a pattern, and the corresponding file will be continuously
  1970. overwritten with new images. Default value is 0.
  1971. @item strftime
  1972. If set to 1, expand the filename with date and time information from
  1973. @code{strftime()}. Default value is 0.
  1974. @item atomic_writing
  1975. Write output to a temporary file, which is renamed to target filename once
  1976. writing is completed. Default is disabled.
  1977. @item protocol_opts @var{options_list}
  1978. Set protocol options as a :-separated list of key=value parameters. Values
  1979. containing the @code{:} special character must be escaped.
  1980. @end table
  1981. @subsection Examples
  1982. The following example shows how to use @command{ffmpeg} for creating a
  1983. sequence of files @file{img-001.jpeg}, @file{img-002.jpeg}, ...,
  1984. taking one image every second from the input video:
  1985. @example
  1986. ffmpeg -i in.avi -vsync cfr -r 1 -f image2 'img-%03d.jpeg'
  1987. @end example
  1988. Note that with @command{ffmpeg}, if the format is not specified with the
  1989. @code{-f} option and the output filename specifies an image file
  1990. format, the image2 muxer is automatically selected, so the previous
  1991. command can be written as:
  1992. @example
  1993. ffmpeg -i in.avi -vsync cfr -r 1 'img-%03d.jpeg'
  1994. @end example
  1995. Note also that the pattern must not necessarily contain "%d" or
  1996. "%0@var{N}d", for example to create a single image file
  1997. @file{img.jpeg} from the start of the input video you can employ the command:
  1998. @example
  1999. ffmpeg -i in.avi -f image2 -frames:v 1 img.jpeg
  2000. @end example
  2001. The @option{strftime} option allows you to expand the filename with
  2002. date and time information. Check the documentation of
  2003. the @code{strftime()} function for the syntax.
  2004. For example to generate image files from the @code{strftime()}
  2005. "%Y-%m-%d_%H-%M-%S" pattern, the following @command{ffmpeg} command
  2006. can be used:
  2007. @example
  2008. ffmpeg -f v4l2 -r 1 -i /dev/video0 -f image2 -strftime 1 "%Y-%m-%d_%H-%M-%S.jpg"
  2009. @end example
  2010. You can set the file name with current frame's PTS:
  2011. @example
  2012. ffmpeg -f v4l2 -r 1 -i /dev/video0 -copyts -f image2 -frame_pts true %d.jpg
  2013. @end example
  2014. A more complex example is to publish contents of your desktop directly to a
  2015. WebDAV server every second:
  2016. @example
  2017. ffmpeg -f x11grab -framerate 1 -i :0.0 -q:v 6 -update 1 -protocol_opts method=PUT http://example.com/desktop.jpg
  2018. @end example
  2019. @section matroska
  2020. Matroska container muxer.
  2021. This muxer implements the matroska and webm container specs.
  2022. @subsection Metadata
  2023. The recognized metadata settings in this muxer are:
  2024. @table @option
  2025. @item title
  2026. Set title name provided to a single track. This gets mapped to
  2027. the FileDescription element for a stream written as attachment.
  2028. @item language
  2029. Specify the language of the track in the Matroska languages form.
  2030. The language can be either the 3 letters bibliographic ISO-639-2 (ISO
  2031. 639-2/B) form (like "fre" for French), or a language code mixed with a
  2032. country code for specialities in languages (like "fre-ca" for Canadian
  2033. French).
  2034. @item stereo_mode
  2035. Set stereo 3D video layout of two views in a single video track.
  2036. The following values are recognized:
  2037. @table @samp
  2038. @item mono
  2039. video is not stereo
  2040. @item left_right
  2041. Both views are arranged side by side, Left-eye view is on the left
  2042. @item bottom_top
  2043. Both views are arranged in top-bottom orientation, Left-eye view is at bottom
  2044. @item top_bottom
  2045. Both views are arranged in top-bottom orientation, Left-eye view is on top
  2046. @item checkerboard_rl
  2047. Each view is arranged in a checkerboard interleaved pattern, Left-eye view being first
  2048. @item checkerboard_lr
  2049. Each view is arranged in a checkerboard interleaved pattern, Right-eye view being first
  2050. @item row_interleaved_rl
  2051. Each view is constituted by a row based interleaving, Right-eye view is first row
  2052. @item row_interleaved_lr
  2053. Each view is constituted by a row based interleaving, Left-eye view is first row
  2054. @item col_interleaved_rl
  2055. Both views are arranged in a column based interleaving manner, Right-eye view is first column
  2056. @item col_interleaved_lr
  2057. Both views are arranged in a column based interleaving manner, Left-eye view is first column
  2058. @item anaglyph_cyan_red
  2059. All frames are in anaglyph format viewable through red-cyan filters
  2060. @item right_left
  2061. Both views are arranged side by side, Right-eye view is on the left
  2062. @item anaglyph_green_magenta
  2063. All frames are in anaglyph format viewable through green-magenta filters
  2064. @item block_lr
  2065. Both eyes laced in one Block, Left-eye view is first
  2066. @item block_rl
  2067. Both eyes laced in one Block, Right-eye view is first
  2068. @end table
  2069. @end table
  2070. For example a 3D WebM clip can be created using the following command line:
  2071. @example
  2072. ffmpeg -i sample_left_right_clip.mpg -an -c:v libvpx -metadata stereo_mode=left_right -y stereo_clip.webm
  2073. @end example
  2074. @subsection Options
  2075. This muxer supports the following options:
  2076. @table @option
  2077. @item reserve_index_space
  2078. By default, this muxer writes the index for seeking (called cues in Matroska
  2079. terms) at the end of the file, because it cannot know in advance how much space
  2080. to leave for the index at the beginning of the file. However for some use cases
  2081. -- e.g. streaming where seeking is possible but slow -- it is useful to put the
  2082. index at the beginning of the file.
  2083. If this option is set to a non-zero value, the muxer will reserve a given amount
  2084. of space in the file header and then try to write the cues there when the muxing
  2085. finishes. If the reserved space does not suffice, no Cues will be written, the
  2086. file will be finalized and writing the trailer will return an error.
  2087. A safe size for most use cases should be about 50kB per hour of video.
  2088. Note that cues are only written if the output is seekable and this option will
  2089. have no effect if it is not.
  2090. @item cues_to_front
  2091. If set, the muxer will write the index at the beginning of the file
  2092. by shifting the main data if necessary. This can be combined with
  2093. reserve_index_space in which case the data is only shifted if
  2094. the initially reserved space turns out to be insufficient.
  2095. This option is ignored if the output is unseekable.
  2096. @item default_mode
  2097. This option controls how the FlagDefault of the output tracks will be set.
  2098. It influences which tracks players should play by default. The default mode
  2099. is @samp{passthrough}.
  2100. @table @samp
  2101. @item infer
  2102. Every track with disposition default will have the FlagDefault set.
  2103. Additionally, for each type of track (audio, video or subtitle), if no track
  2104. with disposition default of this type exists, then the first track of this type
  2105. will be marked as default (if existing). This ensures that the default flag
  2106. is set in a sensible way even if the input originated from containers that
  2107. lack the concept of default tracks.
  2108. @item infer_no_subs
  2109. This mode is the same as infer except that if no subtitle track with
  2110. disposition default exists, no subtitle track will be marked as default.
  2111. @item passthrough
  2112. In this mode the FlagDefault is set if and only if the AV_DISPOSITION_DEFAULT
  2113. flag is set in the disposition of the corresponding stream.
  2114. @end table
  2115. @item flipped_raw_rgb
  2116. If set to true, store positive height for raw RGB bitmaps, which indicates
  2117. bitmap is stored bottom-up. Note that this option does not flip the bitmap
  2118. which has to be done manually beforehand, e.g. by using the vflip filter.
  2119. Default is @var{false} and indicates bitmap is stored top down.
  2120. @end table
  2121. @anchor{md5}
  2122. @section md5
  2123. MD5 testing format.
  2124. This is a variant of the @ref{hash} muxer. Unlike that muxer, it
  2125. defaults to using the MD5 hash function.
  2126. @subsection Examples
  2127. To compute the MD5 hash of the input converted to raw
  2128. audio and video, and store it in the file @file{out.md5}:
  2129. @example
  2130. ffmpeg -i INPUT -f md5 out.md5
  2131. @end example
  2132. You can print the MD5 to stdout with the command:
  2133. @example
  2134. ffmpeg -i INPUT -f md5 -
  2135. @end example
  2136. See also the @ref{hash} and @ref{framemd5} muxers.
  2137. @section mp3
  2138. The MP3 muxer writes a raw MP3 stream with the following optional features:
  2139. @itemize @bullet
  2140. @item
  2141. An ID3v2 metadata header at the beginning (enabled by default). Versions 2.3 and
  2142. 2.4 are supported, the @code{id3v2_version} private option controls which one is
  2143. used (3 or 4). Setting @code{id3v2_version} to 0 disables the ID3v2 header
  2144. completely.
  2145. The muxer supports writing attached pictures (APIC frames) to the ID3v2 header.
  2146. The pictures are supplied to the muxer in form of a video stream with a single
  2147. packet. There can be any number of those streams, each will correspond to a
  2148. single APIC frame. The stream metadata tags @var{title} and @var{comment} map
  2149. to APIC @var{description} and @var{picture type} respectively. See
  2150. @url{http://id3.org/id3v2.4.0-frames} for allowed picture types.
  2151. Note that the APIC frames must be written at the beginning, so the muxer will
  2152. buffer the audio frames until it gets all the pictures. It is therefore advised
  2153. to provide the pictures as soon as possible to avoid excessive buffering.
  2154. @item
  2155. A Xing/LAME frame right after the ID3v2 header (if present). It is enabled by
  2156. default, but will be written only if the output is seekable. The
  2157. @code{write_xing} private option can be used to disable it. The frame contains
  2158. various information that may be useful to the decoder, like the audio duration
  2159. or encoder delay.
  2160. @item
  2161. A legacy ID3v1 tag at the end of the file (disabled by default). It may be
  2162. enabled with the @code{write_id3v1} private option, but as its capabilities are
  2163. very limited, its usage is not recommended.
  2164. @end itemize
  2165. Examples:
  2166. Write an mp3 with an ID3v2.3 header and an ID3v1 footer:
  2167. @example
  2168. ffmpeg -i INPUT -id3v2_version 3 -write_id3v1 1 out.mp3
  2169. @end example
  2170. To attach a picture to an mp3 file select both the audio and the picture stream
  2171. with @code{map}:
  2172. @example
  2173. ffmpeg -i input.mp3 -i cover.png -c copy -map 0 -map 1
  2174. -metadata:s:v title="Album cover" -metadata:s:v comment="Cover (Front)" out.mp3
  2175. @end example
  2176. Write a "clean" MP3 without any extra features:
  2177. @example
  2178. ffmpeg -i input.wav -write_xing 0 -id3v2_version 0 out.mp3
  2179. @end example
  2180. @section mpegts
  2181. MPEG transport stream muxer.
  2182. This muxer implements ISO 13818-1 and part of ETSI EN 300 468.
  2183. The recognized metadata settings in mpegts muxer are @code{service_provider}
  2184. and @code{service_name}. If they are not set the default for
  2185. @code{service_provider} is @samp{FFmpeg} and the default for
  2186. @code{service_name} is @samp{Service01}.
  2187. @subsection Options
  2188. The muxer options are:
  2189. @table @option
  2190. @item mpegts_transport_stream_id @var{integer}
  2191. Set the @samp{transport_stream_id}. This identifies a transponder in DVB.
  2192. Default is @code{0x0001}.
  2193. @item mpegts_original_network_id @var{integer}
  2194. Set the @samp{original_network_id}. This is unique identifier of a
  2195. network in DVB. Its main use is in the unique identification of a service
  2196. through the path @samp{Original_Network_ID, Transport_Stream_ID}. Default
  2197. is @code{0x0001}.
  2198. @item mpegts_service_id @var{integer}
  2199. Set the @samp{service_id}, also known as program in DVB. Default is
  2200. @code{0x0001}.
  2201. @item mpegts_service_type @var{integer}
  2202. Set the program @samp{service_type}. Default is @code{digital_tv}.
  2203. Accepts the following options:
  2204. @table @samp
  2205. @item hex_value
  2206. Any hexadecimal value between @code{0x01} and @code{0xff} as defined in
  2207. ETSI 300 468.
  2208. @item digital_tv
  2209. Digital TV service.
  2210. @item digital_radio
  2211. Digital Radio service.
  2212. @item teletext
  2213. Teletext service.
  2214. @item advanced_codec_digital_radio
  2215. Advanced Codec Digital Radio service.
  2216. @item mpeg2_digital_hdtv
  2217. MPEG2 Digital HDTV service.
  2218. @item advanced_codec_digital_sdtv
  2219. Advanced Codec Digital SDTV service.
  2220. @item advanced_codec_digital_hdtv
  2221. Advanced Codec Digital HDTV service.
  2222. @end table
  2223. @item mpegts_pmt_start_pid @var{integer}
  2224. Set the first PID for PMTs. Default is @code{0x1000}, minimum is @code{0x0020},
  2225. maximum is @code{0x1ffa}. This option has no effect in m2ts mode where the PMT
  2226. PID is fixed @code{0x0100}.
  2227. @item mpegts_start_pid @var{integer}
  2228. Set the first PID for elementary streams. Default is @code{0x0100}, minimum is
  2229. @code{0x0020}, maximum is @code{0x1ffa}. This option has no effect in m2ts mode
  2230. where the elementary stream PIDs are fixed.
  2231. @item mpegts_m2ts_mode @var{boolean}
  2232. Enable m2ts mode if set to @code{1}. Default value is @code{-1} which
  2233. disables m2ts mode.
  2234. @item muxrate @var{integer}
  2235. Set a constant muxrate. Default is VBR.
  2236. @item pes_payload_size @var{integer}
  2237. Set minimum PES packet payload in bytes. Default is @code{2930}.
  2238. @item mpegts_flags @var{flags}
  2239. Set mpegts flags. Accepts the following options:
  2240. @table @samp
  2241. @item resend_headers
  2242. Reemit PAT/PMT before writing the next packet.
  2243. @item latm
  2244. Use LATM packetization for AAC.
  2245. @item pat_pmt_at_frames
  2246. Reemit PAT and PMT at each video frame.
  2247. @item system_b
  2248. Conform to System B (DVB) instead of System A (ATSC).
  2249. @item initial_discontinuity
  2250. Mark the initial packet of each stream as discontinuity.
  2251. @item nit
  2252. Emit NIT table.
  2253. @item omit_rai
  2254. Disable writing of random access indicator.
  2255. @end table
  2256. @item mpegts_copyts @var{boolean}
  2257. Preserve original timestamps, if value is set to @code{1}. Default value
  2258. is @code{-1}, which results in shifting timestamps so that they start from 0.
  2259. @item omit_video_pes_length @var{boolean}
  2260. Omit the PES packet length for video packets. Default is @code{1} (true).
  2261. @item pcr_period @var{integer}
  2262. Override the default PCR retransmission time in milliseconds. Default is
  2263. @code{-1} which means that the PCR interval will be determined automatically:
  2264. 20 ms is used for CBR streams, the highest multiple of the frame duration which
  2265. is less than 100 ms is used for VBR streams.
  2266. @item pat_period @var{duration}
  2267. Maximum time in seconds between PAT/PMT tables. Default is @code{0.1}.
  2268. @item sdt_period @var{duration}
  2269. Maximum time in seconds between SDT tables. Default is @code{0.5}.
  2270. @item nit_period @var{duration}
  2271. Maximum time in seconds between NIT tables. Default is @code{0.5}.
  2272. @item tables_version @var{integer}
  2273. Set PAT, PMT, SDT and NIT version (default @code{0}, valid values are from 0 to 31, inclusively).
  2274. This option allows updating stream structure so that standard consumer may
  2275. detect the change. To do so, reopen output @code{AVFormatContext} (in case of API
  2276. usage) or restart @command{ffmpeg} instance, cyclically changing
  2277. @option{tables_version} value:
  2278. @example
  2279. ffmpeg -i source1.ts -codec copy -f mpegts -tables_version 0 udp://1.1.1.1:1111
  2280. ffmpeg -i source2.ts -codec copy -f mpegts -tables_version 1 udp://1.1.1.1:1111
  2281. ...
  2282. ffmpeg -i source3.ts -codec copy -f mpegts -tables_version 31 udp://1.1.1.1:1111
  2283. ffmpeg -i source1.ts -codec copy -f mpegts -tables_version 0 udp://1.1.1.1:1111
  2284. ffmpeg -i source2.ts -codec copy -f mpegts -tables_version 1 udp://1.1.1.1:1111
  2285. ...
  2286. @end example
  2287. @end table
  2288. @subsection Example
  2289. @example
  2290. ffmpeg -i file.mpg -c copy \
  2291. -mpegts_original_network_id 0x1122 \
  2292. -mpegts_transport_stream_id 0x3344 \
  2293. -mpegts_service_id 0x5566 \
  2294. -mpegts_pmt_start_pid 0x1500 \
  2295. -mpegts_start_pid 0x150 \
  2296. -metadata service_provider="Some provider" \
  2297. -metadata service_name="Some Channel" \
  2298. out.ts
  2299. @end example
  2300. @section mxf, mxf_d10, mxf_opatom
  2301. MXF muxer.
  2302. @subsection Options
  2303. The muxer options are:
  2304. @table @option
  2305. @item store_user_comments @var{bool}
  2306. Set if user comments should be stored if available or never.
  2307. IRT D-10 does not allow user comments. The default is thus to write them for
  2308. mxf and mxf_opatom but not for mxf_d10
  2309. @end table
  2310. @section null
  2311. Null muxer.
  2312. This muxer does not generate any output file, it is mainly useful for
  2313. testing or benchmarking purposes.
  2314. For example to benchmark decoding with @command{ffmpeg} you can use the
  2315. command:
  2316. @example
  2317. ffmpeg -benchmark -i INPUT -f null out.null
  2318. @end example
  2319. Note that the above command does not read or write the @file{out.null}
  2320. file, but specifying the output file is required by the @command{ffmpeg}
  2321. syntax.
  2322. Alternatively you can write the command as:
  2323. @example
  2324. ffmpeg -benchmark -i INPUT -f null -
  2325. @end example
  2326. @section nut
  2327. @table @option
  2328. @item -syncpoints @var{flags}
  2329. Change the syncpoint usage in nut:
  2330. @table @option
  2331. @item @var{default} use the normal low-overhead seeking aids.
  2332. @item @var{none} do not use the syncpoints at all, reducing the overhead but making the stream non-seekable;
  2333. Use of this option is not recommended, as the resulting files are very damage
  2334. sensitive and seeking is not possible. Also in general the overhead from
  2335. syncpoints is negligible. Note, -@code{write_index} 0 can be used to disable
  2336. all growing data tables, allowing to mux endless streams with limited memory
  2337. and without these disadvantages.
  2338. @item @var{timestamped} extend the syncpoint with a wallclock field.
  2339. @end table
  2340. The @var{none} and @var{timestamped} flags are experimental.
  2341. @item -write_index @var{bool}
  2342. Write index at the end, the default is to write an index.
  2343. @end table
  2344. @example
  2345. ffmpeg -i INPUT -f_strict experimental -syncpoints none - | processor
  2346. @end example
  2347. @section ogg
  2348. Ogg container muxer.
  2349. @table @option
  2350. @item -page_duration @var{duration}
  2351. Preferred page duration, in microseconds. The muxer will attempt to create
  2352. pages that are approximately @var{duration} microseconds long. This allows the
  2353. user to compromise between seek granularity and container overhead. The default
  2354. is 1 second. A value of 0 will fill all segments, making pages as large as
  2355. possible. A value of 1 will effectively use 1 packet-per-page in most
  2356. situations, giving a small seek granularity at the cost of additional container
  2357. overhead.
  2358. @item -serial_offset @var{value}
  2359. Serial value from which to set the streams serial number.
  2360. Setting it to different and sufficiently large values ensures that the produced
  2361. ogg files can be safely chained.
  2362. @end table
  2363. @anchor{rcwt}
  2364. @section rcwt
  2365. Raw Captions With Time (RCWT) is a format native to ccextractor, a commonly
  2366. used open source tool for processing 608/708 closed caption (CC) sources.
  2367. It can be used to archive the original, raw CC bitstream and to produce
  2368. a source file for later CC processing or conversion. As a result,
  2369. it also allows for interopability with ccextractor for processing CC data
  2370. extracted via ffmpeg. The format is simple to parse and can be used
  2371. to retain all lines and variants of CC.
  2372. This muxer implements the specification as of 2024-01-05, which has
  2373. been stable and unchanged for 10 years as of this writing.
  2374. This muxer will have some nuances from the way that ccextractor muxes RCWT.
  2375. No compatibility issues when processing the output with ccextractor
  2376. have been observed as a result of this so far, but mileage may vary
  2377. and outputs will not be a bit-exact match.
  2378. A free specification of RCWT can be found here:
  2379. @url{https://github.com/CCExtractor/ccextractor/blob/master/docs/BINARY_FILE_FORMAT.TXT}
  2380. @anchor{segment}
  2381. @section segment, stream_segment, ssegment
  2382. Basic stream segmenter.
  2383. This muxer outputs streams to a number of separate files of nearly
  2384. fixed duration. Output filename pattern can be set in a fashion
  2385. similar to @ref{image2}, or by using a @code{strftime} template if
  2386. the @option{strftime} option is enabled.
  2387. @code{stream_segment} is a variant of the muxer used to write to
  2388. streaming output formats, i.e. which do not require global headers,
  2389. and is recommended for outputting e.g. to MPEG transport stream segments.
  2390. @code{ssegment} is a shorter alias for @code{stream_segment}.
  2391. Every segment starts with a keyframe of the selected reference stream,
  2392. which is set through the @option{reference_stream} option.
  2393. Note that if you want accurate splitting for a video file, you need to
  2394. make the input key frames correspond to the exact splitting times
  2395. expected by the segmenter, or the segment muxer will start the new
  2396. segment with the key frame found next after the specified start
  2397. time.
  2398. The segment muxer works best with a single constant frame rate video.
  2399. Optionally it can generate a list of the created segments, by setting
  2400. the option @var{segment_list}. The list type is specified by the
  2401. @var{segment_list_type} option. The entry filenames in the segment
  2402. list are set by default to the basename of the corresponding segment
  2403. files.
  2404. See also the @ref{hls} muxer, which provides a more specific
  2405. implementation for HLS segmentation.
  2406. @subsection Options
  2407. The segment muxer supports the following options:
  2408. @table @option
  2409. @item increment_tc @var{1|0}
  2410. if set to @code{1}, increment timecode between each segment
  2411. If this is selected, the input need to have
  2412. a timecode in the first video stream. Default value is
  2413. @code{0}.
  2414. @item reference_stream @var{specifier}
  2415. Set the reference stream, as specified by the string @var{specifier}.
  2416. If @var{specifier} is set to @code{auto}, the reference is chosen
  2417. automatically. Otherwise it must be a stream specifier (see the ``Stream
  2418. specifiers'' chapter in the ffmpeg manual) which specifies the
  2419. reference stream. The default value is @code{auto}.
  2420. @item segment_format @var{format}
  2421. Override the inner container format, by default it is guessed by the filename
  2422. extension.
  2423. @item segment_format_options @var{options_list}
  2424. Set output format options using a :-separated list of key=value
  2425. parameters. Values containing the @code{:} special character must be
  2426. escaped.
  2427. @item segment_list @var{name}
  2428. Generate also a listfile named @var{name}. If not specified no
  2429. listfile is generated.
  2430. @item segment_list_flags @var{flags}
  2431. Set flags affecting the segment list generation.
  2432. It currently supports the following flags:
  2433. @table @samp
  2434. @item cache
  2435. Allow caching (only affects M3U8 list files).
  2436. @item live
  2437. Allow live-friendly file generation.
  2438. @end table
  2439. @item segment_list_size @var{size}
  2440. Update the list file so that it contains at most @var{size}
  2441. segments. If 0 the list file will contain all the segments. Default
  2442. value is 0.
  2443. @item segment_list_entry_prefix @var{prefix}
  2444. Prepend @var{prefix} to each entry. Useful to generate absolute paths.
  2445. By default no prefix is applied.
  2446. @item segment_list_type @var{type}
  2447. Select the listing format.
  2448. The following values are recognized:
  2449. @table @samp
  2450. @item flat
  2451. Generate a flat list for the created segments, one segment per line.
  2452. @item csv, ext
  2453. Generate a list for the created segments, one segment per line,
  2454. each line matching the format (comma-separated values):
  2455. @example
  2456. @var{segment_filename},@var{segment_start_time},@var{segment_end_time}
  2457. @end example
  2458. @var{segment_filename} is the name of the output file generated by the
  2459. muxer according to the provided pattern. CSV escaping (according to
  2460. RFC4180) is applied if required.
  2461. @var{segment_start_time} and @var{segment_end_time} specify
  2462. the segment start and end time expressed in seconds.
  2463. A list file with the suffix @code{".csv"} or @code{".ext"} will
  2464. auto-select this format.
  2465. @samp{ext} is deprecated in favor or @samp{csv}.
  2466. @item ffconcat
  2467. Generate an ffconcat file for the created segments. The resulting file
  2468. can be read using the FFmpeg @ref{concat} demuxer.
  2469. A list file with the suffix @code{".ffcat"} or @code{".ffconcat"} will
  2470. auto-select this format.
  2471. @item m3u8
  2472. Generate an extended M3U8 file, version 3, compliant with
  2473. @url{http://tools.ietf.org/id/draft-pantos-http-live-streaming}.
  2474. A list file with the suffix @code{".m3u8"} will auto-select this format.
  2475. @end table
  2476. If not specified the type is guessed from the list file name suffix.
  2477. @item segment_time @var{time}
  2478. Set segment duration to @var{time}, the value must be a duration
  2479. specification. Default value is "2". See also the
  2480. @option{segment_times} option.
  2481. Note that splitting may not be accurate, unless you force the
  2482. reference stream key-frames at the given time. See the introductory
  2483. notice and the examples below.
  2484. @item min_seg_duration @var{time}
  2485. Set minimum segment duration to @var{time}, the value must be a duration
  2486. specification. This prevents the muxer ending segments at a duration below
  2487. this value. Only effective with @code{segment_time}. Default value is "0".
  2488. @item segment_atclocktime @var{1|0}
  2489. If set to "1" split at regular clock time intervals starting from 00:00
  2490. o'clock. The @var{time} value specified in @option{segment_time} is
  2491. used for setting the length of the splitting interval.
  2492. For example with @option{segment_time} set to "900" this makes it possible
  2493. to create files at 12:00 o'clock, 12:15, 12:30, etc.
  2494. Default value is "0".
  2495. @item segment_clocktime_offset @var{duration}
  2496. Delay the segment splitting times with the specified duration when using
  2497. @option{segment_atclocktime}.
  2498. For example with @option{segment_time} set to "900" and
  2499. @option{segment_clocktime_offset} set to "300" this makes it possible to
  2500. create files at 12:05, 12:20, 12:35, etc.
  2501. Default value is "0".
  2502. @item segment_clocktime_wrap_duration @var{duration}
  2503. Force the segmenter to only start a new segment if a packet reaches the muxer
  2504. within the specified duration after the segmenting clock time. This way you
  2505. can make the segmenter more resilient to backward local time jumps, such as
  2506. leap seconds or transition to standard time from daylight savings time.
  2507. Default is the maximum possible duration which means starting a new segment
  2508. regardless of the elapsed time since the last clock time.
  2509. @item segment_time_delta @var{delta}
  2510. Specify the accuracy time when selecting the start time for a
  2511. segment, expressed as a duration specification. Default value is "0".
  2512. When delta is specified a key-frame will start a new segment if its
  2513. PTS satisfies the relation:
  2514. @example
  2515. PTS >= start_time - time_delta
  2516. @end example
  2517. This option is useful when splitting video content, which is always
  2518. split at GOP boundaries, in case a key frame is found just before the
  2519. specified split time.
  2520. In particular may be used in combination with the @file{ffmpeg} option
  2521. @var{force_key_frames}. The key frame times specified by
  2522. @var{force_key_frames} may not be set accurately because of rounding
  2523. issues, with the consequence that a key frame time may result set just
  2524. before the specified time. For constant frame rate videos a value of
  2525. 1/(2*@var{frame_rate}) should address the worst case mismatch between
  2526. the specified time and the time set by @var{force_key_frames}.
  2527. @item segment_times @var{times}
  2528. Specify a list of split points. @var{times} contains a list of comma
  2529. separated duration specifications, in increasing order. See also
  2530. the @option{segment_time} option.
  2531. @item segment_frames @var{frames}
  2532. Specify a list of split video frame numbers. @var{frames} contains a
  2533. list of comma separated integer numbers, in increasing order.
  2534. This option specifies to start a new segment whenever a reference
  2535. stream key frame is found and the sequential number (starting from 0)
  2536. of the frame is greater or equal to the next value in the list.
  2537. @item segment_wrap @var{limit}
  2538. Wrap around segment index once it reaches @var{limit}.
  2539. @item segment_start_number @var{number}
  2540. Set the sequence number of the first segment. Defaults to @code{0}.
  2541. @item strftime @var{1|0}
  2542. Use the @code{strftime} function to define the name of the new
  2543. segments to write. If this is selected, the output segment name must
  2544. contain a @code{strftime} function template. Default value is
  2545. @code{0}.
  2546. @item break_non_keyframes @var{1|0}
  2547. If enabled, allow segments to start on frames other than keyframes. This
  2548. improves behavior on some players when the time between keyframes is
  2549. inconsistent, but may make things worse on others, and can cause some oddities
  2550. during seeking. Defaults to @code{0}.
  2551. @item reset_timestamps @var{1|0}
  2552. Reset timestamps at the beginning of each segment, so that each segment
  2553. will start with near-zero timestamps. It is meant to ease the playback
  2554. of the generated segments. May not work with some combinations of
  2555. muxers/codecs. It is set to @code{0} by default.
  2556. @item initial_offset @var{offset}
  2557. Specify timestamp offset to apply to the output packet timestamps. The
  2558. argument must be a time duration specification, and defaults to 0.
  2559. @item write_empty_segments @var{1|0}
  2560. If enabled, write an empty segment if there are no packets during the period a
  2561. segment would usually span. Otherwise, the segment will be filled with the next
  2562. packet written. Defaults to @code{0}.
  2563. @end table
  2564. Make sure to require a closed GOP when encoding and to set the GOP
  2565. size to fit your segment time constraint.
  2566. @subsection Examples
  2567. @itemize
  2568. @item
  2569. Remux the content of file @file{in.mkv} to a list of segments
  2570. @file{out-000.nut}, @file{out-001.nut}, etc., and write the list of
  2571. generated segments to @file{out.list}:
  2572. @example
  2573. ffmpeg -i in.mkv -codec hevc -flags +cgop -g 60 -map 0 -f segment -segment_list out.list out%03d.nut
  2574. @end example
  2575. @item
  2576. Segment input and set output format options for the output segments:
  2577. @example
  2578. ffmpeg -i in.mkv -f segment -segment_time 10 -segment_format_options movflags=+faststart out%03d.mp4
  2579. @end example
  2580. @item
  2581. Segment the input file according to the split points specified by the
  2582. @var{segment_times} option:
  2583. @example
  2584. 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
  2585. @end example
  2586. @item
  2587. Use the @command{ffmpeg} @option{force_key_frames}
  2588. option to force key frames in the input at the specified location, together
  2589. with the segment option @option{segment_time_delta} to account for
  2590. possible roundings operated when setting key frame times.
  2591. @example
  2592. ffmpeg -i in.mkv -force_key_frames 1,2,3,5,8,13,21 -codec:v mpeg4 -codec:a pcm_s16le -map 0 \
  2593. -f segment -segment_list out.csv -segment_times 1,2,3,5,8,13,21 -segment_time_delta 0.05 out%03d.nut
  2594. @end example
  2595. In order to force key frames on the input file, transcoding is
  2596. required.
  2597. @item
  2598. Segment the input file by splitting the input file according to the
  2599. frame numbers sequence specified with the @option{segment_frames} option:
  2600. @example
  2601. ffmpeg -i in.mkv -codec copy -map 0 -f segment -segment_list out.csv -segment_frames 100,200,300,500,800 out%03d.nut
  2602. @end example
  2603. @item
  2604. Convert the @file{in.mkv} to TS segments using the @code{libx264}
  2605. and @code{aac} encoders:
  2606. @example
  2607. ffmpeg -i in.mkv -map 0 -codec:v libx264 -codec:a aac -f ssegment -segment_list out.list out%03d.ts
  2608. @end example
  2609. @item
  2610. Segment the input file, and create an M3U8 live playlist (can be used
  2611. as live HLS source):
  2612. @example
  2613. ffmpeg -re -i in.mkv -codec copy -map 0 -f segment -segment_list playlist.m3u8 \
  2614. -segment_list_flags +live -segment_time 10 out%03d.mkv
  2615. @end example
  2616. @end itemize
  2617. @section smoothstreaming
  2618. Smooth Streaming muxer generates a set of files (Manifest, chunks) suitable for serving with conventional web server.
  2619. @table @option
  2620. @item window_size
  2621. Specify the number of fragments kept in the manifest. Default 0 (keep all).
  2622. @item extra_window_size
  2623. Specify the number of fragments kept outside of the manifest before removing from disk. Default 5.
  2624. @item lookahead_count
  2625. Specify the number of lookahead fragments. Default 2.
  2626. @item min_frag_duration
  2627. Specify the minimum fragment duration (in microseconds). Default 5000000.
  2628. @item remove_at_exit
  2629. Specify whether to remove all fragments when finished. Default 0 (do not remove).
  2630. @end table
  2631. @anchor{streamhash}
  2632. @section streamhash
  2633. Per stream hash testing format.
  2634. This muxer computes and prints a cryptographic hash of all the input frames,
  2635. on a per-stream basis. This can be used for equality checks without having
  2636. to do a complete binary comparison.
  2637. By default audio frames are converted to signed 16-bit raw audio and
  2638. video frames to raw video before computing the hash, but the output
  2639. of explicit conversions to other codecs can also be used. Timestamps
  2640. are ignored. It uses the SHA-256 cryptographic hash function by default,
  2641. but supports several other algorithms.
  2642. The output of the muxer consists of one line per stream of the form:
  2643. @var{streamindex},@var{streamtype},@var{algo}=@var{hash}, where
  2644. @var{streamindex} is the index of the mapped stream, @var{streamtype} is a
  2645. single character indicating the type of stream, @var{algo} is a short string
  2646. representing the hash function used, and @var{hash} is a hexadecimal number
  2647. representing the computed hash.
  2648. @table @option
  2649. @item hash @var{algorithm}
  2650. Use the cryptographic hash function specified by the string @var{algorithm}.
  2651. Supported values include @code{MD5}, @code{murmur3}, @code{RIPEMD128},
  2652. @code{RIPEMD160}, @code{RIPEMD256}, @code{RIPEMD320}, @code{SHA160},
  2653. @code{SHA224}, @code{SHA256} (default), @code{SHA512/224}, @code{SHA512/256},
  2654. @code{SHA384}, @code{SHA512}, @code{CRC32} and @code{adler32}.
  2655. @end table
  2656. @subsection Examples
  2657. To compute the SHA-256 hash of the input converted to raw audio and
  2658. video, and store it in the file @file{out.sha256}:
  2659. @example
  2660. ffmpeg -i INPUT -f streamhash out.sha256
  2661. @end example
  2662. To print an MD5 hash to stdout use the command:
  2663. @example
  2664. ffmpeg -i INPUT -f streamhash -hash md5 -
  2665. @end example
  2666. See also the @ref{hash} and @ref{framehash} muxers.
  2667. @anchor{tee}
  2668. @section tee
  2669. The tee muxer can be used to write the same data to several outputs, such as files or streams.
  2670. It can be used, for example, to stream a video over a network and save it to disk at the same time.
  2671. It is different from specifying several outputs to the @command{ffmpeg}
  2672. command-line tool. With the tee muxer, the audio and video data will be encoded only once.
  2673. With conventional multiple outputs, multiple encoding operations in parallel are initiated,
  2674. which can be a very expensive process. The tee muxer is not useful when using the libavformat API
  2675. directly because it is then possible to feed the same packets to several muxers directly.
  2676. Since the tee muxer does not represent any particular output format, ffmpeg cannot auto-select
  2677. output streams. So all streams intended for output must be specified using @code{-map}. See
  2678. the examples below.
  2679. Some encoders may need different options depending on the output format;
  2680. the auto-detection of this can not work with the tee muxer, so they need to be explicitly specified.
  2681. The main example is the @option{global_header} flag.
  2682. The slave outputs are specified in the file name given to the muxer,
  2683. separated by '|'. If any of the slave name contains the '|' separator,
  2684. leading or trailing spaces or any special character, those must be
  2685. escaped (see @ref{quoting_and_escaping,,the "Quoting and escaping"
  2686. section in the ffmpeg-utils(1) manual,ffmpeg-utils}).
  2687. @subsection Options
  2688. @table @option
  2689. @item use_fifo @var{bool}
  2690. If set to 1, slave outputs will be processed in separate threads using the @ref{fifo}
  2691. muxer. This allows to compensate for different speed/latency/reliability of
  2692. outputs and setup transparent recovery. By default this feature is turned off.
  2693. @item fifo_options
  2694. Options to pass to fifo pseudo-muxer instances. See @ref{fifo}.
  2695. @end table
  2696. Muxer options can be specified for each slave by prepending them as a list of
  2697. @var{key}=@var{value} pairs separated by ':', between square brackets. If
  2698. the options values contain a special character or the ':' separator, they
  2699. must be escaped; note that this is a second level escaping.
  2700. The following special options are also recognized:
  2701. @table @option
  2702. @item f
  2703. Specify the format name. Required if it cannot be guessed from the
  2704. output URL.
  2705. @item bsfs[/@var{spec}]
  2706. Specify a list of bitstream filters to apply to the specified
  2707. output.
  2708. It is possible to specify to which streams a given bitstream filter
  2709. applies, by appending a stream specifier to the option separated by
  2710. @code{/}. @var{spec} must be a stream specifier (see @ref{Format
  2711. stream specifiers}).
  2712. If the stream specifier is not specified, the bitstream filters will be
  2713. applied to all streams in the output. This will cause that output operation
  2714. to fail if the output contains streams to which the bitstream filter cannot
  2715. be applied e.g. @code{h264_mp4toannexb} being applied to an output containing an audio stream.
  2716. Options for a bitstream filter must be specified in the form of @code{opt=value}.
  2717. Several bitstream filters can be specified, separated by ",".
  2718. @item use_fifo @var{bool}
  2719. This allows to override tee muxer use_fifo option for individual slave muxer.
  2720. @item fifo_options
  2721. This allows to override tee muxer fifo_options for individual slave muxer.
  2722. See @ref{fifo}.
  2723. @item select
  2724. Select the streams that should be mapped to the slave output,
  2725. specified by a stream specifier. If not specified, this defaults to
  2726. all the mapped streams. This will cause that output operation to fail
  2727. if the output format does not accept all mapped streams.
  2728. You may use multiple stream specifiers separated by commas (@code{,}) e.g.: @code{a:0,v}
  2729. @item onfail
  2730. Specify behaviour on output failure. This can be set to either @code{abort} (which is
  2731. default) or @code{ignore}. @code{abort} will cause whole process to fail in case of failure
  2732. on this slave output. @code{ignore} will ignore failure on this output, so other outputs
  2733. will continue without being affected.
  2734. @end table
  2735. @subsection Examples
  2736. @itemize
  2737. @item
  2738. Encode something and both archive it in a WebM file and stream it
  2739. as MPEG-TS over UDP:
  2740. @example
  2741. ffmpeg -i ... -c:v libx264 -c:a mp2 -f tee -map 0:v -map 0:a
  2742. "archive-20121107.mkv|[f=mpegts]udp://10.0.1.255:1234/"
  2743. @end example
  2744. @item
  2745. As above, but continue streaming even if output to local file fails
  2746. (for example local drive fills up):
  2747. @example
  2748. ffmpeg -i ... -c:v libx264 -c:a mp2 -f tee -map 0:v -map 0:a
  2749. "[onfail=ignore]archive-20121107.mkv|[f=mpegts]udp://10.0.1.255:1234/"
  2750. @end example
  2751. @item
  2752. Use @command{ffmpeg} to encode the input, and send the output
  2753. to three different destinations. The @code{dump_extra} bitstream
  2754. filter is used to add extradata information to all the output video
  2755. keyframes packets, as requested by the MPEG-TS format. The select
  2756. option is applied to @file{out.aac} in order to make it contain only
  2757. audio packets.
  2758. @example
  2759. ffmpeg -i ... -map 0 -flags +global_header -c:v libx264 -c:a aac
  2760. -f tee "[bsfs/v=dump_extra=freq=keyframe]out.ts|[movflags=+faststart]out.mp4|[select=a]out.aac"
  2761. @end example
  2762. @item
  2763. As above, but select only stream @code{a:1} for the audio output. Note
  2764. that a second level escaping must be performed, as ":" is a special
  2765. character used to separate options.
  2766. @example
  2767. ffmpeg -i ... -map 0 -flags +global_header -c:v libx264 -c:a aac
  2768. -f tee "[bsfs/v=dump_extra=freq=keyframe]out.ts|[movflags=+faststart]out.mp4|[select=\'a:1\']out.aac"
  2769. @end example
  2770. @end itemize
  2771. @section webm_chunk
  2772. WebM Live Chunk Muxer.
  2773. This muxer writes out WebM headers and chunks as separate files which can be
  2774. consumed by clients that support WebM Live streams via DASH.
  2775. @subsection Options
  2776. This muxer supports the following options:
  2777. @table @option
  2778. @item chunk_start_index
  2779. Index of the first chunk (defaults to 0).
  2780. @item header
  2781. Filename of the header where the initialization data will be written.
  2782. @item audio_chunk_duration
  2783. Duration of each audio chunk in milliseconds (defaults to 5000).
  2784. @end table
  2785. @subsection Example
  2786. @example
  2787. ffmpeg -f v4l2 -i /dev/video0 \
  2788. -f alsa -i hw:0 \
  2789. -map 0:0 \
  2790. -c:v libvpx-vp9 \
  2791. -s 640x360 -keyint_min 30 -g 30 \
  2792. -f webm_chunk \
  2793. -header webm_live_video_360.hdr \
  2794. -chunk_start_index 1 \
  2795. webm_live_video_360_%d.chk \
  2796. -map 1:0 \
  2797. -c:a libvorbis \
  2798. -b:a 128k \
  2799. -f webm_chunk \
  2800. -header webm_live_audio_128.hdr \
  2801. -chunk_start_index 1 \
  2802. -audio_chunk_duration 1000 \
  2803. webm_live_audio_128_%d.chk
  2804. @end example
  2805. @section webm_dash_manifest
  2806. WebM DASH Manifest muxer.
  2807. This muxer implements the WebM DASH Manifest specification to generate the DASH
  2808. manifest XML. It also supports manifest generation for DASH live streams.
  2809. For more information see:
  2810. @itemize @bullet
  2811. @item
  2812. WebM DASH Specification: @url{https://sites.google.com/a/webmproject.org/wiki/adaptive-streaming/webm-dash-specification}
  2813. @item
  2814. ISO DASH Specification: @url{http://standards.iso.org/ittf/PubliclyAvailableStandards/c065274_ISO_IEC_23009-1_2014.zip}
  2815. @end itemize
  2816. @subsection Options
  2817. This muxer supports the following options:
  2818. @table @option
  2819. @item adaptation_sets
  2820. This option has the following syntax: "id=x,streams=a,b,c id=y,streams=d,e" where x and y are the
  2821. unique identifiers of the adaptation sets and a,b,c,d and e are the indices of the corresponding
  2822. audio and video streams. Any number of adaptation sets can be added using this option.
  2823. @item live
  2824. Set this to 1 to create a live stream DASH Manifest. Default: 0.
  2825. @item chunk_start_index
  2826. Start index of the first chunk. This will go in the @samp{startNumber} attribute
  2827. of the @samp{SegmentTemplate} element in the manifest. Default: 0.
  2828. @item chunk_duration_ms
  2829. Duration of each chunk in milliseconds. This will go in the @samp{duration}
  2830. attribute of the @samp{SegmentTemplate} element in the manifest. Default: 1000.
  2831. @item utc_timing_url
  2832. URL of the page that will return the UTC timestamp in ISO format. This will go
  2833. in the @samp{value} attribute of the @samp{UTCTiming} element in the manifest.
  2834. Default: None.
  2835. @item time_shift_buffer_depth
  2836. Smallest time (in seconds) shifting buffer for which any Representation is
  2837. guaranteed to be available. This will go in the @samp{timeShiftBufferDepth}
  2838. attribute of the @samp{MPD} element. Default: 60.
  2839. @item minimum_update_period
  2840. Minimum update period (in seconds) of the manifest. This will go in the
  2841. @samp{minimumUpdatePeriod} attribute of the @samp{MPD} element. Default: 0.
  2842. @end table
  2843. @subsection Example
  2844. @example
  2845. ffmpeg -f webm_dash_manifest -i video1.webm \
  2846. -f webm_dash_manifest -i video2.webm \
  2847. -f webm_dash_manifest -i audio1.webm \
  2848. -f webm_dash_manifest -i audio2.webm \
  2849. -map 0 -map 1 -map 2 -map 3 \
  2850. -c copy \
  2851. -f webm_dash_manifest \
  2852. -adaptation_sets "id=0,streams=0,1 id=1,streams=2,3" \
  2853. manifest.xml
  2854. @end example
  2855. @c man end MUXERS