filters.texi 613 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998
  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{framesync}
  252. @chapter Options for filters with several inputs (framesync)
  253. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  254. Some filters with several inputs support a common set of options.
  255. These options can only be set by name, not with the short notation.
  256. @table @option
  257. @item eof_action
  258. The action to take when EOF is encountered on the secondary input; it accepts
  259. one of the following values:
  260. @table @option
  261. @item repeat
  262. Repeat the last frame (the default).
  263. @item endall
  264. End both streams.
  265. @item pass
  266. Pass the main input through.
  267. @end table
  268. @item shortest
  269. If set to 1, force the output to terminate when the shortest input
  270. terminates. Default value is 0.
  271. @item repeatlast
  272. If set to 1, force the filter to extend the last frame of secondary streams
  273. until the end of the primary stream. A value of 0 disables this behavior.
  274. Default value is 1.
  275. @end table
  276. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  277. @chapter Audio Filters
  278. @c man begin AUDIO FILTERS
  279. When you configure your FFmpeg build, you can disable any of the
  280. existing filters using @code{--disable-filters}.
  281. The configure output will show the audio filters included in your
  282. build.
  283. Below is a description of the currently available audio filters.
  284. @section acompressor
  285. A compressor is mainly used to reduce the dynamic range of a signal.
  286. Especially modern music is mostly compressed at a high ratio to
  287. improve the overall loudness. It's done to get the highest attention
  288. of a listener, "fatten" the sound and bring more "power" to the track.
  289. If a signal is compressed too much it may sound dull or "dead"
  290. afterwards or it may start to "pump" (which could be a powerful effect
  291. but can also destroy a track completely).
  292. The right compression is the key to reach a professional sound and is
  293. the high art of mixing and mastering. Because of its complex settings
  294. it may take a long time to get the right feeling for this kind of effect.
  295. Compression is done by detecting the volume above a chosen level
  296. @code{threshold} and dividing it by the factor set with @code{ratio}.
  297. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  298. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  299. the signal would cause distortion of the waveform the reduction can be
  300. levelled over the time. This is done by setting "Attack" and "Release".
  301. @code{attack} determines how long the signal has to rise above the threshold
  302. before any reduction will occur and @code{release} sets the time the signal
  303. has to fall below the threshold to reduce the reduction again. Shorter signals
  304. than the chosen attack time will be left untouched.
  305. The overall reduction of the signal can be made up afterwards with the
  306. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  307. raising the makeup to this level results in a signal twice as loud than the
  308. source. To gain a softer entry in the compression the @code{knee} flattens the
  309. hard edge at the threshold in the range of the chosen decibels.
  310. The filter accepts the following options:
  311. @table @option
  312. @item level_in
  313. Set input gain. Default is 1. Range is between 0.015625 and 64.
  314. @item mode
  315. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  316. Default is @code{downward}.
  317. @item threshold
  318. If a signal of stream rises above this level it will affect the gain
  319. reduction.
  320. By default it is 0.125. Range is between 0.00097563 and 1.
  321. @item ratio
  322. Set a ratio by which the signal is reduced. 1:2 means that if the level
  323. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  324. Default is 2. Range is between 1 and 20.
  325. @item attack
  326. Amount of milliseconds the signal has to rise above the threshold before gain
  327. reduction starts. Default is 20. Range is between 0.01 and 2000.
  328. @item release
  329. Amount of milliseconds the signal has to fall below the threshold before
  330. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  331. @item makeup
  332. Set the amount by how much signal will be amplified after processing.
  333. Default is 1. Range is from 1 to 64.
  334. @item knee
  335. Curve the sharp knee around the threshold to enter gain reduction more softly.
  336. Default is 2.82843. Range is between 1 and 8.
  337. @item link
  338. Choose if the @code{average} level between all channels of input stream
  339. or the louder(@code{maximum}) channel of input stream affects the
  340. reduction. Default is @code{average}.
  341. @item detection
  342. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  343. of @code{rms}. Default is @code{rms} which is mostly smoother.
  344. @item mix
  345. How much to use compressed signal in output. Default is 1.
  346. Range is between 0 and 1.
  347. @end table
  348. @section acontrast
  349. Simple audio dynamic range compression/expansion filter.
  350. The filter accepts the following options:
  351. @table @option
  352. @item contrast
  353. Set contrast. Default is 33. Allowed range is between 0 and 100.
  354. @end table
  355. @section acopy
  356. Copy the input audio source unchanged to the output. This is mainly useful for
  357. testing purposes.
  358. @section acrossfade
  359. Apply cross fade from one input audio stream to another input audio stream.
  360. The cross fade is applied for specified duration near the end of first stream.
  361. The filter accepts the following options:
  362. @table @option
  363. @item nb_samples, ns
  364. Specify the number of samples for which the cross fade effect has to last.
  365. At the end of the cross fade effect the first input audio will be completely
  366. silent. Default is 44100.
  367. @item duration, d
  368. Specify the duration of the cross fade effect. See
  369. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  370. for the accepted syntax.
  371. By default the duration is determined by @var{nb_samples}.
  372. If set this option is used instead of @var{nb_samples}.
  373. @item overlap, o
  374. Should first stream end overlap with second stream start. Default is enabled.
  375. @item curve1
  376. Set curve for cross fade transition for first stream.
  377. @item curve2
  378. Set curve for cross fade transition for second stream.
  379. For description of available curve types see @ref{afade} filter description.
  380. @end table
  381. @subsection Examples
  382. @itemize
  383. @item
  384. Cross fade from one input to another:
  385. @example
  386. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  387. @end example
  388. @item
  389. Cross fade from one input to another but without overlapping:
  390. @example
  391. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  392. @end example
  393. @end itemize
  394. @section acrossover
  395. Split audio stream into several bands.
  396. This filter splits audio stream into two or more frequency ranges.
  397. Summing all streams back will give flat output.
  398. The filter accepts the following options:
  399. @table @option
  400. @item split
  401. Set split frequencies. Those must be positive and increasing.
  402. @item order
  403. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  404. Default is @var{4th}.
  405. @end table
  406. @section acrusher
  407. Reduce audio bit resolution.
  408. This filter is bit crusher with enhanced functionality. A bit crusher
  409. is used to audibly reduce number of bits an audio signal is sampled
  410. with. This doesn't change the bit depth at all, it just produces the
  411. effect. Material reduced in bit depth sounds more harsh and "digital".
  412. This filter is able to even round to continuous values instead of discrete
  413. bit depths.
  414. Additionally it has a D/C offset which results in different crushing of
  415. the lower and the upper half of the signal.
  416. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  417. Another feature of this filter is the logarithmic mode.
  418. This setting switches from linear distances between bits to logarithmic ones.
  419. The result is a much more "natural" sounding crusher which doesn't gate low
  420. signals for example. The human ear has a logarithmic perception,
  421. so this kind of crushing is much more pleasant.
  422. Logarithmic crushing is also able to get anti-aliased.
  423. The filter accepts the following options:
  424. @table @option
  425. @item level_in
  426. Set level in.
  427. @item level_out
  428. Set level out.
  429. @item bits
  430. Set bit reduction.
  431. @item mix
  432. Set mixing amount.
  433. @item mode
  434. Can be linear: @code{lin} or logarithmic: @code{log}.
  435. @item dc
  436. Set DC.
  437. @item aa
  438. Set anti-aliasing.
  439. @item samples
  440. Set sample reduction.
  441. @item lfo
  442. Enable LFO. By default disabled.
  443. @item lforange
  444. Set LFO range.
  445. @item lforate
  446. Set LFO rate.
  447. @end table
  448. @section acue
  449. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  450. filter.
  451. @section adeclick
  452. Remove impulsive noise from input audio.
  453. Samples detected as impulsive noise are replaced by interpolated samples using
  454. autoregressive modelling.
  455. @table @option
  456. @item w
  457. Set window size, in milliseconds. Allowed range is from @code{10} to
  458. @code{100}. Default value is @code{55} milliseconds.
  459. This sets size of window which will be processed at once.
  460. @item o
  461. Set window overlap, in percentage of window size. Allowed range is from
  462. @code{50} to @code{95}. Default value is @code{75} percent.
  463. Setting this to a very high value increases impulsive noise removal but makes
  464. whole process much slower.
  465. @item a
  466. Set autoregression order, in percentage of window size. Allowed range is from
  467. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  468. controls quality of interpolated samples using neighbour good samples.
  469. @item t
  470. Set threshold value. Allowed range is from @code{1} to @code{100}.
  471. Default value is @code{2}.
  472. This controls the strength of impulsive noise which is going to be removed.
  473. The lower value, the more samples will be detected as impulsive noise.
  474. @item b
  475. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  476. @code{10}. Default value is @code{2}.
  477. If any two samples detected as noise are spaced less than this value then any
  478. sample between those two samples will be also detected as noise.
  479. @item m
  480. Set overlap method.
  481. It accepts the following values:
  482. @table @option
  483. @item a
  484. Select overlap-add method. Even not interpolated samples are slightly
  485. changed with this method.
  486. @item s
  487. Select overlap-save method. Not interpolated samples remain unchanged.
  488. @end table
  489. Default value is @code{a}.
  490. @end table
  491. @section adeclip
  492. Remove clipped samples from input audio.
  493. Samples detected as clipped are replaced by interpolated samples using
  494. autoregressive modelling.
  495. @table @option
  496. @item w
  497. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  498. Default value is @code{55} milliseconds.
  499. This sets size of window which will be processed at once.
  500. @item o
  501. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  502. to @code{95}. Default value is @code{75} percent.
  503. @item a
  504. Set autoregression order, in percentage of window size. Allowed range is from
  505. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  506. quality of interpolated samples using neighbour good samples.
  507. @item t
  508. Set threshold value. Allowed range is from @code{1} to @code{100}.
  509. Default value is @code{10}. Higher values make clip detection less aggressive.
  510. @item n
  511. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  512. Default value is @code{1000}. Higher values make clip detection less aggressive.
  513. @item m
  514. Set overlap method.
  515. It accepts the following values:
  516. @table @option
  517. @item a
  518. Select overlap-add method. Even not interpolated samples are slightly changed
  519. with this method.
  520. @item s
  521. Select overlap-save method. Not interpolated samples remain unchanged.
  522. @end table
  523. Default value is @code{a}.
  524. @end table
  525. @section adelay
  526. Delay one or more audio channels.
  527. Samples in delayed channel are filled with silence.
  528. The filter accepts the following option:
  529. @table @option
  530. @item delays
  531. Set list of delays in milliseconds for each channel separated by '|'.
  532. Unused delays will be silently ignored. If number of given delays is
  533. smaller than number of channels all remaining channels will not be delayed.
  534. If you want to delay exact number of samples, append 'S' to number.
  535. If you want instead to delay in seconds, append 's' to number.
  536. @end table
  537. @subsection Examples
  538. @itemize
  539. @item
  540. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  541. the second channel (and any other channels that may be present) unchanged.
  542. @example
  543. adelay=1500|0|500
  544. @end example
  545. @item
  546. Delay second channel by 500 samples, the third channel by 700 samples and leave
  547. the first channel (and any other channels that may be present) unchanged.
  548. @example
  549. adelay=0|500S|700S
  550. @end example
  551. @end itemize
  552. @section aderivative, aintegral
  553. Compute derivative/integral of audio stream.
  554. Applying both filters one after another produces original audio.
  555. @section aecho
  556. Apply echoing to the input audio.
  557. Echoes are reflected sound and can occur naturally amongst mountains
  558. (and sometimes large buildings) when talking or shouting; digital echo
  559. effects emulate this behaviour and are often used to help fill out the
  560. sound of a single instrument or vocal. The time difference between the
  561. original signal and the reflection is the @code{delay}, and the
  562. loudness of the reflected signal is the @code{decay}.
  563. Multiple echoes can have different delays and decays.
  564. A description of the accepted parameters follows.
  565. @table @option
  566. @item in_gain
  567. Set input gain of reflected signal. Default is @code{0.6}.
  568. @item out_gain
  569. Set output gain of reflected signal. Default is @code{0.3}.
  570. @item delays
  571. Set list of time intervals in milliseconds between original signal and reflections
  572. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  573. Default is @code{1000}.
  574. @item decays
  575. Set list of loudness of reflected signals separated by '|'.
  576. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  577. Default is @code{0.5}.
  578. @end table
  579. @subsection Examples
  580. @itemize
  581. @item
  582. Make it sound as if there are twice as many instruments as are actually playing:
  583. @example
  584. aecho=0.8:0.88:60:0.4
  585. @end example
  586. @item
  587. If delay is very short, then it sound like a (metallic) robot playing music:
  588. @example
  589. aecho=0.8:0.88:6:0.4
  590. @end example
  591. @item
  592. A longer delay will sound like an open air concert in the mountains:
  593. @example
  594. aecho=0.8:0.9:1000:0.3
  595. @end example
  596. @item
  597. Same as above but with one more mountain:
  598. @example
  599. aecho=0.8:0.9:1000|1800:0.3|0.25
  600. @end example
  601. @end itemize
  602. @section aemphasis
  603. Audio emphasis filter creates or restores material directly taken from LPs or
  604. emphased CDs with different filter curves. E.g. to store music on vinyl the
  605. signal has to be altered by a filter first to even out the disadvantages of
  606. this recording medium.
  607. Once the material is played back the inverse filter has to be applied to
  608. restore the distortion of the frequency response.
  609. The filter accepts the following options:
  610. @table @option
  611. @item level_in
  612. Set input gain.
  613. @item level_out
  614. Set output gain.
  615. @item mode
  616. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  617. use @code{production} mode. Default is @code{reproduction} mode.
  618. @item type
  619. Set filter type. Selects medium. Can be one of the following:
  620. @table @option
  621. @item col
  622. select Columbia.
  623. @item emi
  624. select EMI.
  625. @item bsi
  626. select BSI (78RPM).
  627. @item riaa
  628. select RIAA.
  629. @item cd
  630. select Compact Disc (CD).
  631. @item 50fm
  632. select 50µs (FM).
  633. @item 75fm
  634. select 75µs (FM).
  635. @item 50kf
  636. select 50µs (FM-KF).
  637. @item 75kf
  638. select 75µs (FM-KF).
  639. @end table
  640. @end table
  641. @section aeval
  642. Modify an audio signal according to the specified expressions.
  643. This filter accepts one or more expressions (one for each channel),
  644. which are evaluated and used to modify a corresponding audio signal.
  645. It accepts the following parameters:
  646. @table @option
  647. @item exprs
  648. Set the '|'-separated expressions list for each separate channel. If
  649. the number of input channels is greater than the number of
  650. expressions, the last specified expression is used for the remaining
  651. output channels.
  652. @item channel_layout, c
  653. Set output channel layout. If not specified, the channel layout is
  654. specified by the number of expressions. If set to @samp{same}, it will
  655. use by default the same input channel layout.
  656. @end table
  657. Each expression in @var{exprs} can contain the following constants and functions:
  658. @table @option
  659. @item ch
  660. channel number of the current expression
  661. @item n
  662. number of the evaluated sample, starting from 0
  663. @item s
  664. sample rate
  665. @item t
  666. time of the evaluated sample expressed in seconds
  667. @item nb_in_channels
  668. @item nb_out_channels
  669. input and output number of channels
  670. @item val(CH)
  671. the value of input channel with number @var{CH}
  672. @end table
  673. Note: this filter is slow. For faster processing you should use a
  674. dedicated filter.
  675. @subsection Examples
  676. @itemize
  677. @item
  678. Half volume:
  679. @example
  680. aeval=val(ch)/2:c=same
  681. @end example
  682. @item
  683. Invert phase of the second channel:
  684. @example
  685. aeval=val(0)|-val(1)
  686. @end example
  687. @end itemize
  688. @anchor{afade}
  689. @section afade
  690. Apply fade-in/out effect to input audio.
  691. A description of the accepted parameters follows.
  692. @table @option
  693. @item type, t
  694. Specify the effect type, can be either @code{in} for fade-in, or
  695. @code{out} for a fade-out effect. Default is @code{in}.
  696. @item start_sample, ss
  697. Specify the number of the start sample for starting to apply the fade
  698. effect. Default is 0.
  699. @item nb_samples, ns
  700. Specify the number of samples for which the fade effect has to last. At
  701. the end of the fade-in effect the output audio will have the same
  702. volume as the input audio, at the end of the fade-out transition
  703. the output audio will be silence. Default is 44100.
  704. @item start_time, st
  705. Specify the start time of the fade effect. Default is 0.
  706. The value must be specified as a time duration; see
  707. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  708. for the accepted syntax.
  709. If set this option is used instead of @var{start_sample}.
  710. @item duration, d
  711. Specify the duration of the fade effect. See
  712. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  713. for the accepted syntax.
  714. At the end of the fade-in effect the output audio will have the same
  715. volume as the input audio, at the end of the fade-out transition
  716. the output audio will be silence.
  717. By default the duration is determined by @var{nb_samples}.
  718. If set this option is used instead of @var{nb_samples}.
  719. @item curve
  720. Set curve for fade transition.
  721. It accepts the following values:
  722. @table @option
  723. @item tri
  724. select triangular, linear slope (default)
  725. @item qsin
  726. select quarter of sine wave
  727. @item hsin
  728. select half of sine wave
  729. @item esin
  730. select exponential sine wave
  731. @item log
  732. select logarithmic
  733. @item ipar
  734. select inverted parabola
  735. @item qua
  736. select quadratic
  737. @item cub
  738. select cubic
  739. @item squ
  740. select square root
  741. @item cbr
  742. select cubic root
  743. @item par
  744. select parabola
  745. @item exp
  746. select exponential
  747. @item iqsin
  748. select inverted quarter of sine wave
  749. @item ihsin
  750. select inverted half of sine wave
  751. @item dese
  752. select double-exponential seat
  753. @item desi
  754. select double-exponential sigmoid
  755. @item losi
  756. select logistic sigmoid
  757. @item nofade
  758. no fade applied
  759. @end table
  760. @end table
  761. @subsection Examples
  762. @itemize
  763. @item
  764. Fade in first 15 seconds of audio:
  765. @example
  766. afade=t=in:ss=0:d=15
  767. @end example
  768. @item
  769. Fade out last 25 seconds of a 900 seconds audio:
  770. @example
  771. afade=t=out:st=875:d=25
  772. @end example
  773. @end itemize
  774. @section afftdn
  775. Denoise audio samples with FFT.
  776. A description of the accepted parameters follows.
  777. @table @option
  778. @item nr
  779. Set the noise reduction in dB, allowed range is 0.01 to 97.
  780. Default value is 12 dB.
  781. @item nf
  782. Set the noise floor in dB, allowed range is -80 to -20.
  783. Default value is -50 dB.
  784. @item nt
  785. Set the noise type.
  786. It accepts the following values:
  787. @table @option
  788. @item w
  789. Select white noise.
  790. @item v
  791. Select vinyl noise.
  792. @item s
  793. Select shellac noise.
  794. @item c
  795. Select custom noise, defined in @code{bn} option.
  796. Default value is white noise.
  797. @end table
  798. @item bn
  799. Set custom band noise for every one of 15 bands.
  800. Bands are separated by ' ' or '|'.
  801. @item rf
  802. Set the residual floor in dB, allowed range is -80 to -20.
  803. Default value is -38 dB.
  804. @item tn
  805. Enable noise tracking. By default is disabled.
  806. With this enabled, noise floor is automatically adjusted.
  807. @item tr
  808. Enable residual tracking. By default is disabled.
  809. @item om
  810. Set the output mode.
  811. It accepts the following values:
  812. @table @option
  813. @item i
  814. Pass input unchanged.
  815. @item o
  816. Pass noise filtered out.
  817. @item n
  818. Pass only noise.
  819. Default value is @var{o}.
  820. @end table
  821. @end table
  822. @subsection Commands
  823. This filter supports the following commands:
  824. @table @option
  825. @item sample_noise, sn
  826. Start or stop measuring noise profile.
  827. Syntax for the command is : "start" or "stop" string.
  828. After measuring noise profile is stopped it will be
  829. automatically applied in filtering.
  830. @item noise_reduction, nr
  831. Change noise reduction. Argument is single float number.
  832. Syntax for the command is : "@var{noise_reduction}"
  833. @item noise_floor, nf
  834. Change noise floor. Argument is single float number.
  835. Syntax for the command is : "@var{noise_floor}"
  836. @item output_mode, om
  837. Change output mode operation.
  838. Syntax for the command is : "i", "o" or "n" string.
  839. @end table
  840. @section afftfilt
  841. Apply arbitrary expressions to samples in frequency domain.
  842. @table @option
  843. @item real
  844. Set frequency domain real expression for each separate channel separated
  845. by '|'. Default is "re".
  846. If the number of input channels is greater than the number of
  847. expressions, the last specified expression is used for the remaining
  848. output channels.
  849. @item imag
  850. Set frequency domain imaginary expression for each separate channel
  851. separated by '|'. Default is "im".
  852. Each expression in @var{real} and @var{imag} can contain the following
  853. constants and functions:
  854. @table @option
  855. @item sr
  856. sample rate
  857. @item b
  858. current frequency bin number
  859. @item nb
  860. number of available bins
  861. @item ch
  862. channel number of the current expression
  863. @item chs
  864. number of channels
  865. @item pts
  866. current frame pts
  867. @item re
  868. current real part of frequency bin of current channel
  869. @item im
  870. current imaginary part of frequency bin of current channel
  871. @item real(b, ch)
  872. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  873. @item imag(b, ch)
  874. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  875. @end table
  876. @item win_size
  877. Set window size.
  878. It accepts the following values:
  879. @table @samp
  880. @item w16
  881. @item w32
  882. @item w64
  883. @item w128
  884. @item w256
  885. @item w512
  886. @item w1024
  887. @item w2048
  888. @item w4096
  889. @item w8192
  890. @item w16384
  891. @item w32768
  892. @item w65536
  893. @end table
  894. Default is @code{w4096}
  895. @item win_func
  896. Set window function. Default is @code{hann}.
  897. @item overlap
  898. Set window overlap. If set to 1, the recommended overlap for selected
  899. window function will be picked. Default is @code{0.75}.
  900. @end table
  901. @subsection Examples
  902. @itemize
  903. @item
  904. Leave almost only low frequencies in audio:
  905. @example
  906. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  907. @end example
  908. @end itemize
  909. @anchor{afir}
  910. @section afir
  911. Apply an arbitrary Frequency Impulse Response filter.
  912. This filter is designed for applying long FIR filters,
  913. up to 60 seconds long.
  914. It can be used as component for digital crossover filters,
  915. room equalization, cross talk cancellation, wavefield synthesis,
  916. auralization, ambiophonics, ambisonics and spatialization.
  917. This filter uses second stream as FIR coefficients.
  918. If second stream holds single channel, it will be used
  919. for all input channels in first stream, otherwise
  920. number of channels in second stream must be same as
  921. number of channels in first stream.
  922. It accepts the following parameters:
  923. @table @option
  924. @item dry
  925. Set dry gain. This sets input gain.
  926. @item wet
  927. Set wet gain. This sets final output gain.
  928. @item length
  929. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  930. @item gtype
  931. Enable applying gain measured from power of IR.
  932. Set which approach to use for auto gain measurement.
  933. @table @option
  934. @item none
  935. Do not apply any gain.
  936. @item peak
  937. select peak gain, very conservative approach. This is default value.
  938. @item dc
  939. select DC gain, limited application.
  940. @item gn
  941. select gain to noise approach, this is most popular one.
  942. @end table
  943. @item irgain
  944. Set gain to be applied to IR coefficients before filtering.
  945. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  946. @item irfmt
  947. Set format of IR stream. Can be @code{mono} or @code{input}.
  948. Default is @code{input}.
  949. @item maxir
  950. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  951. Allowed range is 0.1 to 60 seconds.
  952. @item response
  953. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  954. By default it is disabled.
  955. @item channel
  956. Set for which IR channel to display frequency response. By default is first channel
  957. displayed. This option is used only when @var{response} is enabled.
  958. @item size
  959. Set video stream size. This option is used only when @var{response} is enabled.
  960. @item rate
  961. Set video stream frame rate. This option is used only when @var{response} is enabled.
  962. @item minp
  963. Set minimal partition size used for convolution. Default is @var{8192}.
  964. Allowed range is from @var{8} to @var{32768}.
  965. Lower values decreases latency at cost of higher CPU usage.
  966. @item maxp
  967. Set maximal partition size used for convolution. Default is @var{8192}.
  968. Allowed range is from @var{8} to @var{32768}.
  969. Lower values may increase CPU usage.
  970. @end table
  971. @subsection Examples
  972. @itemize
  973. @item
  974. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  975. @example
  976. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  977. @end example
  978. @end itemize
  979. @anchor{aformat}
  980. @section aformat
  981. Set output format constraints for the input audio. The framework will
  982. negotiate the most appropriate format to minimize conversions.
  983. It accepts the following parameters:
  984. @table @option
  985. @item sample_fmts
  986. A '|'-separated list of requested sample formats.
  987. @item sample_rates
  988. A '|'-separated list of requested sample rates.
  989. @item channel_layouts
  990. A '|'-separated list of requested channel layouts.
  991. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  992. for the required syntax.
  993. @end table
  994. If a parameter is omitted, all values are allowed.
  995. Force the output to either unsigned 8-bit or signed 16-bit stereo
  996. @example
  997. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  998. @end example
  999. @section agate
  1000. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1001. processing reduces disturbing noise between useful signals.
  1002. Gating is done by detecting the volume below a chosen level @var{threshold}
  1003. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1004. floor is set via @var{range}. Because an exact manipulation of the signal
  1005. would cause distortion of the waveform the reduction can be levelled over
  1006. time. This is done by setting @var{attack} and @var{release}.
  1007. @var{attack} determines how long the signal has to fall below the threshold
  1008. before any reduction will occur and @var{release} sets the time the signal
  1009. has to rise above the threshold to reduce the reduction again.
  1010. Shorter signals than the chosen attack time will be left untouched.
  1011. @table @option
  1012. @item level_in
  1013. Set input level before filtering.
  1014. Default is 1. Allowed range is from 0.015625 to 64.
  1015. @item mode
  1016. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1017. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1018. will be amplified, expanding dynamic range in upward direction.
  1019. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1020. @item range
  1021. Set the level of gain reduction when the signal is below the threshold.
  1022. Default is 0.06125. Allowed range is from 0 to 1.
  1023. Setting this to 0 disables reduction and then filter behaves like expander.
  1024. @item threshold
  1025. If a signal rises above this level the gain reduction is released.
  1026. Default is 0.125. Allowed range is from 0 to 1.
  1027. @item ratio
  1028. Set a ratio by which the signal is reduced.
  1029. Default is 2. Allowed range is from 1 to 9000.
  1030. @item attack
  1031. Amount of milliseconds the signal has to rise above the threshold before gain
  1032. reduction stops.
  1033. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1034. @item release
  1035. Amount of milliseconds the signal has to fall below the threshold before the
  1036. reduction is increased again. Default is 250 milliseconds.
  1037. Allowed range is from 0.01 to 9000.
  1038. @item makeup
  1039. Set amount of amplification of signal after processing.
  1040. Default is 1. Allowed range is from 1 to 64.
  1041. @item knee
  1042. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1043. Default is 2.828427125. Allowed range is from 1 to 8.
  1044. @item detection
  1045. Choose if exact signal should be taken for detection or an RMS like one.
  1046. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1047. @item link
  1048. Choose if the average level between all channels or the louder channel affects
  1049. the reduction.
  1050. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1051. @end table
  1052. @section aiir
  1053. Apply an arbitrary Infinite Impulse Response filter.
  1054. It accepts the following parameters:
  1055. @table @option
  1056. @item z
  1057. Set numerator/zeros coefficients.
  1058. @item p
  1059. Set denominator/poles coefficients.
  1060. @item k
  1061. Set channels gains.
  1062. @item dry_gain
  1063. Set input gain.
  1064. @item wet_gain
  1065. Set output gain.
  1066. @item f
  1067. Set coefficients format.
  1068. @table @samp
  1069. @item tf
  1070. transfer function
  1071. @item zp
  1072. Z-plane zeros/poles, cartesian (default)
  1073. @item pr
  1074. Z-plane zeros/poles, polar radians
  1075. @item pd
  1076. Z-plane zeros/poles, polar degrees
  1077. @end table
  1078. @item r
  1079. Set kind of processing.
  1080. Can be @code{d} - direct or @code{s} - serial cascading. Default is @code{s}.
  1081. @item e
  1082. Set filtering precision.
  1083. @table @samp
  1084. @item dbl
  1085. double-precision floating-point (default)
  1086. @item flt
  1087. single-precision floating-point
  1088. @item i32
  1089. 32-bit integers
  1090. @item i16
  1091. 16-bit integers
  1092. @end table
  1093. @item response
  1094. Show IR frequency response, magnitude and phase in additional video stream.
  1095. By default it is disabled.
  1096. @item channel
  1097. Set for which IR channel to display frequency response. By default is first channel
  1098. displayed. This option is used only when @var{response} is enabled.
  1099. @item size
  1100. Set video stream size. This option is used only when @var{response} is enabled.
  1101. @end table
  1102. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1103. order.
  1104. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1105. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1106. imaginary unit.
  1107. Different coefficients and gains can be provided for every channel, in such case
  1108. use '|' to separate coefficients or gains. Last provided coefficients will be
  1109. used for all remaining channels.
  1110. @subsection Examples
  1111. @itemize
  1112. @item
  1113. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1114. @example
  1115. aiir=k=1:z=7.957584807809675810E-1 -2.575128568908332300 3.674839853930788710 -2.57512875289799137 7.957586296317130880E-1:p=1 -2.86950072432325953 3.63022088054647218 -2.28075678147272232 6.361362326477423500E-1:f=tf:r=d
  1116. @end example
  1117. @item
  1118. Same as above but in @code{zp} format:
  1119. @example
  1120. aiir=k=0.79575848078096756:z=0.80918701+0.58773007i 0.80918701-0.58773007i 0.80884700+0.58784055i 0.80884700-0.58784055i:p=0.63892345+0.59951235i 0.63892345-0.59951235i 0.79582691+0.44198673i 0.79582691-0.44198673i:f=zp:r=s
  1121. @end example
  1122. @end itemize
  1123. @section alimiter
  1124. The limiter prevents an input signal from rising over a desired threshold.
  1125. This limiter uses lookahead technology to prevent your signal from distorting.
  1126. It means that there is a small delay after the signal is processed. Keep in mind
  1127. that the delay it produces is the attack time you set.
  1128. The filter accepts the following options:
  1129. @table @option
  1130. @item level_in
  1131. Set input gain. Default is 1.
  1132. @item level_out
  1133. Set output gain. Default is 1.
  1134. @item limit
  1135. Don't let signals above this level pass the limiter. Default is 1.
  1136. @item attack
  1137. The limiter will reach its attenuation level in this amount of time in
  1138. milliseconds. Default is 5 milliseconds.
  1139. @item release
  1140. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1141. Default is 50 milliseconds.
  1142. @item asc
  1143. When gain reduction is always needed ASC takes care of releasing to an
  1144. average reduction level rather than reaching a reduction of 0 in the release
  1145. time.
  1146. @item asc_level
  1147. Select how much the release time is affected by ASC, 0 means nearly no changes
  1148. in release time while 1 produces higher release times.
  1149. @item level
  1150. Auto level output signal. Default is enabled.
  1151. This normalizes audio back to 0dB if enabled.
  1152. @end table
  1153. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1154. with @ref{aresample} before applying this filter.
  1155. @section allpass
  1156. Apply a two-pole all-pass filter with central frequency (in Hz)
  1157. @var{frequency}, and filter-width @var{width}.
  1158. An all-pass filter changes the audio's frequency to phase relationship
  1159. without changing its frequency to amplitude relationship.
  1160. The filter accepts the following options:
  1161. @table @option
  1162. @item frequency, f
  1163. Set frequency in Hz.
  1164. @item width_type, t
  1165. Set method to specify band-width of filter.
  1166. @table @option
  1167. @item h
  1168. Hz
  1169. @item q
  1170. Q-Factor
  1171. @item o
  1172. octave
  1173. @item s
  1174. slope
  1175. @item k
  1176. kHz
  1177. @end table
  1178. @item width, w
  1179. Specify the band-width of a filter in width_type units.
  1180. @item channels, c
  1181. Specify which channels to filter, by default all available are filtered.
  1182. @end table
  1183. @subsection Commands
  1184. This filter supports the following commands:
  1185. @table @option
  1186. @item frequency, f
  1187. Change allpass frequency.
  1188. Syntax for the command is : "@var{frequency}"
  1189. @item width_type, t
  1190. Change allpass width_type.
  1191. Syntax for the command is : "@var{width_type}"
  1192. @item width, w
  1193. Change allpass width.
  1194. Syntax for the command is : "@var{width}"
  1195. @end table
  1196. @section aloop
  1197. Loop audio samples.
  1198. The filter accepts the following options:
  1199. @table @option
  1200. @item loop
  1201. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1202. Default is 0.
  1203. @item size
  1204. Set maximal number of samples. Default is 0.
  1205. @item start
  1206. Set first sample of loop. Default is 0.
  1207. @end table
  1208. @anchor{amerge}
  1209. @section amerge
  1210. Merge two or more audio streams into a single multi-channel stream.
  1211. The filter accepts the following options:
  1212. @table @option
  1213. @item inputs
  1214. Set the number of inputs. Default is 2.
  1215. @end table
  1216. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1217. the channel layout of the output will be set accordingly and the channels
  1218. will be reordered as necessary. If the channel layouts of the inputs are not
  1219. disjoint, the output will have all the channels of the first input then all
  1220. the channels of the second input, in that order, and the channel layout of
  1221. the output will be the default value corresponding to the total number of
  1222. channels.
  1223. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1224. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1225. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1226. first input, b1 is the first channel of the second input).
  1227. On the other hand, if both input are in stereo, the output channels will be
  1228. in the default order: a1, a2, b1, b2, and the channel layout will be
  1229. arbitrarily set to 4.0, which may or may not be the expected value.
  1230. All inputs must have the same sample rate, and format.
  1231. If inputs do not have the same duration, the output will stop with the
  1232. shortest.
  1233. @subsection Examples
  1234. @itemize
  1235. @item
  1236. Merge two mono files into a stereo stream:
  1237. @example
  1238. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1239. @end example
  1240. @item
  1241. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1242. @example
  1243. ffmpeg -i input.mkv -filter_complex "[0:1][0:2][0:3][0:4][0:5][0:6] amerge=inputs=6" -c:a pcm_s16le output.mkv
  1244. @end example
  1245. @end itemize
  1246. @section amix
  1247. Mixes multiple audio inputs into a single output.
  1248. Note that this filter only supports float samples (the @var{amerge}
  1249. and @var{pan} audio filters support many formats). If the @var{amix}
  1250. input has integer samples then @ref{aresample} will be automatically
  1251. inserted to perform the conversion to float samples.
  1252. For example
  1253. @example
  1254. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1255. @end example
  1256. will mix 3 input audio streams to a single output with the same duration as the
  1257. first input and a dropout transition time of 3 seconds.
  1258. It accepts the following parameters:
  1259. @table @option
  1260. @item inputs
  1261. The number of inputs. If unspecified, it defaults to 2.
  1262. @item duration
  1263. How to determine the end-of-stream.
  1264. @table @option
  1265. @item longest
  1266. The duration of the longest input. (default)
  1267. @item shortest
  1268. The duration of the shortest input.
  1269. @item first
  1270. The duration of the first input.
  1271. @end table
  1272. @item dropout_transition
  1273. The transition time, in seconds, for volume renormalization when an input
  1274. stream ends. The default value is 2 seconds.
  1275. @item weights
  1276. Specify weight of each input audio stream as sequence.
  1277. Each weight is separated by space. By default all inputs have same weight.
  1278. @end table
  1279. @section amultiply
  1280. Multiply first audio stream with second audio stream and store result
  1281. in output audio stream. Multiplication is done by multiplying each
  1282. sample from first stream with sample at same position from second stream.
  1283. With this element-wise multiplication one can create amplitude fades and
  1284. amplitude modulations.
  1285. @section anequalizer
  1286. High-order parametric multiband equalizer for each channel.
  1287. It accepts the following parameters:
  1288. @table @option
  1289. @item params
  1290. This option string is in format:
  1291. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1292. Each equalizer band is separated by '|'.
  1293. @table @option
  1294. @item chn
  1295. Set channel number to which equalization will be applied.
  1296. If input doesn't have that channel the entry is ignored.
  1297. @item f
  1298. Set central frequency for band.
  1299. If input doesn't have that frequency the entry is ignored.
  1300. @item w
  1301. Set band width in hertz.
  1302. @item g
  1303. Set band gain in dB.
  1304. @item t
  1305. Set filter type for band, optional, can be:
  1306. @table @samp
  1307. @item 0
  1308. Butterworth, this is default.
  1309. @item 1
  1310. Chebyshev type 1.
  1311. @item 2
  1312. Chebyshev type 2.
  1313. @end table
  1314. @end table
  1315. @item curves
  1316. With this option activated frequency response of anequalizer is displayed
  1317. in video stream.
  1318. @item size
  1319. Set video stream size. Only useful if curves option is activated.
  1320. @item mgain
  1321. Set max gain that will be displayed. Only useful if curves option is activated.
  1322. Setting this to a reasonable value makes it possible to display gain which is derived from
  1323. neighbour bands which are too close to each other and thus produce higher gain
  1324. when both are activated.
  1325. @item fscale
  1326. Set frequency scale used to draw frequency response in video output.
  1327. Can be linear or logarithmic. Default is logarithmic.
  1328. @item colors
  1329. Set color for each channel curve which is going to be displayed in video stream.
  1330. This is list of color names separated by space or by '|'.
  1331. Unrecognised or missing colors will be replaced by white color.
  1332. @end table
  1333. @subsection Examples
  1334. @itemize
  1335. @item
  1336. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1337. for first 2 channels using Chebyshev type 1 filter:
  1338. @example
  1339. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1340. @end example
  1341. @end itemize
  1342. @subsection Commands
  1343. This filter supports the following commands:
  1344. @table @option
  1345. @item change
  1346. Alter existing filter parameters.
  1347. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1348. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1349. error is returned.
  1350. @var{freq} set new frequency parameter.
  1351. @var{width} set new width parameter in herz.
  1352. @var{gain} set new gain parameter in dB.
  1353. Full filter invocation with asendcmd may look like this:
  1354. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1355. @end table
  1356. @section anlmdn
  1357. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1358. Each sample is adjusted by looking for other samples with similar contexts. This
  1359. context similarity is defined by comparing their surrounding patches of size
  1360. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1361. The filter accepts the following options.
  1362. @table @option
  1363. @item s
  1364. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1365. @item p
  1366. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1367. Default value is 2 milliseconds.
  1368. @item r
  1369. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1370. Default value is 6 milliseconds.
  1371. @item o
  1372. Set the output mode.
  1373. It accepts the following values:
  1374. @table @option
  1375. @item i
  1376. Pass input unchanged.
  1377. @item o
  1378. Pass noise filtered out.
  1379. @item n
  1380. Pass only noise.
  1381. Default value is @var{o}.
  1382. @end table
  1383. @end table
  1384. @section anull
  1385. Pass the audio source unchanged to the output.
  1386. @section apad
  1387. Pad the end of an audio stream with silence.
  1388. This can be used together with @command{ffmpeg} @option{-shortest} to
  1389. extend audio streams to the same length as the video stream.
  1390. A description of the accepted options follows.
  1391. @table @option
  1392. @item packet_size
  1393. Set silence packet size. Default value is 4096.
  1394. @item pad_len
  1395. Set the number of samples of silence to add to the end. After the
  1396. value is reached, the stream is terminated. This option is mutually
  1397. exclusive with @option{whole_len}.
  1398. @item whole_len
  1399. Set the minimum total number of samples in the output audio stream. If
  1400. the value is longer than the input audio length, silence is added to
  1401. the end, until the value is reached. This option is mutually exclusive
  1402. with @option{pad_len}.
  1403. @item pad_dur
  1404. Specify the duration of samples of silence to add. See
  1405. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1406. for the accepted syntax. Used only if set to non-zero value.
  1407. @item whole_dur
  1408. Specify the minimum total duration in the output audio stream. See
  1409. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1410. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1411. the input audio length, silence is added to the end, until the value is reached.
  1412. This option is mutually exclusive with @option{pad_dur}
  1413. @end table
  1414. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1415. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1416. the input stream indefinitely.
  1417. @subsection Examples
  1418. @itemize
  1419. @item
  1420. Add 1024 samples of silence to the end of the input:
  1421. @example
  1422. apad=pad_len=1024
  1423. @end example
  1424. @item
  1425. Make sure the audio output will contain at least 10000 samples, pad
  1426. the input with silence if required:
  1427. @example
  1428. apad=whole_len=10000
  1429. @end example
  1430. @item
  1431. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1432. video stream will always result the shortest and will be converted
  1433. until the end in the output file when using the @option{shortest}
  1434. option:
  1435. @example
  1436. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1437. @end example
  1438. @end itemize
  1439. @section aphaser
  1440. Add a phasing effect to the input audio.
  1441. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1442. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1443. A description of the accepted parameters follows.
  1444. @table @option
  1445. @item in_gain
  1446. Set input gain. Default is 0.4.
  1447. @item out_gain
  1448. Set output gain. Default is 0.74
  1449. @item delay
  1450. Set delay in milliseconds. Default is 3.0.
  1451. @item decay
  1452. Set decay. Default is 0.4.
  1453. @item speed
  1454. Set modulation speed in Hz. Default is 0.5.
  1455. @item type
  1456. Set modulation type. Default is triangular.
  1457. It accepts the following values:
  1458. @table @samp
  1459. @item triangular, t
  1460. @item sinusoidal, s
  1461. @end table
  1462. @end table
  1463. @section apulsator
  1464. Audio pulsator is something between an autopanner and a tremolo.
  1465. But it can produce funny stereo effects as well. Pulsator changes the volume
  1466. of the left and right channel based on a LFO (low frequency oscillator) with
  1467. different waveforms and shifted phases.
  1468. This filter have the ability to define an offset between left and right
  1469. channel. An offset of 0 means that both LFO shapes match each other.
  1470. The left and right channel are altered equally - a conventional tremolo.
  1471. An offset of 50% means that the shape of the right channel is exactly shifted
  1472. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1473. an autopanner. At 1 both curves match again. Every setting in between moves the
  1474. phase shift gapless between all stages and produces some "bypassing" sounds with
  1475. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1476. the 0.5) the faster the signal passes from the left to the right speaker.
  1477. The filter accepts the following options:
  1478. @table @option
  1479. @item level_in
  1480. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1481. @item level_out
  1482. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1483. @item mode
  1484. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1485. sawup or sawdown. Default is sine.
  1486. @item amount
  1487. Set modulation. Define how much of original signal is affected by the LFO.
  1488. @item offset_l
  1489. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1490. @item offset_r
  1491. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1492. @item width
  1493. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1494. @item timing
  1495. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1496. @item bpm
  1497. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1498. is set to bpm.
  1499. @item ms
  1500. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1501. is set to ms.
  1502. @item hz
  1503. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1504. if timing is set to hz.
  1505. @end table
  1506. @anchor{aresample}
  1507. @section aresample
  1508. Resample the input audio to the specified parameters, using the
  1509. libswresample library. If none are specified then the filter will
  1510. automatically convert between its input and output.
  1511. This filter is also able to stretch/squeeze the audio data to make it match
  1512. the timestamps or to inject silence / cut out audio to make it match the
  1513. timestamps, do a combination of both or do neither.
  1514. The filter accepts the syntax
  1515. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1516. expresses a sample rate and @var{resampler_options} is a list of
  1517. @var{key}=@var{value} pairs, separated by ":". See the
  1518. @ref{Resampler Options,,"Resampler Options" section in the
  1519. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1520. for the complete list of supported options.
  1521. @subsection Examples
  1522. @itemize
  1523. @item
  1524. Resample the input audio to 44100Hz:
  1525. @example
  1526. aresample=44100
  1527. @end example
  1528. @item
  1529. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1530. samples per second compensation:
  1531. @example
  1532. aresample=async=1000
  1533. @end example
  1534. @end itemize
  1535. @section areverse
  1536. Reverse an audio clip.
  1537. Warning: This filter requires memory to buffer the entire clip, so trimming
  1538. is suggested.
  1539. @subsection Examples
  1540. @itemize
  1541. @item
  1542. Take the first 5 seconds of a clip, and reverse it.
  1543. @example
  1544. atrim=end=5,areverse
  1545. @end example
  1546. @end itemize
  1547. @section asetnsamples
  1548. Set the number of samples per each output audio frame.
  1549. The last output packet may contain a different number of samples, as
  1550. the filter will flush all the remaining samples when the input audio
  1551. signals its end.
  1552. The filter accepts the following options:
  1553. @table @option
  1554. @item nb_out_samples, n
  1555. Set the number of frames per each output audio frame. The number is
  1556. intended as the number of samples @emph{per each channel}.
  1557. Default value is 1024.
  1558. @item pad, p
  1559. If set to 1, the filter will pad the last audio frame with zeroes, so
  1560. that the last frame will contain the same number of samples as the
  1561. previous ones. Default value is 1.
  1562. @end table
  1563. For example, to set the number of per-frame samples to 1234 and
  1564. disable padding for the last frame, use:
  1565. @example
  1566. asetnsamples=n=1234:p=0
  1567. @end example
  1568. @section asetrate
  1569. Set the sample rate without altering the PCM data.
  1570. This will result in a change of speed and pitch.
  1571. The filter accepts the following options:
  1572. @table @option
  1573. @item sample_rate, r
  1574. Set the output sample rate. Default is 44100 Hz.
  1575. @end table
  1576. @section ashowinfo
  1577. Show a line containing various information for each input audio frame.
  1578. The input audio is not modified.
  1579. The shown line contains a sequence of key/value pairs of the form
  1580. @var{key}:@var{value}.
  1581. The following values are shown in the output:
  1582. @table @option
  1583. @item n
  1584. The (sequential) number of the input frame, starting from 0.
  1585. @item pts
  1586. The presentation timestamp of the input frame, in time base units; the time base
  1587. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1588. @item pts_time
  1589. The presentation timestamp of the input frame in seconds.
  1590. @item pos
  1591. position of the frame in the input stream, -1 if this information in
  1592. unavailable and/or meaningless (for example in case of synthetic audio)
  1593. @item fmt
  1594. The sample format.
  1595. @item chlayout
  1596. The channel layout.
  1597. @item rate
  1598. The sample rate for the audio frame.
  1599. @item nb_samples
  1600. The number of samples (per channel) in the frame.
  1601. @item checksum
  1602. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1603. audio, the data is treated as if all the planes were concatenated.
  1604. @item plane_checksums
  1605. A list of Adler-32 checksums for each data plane.
  1606. @end table
  1607. @anchor{astats}
  1608. @section astats
  1609. Display time domain statistical information about the audio channels.
  1610. Statistics are calculated and displayed for each audio channel and,
  1611. where applicable, an overall figure is also given.
  1612. It accepts the following option:
  1613. @table @option
  1614. @item length
  1615. Short window length in seconds, used for peak and trough RMS measurement.
  1616. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1617. @item metadata
  1618. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1619. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1620. disabled.
  1621. Available keys for each channel are:
  1622. DC_offset
  1623. Min_level
  1624. Max_level
  1625. Min_difference
  1626. Max_difference
  1627. Mean_difference
  1628. RMS_difference
  1629. Peak_level
  1630. RMS_peak
  1631. RMS_trough
  1632. Crest_factor
  1633. Flat_factor
  1634. Peak_count
  1635. Bit_depth
  1636. Dynamic_range
  1637. Zero_crossings
  1638. Zero_crossings_rate
  1639. and for Overall:
  1640. DC_offset
  1641. Min_level
  1642. Max_level
  1643. Min_difference
  1644. Max_difference
  1645. Mean_difference
  1646. RMS_difference
  1647. Peak_level
  1648. RMS_level
  1649. RMS_peak
  1650. RMS_trough
  1651. Flat_factor
  1652. Peak_count
  1653. Bit_depth
  1654. Number_of_samples
  1655. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1656. this @code{lavfi.astats.Overall.Peak_count}.
  1657. For description what each key means read below.
  1658. @item reset
  1659. Set number of frame after which stats are going to be recalculated.
  1660. Default is disabled.
  1661. @item measure_perchannel
  1662. Select the entries which need to be measured per channel. The metadata keys can
  1663. be used as flags, default is @option{all} which measures everything.
  1664. @option{none} disables all per channel measurement.
  1665. @item measure_overall
  1666. Select the entries which need to be measured overall. The metadata keys can
  1667. be used as flags, default is @option{all} which measures everything.
  1668. @option{none} disables all overall measurement.
  1669. @end table
  1670. A description of each shown parameter follows:
  1671. @table @option
  1672. @item DC offset
  1673. Mean amplitude displacement from zero.
  1674. @item Min level
  1675. Minimal sample level.
  1676. @item Max level
  1677. Maximal sample level.
  1678. @item Min difference
  1679. Minimal difference between two consecutive samples.
  1680. @item Max difference
  1681. Maximal difference between two consecutive samples.
  1682. @item Mean difference
  1683. Mean difference between two consecutive samples.
  1684. The average of each difference between two consecutive samples.
  1685. @item RMS difference
  1686. Root Mean Square difference between two consecutive samples.
  1687. @item Peak level dB
  1688. @item RMS level dB
  1689. Standard peak and RMS level measured in dBFS.
  1690. @item RMS peak dB
  1691. @item RMS trough dB
  1692. Peak and trough values for RMS level measured over a short window.
  1693. @item Crest factor
  1694. Standard ratio of peak to RMS level (note: not in dB).
  1695. @item Flat factor
  1696. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1697. (i.e. either @var{Min level} or @var{Max level}).
  1698. @item Peak count
  1699. Number of occasions (not the number of samples) that the signal attained either
  1700. @var{Min level} or @var{Max level}.
  1701. @item Bit depth
  1702. Overall bit depth of audio. Number of bits used for each sample.
  1703. @item Dynamic range
  1704. Measured dynamic range of audio in dB.
  1705. @item Zero crossings
  1706. Number of points where the waveform crosses the zero level axis.
  1707. @item Zero crossings rate
  1708. Rate of Zero crossings and number of audio samples.
  1709. @end table
  1710. @section atempo
  1711. Adjust audio tempo.
  1712. The filter accepts exactly one parameter, the audio tempo. If not
  1713. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1714. be in the [0.5, 100.0] range.
  1715. Note that tempo greater than 2 will skip some samples rather than
  1716. blend them in. If for any reason this is a concern it is always
  1717. possible to daisy-chain several instances of atempo to achieve the
  1718. desired product tempo.
  1719. @subsection Examples
  1720. @itemize
  1721. @item
  1722. Slow down audio to 80% tempo:
  1723. @example
  1724. atempo=0.8
  1725. @end example
  1726. @item
  1727. To speed up audio to 300% tempo:
  1728. @example
  1729. atempo=3
  1730. @end example
  1731. @item
  1732. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1733. @example
  1734. atempo=sqrt(3),atempo=sqrt(3)
  1735. @end example
  1736. @end itemize
  1737. @section atrim
  1738. Trim the input so that the output contains one continuous subpart of the input.
  1739. It accepts the following parameters:
  1740. @table @option
  1741. @item start
  1742. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1743. sample with the timestamp @var{start} will be the first sample in the output.
  1744. @item end
  1745. Specify time of the first audio sample that will be dropped, i.e. the
  1746. audio sample immediately preceding the one with the timestamp @var{end} will be
  1747. the last sample in the output.
  1748. @item start_pts
  1749. Same as @var{start}, except this option sets the start timestamp in samples
  1750. instead of seconds.
  1751. @item end_pts
  1752. Same as @var{end}, except this option sets the end timestamp in samples instead
  1753. of seconds.
  1754. @item duration
  1755. The maximum duration of the output in seconds.
  1756. @item start_sample
  1757. The number of the first sample that should be output.
  1758. @item end_sample
  1759. The number of the first sample that should be dropped.
  1760. @end table
  1761. @option{start}, @option{end}, and @option{duration} are expressed as time
  1762. duration specifications; see
  1763. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1764. Note that the first two sets of the start/end options and the @option{duration}
  1765. option look at the frame timestamp, while the _sample options simply count the
  1766. samples that pass through the filter. So start/end_pts and start/end_sample will
  1767. give different results when the timestamps are wrong, inexact or do not start at
  1768. zero. Also note that this filter does not modify the timestamps. If you wish
  1769. to have the output timestamps start at zero, insert the asetpts filter after the
  1770. atrim filter.
  1771. If multiple start or end options are set, this filter tries to be greedy and
  1772. keep all samples that match at least one of the specified constraints. To keep
  1773. only the part that matches all the constraints at once, chain multiple atrim
  1774. filters.
  1775. The defaults are such that all the input is kept. So it is possible to set e.g.
  1776. just the end values to keep everything before the specified time.
  1777. Examples:
  1778. @itemize
  1779. @item
  1780. Drop everything except the second minute of input:
  1781. @example
  1782. ffmpeg -i INPUT -af atrim=60:120
  1783. @end example
  1784. @item
  1785. Keep only the first 1000 samples:
  1786. @example
  1787. ffmpeg -i INPUT -af atrim=end_sample=1000
  1788. @end example
  1789. @end itemize
  1790. @section bandpass
  1791. Apply a two-pole Butterworth band-pass filter with central
  1792. frequency @var{frequency}, and (3dB-point) band-width width.
  1793. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1794. instead of the default: constant 0dB peak gain.
  1795. The filter roll off at 6dB per octave (20dB per decade).
  1796. The filter accepts the following options:
  1797. @table @option
  1798. @item frequency, f
  1799. Set the filter's central frequency. Default is @code{3000}.
  1800. @item csg
  1801. Constant skirt gain if set to 1. Defaults to 0.
  1802. @item width_type, t
  1803. Set method to specify band-width of filter.
  1804. @table @option
  1805. @item h
  1806. Hz
  1807. @item q
  1808. Q-Factor
  1809. @item o
  1810. octave
  1811. @item s
  1812. slope
  1813. @item k
  1814. kHz
  1815. @end table
  1816. @item width, w
  1817. Specify the band-width of a filter in width_type units.
  1818. @item channels, c
  1819. Specify which channels to filter, by default all available are filtered.
  1820. @end table
  1821. @subsection Commands
  1822. This filter supports the following commands:
  1823. @table @option
  1824. @item frequency, f
  1825. Change bandpass frequency.
  1826. Syntax for the command is : "@var{frequency}"
  1827. @item width_type, t
  1828. Change bandpass width_type.
  1829. Syntax for the command is : "@var{width_type}"
  1830. @item width, w
  1831. Change bandpass width.
  1832. Syntax for the command is : "@var{width}"
  1833. @end table
  1834. @section bandreject
  1835. Apply a two-pole Butterworth band-reject filter with central
  1836. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1837. The filter roll off at 6dB per octave (20dB per decade).
  1838. The filter accepts the following options:
  1839. @table @option
  1840. @item frequency, f
  1841. Set the filter's central frequency. Default is @code{3000}.
  1842. @item width_type, t
  1843. Set method to specify band-width of filter.
  1844. @table @option
  1845. @item h
  1846. Hz
  1847. @item q
  1848. Q-Factor
  1849. @item o
  1850. octave
  1851. @item s
  1852. slope
  1853. @item k
  1854. kHz
  1855. @end table
  1856. @item width, w
  1857. Specify the band-width of a filter in width_type units.
  1858. @item channels, c
  1859. Specify which channels to filter, by default all available are filtered.
  1860. @end table
  1861. @subsection Commands
  1862. This filter supports the following commands:
  1863. @table @option
  1864. @item frequency, f
  1865. Change bandreject frequency.
  1866. Syntax for the command is : "@var{frequency}"
  1867. @item width_type, t
  1868. Change bandreject width_type.
  1869. Syntax for the command is : "@var{width_type}"
  1870. @item width, w
  1871. Change bandreject width.
  1872. Syntax for the command is : "@var{width}"
  1873. @end table
  1874. @section bass, lowshelf
  1875. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1876. shelving filter with a response similar to that of a standard
  1877. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1878. The filter accepts the following options:
  1879. @table @option
  1880. @item gain, g
  1881. Give the gain at 0 Hz. Its useful range is about -20
  1882. (for a large cut) to +20 (for a large boost).
  1883. Beware of clipping when using a positive gain.
  1884. @item frequency, f
  1885. Set the filter's central frequency and so can be used
  1886. to extend or reduce the frequency range to be boosted or cut.
  1887. The default value is @code{100} Hz.
  1888. @item width_type, t
  1889. Set method to specify band-width of filter.
  1890. @table @option
  1891. @item h
  1892. Hz
  1893. @item q
  1894. Q-Factor
  1895. @item o
  1896. octave
  1897. @item s
  1898. slope
  1899. @item k
  1900. kHz
  1901. @end table
  1902. @item width, w
  1903. Determine how steep is the filter's shelf transition.
  1904. @item channels, c
  1905. Specify which channels to filter, by default all available are filtered.
  1906. @end table
  1907. @subsection Commands
  1908. This filter supports the following commands:
  1909. @table @option
  1910. @item frequency, f
  1911. Change bass frequency.
  1912. Syntax for the command is : "@var{frequency}"
  1913. @item width_type, t
  1914. Change bass width_type.
  1915. Syntax for the command is : "@var{width_type}"
  1916. @item width, w
  1917. Change bass width.
  1918. Syntax for the command is : "@var{width}"
  1919. @item gain, g
  1920. Change bass gain.
  1921. Syntax for the command is : "@var{gain}"
  1922. @end table
  1923. @section biquad
  1924. Apply a biquad IIR filter with the given coefficients.
  1925. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1926. are the numerator and denominator coefficients respectively.
  1927. and @var{channels}, @var{c} specify which channels to filter, by default all
  1928. available are filtered.
  1929. @subsection Commands
  1930. This filter supports the following commands:
  1931. @table @option
  1932. @item a0
  1933. @item a1
  1934. @item a2
  1935. @item b0
  1936. @item b1
  1937. @item b2
  1938. Change biquad parameter.
  1939. Syntax for the command is : "@var{value}"
  1940. @end table
  1941. @section bs2b
  1942. Bauer stereo to binaural transformation, which improves headphone listening of
  1943. stereo audio records.
  1944. To enable compilation of this filter you need to configure FFmpeg with
  1945. @code{--enable-libbs2b}.
  1946. It accepts the following parameters:
  1947. @table @option
  1948. @item profile
  1949. Pre-defined crossfeed level.
  1950. @table @option
  1951. @item default
  1952. Default level (fcut=700, feed=50).
  1953. @item cmoy
  1954. Chu Moy circuit (fcut=700, feed=60).
  1955. @item jmeier
  1956. Jan Meier circuit (fcut=650, feed=95).
  1957. @end table
  1958. @item fcut
  1959. Cut frequency (in Hz).
  1960. @item feed
  1961. Feed level (in Hz).
  1962. @end table
  1963. @section channelmap
  1964. Remap input channels to new locations.
  1965. It accepts the following parameters:
  1966. @table @option
  1967. @item map
  1968. Map channels from input to output. The argument is a '|'-separated list of
  1969. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1970. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1971. channel (e.g. FL for front left) or its index in the input channel layout.
  1972. @var{out_channel} is the name of the output channel or its index in the output
  1973. channel layout. If @var{out_channel} is not given then it is implicitly an
  1974. index, starting with zero and increasing by one for each mapping.
  1975. @item channel_layout
  1976. The channel layout of the output stream.
  1977. @end table
  1978. If no mapping is present, the filter will implicitly map input channels to
  1979. output channels, preserving indices.
  1980. @subsection Examples
  1981. @itemize
  1982. @item
  1983. For example, assuming a 5.1+downmix input MOV file,
  1984. @example
  1985. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1986. @end example
  1987. will create an output WAV file tagged as stereo from the downmix channels of
  1988. the input.
  1989. @item
  1990. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1991. @example
  1992. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1993. @end example
  1994. @end itemize
  1995. @section channelsplit
  1996. Split each channel from an input audio stream into a separate output stream.
  1997. It accepts the following parameters:
  1998. @table @option
  1999. @item channel_layout
  2000. The channel layout of the input stream. The default is "stereo".
  2001. @item channels
  2002. A channel layout describing the channels to be extracted as separate output streams
  2003. or "all" to extract each input channel as a separate stream. The default is "all".
  2004. Choosing channels not present in channel layout in the input will result in an error.
  2005. @end table
  2006. @subsection Examples
  2007. @itemize
  2008. @item
  2009. For example, assuming a stereo input MP3 file,
  2010. @example
  2011. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2012. @end example
  2013. will create an output Matroska file with two audio streams, one containing only
  2014. the left channel and the other the right channel.
  2015. @item
  2016. Split a 5.1 WAV file into per-channel files:
  2017. @example
  2018. ffmpeg -i in.wav -filter_complex
  2019. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2020. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2021. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2022. side_right.wav
  2023. @end example
  2024. @item
  2025. Extract only LFE from a 5.1 WAV file:
  2026. @example
  2027. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2028. -map '[LFE]' lfe.wav
  2029. @end example
  2030. @end itemize
  2031. @section chorus
  2032. Add a chorus effect to the audio.
  2033. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2034. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2035. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2036. The modulation depth defines the range the modulated delay is played before or after
  2037. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2038. sound tuned around the original one, like in a chorus where some vocals are slightly
  2039. off key.
  2040. It accepts the following parameters:
  2041. @table @option
  2042. @item in_gain
  2043. Set input gain. Default is 0.4.
  2044. @item out_gain
  2045. Set output gain. Default is 0.4.
  2046. @item delays
  2047. Set delays. A typical delay is around 40ms to 60ms.
  2048. @item decays
  2049. Set decays.
  2050. @item speeds
  2051. Set speeds.
  2052. @item depths
  2053. Set depths.
  2054. @end table
  2055. @subsection Examples
  2056. @itemize
  2057. @item
  2058. A single delay:
  2059. @example
  2060. chorus=0.7:0.9:55:0.4:0.25:2
  2061. @end example
  2062. @item
  2063. Two delays:
  2064. @example
  2065. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2066. @end example
  2067. @item
  2068. Fuller sounding chorus with three delays:
  2069. @example
  2070. chorus=0.5:0.9:50|60|40:0.4|0.32|0.3:0.25|0.4|0.3:2|2.3|1.3
  2071. @end example
  2072. @end itemize
  2073. @section compand
  2074. Compress or expand the audio's dynamic range.
  2075. It accepts the following parameters:
  2076. @table @option
  2077. @item attacks
  2078. @item decays
  2079. A list of times in seconds for each channel over which the instantaneous level
  2080. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2081. increase of volume and @var{decays} refers to decrease of volume. For most
  2082. situations, the attack time (response to the audio getting louder) should be
  2083. shorter than the decay time, because the human ear is more sensitive to sudden
  2084. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2085. a typical value for decay is 0.8 seconds.
  2086. If specified number of attacks & decays is lower than number of channels, the last
  2087. set attack/decay will be used for all remaining channels.
  2088. @item points
  2089. A list of points for the transfer function, specified in dB relative to the
  2090. maximum possible signal amplitude. Each key points list must be defined using
  2091. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2092. @code{x0/y0 x1/y1 x2/y2 ....}
  2093. The input values must be in strictly increasing order but the transfer function
  2094. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2095. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2096. function are @code{-70/-70|-60/-20|1/0}.
  2097. @item soft-knee
  2098. Set the curve radius in dB for all joints. It defaults to 0.01.
  2099. @item gain
  2100. Set the additional gain in dB to be applied at all points on the transfer
  2101. function. This allows for easy adjustment of the overall gain.
  2102. It defaults to 0.
  2103. @item volume
  2104. Set an initial volume, in dB, to be assumed for each channel when filtering
  2105. starts. This permits the user to supply a nominal level initially, so that, for
  2106. example, a very large gain is not applied to initial signal levels before the
  2107. companding has begun to operate. A typical value for audio which is initially
  2108. quiet is -90 dB. It defaults to 0.
  2109. @item delay
  2110. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2111. delayed before being fed to the volume adjuster. Specifying a delay
  2112. approximately equal to the attack/decay times allows the filter to effectively
  2113. operate in predictive rather than reactive mode. It defaults to 0.
  2114. @end table
  2115. @subsection Examples
  2116. @itemize
  2117. @item
  2118. Make music with both quiet and loud passages suitable for listening to in a
  2119. noisy environment:
  2120. @example
  2121. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2122. @end example
  2123. Another example for audio with whisper and explosion parts:
  2124. @example
  2125. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2126. @end example
  2127. @item
  2128. A noise gate for when the noise is at a lower level than the signal:
  2129. @example
  2130. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2131. @end example
  2132. @item
  2133. Here is another noise gate, this time for when the noise is at a higher level
  2134. than the signal (making it, in some ways, similar to squelch):
  2135. @example
  2136. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2137. @end example
  2138. @item
  2139. 2:1 compression starting at -6dB:
  2140. @example
  2141. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2142. @end example
  2143. @item
  2144. 2:1 compression starting at -9dB:
  2145. @example
  2146. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2147. @end example
  2148. @item
  2149. 2:1 compression starting at -12dB:
  2150. @example
  2151. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2152. @end example
  2153. @item
  2154. 2:1 compression starting at -18dB:
  2155. @example
  2156. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2157. @end example
  2158. @item
  2159. 3:1 compression starting at -15dB:
  2160. @example
  2161. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2162. @end example
  2163. @item
  2164. Compressor/Gate:
  2165. @example
  2166. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2167. @end example
  2168. @item
  2169. Expander:
  2170. @example
  2171. compand=attacks=0:points=-80/-169|-54/-80|-49.5/-64.6|-41.1/-41.1|-25.8/-15|-10.8/-4.5|0/0|20/8.3
  2172. @end example
  2173. @item
  2174. Hard limiter at -6dB:
  2175. @example
  2176. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2177. @end example
  2178. @item
  2179. Hard limiter at -12dB:
  2180. @example
  2181. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2182. @end example
  2183. @item
  2184. Hard noise gate at -35 dB:
  2185. @example
  2186. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2187. @end example
  2188. @item
  2189. Soft limiter:
  2190. @example
  2191. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2192. @end example
  2193. @end itemize
  2194. @section compensationdelay
  2195. Compensation Delay Line is a metric based delay to compensate differing
  2196. positions of microphones or speakers.
  2197. For example, you have recorded guitar with two microphones placed in
  2198. different location. Because the front of sound wave has fixed speed in
  2199. normal conditions, the phasing of microphones can vary and depends on
  2200. their location and interposition. The best sound mix can be achieved when
  2201. these microphones are in phase (synchronized). Note that distance of
  2202. ~30 cm between microphones makes one microphone to capture signal in
  2203. antiphase to another microphone. That makes the final mix sounding moody.
  2204. This filter helps to solve phasing problems by adding different delays
  2205. to each microphone track and make them synchronized.
  2206. The best result can be reached when you take one track as base and
  2207. synchronize other tracks one by one with it.
  2208. Remember that synchronization/delay tolerance depends on sample rate, too.
  2209. Higher sample rates will give more tolerance.
  2210. It accepts the following parameters:
  2211. @table @option
  2212. @item mm
  2213. Set millimeters distance. This is compensation distance for fine tuning.
  2214. Default is 0.
  2215. @item cm
  2216. Set cm distance. This is compensation distance for tightening distance setup.
  2217. Default is 0.
  2218. @item m
  2219. Set meters distance. This is compensation distance for hard distance setup.
  2220. Default is 0.
  2221. @item dry
  2222. Set dry amount. Amount of unprocessed (dry) signal.
  2223. Default is 0.
  2224. @item wet
  2225. Set wet amount. Amount of processed (wet) signal.
  2226. Default is 1.
  2227. @item temp
  2228. Set temperature degree in Celsius. This is the temperature of the environment.
  2229. Default is 20.
  2230. @end table
  2231. @section crossfeed
  2232. Apply headphone crossfeed filter.
  2233. Crossfeed is the process of blending the left and right channels of stereo
  2234. audio recording.
  2235. It is mainly used to reduce extreme stereo separation of low frequencies.
  2236. The intent is to produce more speaker like sound to the listener.
  2237. The filter accepts the following options:
  2238. @table @option
  2239. @item strength
  2240. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2241. This sets gain of low shelf filter for side part of stereo image.
  2242. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2243. @item range
  2244. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2245. This sets cut off frequency of low shelf filter. Default is cut off near
  2246. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2247. @item level_in
  2248. Set input gain. Default is 0.9.
  2249. @item level_out
  2250. Set output gain. Default is 1.
  2251. @end table
  2252. @section crystalizer
  2253. Simple algorithm to expand audio dynamic range.
  2254. The filter accepts the following options:
  2255. @table @option
  2256. @item i
  2257. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2258. (unchanged sound) to 10.0 (maximum effect).
  2259. @item c
  2260. Enable clipping. By default is enabled.
  2261. @end table
  2262. @section dcshift
  2263. Apply a DC shift to the audio.
  2264. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2265. in the recording chain) from the audio. The effect of a DC offset is reduced
  2266. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2267. a signal has a DC offset.
  2268. @table @option
  2269. @item shift
  2270. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2271. the audio.
  2272. @item limitergain
  2273. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2274. used to prevent clipping.
  2275. @end table
  2276. @section drmeter
  2277. Measure audio dynamic range.
  2278. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2279. is found in transition material. And anything less that 8 have very poor dynamics
  2280. and is very compressed.
  2281. The filter accepts the following options:
  2282. @table @option
  2283. @item length
  2284. Set window length in seconds used to split audio into segments of equal length.
  2285. Default is 3 seconds.
  2286. @end table
  2287. @section dynaudnorm
  2288. Dynamic Audio Normalizer.
  2289. This filter applies a certain amount of gain to the input audio in order
  2290. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2291. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2292. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2293. This allows for applying extra gain to the "quiet" sections of the audio
  2294. while avoiding distortions or clipping the "loud" sections. In other words:
  2295. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2296. sections, in the sense that the volume of each section is brought to the
  2297. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2298. this goal *without* applying "dynamic range compressing". It will retain 100%
  2299. of the dynamic range *within* each section of the audio file.
  2300. @table @option
  2301. @item f
  2302. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2303. Default is 500 milliseconds.
  2304. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2305. referred to as frames. This is required, because a peak magnitude has no
  2306. meaning for just a single sample value. Instead, we need to determine the
  2307. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2308. normalizer would simply use the peak magnitude of the complete file, the
  2309. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2310. frame. The length of a frame is specified in milliseconds. By default, the
  2311. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2312. been found to give good results with most files.
  2313. Note that the exact frame length, in number of samples, will be determined
  2314. automatically, based on the sampling rate of the individual input audio file.
  2315. @item g
  2316. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2317. number. Default is 31.
  2318. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2319. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2320. is specified in frames, centered around the current frame. For the sake of
  2321. simplicity, this must be an odd number. Consequently, the default value of 31
  2322. takes into account the current frame, as well as the 15 preceding frames and
  2323. the 15 subsequent frames. Using a larger window results in a stronger
  2324. smoothing effect and thus in less gain variation, i.e. slower gain
  2325. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2326. effect and thus in more gain variation, i.e. faster gain adaptation.
  2327. In other words, the more you increase this value, the more the Dynamic Audio
  2328. Normalizer will behave like a "traditional" normalization filter. On the
  2329. contrary, the more you decrease this value, the more the Dynamic Audio
  2330. Normalizer will behave like a dynamic range compressor.
  2331. @item p
  2332. Set the target peak value. This specifies the highest permissible magnitude
  2333. level for the normalized audio input. This filter will try to approach the
  2334. target peak magnitude as closely as possible, but at the same time it also
  2335. makes sure that the normalized signal will never exceed the peak magnitude.
  2336. A frame's maximum local gain factor is imposed directly by the target peak
  2337. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2338. It is not recommended to go above this value.
  2339. @item m
  2340. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2341. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2342. factor for each input frame, i.e. the maximum gain factor that does not
  2343. result in clipping or distortion. The maximum gain factor is determined by
  2344. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2345. additionally bounds the frame's maximum gain factor by a predetermined
  2346. (global) maximum gain factor. This is done in order to avoid excessive gain
  2347. factors in "silent" or almost silent frames. By default, the maximum gain
  2348. factor is 10.0, For most inputs the default value should be sufficient and
  2349. it usually is not recommended to increase this value. Though, for input
  2350. with an extremely low overall volume level, it may be necessary to allow even
  2351. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2352. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2353. Instead, a "sigmoid" threshold function will be applied. This way, the
  2354. gain factors will smoothly approach the threshold value, but never exceed that
  2355. value.
  2356. @item r
  2357. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2358. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2359. This means that the maximum local gain factor for each frame is defined
  2360. (only) by the frame's highest magnitude sample. This way, the samples can
  2361. be amplified as much as possible without exceeding the maximum signal
  2362. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2363. Normalizer can also take into account the frame's root mean square,
  2364. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2365. determine the power of a time-varying signal. It is therefore considered
  2366. that the RMS is a better approximation of the "perceived loudness" than
  2367. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2368. frames to a constant RMS value, a uniform "perceived loudness" can be
  2369. established. If a target RMS value has been specified, a frame's local gain
  2370. factor is defined as the factor that would result in exactly that RMS value.
  2371. Note, however, that the maximum local gain factor is still restricted by the
  2372. frame's highest magnitude sample, in order to prevent clipping.
  2373. @item n
  2374. Enable channels coupling. By default is enabled.
  2375. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2376. amount. This means the same gain factor will be applied to all channels, i.e.
  2377. the maximum possible gain factor is determined by the "loudest" channel.
  2378. However, in some recordings, it may happen that the volume of the different
  2379. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2380. In this case, this option can be used to disable the channel coupling. This way,
  2381. the gain factor will be determined independently for each channel, depending
  2382. only on the individual channel's highest magnitude sample. This allows for
  2383. harmonizing the volume of the different channels.
  2384. @item c
  2385. Enable DC bias correction. By default is disabled.
  2386. An audio signal (in the time domain) is a sequence of sample values.
  2387. In the Dynamic Audio Normalizer these sample values are represented in the
  2388. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2389. audio signal, or "waveform", should be centered around the zero point.
  2390. That means if we calculate the mean value of all samples in a file, or in a
  2391. single frame, then the result should be 0.0 or at least very close to that
  2392. value. If, however, there is a significant deviation of the mean value from
  2393. 0.0, in either positive or negative direction, this is referred to as a
  2394. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2395. Audio Normalizer provides optional DC bias correction.
  2396. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2397. the mean value, or "DC correction" offset, of each input frame and subtract
  2398. that value from all of the frame's sample values which ensures those samples
  2399. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2400. boundaries, the DC correction offset values will be interpolated smoothly
  2401. between neighbouring frames.
  2402. @item b
  2403. Enable alternative boundary mode. By default is disabled.
  2404. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2405. around each frame. This includes the preceding frames as well as the
  2406. subsequent frames. However, for the "boundary" frames, located at the very
  2407. beginning and at the very end of the audio file, not all neighbouring
  2408. frames are available. In particular, for the first few frames in the audio
  2409. file, the preceding frames are not known. And, similarly, for the last few
  2410. frames in the audio file, the subsequent frames are not known. Thus, the
  2411. question arises which gain factors should be assumed for the missing frames
  2412. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2413. to deal with this situation. The default boundary mode assumes a gain factor
  2414. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2415. "fade out" at the beginning and at the end of the input, respectively.
  2416. @item s
  2417. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2418. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2419. compression. This means that signal peaks will not be pruned and thus the
  2420. full dynamic range will be retained within each local neighbourhood. However,
  2421. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2422. normalization algorithm with a more "traditional" compression.
  2423. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2424. (thresholding) function. If (and only if) the compression feature is enabled,
  2425. all input frames will be processed by a soft knee thresholding function prior
  2426. to the actual normalization process. Put simply, the thresholding function is
  2427. going to prune all samples whose magnitude exceeds a certain threshold value.
  2428. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2429. value. Instead, the threshold value will be adjusted for each individual
  2430. frame.
  2431. In general, smaller parameters result in stronger compression, and vice versa.
  2432. Values below 3.0 are not recommended, because audible distortion may appear.
  2433. @end table
  2434. @section earwax
  2435. Make audio easier to listen to on headphones.
  2436. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2437. so that when listened to on headphones the stereo image is moved from
  2438. inside your head (standard for headphones) to outside and in front of
  2439. the listener (standard for speakers).
  2440. Ported from SoX.
  2441. @section equalizer
  2442. Apply a two-pole peaking equalisation (EQ) filter. With this
  2443. filter, the signal-level at and around a selected frequency can
  2444. be increased or decreased, whilst (unlike bandpass and bandreject
  2445. filters) that at all other frequencies is unchanged.
  2446. In order to produce complex equalisation curves, this filter can
  2447. be given several times, each with a different central frequency.
  2448. The filter accepts the following options:
  2449. @table @option
  2450. @item frequency, f
  2451. Set the filter's central frequency in Hz.
  2452. @item width_type, t
  2453. Set method to specify band-width of filter.
  2454. @table @option
  2455. @item h
  2456. Hz
  2457. @item q
  2458. Q-Factor
  2459. @item o
  2460. octave
  2461. @item s
  2462. slope
  2463. @item k
  2464. kHz
  2465. @end table
  2466. @item width, w
  2467. Specify the band-width of a filter in width_type units.
  2468. @item gain, g
  2469. Set the required gain or attenuation in dB.
  2470. Beware of clipping when using a positive gain.
  2471. @item channels, c
  2472. Specify which channels to filter, by default all available are filtered.
  2473. @end table
  2474. @subsection Examples
  2475. @itemize
  2476. @item
  2477. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2478. @example
  2479. equalizer=f=1000:t=h:width=200:g=-10
  2480. @end example
  2481. @item
  2482. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2483. @example
  2484. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2485. @end example
  2486. @end itemize
  2487. @subsection Commands
  2488. This filter supports the following commands:
  2489. @table @option
  2490. @item frequency, f
  2491. Change equalizer frequency.
  2492. Syntax for the command is : "@var{frequency}"
  2493. @item width_type, t
  2494. Change equalizer width_type.
  2495. Syntax for the command is : "@var{width_type}"
  2496. @item width, w
  2497. Change equalizer width.
  2498. Syntax for the command is : "@var{width}"
  2499. @item gain, g
  2500. Change equalizer gain.
  2501. Syntax for the command is : "@var{gain}"
  2502. @end table
  2503. @section extrastereo
  2504. Linearly increases the difference between left and right channels which
  2505. adds some sort of "live" effect to playback.
  2506. The filter accepts the following options:
  2507. @table @option
  2508. @item m
  2509. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2510. (average of both channels), with 1.0 sound will be unchanged, with
  2511. -1.0 left and right channels will be swapped.
  2512. @item c
  2513. Enable clipping. By default is enabled.
  2514. @end table
  2515. @section firequalizer
  2516. Apply FIR Equalization using arbitrary frequency response.
  2517. The filter accepts the following option:
  2518. @table @option
  2519. @item gain
  2520. Set gain curve equation (in dB). The expression can contain variables:
  2521. @table @option
  2522. @item f
  2523. the evaluated frequency
  2524. @item sr
  2525. sample rate
  2526. @item ch
  2527. channel number, set to 0 when multichannels evaluation is disabled
  2528. @item chid
  2529. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2530. multichannels evaluation is disabled
  2531. @item chs
  2532. number of channels
  2533. @item chlayout
  2534. channel_layout, see libavutil/channel_layout.h
  2535. @end table
  2536. and functions:
  2537. @table @option
  2538. @item gain_interpolate(f)
  2539. interpolate gain on frequency f based on gain_entry
  2540. @item cubic_interpolate(f)
  2541. same as gain_interpolate, but smoother
  2542. @end table
  2543. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2544. @item gain_entry
  2545. Set gain entry for gain_interpolate function. The expression can
  2546. contain functions:
  2547. @table @option
  2548. @item entry(f, g)
  2549. store gain entry at frequency f with value g
  2550. @end table
  2551. This option is also available as command.
  2552. @item delay
  2553. Set filter delay in seconds. Higher value means more accurate.
  2554. Default is @code{0.01}.
  2555. @item accuracy
  2556. Set filter accuracy in Hz. Lower value means more accurate.
  2557. Default is @code{5}.
  2558. @item wfunc
  2559. Set window function. Acceptable values are:
  2560. @table @option
  2561. @item rectangular
  2562. rectangular window, useful when gain curve is already smooth
  2563. @item hann
  2564. hann window (default)
  2565. @item hamming
  2566. hamming window
  2567. @item blackman
  2568. blackman window
  2569. @item nuttall3
  2570. 3-terms continuous 1st derivative nuttall window
  2571. @item mnuttall3
  2572. minimum 3-terms discontinuous nuttall window
  2573. @item nuttall
  2574. 4-terms continuous 1st derivative nuttall window
  2575. @item bnuttall
  2576. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2577. @item bharris
  2578. blackman-harris window
  2579. @item tukey
  2580. tukey window
  2581. @end table
  2582. @item fixed
  2583. If enabled, use fixed number of audio samples. This improves speed when
  2584. filtering with large delay. Default is disabled.
  2585. @item multi
  2586. Enable multichannels evaluation on gain. Default is disabled.
  2587. @item zero_phase
  2588. Enable zero phase mode by subtracting timestamp to compensate delay.
  2589. Default is disabled.
  2590. @item scale
  2591. Set scale used by gain. Acceptable values are:
  2592. @table @option
  2593. @item linlin
  2594. linear frequency, linear gain
  2595. @item linlog
  2596. linear frequency, logarithmic (in dB) gain (default)
  2597. @item loglin
  2598. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2599. @item loglog
  2600. logarithmic frequency, logarithmic gain
  2601. @end table
  2602. @item dumpfile
  2603. Set file for dumping, suitable for gnuplot.
  2604. @item dumpscale
  2605. Set scale for dumpfile. Acceptable values are same with scale option.
  2606. Default is linlog.
  2607. @item fft2
  2608. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2609. Default is disabled.
  2610. @item min_phase
  2611. Enable minimum phase impulse response. Default is disabled.
  2612. @end table
  2613. @subsection Examples
  2614. @itemize
  2615. @item
  2616. lowpass at 1000 Hz:
  2617. @example
  2618. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2619. @end example
  2620. @item
  2621. lowpass at 1000 Hz with gain_entry:
  2622. @example
  2623. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2624. @end example
  2625. @item
  2626. custom equalization:
  2627. @example
  2628. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2629. @end example
  2630. @item
  2631. higher delay with zero phase to compensate delay:
  2632. @example
  2633. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2634. @end example
  2635. @item
  2636. lowpass on left channel, highpass on right channel:
  2637. @example
  2638. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2639. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2640. @end example
  2641. @end itemize
  2642. @section flanger
  2643. Apply a flanging effect to the audio.
  2644. The filter accepts the following options:
  2645. @table @option
  2646. @item delay
  2647. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2648. @item depth
  2649. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2650. @item regen
  2651. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2652. Default value is 0.
  2653. @item width
  2654. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2655. Default value is 71.
  2656. @item speed
  2657. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2658. @item shape
  2659. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2660. Default value is @var{sinusoidal}.
  2661. @item phase
  2662. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2663. Default value is 25.
  2664. @item interp
  2665. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2666. Default is @var{linear}.
  2667. @end table
  2668. @section haas
  2669. Apply Haas effect to audio.
  2670. Note that this makes most sense to apply on mono signals.
  2671. With this filter applied to mono signals it give some directionality and
  2672. stretches its stereo image.
  2673. The filter accepts the following options:
  2674. @table @option
  2675. @item level_in
  2676. Set input level. By default is @var{1}, or 0dB
  2677. @item level_out
  2678. Set output level. By default is @var{1}, or 0dB.
  2679. @item side_gain
  2680. Set gain applied to side part of signal. By default is @var{1}.
  2681. @item middle_source
  2682. Set kind of middle source. Can be one of the following:
  2683. @table @samp
  2684. @item left
  2685. Pick left channel.
  2686. @item right
  2687. Pick right channel.
  2688. @item mid
  2689. Pick middle part signal of stereo image.
  2690. @item side
  2691. Pick side part signal of stereo image.
  2692. @end table
  2693. @item middle_phase
  2694. Change middle phase. By default is disabled.
  2695. @item left_delay
  2696. Set left channel delay. By default is @var{2.05} milliseconds.
  2697. @item left_balance
  2698. Set left channel balance. By default is @var{-1}.
  2699. @item left_gain
  2700. Set left channel gain. By default is @var{1}.
  2701. @item left_phase
  2702. Change left phase. By default is disabled.
  2703. @item right_delay
  2704. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2705. @item right_balance
  2706. Set right channel balance. By default is @var{1}.
  2707. @item right_gain
  2708. Set right channel gain. By default is @var{1}.
  2709. @item right_phase
  2710. Change right phase. By default is enabled.
  2711. @end table
  2712. @section hdcd
  2713. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2714. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2715. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2716. of HDCD, and detects the Transient Filter flag.
  2717. @example
  2718. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2719. @end example
  2720. When using the filter with wav, note the default encoding for wav is 16-bit,
  2721. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2722. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2723. @example
  2724. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2725. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2726. @end example
  2727. The filter accepts the following options:
  2728. @table @option
  2729. @item disable_autoconvert
  2730. Disable any automatic format conversion or resampling in the filter graph.
  2731. @item process_stereo
  2732. Process the stereo channels together. If target_gain does not match between
  2733. channels, consider it invalid and use the last valid target_gain.
  2734. @item cdt_ms
  2735. Set the code detect timer period in ms.
  2736. @item force_pe
  2737. Always extend peaks above -3dBFS even if PE isn't signaled.
  2738. @item analyze_mode
  2739. Replace audio with a solid tone and adjust the amplitude to signal some
  2740. specific aspect of the decoding process. The output file can be loaded in
  2741. an audio editor alongside the original to aid analysis.
  2742. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2743. Modes are:
  2744. @table @samp
  2745. @item 0, off
  2746. Disabled
  2747. @item 1, lle
  2748. Gain adjustment level at each sample
  2749. @item 2, pe
  2750. Samples where peak extend occurs
  2751. @item 3, cdt
  2752. Samples where the code detect timer is active
  2753. @item 4, tgm
  2754. Samples where the target gain does not match between channels
  2755. @end table
  2756. @end table
  2757. @section headphone
  2758. Apply head-related transfer functions (HRTFs) to create virtual
  2759. loudspeakers around the user for binaural listening via headphones.
  2760. The HRIRs are provided via additional streams, for each channel
  2761. one stereo input stream is needed.
  2762. The filter accepts the following options:
  2763. @table @option
  2764. @item map
  2765. Set mapping of input streams for convolution.
  2766. The argument is a '|'-separated list of channel names in order as they
  2767. are given as additional stream inputs for filter.
  2768. This also specify number of input streams. Number of input streams
  2769. must be not less than number of channels in first stream plus one.
  2770. @item gain
  2771. Set gain applied to audio. Value is in dB. Default is 0.
  2772. @item type
  2773. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2774. processing audio in time domain which is slow.
  2775. @var{freq} is processing audio in frequency domain which is fast.
  2776. Default is @var{freq}.
  2777. @item lfe
  2778. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2779. @item size
  2780. Set size of frame in number of samples which will be processed at once.
  2781. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2782. @item hrir
  2783. Set format of hrir stream.
  2784. Default value is @var{stereo}. Alternative value is @var{multich}.
  2785. If value is set to @var{stereo}, number of additional streams should
  2786. be greater or equal to number of input channels in first input stream.
  2787. Also each additional stream should have stereo number of channels.
  2788. If value is set to @var{multich}, number of additional streams should
  2789. be exactly one. Also number of input channels of additional stream
  2790. should be equal or greater than twice number of channels of first input
  2791. stream.
  2792. @end table
  2793. @subsection Examples
  2794. @itemize
  2795. @item
  2796. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2797. each amovie filter use stereo file with IR coefficients as input.
  2798. The files give coefficients for each position of virtual loudspeaker:
  2799. @example
  2800. ffmpeg -i input.wav
  2801. -filter_complex "amovie=azi_270_ele_0_DFC.wav[sr];amovie=azi_90_ele_0_DFC.wav[sl];amovie=azi_225_ele_0_DFC.wav[br];amovie=azi_135_ele_0_DFC.wav[bl];amovie=azi_0_ele_0_DFC.wav,asplit[fc][lfe];amovie=azi_35_ele_0_DFC.wav[fl];amovie=azi_325_ele_0_DFC.wav[fr];[0:a][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
  2802. output.wav
  2803. @end example
  2804. @item
  2805. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2806. but now in @var{multich} @var{hrir} format.
  2807. @example
  2808. ffmpeg -i input.wav -filter_complex "amovie=minp.wav[hrirs];[0:a][hrirs]headphone=map=FL|FR|FC|LFE|BL|BR|SL|SR:hrir=multich"
  2809. output.wav
  2810. @end example
  2811. @end itemize
  2812. @section highpass
  2813. Apply a high-pass filter with 3dB point frequency.
  2814. The filter can be either single-pole, or double-pole (the default).
  2815. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2816. The filter accepts the following options:
  2817. @table @option
  2818. @item frequency, f
  2819. Set frequency in Hz. Default is 3000.
  2820. @item poles, p
  2821. Set number of poles. Default is 2.
  2822. @item width_type, t
  2823. Set method to specify band-width of filter.
  2824. @table @option
  2825. @item h
  2826. Hz
  2827. @item q
  2828. Q-Factor
  2829. @item o
  2830. octave
  2831. @item s
  2832. slope
  2833. @item k
  2834. kHz
  2835. @end table
  2836. @item width, w
  2837. Specify the band-width of a filter in width_type units.
  2838. Applies only to double-pole filter.
  2839. The default is 0.707q and gives a Butterworth response.
  2840. @item channels, c
  2841. Specify which channels to filter, by default all available are filtered.
  2842. @end table
  2843. @subsection Commands
  2844. This filter supports the following commands:
  2845. @table @option
  2846. @item frequency, f
  2847. Change highpass frequency.
  2848. Syntax for the command is : "@var{frequency}"
  2849. @item width_type, t
  2850. Change highpass width_type.
  2851. Syntax for the command is : "@var{width_type}"
  2852. @item width, w
  2853. Change highpass width.
  2854. Syntax for the command is : "@var{width}"
  2855. @end table
  2856. @section join
  2857. Join multiple input streams into one multi-channel stream.
  2858. It accepts the following parameters:
  2859. @table @option
  2860. @item inputs
  2861. The number of input streams. It defaults to 2.
  2862. @item channel_layout
  2863. The desired output channel layout. It defaults to stereo.
  2864. @item map
  2865. Map channels from inputs to output. The argument is a '|'-separated list of
  2866. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2867. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2868. can be either the name of the input channel (e.g. FL for front left) or its
  2869. index in the specified input stream. @var{out_channel} is the name of the output
  2870. channel.
  2871. @end table
  2872. The filter will attempt to guess the mappings when they are not specified
  2873. explicitly. It does so by first trying to find an unused matching input channel
  2874. and if that fails it picks the first unused input channel.
  2875. Join 3 inputs (with properly set channel layouts):
  2876. @example
  2877. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2878. @end example
  2879. Build a 5.1 output from 6 single-channel streams:
  2880. @example
  2881. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2882. 'join=inputs=6:channel_layout=5.1:map=0.0-FL|1.0-FR|2.0-FC|3.0-SL|4.0-SR|5.0-LFE'
  2883. out
  2884. @end example
  2885. @section ladspa
  2886. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2887. To enable compilation of this filter you need to configure FFmpeg with
  2888. @code{--enable-ladspa}.
  2889. @table @option
  2890. @item file, f
  2891. Specifies the name of LADSPA plugin library to load. If the environment
  2892. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2893. each one of the directories specified by the colon separated list in
  2894. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2895. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2896. @file{/usr/lib/ladspa/}.
  2897. @item plugin, p
  2898. Specifies the plugin within the library. Some libraries contain only
  2899. one plugin, but others contain many of them. If this is not set filter
  2900. will list all available plugins within the specified library.
  2901. @item controls, c
  2902. Set the '|' separated list of controls which are zero or more floating point
  2903. values that determine the behavior of the loaded plugin (for example delay,
  2904. threshold or gain).
  2905. Controls need to be defined using the following syntax:
  2906. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2907. @var{valuei} is the value set on the @var{i}-th control.
  2908. Alternatively they can be also defined using the following syntax:
  2909. @var{value0}|@var{value1}|@var{value2}|..., where
  2910. @var{valuei} is the value set on the @var{i}-th control.
  2911. If @option{controls} is set to @code{help}, all available controls and
  2912. their valid ranges are printed.
  2913. @item sample_rate, s
  2914. Specify the sample rate, default to 44100. Only used if plugin have
  2915. zero inputs.
  2916. @item nb_samples, n
  2917. Set the number of samples per channel per each output frame, default
  2918. is 1024. Only used if plugin have zero inputs.
  2919. @item duration, d
  2920. Set the minimum duration of the sourced audio. See
  2921. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2922. for the accepted syntax.
  2923. Note that the resulting duration may be greater than the specified duration,
  2924. as the generated audio is always cut at the end of a complete frame.
  2925. If not specified, or the expressed duration is negative, the audio is
  2926. supposed to be generated forever.
  2927. Only used if plugin have zero inputs.
  2928. @end table
  2929. @subsection Examples
  2930. @itemize
  2931. @item
  2932. List all available plugins within amp (LADSPA example plugin) library:
  2933. @example
  2934. ladspa=file=amp
  2935. @end example
  2936. @item
  2937. List all available controls and their valid ranges for @code{vcf_notch}
  2938. plugin from @code{VCF} library:
  2939. @example
  2940. ladspa=f=vcf:p=vcf_notch:c=help
  2941. @end example
  2942. @item
  2943. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2944. plugin library:
  2945. @example
  2946. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2947. @end example
  2948. @item
  2949. Add reverberation to the audio using TAP-plugins
  2950. (Tom's Audio Processing plugins):
  2951. @example
  2952. ladspa=file=tap_reverb:tap_reverb
  2953. @end example
  2954. @item
  2955. Generate white noise, with 0.2 amplitude:
  2956. @example
  2957. ladspa=file=cmt:noise_source_white:c=c0=.2
  2958. @end example
  2959. @item
  2960. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2961. @code{C* Audio Plugin Suite} (CAPS) library:
  2962. @example
  2963. ladspa=file=caps:Click:c=c1=20'
  2964. @end example
  2965. @item
  2966. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2967. @example
  2968. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2969. @end example
  2970. @item
  2971. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2972. @code{SWH Plugins} collection:
  2973. @example
  2974. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2975. @end example
  2976. @item
  2977. Attenuate low frequencies using Multiband EQ from Steve Harris
  2978. @code{SWH Plugins} collection:
  2979. @example
  2980. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2981. @end example
  2982. @item
  2983. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2984. (CAPS) library:
  2985. @example
  2986. ladspa=caps:Narrower
  2987. @end example
  2988. @item
  2989. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2990. @example
  2991. ladspa=caps:White:.2
  2992. @end example
  2993. @item
  2994. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2995. @example
  2996. ladspa=caps:Fractal:c=c1=1
  2997. @end example
  2998. @item
  2999. Dynamic volume normalization using @code{VLevel} plugin:
  3000. @example
  3001. ladspa=vlevel-ladspa:vlevel_mono
  3002. @end example
  3003. @end itemize
  3004. @subsection Commands
  3005. This filter supports the following commands:
  3006. @table @option
  3007. @item cN
  3008. Modify the @var{N}-th control value.
  3009. If the specified value is not valid, it is ignored and prior one is kept.
  3010. @end table
  3011. @section loudnorm
  3012. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3013. Support for both single pass (livestreams, files) and double pass (files) modes.
  3014. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  3015. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  3016. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3017. The filter accepts the following options:
  3018. @table @option
  3019. @item I, i
  3020. Set integrated loudness target.
  3021. Range is -70.0 - -5.0. Default value is -24.0.
  3022. @item LRA, lra
  3023. Set loudness range target.
  3024. Range is 1.0 - 20.0. Default value is 7.0.
  3025. @item TP, tp
  3026. Set maximum true peak.
  3027. Range is -9.0 - +0.0. Default value is -2.0.
  3028. @item measured_I, measured_i
  3029. Measured IL of input file.
  3030. Range is -99.0 - +0.0.
  3031. @item measured_LRA, measured_lra
  3032. Measured LRA of input file.
  3033. Range is 0.0 - 99.0.
  3034. @item measured_TP, measured_tp
  3035. Measured true peak of input file.
  3036. Range is -99.0 - +99.0.
  3037. @item measured_thresh
  3038. Measured threshold of input file.
  3039. Range is -99.0 - +0.0.
  3040. @item offset
  3041. Set offset gain. Gain is applied before the true-peak limiter.
  3042. Range is -99.0 - +99.0. Default is +0.0.
  3043. @item linear
  3044. Normalize linearly if possible.
  3045. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  3046. to be specified in order to use this mode.
  3047. Options are true or false. Default is true.
  3048. @item dual_mono
  3049. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3050. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3051. If set to @code{true}, this option will compensate for this effect.
  3052. Multi-channel input files are not affected by this option.
  3053. Options are true or false. Default is false.
  3054. @item print_format
  3055. Set print format for stats. Options are summary, json, or none.
  3056. Default value is none.
  3057. @end table
  3058. @section lowpass
  3059. Apply a low-pass filter with 3dB point frequency.
  3060. The filter can be either single-pole or double-pole (the default).
  3061. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3062. The filter accepts the following options:
  3063. @table @option
  3064. @item frequency, f
  3065. Set frequency in Hz. Default is 500.
  3066. @item poles, p
  3067. Set number of poles. Default is 2.
  3068. @item width_type, t
  3069. Set method to specify band-width of filter.
  3070. @table @option
  3071. @item h
  3072. Hz
  3073. @item q
  3074. Q-Factor
  3075. @item o
  3076. octave
  3077. @item s
  3078. slope
  3079. @item k
  3080. kHz
  3081. @end table
  3082. @item width, w
  3083. Specify the band-width of a filter in width_type units.
  3084. Applies only to double-pole filter.
  3085. The default is 0.707q and gives a Butterworth response.
  3086. @item channels, c
  3087. Specify which channels to filter, by default all available are filtered.
  3088. @end table
  3089. @subsection Examples
  3090. @itemize
  3091. @item
  3092. Lowpass only LFE channel, it LFE is not present it does nothing:
  3093. @example
  3094. lowpass=c=LFE
  3095. @end example
  3096. @end itemize
  3097. @subsection Commands
  3098. This filter supports the following commands:
  3099. @table @option
  3100. @item frequency, f
  3101. Change lowpass frequency.
  3102. Syntax for the command is : "@var{frequency}"
  3103. @item width_type, t
  3104. Change lowpass width_type.
  3105. Syntax for the command is : "@var{width_type}"
  3106. @item width, w
  3107. Change lowpass width.
  3108. Syntax for the command is : "@var{width}"
  3109. @end table
  3110. @section lv2
  3111. Load a LV2 (LADSPA Version 2) plugin.
  3112. To enable compilation of this filter you need to configure FFmpeg with
  3113. @code{--enable-lv2}.
  3114. @table @option
  3115. @item plugin, p
  3116. Specifies the plugin URI. You may need to escape ':'.
  3117. @item controls, c
  3118. Set the '|' separated list of controls which are zero or more floating point
  3119. values that determine the behavior of the loaded plugin (for example delay,
  3120. threshold or gain).
  3121. If @option{controls} is set to @code{help}, all available controls and
  3122. their valid ranges are printed.
  3123. @item sample_rate, s
  3124. Specify the sample rate, default to 44100. Only used if plugin have
  3125. zero inputs.
  3126. @item nb_samples, n
  3127. Set the number of samples per channel per each output frame, default
  3128. is 1024. Only used if plugin have zero inputs.
  3129. @item duration, d
  3130. Set the minimum duration of the sourced audio. See
  3131. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3132. for the accepted syntax.
  3133. Note that the resulting duration may be greater than the specified duration,
  3134. as the generated audio is always cut at the end of a complete frame.
  3135. If not specified, or the expressed duration is negative, the audio is
  3136. supposed to be generated forever.
  3137. Only used if plugin have zero inputs.
  3138. @end table
  3139. @subsection Examples
  3140. @itemize
  3141. @item
  3142. Apply bass enhancer plugin from Calf:
  3143. @example
  3144. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3145. @end example
  3146. @item
  3147. Apply vinyl plugin from Calf:
  3148. @example
  3149. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3150. @end example
  3151. @item
  3152. Apply bit crusher plugin from ArtyFX:
  3153. @example
  3154. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3155. @end example
  3156. @end itemize
  3157. @section mcompand
  3158. Multiband Compress or expand the audio's dynamic range.
  3159. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3160. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3161. response when absent compander action.
  3162. It accepts the following parameters:
  3163. @table @option
  3164. @item args
  3165. This option syntax is:
  3166. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3167. For explanation of each item refer to compand filter documentation.
  3168. @end table
  3169. @anchor{pan}
  3170. @section pan
  3171. Mix channels with specific gain levels. The filter accepts the output
  3172. channel layout followed by a set of channels definitions.
  3173. This filter is also designed to efficiently remap the channels of an audio
  3174. stream.
  3175. The filter accepts parameters of the form:
  3176. "@var{l}|@var{outdef}|@var{outdef}|..."
  3177. @table @option
  3178. @item l
  3179. output channel layout or number of channels
  3180. @item outdef
  3181. output channel specification, of the form:
  3182. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3183. @item out_name
  3184. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3185. number (c0, c1, etc.)
  3186. @item gain
  3187. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3188. @item in_name
  3189. input channel to use, see out_name for details; it is not possible to mix
  3190. named and numbered input channels
  3191. @end table
  3192. If the `=' in a channel specification is replaced by `<', then the gains for
  3193. that specification will be renormalized so that the total is 1, thus
  3194. avoiding clipping noise.
  3195. @subsection Mixing examples
  3196. For example, if you want to down-mix from stereo to mono, but with a bigger
  3197. factor for the left channel:
  3198. @example
  3199. pan=1c|c0=0.9*c0+0.1*c1
  3200. @end example
  3201. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3202. 7-channels surround:
  3203. @example
  3204. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3205. @end example
  3206. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3207. that should be preferred (see "-ac" option) unless you have very specific
  3208. needs.
  3209. @subsection Remapping examples
  3210. The channel remapping will be effective if, and only if:
  3211. @itemize
  3212. @item gain coefficients are zeroes or ones,
  3213. @item only one input per channel output,
  3214. @end itemize
  3215. If all these conditions are satisfied, the filter will notify the user ("Pure
  3216. channel mapping detected"), and use an optimized and lossless method to do the
  3217. remapping.
  3218. For example, if you have a 5.1 source and want a stereo audio stream by
  3219. dropping the extra channels:
  3220. @example
  3221. pan="stereo| c0=FL | c1=FR"
  3222. @end example
  3223. Given the same source, you can also switch front left and front right channels
  3224. and keep the input channel layout:
  3225. @example
  3226. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3227. @end example
  3228. If the input is a stereo audio stream, you can mute the front left channel (and
  3229. still keep the stereo channel layout) with:
  3230. @example
  3231. pan="stereo|c1=c1"
  3232. @end example
  3233. Still with a stereo audio stream input, you can copy the right channel in both
  3234. front left and right:
  3235. @example
  3236. pan="stereo| c0=FR | c1=FR"
  3237. @end example
  3238. @section replaygain
  3239. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3240. outputs it unchanged.
  3241. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3242. @section resample
  3243. Convert the audio sample format, sample rate and channel layout. It is
  3244. not meant to be used directly.
  3245. @section rubberband
  3246. Apply time-stretching and pitch-shifting with librubberband.
  3247. To enable compilation of this filter, you need to configure FFmpeg with
  3248. @code{--enable-librubberband}.
  3249. The filter accepts the following options:
  3250. @table @option
  3251. @item tempo
  3252. Set tempo scale factor.
  3253. @item pitch
  3254. Set pitch scale factor.
  3255. @item transients
  3256. Set transients detector.
  3257. Possible values are:
  3258. @table @var
  3259. @item crisp
  3260. @item mixed
  3261. @item smooth
  3262. @end table
  3263. @item detector
  3264. Set detector.
  3265. Possible values are:
  3266. @table @var
  3267. @item compound
  3268. @item percussive
  3269. @item soft
  3270. @end table
  3271. @item phase
  3272. Set phase.
  3273. Possible values are:
  3274. @table @var
  3275. @item laminar
  3276. @item independent
  3277. @end table
  3278. @item window
  3279. Set processing window size.
  3280. Possible values are:
  3281. @table @var
  3282. @item standard
  3283. @item short
  3284. @item long
  3285. @end table
  3286. @item smoothing
  3287. Set smoothing.
  3288. Possible values are:
  3289. @table @var
  3290. @item off
  3291. @item on
  3292. @end table
  3293. @item formant
  3294. Enable formant preservation when shift pitching.
  3295. Possible values are:
  3296. @table @var
  3297. @item shifted
  3298. @item preserved
  3299. @end table
  3300. @item pitchq
  3301. Set pitch quality.
  3302. Possible values are:
  3303. @table @var
  3304. @item quality
  3305. @item speed
  3306. @item consistency
  3307. @end table
  3308. @item channels
  3309. Set channels.
  3310. Possible values are:
  3311. @table @var
  3312. @item apart
  3313. @item together
  3314. @end table
  3315. @end table
  3316. @section sidechaincompress
  3317. This filter acts like normal compressor but has the ability to compress
  3318. detected signal using second input signal.
  3319. It needs two input streams and returns one output stream.
  3320. First input stream will be processed depending on second stream signal.
  3321. The filtered signal then can be filtered with other filters in later stages of
  3322. processing. See @ref{pan} and @ref{amerge} filter.
  3323. The filter accepts the following options:
  3324. @table @option
  3325. @item level_in
  3326. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3327. @item mode
  3328. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3329. Default is @code{downward}.
  3330. @item threshold
  3331. If a signal of second stream raises above this level it will affect the gain
  3332. reduction of first stream.
  3333. By default is 0.125. Range is between 0.00097563 and 1.
  3334. @item ratio
  3335. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3336. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3337. Default is 2. Range is between 1 and 20.
  3338. @item attack
  3339. Amount of milliseconds the signal has to rise above the threshold before gain
  3340. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3341. @item release
  3342. Amount of milliseconds the signal has to fall below the threshold before
  3343. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3344. @item makeup
  3345. Set the amount by how much signal will be amplified after processing.
  3346. Default is 1. Range is from 1 to 64.
  3347. @item knee
  3348. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3349. Default is 2.82843. Range is between 1 and 8.
  3350. @item link
  3351. Choose if the @code{average} level between all channels of side-chain stream
  3352. or the louder(@code{maximum}) channel of side-chain stream affects the
  3353. reduction. Default is @code{average}.
  3354. @item detection
  3355. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3356. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3357. @item level_sc
  3358. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3359. @item mix
  3360. How much to use compressed signal in output. Default is 1.
  3361. Range is between 0 and 1.
  3362. @end table
  3363. @subsection Examples
  3364. @itemize
  3365. @item
  3366. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3367. depending on the signal of 2nd input and later compressed signal to be
  3368. merged with 2nd input:
  3369. @example
  3370. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3371. @end example
  3372. @end itemize
  3373. @section sidechaingate
  3374. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3375. filter the detected signal before sending it to the gain reduction stage.
  3376. Normally a gate uses the full range signal to detect a level above the
  3377. threshold.
  3378. For example: If you cut all lower frequencies from your sidechain signal
  3379. the gate will decrease the volume of your track only if not enough highs
  3380. appear. With this technique you are able to reduce the resonation of a
  3381. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3382. guitar.
  3383. It needs two input streams and returns one output stream.
  3384. First input stream will be processed depending on second stream signal.
  3385. The filter accepts the following options:
  3386. @table @option
  3387. @item level_in
  3388. Set input level before filtering.
  3389. Default is 1. Allowed range is from 0.015625 to 64.
  3390. @item mode
  3391. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3392. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3393. will be amplified, expanding dynamic range in upward direction.
  3394. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3395. @item range
  3396. Set the level of gain reduction when the signal is below the threshold.
  3397. Default is 0.06125. Allowed range is from 0 to 1.
  3398. Setting this to 0 disables reduction and then filter behaves like expander.
  3399. @item threshold
  3400. If a signal rises above this level the gain reduction is released.
  3401. Default is 0.125. Allowed range is from 0 to 1.
  3402. @item ratio
  3403. Set a ratio about which the signal is reduced.
  3404. Default is 2. Allowed range is from 1 to 9000.
  3405. @item attack
  3406. Amount of milliseconds the signal has to rise above the threshold before gain
  3407. reduction stops.
  3408. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3409. @item release
  3410. Amount of milliseconds the signal has to fall below the threshold before the
  3411. reduction is increased again. Default is 250 milliseconds.
  3412. Allowed range is from 0.01 to 9000.
  3413. @item makeup
  3414. Set amount of amplification of signal after processing.
  3415. Default is 1. Allowed range is from 1 to 64.
  3416. @item knee
  3417. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3418. Default is 2.828427125. Allowed range is from 1 to 8.
  3419. @item detection
  3420. Choose if exact signal should be taken for detection or an RMS like one.
  3421. Default is rms. Can be peak or rms.
  3422. @item link
  3423. Choose if the average level between all channels or the louder channel affects
  3424. the reduction.
  3425. Default is average. Can be average or maximum.
  3426. @item level_sc
  3427. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3428. @end table
  3429. @section silencedetect
  3430. Detect silence in an audio stream.
  3431. This filter logs a message when it detects that the input audio volume is less
  3432. or equal to a noise tolerance value for a duration greater or equal to the
  3433. minimum detected noise duration.
  3434. The printed times and duration are expressed in seconds.
  3435. The filter accepts the following options:
  3436. @table @option
  3437. @item noise, n
  3438. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3439. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3440. @item duration, d
  3441. Set silence duration until notification (default is 2 seconds).
  3442. @item mono, m
  3443. Process each channel separately, instead of combined. By default is disabled.
  3444. @end table
  3445. @subsection Examples
  3446. @itemize
  3447. @item
  3448. Detect 5 seconds of silence with -50dB noise tolerance:
  3449. @example
  3450. silencedetect=n=-50dB:d=5
  3451. @end example
  3452. @item
  3453. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3454. tolerance in @file{silence.mp3}:
  3455. @example
  3456. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3457. @end example
  3458. @end itemize
  3459. @section silenceremove
  3460. Remove silence from the beginning, middle or end of the audio.
  3461. The filter accepts the following options:
  3462. @table @option
  3463. @item start_periods
  3464. This value is used to indicate if audio should be trimmed at beginning of
  3465. the audio. A value of zero indicates no silence should be trimmed from the
  3466. beginning. When specifying a non-zero value, it trims audio up until it
  3467. finds non-silence. Normally, when trimming silence from beginning of audio
  3468. the @var{start_periods} will be @code{1} but it can be increased to higher
  3469. values to trim all audio up to specific count of non-silence periods.
  3470. Default value is @code{0}.
  3471. @item start_duration
  3472. Specify the amount of time that non-silence must be detected before it stops
  3473. trimming audio. By increasing the duration, bursts of noises can be treated
  3474. as silence and trimmed off. Default value is @code{0}.
  3475. @item start_threshold
  3476. This indicates what sample value should be treated as silence. For digital
  3477. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3478. you may wish to increase the value to account for background noise.
  3479. Can be specified in dB (in case "dB" is appended to the specified value)
  3480. or amplitude ratio. Default value is @code{0}.
  3481. @item start_silence
  3482. Specify max duration of silence at beginning that will be kept after
  3483. trimming. Default is 0, which is equal to trimming all samples detected
  3484. as silence.
  3485. @item start_mode
  3486. Specify mode of detection of silence end in start of multi-channel audio.
  3487. Can be @var{any} or @var{all}. Default is @var{any}.
  3488. With @var{any}, any sample that is detected as non-silence will cause
  3489. stopped trimming of silence.
  3490. With @var{all}, only if all channels are detected as non-silence will cause
  3491. stopped trimming of silence.
  3492. @item stop_periods
  3493. Set the count for trimming silence from the end of audio.
  3494. To remove silence from the middle of a file, specify a @var{stop_periods}
  3495. that is negative. This value is then treated as a positive value and is
  3496. used to indicate the effect should restart processing as specified by
  3497. @var{start_periods}, making it suitable for removing periods of silence
  3498. in the middle of the audio.
  3499. Default value is @code{0}.
  3500. @item stop_duration
  3501. Specify a duration of silence that must exist before audio is not copied any
  3502. more. By specifying a higher duration, silence that is wanted can be left in
  3503. the audio.
  3504. Default value is @code{0}.
  3505. @item stop_threshold
  3506. This is the same as @option{start_threshold} but for trimming silence from
  3507. the end of audio.
  3508. Can be specified in dB (in case "dB" is appended to the specified value)
  3509. or amplitude ratio. Default value is @code{0}.
  3510. @item stop_silence
  3511. Specify max duration of silence at end that will be kept after
  3512. trimming. Default is 0, which is equal to trimming all samples detected
  3513. as silence.
  3514. @item stop_mode
  3515. Specify mode of detection of silence start in end of multi-channel audio.
  3516. Can be @var{any} or @var{all}. Default is @var{any}.
  3517. With @var{any}, any sample that is detected as non-silence will cause
  3518. stopped trimming of silence.
  3519. With @var{all}, only if all channels are detected as non-silence will cause
  3520. stopped trimming of silence.
  3521. @item detection
  3522. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3523. and works better with digital silence which is exactly 0.
  3524. Default value is @code{rms}.
  3525. @item window
  3526. Set duration in number of seconds used to calculate size of window in number
  3527. of samples for detecting silence.
  3528. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3529. @end table
  3530. @subsection Examples
  3531. @itemize
  3532. @item
  3533. The following example shows how this filter can be used to start a recording
  3534. that does not contain the delay at the start which usually occurs between
  3535. pressing the record button and the start of the performance:
  3536. @example
  3537. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3538. @end example
  3539. @item
  3540. Trim all silence encountered from beginning to end where there is more than 1
  3541. second of silence in audio:
  3542. @example
  3543. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3544. @end example
  3545. @end itemize
  3546. @section sofalizer
  3547. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3548. loudspeakers around the user for binaural listening via headphones (audio
  3549. formats up to 9 channels supported).
  3550. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3551. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3552. Austrian Academy of Sciences.
  3553. To enable compilation of this filter you need to configure FFmpeg with
  3554. @code{--enable-libmysofa}.
  3555. The filter accepts the following options:
  3556. @table @option
  3557. @item sofa
  3558. Set the SOFA file used for rendering.
  3559. @item gain
  3560. Set gain applied to audio. Value is in dB. Default is 0.
  3561. @item rotation
  3562. Set rotation of virtual loudspeakers in deg. Default is 0.
  3563. @item elevation
  3564. Set elevation of virtual speakers in deg. Default is 0.
  3565. @item radius
  3566. Set distance in meters between loudspeakers and the listener with near-field
  3567. HRTFs. Default is 1.
  3568. @item type
  3569. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3570. processing audio in time domain which is slow.
  3571. @var{freq} is processing audio in frequency domain which is fast.
  3572. Default is @var{freq}.
  3573. @item speakers
  3574. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3575. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3576. Each virtual loudspeaker is described with short channel name following with
  3577. azimuth and elevation in degrees.
  3578. Each virtual loudspeaker description is separated by '|'.
  3579. For example to override front left and front right channel positions use:
  3580. 'speakers=FL 45 15|FR 345 15'.
  3581. Descriptions with unrecognised channel names are ignored.
  3582. @item lfegain
  3583. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3584. @item framesize
  3585. Set custom frame size in number of samples. Default is 1024.
  3586. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3587. is set to @var{freq}.
  3588. @item normalize
  3589. Should all IRs be normalized upon importing SOFA file.
  3590. By default is enabled.
  3591. @item interpolate
  3592. Should nearest IRs be interpolated with neighbor IRs if exact position
  3593. does not match. By default is disabled.
  3594. @item minphase
  3595. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3596. @item anglestep
  3597. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3598. @item radstep
  3599. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3600. @end table
  3601. @subsection Examples
  3602. @itemize
  3603. @item
  3604. Using ClubFritz6 sofa file:
  3605. @example
  3606. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3607. @end example
  3608. @item
  3609. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3610. @example
  3611. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3612. @end example
  3613. @item
  3614. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3615. and also with custom gain:
  3616. @example
  3617. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3618. @end example
  3619. @end itemize
  3620. @section stereotools
  3621. This filter has some handy utilities to manage stereo signals, for converting
  3622. M/S stereo recordings to L/R signal while having control over the parameters
  3623. or spreading the stereo image of master track.
  3624. The filter accepts the following options:
  3625. @table @option
  3626. @item level_in
  3627. Set input level before filtering for both channels. Defaults is 1.
  3628. Allowed range is from 0.015625 to 64.
  3629. @item level_out
  3630. Set output level after filtering for both channels. Defaults is 1.
  3631. Allowed range is from 0.015625 to 64.
  3632. @item balance_in
  3633. Set input balance between both channels. Default is 0.
  3634. Allowed range is from -1 to 1.
  3635. @item balance_out
  3636. Set output balance between both channels. Default is 0.
  3637. Allowed range is from -1 to 1.
  3638. @item softclip
  3639. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3640. clipping. Disabled by default.
  3641. @item mutel
  3642. Mute the left channel. Disabled by default.
  3643. @item muter
  3644. Mute the right channel. Disabled by default.
  3645. @item phasel
  3646. Change the phase of the left channel. Disabled by default.
  3647. @item phaser
  3648. Change the phase of the right channel. Disabled by default.
  3649. @item mode
  3650. Set stereo mode. Available values are:
  3651. @table @samp
  3652. @item lr>lr
  3653. Left/Right to Left/Right, this is default.
  3654. @item lr>ms
  3655. Left/Right to Mid/Side.
  3656. @item ms>lr
  3657. Mid/Side to Left/Right.
  3658. @item lr>ll
  3659. Left/Right to Left/Left.
  3660. @item lr>rr
  3661. Left/Right to Right/Right.
  3662. @item lr>l+r
  3663. Left/Right to Left + Right.
  3664. @item lr>rl
  3665. Left/Right to Right/Left.
  3666. @item ms>ll
  3667. Mid/Side to Left/Left.
  3668. @item ms>rr
  3669. Mid/Side to Right/Right.
  3670. @end table
  3671. @item slev
  3672. Set level of side signal. Default is 1.
  3673. Allowed range is from 0.015625 to 64.
  3674. @item sbal
  3675. Set balance of side signal. Default is 0.
  3676. Allowed range is from -1 to 1.
  3677. @item mlev
  3678. Set level of the middle signal. Default is 1.
  3679. Allowed range is from 0.015625 to 64.
  3680. @item mpan
  3681. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3682. @item base
  3683. Set stereo base between mono and inversed channels. Default is 0.
  3684. Allowed range is from -1 to 1.
  3685. @item delay
  3686. Set delay in milliseconds how much to delay left from right channel and
  3687. vice versa. Default is 0. Allowed range is from -20 to 20.
  3688. @item sclevel
  3689. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3690. @item phase
  3691. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3692. @item bmode_in, bmode_out
  3693. Set balance mode for balance_in/balance_out option.
  3694. Can be one of the following:
  3695. @table @samp
  3696. @item balance
  3697. Classic balance mode. Attenuate one channel at time.
  3698. Gain is raised up to 1.
  3699. @item amplitude
  3700. Similar as classic mode above but gain is raised up to 2.
  3701. @item power
  3702. Equal power distribution, from -6dB to +6dB range.
  3703. @end table
  3704. @end table
  3705. @subsection Examples
  3706. @itemize
  3707. @item
  3708. Apply karaoke like effect:
  3709. @example
  3710. stereotools=mlev=0.015625
  3711. @end example
  3712. @item
  3713. Convert M/S signal to L/R:
  3714. @example
  3715. "stereotools=mode=ms>lr"
  3716. @end example
  3717. @end itemize
  3718. @section stereowiden
  3719. This filter enhance the stereo effect by suppressing signal common to both
  3720. channels and by delaying the signal of left into right and vice versa,
  3721. thereby widening the stereo effect.
  3722. The filter accepts the following options:
  3723. @table @option
  3724. @item delay
  3725. Time in milliseconds of the delay of left signal into right and vice versa.
  3726. Default is 20 milliseconds.
  3727. @item feedback
  3728. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3729. effect of left signal in right output and vice versa which gives widening
  3730. effect. Default is 0.3.
  3731. @item crossfeed
  3732. Cross feed of left into right with inverted phase. This helps in suppressing
  3733. the mono. If the value is 1 it will cancel all the signal common to both
  3734. channels. Default is 0.3.
  3735. @item drymix
  3736. Set level of input signal of original channel. Default is 0.8.
  3737. @end table
  3738. @section superequalizer
  3739. Apply 18 band equalizer.
  3740. The filter accepts the following options:
  3741. @table @option
  3742. @item 1b
  3743. Set 65Hz band gain.
  3744. @item 2b
  3745. Set 92Hz band gain.
  3746. @item 3b
  3747. Set 131Hz band gain.
  3748. @item 4b
  3749. Set 185Hz band gain.
  3750. @item 5b
  3751. Set 262Hz band gain.
  3752. @item 6b
  3753. Set 370Hz band gain.
  3754. @item 7b
  3755. Set 523Hz band gain.
  3756. @item 8b
  3757. Set 740Hz band gain.
  3758. @item 9b
  3759. Set 1047Hz band gain.
  3760. @item 10b
  3761. Set 1480Hz band gain.
  3762. @item 11b
  3763. Set 2093Hz band gain.
  3764. @item 12b
  3765. Set 2960Hz band gain.
  3766. @item 13b
  3767. Set 4186Hz band gain.
  3768. @item 14b
  3769. Set 5920Hz band gain.
  3770. @item 15b
  3771. Set 8372Hz band gain.
  3772. @item 16b
  3773. Set 11840Hz band gain.
  3774. @item 17b
  3775. Set 16744Hz band gain.
  3776. @item 18b
  3777. Set 20000Hz band gain.
  3778. @end table
  3779. @section surround
  3780. Apply audio surround upmix filter.
  3781. This filter allows to produce multichannel output from audio stream.
  3782. The filter accepts the following options:
  3783. @table @option
  3784. @item chl_out
  3785. Set output channel layout. By default, this is @var{5.1}.
  3786. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3787. for the required syntax.
  3788. @item chl_in
  3789. Set input channel layout. By default, this is @var{stereo}.
  3790. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3791. for the required syntax.
  3792. @item level_in
  3793. Set input volume level. By default, this is @var{1}.
  3794. @item level_out
  3795. Set output volume level. By default, this is @var{1}.
  3796. @item lfe
  3797. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3798. @item lfe_low
  3799. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3800. @item lfe_high
  3801. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3802. @item lfe_mode
  3803. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  3804. In @var{add} mode, LFE channel is created from input audio and added to output.
  3805. In @var{sub} mode, LFE channel is created from input audio and added to output but
  3806. also all non-LFE output channels are subtracted with output LFE channel.
  3807. @item fc_in
  3808. Set front center input volume. By default, this is @var{1}.
  3809. @item fc_out
  3810. Set front center output volume. By default, this is @var{1}.
  3811. @item fl_in
  3812. Set front left input volume. By default, this is @var{1}.
  3813. @item fl_out
  3814. Set front left output volume. By default, this is @var{1}.
  3815. @item fr_in
  3816. Set front right input volume. By default, this is @var{1}.
  3817. @item fr_out
  3818. Set front right output volume. By default, this is @var{1}.
  3819. @item sl_in
  3820. Set side left input volume. By default, this is @var{1}.
  3821. @item sl_out
  3822. Set side left output volume. By default, this is @var{1}.
  3823. @item sr_in
  3824. Set side right input volume. By default, this is @var{1}.
  3825. @item sr_out
  3826. Set side right output volume. By default, this is @var{1}.
  3827. @item bl_in
  3828. Set back left input volume. By default, this is @var{1}.
  3829. @item bl_out
  3830. Set back left output volume. By default, this is @var{1}.
  3831. @item br_in
  3832. Set back right input volume. By default, this is @var{1}.
  3833. @item br_out
  3834. Set back right output volume. By default, this is @var{1}.
  3835. @item bc_in
  3836. Set back center input volume. By default, this is @var{1}.
  3837. @item bc_out
  3838. Set back center output volume. By default, this is @var{1}.
  3839. @item lfe_in
  3840. Set LFE input volume. By default, this is @var{1}.
  3841. @item lfe_out
  3842. Set LFE output volume. By default, this is @var{1}.
  3843. @item allx
  3844. Set spread usage of stereo image across X axis for all channels.
  3845. @item ally
  3846. Set spread usage of stereo image across Y axis for all channels.
  3847. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  3848. Set spread usage of stereo image across X axis for each channel.
  3849. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  3850. Set spread usage of stereo image across Y axis for each channel.
  3851. @item win_size
  3852. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  3853. @item win_func
  3854. Set window function.
  3855. It accepts the following values:
  3856. @table @samp
  3857. @item rect
  3858. @item bartlett
  3859. @item hann, hanning
  3860. @item hamming
  3861. @item blackman
  3862. @item welch
  3863. @item flattop
  3864. @item bharris
  3865. @item bnuttall
  3866. @item bhann
  3867. @item sine
  3868. @item nuttall
  3869. @item lanczos
  3870. @item gauss
  3871. @item tukey
  3872. @item dolph
  3873. @item cauchy
  3874. @item parzen
  3875. @item poisson
  3876. @item bohman
  3877. @end table
  3878. Default is @code{hann}.
  3879. @item overlap
  3880. Set window overlap. If set to 1, the recommended overlap for selected
  3881. window function will be picked. Default is @code{0.5}.
  3882. @end table
  3883. @section treble, highshelf
  3884. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3885. shelving filter with a response similar to that of a standard
  3886. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3887. The filter accepts the following options:
  3888. @table @option
  3889. @item gain, g
  3890. Give the gain at whichever is the lower of ~22 kHz and the
  3891. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3892. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3893. @item frequency, f
  3894. Set the filter's central frequency and so can be used
  3895. to extend or reduce the frequency range to be boosted or cut.
  3896. The default value is @code{3000} Hz.
  3897. @item width_type, t
  3898. Set method to specify band-width of filter.
  3899. @table @option
  3900. @item h
  3901. Hz
  3902. @item q
  3903. Q-Factor
  3904. @item o
  3905. octave
  3906. @item s
  3907. slope
  3908. @item k
  3909. kHz
  3910. @end table
  3911. @item width, w
  3912. Determine how steep is the filter's shelf transition.
  3913. @item channels, c
  3914. Specify which channels to filter, by default all available are filtered.
  3915. @end table
  3916. @subsection Commands
  3917. This filter supports the following commands:
  3918. @table @option
  3919. @item frequency, f
  3920. Change treble frequency.
  3921. Syntax for the command is : "@var{frequency}"
  3922. @item width_type, t
  3923. Change treble width_type.
  3924. Syntax for the command is : "@var{width_type}"
  3925. @item width, w
  3926. Change treble width.
  3927. Syntax for the command is : "@var{width}"
  3928. @item gain, g
  3929. Change treble gain.
  3930. Syntax for the command is : "@var{gain}"
  3931. @end table
  3932. @section tremolo
  3933. Sinusoidal amplitude modulation.
  3934. The filter accepts the following options:
  3935. @table @option
  3936. @item f
  3937. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3938. (20 Hz or lower) will result in a tremolo effect.
  3939. This filter may also be used as a ring modulator by specifying
  3940. a modulation frequency higher than 20 Hz.
  3941. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3942. @item d
  3943. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3944. Default value is 0.5.
  3945. @end table
  3946. @section vibrato
  3947. Sinusoidal phase modulation.
  3948. The filter accepts the following options:
  3949. @table @option
  3950. @item f
  3951. Modulation frequency in Hertz.
  3952. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3953. @item d
  3954. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3955. Default value is 0.5.
  3956. @end table
  3957. @section volume
  3958. Adjust the input audio volume.
  3959. It accepts the following parameters:
  3960. @table @option
  3961. @item volume
  3962. Set audio volume expression.
  3963. Output values are clipped to the maximum value.
  3964. The output audio volume is given by the relation:
  3965. @example
  3966. @var{output_volume} = @var{volume} * @var{input_volume}
  3967. @end example
  3968. The default value for @var{volume} is "1.0".
  3969. @item precision
  3970. This parameter represents the mathematical precision.
  3971. It determines which input sample formats will be allowed, which affects the
  3972. precision of the volume scaling.
  3973. @table @option
  3974. @item fixed
  3975. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3976. @item float
  3977. 32-bit floating-point; this limits input sample format to FLT. (default)
  3978. @item double
  3979. 64-bit floating-point; this limits input sample format to DBL.
  3980. @end table
  3981. @item replaygain
  3982. Choose the behaviour on encountering ReplayGain side data in input frames.
  3983. @table @option
  3984. @item drop
  3985. Remove ReplayGain side data, ignoring its contents (the default).
  3986. @item ignore
  3987. Ignore ReplayGain side data, but leave it in the frame.
  3988. @item track
  3989. Prefer the track gain, if present.
  3990. @item album
  3991. Prefer the album gain, if present.
  3992. @end table
  3993. @item replaygain_preamp
  3994. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3995. Default value for @var{replaygain_preamp} is 0.0.
  3996. @item eval
  3997. Set when the volume expression is evaluated.
  3998. It accepts the following values:
  3999. @table @samp
  4000. @item once
  4001. only evaluate expression once during the filter initialization, or
  4002. when the @samp{volume} command is sent
  4003. @item frame
  4004. evaluate expression for each incoming frame
  4005. @end table
  4006. Default value is @samp{once}.
  4007. @end table
  4008. The volume expression can contain the following parameters.
  4009. @table @option
  4010. @item n
  4011. frame number (starting at zero)
  4012. @item nb_channels
  4013. number of channels
  4014. @item nb_consumed_samples
  4015. number of samples consumed by the filter
  4016. @item nb_samples
  4017. number of samples in the current frame
  4018. @item pos
  4019. original frame position in the file
  4020. @item pts
  4021. frame PTS
  4022. @item sample_rate
  4023. sample rate
  4024. @item startpts
  4025. PTS at start of stream
  4026. @item startt
  4027. time at start of stream
  4028. @item t
  4029. frame time
  4030. @item tb
  4031. timestamp timebase
  4032. @item volume
  4033. last set volume value
  4034. @end table
  4035. Note that when @option{eval} is set to @samp{once} only the
  4036. @var{sample_rate} and @var{tb} variables are available, all other
  4037. variables will evaluate to NAN.
  4038. @subsection Commands
  4039. This filter supports the following commands:
  4040. @table @option
  4041. @item volume
  4042. Modify the volume expression.
  4043. The command accepts the same syntax of the corresponding option.
  4044. If the specified expression is not valid, it is kept at its current
  4045. value.
  4046. @item replaygain_noclip
  4047. Prevent clipping by limiting the gain applied.
  4048. Default value for @var{replaygain_noclip} is 1.
  4049. @end table
  4050. @subsection Examples
  4051. @itemize
  4052. @item
  4053. Halve the input audio volume:
  4054. @example
  4055. volume=volume=0.5
  4056. volume=volume=1/2
  4057. volume=volume=-6.0206dB
  4058. @end example
  4059. In all the above example the named key for @option{volume} can be
  4060. omitted, for example like in:
  4061. @example
  4062. volume=0.5
  4063. @end example
  4064. @item
  4065. Increase input audio power by 6 decibels using fixed-point precision:
  4066. @example
  4067. volume=volume=6dB:precision=fixed
  4068. @end example
  4069. @item
  4070. Fade volume after time 10 with an annihilation period of 5 seconds:
  4071. @example
  4072. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4073. @end example
  4074. @end itemize
  4075. @section volumedetect
  4076. Detect the volume of the input video.
  4077. The filter has no parameters. The input is not modified. Statistics about
  4078. the volume will be printed in the log when the input stream end is reached.
  4079. In particular it will show the mean volume (root mean square), maximum
  4080. volume (on a per-sample basis), and the beginning of a histogram of the
  4081. registered volume values (from the maximum value to a cumulated 1/1000 of
  4082. the samples).
  4083. All volumes are in decibels relative to the maximum PCM value.
  4084. @subsection Examples
  4085. Here is an excerpt of the output:
  4086. @example
  4087. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4088. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4089. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4090. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4091. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4092. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4093. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4094. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4095. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4096. @end example
  4097. It means that:
  4098. @itemize
  4099. @item
  4100. The mean square energy is approximately -27 dB, or 10^-2.7.
  4101. @item
  4102. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4103. @item
  4104. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4105. @end itemize
  4106. In other words, raising the volume by +4 dB does not cause any clipping,
  4107. raising it by +5 dB causes clipping for 6 samples, etc.
  4108. @c man end AUDIO FILTERS
  4109. @chapter Audio Sources
  4110. @c man begin AUDIO SOURCES
  4111. Below is a description of the currently available audio sources.
  4112. @section abuffer
  4113. Buffer audio frames, and make them available to the filter chain.
  4114. This source is mainly intended for a programmatic use, in particular
  4115. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4116. It accepts the following parameters:
  4117. @table @option
  4118. @item time_base
  4119. The timebase which will be used for timestamps of submitted frames. It must be
  4120. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4121. @item sample_rate
  4122. The sample rate of the incoming audio buffers.
  4123. @item sample_fmt
  4124. The sample format of the incoming audio buffers.
  4125. Either a sample format name or its corresponding integer representation from
  4126. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4127. @item channel_layout
  4128. The channel layout of the incoming audio buffers.
  4129. Either a channel layout name from channel_layout_map in
  4130. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4131. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4132. @item channels
  4133. The number of channels of the incoming audio buffers.
  4134. If both @var{channels} and @var{channel_layout} are specified, then they
  4135. must be consistent.
  4136. @end table
  4137. @subsection Examples
  4138. @example
  4139. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4140. @end example
  4141. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4142. Since the sample format with name "s16p" corresponds to the number
  4143. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4144. equivalent to:
  4145. @example
  4146. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4147. @end example
  4148. @section aevalsrc
  4149. Generate an audio signal specified by an expression.
  4150. This source accepts in input one or more expressions (one for each
  4151. channel), which are evaluated and used to generate a corresponding
  4152. audio signal.
  4153. This source accepts the following options:
  4154. @table @option
  4155. @item exprs
  4156. Set the '|'-separated expressions list for each separate channel. In case the
  4157. @option{channel_layout} option is not specified, the selected channel layout
  4158. depends on the number of provided expressions. Otherwise the last
  4159. specified expression is applied to the remaining output channels.
  4160. @item channel_layout, c
  4161. Set the channel layout. The number of channels in the specified layout
  4162. must be equal to the number of specified expressions.
  4163. @item duration, d
  4164. Set the minimum duration of the sourced audio. See
  4165. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4166. for the accepted syntax.
  4167. Note that the resulting duration may be greater than the specified
  4168. duration, as the generated audio is always cut at the end of a
  4169. complete frame.
  4170. If not specified, or the expressed duration is negative, the audio is
  4171. supposed to be generated forever.
  4172. @item nb_samples, n
  4173. Set the number of samples per channel per each output frame,
  4174. default to 1024.
  4175. @item sample_rate, s
  4176. Specify the sample rate, default to 44100.
  4177. @end table
  4178. Each expression in @var{exprs} can contain the following constants:
  4179. @table @option
  4180. @item n
  4181. number of the evaluated sample, starting from 0
  4182. @item t
  4183. time of the evaluated sample expressed in seconds, starting from 0
  4184. @item s
  4185. sample rate
  4186. @end table
  4187. @subsection Examples
  4188. @itemize
  4189. @item
  4190. Generate silence:
  4191. @example
  4192. aevalsrc=0
  4193. @end example
  4194. @item
  4195. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4196. 8000 Hz:
  4197. @example
  4198. aevalsrc="sin(440*2*PI*t):s=8000"
  4199. @end example
  4200. @item
  4201. Generate a two channels signal, specify the channel layout (Front
  4202. Center + Back Center) explicitly:
  4203. @example
  4204. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4205. @end example
  4206. @item
  4207. Generate white noise:
  4208. @example
  4209. aevalsrc="-2+random(0)"
  4210. @end example
  4211. @item
  4212. Generate an amplitude modulated signal:
  4213. @example
  4214. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4215. @end example
  4216. @item
  4217. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4218. @example
  4219. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4220. @end example
  4221. @end itemize
  4222. @section anullsrc
  4223. The null audio source, return unprocessed audio frames. It is mainly useful
  4224. as a template and to be employed in analysis / debugging tools, or as
  4225. the source for filters which ignore the input data (for example the sox
  4226. synth filter).
  4227. This source accepts the following options:
  4228. @table @option
  4229. @item channel_layout, cl
  4230. Specifies the channel layout, and can be either an integer or a string
  4231. representing a channel layout. The default value of @var{channel_layout}
  4232. is "stereo".
  4233. Check the channel_layout_map definition in
  4234. @file{libavutil/channel_layout.c} for the mapping between strings and
  4235. channel layout values.
  4236. @item sample_rate, r
  4237. Specifies the sample rate, and defaults to 44100.
  4238. @item nb_samples, n
  4239. Set the number of samples per requested frames.
  4240. @end table
  4241. @subsection Examples
  4242. @itemize
  4243. @item
  4244. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4245. @example
  4246. anullsrc=r=48000:cl=4
  4247. @end example
  4248. @item
  4249. Do the same operation with a more obvious syntax:
  4250. @example
  4251. anullsrc=r=48000:cl=mono
  4252. @end example
  4253. @end itemize
  4254. All the parameters need to be explicitly defined.
  4255. @section flite
  4256. Synthesize a voice utterance using the libflite library.
  4257. To enable compilation of this filter you need to configure FFmpeg with
  4258. @code{--enable-libflite}.
  4259. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4260. The filter accepts the following options:
  4261. @table @option
  4262. @item list_voices
  4263. If set to 1, list the names of the available voices and exit
  4264. immediately. Default value is 0.
  4265. @item nb_samples, n
  4266. Set the maximum number of samples per frame. Default value is 512.
  4267. @item textfile
  4268. Set the filename containing the text to speak.
  4269. @item text
  4270. Set the text to speak.
  4271. @item voice, v
  4272. Set the voice to use for the speech synthesis. Default value is
  4273. @code{kal}. See also the @var{list_voices} option.
  4274. @end table
  4275. @subsection Examples
  4276. @itemize
  4277. @item
  4278. Read from file @file{speech.txt}, and synthesize the text using the
  4279. standard flite voice:
  4280. @example
  4281. flite=textfile=speech.txt
  4282. @end example
  4283. @item
  4284. Read the specified text selecting the @code{slt} voice:
  4285. @example
  4286. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4287. @end example
  4288. @item
  4289. Input text to ffmpeg:
  4290. @example
  4291. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4292. @end example
  4293. @item
  4294. Make @file{ffplay} speak the specified text, using @code{flite} and
  4295. the @code{lavfi} device:
  4296. @example
  4297. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4298. @end example
  4299. @end itemize
  4300. For more information about libflite, check:
  4301. @url{http://www.festvox.org/flite/}
  4302. @section anoisesrc
  4303. Generate a noise audio signal.
  4304. The filter accepts the following options:
  4305. @table @option
  4306. @item sample_rate, r
  4307. Specify the sample rate. Default value is 48000 Hz.
  4308. @item amplitude, a
  4309. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4310. is 1.0.
  4311. @item duration, d
  4312. Specify the duration of the generated audio stream. Not specifying this option
  4313. results in noise with an infinite length.
  4314. @item color, colour, c
  4315. Specify the color of noise. Available noise colors are white, pink, brown,
  4316. blue and violet. Default color is white.
  4317. @item seed, s
  4318. Specify a value used to seed the PRNG.
  4319. @item nb_samples, n
  4320. Set the number of samples per each output frame, default is 1024.
  4321. @end table
  4322. @subsection Examples
  4323. @itemize
  4324. @item
  4325. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4326. @example
  4327. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4328. @end example
  4329. @end itemize
  4330. @section hilbert
  4331. Generate odd-tap Hilbert transform FIR coefficients.
  4332. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4333. the signal by 90 degrees.
  4334. This is used in many matrix coding schemes and for analytic signal generation.
  4335. The process is often written as a multiplication by i (or j), the imaginary unit.
  4336. The filter accepts the following options:
  4337. @table @option
  4338. @item sample_rate, s
  4339. Set sample rate, default is 44100.
  4340. @item taps, t
  4341. Set length of FIR filter, default is 22051.
  4342. @item nb_samples, n
  4343. Set number of samples per each frame.
  4344. @item win_func, w
  4345. Set window function to be used when generating FIR coefficients.
  4346. @end table
  4347. @section sinc
  4348. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4349. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4350. The filter accepts the following options:
  4351. @table @option
  4352. @item sample_rate, r
  4353. Set sample rate, default is 44100.
  4354. @item nb_samples, n
  4355. Set number of samples per each frame. Default is 1024.
  4356. @item hp
  4357. Set high-pass frequency. Default is 0.
  4358. @item lp
  4359. Set low-pass frequency. Default is 0.
  4360. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4361. is higher than 0 then filter will create band-pass filter coefficients,
  4362. otherwise band-reject filter coefficients.
  4363. @item phase
  4364. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4365. @item beta
  4366. Set Kaiser window beta.
  4367. @item att
  4368. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4369. @item round
  4370. Enable rounding, by default is disabled.
  4371. @item hptaps
  4372. Set number of taps for high-pass filter.
  4373. @item lptaps
  4374. Set number of taps for low-pass filter.
  4375. @end table
  4376. @section sine
  4377. Generate an audio signal made of a sine wave with amplitude 1/8.
  4378. The audio signal is bit-exact.
  4379. The filter accepts the following options:
  4380. @table @option
  4381. @item frequency, f
  4382. Set the carrier frequency. Default is 440 Hz.
  4383. @item beep_factor, b
  4384. Enable a periodic beep every second with frequency @var{beep_factor} times
  4385. the carrier frequency. Default is 0, meaning the beep is disabled.
  4386. @item sample_rate, r
  4387. Specify the sample rate, default is 44100.
  4388. @item duration, d
  4389. Specify the duration of the generated audio stream.
  4390. @item samples_per_frame
  4391. Set the number of samples per output frame.
  4392. The expression can contain the following constants:
  4393. @table @option
  4394. @item n
  4395. The (sequential) number of the output audio frame, starting from 0.
  4396. @item pts
  4397. The PTS (Presentation TimeStamp) of the output audio frame,
  4398. expressed in @var{TB} units.
  4399. @item t
  4400. The PTS of the output audio frame, expressed in seconds.
  4401. @item TB
  4402. The timebase of the output audio frames.
  4403. @end table
  4404. Default is @code{1024}.
  4405. @end table
  4406. @subsection Examples
  4407. @itemize
  4408. @item
  4409. Generate a simple 440 Hz sine wave:
  4410. @example
  4411. sine
  4412. @end example
  4413. @item
  4414. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4415. @example
  4416. sine=220:4:d=5
  4417. sine=f=220:b=4:d=5
  4418. sine=frequency=220:beep_factor=4:duration=5
  4419. @end example
  4420. @item
  4421. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4422. pattern:
  4423. @example
  4424. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4425. @end example
  4426. @end itemize
  4427. @c man end AUDIO SOURCES
  4428. @chapter Audio Sinks
  4429. @c man begin AUDIO SINKS
  4430. Below is a description of the currently available audio sinks.
  4431. @section abuffersink
  4432. Buffer audio frames, and make them available to the end of filter chain.
  4433. This sink is mainly intended for programmatic use, in particular
  4434. through the interface defined in @file{libavfilter/buffersink.h}
  4435. or the options system.
  4436. It accepts a pointer to an AVABufferSinkContext structure, which
  4437. defines the incoming buffers' formats, to be passed as the opaque
  4438. parameter to @code{avfilter_init_filter} for initialization.
  4439. @section anullsink
  4440. Null audio sink; do absolutely nothing with the input audio. It is
  4441. mainly useful as a template and for use in analysis / debugging
  4442. tools.
  4443. @c man end AUDIO SINKS
  4444. @chapter Video Filters
  4445. @c man begin VIDEO FILTERS
  4446. When you configure your FFmpeg build, you can disable any of the
  4447. existing filters using @code{--disable-filters}.
  4448. The configure output will show the video filters included in your
  4449. build.
  4450. Below is a description of the currently available video filters.
  4451. @section alphaextract
  4452. Extract the alpha component from the input as a grayscale video. This
  4453. is especially useful with the @var{alphamerge} filter.
  4454. @section alphamerge
  4455. Add or replace the alpha component of the primary input with the
  4456. grayscale value of a second input. This is intended for use with
  4457. @var{alphaextract} to allow the transmission or storage of frame
  4458. sequences that have alpha in a format that doesn't support an alpha
  4459. channel.
  4460. For example, to reconstruct full frames from a normal YUV-encoded video
  4461. and a separate video created with @var{alphaextract}, you might use:
  4462. @example
  4463. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4464. @end example
  4465. Since this filter is designed for reconstruction, it operates on frame
  4466. sequences without considering timestamps, and terminates when either
  4467. input reaches end of stream. This will cause problems if your encoding
  4468. pipeline drops frames. If you're trying to apply an image as an
  4469. overlay to a video stream, consider the @var{overlay} filter instead.
  4470. @section amplify
  4471. Amplify differences between current pixel and pixels of adjacent frames in
  4472. same pixel location.
  4473. This filter accepts the following options:
  4474. @table @option
  4475. @item radius
  4476. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4477. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4478. @item factor
  4479. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4480. @item threshold
  4481. Set threshold for difference amplification. Any difference greater or equal to
  4482. this value will not alter source pixel. Default is 10.
  4483. Allowed range is from 0 to 65535.
  4484. @item tolerance
  4485. Set tolerance for difference amplification. Any difference lower to
  4486. this value will not alter source pixel. Default is 0.
  4487. Allowed range is from 0 to 65535.
  4488. @item low
  4489. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4490. This option controls maximum possible value that will decrease source pixel value.
  4491. @item high
  4492. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4493. This option controls maximum possible value that will increase source pixel value.
  4494. @item planes
  4495. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4496. @end table
  4497. @section ass
  4498. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4499. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4500. Substation Alpha) subtitles files.
  4501. This filter accepts the following option in addition to the common options from
  4502. the @ref{subtitles} filter:
  4503. @table @option
  4504. @item shaping
  4505. Set the shaping engine
  4506. Available values are:
  4507. @table @samp
  4508. @item auto
  4509. The default libass shaping engine, which is the best available.
  4510. @item simple
  4511. Fast, font-agnostic shaper that can do only substitutions
  4512. @item complex
  4513. Slower shaper using OpenType for substitutions and positioning
  4514. @end table
  4515. The default is @code{auto}.
  4516. @end table
  4517. @section atadenoise
  4518. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4519. The filter accepts the following options:
  4520. @table @option
  4521. @item 0a
  4522. Set threshold A for 1st plane. Default is 0.02.
  4523. Valid range is 0 to 0.3.
  4524. @item 0b
  4525. Set threshold B for 1st plane. Default is 0.04.
  4526. Valid range is 0 to 5.
  4527. @item 1a
  4528. Set threshold A for 2nd plane. Default is 0.02.
  4529. Valid range is 0 to 0.3.
  4530. @item 1b
  4531. Set threshold B for 2nd plane. Default is 0.04.
  4532. Valid range is 0 to 5.
  4533. @item 2a
  4534. Set threshold A for 3rd plane. Default is 0.02.
  4535. Valid range is 0 to 0.3.
  4536. @item 2b
  4537. Set threshold B for 3rd plane. Default is 0.04.
  4538. Valid range is 0 to 5.
  4539. Threshold A is designed to react on abrupt changes in the input signal and
  4540. threshold B is designed to react on continuous changes in the input signal.
  4541. @item s
  4542. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4543. number in range [5, 129].
  4544. @item p
  4545. Set what planes of frame filter will use for averaging. Default is all.
  4546. @end table
  4547. @section avgblur
  4548. Apply average blur filter.
  4549. The filter accepts the following options:
  4550. @table @option
  4551. @item sizeX
  4552. Set horizontal radius size.
  4553. @item planes
  4554. Set which planes to filter. By default all planes are filtered.
  4555. @item sizeY
  4556. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4557. Default is @code{0}.
  4558. @end table
  4559. @section bbox
  4560. Compute the bounding box for the non-black pixels in the input frame
  4561. luminance plane.
  4562. This filter computes the bounding box containing all the pixels with a
  4563. luminance value greater than the minimum allowed value.
  4564. The parameters describing the bounding box are printed on the filter
  4565. log.
  4566. The filter accepts the following option:
  4567. @table @option
  4568. @item min_val
  4569. Set the minimal luminance value. Default is @code{16}.
  4570. @end table
  4571. @section bitplanenoise
  4572. Show and measure bit plane noise.
  4573. The filter accepts the following options:
  4574. @table @option
  4575. @item bitplane
  4576. Set which plane to analyze. Default is @code{1}.
  4577. @item filter
  4578. Filter out noisy pixels from @code{bitplane} set above.
  4579. Default is disabled.
  4580. @end table
  4581. @section blackdetect
  4582. Detect video intervals that are (almost) completely black. Can be
  4583. useful to detect chapter transitions, commercials, or invalid
  4584. recordings. Output lines contains the time for the start, end and
  4585. duration of the detected black interval expressed in seconds.
  4586. In order to display the output lines, you need to set the loglevel at
  4587. least to the AV_LOG_INFO value.
  4588. The filter accepts the following options:
  4589. @table @option
  4590. @item black_min_duration, d
  4591. Set the minimum detected black duration expressed in seconds. It must
  4592. be a non-negative floating point number.
  4593. Default value is 2.0.
  4594. @item picture_black_ratio_th, pic_th
  4595. Set the threshold for considering a picture "black".
  4596. Express the minimum value for the ratio:
  4597. @example
  4598. @var{nb_black_pixels} / @var{nb_pixels}
  4599. @end example
  4600. for which a picture is considered black.
  4601. Default value is 0.98.
  4602. @item pixel_black_th, pix_th
  4603. Set the threshold for considering a pixel "black".
  4604. The threshold expresses the maximum pixel luminance value for which a
  4605. pixel is considered "black". The provided value is scaled according to
  4606. the following equation:
  4607. @example
  4608. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4609. @end example
  4610. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4611. the input video format, the range is [0-255] for YUV full-range
  4612. formats and [16-235] for YUV non full-range formats.
  4613. Default value is 0.10.
  4614. @end table
  4615. The following example sets the maximum pixel threshold to the minimum
  4616. value, and detects only black intervals of 2 or more seconds:
  4617. @example
  4618. blackdetect=d=2:pix_th=0.00
  4619. @end example
  4620. @section blackframe
  4621. Detect frames that are (almost) completely black. Can be useful to
  4622. detect chapter transitions or commercials. Output lines consist of
  4623. the frame number of the detected frame, the percentage of blackness,
  4624. the position in the file if known or -1 and the timestamp in seconds.
  4625. In order to display the output lines, you need to set the loglevel at
  4626. least to the AV_LOG_INFO value.
  4627. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4628. The value represents the percentage of pixels in the picture that
  4629. are below the threshold value.
  4630. It accepts the following parameters:
  4631. @table @option
  4632. @item amount
  4633. The percentage of the pixels that have to be below the threshold; it defaults to
  4634. @code{98}.
  4635. @item threshold, thresh
  4636. The threshold below which a pixel value is considered black; it defaults to
  4637. @code{32}.
  4638. @end table
  4639. @section blend, tblend
  4640. Blend two video frames into each other.
  4641. The @code{blend} filter takes two input streams and outputs one
  4642. stream, the first input is the "top" layer and second input is
  4643. "bottom" layer. By default, the output terminates when the longest input terminates.
  4644. The @code{tblend} (time blend) filter takes two consecutive frames
  4645. from one single stream, and outputs the result obtained by blending
  4646. the new frame on top of the old frame.
  4647. A description of the accepted options follows.
  4648. @table @option
  4649. @item c0_mode
  4650. @item c1_mode
  4651. @item c2_mode
  4652. @item c3_mode
  4653. @item all_mode
  4654. Set blend mode for specific pixel component or all pixel components in case
  4655. of @var{all_mode}. Default value is @code{normal}.
  4656. Available values for component modes are:
  4657. @table @samp
  4658. @item addition
  4659. @item grainmerge
  4660. @item and
  4661. @item average
  4662. @item burn
  4663. @item darken
  4664. @item difference
  4665. @item grainextract
  4666. @item divide
  4667. @item dodge
  4668. @item freeze
  4669. @item exclusion
  4670. @item extremity
  4671. @item glow
  4672. @item hardlight
  4673. @item hardmix
  4674. @item heat
  4675. @item lighten
  4676. @item linearlight
  4677. @item multiply
  4678. @item multiply128
  4679. @item negation
  4680. @item normal
  4681. @item or
  4682. @item overlay
  4683. @item phoenix
  4684. @item pinlight
  4685. @item reflect
  4686. @item screen
  4687. @item softlight
  4688. @item subtract
  4689. @item vividlight
  4690. @item xor
  4691. @end table
  4692. @item c0_opacity
  4693. @item c1_opacity
  4694. @item c2_opacity
  4695. @item c3_opacity
  4696. @item all_opacity
  4697. Set blend opacity for specific pixel component or all pixel components in case
  4698. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4699. @item c0_expr
  4700. @item c1_expr
  4701. @item c2_expr
  4702. @item c3_expr
  4703. @item all_expr
  4704. Set blend expression for specific pixel component or all pixel components in case
  4705. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4706. The expressions can use the following variables:
  4707. @table @option
  4708. @item N
  4709. The sequential number of the filtered frame, starting from @code{0}.
  4710. @item X
  4711. @item Y
  4712. the coordinates of the current sample
  4713. @item W
  4714. @item H
  4715. the width and height of currently filtered plane
  4716. @item SW
  4717. @item SH
  4718. Width and height scale for the plane being filtered. It is the
  4719. ratio between the dimensions of the current plane to the luma plane,
  4720. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  4721. the luma plane and @code{0.5,0.5} for the chroma planes.
  4722. @item T
  4723. Time of the current frame, expressed in seconds.
  4724. @item TOP, A
  4725. Value of pixel component at current location for first video frame (top layer).
  4726. @item BOTTOM, B
  4727. Value of pixel component at current location for second video frame (bottom layer).
  4728. @end table
  4729. @end table
  4730. The @code{blend} filter also supports the @ref{framesync} options.
  4731. @subsection Examples
  4732. @itemize
  4733. @item
  4734. Apply transition from bottom layer to top layer in first 10 seconds:
  4735. @example
  4736. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4737. @end example
  4738. @item
  4739. Apply linear horizontal transition from top layer to bottom layer:
  4740. @example
  4741. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4742. @end example
  4743. @item
  4744. Apply 1x1 checkerboard effect:
  4745. @example
  4746. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4747. @end example
  4748. @item
  4749. Apply uncover left effect:
  4750. @example
  4751. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4752. @end example
  4753. @item
  4754. Apply uncover down effect:
  4755. @example
  4756. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4757. @end example
  4758. @item
  4759. Apply uncover up-left effect:
  4760. @example
  4761. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4762. @end example
  4763. @item
  4764. Split diagonally video and shows top and bottom layer on each side:
  4765. @example
  4766. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4767. @end example
  4768. @item
  4769. Display differences between the current and the previous frame:
  4770. @example
  4771. tblend=all_mode=grainextract
  4772. @end example
  4773. @end itemize
  4774. @section bm3d
  4775. Denoise frames using Block-Matching 3D algorithm.
  4776. The filter accepts the following options.
  4777. @table @option
  4778. @item sigma
  4779. Set denoising strength. Default value is 1.
  4780. Allowed range is from 0 to 999.9.
  4781. The denoising algorithm is very sensitive to sigma, so adjust it
  4782. according to the source.
  4783. @item block
  4784. Set local patch size. This sets dimensions in 2D.
  4785. @item bstep
  4786. Set sliding step for processing blocks. Default value is 4.
  4787. Allowed range is from 1 to 64.
  4788. Smaller values allows processing more reference blocks and is slower.
  4789. @item group
  4790. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  4791. When set to 1, no block matching is done. Larger values allows more blocks
  4792. in single group.
  4793. Allowed range is from 1 to 256.
  4794. @item range
  4795. Set radius for search block matching. Default is 9.
  4796. Allowed range is from 1 to INT32_MAX.
  4797. @item mstep
  4798. Set step between two search locations for block matching. Default is 1.
  4799. Allowed range is from 1 to 64. Smaller is slower.
  4800. @item thmse
  4801. Set threshold of mean square error for block matching. Valid range is 0 to
  4802. INT32_MAX.
  4803. @item hdthr
  4804. Set thresholding parameter for hard thresholding in 3D transformed domain.
  4805. Larger values results in stronger hard-thresholding filtering in frequency
  4806. domain.
  4807. @item estim
  4808. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  4809. Default is @code{basic}.
  4810. @item ref
  4811. If enabled, filter will use 2nd stream for block matching.
  4812. Default is disabled for @code{basic} value of @var{estim} option,
  4813. and always enabled if value of @var{estim} is @code{final}.
  4814. @item planes
  4815. Set planes to filter. Default is all available except alpha.
  4816. @end table
  4817. @subsection Examples
  4818. @itemize
  4819. @item
  4820. Basic filtering with bm3d:
  4821. @example
  4822. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  4823. @end example
  4824. @item
  4825. Same as above, but filtering only luma:
  4826. @example
  4827. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  4828. @end example
  4829. @item
  4830. Same as above, but with both estimation modes:
  4831. @example
  4832. split[a][b],[a]bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic[a],[b][a]bm3d=sigma=3:block=4:bstep=2:group=16:estim=final:ref=1
  4833. @end example
  4834. @item
  4835. Same as above, but prefilter with @ref{nlmeans} filter instead:
  4836. @example
  4837. split[a][b],[a]nlmeans=s=3:r=7:p=3[a],[b][a]bm3d=sigma=3:block=4:bstep=2:group=16:estim=final:ref=1
  4838. @end example
  4839. @end itemize
  4840. @section boxblur
  4841. Apply a boxblur algorithm to the input video.
  4842. It accepts the following parameters:
  4843. @table @option
  4844. @item luma_radius, lr
  4845. @item luma_power, lp
  4846. @item chroma_radius, cr
  4847. @item chroma_power, cp
  4848. @item alpha_radius, ar
  4849. @item alpha_power, ap
  4850. @end table
  4851. A description of the accepted options follows.
  4852. @table @option
  4853. @item luma_radius, lr
  4854. @item chroma_radius, cr
  4855. @item alpha_radius, ar
  4856. Set an expression for the box radius in pixels used for blurring the
  4857. corresponding input plane.
  4858. The radius value must be a non-negative number, and must not be
  4859. greater than the value of the expression @code{min(w,h)/2} for the
  4860. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4861. planes.
  4862. Default value for @option{luma_radius} is "2". If not specified,
  4863. @option{chroma_radius} and @option{alpha_radius} default to the
  4864. corresponding value set for @option{luma_radius}.
  4865. The expressions can contain the following constants:
  4866. @table @option
  4867. @item w
  4868. @item h
  4869. The input width and height in pixels.
  4870. @item cw
  4871. @item ch
  4872. The input chroma image width and height in pixels.
  4873. @item hsub
  4874. @item vsub
  4875. The horizontal and vertical chroma subsample values. For example, for the
  4876. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4877. @end table
  4878. @item luma_power, lp
  4879. @item chroma_power, cp
  4880. @item alpha_power, ap
  4881. Specify how many times the boxblur filter is applied to the
  4882. corresponding plane.
  4883. Default value for @option{luma_power} is 2. If not specified,
  4884. @option{chroma_power} and @option{alpha_power} default to the
  4885. corresponding value set for @option{luma_power}.
  4886. A value of 0 will disable the effect.
  4887. @end table
  4888. @subsection Examples
  4889. @itemize
  4890. @item
  4891. Apply a boxblur filter with the luma, chroma, and alpha radii
  4892. set to 2:
  4893. @example
  4894. boxblur=luma_radius=2:luma_power=1
  4895. boxblur=2:1
  4896. @end example
  4897. @item
  4898. Set the luma radius to 2, and alpha and chroma radius to 0:
  4899. @example
  4900. boxblur=2:1:cr=0:ar=0
  4901. @end example
  4902. @item
  4903. Set the luma and chroma radii to a fraction of the video dimension:
  4904. @example
  4905. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4906. @end example
  4907. @end itemize
  4908. @section bwdif
  4909. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4910. Deinterlacing Filter").
  4911. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4912. interpolation algorithms.
  4913. It accepts the following parameters:
  4914. @table @option
  4915. @item mode
  4916. The interlacing mode to adopt. It accepts one of the following values:
  4917. @table @option
  4918. @item 0, send_frame
  4919. Output one frame for each frame.
  4920. @item 1, send_field
  4921. Output one frame for each field.
  4922. @end table
  4923. The default value is @code{send_field}.
  4924. @item parity
  4925. The picture field parity assumed for the input interlaced video. It accepts one
  4926. of the following values:
  4927. @table @option
  4928. @item 0, tff
  4929. Assume the top field is first.
  4930. @item 1, bff
  4931. Assume the bottom field is first.
  4932. @item -1, auto
  4933. Enable automatic detection of field parity.
  4934. @end table
  4935. The default value is @code{auto}.
  4936. If the interlacing is unknown or the decoder does not export this information,
  4937. top field first will be assumed.
  4938. @item deint
  4939. Specify which frames to deinterlace. Accept one of the following
  4940. values:
  4941. @table @option
  4942. @item 0, all
  4943. Deinterlace all frames.
  4944. @item 1, interlaced
  4945. Only deinterlace frames marked as interlaced.
  4946. @end table
  4947. The default value is @code{all}.
  4948. @end table
  4949. @section chromahold
  4950. Remove all color information for all colors except for certain one.
  4951. The filter accepts the following options:
  4952. @table @option
  4953. @item color
  4954. The color which will not be replaced with neutral chroma.
  4955. @item similarity
  4956. Similarity percentage with the above color.
  4957. 0.01 matches only the exact key color, while 1.0 matches everything.
  4958. @item yuv
  4959. Signals that the color passed is already in YUV instead of RGB.
  4960. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4961. This can be used to pass exact YUV values as hexadecimal numbers.
  4962. @end table
  4963. @section chromakey
  4964. YUV colorspace color/chroma keying.
  4965. The filter accepts the following options:
  4966. @table @option
  4967. @item color
  4968. The color which will be replaced with transparency.
  4969. @item similarity
  4970. Similarity percentage with the key color.
  4971. 0.01 matches only the exact key color, while 1.0 matches everything.
  4972. @item blend
  4973. Blend percentage.
  4974. 0.0 makes pixels either fully transparent, or not transparent at all.
  4975. Higher values result in semi-transparent pixels, with a higher transparency
  4976. the more similar the pixels color is to the key color.
  4977. @item yuv
  4978. Signals that the color passed is already in YUV instead of RGB.
  4979. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4980. This can be used to pass exact YUV values as hexadecimal numbers.
  4981. @end table
  4982. @subsection Examples
  4983. @itemize
  4984. @item
  4985. Make every green pixel in the input image transparent:
  4986. @example
  4987. ffmpeg -i input.png -vf chromakey=green out.png
  4988. @end example
  4989. @item
  4990. Overlay a greenscreen-video on top of a static black background.
  4991. @example
  4992. ffmpeg -f lavfi -i color=c=black:s=1280x720 -i video.mp4 -shortest -filter_complex "[1:v]chromakey=0x70de77:0.1:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" output.mkv
  4993. @end example
  4994. @end itemize
  4995. @section chromashift
  4996. Shift chroma pixels horizontally and/or vertically.
  4997. The filter accepts the following options:
  4998. @table @option
  4999. @item cbh
  5000. Set amount to shift chroma-blue horizontally.
  5001. @item cbv
  5002. Set amount to shift chroma-blue vertically.
  5003. @item crh
  5004. Set amount to shift chroma-red horizontally.
  5005. @item crv
  5006. Set amount to shift chroma-red vertically.
  5007. @item edge
  5008. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5009. @end table
  5010. @section ciescope
  5011. Display CIE color diagram with pixels overlaid onto it.
  5012. The filter accepts the following options:
  5013. @table @option
  5014. @item system
  5015. Set color system.
  5016. @table @samp
  5017. @item ntsc, 470m
  5018. @item ebu, 470bg
  5019. @item smpte
  5020. @item 240m
  5021. @item apple
  5022. @item widergb
  5023. @item cie1931
  5024. @item rec709, hdtv
  5025. @item uhdtv, rec2020
  5026. @end table
  5027. @item cie
  5028. Set CIE system.
  5029. @table @samp
  5030. @item xyy
  5031. @item ucs
  5032. @item luv
  5033. @end table
  5034. @item gamuts
  5035. Set what gamuts to draw.
  5036. See @code{system} option for available values.
  5037. @item size, s
  5038. Set ciescope size, by default set to 512.
  5039. @item intensity, i
  5040. Set intensity used to map input pixel values to CIE diagram.
  5041. @item contrast
  5042. Set contrast used to draw tongue colors that are out of active color system gamut.
  5043. @item corrgamma
  5044. Correct gamma displayed on scope, by default enabled.
  5045. @item showwhite
  5046. Show white point on CIE diagram, by default disabled.
  5047. @item gamma
  5048. Set input gamma. Used only with XYZ input color space.
  5049. @end table
  5050. @section codecview
  5051. Visualize information exported by some codecs.
  5052. Some codecs can export information through frames using side-data or other
  5053. means. For example, some MPEG based codecs export motion vectors through the
  5054. @var{export_mvs} flag in the codec @option{flags2} option.
  5055. The filter accepts the following option:
  5056. @table @option
  5057. @item mv
  5058. Set motion vectors to visualize.
  5059. Available flags for @var{mv} are:
  5060. @table @samp
  5061. @item pf
  5062. forward predicted MVs of P-frames
  5063. @item bf
  5064. forward predicted MVs of B-frames
  5065. @item bb
  5066. backward predicted MVs of B-frames
  5067. @end table
  5068. @item qp
  5069. Display quantization parameters using the chroma planes.
  5070. @item mv_type, mvt
  5071. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5072. Available flags for @var{mv_type} are:
  5073. @table @samp
  5074. @item fp
  5075. forward predicted MVs
  5076. @item bp
  5077. backward predicted MVs
  5078. @end table
  5079. @item frame_type, ft
  5080. Set frame type to visualize motion vectors of.
  5081. Available flags for @var{frame_type} are:
  5082. @table @samp
  5083. @item if
  5084. intra-coded frames (I-frames)
  5085. @item pf
  5086. predicted frames (P-frames)
  5087. @item bf
  5088. bi-directionally predicted frames (B-frames)
  5089. @end table
  5090. @end table
  5091. @subsection Examples
  5092. @itemize
  5093. @item
  5094. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5095. @example
  5096. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5097. @end example
  5098. @item
  5099. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5100. @example
  5101. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5102. @end example
  5103. @end itemize
  5104. @section colorbalance
  5105. Modify intensity of primary colors (red, green and blue) of input frames.
  5106. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5107. regions for the red-cyan, green-magenta or blue-yellow balance.
  5108. A positive adjustment value shifts the balance towards the primary color, a negative
  5109. value towards the complementary color.
  5110. The filter accepts the following options:
  5111. @table @option
  5112. @item rs
  5113. @item gs
  5114. @item bs
  5115. Adjust red, green and blue shadows (darkest pixels).
  5116. @item rm
  5117. @item gm
  5118. @item bm
  5119. Adjust red, green and blue midtones (medium pixels).
  5120. @item rh
  5121. @item gh
  5122. @item bh
  5123. Adjust red, green and blue highlights (brightest pixels).
  5124. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5125. @end table
  5126. @subsection Examples
  5127. @itemize
  5128. @item
  5129. Add red color cast to shadows:
  5130. @example
  5131. colorbalance=rs=.3
  5132. @end example
  5133. @end itemize
  5134. @section colorkey
  5135. RGB colorspace color keying.
  5136. The filter accepts the following options:
  5137. @table @option
  5138. @item color
  5139. The color which will be replaced with transparency.
  5140. @item similarity
  5141. Similarity percentage with the key color.
  5142. 0.01 matches only the exact key color, while 1.0 matches everything.
  5143. @item blend
  5144. Blend percentage.
  5145. 0.0 makes pixels either fully transparent, or not transparent at all.
  5146. Higher values result in semi-transparent pixels, with a higher transparency
  5147. the more similar the pixels color is to the key color.
  5148. @end table
  5149. @subsection Examples
  5150. @itemize
  5151. @item
  5152. Make every green pixel in the input image transparent:
  5153. @example
  5154. ffmpeg -i input.png -vf colorkey=green out.png
  5155. @end example
  5156. @item
  5157. Overlay a greenscreen-video on top of a static background image.
  5158. @example
  5159. ffmpeg -i background.png -i video.mp4 -filter_complex "[1:v]colorkey=0x3BBD1E:0.3:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" output.flv
  5160. @end example
  5161. @end itemize
  5162. @section colorlevels
  5163. Adjust video input frames using levels.
  5164. The filter accepts the following options:
  5165. @table @option
  5166. @item rimin
  5167. @item gimin
  5168. @item bimin
  5169. @item aimin
  5170. Adjust red, green, blue and alpha input black point.
  5171. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5172. @item rimax
  5173. @item gimax
  5174. @item bimax
  5175. @item aimax
  5176. Adjust red, green, blue and alpha input white point.
  5177. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5178. Input levels are used to lighten highlights (bright tones), darken shadows
  5179. (dark tones), change the balance of bright and dark tones.
  5180. @item romin
  5181. @item gomin
  5182. @item bomin
  5183. @item aomin
  5184. Adjust red, green, blue and alpha output black point.
  5185. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5186. @item romax
  5187. @item gomax
  5188. @item bomax
  5189. @item aomax
  5190. Adjust red, green, blue and alpha output white point.
  5191. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5192. Output levels allows manual selection of a constrained output level range.
  5193. @end table
  5194. @subsection Examples
  5195. @itemize
  5196. @item
  5197. Make video output darker:
  5198. @example
  5199. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5200. @end example
  5201. @item
  5202. Increase contrast:
  5203. @example
  5204. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5205. @end example
  5206. @item
  5207. Make video output lighter:
  5208. @example
  5209. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5210. @end example
  5211. @item
  5212. Increase brightness:
  5213. @example
  5214. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5215. @end example
  5216. @end itemize
  5217. @section colorchannelmixer
  5218. Adjust video input frames by re-mixing color channels.
  5219. This filter modifies a color channel by adding the values associated to
  5220. the other channels of the same pixels. For example if the value to
  5221. modify is red, the output value will be:
  5222. @example
  5223. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5224. @end example
  5225. The filter accepts the following options:
  5226. @table @option
  5227. @item rr
  5228. @item rg
  5229. @item rb
  5230. @item ra
  5231. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5232. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5233. @item gr
  5234. @item gg
  5235. @item gb
  5236. @item ga
  5237. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5238. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5239. @item br
  5240. @item bg
  5241. @item bb
  5242. @item ba
  5243. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5244. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5245. @item ar
  5246. @item ag
  5247. @item ab
  5248. @item aa
  5249. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5250. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5251. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5252. @end table
  5253. @subsection Examples
  5254. @itemize
  5255. @item
  5256. Convert source to grayscale:
  5257. @example
  5258. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5259. @end example
  5260. @item
  5261. Simulate sepia tones:
  5262. @example
  5263. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5264. @end example
  5265. @end itemize
  5266. @section colormatrix
  5267. Convert color matrix.
  5268. The filter accepts the following options:
  5269. @table @option
  5270. @item src
  5271. @item dst
  5272. Specify the source and destination color matrix. Both values must be
  5273. specified.
  5274. The accepted values are:
  5275. @table @samp
  5276. @item bt709
  5277. BT.709
  5278. @item fcc
  5279. FCC
  5280. @item bt601
  5281. BT.601
  5282. @item bt470
  5283. BT.470
  5284. @item bt470bg
  5285. BT.470BG
  5286. @item smpte170m
  5287. SMPTE-170M
  5288. @item smpte240m
  5289. SMPTE-240M
  5290. @item bt2020
  5291. BT.2020
  5292. @end table
  5293. @end table
  5294. For example to convert from BT.601 to SMPTE-240M, use the command:
  5295. @example
  5296. colormatrix=bt601:smpte240m
  5297. @end example
  5298. @section colorspace
  5299. Convert colorspace, transfer characteristics or color primaries.
  5300. Input video needs to have an even size.
  5301. The filter accepts the following options:
  5302. @table @option
  5303. @anchor{all}
  5304. @item all
  5305. Specify all color properties at once.
  5306. The accepted values are:
  5307. @table @samp
  5308. @item bt470m
  5309. BT.470M
  5310. @item bt470bg
  5311. BT.470BG
  5312. @item bt601-6-525
  5313. BT.601-6 525
  5314. @item bt601-6-625
  5315. BT.601-6 625
  5316. @item bt709
  5317. BT.709
  5318. @item smpte170m
  5319. SMPTE-170M
  5320. @item smpte240m
  5321. SMPTE-240M
  5322. @item bt2020
  5323. BT.2020
  5324. @end table
  5325. @anchor{space}
  5326. @item space
  5327. Specify output colorspace.
  5328. The accepted values are:
  5329. @table @samp
  5330. @item bt709
  5331. BT.709
  5332. @item fcc
  5333. FCC
  5334. @item bt470bg
  5335. BT.470BG or BT.601-6 625
  5336. @item smpte170m
  5337. SMPTE-170M or BT.601-6 525
  5338. @item smpte240m
  5339. SMPTE-240M
  5340. @item ycgco
  5341. YCgCo
  5342. @item bt2020ncl
  5343. BT.2020 with non-constant luminance
  5344. @end table
  5345. @anchor{trc}
  5346. @item trc
  5347. Specify output transfer characteristics.
  5348. The accepted values are:
  5349. @table @samp
  5350. @item bt709
  5351. BT.709
  5352. @item bt470m
  5353. BT.470M
  5354. @item bt470bg
  5355. BT.470BG
  5356. @item gamma22
  5357. Constant gamma of 2.2
  5358. @item gamma28
  5359. Constant gamma of 2.8
  5360. @item smpte170m
  5361. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5362. @item smpte240m
  5363. SMPTE-240M
  5364. @item srgb
  5365. SRGB
  5366. @item iec61966-2-1
  5367. iec61966-2-1
  5368. @item iec61966-2-4
  5369. iec61966-2-4
  5370. @item xvycc
  5371. xvycc
  5372. @item bt2020-10
  5373. BT.2020 for 10-bits content
  5374. @item bt2020-12
  5375. BT.2020 for 12-bits content
  5376. @end table
  5377. @anchor{primaries}
  5378. @item primaries
  5379. Specify output color primaries.
  5380. The accepted values are:
  5381. @table @samp
  5382. @item bt709
  5383. BT.709
  5384. @item bt470m
  5385. BT.470M
  5386. @item bt470bg
  5387. BT.470BG or BT.601-6 625
  5388. @item smpte170m
  5389. SMPTE-170M or BT.601-6 525
  5390. @item smpte240m
  5391. SMPTE-240M
  5392. @item film
  5393. film
  5394. @item smpte431
  5395. SMPTE-431
  5396. @item smpte432
  5397. SMPTE-432
  5398. @item bt2020
  5399. BT.2020
  5400. @item jedec-p22
  5401. JEDEC P22 phosphors
  5402. @end table
  5403. @anchor{range}
  5404. @item range
  5405. Specify output color range.
  5406. The accepted values are:
  5407. @table @samp
  5408. @item tv
  5409. TV (restricted) range
  5410. @item mpeg
  5411. MPEG (restricted) range
  5412. @item pc
  5413. PC (full) range
  5414. @item jpeg
  5415. JPEG (full) range
  5416. @end table
  5417. @item format
  5418. Specify output color format.
  5419. The accepted values are:
  5420. @table @samp
  5421. @item yuv420p
  5422. YUV 4:2:0 planar 8-bits
  5423. @item yuv420p10
  5424. YUV 4:2:0 planar 10-bits
  5425. @item yuv420p12
  5426. YUV 4:2:0 planar 12-bits
  5427. @item yuv422p
  5428. YUV 4:2:2 planar 8-bits
  5429. @item yuv422p10
  5430. YUV 4:2:2 planar 10-bits
  5431. @item yuv422p12
  5432. YUV 4:2:2 planar 12-bits
  5433. @item yuv444p
  5434. YUV 4:4:4 planar 8-bits
  5435. @item yuv444p10
  5436. YUV 4:4:4 planar 10-bits
  5437. @item yuv444p12
  5438. YUV 4:4:4 planar 12-bits
  5439. @end table
  5440. @item fast
  5441. Do a fast conversion, which skips gamma/primary correction. This will take
  5442. significantly less CPU, but will be mathematically incorrect. To get output
  5443. compatible with that produced by the colormatrix filter, use fast=1.
  5444. @item dither
  5445. Specify dithering mode.
  5446. The accepted values are:
  5447. @table @samp
  5448. @item none
  5449. No dithering
  5450. @item fsb
  5451. Floyd-Steinberg dithering
  5452. @end table
  5453. @item wpadapt
  5454. Whitepoint adaptation mode.
  5455. The accepted values are:
  5456. @table @samp
  5457. @item bradford
  5458. Bradford whitepoint adaptation
  5459. @item vonkries
  5460. von Kries whitepoint adaptation
  5461. @item identity
  5462. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5463. @end table
  5464. @item iall
  5465. Override all input properties at once. Same accepted values as @ref{all}.
  5466. @item ispace
  5467. Override input colorspace. Same accepted values as @ref{space}.
  5468. @item iprimaries
  5469. Override input color primaries. Same accepted values as @ref{primaries}.
  5470. @item itrc
  5471. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5472. @item irange
  5473. Override input color range. Same accepted values as @ref{range}.
  5474. @end table
  5475. The filter converts the transfer characteristics, color space and color
  5476. primaries to the specified user values. The output value, if not specified,
  5477. is set to a default value based on the "all" property. If that property is
  5478. also not specified, the filter will log an error. The output color range and
  5479. format default to the same value as the input color range and format. The
  5480. input transfer characteristics, color space, color primaries and color range
  5481. should be set on the input data. If any of these are missing, the filter will
  5482. log an error and no conversion will take place.
  5483. For example to convert the input to SMPTE-240M, use the command:
  5484. @example
  5485. colorspace=smpte240m
  5486. @end example
  5487. @section convolution
  5488. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5489. The filter accepts the following options:
  5490. @table @option
  5491. @item 0m
  5492. @item 1m
  5493. @item 2m
  5494. @item 3m
  5495. Set matrix for each plane.
  5496. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5497. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5498. @item 0rdiv
  5499. @item 1rdiv
  5500. @item 2rdiv
  5501. @item 3rdiv
  5502. Set multiplier for calculated value for each plane.
  5503. If unset or 0, it will be sum of all matrix elements.
  5504. @item 0bias
  5505. @item 1bias
  5506. @item 2bias
  5507. @item 3bias
  5508. Set bias for each plane. This value is added to the result of the multiplication.
  5509. Useful for making the overall image brighter or darker. Default is 0.0.
  5510. @item 0mode
  5511. @item 1mode
  5512. @item 2mode
  5513. @item 3mode
  5514. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5515. Default is @var{square}.
  5516. @end table
  5517. @subsection Examples
  5518. @itemize
  5519. @item
  5520. Apply sharpen:
  5521. @example
  5522. convolution="0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0"
  5523. @end example
  5524. @item
  5525. Apply blur:
  5526. @example
  5527. convolution="1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1/9:1/9:1/9:1/9"
  5528. @end example
  5529. @item
  5530. Apply edge enhance:
  5531. @example
  5532. convolution="0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:5:1:1:1:0:128:128:128"
  5533. @end example
  5534. @item
  5535. Apply edge detect:
  5536. @example
  5537. convolution="0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:5:5:5:1:0:128:128:128"
  5538. @end example
  5539. @item
  5540. Apply laplacian edge detector which includes diagonals:
  5541. @example
  5542. convolution="1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:5:5:5:1:0:128:128:0"
  5543. @end example
  5544. @item
  5545. Apply emboss:
  5546. @example
  5547. convolution="-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2"
  5548. @end example
  5549. @end itemize
  5550. @section convolve
  5551. Apply 2D convolution of video stream in frequency domain using second stream
  5552. as impulse.
  5553. The filter accepts the following options:
  5554. @table @option
  5555. @item planes
  5556. Set which planes to process.
  5557. @item impulse
  5558. Set which impulse video frames will be processed, can be @var{first}
  5559. or @var{all}. Default is @var{all}.
  5560. @end table
  5561. The @code{convolve} filter also supports the @ref{framesync} options.
  5562. @section copy
  5563. Copy the input video source unchanged to the output. This is mainly useful for
  5564. testing purposes.
  5565. @anchor{coreimage}
  5566. @section coreimage
  5567. Video filtering on GPU using Apple's CoreImage API on OSX.
  5568. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5569. processed by video hardware. However, software-based OpenGL implementations
  5570. exist which means there is no guarantee for hardware processing. It depends on
  5571. the respective OSX.
  5572. There are many filters and image generators provided by Apple that come with a
  5573. large variety of options. The filter has to be referenced by its name along
  5574. with its options.
  5575. The coreimage filter accepts the following options:
  5576. @table @option
  5577. @item list_filters
  5578. List all available filters and generators along with all their respective
  5579. options as well as possible minimum and maximum values along with the default
  5580. values.
  5581. @example
  5582. list_filters=true
  5583. @end example
  5584. @item filter
  5585. Specify all filters by their respective name and options.
  5586. Use @var{list_filters} to determine all valid filter names and options.
  5587. Numerical options are specified by a float value and are automatically clamped
  5588. to their respective value range. Vector and color options have to be specified
  5589. by a list of space separated float values. Character escaping has to be done.
  5590. A special option name @code{default} is available to use default options for a
  5591. filter.
  5592. It is required to specify either @code{default} or at least one of the filter options.
  5593. All omitted options are used with their default values.
  5594. The syntax of the filter string is as follows:
  5595. @example
  5596. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5597. @end example
  5598. @item output_rect
  5599. Specify a rectangle where the output of the filter chain is copied into the
  5600. input image. It is given by a list of space separated float values:
  5601. @example
  5602. output_rect=x\ y\ width\ height
  5603. @end example
  5604. If not given, the output rectangle equals the dimensions of the input image.
  5605. The output rectangle is automatically cropped at the borders of the input
  5606. image. Negative values are valid for each component.
  5607. @example
  5608. output_rect=25\ 25\ 100\ 100
  5609. @end example
  5610. @end table
  5611. Several filters can be chained for successive processing without GPU-HOST
  5612. transfers allowing for fast processing of complex filter chains.
  5613. Currently, only filters with zero (generators) or exactly one (filters) input
  5614. image and one output image are supported. Also, transition filters are not yet
  5615. usable as intended.
  5616. Some filters generate output images with additional padding depending on the
  5617. respective filter kernel. The padding is automatically removed to ensure the
  5618. filter output has the same size as the input image.
  5619. For image generators, the size of the output image is determined by the
  5620. previous output image of the filter chain or the input image of the whole
  5621. filterchain, respectively. The generators do not use the pixel information of
  5622. this image to generate their output. However, the generated output is
  5623. blended onto this image, resulting in partial or complete coverage of the
  5624. output image.
  5625. The @ref{coreimagesrc} video source can be used for generating input images
  5626. which are directly fed into the filter chain. By using it, providing input
  5627. images by another video source or an input video is not required.
  5628. @subsection Examples
  5629. @itemize
  5630. @item
  5631. List all filters available:
  5632. @example
  5633. coreimage=list_filters=true
  5634. @end example
  5635. @item
  5636. Use the CIBoxBlur filter with default options to blur an image:
  5637. @example
  5638. coreimage=filter=CIBoxBlur@@default
  5639. @end example
  5640. @item
  5641. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5642. its center at 100x100 and a radius of 50 pixels:
  5643. @example
  5644. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5645. @end example
  5646. @item
  5647. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5648. given as complete and escaped command-line for Apple's standard bash shell:
  5649. @example
  5650. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5651. @end example
  5652. @end itemize
  5653. @section crop
  5654. Crop the input video to given dimensions.
  5655. It accepts the following parameters:
  5656. @table @option
  5657. @item w, out_w
  5658. The width of the output video. It defaults to @code{iw}.
  5659. This expression is evaluated only once during the filter
  5660. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5661. @item h, out_h
  5662. The height of the output video. It defaults to @code{ih}.
  5663. This expression is evaluated only once during the filter
  5664. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5665. @item x
  5666. The horizontal position, in the input video, of the left edge of the output
  5667. video. It defaults to @code{(in_w-out_w)/2}.
  5668. This expression is evaluated per-frame.
  5669. @item y
  5670. The vertical position, in the input video, of the top edge of the output video.
  5671. It defaults to @code{(in_h-out_h)/2}.
  5672. This expression is evaluated per-frame.
  5673. @item keep_aspect
  5674. If set to 1 will force the output display aspect ratio
  5675. to be the same of the input, by changing the output sample aspect
  5676. ratio. It defaults to 0.
  5677. @item exact
  5678. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5679. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5680. It defaults to 0.
  5681. @end table
  5682. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5683. expressions containing the following constants:
  5684. @table @option
  5685. @item x
  5686. @item y
  5687. The computed values for @var{x} and @var{y}. They are evaluated for
  5688. each new frame.
  5689. @item in_w
  5690. @item in_h
  5691. The input width and height.
  5692. @item iw
  5693. @item ih
  5694. These are the same as @var{in_w} and @var{in_h}.
  5695. @item out_w
  5696. @item out_h
  5697. The output (cropped) width and height.
  5698. @item ow
  5699. @item oh
  5700. These are the same as @var{out_w} and @var{out_h}.
  5701. @item a
  5702. same as @var{iw} / @var{ih}
  5703. @item sar
  5704. input sample aspect ratio
  5705. @item dar
  5706. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5707. @item hsub
  5708. @item vsub
  5709. horizontal and vertical chroma subsample values. For example for the
  5710. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5711. @item n
  5712. The number of the input frame, starting from 0.
  5713. @item pos
  5714. the position in the file of the input frame, NAN if unknown
  5715. @item t
  5716. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5717. @end table
  5718. The expression for @var{out_w} may depend on the value of @var{out_h},
  5719. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5720. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5721. evaluated after @var{out_w} and @var{out_h}.
  5722. The @var{x} and @var{y} parameters specify the expressions for the
  5723. position of the top-left corner of the output (non-cropped) area. They
  5724. are evaluated for each frame. If the evaluated value is not valid, it
  5725. is approximated to the nearest valid value.
  5726. The expression for @var{x} may depend on @var{y}, and the expression
  5727. for @var{y} may depend on @var{x}.
  5728. @subsection Examples
  5729. @itemize
  5730. @item
  5731. Crop area with size 100x100 at position (12,34).
  5732. @example
  5733. crop=100:100:12:34
  5734. @end example
  5735. Using named options, the example above becomes:
  5736. @example
  5737. crop=w=100:h=100:x=12:y=34
  5738. @end example
  5739. @item
  5740. Crop the central input area with size 100x100:
  5741. @example
  5742. crop=100:100
  5743. @end example
  5744. @item
  5745. Crop the central input area with size 2/3 of the input video:
  5746. @example
  5747. crop=2/3*in_w:2/3*in_h
  5748. @end example
  5749. @item
  5750. Crop the input video central square:
  5751. @example
  5752. crop=out_w=in_h
  5753. crop=in_h
  5754. @end example
  5755. @item
  5756. Delimit the rectangle with the top-left corner placed at position
  5757. 100:100 and the right-bottom corner corresponding to the right-bottom
  5758. corner of the input image.
  5759. @example
  5760. crop=in_w-100:in_h-100:100:100
  5761. @end example
  5762. @item
  5763. Crop 10 pixels from the left and right borders, and 20 pixels from
  5764. the top and bottom borders
  5765. @example
  5766. crop=in_w-2*10:in_h-2*20
  5767. @end example
  5768. @item
  5769. Keep only the bottom right quarter of the input image:
  5770. @example
  5771. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5772. @end example
  5773. @item
  5774. Crop height for getting Greek harmony:
  5775. @example
  5776. crop=in_w:1/PHI*in_w
  5777. @end example
  5778. @item
  5779. Apply trembling effect:
  5780. @example
  5781. crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(n/10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(n/7)
  5782. @end example
  5783. @item
  5784. Apply erratic camera effect depending on timestamp:
  5785. @example
  5786. crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(t*10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(t*13)"
  5787. @end example
  5788. @item
  5789. Set x depending on the value of y:
  5790. @example
  5791. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5792. @end example
  5793. @end itemize
  5794. @subsection Commands
  5795. This filter supports the following commands:
  5796. @table @option
  5797. @item w, out_w
  5798. @item h, out_h
  5799. @item x
  5800. @item y
  5801. Set width/height of the output video and the horizontal/vertical position
  5802. in the input video.
  5803. The command accepts the same syntax of the corresponding option.
  5804. If the specified expression is not valid, it is kept at its current
  5805. value.
  5806. @end table
  5807. @section cropdetect
  5808. Auto-detect the crop size.
  5809. It calculates the necessary cropping parameters and prints the
  5810. recommended parameters via the logging system. The detected dimensions
  5811. correspond to the non-black area of the input video.
  5812. It accepts the following parameters:
  5813. @table @option
  5814. @item limit
  5815. Set higher black value threshold, which can be optionally specified
  5816. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5817. value greater to the set value is considered non-black. It defaults to 24.
  5818. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5819. on the bitdepth of the pixel format.
  5820. @item round
  5821. The value which the width/height should be divisible by. It defaults to
  5822. 16. The offset is automatically adjusted to center the video. Use 2 to
  5823. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5824. encoding to most video codecs.
  5825. @item reset_count, reset
  5826. Set the counter that determines after how many frames cropdetect will
  5827. reset the previously detected largest video area and start over to
  5828. detect the current optimal crop area. Default value is 0.
  5829. This can be useful when channel logos distort the video area. 0
  5830. indicates 'never reset', and returns the largest area encountered during
  5831. playback.
  5832. @end table
  5833. @anchor{cue}
  5834. @section cue
  5835. Delay video filtering until a given wallclock timestamp. The filter first
  5836. passes on @option{preroll} amount of frames, then it buffers at most
  5837. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  5838. it forwards the buffered frames and also any subsequent frames coming in its
  5839. input.
  5840. The filter can be used synchronize the output of multiple ffmpeg processes for
  5841. realtime output devices like decklink. By putting the delay in the filtering
  5842. chain and pre-buffering frames the process can pass on data to output almost
  5843. immediately after the target wallclock timestamp is reached.
  5844. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  5845. some use cases.
  5846. @table @option
  5847. @item cue
  5848. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  5849. @item preroll
  5850. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  5851. @item buffer
  5852. The maximum duration of content to buffer before waiting for the cue expressed
  5853. in seconds. Default is 0.
  5854. @end table
  5855. @anchor{curves}
  5856. @section curves
  5857. Apply color adjustments using curves.
  5858. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5859. component (red, green and blue) has its values defined by @var{N} key points
  5860. tied from each other using a smooth curve. The x-axis represents the pixel
  5861. values from the input frame, and the y-axis the new pixel values to be set for
  5862. the output frame.
  5863. By default, a component curve is defined by the two points @var{(0;0)} and
  5864. @var{(1;1)}. This creates a straight line where each original pixel value is
  5865. "adjusted" to its own value, which means no change to the image.
  5866. The filter allows you to redefine these two points and add some more. A new
  5867. curve (using a natural cubic spline interpolation) will be define to pass
  5868. smoothly through all these new coordinates. The new defined points needs to be
  5869. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5870. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5871. the vector spaces, the values will be clipped accordingly.
  5872. The filter accepts the following options:
  5873. @table @option
  5874. @item preset
  5875. Select one of the available color presets. This option can be used in addition
  5876. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5877. options takes priority on the preset values.
  5878. Available presets are:
  5879. @table @samp
  5880. @item none
  5881. @item color_negative
  5882. @item cross_process
  5883. @item darker
  5884. @item increase_contrast
  5885. @item lighter
  5886. @item linear_contrast
  5887. @item medium_contrast
  5888. @item negative
  5889. @item strong_contrast
  5890. @item vintage
  5891. @end table
  5892. Default is @code{none}.
  5893. @item master, m
  5894. Set the master key points. These points will define a second pass mapping. It
  5895. is sometimes called a "luminance" or "value" mapping. It can be used with
  5896. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5897. post-processing LUT.
  5898. @item red, r
  5899. Set the key points for the red component.
  5900. @item green, g
  5901. Set the key points for the green component.
  5902. @item blue, b
  5903. Set the key points for the blue component.
  5904. @item all
  5905. Set the key points for all components (not including master).
  5906. Can be used in addition to the other key points component
  5907. options. In this case, the unset component(s) will fallback on this
  5908. @option{all} setting.
  5909. @item psfile
  5910. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5911. @item plot
  5912. Save Gnuplot script of the curves in specified file.
  5913. @end table
  5914. To avoid some filtergraph syntax conflicts, each key points list need to be
  5915. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5916. @subsection Examples
  5917. @itemize
  5918. @item
  5919. Increase slightly the middle level of blue:
  5920. @example
  5921. curves=blue='0/0 0.5/0.58 1/1'
  5922. @end example
  5923. @item
  5924. Vintage effect:
  5925. @example
  5926. curves=r='0/0.11 .42/.51 1/0.95':g='0/0 0.50/0.48 1/1':b='0/0.22 .49/.44 1/0.8'
  5927. @end example
  5928. Here we obtain the following coordinates for each components:
  5929. @table @var
  5930. @item red
  5931. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5932. @item green
  5933. @code{(0;0) (0.50;0.48) (1;1)}
  5934. @item blue
  5935. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5936. @end table
  5937. @item
  5938. The previous example can also be achieved with the associated built-in preset:
  5939. @example
  5940. curves=preset=vintage
  5941. @end example
  5942. @item
  5943. Or simply:
  5944. @example
  5945. curves=vintage
  5946. @end example
  5947. @item
  5948. Use a Photoshop preset and redefine the points of the green component:
  5949. @example
  5950. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5951. @end example
  5952. @item
  5953. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5954. and @command{gnuplot}:
  5955. @example
  5956. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5957. gnuplot -p /tmp/curves.plt
  5958. @end example
  5959. @end itemize
  5960. @section datascope
  5961. Video data analysis filter.
  5962. This filter shows hexadecimal pixel values of part of video.
  5963. The filter accepts the following options:
  5964. @table @option
  5965. @item size, s
  5966. Set output video size.
  5967. @item x
  5968. Set x offset from where to pick pixels.
  5969. @item y
  5970. Set y offset from where to pick pixels.
  5971. @item mode
  5972. Set scope mode, can be one of the following:
  5973. @table @samp
  5974. @item mono
  5975. Draw hexadecimal pixel values with white color on black background.
  5976. @item color
  5977. Draw hexadecimal pixel values with input video pixel color on black
  5978. background.
  5979. @item color2
  5980. Draw hexadecimal pixel values on color background picked from input video,
  5981. the text color is picked in such way so its always visible.
  5982. @end table
  5983. @item axis
  5984. Draw rows and columns numbers on left and top of video.
  5985. @item opacity
  5986. Set background opacity.
  5987. @end table
  5988. @section dctdnoiz
  5989. Denoise frames using 2D DCT (frequency domain filtering).
  5990. This filter is not designed for real time.
  5991. The filter accepts the following options:
  5992. @table @option
  5993. @item sigma, s
  5994. Set the noise sigma constant.
  5995. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5996. coefficient (absolute value) below this threshold with be dropped.
  5997. If you need a more advanced filtering, see @option{expr}.
  5998. Default is @code{0}.
  5999. @item overlap
  6000. Set number overlapping pixels for each block. Since the filter can be slow, you
  6001. may want to reduce this value, at the cost of a less effective filter and the
  6002. risk of various artefacts.
  6003. If the overlapping value doesn't permit processing the whole input width or
  6004. height, a warning will be displayed and according borders won't be denoised.
  6005. Default value is @var{blocksize}-1, which is the best possible setting.
  6006. @item expr, e
  6007. Set the coefficient factor expression.
  6008. For each coefficient of a DCT block, this expression will be evaluated as a
  6009. multiplier value for the coefficient.
  6010. If this is option is set, the @option{sigma} option will be ignored.
  6011. The absolute value of the coefficient can be accessed through the @var{c}
  6012. variable.
  6013. @item n
  6014. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6015. @var{blocksize}, which is the width and height of the processed blocks.
  6016. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6017. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6018. on the speed processing. Also, a larger block size does not necessarily means a
  6019. better de-noising.
  6020. @end table
  6021. @subsection Examples
  6022. Apply a denoise with a @option{sigma} of @code{4.5}:
  6023. @example
  6024. dctdnoiz=4.5
  6025. @end example
  6026. The same operation can be achieved using the expression system:
  6027. @example
  6028. dctdnoiz=e='gte(c, 4.5*3)'
  6029. @end example
  6030. Violent denoise using a block size of @code{16x16}:
  6031. @example
  6032. dctdnoiz=15:n=4
  6033. @end example
  6034. @section deband
  6035. Remove banding artifacts from input video.
  6036. It works by replacing banded pixels with average value of referenced pixels.
  6037. The filter accepts the following options:
  6038. @table @option
  6039. @item 1thr
  6040. @item 2thr
  6041. @item 3thr
  6042. @item 4thr
  6043. Set banding detection threshold for each plane. Default is 0.02.
  6044. Valid range is 0.00003 to 0.5.
  6045. If difference between current pixel and reference pixel is less than threshold,
  6046. it will be considered as banded.
  6047. @item range, r
  6048. Banding detection range in pixels. Default is 16. If positive, random number
  6049. in range 0 to set value will be used. If negative, exact absolute value
  6050. will be used.
  6051. The range defines square of four pixels around current pixel.
  6052. @item direction, d
  6053. Set direction in radians from which four pixel will be compared. If positive,
  6054. random direction from 0 to set direction will be picked. If negative, exact of
  6055. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6056. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6057. column.
  6058. @item blur, b
  6059. If enabled, current pixel is compared with average value of all four
  6060. surrounding pixels. The default is enabled. If disabled current pixel is
  6061. compared with all four surrounding pixels. The pixel is considered banded
  6062. if only all four differences with surrounding pixels are less than threshold.
  6063. @item coupling, c
  6064. If enabled, current pixel is changed if and only if all pixel components are banded,
  6065. e.g. banding detection threshold is triggered for all color components.
  6066. The default is disabled.
  6067. @end table
  6068. @section deblock
  6069. Remove blocking artifacts from input video.
  6070. The filter accepts the following options:
  6071. @table @option
  6072. @item filter
  6073. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6074. This controls what kind of deblocking is applied.
  6075. @item block
  6076. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6077. @item alpha
  6078. @item beta
  6079. @item gamma
  6080. @item delta
  6081. Set blocking detection thresholds. Allowed range is 0 to 1.
  6082. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6083. Using higher threshold gives more deblocking strength.
  6084. Setting @var{alpha} controls threshold detection at exact edge of block.
  6085. Remaining options controls threshold detection near the edge. Each one for
  6086. below/above or left/right. Setting any of those to @var{0} disables
  6087. deblocking.
  6088. @item planes
  6089. Set planes to filter. Default is to filter all available planes.
  6090. @end table
  6091. @subsection Examples
  6092. @itemize
  6093. @item
  6094. Deblock using weak filter and block size of 4 pixels.
  6095. @example
  6096. deblock=filter=weak:block=4
  6097. @end example
  6098. @item
  6099. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6100. deblocking more edges.
  6101. @example
  6102. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6103. @end example
  6104. @item
  6105. Similar as above, but filter only first plane.
  6106. @example
  6107. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6108. @end example
  6109. @item
  6110. Similar as above, but filter only second and third plane.
  6111. @example
  6112. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6113. @end example
  6114. @end itemize
  6115. @anchor{decimate}
  6116. @section decimate
  6117. Drop duplicated frames at regular intervals.
  6118. The filter accepts the following options:
  6119. @table @option
  6120. @item cycle
  6121. Set the number of frames from which one will be dropped. Setting this to
  6122. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6123. Default is @code{5}.
  6124. @item dupthresh
  6125. Set the threshold for duplicate detection. If the difference metric for a frame
  6126. is less than or equal to this value, then it is declared as duplicate. Default
  6127. is @code{1.1}
  6128. @item scthresh
  6129. Set scene change threshold. Default is @code{15}.
  6130. @item blockx
  6131. @item blocky
  6132. Set the size of the x and y-axis blocks used during metric calculations.
  6133. Larger blocks give better noise suppression, but also give worse detection of
  6134. small movements. Must be a power of two. Default is @code{32}.
  6135. @item ppsrc
  6136. Mark main input as a pre-processed input and activate clean source input
  6137. stream. This allows the input to be pre-processed with various filters to help
  6138. the metrics calculation while keeping the frame selection lossless. When set to
  6139. @code{1}, the first stream is for the pre-processed input, and the second
  6140. stream is the clean source from where the kept frames are chosen. Default is
  6141. @code{0}.
  6142. @item chroma
  6143. Set whether or not chroma is considered in the metric calculations. Default is
  6144. @code{1}.
  6145. @end table
  6146. @section deconvolve
  6147. Apply 2D deconvolution of video stream in frequency domain using second stream
  6148. as impulse.
  6149. The filter accepts the following options:
  6150. @table @option
  6151. @item planes
  6152. Set which planes to process.
  6153. @item impulse
  6154. Set which impulse video frames will be processed, can be @var{first}
  6155. or @var{all}. Default is @var{all}.
  6156. @item noise
  6157. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6158. and height are not same and not power of 2 or if stream prior to convolving
  6159. had noise.
  6160. @end table
  6161. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6162. @section dedot
  6163. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6164. It accepts the following options:
  6165. @table @option
  6166. @item m
  6167. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6168. @var{rainbows} for cross-color reduction.
  6169. @item lt
  6170. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6171. @item tl
  6172. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6173. @item tc
  6174. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6175. @item ct
  6176. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6177. @end table
  6178. @section deflate
  6179. Apply deflate effect to the video.
  6180. This filter replaces the pixel by the local(3x3) average by taking into account
  6181. only values lower than the pixel.
  6182. It accepts the following options:
  6183. @table @option
  6184. @item threshold0
  6185. @item threshold1
  6186. @item threshold2
  6187. @item threshold3
  6188. Limit the maximum change for each plane, default is 65535.
  6189. If 0, plane will remain unchanged.
  6190. @end table
  6191. @section deflicker
  6192. Remove temporal frame luminance variations.
  6193. It accepts the following options:
  6194. @table @option
  6195. @item size, s
  6196. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6197. @item mode, m
  6198. Set averaging mode to smooth temporal luminance variations.
  6199. Available values are:
  6200. @table @samp
  6201. @item am
  6202. Arithmetic mean
  6203. @item gm
  6204. Geometric mean
  6205. @item hm
  6206. Harmonic mean
  6207. @item qm
  6208. Quadratic mean
  6209. @item cm
  6210. Cubic mean
  6211. @item pm
  6212. Power mean
  6213. @item median
  6214. Median
  6215. @end table
  6216. @item bypass
  6217. Do not actually modify frame. Useful when one only wants metadata.
  6218. @end table
  6219. @section dejudder
  6220. Remove judder produced by partially interlaced telecined content.
  6221. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6222. source was partially telecined content then the output of @code{pullup,dejudder}
  6223. will have a variable frame rate. May change the recorded frame rate of the
  6224. container. Aside from that change, this filter will not affect constant frame
  6225. rate video.
  6226. The option available in this filter is:
  6227. @table @option
  6228. @item cycle
  6229. Specify the length of the window over which the judder repeats.
  6230. Accepts any integer greater than 1. Useful values are:
  6231. @table @samp
  6232. @item 4
  6233. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6234. @item 5
  6235. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6236. @item 20
  6237. If a mixture of the two.
  6238. @end table
  6239. The default is @samp{4}.
  6240. @end table
  6241. @section delogo
  6242. Suppress a TV station logo by a simple interpolation of the surrounding
  6243. pixels. Just set a rectangle covering the logo and watch it disappear
  6244. (and sometimes something even uglier appear - your mileage may vary).
  6245. It accepts the following parameters:
  6246. @table @option
  6247. @item x
  6248. @item y
  6249. Specify the top left corner coordinates of the logo. They must be
  6250. specified.
  6251. @item w
  6252. @item h
  6253. Specify the width and height of the logo to clear. They must be
  6254. specified.
  6255. @item band, t
  6256. Specify the thickness of the fuzzy edge of the rectangle (added to
  6257. @var{w} and @var{h}). The default value is 1. This option is
  6258. deprecated, setting higher values should no longer be necessary and
  6259. is not recommended.
  6260. @item show
  6261. When set to 1, a green rectangle is drawn on the screen to simplify
  6262. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6263. The default value is 0.
  6264. The rectangle is drawn on the outermost pixels which will be (partly)
  6265. replaced with interpolated values. The values of the next pixels
  6266. immediately outside this rectangle in each direction will be used to
  6267. compute the interpolated pixel values inside the rectangle.
  6268. @end table
  6269. @subsection Examples
  6270. @itemize
  6271. @item
  6272. Set a rectangle covering the area with top left corner coordinates 0,0
  6273. and size 100x77, and a band of size 10:
  6274. @example
  6275. delogo=x=0:y=0:w=100:h=77:band=10
  6276. @end example
  6277. @end itemize
  6278. @section deshake
  6279. Attempt to fix small changes in horizontal and/or vertical shift. This
  6280. filter helps remove camera shake from hand-holding a camera, bumping a
  6281. tripod, moving on a vehicle, etc.
  6282. The filter accepts the following options:
  6283. @table @option
  6284. @item x
  6285. @item y
  6286. @item w
  6287. @item h
  6288. Specify a rectangular area where to limit the search for motion
  6289. vectors.
  6290. If desired the search for motion vectors can be limited to a
  6291. rectangular area of the frame defined by its top left corner, width
  6292. and height. These parameters have the same meaning as the drawbox
  6293. filter which can be used to visualise the position of the bounding
  6294. box.
  6295. This is useful when simultaneous movement of subjects within the frame
  6296. might be confused for camera motion by the motion vector search.
  6297. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6298. then the full frame is used. This allows later options to be set
  6299. without specifying the bounding box for the motion vector search.
  6300. Default - search the whole frame.
  6301. @item rx
  6302. @item ry
  6303. Specify the maximum extent of movement in x and y directions in the
  6304. range 0-64 pixels. Default 16.
  6305. @item edge
  6306. Specify how to generate pixels to fill blanks at the edge of the
  6307. frame. Available values are:
  6308. @table @samp
  6309. @item blank, 0
  6310. Fill zeroes at blank locations
  6311. @item original, 1
  6312. Original image at blank locations
  6313. @item clamp, 2
  6314. Extruded edge value at blank locations
  6315. @item mirror, 3
  6316. Mirrored edge at blank locations
  6317. @end table
  6318. Default value is @samp{mirror}.
  6319. @item blocksize
  6320. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6321. default 8.
  6322. @item contrast
  6323. Specify the contrast threshold for blocks. Only blocks with more than
  6324. the specified contrast (difference between darkest and lightest
  6325. pixels) will be considered. Range 1-255, default 125.
  6326. @item search
  6327. Specify the search strategy. Available values are:
  6328. @table @samp
  6329. @item exhaustive, 0
  6330. Set exhaustive search
  6331. @item less, 1
  6332. Set less exhaustive search.
  6333. @end table
  6334. Default value is @samp{exhaustive}.
  6335. @item filename
  6336. If set then a detailed log of the motion search is written to the
  6337. specified file.
  6338. @end table
  6339. @section despill
  6340. Remove unwanted contamination of foreground colors, caused by reflected color of
  6341. greenscreen or bluescreen.
  6342. This filter accepts the following options:
  6343. @table @option
  6344. @item type
  6345. Set what type of despill to use.
  6346. @item mix
  6347. Set how spillmap will be generated.
  6348. @item expand
  6349. Set how much to get rid of still remaining spill.
  6350. @item red
  6351. Controls amount of red in spill area.
  6352. @item green
  6353. Controls amount of green in spill area.
  6354. Should be -1 for greenscreen.
  6355. @item blue
  6356. Controls amount of blue in spill area.
  6357. Should be -1 for bluescreen.
  6358. @item brightness
  6359. Controls brightness of spill area, preserving colors.
  6360. @item alpha
  6361. Modify alpha from generated spillmap.
  6362. @end table
  6363. @section detelecine
  6364. Apply an exact inverse of the telecine operation. It requires a predefined
  6365. pattern specified using the pattern option which must be the same as that passed
  6366. to the telecine filter.
  6367. This filter accepts the following options:
  6368. @table @option
  6369. @item first_field
  6370. @table @samp
  6371. @item top, t
  6372. top field first
  6373. @item bottom, b
  6374. bottom field first
  6375. The default value is @code{top}.
  6376. @end table
  6377. @item pattern
  6378. A string of numbers representing the pulldown pattern you wish to apply.
  6379. The default value is @code{23}.
  6380. @item start_frame
  6381. A number representing position of the first frame with respect to the telecine
  6382. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6383. @end table
  6384. @section dilation
  6385. Apply dilation effect to the video.
  6386. This filter replaces the pixel by the local(3x3) maximum.
  6387. It accepts the following options:
  6388. @table @option
  6389. @item threshold0
  6390. @item threshold1
  6391. @item threshold2
  6392. @item threshold3
  6393. Limit the maximum change for each plane, default is 65535.
  6394. If 0, plane will remain unchanged.
  6395. @item coordinates
  6396. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6397. pixels are used.
  6398. Flags to local 3x3 coordinates maps like this:
  6399. 1 2 3
  6400. 4 5
  6401. 6 7 8
  6402. @end table
  6403. @section displace
  6404. Displace pixels as indicated by second and third input stream.
  6405. It takes three input streams and outputs one stream, the first input is the
  6406. source, and second and third input are displacement maps.
  6407. The second input specifies how much to displace pixels along the
  6408. x-axis, while the third input specifies how much to displace pixels
  6409. along the y-axis.
  6410. If one of displacement map streams terminates, last frame from that
  6411. displacement map will be used.
  6412. Note that once generated, displacements maps can be reused over and over again.
  6413. A description of the accepted options follows.
  6414. @table @option
  6415. @item edge
  6416. Set displace behavior for pixels that are out of range.
  6417. Available values are:
  6418. @table @samp
  6419. @item blank
  6420. Missing pixels are replaced by black pixels.
  6421. @item smear
  6422. Adjacent pixels will spread out to replace missing pixels.
  6423. @item wrap
  6424. Out of range pixels are wrapped so they point to pixels of other side.
  6425. @item mirror
  6426. Out of range pixels will be replaced with mirrored pixels.
  6427. @end table
  6428. Default is @samp{smear}.
  6429. @end table
  6430. @subsection Examples
  6431. @itemize
  6432. @item
  6433. Add ripple effect to rgb input of video size hd720:
  6434. @example
  6435. ffmpeg -i INPUT -f lavfi -i nullsrc=s=hd720,lutrgb=128:128:128 -f lavfi -i nullsrc=s=hd720,geq='r=128+30*sin(2*PI*X/400+T):g=128+30*sin(2*PI*X/400+T):b=128+30*sin(2*PI*X/400+T)' -lavfi '[0][1][2]displace' OUTPUT
  6436. @end example
  6437. @item
  6438. Add wave effect to rgb input of video size hd720:
  6439. @example
  6440. ffmpeg -i INPUT -f lavfi -i nullsrc=hd720,geq='r=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T)):g=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T)):b=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T))' -lavfi '[1]split[x][y],[0][x][y]displace' OUTPUT
  6441. @end example
  6442. @end itemize
  6443. @section drawbox
  6444. Draw a colored box on the input image.
  6445. It accepts the following parameters:
  6446. @table @option
  6447. @item x
  6448. @item y
  6449. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6450. @item width, w
  6451. @item height, h
  6452. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6453. the input width and height. It defaults to 0.
  6454. @item color, c
  6455. Specify the color of the box to write. For the general syntax of this option,
  6456. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6457. value @code{invert} is used, the box edge color is the same as the
  6458. video with inverted luma.
  6459. @item thickness, t
  6460. The expression which sets the thickness of the box edge.
  6461. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6462. See below for the list of accepted constants.
  6463. @item replace
  6464. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6465. will overwrite the video's color and alpha pixels.
  6466. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6467. @end table
  6468. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6469. following constants:
  6470. @table @option
  6471. @item dar
  6472. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6473. @item hsub
  6474. @item vsub
  6475. horizontal and vertical chroma subsample values. For example for the
  6476. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6477. @item in_h, ih
  6478. @item in_w, iw
  6479. The input width and height.
  6480. @item sar
  6481. The input sample aspect ratio.
  6482. @item x
  6483. @item y
  6484. The x and y offset coordinates where the box is drawn.
  6485. @item w
  6486. @item h
  6487. The width and height of the drawn box.
  6488. @item t
  6489. The thickness of the drawn box.
  6490. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6491. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6492. @end table
  6493. @subsection Examples
  6494. @itemize
  6495. @item
  6496. Draw a black box around the edge of the input image:
  6497. @example
  6498. drawbox
  6499. @end example
  6500. @item
  6501. Draw a box with color red and an opacity of 50%:
  6502. @example
  6503. drawbox=10:20:200:60:red@@0.5
  6504. @end example
  6505. The previous example can be specified as:
  6506. @example
  6507. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6508. @end example
  6509. @item
  6510. Fill the box with pink color:
  6511. @example
  6512. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6513. @end example
  6514. @item
  6515. Draw a 2-pixel red 2.40:1 mask:
  6516. @example
  6517. drawbox=x=-t:y=0.5*(ih-iw/2.4)-t:w=iw+t*2:h=iw/2.4+t*2:t=2:c=red
  6518. @end example
  6519. @end itemize
  6520. @section drawgrid
  6521. Draw a grid on the input image.
  6522. It accepts the following parameters:
  6523. @table @option
  6524. @item x
  6525. @item y
  6526. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6527. @item width, w
  6528. @item height, h
  6529. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6530. input width and height, respectively, minus @code{thickness}, so image gets
  6531. framed. Default to 0.
  6532. @item color, c
  6533. Specify the color of the grid. For the general syntax of this option,
  6534. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6535. value @code{invert} is used, the grid color is the same as the
  6536. video with inverted luma.
  6537. @item thickness, t
  6538. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6539. See below for the list of accepted constants.
  6540. @item replace
  6541. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6542. will overwrite the video's color and alpha pixels.
  6543. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6544. @end table
  6545. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6546. following constants:
  6547. @table @option
  6548. @item dar
  6549. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6550. @item hsub
  6551. @item vsub
  6552. horizontal and vertical chroma subsample values. For example for the
  6553. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6554. @item in_h, ih
  6555. @item in_w, iw
  6556. The input grid cell width and height.
  6557. @item sar
  6558. The input sample aspect ratio.
  6559. @item x
  6560. @item y
  6561. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6562. @item w
  6563. @item h
  6564. The width and height of the drawn cell.
  6565. @item t
  6566. The thickness of the drawn cell.
  6567. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6568. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6569. @end table
  6570. @subsection Examples
  6571. @itemize
  6572. @item
  6573. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6574. @example
  6575. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6576. @end example
  6577. @item
  6578. Draw a white 3x3 grid with an opacity of 50%:
  6579. @example
  6580. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6581. @end example
  6582. @end itemize
  6583. @anchor{drawtext}
  6584. @section drawtext
  6585. Draw a text string or text from a specified file on top of a video, using the
  6586. libfreetype library.
  6587. To enable compilation of this filter, you need to configure FFmpeg with
  6588. @code{--enable-libfreetype}.
  6589. To enable default font fallback and the @var{font} option you need to
  6590. configure FFmpeg with @code{--enable-libfontconfig}.
  6591. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6592. @code{--enable-libfribidi}.
  6593. @subsection Syntax
  6594. It accepts the following parameters:
  6595. @table @option
  6596. @item box
  6597. Used to draw a box around text using the background color.
  6598. The value must be either 1 (enable) or 0 (disable).
  6599. The default value of @var{box} is 0.
  6600. @item boxborderw
  6601. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6602. The default value of @var{boxborderw} is 0.
  6603. @item boxcolor
  6604. The color to be used for drawing box around text. For the syntax of this
  6605. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6606. The default value of @var{boxcolor} is "white".
  6607. @item line_spacing
  6608. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6609. The default value of @var{line_spacing} is 0.
  6610. @item borderw
  6611. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6612. The default value of @var{borderw} is 0.
  6613. @item bordercolor
  6614. Set the color to be used for drawing border around text. For the syntax of this
  6615. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6616. The default value of @var{bordercolor} is "black".
  6617. @item expansion
  6618. Select how the @var{text} is expanded. Can be either @code{none},
  6619. @code{strftime} (deprecated) or
  6620. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6621. below for details.
  6622. @item basetime
  6623. Set a start time for the count. Value is in microseconds. Only applied
  6624. in the deprecated strftime expansion mode. To emulate in normal expansion
  6625. mode use the @code{pts} function, supplying the start time (in seconds)
  6626. as the second argument.
  6627. @item fix_bounds
  6628. If true, check and fix text coords to avoid clipping.
  6629. @item fontcolor
  6630. The color to be used for drawing fonts. For the syntax of this option, check
  6631. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6632. The default value of @var{fontcolor} is "black".
  6633. @item fontcolor_expr
  6634. String which is expanded the same way as @var{text} to obtain dynamic
  6635. @var{fontcolor} value. By default this option has empty value and is not
  6636. processed. When this option is set, it overrides @var{fontcolor} option.
  6637. @item font
  6638. The font family to be used for drawing text. By default Sans.
  6639. @item fontfile
  6640. The font file to be used for drawing text. The path must be included.
  6641. This parameter is mandatory if the fontconfig support is disabled.
  6642. @item alpha
  6643. Draw the text applying alpha blending. The value can
  6644. be a number between 0.0 and 1.0.
  6645. The expression accepts the same variables @var{x, y} as well.
  6646. The default value is 1.
  6647. Please see @var{fontcolor_expr}.
  6648. @item fontsize
  6649. The font size to be used for drawing text.
  6650. The default value of @var{fontsize} is 16.
  6651. @item text_shaping
  6652. If set to 1, attempt to shape the text (for example, reverse the order of
  6653. right-to-left text and join Arabic characters) before drawing it.
  6654. Otherwise, just draw the text exactly as given.
  6655. By default 1 (if supported).
  6656. @item ft_load_flags
  6657. The flags to be used for loading the fonts.
  6658. The flags map the corresponding flags supported by libfreetype, and are
  6659. a combination of the following values:
  6660. @table @var
  6661. @item default
  6662. @item no_scale
  6663. @item no_hinting
  6664. @item render
  6665. @item no_bitmap
  6666. @item vertical_layout
  6667. @item force_autohint
  6668. @item crop_bitmap
  6669. @item pedantic
  6670. @item ignore_global_advance_width
  6671. @item no_recurse
  6672. @item ignore_transform
  6673. @item monochrome
  6674. @item linear_design
  6675. @item no_autohint
  6676. @end table
  6677. Default value is "default".
  6678. For more information consult the documentation for the FT_LOAD_*
  6679. libfreetype flags.
  6680. @item shadowcolor
  6681. The color to be used for drawing a shadow behind the drawn text. For the
  6682. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6683. ffmpeg-utils manual,ffmpeg-utils}.
  6684. The default value of @var{shadowcolor} is "black".
  6685. @item shadowx
  6686. @item shadowy
  6687. The x and y offsets for the text shadow position with respect to the
  6688. position of the text. They can be either positive or negative
  6689. values. The default value for both is "0".
  6690. @item start_number
  6691. The starting frame number for the n/frame_num variable. The default value
  6692. is "0".
  6693. @item tabsize
  6694. The size in number of spaces to use for rendering the tab.
  6695. Default value is 4.
  6696. @item timecode
  6697. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6698. format. It can be used with or without text parameter. @var{timecode_rate}
  6699. option must be specified.
  6700. @item timecode_rate, rate, r
  6701. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6702. integer. Minimum value is "1".
  6703. Drop-frame timecode is supported for frame rates 30 & 60.
  6704. @item tc24hmax
  6705. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6706. Default is 0 (disabled).
  6707. @item text
  6708. The text string to be drawn. The text must be a sequence of UTF-8
  6709. encoded characters.
  6710. This parameter is mandatory if no file is specified with the parameter
  6711. @var{textfile}.
  6712. @item textfile
  6713. A text file containing text to be drawn. The text must be a sequence
  6714. of UTF-8 encoded characters.
  6715. This parameter is mandatory if no text string is specified with the
  6716. parameter @var{text}.
  6717. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6718. @item reload
  6719. If set to 1, the @var{textfile} will be reloaded before each frame.
  6720. Be sure to update it atomically, or it may be read partially, or even fail.
  6721. @item x
  6722. @item y
  6723. The expressions which specify the offsets where text will be drawn
  6724. within the video frame. They are relative to the top/left border of the
  6725. output image.
  6726. The default value of @var{x} and @var{y} is "0".
  6727. See below for the list of accepted constants and functions.
  6728. @end table
  6729. The parameters for @var{x} and @var{y} are expressions containing the
  6730. following constants and functions:
  6731. @table @option
  6732. @item dar
  6733. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6734. @item hsub
  6735. @item vsub
  6736. horizontal and vertical chroma subsample values. For example for the
  6737. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6738. @item line_h, lh
  6739. the height of each text line
  6740. @item main_h, h, H
  6741. the input height
  6742. @item main_w, w, W
  6743. the input width
  6744. @item max_glyph_a, ascent
  6745. the maximum distance from the baseline to the highest/upper grid
  6746. coordinate used to place a glyph outline point, for all the rendered
  6747. glyphs.
  6748. It is a positive value, due to the grid's orientation with the Y axis
  6749. upwards.
  6750. @item max_glyph_d, descent
  6751. the maximum distance from the baseline to the lowest grid coordinate
  6752. used to place a glyph outline point, for all the rendered glyphs.
  6753. This is a negative value, due to the grid's orientation, with the Y axis
  6754. upwards.
  6755. @item max_glyph_h
  6756. maximum glyph height, that is the maximum height for all the glyphs
  6757. contained in the rendered text, it is equivalent to @var{ascent} -
  6758. @var{descent}.
  6759. @item max_glyph_w
  6760. maximum glyph width, that is the maximum width for all the glyphs
  6761. contained in the rendered text
  6762. @item n
  6763. the number of input frame, starting from 0
  6764. @item rand(min, max)
  6765. return a random number included between @var{min} and @var{max}
  6766. @item sar
  6767. The input sample aspect ratio.
  6768. @item t
  6769. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6770. @item text_h, th
  6771. the height of the rendered text
  6772. @item text_w, tw
  6773. the width of the rendered text
  6774. @item x
  6775. @item y
  6776. the x and y offset coordinates where the text is drawn.
  6777. These parameters allow the @var{x} and @var{y} expressions to refer
  6778. each other, so you can for example specify @code{y=x/dar}.
  6779. @end table
  6780. @anchor{drawtext_expansion}
  6781. @subsection Text expansion
  6782. If @option{expansion} is set to @code{strftime},
  6783. the filter recognizes strftime() sequences in the provided text and
  6784. expands them accordingly. Check the documentation of strftime(). This
  6785. feature is deprecated.
  6786. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6787. If @option{expansion} is set to @code{normal} (which is the default),
  6788. the following expansion mechanism is used.
  6789. The backslash character @samp{\}, followed by any character, always expands to
  6790. the second character.
  6791. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6792. braces is a function name, possibly followed by arguments separated by ':'.
  6793. If the arguments contain special characters or delimiters (':' or '@}'),
  6794. they should be escaped.
  6795. Note that they probably must also be escaped as the value for the
  6796. @option{text} option in the filter argument string and as the filter
  6797. argument in the filtergraph description, and possibly also for the shell,
  6798. that makes up to four levels of escaping; using a text file avoids these
  6799. problems.
  6800. The following functions are available:
  6801. @table @command
  6802. @item expr, e
  6803. The expression evaluation result.
  6804. It must take one argument specifying the expression to be evaluated,
  6805. which accepts the same constants and functions as the @var{x} and
  6806. @var{y} values. Note that not all constants should be used, for
  6807. example the text size is not known when evaluating the expression, so
  6808. the constants @var{text_w} and @var{text_h} will have an undefined
  6809. value.
  6810. @item expr_int_format, eif
  6811. Evaluate the expression's value and output as formatted integer.
  6812. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6813. The second argument specifies the output format. Allowed values are @samp{x},
  6814. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6815. @code{printf} function.
  6816. The third parameter is optional and sets the number of positions taken by the output.
  6817. It can be used to add padding with zeros from the left.
  6818. @item gmtime
  6819. The time at which the filter is running, expressed in UTC.
  6820. It can accept an argument: a strftime() format string.
  6821. @item localtime
  6822. The time at which the filter is running, expressed in the local time zone.
  6823. It can accept an argument: a strftime() format string.
  6824. @item metadata
  6825. Frame metadata. Takes one or two arguments.
  6826. The first argument is mandatory and specifies the metadata key.
  6827. The second argument is optional and specifies a default value, used when the
  6828. metadata key is not found or empty.
  6829. @item n, frame_num
  6830. The frame number, starting from 0.
  6831. @item pict_type
  6832. A 1 character description of the current picture type.
  6833. @item pts
  6834. The timestamp of the current frame.
  6835. It can take up to three arguments.
  6836. The first argument is the format of the timestamp; it defaults to @code{flt}
  6837. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6838. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6839. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6840. @code{localtime} stands for the timestamp of the frame formatted as
  6841. local time zone time.
  6842. The second argument is an offset added to the timestamp.
  6843. If the format is set to @code{hms}, a third argument @code{24HH} may be
  6844. supplied to present the hour part of the formatted timestamp in 24h format
  6845. (00-23).
  6846. If the format is set to @code{localtime} or @code{gmtime},
  6847. a third argument may be supplied: a strftime() format string.
  6848. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6849. @end table
  6850. @subsection Examples
  6851. @itemize
  6852. @item
  6853. Draw "Test Text" with font FreeSerif, using the default values for the
  6854. optional parameters.
  6855. @example
  6856. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6857. @end example
  6858. @item
  6859. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6860. and y=50 (counting from the top-left corner of the screen), text is
  6861. yellow with a red box around it. Both the text and the box have an
  6862. opacity of 20%.
  6863. @example
  6864. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6865. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6866. @end example
  6867. Note that the double quotes are not necessary if spaces are not used
  6868. within the parameter list.
  6869. @item
  6870. Show the text at the center of the video frame:
  6871. @example
  6872. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6873. @end example
  6874. @item
  6875. Show the text at a random position, switching to a new position every 30 seconds:
  6876. @example
  6877. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=if(eq(mod(t\,30)\,0)\,rand(0\,(w-text_w))\,x):y=if(eq(mod(t\,30)\,0)\,rand(0\,(h-text_h))\,y)"
  6878. @end example
  6879. @item
  6880. Show a text line sliding from right to left in the last row of the video
  6881. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6882. with no newlines.
  6883. @example
  6884. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6885. @end example
  6886. @item
  6887. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6888. @example
  6889. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6890. @end example
  6891. @item
  6892. Draw a single green letter "g", at the center of the input video.
  6893. The glyph baseline is placed at half screen height.
  6894. @example
  6895. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6896. @end example
  6897. @item
  6898. Show text for 1 second every 3 seconds:
  6899. @example
  6900. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6901. @end example
  6902. @item
  6903. Use fontconfig to set the font. Note that the colons need to be escaped.
  6904. @example
  6905. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6906. @end example
  6907. @item
  6908. Print the date of a real-time encoding (see strftime(3)):
  6909. @example
  6910. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6911. @end example
  6912. @item
  6913. Show text fading in and out (appearing/disappearing):
  6914. @example
  6915. #!/bin/sh
  6916. DS=1.0 # display start
  6917. DE=10.0 # display end
  6918. FID=1.5 # fade in duration
  6919. FOD=5 # fade out duration
  6920. ffplay -f lavfi "color,drawtext=text=TEST:fontsize=50:fontfile=FreeSerif.ttf:fontcolor_expr=ff0000%@{eif\\\\: clip(255*(1*between(t\\, $DS + $FID\\, $DE - $FOD) + ((t - $DS)/$FID)*between(t\\, $DS\\, $DS + $FID) + (-(t - $DE)/$FOD)*between(t\\, $DE - $FOD\\, $DE) )\\, 0\\, 255) \\\\: x\\\\: 2 @}"
  6921. @end example
  6922. @item
  6923. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6924. and the @option{fontsize} value are included in the @option{y} offset.
  6925. @example
  6926. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6927. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6928. @end example
  6929. @end itemize
  6930. For more information about libfreetype, check:
  6931. @url{http://www.freetype.org/}.
  6932. For more information about fontconfig, check:
  6933. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6934. For more information about libfribidi, check:
  6935. @url{http://fribidi.org/}.
  6936. @section edgedetect
  6937. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6938. The filter accepts the following options:
  6939. @table @option
  6940. @item low
  6941. @item high
  6942. Set low and high threshold values used by the Canny thresholding
  6943. algorithm.
  6944. The high threshold selects the "strong" edge pixels, which are then
  6945. connected through 8-connectivity with the "weak" edge pixels selected
  6946. by the low threshold.
  6947. @var{low} and @var{high} threshold values must be chosen in the range
  6948. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6949. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6950. is @code{50/255}.
  6951. @item mode
  6952. Define the drawing mode.
  6953. @table @samp
  6954. @item wires
  6955. Draw white/gray wires on black background.
  6956. @item colormix
  6957. Mix the colors to create a paint/cartoon effect.
  6958. @item canny
  6959. Apply Canny edge detector on all selected planes.
  6960. @end table
  6961. Default value is @var{wires}.
  6962. @item planes
  6963. Select planes for filtering. By default all available planes are filtered.
  6964. @end table
  6965. @subsection Examples
  6966. @itemize
  6967. @item
  6968. Standard edge detection with custom values for the hysteresis thresholding:
  6969. @example
  6970. edgedetect=low=0.1:high=0.4
  6971. @end example
  6972. @item
  6973. Painting effect without thresholding:
  6974. @example
  6975. edgedetect=mode=colormix:high=0
  6976. @end example
  6977. @end itemize
  6978. @section eq
  6979. Set brightness, contrast, saturation and approximate gamma adjustment.
  6980. The filter accepts the following options:
  6981. @table @option
  6982. @item contrast
  6983. Set the contrast expression. The value must be a float value in range
  6984. @code{-2.0} to @code{2.0}. The default value is "1".
  6985. @item brightness
  6986. Set the brightness expression. The value must be a float value in
  6987. range @code{-1.0} to @code{1.0}. The default value is "0".
  6988. @item saturation
  6989. Set the saturation expression. The value must be a float in
  6990. range @code{0.0} to @code{3.0}. The default value is "1".
  6991. @item gamma
  6992. Set the gamma expression. The value must be a float in range
  6993. @code{0.1} to @code{10.0}. The default value is "1".
  6994. @item gamma_r
  6995. Set the gamma expression for red. The value must be a float in
  6996. range @code{0.1} to @code{10.0}. The default value is "1".
  6997. @item gamma_g
  6998. Set the gamma expression for green. The value must be a float in range
  6999. @code{0.1} to @code{10.0}. The default value is "1".
  7000. @item gamma_b
  7001. Set the gamma expression for blue. The value must be a float in range
  7002. @code{0.1} to @code{10.0}. The default value is "1".
  7003. @item gamma_weight
  7004. Set the gamma weight expression. It can be used to reduce the effect
  7005. of a high gamma value on bright image areas, e.g. keep them from
  7006. getting overamplified and just plain white. The value must be a float
  7007. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  7008. gamma correction all the way down while @code{1.0} leaves it at its
  7009. full strength. Default is "1".
  7010. @item eval
  7011. Set when the expressions for brightness, contrast, saturation and
  7012. gamma expressions are evaluated.
  7013. It accepts the following values:
  7014. @table @samp
  7015. @item init
  7016. only evaluate expressions once during the filter initialization or
  7017. when a command is processed
  7018. @item frame
  7019. evaluate expressions for each incoming frame
  7020. @end table
  7021. Default value is @samp{init}.
  7022. @end table
  7023. The expressions accept the following parameters:
  7024. @table @option
  7025. @item n
  7026. frame count of the input frame starting from 0
  7027. @item pos
  7028. byte position of the corresponding packet in the input file, NAN if
  7029. unspecified
  7030. @item r
  7031. frame rate of the input video, NAN if the input frame rate is unknown
  7032. @item t
  7033. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7034. @end table
  7035. @subsection Commands
  7036. The filter supports the following commands:
  7037. @table @option
  7038. @item contrast
  7039. Set the contrast expression.
  7040. @item brightness
  7041. Set the brightness expression.
  7042. @item saturation
  7043. Set the saturation expression.
  7044. @item gamma
  7045. Set the gamma expression.
  7046. @item gamma_r
  7047. Set the gamma_r expression.
  7048. @item gamma_g
  7049. Set gamma_g expression.
  7050. @item gamma_b
  7051. Set gamma_b expression.
  7052. @item gamma_weight
  7053. Set gamma_weight expression.
  7054. The command accepts the same syntax of the corresponding option.
  7055. If the specified expression is not valid, it is kept at its current
  7056. value.
  7057. @end table
  7058. @section erosion
  7059. Apply erosion effect to the video.
  7060. This filter replaces the pixel by the local(3x3) minimum.
  7061. It accepts the following options:
  7062. @table @option
  7063. @item threshold0
  7064. @item threshold1
  7065. @item threshold2
  7066. @item threshold3
  7067. Limit the maximum change for each plane, default is 65535.
  7068. If 0, plane will remain unchanged.
  7069. @item coordinates
  7070. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7071. pixels are used.
  7072. Flags to local 3x3 coordinates maps like this:
  7073. 1 2 3
  7074. 4 5
  7075. 6 7 8
  7076. @end table
  7077. @section extractplanes
  7078. Extract color channel components from input video stream into
  7079. separate grayscale video streams.
  7080. The filter accepts the following option:
  7081. @table @option
  7082. @item planes
  7083. Set plane(s) to extract.
  7084. Available values for planes are:
  7085. @table @samp
  7086. @item y
  7087. @item u
  7088. @item v
  7089. @item a
  7090. @item r
  7091. @item g
  7092. @item b
  7093. @end table
  7094. Choosing planes not available in the input will result in an error.
  7095. That means you cannot select @code{r}, @code{g}, @code{b} planes
  7096. with @code{y}, @code{u}, @code{v} planes at same time.
  7097. @end table
  7098. @subsection Examples
  7099. @itemize
  7100. @item
  7101. Extract luma, u and v color channel component from input video frame
  7102. into 3 grayscale outputs:
  7103. @example
  7104. ffmpeg -i video.avi -filter_complex 'extractplanes=y+u+v[y][u][v]' -map '[y]' y.avi -map '[u]' u.avi -map '[v]' v.avi
  7105. @end example
  7106. @end itemize
  7107. @section elbg
  7108. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7109. For each input image, the filter will compute the optimal mapping from
  7110. the input to the output given the codebook length, that is the number
  7111. of distinct output colors.
  7112. This filter accepts the following options.
  7113. @table @option
  7114. @item codebook_length, l
  7115. Set codebook length. The value must be a positive integer, and
  7116. represents the number of distinct output colors. Default value is 256.
  7117. @item nb_steps, n
  7118. Set the maximum number of iterations to apply for computing the optimal
  7119. mapping. The higher the value the better the result and the higher the
  7120. computation time. Default value is 1.
  7121. @item seed, s
  7122. Set a random seed, must be an integer included between 0 and
  7123. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7124. will try to use a good random seed on a best effort basis.
  7125. @item pal8
  7126. Set pal8 output pixel format. This option does not work with codebook
  7127. length greater than 256.
  7128. @end table
  7129. @section entropy
  7130. Measure graylevel entropy in histogram of color channels of video frames.
  7131. It accepts the following parameters:
  7132. @table @option
  7133. @item mode
  7134. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7135. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7136. between neighbour histogram values.
  7137. @end table
  7138. @section fade
  7139. Apply a fade-in/out effect to the input video.
  7140. It accepts the following parameters:
  7141. @table @option
  7142. @item type, t
  7143. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7144. effect.
  7145. Default is @code{in}.
  7146. @item start_frame, s
  7147. Specify the number of the frame to start applying the fade
  7148. effect at. Default is 0.
  7149. @item nb_frames, n
  7150. The number of frames that the fade effect lasts. At the end of the
  7151. fade-in effect, the output video will have the same intensity as the input video.
  7152. At the end of the fade-out transition, the output video will be filled with the
  7153. selected @option{color}.
  7154. Default is 25.
  7155. @item alpha
  7156. If set to 1, fade only alpha channel, if one exists on the input.
  7157. Default value is 0.
  7158. @item start_time, st
  7159. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7160. effect. If both start_frame and start_time are specified, the fade will start at
  7161. whichever comes last. Default is 0.
  7162. @item duration, d
  7163. The number of seconds for which the fade effect has to last. At the end of the
  7164. fade-in effect the output video will have the same intensity as the input video,
  7165. at the end of the fade-out transition the output video will be filled with the
  7166. selected @option{color}.
  7167. If both duration and nb_frames are specified, duration is used. Default is 0
  7168. (nb_frames is used by default).
  7169. @item color, c
  7170. Specify the color of the fade. Default is "black".
  7171. @end table
  7172. @subsection Examples
  7173. @itemize
  7174. @item
  7175. Fade in the first 30 frames of video:
  7176. @example
  7177. fade=in:0:30
  7178. @end example
  7179. The command above is equivalent to:
  7180. @example
  7181. fade=t=in:s=0:n=30
  7182. @end example
  7183. @item
  7184. Fade out the last 45 frames of a 200-frame video:
  7185. @example
  7186. fade=out:155:45
  7187. fade=type=out:start_frame=155:nb_frames=45
  7188. @end example
  7189. @item
  7190. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7191. @example
  7192. fade=in:0:25, fade=out:975:25
  7193. @end example
  7194. @item
  7195. Make the first 5 frames yellow, then fade in from frame 5-24:
  7196. @example
  7197. fade=in:5:20:color=yellow
  7198. @end example
  7199. @item
  7200. Fade in alpha over first 25 frames of video:
  7201. @example
  7202. fade=in:0:25:alpha=1
  7203. @end example
  7204. @item
  7205. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7206. @example
  7207. fade=t=in:st=5.5:d=0.5
  7208. @end example
  7209. @end itemize
  7210. @section fftfilt
  7211. Apply arbitrary expressions to samples in frequency domain
  7212. @table @option
  7213. @item dc_Y
  7214. Adjust the dc value (gain) of the luma plane of the image. The filter
  7215. accepts an integer value in range @code{0} to @code{1000}. The default
  7216. value is set to @code{0}.
  7217. @item dc_U
  7218. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7219. filter accepts an integer value in range @code{0} to @code{1000}. The
  7220. default value is set to @code{0}.
  7221. @item dc_V
  7222. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7223. filter accepts an integer value in range @code{0} to @code{1000}. The
  7224. default value is set to @code{0}.
  7225. @item weight_Y
  7226. Set the frequency domain weight expression for the luma plane.
  7227. @item weight_U
  7228. Set the frequency domain weight expression for the 1st chroma plane.
  7229. @item weight_V
  7230. Set the frequency domain weight expression for the 2nd chroma plane.
  7231. @item eval
  7232. Set when the expressions are evaluated.
  7233. It accepts the following values:
  7234. @table @samp
  7235. @item init
  7236. Only evaluate expressions once during the filter initialization.
  7237. @item frame
  7238. Evaluate expressions for each incoming frame.
  7239. @end table
  7240. Default value is @samp{init}.
  7241. The filter accepts the following variables:
  7242. @item X
  7243. @item Y
  7244. The coordinates of the current sample.
  7245. @item W
  7246. @item H
  7247. The width and height of the image.
  7248. @item N
  7249. The number of input frame, starting from 0.
  7250. @end table
  7251. @subsection Examples
  7252. @itemize
  7253. @item
  7254. High-pass:
  7255. @example
  7256. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7257. @end example
  7258. @item
  7259. Low-pass:
  7260. @example
  7261. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7262. @end example
  7263. @item
  7264. Sharpen:
  7265. @example
  7266. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7267. @end example
  7268. @item
  7269. Blur:
  7270. @example
  7271. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7272. @end example
  7273. @end itemize
  7274. @section fftdnoiz
  7275. Denoise frames using 3D FFT (frequency domain filtering).
  7276. The filter accepts the following options:
  7277. @table @option
  7278. @item sigma
  7279. Set the noise sigma constant. This sets denoising strength.
  7280. Default value is 1. Allowed range is from 0 to 30.
  7281. Using very high sigma with low overlap may give blocking artifacts.
  7282. @item amount
  7283. Set amount of denoising. By default all detected noise is reduced.
  7284. Default value is 1. Allowed range is from 0 to 1.
  7285. @item block
  7286. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7287. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7288. block size in pixels is 2^4 which is 16.
  7289. @item overlap
  7290. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7291. @item prev
  7292. Set number of previous frames to use for denoising. By default is set to 0.
  7293. @item next
  7294. Set number of next frames to to use for denoising. By default is set to 0.
  7295. @item planes
  7296. Set planes which will be filtered, by default are all available filtered
  7297. except alpha.
  7298. @end table
  7299. @section field
  7300. Extract a single field from an interlaced image using stride
  7301. arithmetic to avoid wasting CPU time. The output frames are marked as
  7302. non-interlaced.
  7303. The filter accepts the following options:
  7304. @table @option
  7305. @item type
  7306. Specify whether to extract the top (if the value is @code{0} or
  7307. @code{top}) or the bottom field (if the value is @code{1} or
  7308. @code{bottom}).
  7309. @end table
  7310. @section fieldhint
  7311. Create new frames by copying the top and bottom fields from surrounding frames
  7312. supplied as numbers by the hint file.
  7313. @table @option
  7314. @item hint
  7315. Set file containing hints: absolute/relative frame numbers.
  7316. There must be one line for each frame in a clip. Each line must contain two
  7317. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7318. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7319. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7320. for @code{relative} mode. First number tells from which frame to pick up top
  7321. field and second number tells from which frame to pick up bottom field.
  7322. If optionally followed by @code{+} output frame will be marked as interlaced,
  7323. else if followed by @code{-} output frame will be marked as progressive, else
  7324. it will be marked same as input frame.
  7325. If line starts with @code{#} or @code{;} that line is skipped.
  7326. @item mode
  7327. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7328. @end table
  7329. Example of first several lines of @code{hint} file for @code{relative} mode:
  7330. @example
  7331. 0,0 - # first frame
  7332. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7333. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7334. 1,0 -
  7335. 0,0 -
  7336. 0,0 -
  7337. 1,0 -
  7338. 1,0 -
  7339. 1,0 -
  7340. 0,0 -
  7341. 0,0 -
  7342. 1,0 -
  7343. 1,0 -
  7344. 1,0 -
  7345. 0,0 -
  7346. @end example
  7347. @section fieldmatch
  7348. Field matching filter for inverse telecine. It is meant to reconstruct the
  7349. progressive frames from a telecined stream. The filter does not drop duplicated
  7350. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  7351. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  7352. The separation of the field matching and the decimation is notably motivated by
  7353. the possibility of inserting a de-interlacing filter fallback between the two.
  7354. If the source has mixed telecined and real interlaced content,
  7355. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  7356. But these remaining combed frames will be marked as interlaced, and thus can be
  7357. de-interlaced by a later filter such as @ref{yadif} before decimation.
  7358. In addition to the various configuration options, @code{fieldmatch} can take an
  7359. optional second stream, activated through the @option{ppsrc} option. If
  7360. enabled, the frames reconstruction will be based on the fields and frames from
  7361. this second stream. This allows the first input to be pre-processed in order to
  7362. help the various algorithms of the filter, while keeping the output lossless
  7363. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  7364. or brightness/contrast adjustments can help.
  7365. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  7366. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  7367. which @code{fieldmatch} is based on. While the semantic and usage are very
  7368. close, some behaviour and options names can differ.
  7369. The @ref{decimate} filter currently only works for constant frame rate input.
  7370. If your input has mixed telecined (30fps) and progressive content with a lower
  7371. framerate like 24fps use the following filterchain to produce the necessary cfr
  7372. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  7373. The filter accepts the following options:
  7374. @table @option
  7375. @item order
  7376. Specify the assumed field order of the input stream. Available values are:
  7377. @table @samp
  7378. @item auto
  7379. Auto detect parity (use FFmpeg's internal parity value).
  7380. @item bff
  7381. Assume bottom field first.
  7382. @item tff
  7383. Assume top field first.
  7384. @end table
  7385. Note that it is sometimes recommended not to trust the parity announced by the
  7386. stream.
  7387. Default value is @var{auto}.
  7388. @item mode
  7389. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  7390. sense that it won't risk creating jerkiness due to duplicate frames when
  7391. possible, but if there are bad edits or blended fields it will end up
  7392. outputting combed frames when a good match might actually exist. On the other
  7393. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  7394. but will almost always find a good frame if there is one. The other values are
  7395. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  7396. jerkiness and creating duplicate frames versus finding good matches in sections
  7397. with bad edits, orphaned fields, blended fields, etc.
  7398. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  7399. Available values are:
  7400. @table @samp
  7401. @item pc
  7402. 2-way matching (p/c)
  7403. @item pc_n
  7404. 2-way matching, and trying 3rd match if still combed (p/c + n)
  7405. @item pc_u
  7406. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  7407. @item pc_n_ub
  7408. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  7409. still combed (p/c + n + u/b)
  7410. @item pcn
  7411. 3-way matching (p/c/n)
  7412. @item pcn_ub
  7413. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  7414. detected as combed (p/c/n + u/b)
  7415. @end table
  7416. The parenthesis at the end indicate the matches that would be used for that
  7417. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  7418. @var{top}).
  7419. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  7420. the slowest.
  7421. Default value is @var{pc_n}.
  7422. @item ppsrc
  7423. Mark the main input stream as a pre-processed input, and enable the secondary
  7424. input stream as the clean source to pick the fields from. See the filter
  7425. introduction for more details. It is similar to the @option{clip2} feature from
  7426. VFM/TFM.
  7427. Default value is @code{0} (disabled).
  7428. @item field
  7429. Set the field to match from. It is recommended to set this to the same value as
  7430. @option{order} unless you experience matching failures with that setting. In
  7431. certain circumstances changing the field that is used to match from can have a
  7432. large impact on matching performance. Available values are:
  7433. @table @samp
  7434. @item auto
  7435. Automatic (same value as @option{order}).
  7436. @item bottom
  7437. Match from the bottom field.
  7438. @item top
  7439. Match from the top field.
  7440. @end table
  7441. Default value is @var{auto}.
  7442. @item mchroma
  7443. Set whether or not chroma is included during the match comparisons. In most
  7444. cases it is recommended to leave this enabled. You should set this to @code{0}
  7445. only if your clip has bad chroma problems such as heavy rainbowing or other
  7446. artifacts. Setting this to @code{0} could also be used to speed things up at
  7447. the cost of some accuracy.
  7448. Default value is @code{1}.
  7449. @item y0
  7450. @item y1
  7451. These define an exclusion band which excludes the lines between @option{y0} and
  7452. @option{y1} from being included in the field matching decision. An exclusion
  7453. band can be used to ignore subtitles, a logo, or other things that may
  7454. interfere with the matching. @option{y0} sets the starting scan line and
  7455. @option{y1} sets the ending line; all lines in between @option{y0} and
  7456. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  7457. @option{y0} and @option{y1} to the same value will disable the feature.
  7458. @option{y0} and @option{y1} defaults to @code{0}.
  7459. @item scthresh
  7460. Set the scene change detection threshold as a percentage of maximum change on
  7461. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  7462. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  7463. @option{scthresh} is @code{[0.0, 100.0]}.
  7464. Default value is @code{12.0}.
  7465. @item combmatch
  7466. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  7467. account the combed scores of matches when deciding what match to use as the
  7468. final match. Available values are:
  7469. @table @samp
  7470. @item none
  7471. No final matching based on combed scores.
  7472. @item sc
  7473. Combed scores are only used when a scene change is detected.
  7474. @item full
  7475. Use combed scores all the time.
  7476. @end table
  7477. Default is @var{sc}.
  7478. @item combdbg
  7479. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7480. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7481. Available values are:
  7482. @table @samp
  7483. @item none
  7484. No forced calculation.
  7485. @item pcn
  7486. Force p/c/n calculations.
  7487. @item pcnub
  7488. Force p/c/n/u/b calculations.
  7489. @end table
  7490. Default value is @var{none}.
  7491. @item cthresh
  7492. This is the area combing threshold used for combed frame detection. This
  7493. essentially controls how "strong" or "visible" combing must be to be detected.
  7494. Larger values mean combing must be more visible and smaller values mean combing
  7495. can be less visible or strong and still be detected. Valid settings are from
  7496. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7497. be detected as combed). This is basically a pixel difference value. A good
  7498. range is @code{[8, 12]}.
  7499. Default value is @code{9}.
  7500. @item chroma
  7501. Sets whether or not chroma is considered in the combed frame decision. Only
  7502. disable this if your source has chroma problems (rainbowing, etc.) that are
  7503. causing problems for the combed frame detection with chroma enabled. Actually,
  7504. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7505. where there is chroma only combing in the source.
  7506. Default value is @code{0}.
  7507. @item blockx
  7508. @item blocky
  7509. Respectively set the x-axis and y-axis size of the window used during combed
  7510. frame detection. This has to do with the size of the area in which
  7511. @option{combpel} pixels are required to be detected as combed for a frame to be
  7512. declared combed. See the @option{combpel} parameter description for more info.
  7513. Possible values are any number that is a power of 2 starting at 4 and going up
  7514. to 512.
  7515. Default value is @code{16}.
  7516. @item combpel
  7517. The number of combed pixels inside any of the @option{blocky} by
  7518. @option{blockx} size blocks on the frame for the frame to be detected as
  7519. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7520. setting controls "how much" combing there must be in any localized area (a
  7521. window defined by the @option{blockx} and @option{blocky} settings) on the
  7522. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7523. which point no frames will ever be detected as combed). This setting is known
  7524. as @option{MI} in TFM/VFM vocabulary.
  7525. Default value is @code{80}.
  7526. @end table
  7527. @anchor{p/c/n/u/b meaning}
  7528. @subsection p/c/n/u/b meaning
  7529. @subsubsection p/c/n
  7530. We assume the following telecined stream:
  7531. @example
  7532. Top fields: 1 2 2 3 4
  7533. Bottom fields: 1 2 3 4 4
  7534. @end example
  7535. The numbers correspond to the progressive frame the fields relate to. Here, the
  7536. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7537. When @code{fieldmatch} is configured to run a matching from bottom
  7538. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7539. @example
  7540. Input stream:
  7541. T 1 2 2 3 4
  7542. B 1 2 3 4 4 <-- matching reference
  7543. Matches: c c n n c
  7544. Output stream:
  7545. T 1 2 3 4 4
  7546. B 1 2 3 4 4
  7547. @end example
  7548. As a result of the field matching, we can see that some frames get duplicated.
  7549. To perform a complete inverse telecine, you need to rely on a decimation filter
  7550. after this operation. See for instance the @ref{decimate} filter.
  7551. The same operation now matching from top fields (@option{field}=@var{top})
  7552. looks like this:
  7553. @example
  7554. Input stream:
  7555. T 1 2 2 3 4 <-- matching reference
  7556. B 1 2 3 4 4
  7557. Matches: c c p p c
  7558. Output stream:
  7559. T 1 2 2 3 4
  7560. B 1 2 2 3 4
  7561. @end example
  7562. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7563. basically, they refer to the frame and field of the opposite parity:
  7564. @itemize
  7565. @item @var{p} matches the field of the opposite parity in the previous frame
  7566. @item @var{c} matches the field of the opposite parity in the current frame
  7567. @item @var{n} matches the field of the opposite parity in the next frame
  7568. @end itemize
  7569. @subsubsection u/b
  7570. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7571. from the opposite parity flag. In the following examples, we assume that we are
  7572. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7573. 'x' is placed above and below each matched fields.
  7574. With bottom matching (@option{field}=@var{bottom}):
  7575. @example
  7576. Match: c p n b u
  7577. x x x x x
  7578. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7579. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7580. x x x x x
  7581. Output frames:
  7582. 2 1 2 2 2
  7583. 2 2 2 1 3
  7584. @end example
  7585. With top matching (@option{field}=@var{top}):
  7586. @example
  7587. Match: c p n b u
  7588. x x x x x
  7589. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7590. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7591. x x x x x
  7592. Output frames:
  7593. 2 2 2 1 2
  7594. 2 1 3 2 2
  7595. @end example
  7596. @subsection Examples
  7597. Simple IVTC of a top field first telecined stream:
  7598. @example
  7599. fieldmatch=order=tff:combmatch=none, decimate
  7600. @end example
  7601. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7602. @example
  7603. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7604. @end example
  7605. @section fieldorder
  7606. Transform the field order of the input video.
  7607. It accepts the following parameters:
  7608. @table @option
  7609. @item order
  7610. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7611. for bottom field first.
  7612. @end table
  7613. The default value is @samp{tff}.
  7614. The transformation is done by shifting the picture content up or down
  7615. by one line, and filling the remaining line with appropriate picture content.
  7616. This method is consistent with most broadcast field order converters.
  7617. If the input video is not flagged as being interlaced, or it is already
  7618. flagged as being of the required output field order, then this filter does
  7619. not alter the incoming video.
  7620. It is very useful when converting to or from PAL DV material,
  7621. which is bottom field first.
  7622. For example:
  7623. @example
  7624. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7625. @end example
  7626. @section fifo, afifo
  7627. Buffer input images and send them when they are requested.
  7628. It is mainly useful when auto-inserted by the libavfilter
  7629. framework.
  7630. It does not take parameters.
  7631. @section fillborders
  7632. Fill borders of the input video, without changing video stream dimensions.
  7633. Sometimes video can have garbage at the four edges and you may not want to
  7634. crop video input to keep size multiple of some number.
  7635. This filter accepts the following options:
  7636. @table @option
  7637. @item left
  7638. Number of pixels to fill from left border.
  7639. @item right
  7640. Number of pixels to fill from right border.
  7641. @item top
  7642. Number of pixels to fill from top border.
  7643. @item bottom
  7644. Number of pixels to fill from bottom border.
  7645. @item mode
  7646. Set fill mode.
  7647. It accepts the following values:
  7648. @table @samp
  7649. @item smear
  7650. fill pixels using outermost pixels
  7651. @item mirror
  7652. fill pixels using mirroring
  7653. @item fixed
  7654. fill pixels with constant value
  7655. @end table
  7656. Default is @var{smear}.
  7657. @item color
  7658. Set color for pixels in fixed mode. Default is @var{black}.
  7659. @end table
  7660. @section find_rect
  7661. Find a rectangular object
  7662. It accepts the following options:
  7663. @table @option
  7664. @item object
  7665. Filepath of the object image, needs to be in gray8.
  7666. @item threshold
  7667. Detection threshold, default is 0.5.
  7668. @item mipmaps
  7669. Number of mipmaps, default is 3.
  7670. @item xmin, ymin, xmax, ymax
  7671. Specifies the rectangle in which to search.
  7672. @end table
  7673. @subsection Examples
  7674. @itemize
  7675. @item
  7676. Generate a representative palette of a given video using @command{ffmpeg}:
  7677. @example
  7678. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7679. @end example
  7680. @end itemize
  7681. @section cover_rect
  7682. Cover a rectangular object
  7683. It accepts the following options:
  7684. @table @option
  7685. @item cover
  7686. Filepath of the optional cover image, needs to be in yuv420.
  7687. @item mode
  7688. Set covering mode.
  7689. It accepts the following values:
  7690. @table @samp
  7691. @item cover
  7692. cover it by the supplied image
  7693. @item blur
  7694. cover it by interpolating the surrounding pixels
  7695. @end table
  7696. Default value is @var{blur}.
  7697. @end table
  7698. @subsection Examples
  7699. @itemize
  7700. @item
  7701. Generate a representative palette of a given video using @command{ffmpeg}:
  7702. @example
  7703. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7704. @end example
  7705. @end itemize
  7706. @section floodfill
  7707. Flood area with values of same pixel components with another values.
  7708. It accepts the following options:
  7709. @table @option
  7710. @item x
  7711. Set pixel x coordinate.
  7712. @item y
  7713. Set pixel y coordinate.
  7714. @item s0
  7715. Set source #0 component value.
  7716. @item s1
  7717. Set source #1 component value.
  7718. @item s2
  7719. Set source #2 component value.
  7720. @item s3
  7721. Set source #3 component value.
  7722. @item d0
  7723. Set destination #0 component value.
  7724. @item d1
  7725. Set destination #1 component value.
  7726. @item d2
  7727. Set destination #2 component value.
  7728. @item d3
  7729. Set destination #3 component value.
  7730. @end table
  7731. @anchor{format}
  7732. @section format
  7733. Convert the input video to one of the specified pixel formats.
  7734. Libavfilter will try to pick one that is suitable as input to
  7735. the next filter.
  7736. It accepts the following parameters:
  7737. @table @option
  7738. @item pix_fmts
  7739. A '|'-separated list of pixel format names, such as
  7740. "pix_fmts=yuv420p|monow|rgb24".
  7741. @end table
  7742. @subsection Examples
  7743. @itemize
  7744. @item
  7745. Convert the input video to the @var{yuv420p} format
  7746. @example
  7747. format=pix_fmts=yuv420p
  7748. @end example
  7749. Convert the input video to any of the formats in the list
  7750. @example
  7751. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7752. @end example
  7753. @end itemize
  7754. @anchor{fps}
  7755. @section fps
  7756. Convert the video to specified constant frame rate by duplicating or dropping
  7757. frames as necessary.
  7758. It accepts the following parameters:
  7759. @table @option
  7760. @item fps
  7761. The desired output frame rate. The default is @code{25}.
  7762. @item start_time
  7763. Assume the first PTS should be the given value, in seconds. This allows for
  7764. padding/trimming at the start of stream. By default, no assumption is made
  7765. about the first frame's expected PTS, so no padding or trimming is done.
  7766. For example, this could be set to 0 to pad the beginning with duplicates of
  7767. the first frame if a video stream starts after the audio stream or to trim any
  7768. frames with a negative PTS.
  7769. @item round
  7770. Timestamp (PTS) rounding method.
  7771. Possible values are:
  7772. @table @option
  7773. @item zero
  7774. round towards 0
  7775. @item inf
  7776. round away from 0
  7777. @item down
  7778. round towards -infinity
  7779. @item up
  7780. round towards +infinity
  7781. @item near
  7782. round to nearest
  7783. @end table
  7784. The default is @code{near}.
  7785. @item eof_action
  7786. Action performed when reading the last frame.
  7787. Possible values are:
  7788. @table @option
  7789. @item round
  7790. Use same timestamp rounding method as used for other frames.
  7791. @item pass
  7792. Pass through last frame if input duration has not been reached yet.
  7793. @end table
  7794. The default is @code{round}.
  7795. @end table
  7796. Alternatively, the options can be specified as a flat string:
  7797. @var{fps}[:@var{start_time}[:@var{round}]].
  7798. See also the @ref{setpts} filter.
  7799. @subsection Examples
  7800. @itemize
  7801. @item
  7802. A typical usage in order to set the fps to 25:
  7803. @example
  7804. fps=fps=25
  7805. @end example
  7806. @item
  7807. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7808. @example
  7809. fps=fps=film:round=near
  7810. @end example
  7811. @end itemize
  7812. @section framepack
  7813. Pack two different video streams into a stereoscopic video, setting proper
  7814. metadata on supported codecs. The two views should have the same size and
  7815. framerate and processing will stop when the shorter video ends. Please note
  7816. that you may conveniently adjust view properties with the @ref{scale} and
  7817. @ref{fps} filters.
  7818. It accepts the following parameters:
  7819. @table @option
  7820. @item format
  7821. The desired packing format. Supported values are:
  7822. @table @option
  7823. @item sbs
  7824. The views are next to each other (default).
  7825. @item tab
  7826. The views are on top of each other.
  7827. @item lines
  7828. The views are packed by line.
  7829. @item columns
  7830. The views are packed by column.
  7831. @item frameseq
  7832. The views are temporally interleaved.
  7833. @end table
  7834. @end table
  7835. Some examples:
  7836. @example
  7837. # Convert left and right views into a frame-sequential video
  7838. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7839. # Convert views into a side-by-side video with the same output resolution as the input
  7840. ffmpeg -i LEFT -i RIGHT -filter_complex [0:v]scale=w=iw/2[left],[1:v]scale=w=iw/2[right],[left][right]framepack=sbs OUTPUT
  7841. @end example
  7842. @section framerate
  7843. Change the frame rate by interpolating new video output frames from the source
  7844. frames.
  7845. This filter is not designed to function correctly with interlaced media. If
  7846. you wish to change the frame rate of interlaced media then you are required
  7847. to deinterlace before this filter and re-interlace after this filter.
  7848. A description of the accepted options follows.
  7849. @table @option
  7850. @item fps
  7851. Specify the output frames per second. This option can also be specified
  7852. as a value alone. The default is @code{50}.
  7853. @item interp_start
  7854. Specify the start of a range where the output frame will be created as a
  7855. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7856. the default is @code{15}.
  7857. @item interp_end
  7858. Specify the end of a range where the output frame will be created as a
  7859. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7860. the default is @code{240}.
  7861. @item scene
  7862. Specify the level at which a scene change is detected as a value between
  7863. 0 and 100 to indicate a new scene; a low value reflects a low
  7864. probability for the current frame to introduce a new scene, while a higher
  7865. value means the current frame is more likely to be one.
  7866. The default is @code{8.2}.
  7867. @item flags
  7868. Specify flags influencing the filter process.
  7869. Available value for @var{flags} is:
  7870. @table @option
  7871. @item scene_change_detect, scd
  7872. Enable scene change detection using the value of the option @var{scene}.
  7873. This flag is enabled by default.
  7874. @end table
  7875. @end table
  7876. @section framestep
  7877. Select one frame every N-th frame.
  7878. This filter accepts the following option:
  7879. @table @option
  7880. @item step
  7881. Select frame after every @code{step} frames.
  7882. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7883. @end table
  7884. @section freezedetect
  7885. Detect frozen video.
  7886. This filter logs a message and sets frame metadata when it detects that the
  7887. input video has no significant change in content during a specified duration.
  7888. Video freeze detection calculates the mean average absolute difference of all
  7889. the components of video frames and compares it to a noise floor.
  7890. The printed times and duration are expressed in seconds. The
  7891. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  7892. whose timestamp equals or exceeds the detection duration and it contains the
  7893. timestamp of the first frame of the freeze. The
  7894. @code{lavfi.freezedetect.freeze_duration} and
  7895. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  7896. after the freeze.
  7897. The filter accepts the following options:
  7898. @table @option
  7899. @item noise, n
  7900. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  7901. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  7902. 0.001.
  7903. @item duration, d
  7904. Set freeze duration until notification (default is 2 seconds).
  7905. @end table
  7906. @anchor{frei0r}
  7907. @section frei0r
  7908. Apply a frei0r effect to the input video.
  7909. To enable the compilation of this filter, you need to install the frei0r
  7910. header and configure FFmpeg with @code{--enable-frei0r}.
  7911. It accepts the following parameters:
  7912. @table @option
  7913. @item filter_name
  7914. The name of the frei0r effect to load. If the environment variable
  7915. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7916. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7917. Otherwise, the standard frei0r paths are searched, in this order:
  7918. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7919. @file{/usr/lib/frei0r-1/}.
  7920. @item filter_params
  7921. A '|'-separated list of parameters to pass to the frei0r effect.
  7922. @end table
  7923. A frei0r effect parameter can be a boolean (its value is either
  7924. "y" or "n"), a double, a color (specified as
  7925. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7926. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  7927. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  7928. a position (specified as @var{X}/@var{Y}, where
  7929. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7930. The number and types of parameters depend on the loaded effect. If an
  7931. effect parameter is not specified, the default value is set.
  7932. @subsection Examples
  7933. @itemize
  7934. @item
  7935. Apply the distort0r effect, setting the first two double parameters:
  7936. @example
  7937. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7938. @end example
  7939. @item
  7940. Apply the colordistance effect, taking a color as the first parameter:
  7941. @example
  7942. frei0r=colordistance:0.2/0.3/0.4
  7943. frei0r=colordistance:violet
  7944. frei0r=colordistance:0x112233
  7945. @end example
  7946. @item
  7947. Apply the perspective effect, specifying the top left and top right image
  7948. positions:
  7949. @example
  7950. frei0r=perspective:0.2/0.2|0.8/0.2
  7951. @end example
  7952. @end itemize
  7953. For more information, see
  7954. @url{http://frei0r.dyne.org}
  7955. @section fspp
  7956. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7957. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7958. processing filter, one of them is performed once per block, not per pixel.
  7959. This allows for much higher speed.
  7960. The filter accepts the following options:
  7961. @table @option
  7962. @item quality
  7963. Set quality. This option defines the number of levels for averaging. It accepts
  7964. an integer in the range 4-5. Default value is @code{4}.
  7965. @item qp
  7966. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7967. If not set, the filter will use the QP from the video stream (if available).
  7968. @item strength
  7969. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  7970. more details but also more artifacts, while higher values make the image smoother
  7971. but also blurrier. Default value is @code{0} − PSNR optimal.
  7972. @item use_bframe_qp
  7973. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7974. option may cause flicker since the B-Frames have often larger QP. Default is
  7975. @code{0} (not enabled).
  7976. @end table
  7977. @section gblur
  7978. Apply Gaussian blur filter.
  7979. The filter accepts the following options:
  7980. @table @option
  7981. @item sigma
  7982. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  7983. @item steps
  7984. Set number of steps for Gaussian approximation. Default is @code{1}.
  7985. @item planes
  7986. Set which planes to filter. By default all planes are filtered.
  7987. @item sigmaV
  7988. Set vertical sigma, if negative it will be same as @code{sigma}.
  7989. Default is @code{-1}.
  7990. @end table
  7991. @section geq
  7992. Apply generic equation to each pixel.
  7993. The filter accepts the following options:
  7994. @table @option
  7995. @item lum_expr, lum
  7996. Set the luminance expression.
  7997. @item cb_expr, cb
  7998. Set the chrominance blue expression.
  7999. @item cr_expr, cr
  8000. Set the chrominance red expression.
  8001. @item alpha_expr, a
  8002. Set the alpha expression.
  8003. @item red_expr, r
  8004. Set the red expression.
  8005. @item green_expr, g
  8006. Set the green expression.
  8007. @item blue_expr, b
  8008. Set the blue expression.
  8009. @end table
  8010. The colorspace is selected according to the specified options. If one
  8011. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  8012. options is specified, the filter will automatically select a YCbCr
  8013. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  8014. @option{blue_expr} options is specified, it will select an RGB
  8015. colorspace.
  8016. If one of the chrominance expression is not defined, it falls back on the other
  8017. one. If no alpha expression is specified it will evaluate to opaque value.
  8018. If none of chrominance expressions are specified, they will evaluate
  8019. to the luminance expression.
  8020. The expressions can use the following variables and functions:
  8021. @table @option
  8022. @item N
  8023. The sequential number of the filtered frame, starting from @code{0}.
  8024. @item X
  8025. @item Y
  8026. The coordinates of the current sample.
  8027. @item W
  8028. @item H
  8029. The width and height of the image.
  8030. @item SW
  8031. @item SH
  8032. Width and height scale depending on the currently filtered plane. It is the
  8033. ratio between the corresponding luma plane number of pixels and the current
  8034. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  8035. @code{0.5,0.5} for chroma planes.
  8036. @item T
  8037. Time of the current frame, expressed in seconds.
  8038. @item p(x, y)
  8039. Return the value of the pixel at location (@var{x},@var{y}) of the current
  8040. plane.
  8041. @item lum(x, y)
  8042. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  8043. plane.
  8044. @item cb(x, y)
  8045. Return the value of the pixel at location (@var{x},@var{y}) of the
  8046. blue-difference chroma plane. Return 0 if there is no such plane.
  8047. @item cr(x, y)
  8048. Return the value of the pixel at location (@var{x},@var{y}) of the
  8049. red-difference chroma plane. Return 0 if there is no such plane.
  8050. @item r(x, y)
  8051. @item g(x, y)
  8052. @item b(x, y)
  8053. Return the value of the pixel at location (@var{x},@var{y}) of the
  8054. red/green/blue component. Return 0 if there is no such component.
  8055. @item alpha(x, y)
  8056. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  8057. plane. Return 0 if there is no such plane.
  8058. @end table
  8059. For functions, if @var{x} and @var{y} are outside the area, the value will be
  8060. automatically clipped to the closer edge.
  8061. @subsection Examples
  8062. @itemize
  8063. @item
  8064. Flip the image horizontally:
  8065. @example
  8066. geq=p(W-X\,Y)
  8067. @end example
  8068. @item
  8069. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  8070. wavelength of 100 pixels:
  8071. @example
  8072. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  8073. @end example
  8074. @item
  8075. Generate a fancy enigmatic moving light:
  8076. @example
  8077. nullsrc=s=256x256,geq=random(1)/hypot(X-cos(N*0.07)*W/2-W/2\,Y-sin(N*0.09)*H/2-H/2)^2*1000000*sin(N*0.02):128:128
  8078. @end example
  8079. @item
  8080. Generate a quick emboss effect:
  8081. @example
  8082. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  8083. @end example
  8084. @item
  8085. Modify RGB components depending on pixel position:
  8086. @example
  8087. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  8088. @end example
  8089. @item
  8090. Create a radial gradient that is the same size as the input (also see
  8091. the @ref{vignette} filter):
  8092. @example
  8093. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  8094. @end example
  8095. @end itemize
  8096. @section gradfun
  8097. Fix the banding artifacts that are sometimes introduced into nearly flat
  8098. regions by truncation to 8-bit color depth.
  8099. Interpolate the gradients that should go where the bands are, and
  8100. dither them.
  8101. It is designed for playback only. Do not use it prior to
  8102. lossy compression, because compression tends to lose the dither and
  8103. bring back the bands.
  8104. It accepts the following parameters:
  8105. @table @option
  8106. @item strength
  8107. The maximum amount by which the filter will change any one pixel. This is also
  8108. the threshold for detecting nearly flat regions. Acceptable values range from
  8109. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  8110. valid range.
  8111. @item radius
  8112. The neighborhood to fit the gradient to. A larger radius makes for smoother
  8113. gradients, but also prevents the filter from modifying the pixels near detailed
  8114. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  8115. values will be clipped to the valid range.
  8116. @end table
  8117. Alternatively, the options can be specified as a flat string:
  8118. @var{strength}[:@var{radius}]
  8119. @subsection Examples
  8120. @itemize
  8121. @item
  8122. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8123. @example
  8124. gradfun=3.5:8
  8125. @end example
  8126. @item
  8127. Specify radius, omitting the strength (which will fall-back to the default
  8128. value):
  8129. @example
  8130. gradfun=radius=8
  8131. @end example
  8132. @end itemize
  8133. @section graphmonitor, agraphmonitor
  8134. Show various filtergraph stats.
  8135. With this filter one can debug complete filtergraph.
  8136. Especially issues with links filling with queued frames.
  8137. The filter accepts the following options:
  8138. @table @option
  8139. @item size, s
  8140. Set video output size. Default is @var{hd720}.
  8141. @item opacity, o
  8142. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8143. @item mode, m
  8144. Set output mode, can be @var{fulll} or @var{compact}.
  8145. In @var{compact} mode only filters with some queued frames have displayed stats.
  8146. @item flags, f
  8147. Set flags which enable which stats are shown in video.
  8148. Available values for flags are:
  8149. @table @samp
  8150. @item queue
  8151. Display number of queued frames in each link.
  8152. @item frame_count_in
  8153. Display number of frames taken from filter.
  8154. @item frame_count_out
  8155. Display number of frames given out from filter.
  8156. @item pts
  8157. Display current filtered frame pts.
  8158. @item time
  8159. Display current filtered frame time.
  8160. @item timebase
  8161. Display time base for filter link.
  8162. @item format
  8163. Display used format for filter link.
  8164. @item size
  8165. Display video size or number of audio channels in case of audio used by filter link.
  8166. @item rate
  8167. Display video frame rate or sample rate in case of audio used by filter link.
  8168. @end table
  8169. @item rate, r
  8170. Set upper limit for video rate of output stream, Default value is @var{25}.
  8171. This guarantee that output video frame rate will not be higher than this value.
  8172. @end table
  8173. @section greyedge
  8174. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8175. and corrects the scene colors accordingly.
  8176. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8177. The filter accepts the following options:
  8178. @table @option
  8179. @item difford
  8180. The order of differentiation to be applied on the scene. Must be chosen in the range
  8181. [0,2] and default value is 1.
  8182. @item minknorm
  8183. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8184. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8185. max value instead of calculating Minkowski distance.
  8186. @item sigma
  8187. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8188. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8189. can't be equal to 0 if @var{difford} is greater than 0.
  8190. @end table
  8191. @subsection Examples
  8192. @itemize
  8193. @item
  8194. Grey Edge:
  8195. @example
  8196. greyedge=difford=1:minknorm=5:sigma=2
  8197. @end example
  8198. @item
  8199. Max Edge:
  8200. @example
  8201. greyedge=difford=1:minknorm=0:sigma=2
  8202. @end example
  8203. @end itemize
  8204. @anchor{haldclut}
  8205. @section haldclut
  8206. Apply a Hald CLUT to a video stream.
  8207. First input is the video stream to process, and second one is the Hald CLUT.
  8208. The Hald CLUT input can be a simple picture or a complete video stream.
  8209. The filter accepts the following options:
  8210. @table @option
  8211. @item shortest
  8212. Force termination when the shortest input terminates. Default is @code{0}.
  8213. @item repeatlast
  8214. Continue applying the last CLUT after the end of the stream. A value of
  8215. @code{0} disable the filter after the last frame of the CLUT is reached.
  8216. Default is @code{1}.
  8217. @end table
  8218. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  8219. filters share the same internals).
  8220. More information about the Hald CLUT can be found on Eskil Steenberg's website
  8221. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  8222. @subsection Workflow examples
  8223. @subsubsection Hald CLUT video stream
  8224. Generate an identity Hald CLUT stream altered with various effects:
  8225. @example
  8226. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "hue=H=2*PI*t:s=sin(2*PI*t)+1, curves=cross_process" -t 10 -c:v ffv1 clut.nut
  8227. @end example
  8228. Note: make sure you use a lossless codec.
  8229. Then use it with @code{haldclut} to apply it on some random stream:
  8230. @example
  8231. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8232. @end example
  8233. The Hald CLUT will be applied to the 10 first seconds (duration of
  8234. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8235. to the remaining frames of the @code{mandelbrot} stream.
  8236. @subsubsection Hald CLUT with preview
  8237. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8238. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8239. biggest possible square starting at the top left of the picture. The remaining
  8240. padding pixels (bottom or right) will be ignored. This area can be used to add
  8241. a preview of the Hald CLUT.
  8242. Typically, the following generated Hald CLUT will be supported by the
  8243. @code{haldclut} filter:
  8244. @example
  8245. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8246. pad=iw+320 [padded_clut];
  8247. smptebars=s=320x256, split [a][b];
  8248. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8249. [main][b] overlay=W-320" -frames:v 1 clut.png
  8250. @end example
  8251. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8252. bars are displayed on the right-top, and below the same color bars processed by
  8253. the color changes.
  8254. Then, the effect of this Hald CLUT can be visualized with:
  8255. @example
  8256. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8257. @end example
  8258. @section hflip
  8259. Flip the input video horizontally.
  8260. For example, to horizontally flip the input video with @command{ffmpeg}:
  8261. @example
  8262. ffmpeg -i in.avi -vf "hflip" out.avi
  8263. @end example
  8264. @section histeq
  8265. This filter applies a global color histogram equalization on a
  8266. per-frame basis.
  8267. It can be used to correct video that has a compressed range of pixel
  8268. intensities. The filter redistributes the pixel intensities to
  8269. equalize their distribution across the intensity range. It may be
  8270. viewed as an "automatically adjusting contrast filter". This filter is
  8271. useful only for correcting degraded or poorly captured source
  8272. video.
  8273. The filter accepts the following options:
  8274. @table @option
  8275. @item strength
  8276. Determine the amount of equalization to be applied. As the strength
  8277. is reduced, the distribution of pixel intensities more-and-more
  8278. approaches that of the input frame. The value must be a float number
  8279. in the range [0,1] and defaults to 0.200.
  8280. @item intensity
  8281. Set the maximum intensity that can generated and scale the output
  8282. values appropriately. The strength should be set as desired and then
  8283. the intensity can be limited if needed to avoid washing-out. The value
  8284. must be a float number in the range [0,1] and defaults to 0.210.
  8285. @item antibanding
  8286. Set the antibanding level. If enabled the filter will randomly vary
  8287. the luminance of output pixels by a small amount to avoid banding of
  8288. the histogram. Possible values are @code{none}, @code{weak} or
  8289. @code{strong}. It defaults to @code{none}.
  8290. @end table
  8291. @section histogram
  8292. Compute and draw a color distribution histogram for the input video.
  8293. The computed histogram is a representation of the color component
  8294. distribution in an image.
  8295. Standard histogram displays the color components distribution in an image.
  8296. Displays color graph for each color component. Shows distribution of
  8297. the Y, U, V, A or R, G, B components, depending on input format, in the
  8298. current frame. Below each graph a color component scale meter is shown.
  8299. The filter accepts the following options:
  8300. @table @option
  8301. @item level_height
  8302. Set height of level. Default value is @code{200}.
  8303. Allowed range is [50, 2048].
  8304. @item scale_height
  8305. Set height of color scale. Default value is @code{12}.
  8306. Allowed range is [0, 40].
  8307. @item display_mode
  8308. Set display mode.
  8309. It accepts the following values:
  8310. @table @samp
  8311. @item stack
  8312. Per color component graphs are placed below each other.
  8313. @item parade
  8314. Per color component graphs are placed side by side.
  8315. @item overlay
  8316. Presents information identical to that in the @code{parade}, except
  8317. that the graphs representing color components are superimposed directly
  8318. over one another.
  8319. @end table
  8320. Default is @code{stack}.
  8321. @item levels_mode
  8322. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8323. Default is @code{linear}.
  8324. @item components
  8325. Set what color components to display.
  8326. Default is @code{7}.
  8327. @item fgopacity
  8328. Set foreground opacity. Default is @code{0.7}.
  8329. @item bgopacity
  8330. Set background opacity. Default is @code{0.5}.
  8331. @end table
  8332. @subsection Examples
  8333. @itemize
  8334. @item
  8335. Calculate and draw histogram:
  8336. @example
  8337. ffplay -i input -vf histogram
  8338. @end example
  8339. @end itemize
  8340. @anchor{hqdn3d}
  8341. @section hqdn3d
  8342. This is a high precision/quality 3d denoise filter. It aims to reduce
  8343. image noise, producing smooth images and making still images really
  8344. still. It should enhance compressibility.
  8345. It accepts the following optional parameters:
  8346. @table @option
  8347. @item luma_spatial
  8348. A non-negative floating point number which specifies spatial luma strength.
  8349. It defaults to 4.0.
  8350. @item chroma_spatial
  8351. A non-negative floating point number which specifies spatial chroma strength.
  8352. It defaults to 3.0*@var{luma_spatial}/4.0.
  8353. @item luma_tmp
  8354. A floating point number which specifies luma temporal strength. It defaults to
  8355. 6.0*@var{luma_spatial}/4.0.
  8356. @item chroma_tmp
  8357. A floating point number which specifies chroma temporal strength. It defaults to
  8358. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  8359. @end table
  8360. @anchor{hwdownload}
  8361. @section hwdownload
  8362. Download hardware frames to system memory.
  8363. The input must be in hardware frames, and the output a non-hardware format.
  8364. Not all formats will be supported on the output - it may be necessary to insert
  8365. an additional @option{format} filter immediately following in the graph to get
  8366. the output in a supported format.
  8367. @section hwmap
  8368. Map hardware frames to system memory or to another device.
  8369. This filter has several different modes of operation; which one is used depends
  8370. on the input and output formats:
  8371. @itemize
  8372. @item
  8373. Hardware frame input, normal frame output
  8374. Map the input frames to system memory and pass them to the output. If the
  8375. original hardware frame is later required (for example, after overlaying
  8376. something else on part of it), the @option{hwmap} filter can be used again
  8377. in the next mode to retrieve it.
  8378. @item
  8379. Normal frame input, hardware frame output
  8380. If the input is actually a software-mapped hardware frame, then unmap it -
  8381. that is, return the original hardware frame.
  8382. Otherwise, a device must be provided. Create new hardware surfaces on that
  8383. device for the output, then map them back to the software format at the input
  8384. and give those frames to the preceding filter. This will then act like the
  8385. @option{hwupload} filter, but may be able to avoid an additional copy when
  8386. the input is already in a compatible format.
  8387. @item
  8388. Hardware frame input and output
  8389. A device must be supplied for the output, either directly or with the
  8390. @option{derive_device} option. The input and output devices must be of
  8391. different types and compatible - the exact meaning of this is
  8392. system-dependent, but typically it means that they must refer to the same
  8393. underlying hardware context (for example, refer to the same graphics card).
  8394. If the input frames were originally created on the output device, then unmap
  8395. to retrieve the original frames.
  8396. Otherwise, map the frames to the output device - create new hardware frames
  8397. on the output corresponding to the frames on the input.
  8398. @end itemize
  8399. The following additional parameters are accepted:
  8400. @table @option
  8401. @item mode
  8402. Set the frame mapping mode. Some combination of:
  8403. @table @var
  8404. @item read
  8405. The mapped frame should be readable.
  8406. @item write
  8407. The mapped frame should be writeable.
  8408. @item overwrite
  8409. The mapping will always overwrite the entire frame.
  8410. This may improve performance in some cases, as the original contents of the
  8411. frame need not be loaded.
  8412. @item direct
  8413. The mapping must not involve any copying.
  8414. Indirect mappings to copies of frames are created in some cases where either
  8415. direct mapping is not possible or it would have unexpected properties.
  8416. Setting this flag ensures that the mapping is direct and will fail if that is
  8417. not possible.
  8418. @end table
  8419. Defaults to @var{read+write} if not specified.
  8420. @item derive_device @var{type}
  8421. Rather than using the device supplied at initialisation, instead derive a new
  8422. device of type @var{type} from the device the input frames exist on.
  8423. @item reverse
  8424. In a hardware to hardware mapping, map in reverse - create frames in the sink
  8425. and map them back to the source. This may be necessary in some cases where
  8426. a mapping in one direction is required but only the opposite direction is
  8427. supported by the devices being used.
  8428. This option is dangerous - it may break the preceding filter in undefined
  8429. ways if there are any additional constraints on that filter's output.
  8430. Do not use it without fully understanding the implications of its use.
  8431. @end table
  8432. @anchor{hwupload}
  8433. @section hwupload
  8434. Upload system memory frames to hardware surfaces.
  8435. The device to upload to must be supplied when the filter is initialised. If
  8436. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  8437. option.
  8438. @anchor{hwupload_cuda}
  8439. @section hwupload_cuda
  8440. Upload system memory frames to a CUDA device.
  8441. It accepts the following optional parameters:
  8442. @table @option
  8443. @item device
  8444. The number of the CUDA device to use
  8445. @end table
  8446. @section hqx
  8447. Apply a high-quality magnification filter designed for pixel art. This filter
  8448. was originally created by Maxim Stepin.
  8449. It accepts the following option:
  8450. @table @option
  8451. @item n
  8452. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  8453. @code{hq3x} and @code{4} for @code{hq4x}.
  8454. Default is @code{3}.
  8455. @end table
  8456. @section hstack
  8457. Stack input videos horizontally.
  8458. All streams must be of same pixel format and of same height.
  8459. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8460. to create same output.
  8461. The filter accept the following option:
  8462. @table @option
  8463. @item inputs
  8464. Set number of input streams. Default is 2.
  8465. @item shortest
  8466. If set to 1, force the output to terminate when the shortest input
  8467. terminates. Default value is 0.
  8468. @end table
  8469. @section hue
  8470. Modify the hue and/or the saturation of the input.
  8471. It accepts the following parameters:
  8472. @table @option
  8473. @item h
  8474. Specify the hue angle as a number of degrees. It accepts an expression,
  8475. and defaults to "0".
  8476. @item s
  8477. Specify the saturation in the [-10,10] range. It accepts an expression and
  8478. defaults to "1".
  8479. @item H
  8480. Specify the hue angle as a number of radians. It accepts an
  8481. expression, and defaults to "0".
  8482. @item b
  8483. Specify the brightness in the [-10,10] range. It accepts an expression and
  8484. defaults to "0".
  8485. @end table
  8486. @option{h} and @option{H} are mutually exclusive, and can't be
  8487. specified at the same time.
  8488. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  8489. expressions containing the following constants:
  8490. @table @option
  8491. @item n
  8492. frame count of the input frame starting from 0
  8493. @item pts
  8494. presentation timestamp of the input frame expressed in time base units
  8495. @item r
  8496. frame rate of the input video, NAN if the input frame rate is unknown
  8497. @item t
  8498. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8499. @item tb
  8500. time base of the input video
  8501. @end table
  8502. @subsection Examples
  8503. @itemize
  8504. @item
  8505. Set the hue to 90 degrees and the saturation to 1.0:
  8506. @example
  8507. hue=h=90:s=1
  8508. @end example
  8509. @item
  8510. Same command but expressing the hue in radians:
  8511. @example
  8512. hue=H=PI/2:s=1
  8513. @end example
  8514. @item
  8515. Rotate hue and make the saturation swing between 0
  8516. and 2 over a period of 1 second:
  8517. @example
  8518. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  8519. @end example
  8520. @item
  8521. Apply a 3 seconds saturation fade-in effect starting at 0:
  8522. @example
  8523. hue="s=min(t/3\,1)"
  8524. @end example
  8525. The general fade-in expression can be written as:
  8526. @example
  8527. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  8528. @end example
  8529. @item
  8530. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  8531. @example
  8532. hue="s=max(0\, min(1\, (8-t)/3))"
  8533. @end example
  8534. The general fade-out expression can be written as:
  8535. @example
  8536. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8537. @end example
  8538. @end itemize
  8539. @subsection Commands
  8540. This filter supports the following commands:
  8541. @table @option
  8542. @item b
  8543. @item s
  8544. @item h
  8545. @item H
  8546. Modify the hue and/or the saturation and/or brightness of the input video.
  8547. The command accepts the same syntax of the corresponding option.
  8548. If the specified expression is not valid, it is kept at its current
  8549. value.
  8550. @end table
  8551. @section hysteresis
  8552. Grow first stream into second stream by connecting components.
  8553. This makes it possible to build more robust edge masks.
  8554. This filter accepts the following options:
  8555. @table @option
  8556. @item planes
  8557. Set which planes will be processed as bitmap, unprocessed planes will be
  8558. copied from first stream.
  8559. By default value 0xf, all planes will be processed.
  8560. @item threshold
  8561. Set threshold which is used in filtering. If pixel component value is higher than
  8562. this value filter algorithm for connecting components is activated.
  8563. By default value is 0.
  8564. @end table
  8565. @section idet
  8566. Detect video interlacing type.
  8567. This filter tries to detect if the input frames are interlaced, progressive,
  8568. top or bottom field first. It will also try to detect fields that are
  8569. repeated between adjacent frames (a sign of telecine).
  8570. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8571. Multiple frame detection incorporates the classification history of previous frames.
  8572. The filter will log these metadata values:
  8573. @table @option
  8574. @item single.current_frame
  8575. Detected type of current frame using single-frame detection. One of:
  8576. ``tff'' (top field first), ``bff'' (bottom field first),
  8577. ``progressive'', or ``undetermined''
  8578. @item single.tff
  8579. Cumulative number of frames detected as top field first using single-frame detection.
  8580. @item multiple.tff
  8581. Cumulative number of frames detected as top field first using multiple-frame detection.
  8582. @item single.bff
  8583. Cumulative number of frames detected as bottom field first using single-frame detection.
  8584. @item multiple.current_frame
  8585. Detected type of current frame using multiple-frame detection. One of:
  8586. ``tff'' (top field first), ``bff'' (bottom field first),
  8587. ``progressive'', or ``undetermined''
  8588. @item multiple.bff
  8589. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8590. @item single.progressive
  8591. Cumulative number of frames detected as progressive using single-frame detection.
  8592. @item multiple.progressive
  8593. Cumulative number of frames detected as progressive using multiple-frame detection.
  8594. @item single.undetermined
  8595. Cumulative number of frames that could not be classified using single-frame detection.
  8596. @item multiple.undetermined
  8597. Cumulative number of frames that could not be classified using multiple-frame detection.
  8598. @item repeated.current_frame
  8599. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8600. @item repeated.neither
  8601. Cumulative number of frames with no repeated field.
  8602. @item repeated.top
  8603. Cumulative number of frames with the top field repeated from the previous frame's top field.
  8604. @item repeated.bottom
  8605. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  8606. @end table
  8607. The filter accepts the following options:
  8608. @table @option
  8609. @item intl_thres
  8610. Set interlacing threshold.
  8611. @item prog_thres
  8612. Set progressive threshold.
  8613. @item rep_thres
  8614. Threshold for repeated field detection.
  8615. @item half_life
  8616. Number of frames after which a given frame's contribution to the
  8617. statistics is halved (i.e., it contributes only 0.5 to its
  8618. classification). The default of 0 means that all frames seen are given
  8619. full weight of 1.0 forever.
  8620. @item analyze_interlaced_flag
  8621. When this is not 0 then idet will use the specified number of frames to determine
  8622. if the interlaced flag is accurate, it will not count undetermined frames.
  8623. If the flag is found to be accurate it will be used without any further
  8624. computations, if it is found to be inaccurate it will be cleared without any
  8625. further computations. This allows inserting the idet filter as a low computational
  8626. method to clean up the interlaced flag
  8627. @end table
  8628. @section il
  8629. Deinterleave or interleave fields.
  8630. This filter allows one to process interlaced images fields without
  8631. deinterlacing them. Deinterleaving splits the input frame into 2
  8632. fields (so called half pictures). Odd lines are moved to the top
  8633. half of the output image, even lines to the bottom half.
  8634. You can process (filter) them independently and then re-interleave them.
  8635. The filter accepts the following options:
  8636. @table @option
  8637. @item luma_mode, l
  8638. @item chroma_mode, c
  8639. @item alpha_mode, a
  8640. Available values for @var{luma_mode}, @var{chroma_mode} and
  8641. @var{alpha_mode} are:
  8642. @table @samp
  8643. @item none
  8644. Do nothing.
  8645. @item deinterleave, d
  8646. Deinterleave fields, placing one above the other.
  8647. @item interleave, i
  8648. Interleave fields. Reverse the effect of deinterleaving.
  8649. @end table
  8650. Default value is @code{none}.
  8651. @item luma_swap, ls
  8652. @item chroma_swap, cs
  8653. @item alpha_swap, as
  8654. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  8655. @end table
  8656. @section inflate
  8657. Apply inflate effect to the video.
  8658. This filter replaces the pixel by the local(3x3) average by taking into account
  8659. only values higher than the pixel.
  8660. It accepts the following options:
  8661. @table @option
  8662. @item threshold0
  8663. @item threshold1
  8664. @item threshold2
  8665. @item threshold3
  8666. Limit the maximum change for each plane, default is 65535.
  8667. If 0, plane will remain unchanged.
  8668. @end table
  8669. @section interlace
  8670. Simple interlacing filter from progressive contents. This interleaves upper (or
  8671. lower) lines from odd frames with lower (or upper) lines from even frames,
  8672. halving the frame rate and preserving image height.
  8673. @example
  8674. Original Original New Frame
  8675. Frame 'j' Frame 'j+1' (tff)
  8676. ========== =========== ==================
  8677. Line 0 --------------------> Frame 'j' Line 0
  8678. Line 1 Line 1 ----> Frame 'j+1' Line 1
  8679. Line 2 ---------------------> Frame 'j' Line 2
  8680. Line 3 Line 3 ----> Frame 'j+1' Line 3
  8681. ... ... ...
  8682. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  8683. @end example
  8684. It accepts the following optional parameters:
  8685. @table @option
  8686. @item scan
  8687. This determines whether the interlaced frame is taken from the even
  8688. (tff - default) or odd (bff) lines of the progressive frame.
  8689. @item lowpass
  8690. Vertical lowpass filter to avoid twitter interlacing and
  8691. reduce moire patterns.
  8692. @table @samp
  8693. @item 0, off
  8694. Disable vertical lowpass filter
  8695. @item 1, linear
  8696. Enable linear filter (default)
  8697. @item 2, complex
  8698. Enable complex filter. This will slightly less reduce twitter and moire
  8699. but better retain detail and subjective sharpness impression.
  8700. @end table
  8701. @end table
  8702. @section kerndeint
  8703. Deinterlace input video by applying Donald Graft's adaptive kernel
  8704. deinterling. Work on interlaced parts of a video to produce
  8705. progressive frames.
  8706. The description of the accepted parameters follows.
  8707. @table @option
  8708. @item thresh
  8709. Set the threshold which affects the filter's tolerance when
  8710. determining if a pixel line must be processed. It must be an integer
  8711. in the range [0,255] and defaults to 10. A value of 0 will result in
  8712. applying the process on every pixels.
  8713. @item map
  8714. Paint pixels exceeding the threshold value to white if set to 1.
  8715. Default is 0.
  8716. @item order
  8717. Set the fields order. Swap fields if set to 1, leave fields alone if
  8718. 0. Default is 0.
  8719. @item sharp
  8720. Enable additional sharpening if set to 1. Default is 0.
  8721. @item twoway
  8722. Enable twoway sharpening if set to 1. Default is 0.
  8723. @end table
  8724. @subsection Examples
  8725. @itemize
  8726. @item
  8727. Apply default values:
  8728. @example
  8729. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  8730. @end example
  8731. @item
  8732. Enable additional sharpening:
  8733. @example
  8734. kerndeint=sharp=1
  8735. @end example
  8736. @item
  8737. Paint processed pixels in white:
  8738. @example
  8739. kerndeint=map=1
  8740. @end example
  8741. @end itemize
  8742. @section lagfun
  8743. Slowly update darker pixels.
  8744. This filter makes short flashes of light appear longer.
  8745. This filter accepts the following options:
  8746. @table @option
  8747. @item decay
  8748. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  8749. @item planes
  8750. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  8751. @end table
  8752. @section lenscorrection
  8753. Correct radial lens distortion
  8754. This filter can be used to correct for radial distortion as can result from the use
  8755. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  8756. one can use tools available for example as part of opencv or simply trial-and-error.
  8757. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  8758. and extract the k1 and k2 coefficients from the resulting matrix.
  8759. Note that effectively the same filter is available in the open-source tools Krita and
  8760. Digikam from the KDE project.
  8761. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  8762. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  8763. brightness distribution, so you may want to use both filters together in certain
  8764. cases, though you will have to take care of ordering, i.e. whether vignetting should
  8765. be applied before or after lens correction.
  8766. @subsection Options
  8767. The filter accepts the following options:
  8768. @table @option
  8769. @item cx
  8770. Relative x-coordinate of the focal point of the image, and thereby the center of the
  8771. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8772. width. Default is 0.5.
  8773. @item cy
  8774. Relative y-coordinate of the focal point of the image, and thereby the center of the
  8775. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8776. height. Default is 0.5.
  8777. @item k1
  8778. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  8779. no correction. Default is 0.
  8780. @item k2
  8781. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  8782. 0 means no correction. Default is 0.
  8783. @end table
  8784. The formula that generates the correction is:
  8785. @var{r_src} = @var{r_tgt} * (1 + @var{k1} * (@var{r_tgt} / @var{r_0})^2 + @var{k2} * (@var{r_tgt} / @var{r_0})^4)
  8786. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  8787. distances from the focal point in the source and target images, respectively.
  8788. @section lensfun
  8789. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  8790. The @code{lensfun} filter requires the camera make, camera model, and lens model
  8791. to apply the lens correction. The filter will load the lensfun database and
  8792. query it to find the corresponding camera and lens entries in the database. As
  8793. long as these entries can be found with the given options, the filter can
  8794. perform corrections on frames. Note that incomplete strings will result in the
  8795. filter choosing the best match with the given options, and the filter will
  8796. output the chosen camera and lens models (logged with level "info"). You must
  8797. provide the make, camera model, and lens model as they are required.
  8798. The filter accepts the following options:
  8799. @table @option
  8800. @item make
  8801. The make of the camera (for example, "Canon"). This option is required.
  8802. @item model
  8803. The model of the camera (for example, "Canon EOS 100D"). This option is
  8804. required.
  8805. @item lens_model
  8806. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  8807. option is required.
  8808. @item mode
  8809. The type of correction to apply. The following values are valid options:
  8810. @table @samp
  8811. @item vignetting
  8812. Enables fixing lens vignetting.
  8813. @item geometry
  8814. Enables fixing lens geometry. This is the default.
  8815. @item subpixel
  8816. Enables fixing chromatic aberrations.
  8817. @item vig_geo
  8818. Enables fixing lens vignetting and lens geometry.
  8819. @item vig_subpixel
  8820. Enables fixing lens vignetting and chromatic aberrations.
  8821. @item distortion
  8822. Enables fixing both lens geometry and chromatic aberrations.
  8823. @item all
  8824. Enables all possible corrections.
  8825. @end table
  8826. @item focal_length
  8827. The focal length of the image/video (zoom; expected constant for video). For
  8828. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  8829. range should be chosen when using that lens. Default 18.
  8830. @item aperture
  8831. The aperture of the image/video (expected constant for video). Note that
  8832. aperture is only used for vignetting correction. Default 3.5.
  8833. @item focus_distance
  8834. The focus distance of the image/video (expected constant for video). Note that
  8835. focus distance is only used for vignetting and only slightly affects the
  8836. vignetting correction process. If unknown, leave it at the default value (which
  8837. is 1000).
  8838. @item scale
  8839. The scale factor which is applied after transformation. After correction the
  8840. video is no longer necessarily rectangular. This parameter controls how much of
  8841. the resulting image is visible. The value 0 means that a value will be chosen
  8842. automatically such that there is little or no unmapped area in the output
  8843. image. 1.0 means that no additional scaling is done. Lower values may result
  8844. in more of the corrected image being visible, while higher values may avoid
  8845. unmapped areas in the output.
  8846. @item target_geometry
  8847. The target geometry of the output image/video. The following values are valid
  8848. options:
  8849. @table @samp
  8850. @item rectilinear (default)
  8851. @item fisheye
  8852. @item panoramic
  8853. @item equirectangular
  8854. @item fisheye_orthographic
  8855. @item fisheye_stereographic
  8856. @item fisheye_equisolid
  8857. @item fisheye_thoby
  8858. @end table
  8859. @item reverse
  8860. Apply the reverse of image correction (instead of correcting distortion, apply
  8861. it).
  8862. @item interpolation
  8863. The type of interpolation used when correcting distortion. The following values
  8864. are valid options:
  8865. @table @samp
  8866. @item nearest
  8867. @item linear (default)
  8868. @item lanczos
  8869. @end table
  8870. @end table
  8871. @subsection Examples
  8872. @itemize
  8873. @item
  8874. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  8875. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  8876. aperture of "8.0".
  8877. @example
  8878. ffmpeg -i input.mov -vf lensfun=make=Canon:model="Canon EOS 100D":lens_model="Canon EF-S 18-55mm f/3.5-5.6 IS STM":focal_length=18:aperture=8 -c:v h264 -b:v 8000k output.mov
  8879. @end example
  8880. @item
  8881. Apply the same as before, but only for the first 5 seconds of video.
  8882. @example
  8883. ffmpeg -i input.mov -vf lensfun=make=Canon:model="Canon EOS 100D":lens_model="Canon EF-S 18-55mm f/3.5-5.6 IS STM":focal_length=18:aperture=8:enable='lte(t\,5)' -c:v h264 -b:v 8000k output.mov
  8884. @end example
  8885. @end itemize
  8886. @section libvmaf
  8887. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  8888. score between two input videos.
  8889. The obtained VMAF score is printed through the logging system.
  8890. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  8891. After installing the library it can be enabled using:
  8892. @code{./configure --enable-libvmaf --enable-version3}.
  8893. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  8894. The filter has following options:
  8895. @table @option
  8896. @item model_path
  8897. Set the model path which is to be used for SVM.
  8898. Default value: @code{"vmaf_v0.6.1.pkl"}
  8899. @item log_path
  8900. Set the file path to be used to store logs.
  8901. @item log_fmt
  8902. Set the format of the log file (xml or json).
  8903. @item enable_transform
  8904. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  8905. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  8906. Default value: @code{false}
  8907. @item phone_model
  8908. Invokes the phone model which will generate VMAF scores higher than in the
  8909. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  8910. @item psnr
  8911. Enables computing psnr along with vmaf.
  8912. @item ssim
  8913. Enables computing ssim along with vmaf.
  8914. @item ms_ssim
  8915. Enables computing ms_ssim along with vmaf.
  8916. @item pool
  8917. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  8918. @item n_threads
  8919. Set number of threads to be used when computing vmaf.
  8920. @item n_subsample
  8921. Set interval for frame subsampling used when computing vmaf.
  8922. @item enable_conf_interval
  8923. Enables confidence interval.
  8924. @end table
  8925. This filter also supports the @ref{framesync} options.
  8926. On the below examples the input file @file{main.mpg} being processed is
  8927. compared with the reference file @file{ref.mpg}.
  8928. @example
  8929. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  8930. @end example
  8931. Example with options:
  8932. @example
  8933. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  8934. @end example
  8935. @section limiter
  8936. Limits the pixel components values to the specified range [min, max].
  8937. The filter accepts the following options:
  8938. @table @option
  8939. @item min
  8940. Lower bound. Defaults to the lowest allowed value for the input.
  8941. @item max
  8942. Upper bound. Defaults to the highest allowed value for the input.
  8943. @item planes
  8944. Specify which planes will be processed. Defaults to all available.
  8945. @end table
  8946. @section loop
  8947. Loop video frames.
  8948. The filter accepts the following options:
  8949. @table @option
  8950. @item loop
  8951. Set the number of loops. Setting this value to -1 will result in infinite loops.
  8952. Default is 0.
  8953. @item size
  8954. Set maximal size in number of frames. Default is 0.
  8955. @item start
  8956. Set first frame of loop. Default is 0.
  8957. @end table
  8958. @subsection Examples
  8959. @itemize
  8960. @item
  8961. Loop single first frame infinitely:
  8962. @example
  8963. loop=loop=-1:size=1:start=0
  8964. @end example
  8965. @item
  8966. Loop single first frame 10 times:
  8967. @example
  8968. loop=loop=10:size=1:start=0
  8969. @end example
  8970. @item
  8971. Loop 10 first frames 5 times:
  8972. @example
  8973. loop=loop=5:size=10:start=0
  8974. @end example
  8975. @end itemize
  8976. @section lut1d
  8977. Apply a 1D LUT to an input video.
  8978. The filter accepts the following options:
  8979. @table @option
  8980. @item file
  8981. Set the 1D LUT file name.
  8982. Currently supported formats:
  8983. @table @samp
  8984. @item cube
  8985. Iridas
  8986. @item csp
  8987. cineSpace
  8988. @end table
  8989. @item interp
  8990. Select interpolation mode.
  8991. Available values are:
  8992. @table @samp
  8993. @item nearest
  8994. Use values from the nearest defined point.
  8995. @item linear
  8996. Interpolate values using the linear interpolation.
  8997. @item cosine
  8998. Interpolate values using the cosine interpolation.
  8999. @item cubic
  9000. Interpolate values using the cubic interpolation.
  9001. @item spline
  9002. Interpolate values using the spline interpolation.
  9003. @end table
  9004. @end table
  9005. @anchor{lut3d}
  9006. @section lut3d
  9007. Apply a 3D LUT to an input video.
  9008. The filter accepts the following options:
  9009. @table @option
  9010. @item file
  9011. Set the 3D LUT file name.
  9012. Currently supported formats:
  9013. @table @samp
  9014. @item 3dl
  9015. AfterEffects
  9016. @item cube
  9017. Iridas
  9018. @item dat
  9019. DaVinci
  9020. @item m3d
  9021. Pandora
  9022. @item csp
  9023. cineSpace
  9024. @end table
  9025. @item interp
  9026. Select interpolation mode.
  9027. Available values are:
  9028. @table @samp
  9029. @item nearest
  9030. Use values from the nearest defined point.
  9031. @item trilinear
  9032. Interpolate values using the 8 points defining a cube.
  9033. @item tetrahedral
  9034. Interpolate values using a tetrahedron.
  9035. @end table
  9036. @end table
  9037. This filter also supports the @ref{framesync} options.
  9038. @section lumakey
  9039. Turn certain luma values into transparency.
  9040. The filter accepts the following options:
  9041. @table @option
  9042. @item threshold
  9043. Set the luma which will be used as base for transparency.
  9044. Default value is @code{0}.
  9045. @item tolerance
  9046. Set the range of luma values to be keyed out.
  9047. Default value is @code{0}.
  9048. @item softness
  9049. Set the range of softness. Default value is @code{0}.
  9050. Use this to control gradual transition from zero to full transparency.
  9051. @end table
  9052. @section lut, lutrgb, lutyuv
  9053. Compute a look-up table for binding each pixel component input value
  9054. to an output value, and apply it to the input video.
  9055. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  9056. to an RGB input video.
  9057. These filters accept the following parameters:
  9058. @table @option
  9059. @item c0
  9060. set first pixel component expression
  9061. @item c1
  9062. set second pixel component expression
  9063. @item c2
  9064. set third pixel component expression
  9065. @item c3
  9066. set fourth pixel component expression, corresponds to the alpha component
  9067. @item r
  9068. set red component expression
  9069. @item g
  9070. set green component expression
  9071. @item b
  9072. set blue component expression
  9073. @item a
  9074. alpha component expression
  9075. @item y
  9076. set Y/luminance component expression
  9077. @item u
  9078. set U/Cb component expression
  9079. @item v
  9080. set V/Cr component expression
  9081. @end table
  9082. Each of them specifies the expression to use for computing the lookup table for
  9083. the corresponding pixel component values.
  9084. The exact component associated to each of the @var{c*} options depends on the
  9085. format in input.
  9086. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  9087. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  9088. The expressions can contain the following constants and functions:
  9089. @table @option
  9090. @item w
  9091. @item h
  9092. The input width and height.
  9093. @item val
  9094. The input value for the pixel component.
  9095. @item clipval
  9096. The input value, clipped to the @var{minval}-@var{maxval} range.
  9097. @item maxval
  9098. The maximum value for the pixel component.
  9099. @item minval
  9100. The minimum value for the pixel component.
  9101. @item negval
  9102. The negated value for the pixel component value, clipped to the
  9103. @var{minval}-@var{maxval} range; it corresponds to the expression
  9104. "maxval-clipval+minval".
  9105. @item clip(val)
  9106. The computed value in @var{val}, clipped to the
  9107. @var{minval}-@var{maxval} range.
  9108. @item gammaval(gamma)
  9109. The computed gamma correction value of the pixel component value,
  9110. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  9111. expression
  9112. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  9113. @end table
  9114. All expressions default to "val".
  9115. @subsection Examples
  9116. @itemize
  9117. @item
  9118. Negate input video:
  9119. @example
  9120. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  9121. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  9122. @end example
  9123. The above is the same as:
  9124. @example
  9125. lutrgb="r=negval:g=negval:b=negval"
  9126. lutyuv="y=negval:u=negval:v=negval"
  9127. @end example
  9128. @item
  9129. Negate luminance:
  9130. @example
  9131. lutyuv=y=negval
  9132. @end example
  9133. @item
  9134. Remove chroma components, turning the video into a graytone image:
  9135. @example
  9136. lutyuv="u=128:v=128"
  9137. @end example
  9138. @item
  9139. Apply a luma burning effect:
  9140. @example
  9141. lutyuv="y=2*val"
  9142. @end example
  9143. @item
  9144. Remove green and blue components:
  9145. @example
  9146. lutrgb="g=0:b=0"
  9147. @end example
  9148. @item
  9149. Set a constant alpha channel value on input:
  9150. @example
  9151. format=rgba,lutrgb=a="maxval-minval/2"
  9152. @end example
  9153. @item
  9154. Correct luminance gamma by a factor of 0.5:
  9155. @example
  9156. lutyuv=y=gammaval(0.5)
  9157. @end example
  9158. @item
  9159. Discard least significant bits of luma:
  9160. @example
  9161. lutyuv=y='bitand(val, 128+64+32)'
  9162. @end example
  9163. @item
  9164. Technicolor like effect:
  9165. @example
  9166. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  9167. @end example
  9168. @end itemize
  9169. @section lut2, tlut2
  9170. The @code{lut2} filter takes two input streams and outputs one
  9171. stream.
  9172. The @code{tlut2} (time lut2) filter takes two consecutive frames
  9173. from one single stream.
  9174. This filter accepts the following parameters:
  9175. @table @option
  9176. @item c0
  9177. set first pixel component expression
  9178. @item c1
  9179. set second pixel component expression
  9180. @item c2
  9181. set third pixel component expression
  9182. @item c3
  9183. set fourth pixel component expression, corresponds to the alpha component
  9184. @item d
  9185. set output bit depth, only available for @code{lut2} filter. By default is 0,
  9186. which means bit depth is automatically picked from first input format.
  9187. @end table
  9188. Each of them specifies the expression to use for computing the lookup table for
  9189. the corresponding pixel component values.
  9190. The exact component associated to each of the @var{c*} options depends on the
  9191. format in inputs.
  9192. The expressions can contain the following constants:
  9193. @table @option
  9194. @item w
  9195. @item h
  9196. The input width and height.
  9197. @item x
  9198. The first input value for the pixel component.
  9199. @item y
  9200. The second input value for the pixel component.
  9201. @item bdx
  9202. The first input video bit depth.
  9203. @item bdy
  9204. The second input video bit depth.
  9205. @end table
  9206. All expressions default to "x".
  9207. @subsection Examples
  9208. @itemize
  9209. @item
  9210. Highlight differences between two RGB video streams:
  9211. @example
  9212. lut2='ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,0,pow(2,bdx)-1)'
  9213. @end example
  9214. @item
  9215. Highlight differences between two YUV video streams:
  9216. @example
  9217. lut2='ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,pow(2,bdx-1),pow(2,bdx)-1):ifnot(x-y,pow(2,bdx-1),pow(2,bdx)-1)'
  9218. @end example
  9219. @item
  9220. Show max difference between two video streams:
  9221. @example
  9222. lut2='if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1))):if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1))):if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1)))'
  9223. @end example
  9224. @end itemize
  9225. @section maskedclamp
  9226. Clamp the first input stream with the second input and third input stream.
  9227. Returns the value of first stream to be between second input
  9228. stream - @code{undershoot} and third input stream + @code{overshoot}.
  9229. This filter accepts the following options:
  9230. @table @option
  9231. @item undershoot
  9232. Default value is @code{0}.
  9233. @item overshoot
  9234. Default value is @code{0}.
  9235. @item planes
  9236. Set which planes will be processed as bitmap, unprocessed planes will be
  9237. copied from first stream.
  9238. By default value 0xf, all planes will be processed.
  9239. @end table
  9240. @section maskedmerge
  9241. Merge the first input stream with the second input stream using per pixel
  9242. weights in the third input stream.
  9243. A value of 0 in the third stream pixel component means that pixel component
  9244. from first stream is returned unchanged, while maximum value (eg. 255 for
  9245. 8-bit videos) means that pixel component from second stream is returned
  9246. unchanged. Intermediate values define the amount of merging between both
  9247. input stream's pixel components.
  9248. This filter accepts the following options:
  9249. @table @option
  9250. @item planes
  9251. Set which planes will be processed as bitmap, unprocessed planes will be
  9252. copied from first stream.
  9253. By default value 0xf, all planes will be processed.
  9254. @end table
  9255. @section maskfun
  9256. Create mask from input video.
  9257. For example it is useful to create motion masks after @code{tblend} filter.
  9258. This filter accepts the following options:
  9259. @table @option
  9260. @item low
  9261. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  9262. @item high
  9263. Set high threshold. Any pixel component higher than this value will be set to max value
  9264. allowed for current pixel format.
  9265. @item planes
  9266. Set planes to filter, by default all available planes are filtered.
  9267. @item fill
  9268. Fill all frame pixels with this value.
  9269. @item sum
  9270. Set max average pixel value for frame. If sum of all pixel components is higher that this
  9271. average, output frame will be completely filled with value set by @var{fill} option.
  9272. Typically useful for scene changes when used in combination with @code{tblend} filter.
  9273. @end table
  9274. @section mcdeint
  9275. Apply motion-compensation deinterlacing.
  9276. It needs one field per frame as input and must thus be used together
  9277. with yadif=1/3 or equivalent.
  9278. This filter accepts the following options:
  9279. @table @option
  9280. @item mode
  9281. Set the deinterlacing mode.
  9282. It accepts one of the following values:
  9283. @table @samp
  9284. @item fast
  9285. @item medium
  9286. @item slow
  9287. use iterative motion estimation
  9288. @item extra_slow
  9289. like @samp{slow}, but use multiple reference frames.
  9290. @end table
  9291. Default value is @samp{fast}.
  9292. @item parity
  9293. Set the picture field parity assumed for the input video. It must be
  9294. one of the following values:
  9295. @table @samp
  9296. @item 0, tff
  9297. assume top field first
  9298. @item 1, bff
  9299. assume bottom field first
  9300. @end table
  9301. Default value is @samp{bff}.
  9302. @item qp
  9303. Set per-block quantization parameter (QP) used by the internal
  9304. encoder.
  9305. Higher values should result in a smoother motion vector field but less
  9306. optimal individual vectors. Default value is 1.
  9307. @end table
  9308. @section mergeplanes
  9309. Merge color channel components from several video streams.
  9310. The filter accepts up to 4 input streams, and merge selected input
  9311. planes to the output video.
  9312. This filter accepts the following options:
  9313. @table @option
  9314. @item mapping
  9315. Set input to output plane mapping. Default is @code{0}.
  9316. The mappings is specified as a bitmap. It should be specified as a
  9317. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  9318. mapping for the first plane of the output stream. 'A' sets the number of
  9319. the input stream to use (from 0 to 3), and 'a' the plane number of the
  9320. corresponding input to use (from 0 to 3). The rest of the mappings is
  9321. similar, 'Bb' describes the mapping for the output stream second
  9322. plane, 'Cc' describes the mapping for the output stream third plane and
  9323. 'Dd' describes the mapping for the output stream fourth plane.
  9324. @item format
  9325. Set output pixel format. Default is @code{yuva444p}.
  9326. @end table
  9327. @subsection Examples
  9328. @itemize
  9329. @item
  9330. Merge three gray video streams of same width and height into single video stream:
  9331. @example
  9332. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  9333. @end example
  9334. @item
  9335. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  9336. @example
  9337. [a0][a1]mergeplanes=0x00010210:yuva444p
  9338. @end example
  9339. @item
  9340. Swap Y and A plane in yuva444p stream:
  9341. @example
  9342. format=yuva444p,mergeplanes=0x03010200:yuva444p
  9343. @end example
  9344. @item
  9345. Swap U and V plane in yuv420p stream:
  9346. @example
  9347. format=yuv420p,mergeplanes=0x000201:yuv420p
  9348. @end example
  9349. @item
  9350. Cast a rgb24 clip to yuv444p:
  9351. @example
  9352. format=rgb24,mergeplanes=0x000102:yuv444p
  9353. @end example
  9354. @end itemize
  9355. @section mestimate
  9356. Estimate and export motion vectors using block matching algorithms.
  9357. Motion vectors are stored in frame side data to be used by other filters.
  9358. This filter accepts the following options:
  9359. @table @option
  9360. @item method
  9361. Specify the motion estimation method. Accepts one of the following values:
  9362. @table @samp
  9363. @item esa
  9364. Exhaustive search algorithm.
  9365. @item tss
  9366. Three step search algorithm.
  9367. @item tdls
  9368. Two dimensional logarithmic search algorithm.
  9369. @item ntss
  9370. New three step search algorithm.
  9371. @item fss
  9372. Four step search algorithm.
  9373. @item ds
  9374. Diamond search algorithm.
  9375. @item hexbs
  9376. Hexagon-based search algorithm.
  9377. @item epzs
  9378. Enhanced predictive zonal search algorithm.
  9379. @item umh
  9380. Uneven multi-hexagon search algorithm.
  9381. @end table
  9382. Default value is @samp{esa}.
  9383. @item mb_size
  9384. Macroblock size. Default @code{16}.
  9385. @item search_param
  9386. Search parameter. Default @code{7}.
  9387. @end table
  9388. @section midequalizer
  9389. Apply Midway Image Equalization effect using two video streams.
  9390. Midway Image Equalization adjusts a pair of images to have the same
  9391. histogram, while maintaining their dynamics as much as possible. It's
  9392. useful for e.g. matching exposures from a pair of stereo cameras.
  9393. This filter has two inputs and one output, which must be of same pixel format, but
  9394. may be of different sizes. The output of filter is first input adjusted with
  9395. midway histogram of both inputs.
  9396. This filter accepts the following option:
  9397. @table @option
  9398. @item planes
  9399. Set which planes to process. Default is @code{15}, which is all available planes.
  9400. @end table
  9401. @section minterpolate
  9402. Convert the video to specified frame rate using motion interpolation.
  9403. This filter accepts the following options:
  9404. @table @option
  9405. @item fps
  9406. Specify the output frame rate. This can be rational e.g. @code{60000/1001}. Frames are dropped if @var{fps} is lower than source fps. Default @code{60}.
  9407. @item mi_mode
  9408. Motion interpolation mode. Following values are accepted:
  9409. @table @samp
  9410. @item dup
  9411. Duplicate previous or next frame for interpolating new ones.
  9412. @item blend
  9413. Blend source frames. Interpolated frame is mean of previous and next frames.
  9414. @item mci
  9415. Motion compensated interpolation. Following options are effective when this mode is selected:
  9416. @table @samp
  9417. @item mc_mode
  9418. Motion compensation mode. Following values are accepted:
  9419. @table @samp
  9420. @item obmc
  9421. Overlapped block motion compensation.
  9422. @item aobmc
  9423. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  9424. @end table
  9425. Default mode is @samp{obmc}.
  9426. @item me_mode
  9427. Motion estimation mode. Following values are accepted:
  9428. @table @samp
  9429. @item bidir
  9430. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  9431. @item bilat
  9432. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  9433. @end table
  9434. Default mode is @samp{bilat}.
  9435. @item me
  9436. The algorithm to be used for motion estimation. Following values are accepted:
  9437. @table @samp
  9438. @item esa
  9439. Exhaustive search algorithm.
  9440. @item tss
  9441. Three step search algorithm.
  9442. @item tdls
  9443. Two dimensional logarithmic search algorithm.
  9444. @item ntss
  9445. New three step search algorithm.
  9446. @item fss
  9447. Four step search algorithm.
  9448. @item ds
  9449. Diamond search algorithm.
  9450. @item hexbs
  9451. Hexagon-based search algorithm.
  9452. @item epzs
  9453. Enhanced predictive zonal search algorithm.
  9454. @item umh
  9455. Uneven multi-hexagon search algorithm.
  9456. @end table
  9457. Default algorithm is @samp{epzs}.
  9458. @item mb_size
  9459. Macroblock size. Default @code{16}.
  9460. @item search_param
  9461. Motion estimation search parameter. Default @code{32}.
  9462. @item vsbmc
  9463. Enable variable-size block motion compensation. Motion estimation is applied with smaller block sizes at object boundaries in order to make the them less blur. Default is @code{0} (disabled).
  9464. @end table
  9465. @end table
  9466. @item scd
  9467. Scene change detection method. Scene change leads motion vectors to be in random direction. Scene change detection replace interpolated frames by duplicate ones. May not be needed for other modes. Following values are accepted:
  9468. @table @samp
  9469. @item none
  9470. Disable scene change detection.
  9471. @item fdiff
  9472. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  9473. @end table
  9474. Default method is @samp{fdiff}.
  9475. @item scd_threshold
  9476. Scene change detection threshold. Default is @code{5.0}.
  9477. @end table
  9478. @section mix
  9479. Mix several video input streams into one video stream.
  9480. A description of the accepted options follows.
  9481. @table @option
  9482. @item nb_inputs
  9483. The number of inputs. If unspecified, it defaults to 2.
  9484. @item weights
  9485. Specify weight of each input video stream as sequence.
  9486. Each weight is separated by space. If number of weights
  9487. is smaller than number of @var{frames} last specified
  9488. weight will be used for all remaining unset weights.
  9489. @item scale
  9490. Specify scale, if it is set it will be multiplied with sum
  9491. of each weight multiplied with pixel values to give final destination
  9492. pixel value. By default @var{scale} is auto scaled to sum of weights.
  9493. @item duration
  9494. Specify how end of stream is determined.
  9495. @table @samp
  9496. @item longest
  9497. The duration of the longest input. (default)
  9498. @item shortest
  9499. The duration of the shortest input.
  9500. @item first
  9501. The duration of the first input.
  9502. @end table
  9503. @end table
  9504. @section mpdecimate
  9505. Drop frames that do not differ greatly from the previous frame in
  9506. order to reduce frame rate.
  9507. The main use of this filter is for very-low-bitrate encoding
  9508. (e.g. streaming over dialup modem), but it could in theory be used for
  9509. fixing movies that were inverse-telecined incorrectly.
  9510. A description of the accepted options follows.
  9511. @table @option
  9512. @item max
  9513. Set the maximum number of consecutive frames which can be dropped (if
  9514. positive), or the minimum interval between dropped frames (if
  9515. negative). If the value is 0, the frame is dropped disregarding the
  9516. number of previous sequentially dropped frames.
  9517. Default value is 0.
  9518. @item hi
  9519. @item lo
  9520. @item frac
  9521. Set the dropping threshold values.
  9522. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  9523. represent actual pixel value differences, so a threshold of 64
  9524. corresponds to 1 unit of difference for each pixel, or the same spread
  9525. out differently over the block.
  9526. A frame is a candidate for dropping if no 8x8 blocks differ by more
  9527. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  9528. meaning the whole image) differ by more than a threshold of @option{lo}.
  9529. Default value for @option{hi} is 64*12, default value for @option{lo} is
  9530. 64*5, and default value for @option{frac} is 0.33.
  9531. @end table
  9532. @section negate
  9533. Negate (invert) the input video.
  9534. It accepts the following option:
  9535. @table @option
  9536. @item negate_alpha
  9537. With value 1, it negates the alpha component, if present. Default value is 0.
  9538. @end table
  9539. @anchor{nlmeans}
  9540. @section nlmeans
  9541. Denoise frames using Non-Local Means algorithm.
  9542. Each pixel is adjusted by looking for other pixels with similar contexts. This
  9543. context similarity is defined by comparing their surrounding patches of size
  9544. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  9545. around the pixel.
  9546. Note that the research area defines centers for patches, which means some
  9547. patches will be made of pixels outside that research area.
  9548. The filter accepts the following options.
  9549. @table @option
  9550. @item s
  9551. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  9552. @item p
  9553. Set patch size. Default is 7. Must be odd number in range [0, 99].
  9554. @item pc
  9555. Same as @option{p} but for chroma planes.
  9556. The default value is @var{0} and means automatic.
  9557. @item r
  9558. Set research size. Default is 15. Must be odd number in range [0, 99].
  9559. @item rc
  9560. Same as @option{r} but for chroma planes.
  9561. The default value is @var{0} and means automatic.
  9562. @end table
  9563. @section nnedi
  9564. Deinterlace video using neural network edge directed interpolation.
  9565. This filter accepts the following options:
  9566. @table @option
  9567. @item weights
  9568. Mandatory option, without binary file filter can not work.
  9569. Currently file can be found here:
  9570. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  9571. @item deint
  9572. Set which frames to deinterlace, by default it is @code{all}.
  9573. Can be @code{all} or @code{interlaced}.
  9574. @item field
  9575. Set mode of operation.
  9576. Can be one of the following:
  9577. @table @samp
  9578. @item af
  9579. Use frame flags, both fields.
  9580. @item a
  9581. Use frame flags, single field.
  9582. @item t
  9583. Use top field only.
  9584. @item b
  9585. Use bottom field only.
  9586. @item tf
  9587. Use both fields, top first.
  9588. @item bf
  9589. Use both fields, bottom first.
  9590. @end table
  9591. @item planes
  9592. Set which planes to process, by default filter process all frames.
  9593. @item nsize
  9594. Set size of local neighborhood around each pixel, used by the predictor neural
  9595. network.
  9596. Can be one of the following:
  9597. @table @samp
  9598. @item s8x6
  9599. @item s16x6
  9600. @item s32x6
  9601. @item s48x6
  9602. @item s8x4
  9603. @item s16x4
  9604. @item s32x4
  9605. @end table
  9606. @item nns
  9607. Set the number of neurons in predictor neural network.
  9608. Can be one of the following:
  9609. @table @samp
  9610. @item n16
  9611. @item n32
  9612. @item n64
  9613. @item n128
  9614. @item n256
  9615. @end table
  9616. @item qual
  9617. Controls the number of different neural network predictions that are blended
  9618. together to compute the final output value. Can be @code{fast}, default or
  9619. @code{slow}.
  9620. @item etype
  9621. Set which set of weights to use in the predictor.
  9622. Can be one of the following:
  9623. @table @samp
  9624. @item a
  9625. weights trained to minimize absolute error
  9626. @item s
  9627. weights trained to minimize squared error
  9628. @end table
  9629. @item pscrn
  9630. Controls whether or not the prescreener neural network is used to decide
  9631. which pixels should be processed by the predictor neural network and which
  9632. can be handled by simple cubic interpolation.
  9633. The prescreener is trained to know whether cubic interpolation will be
  9634. sufficient for a pixel or whether it should be predicted by the predictor nn.
  9635. The computational complexity of the prescreener nn is much less than that of
  9636. the predictor nn. Since most pixels can be handled by cubic interpolation,
  9637. using the prescreener generally results in much faster processing.
  9638. The prescreener is pretty accurate, so the difference between using it and not
  9639. using it is almost always unnoticeable.
  9640. Can be one of the following:
  9641. @table @samp
  9642. @item none
  9643. @item original
  9644. @item new
  9645. @end table
  9646. Default is @code{new}.
  9647. @item fapprox
  9648. Set various debugging flags.
  9649. @end table
  9650. @section noformat
  9651. Force libavfilter not to use any of the specified pixel formats for the
  9652. input to the next filter.
  9653. It accepts the following parameters:
  9654. @table @option
  9655. @item pix_fmts
  9656. A '|'-separated list of pixel format names, such as
  9657. pix_fmts=yuv420p|monow|rgb24".
  9658. @end table
  9659. @subsection Examples
  9660. @itemize
  9661. @item
  9662. Force libavfilter to use a format different from @var{yuv420p} for the
  9663. input to the vflip filter:
  9664. @example
  9665. noformat=pix_fmts=yuv420p,vflip
  9666. @end example
  9667. @item
  9668. Convert the input video to any of the formats not contained in the list:
  9669. @example
  9670. noformat=yuv420p|yuv444p|yuv410p
  9671. @end example
  9672. @end itemize
  9673. @section noise
  9674. Add noise on video input frame.
  9675. The filter accepts the following options:
  9676. @table @option
  9677. @item all_seed
  9678. @item c0_seed
  9679. @item c1_seed
  9680. @item c2_seed
  9681. @item c3_seed
  9682. Set noise seed for specific pixel component or all pixel components in case
  9683. of @var{all_seed}. Default value is @code{123457}.
  9684. @item all_strength, alls
  9685. @item c0_strength, c0s
  9686. @item c1_strength, c1s
  9687. @item c2_strength, c2s
  9688. @item c3_strength, c3s
  9689. Set noise strength for specific pixel component or all pixel components in case
  9690. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  9691. @item all_flags, allf
  9692. @item c0_flags, c0f
  9693. @item c1_flags, c1f
  9694. @item c2_flags, c2f
  9695. @item c3_flags, c3f
  9696. Set pixel component flags or set flags for all components if @var{all_flags}.
  9697. Available values for component flags are:
  9698. @table @samp
  9699. @item a
  9700. averaged temporal noise (smoother)
  9701. @item p
  9702. mix random noise with a (semi)regular pattern
  9703. @item t
  9704. temporal noise (noise pattern changes between frames)
  9705. @item u
  9706. uniform noise (gaussian otherwise)
  9707. @end table
  9708. @end table
  9709. @subsection Examples
  9710. Add temporal and uniform noise to input video:
  9711. @example
  9712. noise=alls=20:allf=t+u
  9713. @end example
  9714. @section normalize
  9715. Normalize RGB video (aka histogram stretching, contrast stretching).
  9716. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  9717. For each channel of each frame, the filter computes the input range and maps
  9718. it linearly to the user-specified output range. The output range defaults
  9719. to the full dynamic range from pure black to pure white.
  9720. Temporal smoothing can be used on the input range to reduce flickering (rapid
  9721. changes in brightness) caused when small dark or bright objects enter or leave
  9722. the scene. This is similar to the auto-exposure (automatic gain control) on a
  9723. video camera, and, like a video camera, it may cause a period of over- or
  9724. under-exposure of the video.
  9725. The R,G,B channels can be normalized independently, which may cause some
  9726. color shifting, or linked together as a single channel, which prevents
  9727. color shifting. Linked normalization preserves hue. Independent normalization
  9728. does not, so it can be used to remove some color casts. Independent and linked
  9729. normalization can be combined in any ratio.
  9730. The normalize filter accepts the following options:
  9731. @table @option
  9732. @item blackpt
  9733. @item whitept
  9734. Colors which define the output range. The minimum input value is mapped to
  9735. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  9736. The defaults are black and white respectively. Specifying white for
  9737. @var{blackpt} and black for @var{whitept} will give color-inverted,
  9738. normalized video. Shades of grey can be used to reduce the dynamic range
  9739. (contrast). Specifying saturated colors here can create some interesting
  9740. effects.
  9741. @item smoothing
  9742. The number of previous frames to use for temporal smoothing. The input range
  9743. of each channel is smoothed using a rolling average over the current frame
  9744. and the @var{smoothing} previous frames. The default is 0 (no temporal
  9745. smoothing).
  9746. @item independence
  9747. Controls the ratio of independent (color shifting) channel normalization to
  9748. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  9749. independent. Defaults to 1.0 (fully independent).
  9750. @item strength
  9751. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  9752. expensive no-op. Defaults to 1.0 (full strength).
  9753. @end table
  9754. @subsection Examples
  9755. Stretch video contrast to use the full dynamic range, with no temporal
  9756. smoothing; may flicker depending on the source content:
  9757. @example
  9758. normalize=blackpt=black:whitept=white:smoothing=0
  9759. @end example
  9760. As above, but with 50 frames of temporal smoothing; flicker should be
  9761. reduced, depending on the source content:
  9762. @example
  9763. normalize=blackpt=black:whitept=white:smoothing=50
  9764. @end example
  9765. As above, but with hue-preserving linked channel normalization:
  9766. @example
  9767. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  9768. @end example
  9769. As above, but with half strength:
  9770. @example
  9771. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  9772. @end example
  9773. Map the darkest input color to red, the brightest input color to cyan:
  9774. @example
  9775. normalize=blackpt=red:whitept=cyan
  9776. @end example
  9777. @section null
  9778. Pass the video source unchanged to the output.
  9779. @section ocr
  9780. Optical Character Recognition
  9781. This filter uses Tesseract for optical character recognition. To enable
  9782. compilation of this filter, you need to configure FFmpeg with
  9783. @code{--enable-libtesseract}.
  9784. It accepts the following options:
  9785. @table @option
  9786. @item datapath
  9787. Set datapath to tesseract data. Default is to use whatever was
  9788. set at installation.
  9789. @item language
  9790. Set language, default is "eng".
  9791. @item whitelist
  9792. Set character whitelist.
  9793. @item blacklist
  9794. Set character blacklist.
  9795. @end table
  9796. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  9797. @section ocv
  9798. Apply a video transform using libopencv.
  9799. To enable this filter, install the libopencv library and headers and
  9800. configure FFmpeg with @code{--enable-libopencv}.
  9801. It accepts the following parameters:
  9802. @table @option
  9803. @item filter_name
  9804. The name of the libopencv filter to apply.
  9805. @item filter_params
  9806. The parameters to pass to the libopencv filter. If not specified, the default
  9807. values are assumed.
  9808. @end table
  9809. Refer to the official libopencv documentation for more precise
  9810. information:
  9811. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  9812. Several libopencv filters are supported; see the following subsections.
  9813. @anchor{dilate}
  9814. @subsection dilate
  9815. Dilate an image by using a specific structuring element.
  9816. It corresponds to the libopencv function @code{cvDilate}.
  9817. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  9818. @var{struct_el} represents a structuring element, and has the syntax:
  9819. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  9820. @var{cols} and @var{rows} represent the number of columns and rows of
  9821. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  9822. point, and @var{shape} the shape for the structuring element. @var{shape}
  9823. must be "rect", "cross", "ellipse", or "custom".
  9824. If the value for @var{shape} is "custom", it must be followed by a
  9825. string of the form "=@var{filename}". The file with name
  9826. @var{filename} is assumed to represent a binary image, with each
  9827. printable character corresponding to a bright pixel. When a custom
  9828. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  9829. or columns and rows of the read file are assumed instead.
  9830. The default value for @var{struct_el} is "3x3+0x0/rect".
  9831. @var{nb_iterations} specifies the number of times the transform is
  9832. applied to the image, and defaults to 1.
  9833. Some examples:
  9834. @example
  9835. # Use the default values
  9836. ocv=dilate
  9837. # Dilate using a structuring element with a 5x5 cross, iterating two times
  9838. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  9839. # Read the shape from the file diamond.shape, iterating two times.
  9840. # The file diamond.shape may contain a pattern of characters like this
  9841. # *
  9842. # ***
  9843. # *****
  9844. # ***
  9845. # *
  9846. # The specified columns and rows are ignored
  9847. # but the anchor point coordinates are not
  9848. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  9849. @end example
  9850. @subsection erode
  9851. Erode an image by using a specific structuring element.
  9852. It corresponds to the libopencv function @code{cvErode}.
  9853. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  9854. with the same syntax and semantics as the @ref{dilate} filter.
  9855. @subsection smooth
  9856. Smooth the input video.
  9857. The filter takes the following parameters:
  9858. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  9859. @var{type} is the type of smooth filter to apply, and must be one of
  9860. the following values: "blur", "blur_no_scale", "median", "gaussian",
  9861. or "bilateral". The default value is "gaussian".
  9862. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  9863. depend on the smooth type. @var{param1} and
  9864. @var{param2} accept integer positive values or 0. @var{param3} and
  9865. @var{param4} accept floating point values.
  9866. The default value for @var{param1} is 3. The default value for the
  9867. other parameters is 0.
  9868. These parameters correspond to the parameters assigned to the
  9869. libopencv function @code{cvSmooth}.
  9870. @section oscilloscope
  9871. 2D Video Oscilloscope.
  9872. Useful to measure spatial impulse, step responses, chroma delays, etc.
  9873. It accepts the following parameters:
  9874. @table @option
  9875. @item x
  9876. Set scope center x position.
  9877. @item y
  9878. Set scope center y position.
  9879. @item s
  9880. Set scope size, relative to frame diagonal.
  9881. @item t
  9882. Set scope tilt/rotation.
  9883. @item o
  9884. Set trace opacity.
  9885. @item tx
  9886. Set trace center x position.
  9887. @item ty
  9888. Set trace center y position.
  9889. @item tw
  9890. Set trace width, relative to width of frame.
  9891. @item th
  9892. Set trace height, relative to height of frame.
  9893. @item c
  9894. Set which components to trace. By default it traces first three components.
  9895. @item g
  9896. Draw trace grid. By default is enabled.
  9897. @item st
  9898. Draw some statistics. By default is enabled.
  9899. @item sc
  9900. Draw scope. By default is enabled.
  9901. @end table
  9902. @subsection Examples
  9903. @itemize
  9904. @item
  9905. Inspect full first row of video frame.
  9906. @example
  9907. oscilloscope=x=0.5:y=0:s=1
  9908. @end example
  9909. @item
  9910. Inspect full last row of video frame.
  9911. @example
  9912. oscilloscope=x=0.5:y=1:s=1
  9913. @end example
  9914. @item
  9915. Inspect full 5th line of video frame of height 1080.
  9916. @example
  9917. oscilloscope=x=0.5:y=5/1080:s=1
  9918. @end example
  9919. @item
  9920. Inspect full last column of video frame.
  9921. @example
  9922. oscilloscope=x=1:y=0.5:s=1:t=1
  9923. @end example
  9924. @end itemize
  9925. @anchor{overlay}
  9926. @section overlay
  9927. Overlay one video on top of another.
  9928. It takes two inputs and has one output. The first input is the "main"
  9929. video on which the second input is overlaid.
  9930. It accepts the following parameters:
  9931. A description of the accepted options follows.
  9932. @table @option
  9933. @item x
  9934. @item y
  9935. Set the expression for the x and y coordinates of the overlaid video
  9936. on the main video. Default value is "0" for both expressions. In case
  9937. the expression is invalid, it is set to a huge value (meaning that the
  9938. overlay will not be displayed within the output visible area).
  9939. @item eof_action
  9940. See @ref{framesync}.
  9941. @item eval
  9942. Set when the expressions for @option{x}, and @option{y} are evaluated.
  9943. It accepts the following values:
  9944. @table @samp
  9945. @item init
  9946. only evaluate expressions once during the filter initialization or
  9947. when a command is processed
  9948. @item frame
  9949. evaluate expressions for each incoming frame
  9950. @end table
  9951. Default value is @samp{frame}.
  9952. @item shortest
  9953. See @ref{framesync}.
  9954. @item format
  9955. Set the format for the output video.
  9956. It accepts the following values:
  9957. @table @samp
  9958. @item yuv420
  9959. force YUV420 output
  9960. @item yuv422
  9961. force YUV422 output
  9962. @item yuv444
  9963. force YUV444 output
  9964. @item rgb
  9965. force packed RGB output
  9966. @item gbrp
  9967. force planar RGB output
  9968. @item auto
  9969. automatically pick format
  9970. @end table
  9971. Default value is @samp{yuv420}.
  9972. @item repeatlast
  9973. See @ref{framesync}.
  9974. @item alpha
  9975. Set format of alpha of the overlaid video, it can be @var{straight} or
  9976. @var{premultiplied}. Default is @var{straight}.
  9977. @end table
  9978. The @option{x}, and @option{y} expressions can contain the following
  9979. parameters.
  9980. @table @option
  9981. @item main_w, W
  9982. @item main_h, H
  9983. The main input width and height.
  9984. @item overlay_w, w
  9985. @item overlay_h, h
  9986. The overlay input width and height.
  9987. @item x
  9988. @item y
  9989. The computed values for @var{x} and @var{y}. They are evaluated for
  9990. each new frame.
  9991. @item hsub
  9992. @item vsub
  9993. horizontal and vertical chroma subsample values of the output
  9994. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  9995. @var{vsub} is 1.
  9996. @item n
  9997. the number of input frame, starting from 0
  9998. @item pos
  9999. the position in the file of the input frame, NAN if unknown
  10000. @item t
  10001. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  10002. @end table
  10003. This filter also supports the @ref{framesync} options.
  10004. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  10005. when evaluation is done @emph{per frame}, and will evaluate to NAN
  10006. when @option{eval} is set to @samp{init}.
  10007. Be aware that frames are taken from each input video in timestamp
  10008. order, hence, if their initial timestamps differ, it is a good idea
  10009. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  10010. have them begin in the same zero timestamp, as the example for
  10011. the @var{movie} filter does.
  10012. You can chain together more overlays but you should test the
  10013. efficiency of such approach.
  10014. @subsection Commands
  10015. This filter supports the following commands:
  10016. @table @option
  10017. @item x
  10018. @item y
  10019. Modify the x and y of the overlay input.
  10020. The command accepts the same syntax of the corresponding option.
  10021. If the specified expression is not valid, it is kept at its current
  10022. value.
  10023. @end table
  10024. @subsection Examples
  10025. @itemize
  10026. @item
  10027. Draw the overlay at 10 pixels from the bottom right corner of the main
  10028. video:
  10029. @example
  10030. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  10031. @end example
  10032. Using named options the example above becomes:
  10033. @example
  10034. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  10035. @end example
  10036. @item
  10037. Insert a transparent PNG logo in the bottom left corner of the input,
  10038. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  10039. @example
  10040. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  10041. @end example
  10042. @item
  10043. Insert 2 different transparent PNG logos (second logo on bottom
  10044. right corner) using the @command{ffmpeg} tool:
  10045. @example
  10046. ffmpeg -i input -i logo1 -i logo2 -filter_complex 'overlay=x=10:y=H-h-10,overlay=x=W-w-10:y=H-h-10' output
  10047. @end example
  10048. @item
  10049. Add a transparent color layer on top of the main video; @code{WxH}
  10050. must specify the size of the main input to the overlay filter:
  10051. @example
  10052. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  10053. @end example
  10054. @item
  10055. Play an original video and a filtered version (here with the deshake
  10056. filter) side by side using the @command{ffplay} tool:
  10057. @example
  10058. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  10059. @end example
  10060. The above command is the same as:
  10061. @example
  10062. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  10063. @end example
  10064. @item
  10065. Make a sliding overlay appearing from the left to the right top part of the
  10066. screen starting since time 2:
  10067. @example
  10068. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  10069. @end example
  10070. @item
  10071. Compose output by putting two input videos side to side:
  10072. @example
  10073. ffmpeg -i left.avi -i right.avi -filter_complex "
  10074. nullsrc=size=200x100 [background];
  10075. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  10076. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  10077. [background][left] overlay=shortest=1 [background+left];
  10078. [background+left][right] overlay=shortest=1:x=100 [left+right]
  10079. "
  10080. @end example
  10081. @item
  10082. Mask 10-20 seconds of a video by applying the delogo filter to a section
  10083. @example
  10084. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  10085. -vf '[in]split[split_main][split_delogo];[split_delogo]trim=start=360:end=371,delogo=0:0:640:480[delogoed];[split_main][delogoed]overlay=eof_action=pass[out]'
  10086. masked.avi
  10087. @end example
  10088. @item
  10089. Chain several overlays in cascade:
  10090. @example
  10091. nullsrc=s=200x200 [bg];
  10092. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  10093. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  10094. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  10095. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  10096. [in3] null, [mid2] overlay=100:100 [out0]
  10097. @end example
  10098. @end itemize
  10099. @section owdenoise
  10100. Apply Overcomplete Wavelet denoiser.
  10101. The filter accepts the following options:
  10102. @table @option
  10103. @item depth
  10104. Set depth.
  10105. Larger depth values will denoise lower frequency components more, but
  10106. slow down filtering.
  10107. Must be an int in the range 8-16, default is @code{8}.
  10108. @item luma_strength, ls
  10109. Set luma strength.
  10110. Must be a double value in the range 0-1000, default is @code{1.0}.
  10111. @item chroma_strength, cs
  10112. Set chroma strength.
  10113. Must be a double value in the range 0-1000, default is @code{1.0}.
  10114. @end table
  10115. @anchor{pad}
  10116. @section pad
  10117. Add paddings to the input image, and place the original input at the
  10118. provided @var{x}, @var{y} coordinates.
  10119. It accepts the following parameters:
  10120. @table @option
  10121. @item width, w
  10122. @item height, h
  10123. Specify an expression for the size of the output image with the
  10124. paddings added. If the value for @var{width} or @var{height} is 0, the
  10125. corresponding input size is used for the output.
  10126. The @var{width} expression can reference the value set by the
  10127. @var{height} expression, and vice versa.
  10128. The default value of @var{width} and @var{height} is 0.
  10129. @item x
  10130. @item y
  10131. Specify the offsets to place the input image at within the padded area,
  10132. with respect to the top/left border of the output image.
  10133. The @var{x} expression can reference the value set by the @var{y}
  10134. expression, and vice versa.
  10135. The default value of @var{x} and @var{y} is 0.
  10136. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  10137. so the input image is centered on the padded area.
  10138. @item color
  10139. Specify the color of the padded area. For the syntax of this option,
  10140. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  10141. manual,ffmpeg-utils}.
  10142. The default value of @var{color} is "black".
  10143. @item eval
  10144. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  10145. It accepts the following values:
  10146. @table @samp
  10147. @item init
  10148. Only evaluate expressions once during the filter initialization or when
  10149. a command is processed.
  10150. @item frame
  10151. Evaluate expressions for each incoming frame.
  10152. @end table
  10153. Default value is @samp{init}.
  10154. @item aspect
  10155. Pad to aspect instead to a resolution.
  10156. @end table
  10157. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  10158. options are expressions containing the following constants:
  10159. @table @option
  10160. @item in_w
  10161. @item in_h
  10162. The input video width and height.
  10163. @item iw
  10164. @item ih
  10165. These are the same as @var{in_w} and @var{in_h}.
  10166. @item out_w
  10167. @item out_h
  10168. The output width and height (the size of the padded area), as
  10169. specified by the @var{width} and @var{height} expressions.
  10170. @item ow
  10171. @item oh
  10172. These are the same as @var{out_w} and @var{out_h}.
  10173. @item x
  10174. @item y
  10175. The x and y offsets as specified by the @var{x} and @var{y}
  10176. expressions, or NAN if not yet specified.
  10177. @item a
  10178. same as @var{iw} / @var{ih}
  10179. @item sar
  10180. input sample aspect ratio
  10181. @item dar
  10182. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  10183. @item hsub
  10184. @item vsub
  10185. The horizontal and vertical chroma subsample values. For example for the
  10186. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10187. @end table
  10188. @subsection Examples
  10189. @itemize
  10190. @item
  10191. Add paddings with the color "violet" to the input video. The output video
  10192. size is 640x480, and the top-left corner of the input video is placed at
  10193. column 0, row 40
  10194. @example
  10195. pad=640:480:0:40:violet
  10196. @end example
  10197. The example above is equivalent to the following command:
  10198. @example
  10199. pad=width=640:height=480:x=0:y=40:color=violet
  10200. @end example
  10201. @item
  10202. Pad the input to get an output with dimensions increased by 3/2,
  10203. and put the input video at the center of the padded area:
  10204. @example
  10205. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  10206. @end example
  10207. @item
  10208. Pad the input to get a squared output with size equal to the maximum
  10209. value between the input width and height, and put the input video at
  10210. the center of the padded area:
  10211. @example
  10212. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  10213. @end example
  10214. @item
  10215. Pad the input to get a final w/h ratio of 16:9:
  10216. @example
  10217. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  10218. @end example
  10219. @item
  10220. In case of anamorphic video, in order to set the output display aspect
  10221. correctly, it is necessary to use @var{sar} in the expression,
  10222. according to the relation:
  10223. @example
  10224. (ih * X / ih) * sar = output_dar
  10225. X = output_dar / sar
  10226. @end example
  10227. Thus the previous example needs to be modified to:
  10228. @example
  10229. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  10230. @end example
  10231. @item
  10232. Double the output size and put the input video in the bottom-right
  10233. corner of the output padded area:
  10234. @example
  10235. pad="2*iw:2*ih:ow-iw:oh-ih"
  10236. @end example
  10237. @end itemize
  10238. @anchor{palettegen}
  10239. @section palettegen
  10240. Generate one palette for a whole video stream.
  10241. It accepts the following options:
  10242. @table @option
  10243. @item max_colors
  10244. Set the maximum number of colors to quantize in the palette.
  10245. Note: the palette will still contain 256 colors; the unused palette entries
  10246. will be black.
  10247. @item reserve_transparent
  10248. Create a palette of 255 colors maximum and reserve the last one for
  10249. transparency. Reserving the transparency color is useful for GIF optimization.
  10250. If not set, the maximum of colors in the palette will be 256. You probably want
  10251. to disable this option for a standalone image.
  10252. Set by default.
  10253. @item transparency_color
  10254. Set the color that will be used as background for transparency.
  10255. @item stats_mode
  10256. Set statistics mode.
  10257. It accepts the following values:
  10258. @table @samp
  10259. @item full
  10260. Compute full frame histograms.
  10261. @item diff
  10262. Compute histograms only for the part that differs from previous frame. This
  10263. might be relevant to give more importance to the moving part of your input if
  10264. the background is static.
  10265. @item single
  10266. Compute new histogram for each frame.
  10267. @end table
  10268. Default value is @var{full}.
  10269. @end table
  10270. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  10271. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  10272. color quantization of the palette. This information is also visible at
  10273. @var{info} logging level.
  10274. @subsection Examples
  10275. @itemize
  10276. @item
  10277. Generate a representative palette of a given video using @command{ffmpeg}:
  10278. @example
  10279. ffmpeg -i input.mkv -vf palettegen palette.png
  10280. @end example
  10281. @end itemize
  10282. @section paletteuse
  10283. Use a palette to downsample an input video stream.
  10284. The filter takes two inputs: one video stream and a palette. The palette must
  10285. be a 256 pixels image.
  10286. It accepts the following options:
  10287. @table @option
  10288. @item dither
  10289. Select dithering mode. Available algorithms are:
  10290. @table @samp
  10291. @item bayer
  10292. Ordered 8x8 bayer dithering (deterministic)
  10293. @item heckbert
  10294. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  10295. Note: this dithering is sometimes considered "wrong" and is included as a
  10296. reference.
  10297. @item floyd_steinberg
  10298. Floyd and Steingberg dithering (error diffusion)
  10299. @item sierra2
  10300. Frankie Sierra dithering v2 (error diffusion)
  10301. @item sierra2_4a
  10302. Frankie Sierra dithering v2 "Lite" (error diffusion)
  10303. @end table
  10304. Default is @var{sierra2_4a}.
  10305. @item bayer_scale
  10306. When @var{bayer} dithering is selected, this option defines the scale of the
  10307. pattern (how much the crosshatch pattern is visible). A low value means more
  10308. visible pattern for less banding, and higher value means less visible pattern
  10309. at the cost of more banding.
  10310. The option must be an integer value in the range [0,5]. Default is @var{2}.
  10311. @item diff_mode
  10312. If set, define the zone to process
  10313. @table @samp
  10314. @item rectangle
  10315. Only the changing rectangle will be reprocessed. This is similar to GIF
  10316. cropping/offsetting compression mechanism. This option can be useful for speed
  10317. if only a part of the image is changing, and has use cases such as limiting the
  10318. scope of the error diffusal @option{dither} to the rectangle that bounds the
  10319. moving scene (it leads to more deterministic output if the scene doesn't change
  10320. much, and as a result less moving noise and better GIF compression).
  10321. @end table
  10322. Default is @var{none}.
  10323. @item new
  10324. Take new palette for each output frame.
  10325. @item alpha_threshold
  10326. Sets the alpha threshold for transparency. Alpha values above this threshold
  10327. will be treated as completely opaque, and values below this threshold will be
  10328. treated as completely transparent.
  10329. The option must be an integer value in the range [0,255]. Default is @var{128}.
  10330. @end table
  10331. @subsection Examples
  10332. @itemize
  10333. @item
  10334. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  10335. using @command{ffmpeg}:
  10336. @example
  10337. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  10338. @end example
  10339. @end itemize
  10340. @section perspective
  10341. Correct perspective of video not recorded perpendicular to the screen.
  10342. A description of the accepted parameters follows.
  10343. @table @option
  10344. @item x0
  10345. @item y0
  10346. @item x1
  10347. @item y1
  10348. @item x2
  10349. @item y2
  10350. @item x3
  10351. @item y3
  10352. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  10353. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  10354. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  10355. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  10356. then the corners of the source will be sent to the specified coordinates.
  10357. The expressions can use the following variables:
  10358. @table @option
  10359. @item W
  10360. @item H
  10361. the width and height of video frame.
  10362. @item in
  10363. Input frame count.
  10364. @item on
  10365. Output frame count.
  10366. @end table
  10367. @item interpolation
  10368. Set interpolation for perspective correction.
  10369. It accepts the following values:
  10370. @table @samp
  10371. @item linear
  10372. @item cubic
  10373. @end table
  10374. Default value is @samp{linear}.
  10375. @item sense
  10376. Set interpretation of coordinate options.
  10377. It accepts the following values:
  10378. @table @samp
  10379. @item 0, source
  10380. Send point in the source specified by the given coordinates to
  10381. the corners of the destination.
  10382. @item 1, destination
  10383. Send the corners of the source to the point in the destination specified
  10384. by the given coordinates.
  10385. Default value is @samp{source}.
  10386. @end table
  10387. @item eval
  10388. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  10389. It accepts the following values:
  10390. @table @samp
  10391. @item init
  10392. only evaluate expressions once during the filter initialization or
  10393. when a command is processed
  10394. @item frame
  10395. evaluate expressions for each incoming frame
  10396. @end table
  10397. Default value is @samp{init}.
  10398. @end table
  10399. @section phase
  10400. Delay interlaced video by one field time so that the field order changes.
  10401. The intended use is to fix PAL movies that have been captured with the
  10402. opposite field order to the film-to-video transfer.
  10403. A description of the accepted parameters follows.
  10404. @table @option
  10405. @item mode
  10406. Set phase mode.
  10407. It accepts the following values:
  10408. @table @samp
  10409. @item t
  10410. Capture field order top-first, transfer bottom-first.
  10411. Filter will delay the bottom field.
  10412. @item b
  10413. Capture field order bottom-first, transfer top-first.
  10414. Filter will delay the top field.
  10415. @item p
  10416. Capture and transfer with the same field order. This mode only exists
  10417. for the documentation of the other options to refer to, but if you
  10418. actually select it, the filter will faithfully do nothing.
  10419. @item a
  10420. Capture field order determined automatically by field flags, transfer
  10421. opposite.
  10422. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  10423. basis using field flags. If no field information is available,
  10424. then this works just like @samp{u}.
  10425. @item u
  10426. Capture unknown or varying, transfer opposite.
  10427. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  10428. analyzing the images and selecting the alternative that produces best
  10429. match between the fields.
  10430. @item T
  10431. Capture top-first, transfer unknown or varying.
  10432. Filter selects among @samp{t} and @samp{p} using image analysis.
  10433. @item B
  10434. Capture bottom-first, transfer unknown or varying.
  10435. Filter selects among @samp{b} and @samp{p} using image analysis.
  10436. @item A
  10437. Capture determined by field flags, transfer unknown or varying.
  10438. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  10439. image analysis. If no field information is available, then this works just
  10440. like @samp{U}. This is the default mode.
  10441. @item U
  10442. Both capture and transfer unknown or varying.
  10443. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  10444. @end table
  10445. @end table
  10446. @section pixdesctest
  10447. Pixel format descriptor test filter, mainly useful for internal
  10448. testing. The output video should be equal to the input video.
  10449. For example:
  10450. @example
  10451. format=monow, pixdesctest
  10452. @end example
  10453. can be used to test the monowhite pixel format descriptor definition.
  10454. @section pixscope
  10455. Display sample values of color channels. Mainly useful for checking color
  10456. and levels. Minimum supported resolution is 640x480.
  10457. The filters accept the following options:
  10458. @table @option
  10459. @item x
  10460. Set scope X position, relative offset on X axis.
  10461. @item y
  10462. Set scope Y position, relative offset on Y axis.
  10463. @item w
  10464. Set scope width.
  10465. @item h
  10466. Set scope height.
  10467. @item o
  10468. Set window opacity. This window also holds statistics about pixel area.
  10469. @item wx
  10470. Set window X position, relative offset on X axis.
  10471. @item wy
  10472. Set window Y position, relative offset on Y axis.
  10473. @end table
  10474. @section pp
  10475. Enable the specified chain of postprocessing subfilters using libpostproc. This
  10476. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  10477. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  10478. Each subfilter and some options have a short and a long name that can be used
  10479. interchangeably, i.e. dr/dering are the same.
  10480. The filters accept the following options:
  10481. @table @option
  10482. @item subfilters
  10483. Set postprocessing subfilters string.
  10484. @end table
  10485. All subfilters share common options to determine their scope:
  10486. @table @option
  10487. @item a/autoq
  10488. Honor the quality commands for this subfilter.
  10489. @item c/chrom
  10490. Do chrominance filtering, too (default).
  10491. @item y/nochrom
  10492. Do luminance filtering only (no chrominance).
  10493. @item n/noluma
  10494. Do chrominance filtering only (no luminance).
  10495. @end table
  10496. These options can be appended after the subfilter name, separated by a '|'.
  10497. Available subfilters are:
  10498. @table @option
  10499. @item hb/hdeblock[|difference[|flatness]]
  10500. Horizontal deblocking filter
  10501. @table @option
  10502. @item difference
  10503. Difference factor where higher values mean more deblocking (default: @code{32}).
  10504. @item flatness
  10505. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10506. @end table
  10507. @item vb/vdeblock[|difference[|flatness]]
  10508. Vertical deblocking filter
  10509. @table @option
  10510. @item difference
  10511. Difference factor where higher values mean more deblocking (default: @code{32}).
  10512. @item flatness
  10513. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10514. @end table
  10515. @item ha/hadeblock[|difference[|flatness]]
  10516. Accurate horizontal deblocking filter
  10517. @table @option
  10518. @item difference
  10519. Difference factor where higher values mean more deblocking (default: @code{32}).
  10520. @item flatness
  10521. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10522. @end table
  10523. @item va/vadeblock[|difference[|flatness]]
  10524. Accurate vertical deblocking filter
  10525. @table @option
  10526. @item difference
  10527. Difference factor where higher values mean more deblocking (default: @code{32}).
  10528. @item flatness
  10529. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10530. @end table
  10531. @end table
  10532. The horizontal and vertical deblocking filters share the difference and
  10533. flatness values so you cannot set different horizontal and vertical
  10534. thresholds.
  10535. @table @option
  10536. @item h1/x1hdeblock
  10537. Experimental horizontal deblocking filter
  10538. @item v1/x1vdeblock
  10539. Experimental vertical deblocking filter
  10540. @item dr/dering
  10541. Deringing filter
  10542. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  10543. @table @option
  10544. @item threshold1
  10545. larger -> stronger filtering
  10546. @item threshold2
  10547. larger -> stronger filtering
  10548. @item threshold3
  10549. larger -> stronger filtering
  10550. @end table
  10551. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  10552. @table @option
  10553. @item f/fullyrange
  10554. Stretch luminance to @code{0-255}.
  10555. @end table
  10556. @item lb/linblenddeint
  10557. Linear blend deinterlacing filter that deinterlaces the given block by
  10558. filtering all lines with a @code{(1 2 1)} filter.
  10559. @item li/linipoldeint
  10560. Linear interpolating deinterlacing filter that deinterlaces the given block by
  10561. linearly interpolating every second line.
  10562. @item ci/cubicipoldeint
  10563. Cubic interpolating deinterlacing filter deinterlaces the given block by
  10564. cubically interpolating every second line.
  10565. @item md/mediandeint
  10566. Median deinterlacing filter that deinterlaces the given block by applying a
  10567. median filter to every second line.
  10568. @item fd/ffmpegdeint
  10569. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  10570. second line with a @code{(-1 4 2 4 -1)} filter.
  10571. @item l5/lowpass5
  10572. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  10573. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  10574. @item fq/forceQuant[|quantizer]
  10575. Overrides the quantizer table from the input with the constant quantizer you
  10576. specify.
  10577. @table @option
  10578. @item quantizer
  10579. Quantizer to use
  10580. @end table
  10581. @item de/default
  10582. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  10583. @item fa/fast
  10584. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  10585. @item ac
  10586. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  10587. @end table
  10588. @subsection Examples
  10589. @itemize
  10590. @item
  10591. Apply horizontal and vertical deblocking, deringing and automatic
  10592. brightness/contrast:
  10593. @example
  10594. pp=hb/vb/dr/al
  10595. @end example
  10596. @item
  10597. Apply default filters without brightness/contrast correction:
  10598. @example
  10599. pp=de/-al
  10600. @end example
  10601. @item
  10602. Apply default filters and temporal denoiser:
  10603. @example
  10604. pp=default/tmpnoise|1|2|3
  10605. @end example
  10606. @item
  10607. Apply deblocking on luminance only, and switch vertical deblocking on or off
  10608. automatically depending on available CPU time:
  10609. @example
  10610. pp=hb|y/vb|a
  10611. @end example
  10612. @end itemize
  10613. @section pp7
  10614. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  10615. similar to spp = 6 with 7 point DCT, where only the center sample is
  10616. used after IDCT.
  10617. The filter accepts the following options:
  10618. @table @option
  10619. @item qp
  10620. Force a constant quantization parameter. It accepts an integer in range
  10621. 0 to 63. If not set, the filter will use the QP from the video stream
  10622. (if available).
  10623. @item mode
  10624. Set thresholding mode. Available modes are:
  10625. @table @samp
  10626. @item hard
  10627. Set hard thresholding.
  10628. @item soft
  10629. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10630. @item medium
  10631. Set medium thresholding (good results, default).
  10632. @end table
  10633. @end table
  10634. @section premultiply
  10635. Apply alpha premultiply effect to input video stream using first plane
  10636. of second stream as alpha.
  10637. Both streams must have same dimensions and same pixel format.
  10638. The filter accepts the following option:
  10639. @table @option
  10640. @item planes
  10641. Set which planes will be processed, unprocessed planes will be copied.
  10642. By default value 0xf, all planes will be processed.
  10643. @item inplace
  10644. Do not require 2nd input for processing, instead use alpha plane from input stream.
  10645. @end table
  10646. @section prewitt
  10647. Apply prewitt operator to input video stream.
  10648. The filter accepts the following option:
  10649. @table @option
  10650. @item planes
  10651. Set which planes will be processed, unprocessed planes will be copied.
  10652. By default value 0xf, all planes will be processed.
  10653. @item scale
  10654. Set value which will be multiplied with filtered result.
  10655. @item delta
  10656. Set value which will be added to filtered result.
  10657. @end table
  10658. @anchor{program_opencl}
  10659. @section program_opencl
  10660. Filter video using an OpenCL program.
  10661. @table @option
  10662. @item source
  10663. OpenCL program source file.
  10664. @item kernel
  10665. Kernel name in program.
  10666. @item inputs
  10667. Number of inputs to the filter. Defaults to 1.
  10668. @item size, s
  10669. Size of output frames. Defaults to the same as the first input.
  10670. @end table
  10671. The program source file must contain a kernel function with the given name,
  10672. which will be run once for each plane of the output. Each run on a plane
  10673. gets enqueued as a separate 2D global NDRange with one work-item for each
  10674. pixel to be generated. The global ID offset for each work-item is therefore
  10675. the coordinates of a pixel in the destination image.
  10676. The kernel function needs to take the following arguments:
  10677. @itemize
  10678. @item
  10679. Destination image, @var{__write_only image2d_t}.
  10680. This image will become the output; the kernel should write all of it.
  10681. @item
  10682. Frame index, @var{unsigned int}.
  10683. This is a counter starting from zero and increasing by one for each frame.
  10684. @item
  10685. Source images, @var{__read_only image2d_t}.
  10686. These are the most recent images on each input. The kernel may read from
  10687. them to generate the output, but they can't be written to.
  10688. @end itemize
  10689. Example programs:
  10690. @itemize
  10691. @item
  10692. Copy the input to the output (output must be the same size as the input).
  10693. @verbatim
  10694. __kernel void copy(__write_only image2d_t destination,
  10695. unsigned int index,
  10696. __read_only image2d_t source)
  10697. {
  10698. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  10699. int2 location = (int2)(get_global_id(0), get_global_id(1));
  10700. float4 value = read_imagef(source, sampler, location);
  10701. write_imagef(destination, location, value);
  10702. }
  10703. @end verbatim
  10704. @item
  10705. Apply a simple transformation, rotating the input by an amount increasing
  10706. with the index counter. Pixel values are linearly interpolated by the
  10707. sampler, and the output need not have the same dimensions as the input.
  10708. @verbatim
  10709. __kernel void rotate_image(__write_only image2d_t dst,
  10710. unsigned int index,
  10711. __read_only image2d_t src)
  10712. {
  10713. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10714. CLK_FILTER_LINEAR);
  10715. float angle = (float)index / 100.0f;
  10716. float2 dst_dim = convert_float2(get_image_dim(dst));
  10717. float2 src_dim = convert_float2(get_image_dim(src));
  10718. float2 dst_cen = dst_dim / 2.0f;
  10719. float2 src_cen = src_dim / 2.0f;
  10720. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10721. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  10722. float2 src_pos = {
  10723. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  10724. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  10725. };
  10726. src_pos = src_pos * src_dim / dst_dim;
  10727. float2 src_loc = src_pos + src_cen;
  10728. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  10729. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  10730. write_imagef(dst, dst_loc, 0.5f);
  10731. else
  10732. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  10733. }
  10734. @end verbatim
  10735. @item
  10736. Blend two inputs together, with the amount of each input used varying
  10737. with the index counter.
  10738. @verbatim
  10739. __kernel void blend_images(__write_only image2d_t dst,
  10740. unsigned int index,
  10741. __read_only image2d_t src1,
  10742. __read_only image2d_t src2)
  10743. {
  10744. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10745. CLK_FILTER_LINEAR);
  10746. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  10747. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10748. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  10749. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  10750. float4 val1 = read_imagef(src1, sampler, src1_loc);
  10751. float4 val2 = read_imagef(src2, sampler, src2_loc);
  10752. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  10753. }
  10754. @end verbatim
  10755. @end itemize
  10756. @section pseudocolor
  10757. Alter frame colors in video with pseudocolors.
  10758. This filter accept the following options:
  10759. @table @option
  10760. @item c0
  10761. set pixel first component expression
  10762. @item c1
  10763. set pixel second component expression
  10764. @item c2
  10765. set pixel third component expression
  10766. @item c3
  10767. set pixel fourth component expression, corresponds to the alpha component
  10768. @item i
  10769. set component to use as base for altering colors
  10770. @end table
  10771. Each of them specifies the expression to use for computing the lookup table for
  10772. the corresponding pixel component values.
  10773. The expressions can contain the following constants and functions:
  10774. @table @option
  10775. @item w
  10776. @item h
  10777. The input width and height.
  10778. @item val
  10779. The input value for the pixel component.
  10780. @item ymin, umin, vmin, amin
  10781. The minimum allowed component value.
  10782. @item ymax, umax, vmax, amax
  10783. The maximum allowed component value.
  10784. @end table
  10785. All expressions default to "val".
  10786. @subsection Examples
  10787. @itemize
  10788. @item
  10789. Change too high luma values to gradient:
  10790. @example
  10791. pseudocolor="'if(between(val,ymax,amax),lerp(ymin,ymax,(val-ymax)/(amax-ymax)),-1):if(between(val,ymax,amax),lerp(umax,umin,(val-ymax)/(amax-ymax)),-1):if(between(val,ymax,amax),lerp(vmin,vmax,(val-ymax)/(amax-ymax)),-1):-1'"
  10792. @end example
  10793. @end itemize
  10794. @section psnr
  10795. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  10796. Ratio) between two input videos.
  10797. This filter takes in input two input videos, the first input is
  10798. considered the "main" source and is passed unchanged to the
  10799. output. The second input is used as a "reference" video for computing
  10800. the PSNR.
  10801. Both video inputs must have the same resolution and pixel format for
  10802. this filter to work correctly. Also it assumes that both inputs
  10803. have the same number of frames, which are compared one by one.
  10804. The obtained average PSNR is printed through the logging system.
  10805. The filter stores the accumulated MSE (mean squared error) of each
  10806. frame, and at the end of the processing it is averaged across all frames
  10807. equally, and the following formula is applied to obtain the PSNR:
  10808. @example
  10809. PSNR = 10*log10(MAX^2/MSE)
  10810. @end example
  10811. Where MAX is the average of the maximum values of each component of the
  10812. image.
  10813. The description of the accepted parameters follows.
  10814. @table @option
  10815. @item stats_file, f
  10816. If specified the filter will use the named file to save the PSNR of
  10817. each individual frame. When filename equals "-" the data is sent to
  10818. standard output.
  10819. @item stats_version
  10820. Specifies which version of the stats file format to use. Details of
  10821. each format are written below.
  10822. Default value is 1.
  10823. @item stats_add_max
  10824. Determines whether the max value is output to the stats log.
  10825. Default value is 0.
  10826. Requires stats_version >= 2. If this is set and stats_version < 2,
  10827. the filter will return an error.
  10828. @end table
  10829. This filter also supports the @ref{framesync} options.
  10830. The file printed if @var{stats_file} is selected, contains a sequence of
  10831. key/value pairs of the form @var{key}:@var{value} for each compared
  10832. couple of frames.
  10833. If a @var{stats_version} greater than 1 is specified, a header line precedes
  10834. the list of per-frame-pair stats, with key value pairs following the frame
  10835. format with the following parameters:
  10836. @table @option
  10837. @item psnr_log_version
  10838. The version of the log file format. Will match @var{stats_version}.
  10839. @item fields
  10840. A comma separated list of the per-frame-pair parameters included in
  10841. the log.
  10842. @end table
  10843. A description of each shown per-frame-pair parameter follows:
  10844. @table @option
  10845. @item n
  10846. sequential number of the input frame, starting from 1
  10847. @item mse_avg
  10848. Mean Square Error pixel-by-pixel average difference of the compared
  10849. frames, averaged over all the image components.
  10850. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  10851. Mean Square Error pixel-by-pixel average difference of the compared
  10852. frames for the component specified by the suffix.
  10853. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  10854. Peak Signal to Noise ratio of the compared frames for the component
  10855. specified by the suffix.
  10856. @item max_avg, max_y, max_u, max_v
  10857. Maximum allowed value for each channel, and average over all
  10858. channels.
  10859. @end table
  10860. For example:
  10861. @example
  10862. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10863. [main][ref] psnr="stats_file=stats.log" [out]
  10864. @end example
  10865. On this example the input file being processed is compared with the
  10866. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  10867. is stored in @file{stats.log}.
  10868. @anchor{pullup}
  10869. @section pullup
  10870. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  10871. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  10872. content.
  10873. The pullup filter is designed to take advantage of future context in making
  10874. its decisions. This filter is stateless in the sense that it does not lock
  10875. onto a pattern to follow, but it instead looks forward to the following
  10876. fields in order to identify matches and rebuild progressive frames.
  10877. To produce content with an even framerate, insert the fps filter after
  10878. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  10879. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  10880. The filter accepts the following options:
  10881. @table @option
  10882. @item jl
  10883. @item jr
  10884. @item jt
  10885. @item jb
  10886. These options set the amount of "junk" to ignore at the left, right, top, and
  10887. bottom of the image, respectively. Left and right are in units of 8 pixels,
  10888. while top and bottom are in units of 2 lines.
  10889. The default is 8 pixels on each side.
  10890. @item sb
  10891. Set the strict breaks. Setting this option to 1 will reduce the chances of
  10892. filter generating an occasional mismatched frame, but it may also cause an
  10893. excessive number of frames to be dropped during high motion sequences.
  10894. Conversely, setting it to -1 will make filter match fields more easily.
  10895. This may help processing of video where there is slight blurring between
  10896. the fields, but may also cause there to be interlaced frames in the output.
  10897. Default value is @code{0}.
  10898. @item mp
  10899. Set the metric plane to use. It accepts the following values:
  10900. @table @samp
  10901. @item l
  10902. Use luma plane.
  10903. @item u
  10904. Use chroma blue plane.
  10905. @item v
  10906. Use chroma red plane.
  10907. @end table
  10908. This option may be set to use chroma plane instead of the default luma plane
  10909. for doing filter's computations. This may improve accuracy on very clean
  10910. source material, but more likely will decrease accuracy, especially if there
  10911. is chroma noise (rainbow effect) or any grayscale video.
  10912. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  10913. load and make pullup usable in realtime on slow machines.
  10914. @end table
  10915. For best results (without duplicated frames in the output file) it is
  10916. necessary to change the output frame rate. For example, to inverse
  10917. telecine NTSC input:
  10918. @example
  10919. ffmpeg -i input -vf pullup -r 24000/1001 ...
  10920. @end example
  10921. @section qp
  10922. Change video quantization parameters (QP).
  10923. The filter accepts the following option:
  10924. @table @option
  10925. @item qp
  10926. Set expression for quantization parameter.
  10927. @end table
  10928. The expression is evaluated through the eval API and can contain, among others,
  10929. the following constants:
  10930. @table @var
  10931. @item known
  10932. 1 if index is not 129, 0 otherwise.
  10933. @item qp
  10934. Sequential index starting from -129 to 128.
  10935. @end table
  10936. @subsection Examples
  10937. @itemize
  10938. @item
  10939. Some equation like:
  10940. @example
  10941. qp=2+2*sin(PI*qp)
  10942. @end example
  10943. @end itemize
  10944. @section random
  10945. Flush video frames from internal cache of frames into a random order.
  10946. No frame is discarded.
  10947. Inspired by @ref{frei0r} nervous filter.
  10948. @table @option
  10949. @item frames
  10950. Set size in number of frames of internal cache, in range from @code{2} to
  10951. @code{512}. Default is @code{30}.
  10952. @item seed
  10953. Set seed for random number generator, must be an integer included between
  10954. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  10955. less than @code{0}, the filter will try to use a good random seed on a
  10956. best effort basis.
  10957. @end table
  10958. @section readeia608
  10959. Read closed captioning (EIA-608) information from the top lines of a video frame.
  10960. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  10961. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  10962. with EIA-608 data (starting from 0). A description of each metadata value follows:
  10963. @table @option
  10964. @item lavfi.readeia608.X.cc
  10965. The two bytes stored as EIA-608 data (printed in hexadecimal).
  10966. @item lavfi.readeia608.X.line
  10967. The number of the line on which the EIA-608 data was identified and read.
  10968. @end table
  10969. This filter accepts the following options:
  10970. @table @option
  10971. @item scan_min
  10972. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  10973. @item scan_max
  10974. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  10975. @item mac
  10976. Set minimal acceptable amplitude change for sync codes detection.
  10977. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  10978. @item spw
  10979. Set the ratio of width reserved for sync code detection.
  10980. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  10981. @item mhd
  10982. Set the max peaks height difference for sync code detection.
  10983. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10984. @item mpd
  10985. Set max peaks period difference for sync code detection.
  10986. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10987. @item msd
  10988. Set the first two max start code bits differences.
  10989. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  10990. @item bhd
  10991. Set the minimum ratio of bits height compared to 3rd start code bit.
  10992. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  10993. @item th_w
  10994. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  10995. @item th_b
  10996. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  10997. @item chp
  10998. Enable checking the parity bit. In the event of a parity error, the filter will output
  10999. @code{0x00} for that character. Default is false.
  11000. @end table
  11001. @subsection Examples
  11002. @itemize
  11003. @item
  11004. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  11005. @example
  11006. ffprobe -f lavfi -i movie=captioned_video.mov,readeia608 -show_entries frame=pkt_pts_time:frame_tags=lavfi.readeia608.0.cc,lavfi.readeia608.1.cc -of csv
  11007. @end example
  11008. @end itemize
  11009. @section readvitc
  11010. Read vertical interval timecode (VITC) information from the top lines of a
  11011. video frame.
  11012. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  11013. timecode value, if a valid timecode has been detected. Further metadata key
  11014. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  11015. timecode data has been found or not.
  11016. This filter accepts the following options:
  11017. @table @option
  11018. @item scan_max
  11019. Set the maximum number of lines to scan for VITC data. If the value is set to
  11020. @code{-1} the full video frame is scanned. Default is @code{45}.
  11021. @item thr_b
  11022. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  11023. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  11024. @item thr_w
  11025. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  11026. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  11027. @end table
  11028. @subsection Examples
  11029. @itemize
  11030. @item
  11031. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  11032. draw @code{--:--:--:--} as a placeholder:
  11033. @example
  11034. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  11035. @end example
  11036. @end itemize
  11037. @section remap
  11038. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  11039. Destination pixel at position (X, Y) will be picked from source (x, y) position
  11040. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  11041. value for pixel will be used for destination pixel.
  11042. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  11043. will have Xmap/Ymap video stream dimensions.
  11044. Xmap and Ymap input video streams are 16bit depth, single channel.
  11045. @section removegrain
  11046. The removegrain filter is a spatial denoiser for progressive video.
  11047. @table @option
  11048. @item m0
  11049. Set mode for the first plane.
  11050. @item m1
  11051. Set mode for the second plane.
  11052. @item m2
  11053. Set mode for the third plane.
  11054. @item m3
  11055. Set mode for the fourth plane.
  11056. @end table
  11057. Range of mode is from 0 to 24. Description of each mode follows:
  11058. @table @var
  11059. @item 0
  11060. Leave input plane unchanged. Default.
  11061. @item 1
  11062. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  11063. @item 2
  11064. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  11065. @item 3
  11066. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  11067. @item 4
  11068. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  11069. This is equivalent to a median filter.
  11070. @item 5
  11071. Line-sensitive clipping giving the minimal change.
  11072. @item 6
  11073. Line-sensitive clipping, intermediate.
  11074. @item 7
  11075. Line-sensitive clipping, intermediate.
  11076. @item 8
  11077. Line-sensitive clipping, intermediate.
  11078. @item 9
  11079. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  11080. @item 10
  11081. Replaces the target pixel with the closest neighbour.
  11082. @item 11
  11083. [1 2 1] horizontal and vertical kernel blur.
  11084. @item 12
  11085. Same as mode 11.
  11086. @item 13
  11087. Bob mode, interpolates top field from the line where the neighbours
  11088. pixels are the closest.
  11089. @item 14
  11090. Bob mode, interpolates bottom field from the line where the neighbours
  11091. pixels are the closest.
  11092. @item 15
  11093. Bob mode, interpolates top field. Same as 13 but with a more complicated
  11094. interpolation formula.
  11095. @item 16
  11096. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  11097. interpolation formula.
  11098. @item 17
  11099. Clips the pixel with the minimum and maximum of respectively the maximum and
  11100. minimum of each pair of opposite neighbour pixels.
  11101. @item 18
  11102. Line-sensitive clipping using opposite neighbours whose greatest distance from
  11103. the current pixel is minimal.
  11104. @item 19
  11105. Replaces the pixel with the average of its 8 neighbours.
  11106. @item 20
  11107. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  11108. @item 21
  11109. Clips pixels using the averages of opposite neighbour.
  11110. @item 22
  11111. Same as mode 21 but simpler and faster.
  11112. @item 23
  11113. Small edge and halo removal, but reputed useless.
  11114. @item 24
  11115. Similar as 23.
  11116. @end table
  11117. @section removelogo
  11118. Suppress a TV station logo, using an image file to determine which
  11119. pixels comprise the logo. It works by filling in the pixels that
  11120. comprise the logo with neighboring pixels.
  11121. The filter accepts the following options:
  11122. @table @option
  11123. @item filename, f
  11124. Set the filter bitmap file, which can be any image format supported by
  11125. libavformat. The width and height of the image file must match those of the
  11126. video stream being processed.
  11127. @end table
  11128. Pixels in the provided bitmap image with a value of zero are not
  11129. considered part of the logo, non-zero pixels are considered part of
  11130. the logo. If you use white (255) for the logo and black (0) for the
  11131. rest, you will be safe. For making the filter bitmap, it is
  11132. recommended to take a screen capture of a black frame with the logo
  11133. visible, and then using a threshold filter followed by the erode
  11134. filter once or twice.
  11135. If needed, little splotches can be fixed manually. Remember that if
  11136. logo pixels are not covered, the filter quality will be much
  11137. reduced. Marking too many pixels as part of the logo does not hurt as
  11138. much, but it will increase the amount of blurring needed to cover over
  11139. the image and will destroy more information than necessary, and extra
  11140. pixels will slow things down on a large logo.
  11141. @section repeatfields
  11142. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  11143. fields based on its value.
  11144. @section reverse
  11145. Reverse a video clip.
  11146. Warning: This filter requires memory to buffer the entire clip, so trimming
  11147. is suggested.
  11148. @subsection Examples
  11149. @itemize
  11150. @item
  11151. Take the first 5 seconds of a clip, and reverse it.
  11152. @example
  11153. trim=end=5,reverse
  11154. @end example
  11155. @end itemize
  11156. @section rgbashift
  11157. Shift R/G/B/A pixels horizontally and/or vertically.
  11158. The filter accepts the following options:
  11159. @table @option
  11160. @item rh
  11161. Set amount to shift red horizontally.
  11162. @item rv
  11163. Set amount to shift red vertically.
  11164. @item gh
  11165. Set amount to shift green horizontally.
  11166. @item gv
  11167. Set amount to shift green vertically.
  11168. @item bh
  11169. Set amount to shift blue horizontally.
  11170. @item bv
  11171. Set amount to shift blue vertically.
  11172. @item ah
  11173. Set amount to shift alpha horizontally.
  11174. @item av
  11175. Set amount to shift alpha vertically.
  11176. @item edge
  11177. Set edge mode, can be @var{smear}, default, or @var{warp}.
  11178. @end table
  11179. @section roberts
  11180. Apply roberts cross operator to input video stream.
  11181. The filter accepts the following option:
  11182. @table @option
  11183. @item planes
  11184. Set which planes will be processed, unprocessed planes will be copied.
  11185. By default value 0xf, all planes will be processed.
  11186. @item scale
  11187. Set value which will be multiplied with filtered result.
  11188. @item delta
  11189. Set value which will be added to filtered result.
  11190. @end table
  11191. @section rotate
  11192. Rotate video by an arbitrary angle expressed in radians.
  11193. The filter accepts the following options:
  11194. A description of the optional parameters follows.
  11195. @table @option
  11196. @item angle, a
  11197. Set an expression for the angle by which to rotate the input video
  11198. clockwise, expressed as a number of radians. A negative value will
  11199. result in a counter-clockwise rotation. By default it is set to "0".
  11200. This expression is evaluated for each frame.
  11201. @item out_w, ow
  11202. Set the output width expression, default value is "iw".
  11203. This expression is evaluated just once during configuration.
  11204. @item out_h, oh
  11205. Set the output height expression, default value is "ih".
  11206. This expression is evaluated just once during configuration.
  11207. @item bilinear
  11208. Enable bilinear interpolation if set to 1, a value of 0 disables
  11209. it. Default value is 1.
  11210. @item fillcolor, c
  11211. Set the color used to fill the output area not covered by the rotated
  11212. image. For the general syntax of this option, check the
  11213. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11214. If the special value "none" is selected then no
  11215. background is printed (useful for example if the background is never shown).
  11216. Default value is "black".
  11217. @end table
  11218. The expressions for the angle and the output size can contain the
  11219. following constants and functions:
  11220. @table @option
  11221. @item n
  11222. sequential number of the input frame, starting from 0. It is always NAN
  11223. before the first frame is filtered.
  11224. @item t
  11225. time in seconds of the input frame, it is set to 0 when the filter is
  11226. configured. It is always NAN before the first frame is filtered.
  11227. @item hsub
  11228. @item vsub
  11229. horizontal and vertical chroma subsample values. For example for the
  11230. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11231. @item in_w, iw
  11232. @item in_h, ih
  11233. the input video width and height
  11234. @item out_w, ow
  11235. @item out_h, oh
  11236. the output width and height, that is the size of the padded area as
  11237. specified by the @var{width} and @var{height} expressions
  11238. @item rotw(a)
  11239. @item roth(a)
  11240. the minimal width/height required for completely containing the input
  11241. video rotated by @var{a} radians.
  11242. These are only available when computing the @option{out_w} and
  11243. @option{out_h} expressions.
  11244. @end table
  11245. @subsection Examples
  11246. @itemize
  11247. @item
  11248. Rotate the input by PI/6 radians clockwise:
  11249. @example
  11250. rotate=PI/6
  11251. @end example
  11252. @item
  11253. Rotate the input by PI/6 radians counter-clockwise:
  11254. @example
  11255. rotate=-PI/6
  11256. @end example
  11257. @item
  11258. Rotate the input by 45 degrees clockwise:
  11259. @example
  11260. rotate=45*PI/180
  11261. @end example
  11262. @item
  11263. Apply a constant rotation with period T, starting from an angle of PI/3:
  11264. @example
  11265. rotate=PI/3+2*PI*t/T
  11266. @end example
  11267. @item
  11268. Make the input video rotation oscillating with a period of T
  11269. seconds and an amplitude of A radians:
  11270. @example
  11271. rotate=A*sin(2*PI/T*t)
  11272. @end example
  11273. @item
  11274. Rotate the video, output size is chosen so that the whole rotating
  11275. input video is always completely contained in the output:
  11276. @example
  11277. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  11278. @end example
  11279. @item
  11280. Rotate the video, reduce the output size so that no background is ever
  11281. shown:
  11282. @example
  11283. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  11284. @end example
  11285. @end itemize
  11286. @subsection Commands
  11287. The filter supports the following commands:
  11288. @table @option
  11289. @item a, angle
  11290. Set the angle expression.
  11291. The command accepts the same syntax of the corresponding option.
  11292. If the specified expression is not valid, it is kept at its current
  11293. value.
  11294. @end table
  11295. @section sab
  11296. Apply Shape Adaptive Blur.
  11297. The filter accepts the following options:
  11298. @table @option
  11299. @item luma_radius, lr
  11300. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  11301. value is 1.0. A greater value will result in a more blurred image, and
  11302. in slower processing.
  11303. @item luma_pre_filter_radius, lpfr
  11304. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  11305. value is 1.0.
  11306. @item luma_strength, ls
  11307. Set luma maximum difference between pixels to still be considered, must
  11308. be a value in the 0.1-100.0 range, default value is 1.0.
  11309. @item chroma_radius, cr
  11310. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  11311. greater value will result in a more blurred image, and in slower
  11312. processing.
  11313. @item chroma_pre_filter_radius, cpfr
  11314. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  11315. @item chroma_strength, cs
  11316. Set chroma maximum difference between pixels to still be considered,
  11317. must be a value in the -0.9-100.0 range.
  11318. @end table
  11319. Each chroma option value, if not explicitly specified, is set to the
  11320. corresponding luma option value.
  11321. @anchor{scale}
  11322. @section scale
  11323. Scale (resize) the input video, using the libswscale library.
  11324. The scale filter forces the output display aspect ratio to be the same
  11325. of the input, by changing the output sample aspect ratio.
  11326. If the input image format is different from the format requested by
  11327. the next filter, the scale filter will convert the input to the
  11328. requested format.
  11329. @subsection Options
  11330. The filter accepts the following options, or any of the options
  11331. supported by the libswscale scaler.
  11332. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  11333. the complete list of scaler options.
  11334. @table @option
  11335. @item width, w
  11336. @item height, h
  11337. Set the output video dimension expression. Default value is the input
  11338. dimension.
  11339. If the @var{width} or @var{w} value is 0, the input width is used for
  11340. the output. If the @var{height} or @var{h} value is 0, the input height
  11341. is used for the output.
  11342. If one and only one of the values is -n with n >= 1, the scale filter
  11343. will use a value that maintains the aspect ratio of the input image,
  11344. calculated from the other specified dimension. After that it will,
  11345. however, make sure that the calculated dimension is divisible by n and
  11346. adjust the value if necessary.
  11347. If both values are -n with n >= 1, the behavior will be identical to
  11348. both values being set to 0 as previously detailed.
  11349. See below for the list of accepted constants for use in the dimension
  11350. expression.
  11351. @item eval
  11352. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  11353. @table @samp
  11354. @item init
  11355. Only evaluate expressions once during the filter initialization or when a command is processed.
  11356. @item frame
  11357. Evaluate expressions for each incoming frame.
  11358. @end table
  11359. Default value is @samp{init}.
  11360. @item interl
  11361. Set the interlacing mode. It accepts the following values:
  11362. @table @samp
  11363. @item 1
  11364. Force interlaced aware scaling.
  11365. @item 0
  11366. Do not apply interlaced scaling.
  11367. @item -1
  11368. Select interlaced aware scaling depending on whether the source frames
  11369. are flagged as interlaced or not.
  11370. @end table
  11371. Default value is @samp{0}.
  11372. @item flags
  11373. Set libswscale scaling flags. See
  11374. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11375. complete list of values. If not explicitly specified the filter applies
  11376. the default flags.
  11377. @item param0, param1
  11378. Set libswscale input parameters for scaling algorithms that need them. See
  11379. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11380. complete documentation. If not explicitly specified the filter applies
  11381. empty parameters.
  11382. @item size, s
  11383. Set the video size. For the syntax of this option, check the
  11384. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11385. @item in_color_matrix
  11386. @item out_color_matrix
  11387. Set in/output YCbCr color space type.
  11388. This allows the autodetected value to be overridden as well as allows forcing
  11389. a specific value used for the output and encoder.
  11390. If not specified, the color space type depends on the pixel format.
  11391. Possible values:
  11392. @table @samp
  11393. @item auto
  11394. Choose automatically.
  11395. @item bt709
  11396. Format conforming to International Telecommunication Union (ITU)
  11397. Recommendation BT.709.
  11398. @item fcc
  11399. Set color space conforming to the United States Federal Communications
  11400. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  11401. @item bt601
  11402. Set color space conforming to:
  11403. @itemize
  11404. @item
  11405. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  11406. @item
  11407. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  11408. @item
  11409. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  11410. @end itemize
  11411. @item smpte240m
  11412. Set color space conforming to SMPTE ST 240:1999.
  11413. @end table
  11414. @item in_range
  11415. @item out_range
  11416. Set in/output YCbCr sample range.
  11417. This allows the autodetected value to be overridden as well as allows forcing
  11418. a specific value used for the output and encoder. If not specified, the
  11419. range depends on the pixel format. Possible values:
  11420. @table @samp
  11421. @item auto/unknown
  11422. Choose automatically.
  11423. @item jpeg/full/pc
  11424. Set full range (0-255 in case of 8-bit luma).
  11425. @item mpeg/limited/tv
  11426. Set "MPEG" range (16-235 in case of 8-bit luma).
  11427. @end table
  11428. @item force_original_aspect_ratio
  11429. Enable decreasing or increasing output video width or height if necessary to
  11430. keep the original aspect ratio. Possible values:
  11431. @table @samp
  11432. @item disable
  11433. Scale the video as specified and disable this feature.
  11434. @item decrease
  11435. The output video dimensions will automatically be decreased if needed.
  11436. @item increase
  11437. The output video dimensions will automatically be increased if needed.
  11438. @end table
  11439. One useful instance of this option is that when you know a specific device's
  11440. maximum allowed resolution, you can use this to limit the output video to
  11441. that, while retaining the aspect ratio. For example, device A allows
  11442. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  11443. decrease) and specifying 1280x720 to the command line makes the output
  11444. 1280x533.
  11445. Please note that this is a different thing than specifying -1 for @option{w}
  11446. or @option{h}, you still need to specify the output resolution for this option
  11447. to work.
  11448. @end table
  11449. The values of the @option{w} and @option{h} options are expressions
  11450. containing the following constants:
  11451. @table @var
  11452. @item in_w
  11453. @item in_h
  11454. The input width and height
  11455. @item iw
  11456. @item ih
  11457. These are the same as @var{in_w} and @var{in_h}.
  11458. @item out_w
  11459. @item out_h
  11460. The output (scaled) width and height
  11461. @item ow
  11462. @item oh
  11463. These are the same as @var{out_w} and @var{out_h}
  11464. @item a
  11465. The same as @var{iw} / @var{ih}
  11466. @item sar
  11467. input sample aspect ratio
  11468. @item dar
  11469. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11470. @item hsub
  11471. @item vsub
  11472. horizontal and vertical input chroma subsample values. For example for the
  11473. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11474. @item ohsub
  11475. @item ovsub
  11476. horizontal and vertical output chroma subsample values. For example for the
  11477. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11478. @end table
  11479. @subsection Examples
  11480. @itemize
  11481. @item
  11482. Scale the input video to a size of 200x100
  11483. @example
  11484. scale=w=200:h=100
  11485. @end example
  11486. This is equivalent to:
  11487. @example
  11488. scale=200:100
  11489. @end example
  11490. or:
  11491. @example
  11492. scale=200x100
  11493. @end example
  11494. @item
  11495. Specify a size abbreviation for the output size:
  11496. @example
  11497. scale=qcif
  11498. @end example
  11499. which can also be written as:
  11500. @example
  11501. scale=size=qcif
  11502. @end example
  11503. @item
  11504. Scale the input to 2x:
  11505. @example
  11506. scale=w=2*iw:h=2*ih
  11507. @end example
  11508. @item
  11509. The above is the same as:
  11510. @example
  11511. scale=2*in_w:2*in_h
  11512. @end example
  11513. @item
  11514. Scale the input to 2x with forced interlaced scaling:
  11515. @example
  11516. scale=2*iw:2*ih:interl=1
  11517. @end example
  11518. @item
  11519. Scale the input to half size:
  11520. @example
  11521. scale=w=iw/2:h=ih/2
  11522. @end example
  11523. @item
  11524. Increase the width, and set the height to the same size:
  11525. @example
  11526. scale=3/2*iw:ow
  11527. @end example
  11528. @item
  11529. Seek Greek harmony:
  11530. @example
  11531. scale=iw:1/PHI*iw
  11532. scale=ih*PHI:ih
  11533. @end example
  11534. @item
  11535. Increase the height, and set the width to 3/2 of the height:
  11536. @example
  11537. scale=w=3/2*oh:h=3/5*ih
  11538. @end example
  11539. @item
  11540. Increase the size, making the size a multiple of the chroma
  11541. subsample values:
  11542. @example
  11543. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  11544. @end example
  11545. @item
  11546. Increase the width to a maximum of 500 pixels,
  11547. keeping the same aspect ratio as the input:
  11548. @example
  11549. scale=w='min(500\, iw*3/2):h=-1'
  11550. @end example
  11551. @item
  11552. Make pixels square by combining scale and setsar:
  11553. @example
  11554. scale='trunc(ih*dar):ih',setsar=1/1
  11555. @end example
  11556. @item
  11557. Make pixels square by combining scale and setsar,
  11558. making sure the resulting resolution is even (required by some codecs):
  11559. @example
  11560. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  11561. @end example
  11562. @end itemize
  11563. @subsection Commands
  11564. This filter supports the following commands:
  11565. @table @option
  11566. @item width, w
  11567. @item height, h
  11568. Set the output video dimension expression.
  11569. The command accepts the same syntax of the corresponding option.
  11570. If the specified expression is not valid, it is kept at its current
  11571. value.
  11572. @end table
  11573. @section scale_npp
  11574. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  11575. format conversion on CUDA video frames. Setting the output width and height
  11576. works in the same way as for the @var{scale} filter.
  11577. The following additional options are accepted:
  11578. @table @option
  11579. @item format
  11580. The pixel format of the output CUDA frames. If set to the string "same" (the
  11581. default), the input format will be kept. Note that automatic format negotiation
  11582. and conversion is not yet supported for hardware frames
  11583. @item interp_algo
  11584. The interpolation algorithm used for resizing. One of the following:
  11585. @table @option
  11586. @item nn
  11587. Nearest neighbour.
  11588. @item linear
  11589. @item cubic
  11590. @item cubic2p_bspline
  11591. 2-parameter cubic (B=1, C=0)
  11592. @item cubic2p_catmullrom
  11593. 2-parameter cubic (B=0, C=1/2)
  11594. @item cubic2p_b05c03
  11595. 2-parameter cubic (B=1/2, C=3/10)
  11596. @item super
  11597. Supersampling
  11598. @item lanczos
  11599. @end table
  11600. @end table
  11601. @section scale2ref
  11602. Scale (resize) the input video, based on a reference video.
  11603. See the scale filter for available options, scale2ref supports the same but
  11604. uses the reference video instead of the main input as basis. scale2ref also
  11605. supports the following additional constants for the @option{w} and
  11606. @option{h} options:
  11607. @table @var
  11608. @item main_w
  11609. @item main_h
  11610. The main input video's width and height
  11611. @item main_a
  11612. The same as @var{main_w} / @var{main_h}
  11613. @item main_sar
  11614. The main input video's sample aspect ratio
  11615. @item main_dar, mdar
  11616. The main input video's display aspect ratio. Calculated from
  11617. @code{(main_w / main_h) * main_sar}.
  11618. @item main_hsub
  11619. @item main_vsub
  11620. The main input video's horizontal and vertical chroma subsample values.
  11621. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  11622. is 1.
  11623. @end table
  11624. @subsection Examples
  11625. @itemize
  11626. @item
  11627. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  11628. @example
  11629. 'scale2ref[b][a];[a][b]overlay'
  11630. @end example
  11631. @end itemize
  11632. @anchor{selectivecolor}
  11633. @section selectivecolor
  11634. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  11635. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  11636. by the "purity" of the color (that is, how saturated it already is).
  11637. This filter is similar to the Adobe Photoshop Selective Color tool.
  11638. The filter accepts the following options:
  11639. @table @option
  11640. @item correction_method
  11641. Select color correction method.
  11642. Available values are:
  11643. @table @samp
  11644. @item absolute
  11645. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  11646. component value).
  11647. @item relative
  11648. Specified adjustments are relative to the original component value.
  11649. @end table
  11650. Default is @code{absolute}.
  11651. @item reds
  11652. Adjustments for red pixels (pixels where the red component is the maximum)
  11653. @item yellows
  11654. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  11655. @item greens
  11656. Adjustments for green pixels (pixels where the green component is the maximum)
  11657. @item cyans
  11658. Adjustments for cyan pixels (pixels where the red component is the minimum)
  11659. @item blues
  11660. Adjustments for blue pixels (pixels where the blue component is the maximum)
  11661. @item magentas
  11662. Adjustments for magenta pixels (pixels where the green component is the minimum)
  11663. @item whites
  11664. Adjustments for white pixels (pixels where all components are greater than 128)
  11665. @item neutrals
  11666. Adjustments for all pixels except pure black and pure white
  11667. @item blacks
  11668. Adjustments for black pixels (pixels where all components are lesser than 128)
  11669. @item psfile
  11670. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  11671. @end table
  11672. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  11673. 4 space separated floating point adjustment values in the [-1,1] range,
  11674. respectively to adjust the amount of cyan, magenta, yellow and black for the
  11675. pixels of its range.
  11676. @subsection Examples
  11677. @itemize
  11678. @item
  11679. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  11680. increase magenta by 27% in blue areas:
  11681. @example
  11682. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  11683. @end example
  11684. @item
  11685. Use a Photoshop selective color preset:
  11686. @example
  11687. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  11688. @end example
  11689. @end itemize
  11690. @anchor{separatefields}
  11691. @section separatefields
  11692. The @code{separatefields} takes a frame-based video input and splits
  11693. each frame into its components fields, producing a new half height clip
  11694. with twice the frame rate and twice the frame count.
  11695. This filter use field-dominance information in frame to decide which
  11696. of each pair of fields to place first in the output.
  11697. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  11698. @section setdar, setsar
  11699. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  11700. output video.
  11701. This is done by changing the specified Sample (aka Pixel) Aspect
  11702. Ratio, according to the following equation:
  11703. @example
  11704. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  11705. @end example
  11706. Keep in mind that the @code{setdar} filter does not modify the pixel
  11707. dimensions of the video frame. Also, the display aspect ratio set by
  11708. this filter may be changed by later filters in the filterchain,
  11709. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  11710. applied.
  11711. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  11712. the filter output video.
  11713. Note that as a consequence of the application of this filter, the
  11714. output display aspect ratio will change according to the equation
  11715. above.
  11716. Keep in mind that the sample aspect ratio set by the @code{setsar}
  11717. filter may be changed by later filters in the filterchain, e.g. if
  11718. another "setsar" or a "setdar" filter is applied.
  11719. It accepts the following parameters:
  11720. @table @option
  11721. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  11722. Set the aspect ratio used by the filter.
  11723. The parameter can be a floating point number string, an expression, or
  11724. a string of the form @var{num}:@var{den}, where @var{num} and
  11725. @var{den} are the numerator and denominator of the aspect ratio. If
  11726. the parameter is not specified, it is assumed the value "0".
  11727. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  11728. should be escaped.
  11729. @item max
  11730. Set the maximum integer value to use for expressing numerator and
  11731. denominator when reducing the expressed aspect ratio to a rational.
  11732. Default value is @code{100}.
  11733. @end table
  11734. The parameter @var{sar} is an expression containing
  11735. the following constants:
  11736. @table @option
  11737. @item E, PI, PHI
  11738. These are approximated values for the mathematical constants e
  11739. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  11740. @item w, h
  11741. The input width and height.
  11742. @item a
  11743. These are the same as @var{w} / @var{h}.
  11744. @item sar
  11745. The input sample aspect ratio.
  11746. @item dar
  11747. The input display aspect ratio. It is the same as
  11748. (@var{w} / @var{h}) * @var{sar}.
  11749. @item hsub, vsub
  11750. Horizontal and vertical chroma subsample values. For example, for the
  11751. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11752. @end table
  11753. @subsection Examples
  11754. @itemize
  11755. @item
  11756. To change the display aspect ratio to 16:9, specify one of the following:
  11757. @example
  11758. setdar=dar=1.77777
  11759. setdar=dar=16/9
  11760. @end example
  11761. @item
  11762. To change the sample aspect ratio to 10:11, specify:
  11763. @example
  11764. setsar=sar=10/11
  11765. @end example
  11766. @item
  11767. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  11768. 1000 in the aspect ratio reduction, use the command:
  11769. @example
  11770. setdar=ratio=16/9:max=1000
  11771. @end example
  11772. @end itemize
  11773. @anchor{setfield}
  11774. @section setfield
  11775. Force field for the output video frame.
  11776. The @code{setfield} filter marks the interlace type field for the
  11777. output frames. It does not change the input frame, but only sets the
  11778. corresponding property, which affects how the frame is treated by
  11779. following filters (e.g. @code{fieldorder} or @code{yadif}).
  11780. The filter accepts the following options:
  11781. @table @option
  11782. @item mode
  11783. Available values are:
  11784. @table @samp
  11785. @item auto
  11786. Keep the same field property.
  11787. @item bff
  11788. Mark the frame as bottom-field-first.
  11789. @item tff
  11790. Mark the frame as top-field-first.
  11791. @item prog
  11792. Mark the frame as progressive.
  11793. @end table
  11794. @end table
  11795. @anchor{setparams}
  11796. @section setparams
  11797. Force frame parameter for the output video frame.
  11798. The @code{setparams} filter marks interlace and color range for the
  11799. output frames. It does not change the input frame, but only sets the
  11800. corresponding property, which affects how the frame is treated by
  11801. filters/encoders.
  11802. @table @option
  11803. @item field_mode
  11804. Available values are:
  11805. @table @samp
  11806. @item auto
  11807. Keep the same field property (default).
  11808. @item bff
  11809. Mark the frame as bottom-field-first.
  11810. @item tff
  11811. Mark the frame as top-field-first.
  11812. @item prog
  11813. Mark the frame as progressive.
  11814. @end table
  11815. @item range
  11816. Available values are:
  11817. @table @samp
  11818. @item auto
  11819. Keep the same color range property (default).
  11820. @item unspecified, unknown
  11821. Mark the frame as unspecified color range.
  11822. @item limited, tv, mpeg
  11823. Mark the frame as limited range.
  11824. @item full, pc, jpeg
  11825. Mark the frame as full range.
  11826. @end table
  11827. @item color_primaries
  11828. Set the color primaries.
  11829. Available values are:
  11830. @table @samp
  11831. @item auto
  11832. Keep the same color primaries property (default).
  11833. @item bt709
  11834. @item unknown
  11835. @item bt470m
  11836. @item bt470bg
  11837. @item smpte170m
  11838. @item smpte240m
  11839. @item film
  11840. @item bt2020
  11841. @item smpte428
  11842. @item smpte431
  11843. @item smpte432
  11844. @item jedec-p22
  11845. @end table
  11846. @item color_trc
  11847. Set the color transfer.
  11848. Available values are:
  11849. @table @samp
  11850. @item auto
  11851. Keep the same color trc property (default).
  11852. @item bt709
  11853. @item unknown
  11854. @item bt470m
  11855. @item bt470bg
  11856. @item smpte170m
  11857. @item smpte240m
  11858. @item linear
  11859. @item log100
  11860. @item log316
  11861. @item iec61966-2-4
  11862. @item bt1361e
  11863. @item iec61966-2-1
  11864. @item bt2020-10
  11865. @item bt2020-12
  11866. @item smpte2084
  11867. @item smpte428
  11868. @item arib-std-b67
  11869. @end table
  11870. @item colorspace
  11871. Set the colorspace.
  11872. Available values are:
  11873. @table @samp
  11874. @item auto
  11875. Keep the same colorspace property (default).
  11876. @item gbr
  11877. @item bt709
  11878. @item unknown
  11879. @item fcc
  11880. @item bt470bg
  11881. @item smpte170m
  11882. @item smpte240m
  11883. @item ycgco
  11884. @item bt2020nc
  11885. @item bt2020c
  11886. @item smpte2085
  11887. @item chroma-derived-nc
  11888. @item chroma-derived-c
  11889. @item ictcp
  11890. @end table
  11891. @end table
  11892. @section showinfo
  11893. Show a line containing various information for each input video frame.
  11894. The input video is not modified.
  11895. This filter supports the following options:
  11896. @table @option
  11897. @item checksum
  11898. Calculate checksums of each plane. By default enabled.
  11899. @end table
  11900. The shown line contains a sequence of key/value pairs of the form
  11901. @var{key}:@var{value}.
  11902. The following values are shown in the output:
  11903. @table @option
  11904. @item n
  11905. The (sequential) number of the input frame, starting from 0.
  11906. @item pts
  11907. The Presentation TimeStamp of the input frame, expressed as a number of
  11908. time base units. The time base unit depends on the filter input pad.
  11909. @item pts_time
  11910. The Presentation TimeStamp of the input frame, expressed as a number of
  11911. seconds.
  11912. @item pos
  11913. The position of the frame in the input stream, or -1 if this information is
  11914. unavailable and/or meaningless (for example in case of synthetic video).
  11915. @item fmt
  11916. The pixel format name.
  11917. @item sar
  11918. The sample aspect ratio of the input frame, expressed in the form
  11919. @var{num}/@var{den}.
  11920. @item s
  11921. The size of the input frame. For the syntax of this option, check the
  11922. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11923. @item i
  11924. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  11925. for bottom field first).
  11926. @item iskey
  11927. This is 1 if the frame is a key frame, 0 otherwise.
  11928. @item type
  11929. The picture type of the input frame ("I" for an I-frame, "P" for a
  11930. P-frame, "B" for a B-frame, or "?" for an unknown type).
  11931. Also refer to the documentation of the @code{AVPictureType} enum and of
  11932. the @code{av_get_picture_type_char} function defined in
  11933. @file{libavutil/avutil.h}.
  11934. @item checksum
  11935. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  11936. @item plane_checksum
  11937. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  11938. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  11939. @end table
  11940. @section showpalette
  11941. Displays the 256 colors palette of each frame. This filter is only relevant for
  11942. @var{pal8} pixel format frames.
  11943. It accepts the following option:
  11944. @table @option
  11945. @item s
  11946. Set the size of the box used to represent one palette color entry. Default is
  11947. @code{30} (for a @code{30x30} pixel box).
  11948. @end table
  11949. @section shuffleframes
  11950. Reorder and/or duplicate and/or drop video frames.
  11951. It accepts the following parameters:
  11952. @table @option
  11953. @item mapping
  11954. Set the destination indexes of input frames.
  11955. This is space or '|' separated list of indexes that maps input frames to output
  11956. frames. Number of indexes also sets maximal value that each index may have.
  11957. '-1' index have special meaning and that is to drop frame.
  11958. @end table
  11959. The first frame has the index 0. The default is to keep the input unchanged.
  11960. @subsection Examples
  11961. @itemize
  11962. @item
  11963. Swap second and third frame of every three frames of the input:
  11964. @example
  11965. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  11966. @end example
  11967. @item
  11968. Swap 10th and 1st frame of every ten frames of the input:
  11969. @example
  11970. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  11971. @end example
  11972. @end itemize
  11973. @section shuffleplanes
  11974. Reorder and/or duplicate video planes.
  11975. It accepts the following parameters:
  11976. @table @option
  11977. @item map0
  11978. The index of the input plane to be used as the first output plane.
  11979. @item map1
  11980. The index of the input plane to be used as the second output plane.
  11981. @item map2
  11982. The index of the input plane to be used as the third output plane.
  11983. @item map3
  11984. The index of the input plane to be used as the fourth output plane.
  11985. @end table
  11986. The first plane has the index 0. The default is to keep the input unchanged.
  11987. @subsection Examples
  11988. @itemize
  11989. @item
  11990. Swap the second and third planes of the input:
  11991. @example
  11992. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  11993. @end example
  11994. @end itemize
  11995. @anchor{signalstats}
  11996. @section signalstats
  11997. Evaluate various visual metrics that assist in determining issues associated
  11998. with the digitization of analog video media.
  11999. By default the filter will log these metadata values:
  12000. @table @option
  12001. @item YMIN
  12002. Display the minimal Y value contained within the input frame. Expressed in
  12003. range of [0-255].
  12004. @item YLOW
  12005. Display the Y value at the 10% percentile within the input frame. Expressed in
  12006. range of [0-255].
  12007. @item YAVG
  12008. Display the average Y value within the input frame. Expressed in range of
  12009. [0-255].
  12010. @item YHIGH
  12011. Display the Y value at the 90% percentile within the input frame. Expressed in
  12012. range of [0-255].
  12013. @item YMAX
  12014. Display the maximum Y value contained within the input frame. Expressed in
  12015. range of [0-255].
  12016. @item UMIN
  12017. Display the minimal U value contained within the input frame. Expressed in
  12018. range of [0-255].
  12019. @item ULOW
  12020. Display the U value at the 10% percentile within the input frame. Expressed in
  12021. range of [0-255].
  12022. @item UAVG
  12023. Display the average U value within the input frame. Expressed in range of
  12024. [0-255].
  12025. @item UHIGH
  12026. Display the U value at the 90% percentile within the input frame. Expressed in
  12027. range of [0-255].
  12028. @item UMAX
  12029. Display the maximum U value contained within the input frame. Expressed in
  12030. range of [0-255].
  12031. @item VMIN
  12032. Display the minimal V value contained within the input frame. Expressed in
  12033. range of [0-255].
  12034. @item VLOW
  12035. Display the V value at the 10% percentile within the input frame. Expressed in
  12036. range of [0-255].
  12037. @item VAVG
  12038. Display the average V value within the input frame. Expressed in range of
  12039. [0-255].
  12040. @item VHIGH
  12041. Display the V value at the 90% percentile within the input frame. Expressed in
  12042. range of [0-255].
  12043. @item VMAX
  12044. Display the maximum V value contained within the input frame. Expressed in
  12045. range of [0-255].
  12046. @item SATMIN
  12047. Display the minimal saturation value contained within the input frame.
  12048. Expressed in range of [0-~181.02].
  12049. @item SATLOW
  12050. Display the saturation value at the 10% percentile within the input frame.
  12051. Expressed in range of [0-~181.02].
  12052. @item SATAVG
  12053. Display the average saturation value within the input frame. Expressed in range
  12054. of [0-~181.02].
  12055. @item SATHIGH
  12056. Display the saturation value at the 90% percentile within the input frame.
  12057. Expressed in range of [0-~181.02].
  12058. @item SATMAX
  12059. Display the maximum saturation value contained within the input frame.
  12060. Expressed in range of [0-~181.02].
  12061. @item HUEMED
  12062. Display the median value for hue within the input frame. Expressed in range of
  12063. [0-360].
  12064. @item HUEAVG
  12065. Display the average value for hue within the input frame. Expressed in range of
  12066. [0-360].
  12067. @item YDIF
  12068. Display the average of sample value difference between all values of the Y
  12069. plane in the current frame and corresponding values of the previous input frame.
  12070. Expressed in range of [0-255].
  12071. @item UDIF
  12072. Display the average of sample value difference between all values of the U
  12073. plane in the current frame and corresponding values of the previous input frame.
  12074. Expressed in range of [0-255].
  12075. @item VDIF
  12076. Display the average of sample value difference between all values of the V
  12077. plane in the current frame and corresponding values of the previous input frame.
  12078. Expressed in range of [0-255].
  12079. @item YBITDEPTH
  12080. Display bit depth of Y plane in current frame.
  12081. Expressed in range of [0-16].
  12082. @item UBITDEPTH
  12083. Display bit depth of U plane in current frame.
  12084. Expressed in range of [0-16].
  12085. @item VBITDEPTH
  12086. Display bit depth of V plane in current frame.
  12087. Expressed in range of [0-16].
  12088. @end table
  12089. The filter accepts the following options:
  12090. @table @option
  12091. @item stat
  12092. @item out
  12093. @option{stat} specify an additional form of image analysis.
  12094. @option{out} output video with the specified type of pixel highlighted.
  12095. Both options accept the following values:
  12096. @table @samp
  12097. @item tout
  12098. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  12099. unlike the neighboring pixels of the same field. Examples of temporal outliers
  12100. include the results of video dropouts, head clogs, or tape tracking issues.
  12101. @item vrep
  12102. Identify @var{vertical line repetition}. Vertical line repetition includes
  12103. similar rows of pixels within a frame. In born-digital video vertical line
  12104. repetition is common, but this pattern is uncommon in video digitized from an
  12105. analog source. When it occurs in video that results from the digitization of an
  12106. analog source it can indicate concealment from a dropout compensator.
  12107. @item brng
  12108. Identify pixels that fall outside of legal broadcast range.
  12109. @end table
  12110. @item color, c
  12111. Set the highlight color for the @option{out} option. The default color is
  12112. yellow.
  12113. @end table
  12114. @subsection Examples
  12115. @itemize
  12116. @item
  12117. Output data of various video metrics:
  12118. @example
  12119. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  12120. @end example
  12121. @item
  12122. Output specific data about the minimum and maximum values of the Y plane per frame:
  12123. @example
  12124. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  12125. @end example
  12126. @item
  12127. Playback video while highlighting pixels that are outside of broadcast range in red.
  12128. @example
  12129. ffplay example.mov -vf signalstats="out=brng:color=red"
  12130. @end example
  12131. @item
  12132. Playback video with signalstats metadata drawn over the frame.
  12133. @example
  12134. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  12135. @end example
  12136. The contents of signalstat_drawtext.txt used in the command are:
  12137. @example
  12138. time %@{pts:hms@}
  12139. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  12140. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  12141. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  12142. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  12143. @end example
  12144. @end itemize
  12145. @anchor{signature}
  12146. @section signature
  12147. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  12148. input. In this case the matching between the inputs can be calculated additionally.
  12149. The filter always passes through the first input. The signature of each stream can
  12150. be written into a file.
  12151. It accepts the following options:
  12152. @table @option
  12153. @item detectmode
  12154. Enable or disable the matching process.
  12155. Available values are:
  12156. @table @samp
  12157. @item off
  12158. Disable the calculation of a matching (default).
  12159. @item full
  12160. Calculate the matching for the whole video and output whether the whole video
  12161. matches or only parts.
  12162. @item fast
  12163. Calculate only until a matching is found or the video ends. Should be faster in
  12164. some cases.
  12165. @end table
  12166. @item nb_inputs
  12167. Set the number of inputs. The option value must be a non negative integer.
  12168. Default value is 1.
  12169. @item filename
  12170. Set the path to which the output is written. If there is more than one input,
  12171. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  12172. integer), that will be replaced with the input number. If no filename is
  12173. specified, no output will be written. This is the default.
  12174. @item format
  12175. Choose the output format.
  12176. Available values are:
  12177. @table @samp
  12178. @item binary
  12179. Use the specified binary representation (default).
  12180. @item xml
  12181. Use the specified xml representation.
  12182. @end table
  12183. @item th_d
  12184. Set threshold to detect one word as similar. The option value must be an integer
  12185. greater than zero. The default value is 9000.
  12186. @item th_dc
  12187. Set threshold to detect all words as similar. The option value must be an integer
  12188. greater than zero. The default value is 60000.
  12189. @item th_xh
  12190. Set threshold to detect frames as similar. The option value must be an integer
  12191. greater than zero. The default value is 116.
  12192. @item th_di
  12193. Set the minimum length of a sequence in frames to recognize it as matching
  12194. sequence. The option value must be a non negative integer value.
  12195. The default value is 0.
  12196. @item th_it
  12197. Set the minimum relation, that matching frames to all frames must have.
  12198. The option value must be a double value between 0 and 1. The default value is 0.5.
  12199. @end table
  12200. @subsection Examples
  12201. @itemize
  12202. @item
  12203. To calculate the signature of an input video and store it in signature.bin:
  12204. @example
  12205. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  12206. @end example
  12207. @item
  12208. To detect whether two videos match and store the signatures in XML format in
  12209. signature0.xml and signature1.xml:
  12210. @example
  12211. ffmpeg -i input1.mkv -i input2.mkv -filter_complex "[0:v][1:v] signature=nb_inputs=2:detectmode=full:format=xml:filename=signature%d.xml" -map :v -f null -
  12212. @end example
  12213. @end itemize
  12214. @anchor{smartblur}
  12215. @section smartblur
  12216. Blur the input video without impacting the outlines.
  12217. It accepts the following options:
  12218. @table @option
  12219. @item luma_radius, lr
  12220. Set the luma radius. The option value must be a float number in
  12221. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12222. used to blur the image (slower if larger). Default value is 1.0.
  12223. @item luma_strength, ls
  12224. Set the luma strength. The option value must be a float number
  12225. in the range [-1.0,1.0] that configures the blurring. A value included
  12226. in [0.0,1.0] will blur the image whereas a value included in
  12227. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  12228. @item luma_threshold, lt
  12229. Set the luma threshold used as a coefficient to determine
  12230. whether a pixel should be blurred or not. The option value must be an
  12231. integer in the range [-30,30]. A value of 0 will filter all the image,
  12232. a value included in [0,30] will filter flat areas and a value included
  12233. in [-30,0] will filter edges. Default value is 0.
  12234. @item chroma_radius, cr
  12235. Set the chroma radius. The option value must be a float number in
  12236. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12237. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  12238. @item chroma_strength, cs
  12239. Set the chroma strength. The option value must be a float number
  12240. in the range [-1.0,1.0] that configures the blurring. A value included
  12241. in [0.0,1.0] will blur the image whereas a value included in
  12242. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  12243. @item chroma_threshold, ct
  12244. Set the chroma threshold used as a coefficient to determine
  12245. whether a pixel should be blurred or not. The option value must be an
  12246. integer in the range [-30,30]. A value of 0 will filter all the image,
  12247. a value included in [0,30] will filter flat areas and a value included
  12248. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  12249. @end table
  12250. If a chroma option is not explicitly set, the corresponding luma value
  12251. is set.
  12252. @section ssim
  12253. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  12254. This filter takes in input two input videos, the first input is
  12255. considered the "main" source and is passed unchanged to the
  12256. output. The second input is used as a "reference" video for computing
  12257. the SSIM.
  12258. Both video inputs must have the same resolution and pixel format for
  12259. this filter to work correctly. Also it assumes that both inputs
  12260. have the same number of frames, which are compared one by one.
  12261. The filter stores the calculated SSIM of each frame.
  12262. The description of the accepted parameters follows.
  12263. @table @option
  12264. @item stats_file, f
  12265. If specified the filter will use the named file to save the SSIM of
  12266. each individual frame. When filename equals "-" the data is sent to
  12267. standard output.
  12268. @end table
  12269. The file printed if @var{stats_file} is selected, contains a sequence of
  12270. key/value pairs of the form @var{key}:@var{value} for each compared
  12271. couple of frames.
  12272. A description of each shown parameter follows:
  12273. @table @option
  12274. @item n
  12275. sequential number of the input frame, starting from 1
  12276. @item Y, U, V, R, G, B
  12277. SSIM of the compared frames for the component specified by the suffix.
  12278. @item All
  12279. SSIM of the compared frames for the whole frame.
  12280. @item dB
  12281. Same as above but in dB representation.
  12282. @end table
  12283. This filter also supports the @ref{framesync} options.
  12284. For example:
  12285. @example
  12286. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12287. [main][ref] ssim="stats_file=stats.log" [out]
  12288. @end example
  12289. On this example the input file being processed is compared with the
  12290. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  12291. is stored in @file{stats.log}.
  12292. Another example with both psnr and ssim at same time:
  12293. @example
  12294. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  12295. @end example
  12296. @section stereo3d
  12297. Convert between different stereoscopic image formats.
  12298. The filters accept the following options:
  12299. @table @option
  12300. @item in
  12301. Set stereoscopic image format of input.
  12302. Available values for input image formats are:
  12303. @table @samp
  12304. @item sbsl
  12305. side by side parallel (left eye left, right eye right)
  12306. @item sbsr
  12307. side by side crosseye (right eye left, left eye right)
  12308. @item sbs2l
  12309. side by side parallel with half width resolution
  12310. (left eye left, right eye right)
  12311. @item sbs2r
  12312. side by side crosseye with half width resolution
  12313. (right eye left, left eye right)
  12314. @item abl
  12315. above-below (left eye above, right eye below)
  12316. @item abr
  12317. above-below (right eye above, left eye below)
  12318. @item ab2l
  12319. above-below with half height resolution
  12320. (left eye above, right eye below)
  12321. @item ab2r
  12322. above-below with half height resolution
  12323. (right eye above, left eye below)
  12324. @item al
  12325. alternating frames (left eye first, right eye second)
  12326. @item ar
  12327. alternating frames (right eye first, left eye second)
  12328. @item irl
  12329. interleaved rows (left eye has top row, right eye starts on next row)
  12330. @item irr
  12331. interleaved rows (right eye has top row, left eye starts on next row)
  12332. @item icl
  12333. interleaved columns, left eye first
  12334. @item icr
  12335. interleaved columns, right eye first
  12336. Default value is @samp{sbsl}.
  12337. @end table
  12338. @item out
  12339. Set stereoscopic image format of output.
  12340. @table @samp
  12341. @item sbsl
  12342. side by side parallel (left eye left, right eye right)
  12343. @item sbsr
  12344. side by side crosseye (right eye left, left eye right)
  12345. @item sbs2l
  12346. side by side parallel with half width resolution
  12347. (left eye left, right eye right)
  12348. @item sbs2r
  12349. side by side crosseye with half width resolution
  12350. (right eye left, left eye right)
  12351. @item abl
  12352. above-below (left eye above, right eye below)
  12353. @item abr
  12354. above-below (right eye above, left eye below)
  12355. @item ab2l
  12356. above-below with half height resolution
  12357. (left eye above, right eye below)
  12358. @item ab2r
  12359. above-below with half height resolution
  12360. (right eye above, left eye below)
  12361. @item al
  12362. alternating frames (left eye first, right eye second)
  12363. @item ar
  12364. alternating frames (right eye first, left eye second)
  12365. @item irl
  12366. interleaved rows (left eye has top row, right eye starts on next row)
  12367. @item irr
  12368. interleaved rows (right eye has top row, left eye starts on next row)
  12369. @item arbg
  12370. anaglyph red/blue gray
  12371. (red filter on left eye, blue filter on right eye)
  12372. @item argg
  12373. anaglyph red/green gray
  12374. (red filter on left eye, green filter on right eye)
  12375. @item arcg
  12376. anaglyph red/cyan gray
  12377. (red filter on left eye, cyan filter on right eye)
  12378. @item arch
  12379. anaglyph red/cyan half colored
  12380. (red filter on left eye, cyan filter on right eye)
  12381. @item arcc
  12382. anaglyph red/cyan color
  12383. (red filter on left eye, cyan filter on right eye)
  12384. @item arcd
  12385. anaglyph red/cyan color optimized with the least squares projection of dubois
  12386. (red filter on left eye, cyan filter on right eye)
  12387. @item agmg
  12388. anaglyph green/magenta gray
  12389. (green filter on left eye, magenta filter on right eye)
  12390. @item agmh
  12391. anaglyph green/magenta half colored
  12392. (green filter on left eye, magenta filter on right eye)
  12393. @item agmc
  12394. anaglyph green/magenta colored
  12395. (green filter on left eye, magenta filter on right eye)
  12396. @item agmd
  12397. anaglyph green/magenta color optimized with the least squares projection of dubois
  12398. (green filter on left eye, magenta filter on right eye)
  12399. @item aybg
  12400. anaglyph yellow/blue gray
  12401. (yellow filter on left eye, blue filter on right eye)
  12402. @item aybh
  12403. anaglyph yellow/blue half colored
  12404. (yellow filter on left eye, blue filter on right eye)
  12405. @item aybc
  12406. anaglyph yellow/blue colored
  12407. (yellow filter on left eye, blue filter on right eye)
  12408. @item aybd
  12409. anaglyph yellow/blue color optimized with the least squares projection of dubois
  12410. (yellow filter on left eye, blue filter on right eye)
  12411. @item ml
  12412. mono output (left eye only)
  12413. @item mr
  12414. mono output (right eye only)
  12415. @item chl
  12416. checkerboard, left eye first
  12417. @item chr
  12418. checkerboard, right eye first
  12419. @item icl
  12420. interleaved columns, left eye first
  12421. @item icr
  12422. interleaved columns, right eye first
  12423. @item hdmi
  12424. HDMI frame pack
  12425. @end table
  12426. Default value is @samp{arcd}.
  12427. @end table
  12428. @subsection Examples
  12429. @itemize
  12430. @item
  12431. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  12432. @example
  12433. stereo3d=sbsl:aybd
  12434. @end example
  12435. @item
  12436. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  12437. @example
  12438. stereo3d=abl:sbsr
  12439. @end example
  12440. @end itemize
  12441. @section streamselect, astreamselect
  12442. Select video or audio streams.
  12443. The filter accepts the following options:
  12444. @table @option
  12445. @item inputs
  12446. Set number of inputs. Default is 2.
  12447. @item map
  12448. Set input indexes to remap to outputs.
  12449. @end table
  12450. @subsection Commands
  12451. The @code{streamselect} and @code{astreamselect} filter supports the following
  12452. commands:
  12453. @table @option
  12454. @item map
  12455. Set input indexes to remap to outputs.
  12456. @end table
  12457. @subsection Examples
  12458. @itemize
  12459. @item
  12460. Select first 5 seconds 1st stream and rest of time 2nd stream:
  12461. @example
  12462. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  12463. @end example
  12464. @item
  12465. Same as above, but for audio:
  12466. @example
  12467. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  12468. @end example
  12469. @end itemize
  12470. @section sobel
  12471. Apply sobel operator to input video stream.
  12472. The filter accepts the following option:
  12473. @table @option
  12474. @item planes
  12475. Set which planes will be processed, unprocessed planes will be copied.
  12476. By default value 0xf, all planes will be processed.
  12477. @item scale
  12478. Set value which will be multiplied with filtered result.
  12479. @item delta
  12480. Set value which will be added to filtered result.
  12481. @end table
  12482. @anchor{spp}
  12483. @section spp
  12484. Apply a simple postprocessing filter that compresses and decompresses the image
  12485. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  12486. and average the results.
  12487. The filter accepts the following options:
  12488. @table @option
  12489. @item quality
  12490. Set quality. This option defines the number of levels for averaging. It accepts
  12491. an integer in the range 0-6. If set to @code{0}, the filter will have no
  12492. effect. A value of @code{6} means the higher quality. For each increment of
  12493. that value the speed drops by a factor of approximately 2. Default value is
  12494. @code{3}.
  12495. @item qp
  12496. Force a constant quantization parameter. If not set, the filter will use the QP
  12497. from the video stream (if available).
  12498. @item mode
  12499. Set thresholding mode. Available modes are:
  12500. @table @samp
  12501. @item hard
  12502. Set hard thresholding (default).
  12503. @item soft
  12504. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12505. @end table
  12506. @item use_bframe_qp
  12507. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  12508. option may cause flicker since the B-Frames have often larger QP. Default is
  12509. @code{0} (not enabled).
  12510. @end table
  12511. @section sr
  12512. Scale the input by applying one of the super-resolution methods based on
  12513. convolutional neural networks. Supported models:
  12514. @itemize
  12515. @item
  12516. Super-Resolution Convolutional Neural Network model (SRCNN).
  12517. See @url{https://arxiv.org/abs/1501.00092}.
  12518. @item
  12519. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  12520. See @url{https://arxiv.org/abs/1609.05158}.
  12521. @end itemize
  12522. Training scripts as well as scripts for model generation are provided in
  12523. the repository at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  12524. The filter accepts the following options:
  12525. @table @option
  12526. @item dnn_backend
  12527. Specify which DNN backend to use for model loading and execution. This option accepts
  12528. the following values:
  12529. @table @samp
  12530. @item native
  12531. Native implementation of DNN loading and execution.
  12532. @item tensorflow
  12533. TensorFlow backend. To enable this backend you
  12534. need to install the TensorFlow for C library (see
  12535. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  12536. @code{--enable-libtensorflow}
  12537. @end table
  12538. Default value is @samp{native}.
  12539. @item model
  12540. Set path to model file specifying network architecture and its parameters.
  12541. Note that different backends use different file formats. TensorFlow backend
  12542. can load files for both formats, while native backend can load files for only
  12543. its format.
  12544. @item scale_factor
  12545. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  12546. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  12547. input upscaled using bicubic upscaling with proper scale factor.
  12548. @end table
  12549. @anchor{subtitles}
  12550. @section subtitles
  12551. Draw subtitles on top of input video using the libass library.
  12552. To enable compilation of this filter you need to configure FFmpeg with
  12553. @code{--enable-libass}. This filter also requires a build with libavcodec and
  12554. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  12555. Alpha) subtitles format.
  12556. The filter accepts the following options:
  12557. @table @option
  12558. @item filename, f
  12559. Set the filename of the subtitle file to read. It must be specified.
  12560. @item original_size
  12561. Specify the size of the original video, the video for which the ASS file
  12562. was composed. For the syntax of this option, check the
  12563. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12564. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  12565. correctly scale the fonts if the aspect ratio has been changed.
  12566. @item fontsdir
  12567. Set a directory path containing fonts that can be used by the filter.
  12568. These fonts will be used in addition to whatever the font provider uses.
  12569. @item alpha
  12570. Process alpha channel, by default alpha channel is untouched.
  12571. @item charenc
  12572. Set subtitles input character encoding. @code{subtitles} filter only. Only
  12573. useful if not UTF-8.
  12574. @item stream_index, si
  12575. Set subtitles stream index. @code{subtitles} filter only.
  12576. @item force_style
  12577. Override default style or script info parameters of the subtitles. It accepts a
  12578. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  12579. @end table
  12580. If the first key is not specified, it is assumed that the first value
  12581. specifies the @option{filename}.
  12582. For example, to render the file @file{sub.srt} on top of the input
  12583. video, use the command:
  12584. @example
  12585. subtitles=sub.srt
  12586. @end example
  12587. which is equivalent to:
  12588. @example
  12589. subtitles=filename=sub.srt
  12590. @end example
  12591. To render the default subtitles stream from file @file{video.mkv}, use:
  12592. @example
  12593. subtitles=video.mkv
  12594. @end example
  12595. To render the second subtitles stream from that file, use:
  12596. @example
  12597. subtitles=video.mkv:si=1
  12598. @end example
  12599. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  12600. @code{DejaVu Serif}, use:
  12601. @example
  12602. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  12603. @end example
  12604. @section super2xsai
  12605. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  12606. Interpolate) pixel art scaling algorithm.
  12607. Useful for enlarging pixel art images without reducing sharpness.
  12608. @section swaprect
  12609. Swap two rectangular objects in video.
  12610. This filter accepts the following options:
  12611. @table @option
  12612. @item w
  12613. Set object width.
  12614. @item h
  12615. Set object height.
  12616. @item x1
  12617. Set 1st rect x coordinate.
  12618. @item y1
  12619. Set 1st rect y coordinate.
  12620. @item x2
  12621. Set 2nd rect x coordinate.
  12622. @item y2
  12623. Set 2nd rect y coordinate.
  12624. All expressions are evaluated once for each frame.
  12625. @end table
  12626. The all options are expressions containing the following constants:
  12627. @table @option
  12628. @item w
  12629. @item h
  12630. The input width and height.
  12631. @item a
  12632. same as @var{w} / @var{h}
  12633. @item sar
  12634. input sample aspect ratio
  12635. @item dar
  12636. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  12637. @item n
  12638. The number of the input frame, starting from 0.
  12639. @item t
  12640. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  12641. @item pos
  12642. the position in the file of the input frame, NAN if unknown
  12643. @end table
  12644. @section swapuv
  12645. Swap U & V plane.
  12646. @section telecine
  12647. Apply telecine process to the video.
  12648. This filter accepts the following options:
  12649. @table @option
  12650. @item first_field
  12651. @table @samp
  12652. @item top, t
  12653. top field first
  12654. @item bottom, b
  12655. bottom field first
  12656. The default value is @code{top}.
  12657. @end table
  12658. @item pattern
  12659. A string of numbers representing the pulldown pattern you wish to apply.
  12660. The default value is @code{23}.
  12661. @end table
  12662. @example
  12663. Some typical patterns:
  12664. NTSC output (30i):
  12665. 27.5p: 32222
  12666. 24p: 23 (classic)
  12667. 24p: 2332 (preferred)
  12668. 20p: 33
  12669. 18p: 334
  12670. 16p: 3444
  12671. PAL output (25i):
  12672. 27.5p: 12222
  12673. 24p: 222222222223 ("Euro pulldown")
  12674. 16.67p: 33
  12675. 16p: 33333334
  12676. @end example
  12677. @section threshold
  12678. Apply threshold effect to video stream.
  12679. This filter needs four video streams to perform thresholding.
  12680. First stream is stream we are filtering.
  12681. Second stream is holding threshold values, third stream is holding min values,
  12682. and last, fourth stream is holding max values.
  12683. The filter accepts the following option:
  12684. @table @option
  12685. @item planes
  12686. Set which planes will be processed, unprocessed planes will be copied.
  12687. By default value 0xf, all planes will be processed.
  12688. @end table
  12689. For example if first stream pixel's component value is less then threshold value
  12690. of pixel component from 2nd threshold stream, third stream value will picked,
  12691. otherwise fourth stream pixel component value will be picked.
  12692. Using color source filter one can perform various types of thresholding:
  12693. @subsection Examples
  12694. @itemize
  12695. @item
  12696. Binary threshold, using gray color as threshold:
  12697. @example
  12698. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  12699. @end example
  12700. @item
  12701. Inverted binary threshold, using gray color as threshold:
  12702. @example
  12703. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  12704. @end example
  12705. @item
  12706. Truncate binary threshold, using gray color as threshold:
  12707. @example
  12708. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  12709. @end example
  12710. @item
  12711. Threshold to zero, using gray color as threshold:
  12712. @example
  12713. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  12714. @end example
  12715. @item
  12716. Inverted threshold to zero, using gray color as threshold:
  12717. @example
  12718. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  12719. @end example
  12720. @end itemize
  12721. @section thumbnail
  12722. Select the most representative frame in a given sequence of consecutive frames.
  12723. The filter accepts the following options:
  12724. @table @option
  12725. @item n
  12726. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  12727. will pick one of them, and then handle the next batch of @var{n} frames until
  12728. the end. Default is @code{100}.
  12729. @end table
  12730. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  12731. value will result in a higher memory usage, so a high value is not recommended.
  12732. @subsection Examples
  12733. @itemize
  12734. @item
  12735. Extract one picture each 50 frames:
  12736. @example
  12737. thumbnail=50
  12738. @end example
  12739. @item
  12740. Complete example of a thumbnail creation with @command{ffmpeg}:
  12741. @example
  12742. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  12743. @end example
  12744. @end itemize
  12745. @section tile
  12746. Tile several successive frames together.
  12747. The filter accepts the following options:
  12748. @table @option
  12749. @item layout
  12750. Set the grid size (i.e. the number of lines and columns). For the syntax of
  12751. this option, check the
  12752. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12753. @item nb_frames
  12754. Set the maximum number of frames to render in the given area. It must be less
  12755. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  12756. the area will be used.
  12757. @item margin
  12758. Set the outer border margin in pixels.
  12759. @item padding
  12760. Set the inner border thickness (i.e. the number of pixels between frames). For
  12761. more advanced padding options (such as having different values for the edges),
  12762. refer to the pad video filter.
  12763. @item color
  12764. Specify the color of the unused area. For the syntax of this option, check the
  12765. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12766. The default value of @var{color} is "black".
  12767. @item overlap
  12768. Set the number of frames to overlap when tiling several successive frames together.
  12769. The value must be between @code{0} and @var{nb_frames - 1}.
  12770. @item init_padding
  12771. Set the number of frames to initially be empty before displaying first output frame.
  12772. This controls how soon will one get first output frame.
  12773. The value must be between @code{0} and @var{nb_frames - 1}.
  12774. @end table
  12775. @subsection Examples
  12776. @itemize
  12777. @item
  12778. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  12779. @example
  12780. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  12781. @end example
  12782. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  12783. duplicating each output frame to accommodate the originally detected frame
  12784. rate.
  12785. @item
  12786. Display @code{5} pictures in an area of @code{3x2} frames,
  12787. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  12788. mixed flat and named options:
  12789. @example
  12790. tile=3x2:nb_frames=5:padding=7:margin=2
  12791. @end example
  12792. @end itemize
  12793. @section tinterlace
  12794. Perform various types of temporal field interlacing.
  12795. Frames are counted starting from 1, so the first input frame is
  12796. considered odd.
  12797. The filter accepts the following options:
  12798. @table @option
  12799. @item mode
  12800. Specify the mode of the interlacing. This option can also be specified
  12801. as a value alone. See below for a list of values for this option.
  12802. Available values are:
  12803. @table @samp
  12804. @item merge, 0
  12805. Move odd frames into the upper field, even into the lower field,
  12806. generating a double height frame at half frame rate.
  12807. @example
  12808. ------> time
  12809. Input:
  12810. Frame 1 Frame 2 Frame 3 Frame 4
  12811. 11111 22222 33333 44444
  12812. 11111 22222 33333 44444
  12813. 11111 22222 33333 44444
  12814. 11111 22222 33333 44444
  12815. Output:
  12816. 11111 33333
  12817. 22222 44444
  12818. 11111 33333
  12819. 22222 44444
  12820. 11111 33333
  12821. 22222 44444
  12822. 11111 33333
  12823. 22222 44444
  12824. @end example
  12825. @item drop_even, 1
  12826. Only output odd frames, even frames are dropped, generating a frame with
  12827. unchanged height at half frame rate.
  12828. @example
  12829. ------> time
  12830. Input:
  12831. Frame 1 Frame 2 Frame 3 Frame 4
  12832. 11111 22222 33333 44444
  12833. 11111 22222 33333 44444
  12834. 11111 22222 33333 44444
  12835. 11111 22222 33333 44444
  12836. Output:
  12837. 11111 33333
  12838. 11111 33333
  12839. 11111 33333
  12840. 11111 33333
  12841. @end example
  12842. @item drop_odd, 2
  12843. Only output even frames, odd frames are dropped, generating a frame with
  12844. unchanged height at half frame rate.
  12845. @example
  12846. ------> time
  12847. Input:
  12848. Frame 1 Frame 2 Frame 3 Frame 4
  12849. 11111 22222 33333 44444
  12850. 11111 22222 33333 44444
  12851. 11111 22222 33333 44444
  12852. 11111 22222 33333 44444
  12853. Output:
  12854. 22222 44444
  12855. 22222 44444
  12856. 22222 44444
  12857. 22222 44444
  12858. @end example
  12859. @item pad, 3
  12860. Expand each frame to full height, but pad alternate lines with black,
  12861. generating a frame with double height at the same input frame rate.
  12862. @example
  12863. ------> time
  12864. Input:
  12865. Frame 1 Frame 2 Frame 3 Frame 4
  12866. 11111 22222 33333 44444
  12867. 11111 22222 33333 44444
  12868. 11111 22222 33333 44444
  12869. 11111 22222 33333 44444
  12870. Output:
  12871. 11111 ..... 33333 .....
  12872. ..... 22222 ..... 44444
  12873. 11111 ..... 33333 .....
  12874. ..... 22222 ..... 44444
  12875. 11111 ..... 33333 .....
  12876. ..... 22222 ..... 44444
  12877. 11111 ..... 33333 .....
  12878. ..... 22222 ..... 44444
  12879. @end example
  12880. @item interleave_top, 4
  12881. Interleave the upper field from odd frames with the lower field from
  12882. even frames, generating a frame with unchanged height at half frame rate.
  12883. @example
  12884. ------> time
  12885. Input:
  12886. Frame 1 Frame 2 Frame 3 Frame 4
  12887. 11111<- 22222 33333<- 44444
  12888. 11111 22222<- 33333 44444<-
  12889. 11111<- 22222 33333<- 44444
  12890. 11111 22222<- 33333 44444<-
  12891. Output:
  12892. 11111 33333
  12893. 22222 44444
  12894. 11111 33333
  12895. 22222 44444
  12896. @end example
  12897. @item interleave_bottom, 5
  12898. Interleave the lower field from odd frames with the upper field from
  12899. even frames, generating a frame with unchanged height at half frame rate.
  12900. @example
  12901. ------> time
  12902. Input:
  12903. Frame 1 Frame 2 Frame 3 Frame 4
  12904. 11111 22222<- 33333 44444<-
  12905. 11111<- 22222 33333<- 44444
  12906. 11111 22222<- 33333 44444<-
  12907. 11111<- 22222 33333<- 44444
  12908. Output:
  12909. 22222 44444
  12910. 11111 33333
  12911. 22222 44444
  12912. 11111 33333
  12913. @end example
  12914. @item interlacex2, 6
  12915. Double frame rate with unchanged height. Frames are inserted each
  12916. containing the second temporal field from the previous input frame and
  12917. the first temporal field from the next input frame. This mode relies on
  12918. the top_field_first flag. Useful for interlaced video displays with no
  12919. field synchronisation.
  12920. @example
  12921. ------> time
  12922. Input:
  12923. Frame 1 Frame 2 Frame 3 Frame 4
  12924. 11111 22222 33333 44444
  12925. 11111 22222 33333 44444
  12926. 11111 22222 33333 44444
  12927. 11111 22222 33333 44444
  12928. Output:
  12929. 11111 22222 22222 33333 33333 44444 44444
  12930. 11111 11111 22222 22222 33333 33333 44444
  12931. 11111 22222 22222 33333 33333 44444 44444
  12932. 11111 11111 22222 22222 33333 33333 44444
  12933. @end example
  12934. @item mergex2, 7
  12935. Move odd frames into the upper field, even into the lower field,
  12936. generating a double height frame at same frame rate.
  12937. @example
  12938. ------> time
  12939. Input:
  12940. Frame 1 Frame 2 Frame 3 Frame 4
  12941. 11111 22222 33333 44444
  12942. 11111 22222 33333 44444
  12943. 11111 22222 33333 44444
  12944. 11111 22222 33333 44444
  12945. Output:
  12946. 11111 33333 33333 55555
  12947. 22222 22222 44444 44444
  12948. 11111 33333 33333 55555
  12949. 22222 22222 44444 44444
  12950. 11111 33333 33333 55555
  12951. 22222 22222 44444 44444
  12952. 11111 33333 33333 55555
  12953. 22222 22222 44444 44444
  12954. @end example
  12955. @end table
  12956. Numeric values are deprecated but are accepted for backward
  12957. compatibility reasons.
  12958. Default mode is @code{merge}.
  12959. @item flags
  12960. Specify flags influencing the filter process.
  12961. Available value for @var{flags} is:
  12962. @table @option
  12963. @item low_pass_filter, vlfp
  12964. Enable linear vertical low-pass filtering in the filter.
  12965. Vertical low-pass filtering is required when creating an interlaced
  12966. destination from a progressive source which contains high-frequency
  12967. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  12968. patterning.
  12969. @item complex_filter, cvlfp
  12970. Enable complex vertical low-pass filtering.
  12971. This will slightly less reduce interlace 'twitter' and Moire
  12972. patterning but better retain detail and subjective sharpness impression.
  12973. @end table
  12974. Vertical low-pass filtering can only be enabled for @option{mode}
  12975. @var{interleave_top} and @var{interleave_bottom}.
  12976. @end table
  12977. @section tmix
  12978. Mix successive video frames.
  12979. A description of the accepted options follows.
  12980. @table @option
  12981. @item frames
  12982. The number of successive frames to mix. If unspecified, it defaults to 3.
  12983. @item weights
  12984. Specify weight of each input video frame.
  12985. Each weight is separated by space. If number of weights is smaller than
  12986. number of @var{frames} last specified weight will be used for all remaining
  12987. unset weights.
  12988. @item scale
  12989. Specify scale, if it is set it will be multiplied with sum
  12990. of each weight multiplied with pixel values to give final destination
  12991. pixel value. By default @var{scale} is auto scaled to sum of weights.
  12992. @end table
  12993. @subsection Examples
  12994. @itemize
  12995. @item
  12996. Average 7 successive frames:
  12997. @example
  12998. tmix=frames=7:weights="1 1 1 1 1 1 1"
  12999. @end example
  13000. @item
  13001. Apply simple temporal convolution:
  13002. @example
  13003. tmix=frames=3:weights="-1 3 -1"
  13004. @end example
  13005. @item
  13006. Similar as above but only showing temporal differences:
  13007. @example
  13008. tmix=frames=3:weights="-1 2 -1":scale=1
  13009. @end example
  13010. @end itemize
  13011. @anchor{tonemap}
  13012. @section tonemap
  13013. Tone map colors from different dynamic ranges.
  13014. This filter expects data in single precision floating point, as it needs to
  13015. operate on (and can output) out-of-range values. Another filter, such as
  13016. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  13017. The tonemapping algorithms implemented only work on linear light, so input
  13018. data should be linearized beforehand (and possibly correctly tagged).
  13019. @example
  13020. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  13021. @end example
  13022. @subsection Options
  13023. The filter accepts the following options.
  13024. @table @option
  13025. @item tonemap
  13026. Set the tone map algorithm to use.
  13027. Possible values are:
  13028. @table @var
  13029. @item none
  13030. Do not apply any tone map, only desaturate overbright pixels.
  13031. @item clip
  13032. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  13033. in-range values, while distorting out-of-range values.
  13034. @item linear
  13035. Stretch the entire reference gamut to a linear multiple of the display.
  13036. @item gamma
  13037. Fit a logarithmic transfer between the tone curves.
  13038. @item reinhard
  13039. Preserve overall image brightness with a simple curve, using nonlinear
  13040. contrast, which results in flattening details and degrading color accuracy.
  13041. @item hable
  13042. Preserve both dark and bright details better than @var{reinhard}, at the cost
  13043. of slightly darkening everything. Use it when detail preservation is more
  13044. important than color and brightness accuracy.
  13045. @item mobius
  13046. Smoothly map out-of-range values, while retaining contrast and colors for
  13047. in-range material as much as possible. Use it when color accuracy is more
  13048. important than detail preservation.
  13049. @end table
  13050. Default is none.
  13051. @item param
  13052. Tune the tone mapping algorithm.
  13053. This affects the following algorithms:
  13054. @table @var
  13055. @item none
  13056. Ignored.
  13057. @item linear
  13058. Specifies the scale factor to use while stretching.
  13059. Default to 1.0.
  13060. @item gamma
  13061. Specifies the exponent of the function.
  13062. Default to 1.8.
  13063. @item clip
  13064. Specify an extra linear coefficient to multiply into the signal before clipping.
  13065. Default to 1.0.
  13066. @item reinhard
  13067. Specify the local contrast coefficient at the display peak.
  13068. Default to 0.5, which means that in-gamut values will be about half as bright
  13069. as when clipping.
  13070. @item hable
  13071. Ignored.
  13072. @item mobius
  13073. Specify the transition point from linear to mobius transform. Every value
  13074. below this point is guaranteed to be mapped 1:1. The higher the value, the
  13075. more accurate the result will be, at the cost of losing bright details.
  13076. Default to 0.3, which due to the steep initial slope still preserves in-range
  13077. colors fairly accurately.
  13078. @end table
  13079. @item desat
  13080. Apply desaturation for highlights that exceed this level of brightness. The
  13081. higher the parameter, the more color information will be preserved. This
  13082. setting helps prevent unnaturally blown-out colors for super-highlights, by
  13083. (smoothly) turning into white instead. This makes images feel more natural,
  13084. at the cost of reducing information about out-of-range colors.
  13085. The default of 2.0 is somewhat conservative and will mostly just apply to
  13086. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  13087. This option works only if the input frame has a supported color tag.
  13088. @item peak
  13089. Override signal/nominal/reference peak with this value. Useful when the
  13090. embedded peak information in display metadata is not reliable or when tone
  13091. mapping from a lower range to a higher range.
  13092. @end table
  13093. @section tpad
  13094. Temporarily pad video frames.
  13095. The filter accepts the following options:
  13096. @table @option
  13097. @item start
  13098. Specify number of delay frames before input video stream.
  13099. @item stop
  13100. Specify number of padding frames after input video stream.
  13101. Set to -1 to pad indefinitely.
  13102. @item start_mode
  13103. Set kind of frames added to beginning of stream.
  13104. Can be either @var{add} or @var{clone}.
  13105. With @var{add} frames of solid-color are added.
  13106. With @var{clone} frames are clones of first frame.
  13107. @item stop_mode
  13108. Set kind of frames added to end of stream.
  13109. Can be either @var{add} or @var{clone}.
  13110. With @var{add} frames of solid-color are added.
  13111. With @var{clone} frames are clones of last frame.
  13112. @item start_duration, stop_duration
  13113. Specify the duration of the start/stop delay. See
  13114. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13115. for the accepted syntax.
  13116. These options override @var{start} and @var{stop}.
  13117. @item color
  13118. Specify the color of the padded area. For the syntax of this option,
  13119. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  13120. manual,ffmpeg-utils}.
  13121. The default value of @var{color} is "black".
  13122. @end table
  13123. @anchor{transpose}
  13124. @section transpose
  13125. Transpose rows with columns in the input video and optionally flip it.
  13126. It accepts the following parameters:
  13127. @table @option
  13128. @item dir
  13129. Specify the transposition direction.
  13130. Can assume the following values:
  13131. @table @samp
  13132. @item 0, 4, cclock_flip
  13133. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  13134. @example
  13135. L.R L.l
  13136. . . -> . .
  13137. l.r R.r
  13138. @end example
  13139. @item 1, 5, clock
  13140. Rotate by 90 degrees clockwise, that is:
  13141. @example
  13142. L.R l.L
  13143. . . -> . .
  13144. l.r r.R
  13145. @end example
  13146. @item 2, 6, cclock
  13147. Rotate by 90 degrees counterclockwise, that is:
  13148. @example
  13149. L.R R.r
  13150. . . -> . .
  13151. l.r L.l
  13152. @end example
  13153. @item 3, 7, clock_flip
  13154. Rotate by 90 degrees clockwise and vertically flip, that is:
  13155. @example
  13156. L.R r.R
  13157. . . -> . .
  13158. l.r l.L
  13159. @end example
  13160. @end table
  13161. For values between 4-7, the transposition is only done if the input
  13162. video geometry is portrait and not landscape. These values are
  13163. deprecated, the @code{passthrough} option should be used instead.
  13164. Numerical values are deprecated, and should be dropped in favor of
  13165. symbolic constants.
  13166. @item passthrough
  13167. Do not apply the transposition if the input geometry matches the one
  13168. specified by the specified value. It accepts the following values:
  13169. @table @samp
  13170. @item none
  13171. Always apply transposition.
  13172. @item portrait
  13173. Preserve portrait geometry (when @var{height} >= @var{width}).
  13174. @item landscape
  13175. Preserve landscape geometry (when @var{width} >= @var{height}).
  13176. @end table
  13177. Default value is @code{none}.
  13178. @end table
  13179. For example to rotate by 90 degrees clockwise and preserve portrait
  13180. layout:
  13181. @example
  13182. transpose=dir=1:passthrough=portrait
  13183. @end example
  13184. The command above can also be specified as:
  13185. @example
  13186. transpose=1:portrait
  13187. @end example
  13188. @section transpose_npp
  13189. Transpose rows with columns in the input video and optionally flip it.
  13190. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  13191. It accepts the following parameters:
  13192. @table @option
  13193. @item dir
  13194. Specify the transposition direction.
  13195. Can assume the following values:
  13196. @table @samp
  13197. @item cclock_flip
  13198. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  13199. @item clock
  13200. Rotate by 90 degrees clockwise.
  13201. @item cclock
  13202. Rotate by 90 degrees counterclockwise.
  13203. @item clock_flip
  13204. Rotate by 90 degrees clockwise and vertically flip.
  13205. @end table
  13206. @item passthrough
  13207. Do not apply the transposition if the input geometry matches the one
  13208. specified by the specified value. It accepts the following values:
  13209. @table @samp
  13210. @item none
  13211. Always apply transposition. (default)
  13212. @item portrait
  13213. Preserve portrait geometry (when @var{height} >= @var{width}).
  13214. @item landscape
  13215. Preserve landscape geometry (when @var{width} >= @var{height}).
  13216. @end table
  13217. @end table
  13218. @section trim
  13219. Trim the input so that the output contains one continuous subpart of the input.
  13220. It accepts the following parameters:
  13221. @table @option
  13222. @item start
  13223. Specify the time of the start of the kept section, i.e. the frame with the
  13224. timestamp @var{start} will be the first frame in the output.
  13225. @item end
  13226. Specify the time of the first frame that will be dropped, i.e. the frame
  13227. immediately preceding the one with the timestamp @var{end} will be the last
  13228. frame in the output.
  13229. @item start_pts
  13230. This is the same as @var{start}, except this option sets the start timestamp
  13231. in timebase units instead of seconds.
  13232. @item end_pts
  13233. This is the same as @var{end}, except this option sets the end timestamp
  13234. in timebase units instead of seconds.
  13235. @item duration
  13236. The maximum duration of the output in seconds.
  13237. @item start_frame
  13238. The number of the first frame that should be passed to the output.
  13239. @item end_frame
  13240. The number of the first frame that should be dropped.
  13241. @end table
  13242. @option{start}, @option{end}, and @option{duration} are expressed as time
  13243. duration specifications; see
  13244. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13245. for the accepted syntax.
  13246. Note that the first two sets of the start/end options and the @option{duration}
  13247. option look at the frame timestamp, while the _frame variants simply count the
  13248. frames that pass through the filter. Also note that this filter does not modify
  13249. the timestamps. If you wish for the output timestamps to start at zero, insert a
  13250. setpts filter after the trim filter.
  13251. If multiple start or end options are set, this filter tries to be greedy and
  13252. keep all the frames that match at least one of the specified constraints. To keep
  13253. only the part that matches all the constraints at once, chain multiple trim
  13254. filters.
  13255. The defaults are such that all the input is kept. So it is possible to set e.g.
  13256. just the end values to keep everything before the specified time.
  13257. Examples:
  13258. @itemize
  13259. @item
  13260. Drop everything except the second minute of input:
  13261. @example
  13262. ffmpeg -i INPUT -vf trim=60:120
  13263. @end example
  13264. @item
  13265. Keep only the first second:
  13266. @example
  13267. ffmpeg -i INPUT -vf trim=duration=1
  13268. @end example
  13269. @end itemize
  13270. @section unpremultiply
  13271. Apply alpha unpremultiply effect to input video stream using first plane
  13272. of second stream as alpha.
  13273. Both streams must have same dimensions and same pixel format.
  13274. The filter accepts the following option:
  13275. @table @option
  13276. @item planes
  13277. Set which planes will be processed, unprocessed planes will be copied.
  13278. By default value 0xf, all planes will be processed.
  13279. If the format has 1 or 2 components, then luma is bit 0.
  13280. If the format has 3 or 4 components:
  13281. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  13282. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  13283. If present, the alpha channel is always the last bit.
  13284. @item inplace
  13285. Do not require 2nd input for processing, instead use alpha plane from input stream.
  13286. @end table
  13287. @anchor{unsharp}
  13288. @section unsharp
  13289. Sharpen or blur the input video.
  13290. It accepts the following parameters:
  13291. @table @option
  13292. @item luma_msize_x, lx
  13293. Set the luma matrix horizontal size. It must be an odd integer between
  13294. 3 and 23. The default value is 5.
  13295. @item luma_msize_y, ly
  13296. Set the luma matrix vertical size. It must be an odd integer between 3
  13297. and 23. The default value is 5.
  13298. @item luma_amount, la
  13299. Set the luma effect strength. It must be a floating point number, reasonable
  13300. values lay between -1.5 and 1.5.
  13301. Negative values will blur the input video, while positive values will
  13302. sharpen it, a value of zero will disable the effect.
  13303. Default value is 1.0.
  13304. @item chroma_msize_x, cx
  13305. Set the chroma matrix horizontal size. It must be an odd integer
  13306. between 3 and 23. The default value is 5.
  13307. @item chroma_msize_y, cy
  13308. Set the chroma matrix vertical size. It must be an odd integer
  13309. between 3 and 23. The default value is 5.
  13310. @item chroma_amount, ca
  13311. Set the chroma effect strength. It must be a floating point number, reasonable
  13312. values lay between -1.5 and 1.5.
  13313. Negative values will blur the input video, while positive values will
  13314. sharpen it, a value of zero will disable the effect.
  13315. Default value is 0.0.
  13316. @end table
  13317. All parameters are optional and default to the equivalent of the
  13318. string '5:5:1.0:5:5:0.0'.
  13319. @subsection Examples
  13320. @itemize
  13321. @item
  13322. Apply strong luma sharpen effect:
  13323. @example
  13324. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  13325. @end example
  13326. @item
  13327. Apply a strong blur of both luma and chroma parameters:
  13328. @example
  13329. unsharp=7:7:-2:7:7:-2
  13330. @end example
  13331. @end itemize
  13332. @section uspp
  13333. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  13334. the image at several (or - in the case of @option{quality} level @code{8} - all)
  13335. shifts and average the results.
  13336. The way this differs from the behavior of spp is that uspp actually encodes &
  13337. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  13338. DCT similar to MJPEG.
  13339. The filter accepts the following options:
  13340. @table @option
  13341. @item quality
  13342. Set quality. This option defines the number of levels for averaging. It accepts
  13343. an integer in the range 0-8. If set to @code{0}, the filter will have no
  13344. effect. A value of @code{8} means the higher quality. For each increment of
  13345. that value the speed drops by a factor of approximately 2. Default value is
  13346. @code{3}.
  13347. @item qp
  13348. Force a constant quantization parameter. If not set, the filter will use the QP
  13349. from the video stream (if available).
  13350. @end table
  13351. @section vaguedenoiser
  13352. Apply a wavelet based denoiser.
  13353. It transforms each frame from the video input into the wavelet domain,
  13354. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  13355. the obtained coefficients. It does an inverse wavelet transform after.
  13356. Due to wavelet properties, it should give a nice smoothed result, and
  13357. reduced noise, without blurring picture features.
  13358. This filter accepts the following options:
  13359. @table @option
  13360. @item threshold
  13361. The filtering strength. The higher, the more filtered the video will be.
  13362. Hard thresholding can use a higher threshold than soft thresholding
  13363. before the video looks overfiltered. Default value is 2.
  13364. @item method
  13365. The filtering method the filter will use.
  13366. It accepts the following values:
  13367. @table @samp
  13368. @item hard
  13369. All values under the threshold will be zeroed.
  13370. @item soft
  13371. All values under the threshold will be zeroed. All values above will be
  13372. reduced by the threshold.
  13373. @item garrote
  13374. Scales or nullifies coefficients - intermediary between (more) soft and
  13375. (less) hard thresholding.
  13376. @end table
  13377. Default is garrote.
  13378. @item nsteps
  13379. Number of times, the wavelet will decompose the picture. Picture can't
  13380. be decomposed beyond a particular point (typically, 8 for a 640x480
  13381. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  13382. @item percent
  13383. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  13384. @item planes
  13385. A list of the planes to process. By default all planes are processed.
  13386. @end table
  13387. @section vectorscope
  13388. Display 2 color component values in the two dimensional graph (which is called
  13389. a vectorscope).
  13390. This filter accepts the following options:
  13391. @table @option
  13392. @item mode, m
  13393. Set vectorscope mode.
  13394. It accepts the following values:
  13395. @table @samp
  13396. @item gray
  13397. Gray values are displayed on graph, higher brightness means more pixels have
  13398. same component color value on location in graph. This is the default mode.
  13399. @item color
  13400. Gray values are displayed on graph. Surrounding pixels values which are not
  13401. present in video frame are drawn in gradient of 2 color components which are
  13402. set by option @code{x} and @code{y}. The 3rd color component is static.
  13403. @item color2
  13404. Actual color components values present in video frame are displayed on graph.
  13405. @item color3
  13406. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  13407. on graph increases value of another color component, which is luminance by
  13408. default values of @code{x} and @code{y}.
  13409. @item color4
  13410. Actual colors present in video frame are displayed on graph. If two different
  13411. colors map to same position on graph then color with higher value of component
  13412. not present in graph is picked.
  13413. @item color5
  13414. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  13415. component picked from radial gradient.
  13416. @end table
  13417. @item x
  13418. Set which color component will be represented on X-axis. Default is @code{1}.
  13419. @item y
  13420. Set which color component will be represented on Y-axis. Default is @code{2}.
  13421. @item intensity, i
  13422. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  13423. of color component which represents frequency of (X, Y) location in graph.
  13424. @item envelope, e
  13425. @table @samp
  13426. @item none
  13427. No envelope, this is default.
  13428. @item instant
  13429. Instant envelope, even darkest single pixel will be clearly highlighted.
  13430. @item peak
  13431. Hold maximum and minimum values presented in graph over time. This way you
  13432. can still spot out of range values without constantly looking at vectorscope.
  13433. @item peak+instant
  13434. Peak and instant envelope combined together.
  13435. @end table
  13436. @item graticule, g
  13437. Set what kind of graticule to draw.
  13438. @table @samp
  13439. @item none
  13440. @item green
  13441. @item color
  13442. @end table
  13443. @item opacity, o
  13444. Set graticule opacity.
  13445. @item flags, f
  13446. Set graticule flags.
  13447. @table @samp
  13448. @item white
  13449. Draw graticule for white point.
  13450. @item black
  13451. Draw graticule for black point.
  13452. @item name
  13453. Draw color points short names.
  13454. @end table
  13455. @item bgopacity, b
  13456. Set background opacity.
  13457. @item lthreshold, l
  13458. Set low threshold for color component not represented on X or Y axis.
  13459. Values lower than this value will be ignored. Default is 0.
  13460. Note this value is multiplied with actual max possible value one pixel component
  13461. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  13462. is 0.1 * 255 = 25.
  13463. @item hthreshold, h
  13464. Set high threshold for color component not represented on X or Y axis.
  13465. Values higher than this value will be ignored. Default is 1.
  13466. Note this value is multiplied with actual max possible value one pixel component
  13467. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  13468. is 0.9 * 255 = 230.
  13469. @item colorspace, c
  13470. Set what kind of colorspace to use when drawing graticule.
  13471. @table @samp
  13472. @item auto
  13473. @item 601
  13474. @item 709
  13475. @end table
  13476. Default is auto.
  13477. @end table
  13478. @anchor{vidstabdetect}
  13479. @section vidstabdetect
  13480. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  13481. @ref{vidstabtransform} for pass 2.
  13482. This filter generates a file with relative translation and rotation
  13483. transform information about subsequent frames, which is then used by
  13484. the @ref{vidstabtransform} filter.
  13485. To enable compilation of this filter you need to configure FFmpeg with
  13486. @code{--enable-libvidstab}.
  13487. This filter accepts the following options:
  13488. @table @option
  13489. @item result
  13490. Set the path to the file used to write the transforms information.
  13491. Default value is @file{transforms.trf}.
  13492. @item shakiness
  13493. Set how shaky the video is and how quick the camera is. It accepts an
  13494. integer in the range 1-10, a value of 1 means little shakiness, a
  13495. value of 10 means strong shakiness. Default value is 5.
  13496. @item accuracy
  13497. Set the accuracy of the detection process. It must be a value in the
  13498. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  13499. accuracy. Default value is 15.
  13500. @item stepsize
  13501. Set stepsize of the search process. The region around minimum is
  13502. scanned with 1 pixel resolution. Default value is 6.
  13503. @item mincontrast
  13504. Set minimum contrast. Below this value a local measurement field is
  13505. discarded. Must be a floating point value in the range 0-1. Default
  13506. value is 0.3.
  13507. @item tripod
  13508. Set reference frame number for tripod mode.
  13509. If enabled, the motion of the frames is compared to a reference frame
  13510. in the filtered stream, identified by the specified number. The idea
  13511. is to compensate all movements in a more-or-less static scene and keep
  13512. the camera view absolutely still.
  13513. If set to 0, it is disabled. The frames are counted starting from 1.
  13514. @item show
  13515. Show fields and transforms in the resulting frames. It accepts an
  13516. integer in the range 0-2. Default value is 0, which disables any
  13517. visualization.
  13518. @end table
  13519. @subsection Examples
  13520. @itemize
  13521. @item
  13522. Use default values:
  13523. @example
  13524. vidstabdetect
  13525. @end example
  13526. @item
  13527. Analyze strongly shaky movie and put the results in file
  13528. @file{mytransforms.trf}:
  13529. @example
  13530. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  13531. @end example
  13532. @item
  13533. Visualize the result of internal transformations in the resulting
  13534. video:
  13535. @example
  13536. vidstabdetect=show=1
  13537. @end example
  13538. @item
  13539. Analyze a video with medium shakiness using @command{ffmpeg}:
  13540. @example
  13541. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  13542. @end example
  13543. @end itemize
  13544. @anchor{vidstabtransform}
  13545. @section vidstabtransform
  13546. Video stabilization/deshaking: pass 2 of 2,
  13547. see @ref{vidstabdetect} for pass 1.
  13548. Read a file with transform information for each frame and
  13549. apply/compensate them. Together with the @ref{vidstabdetect}
  13550. filter this can be used to deshake videos. See also
  13551. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  13552. the @ref{unsharp} filter, see below.
  13553. To enable compilation of this filter you need to configure FFmpeg with
  13554. @code{--enable-libvidstab}.
  13555. @subsection Options
  13556. @table @option
  13557. @item input
  13558. Set path to the file used to read the transforms. Default value is
  13559. @file{transforms.trf}.
  13560. @item smoothing
  13561. Set the number of frames (value*2 + 1) used for lowpass filtering the
  13562. camera movements. Default value is 10.
  13563. For example a number of 10 means that 21 frames are used (10 in the
  13564. past and 10 in the future) to smoothen the motion in the video. A
  13565. larger value leads to a smoother video, but limits the acceleration of
  13566. the camera (pan/tilt movements). 0 is a special case where a static
  13567. camera is simulated.
  13568. @item optalgo
  13569. Set the camera path optimization algorithm.
  13570. Accepted values are:
  13571. @table @samp
  13572. @item gauss
  13573. gaussian kernel low-pass filter on camera motion (default)
  13574. @item avg
  13575. averaging on transformations
  13576. @end table
  13577. @item maxshift
  13578. Set maximal number of pixels to translate frames. Default value is -1,
  13579. meaning no limit.
  13580. @item maxangle
  13581. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  13582. value is -1, meaning no limit.
  13583. @item crop
  13584. Specify how to deal with borders that may be visible due to movement
  13585. compensation.
  13586. Available values are:
  13587. @table @samp
  13588. @item keep
  13589. keep image information from previous frame (default)
  13590. @item black
  13591. fill the border black
  13592. @end table
  13593. @item invert
  13594. Invert transforms if set to 1. Default value is 0.
  13595. @item relative
  13596. Consider transforms as relative to previous frame if set to 1,
  13597. absolute if set to 0. Default value is 0.
  13598. @item zoom
  13599. Set percentage to zoom. A positive value will result in a zoom-in
  13600. effect, a negative value in a zoom-out effect. Default value is 0 (no
  13601. zoom).
  13602. @item optzoom
  13603. Set optimal zooming to avoid borders.
  13604. Accepted values are:
  13605. @table @samp
  13606. @item 0
  13607. disabled
  13608. @item 1
  13609. optimal static zoom value is determined (only very strong movements
  13610. will lead to visible borders) (default)
  13611. @item 2
  13612. optimal adaptive zoom value is determined (no borders will be
  13613. visible), see @option{zoomspeed}
  13614. @end table
  13615. Note that the value given at zoom is added to the one calculated here.
  13616. @item zoomspeed
  13617. Set percent to zoom maximally each frame (enabled when
  13618. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  13619. 0.25.
  13620. @item interpol
  13621. Specify type of interpolation.
  13622. Available values are:
  13623. @table @samp
  13624. @item no
  13625. no interpolation
  13626. @item linear
  13627. linear only horizontal
  13628. @item bilinear
  13629. linear in both directions (default)
  13630. @item bicubic
  13631. cubic in both directions (slow)
  13632. @end table
  13633. @item tripod
  13634. Enable virtual tripod mode if set to 1, which is equivalent to
  13635. @code{relative=0:smoothing=0}. Default value is 0.
  13636. Use also @code{tripod} option of @ref{vidstabdetect}.
  13637. @item debug
  13638. Increase log verbosity if set to 1. Also the detected global motions
  13639. are written to the temporary file @file{global_motions.trf}. Default
  13640. value is 0.
  13641. @end table
  13642. @subsection Examples
  13643. @itemize
  13644. @item
  13645. Use @command{ffmpeg} for a typical stabilization with default values:
  13646. @example
  13647. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  13648. @end example
  13649. Note the use of the @ref{unsharp} filter which is always recommended.
  13650. @item
  13651. Zoom in a bit more and load transform data from a given file:
  13652. @example
  13653. vidstabtransform=zoom=5:input="mytransforms.trf"
  13654. @end example
  13655. @item
  13656. Smoothen the video even more:
  13657. @example
  13658. vidstabtransform=smoothing=30
  13659. @end example
  13660. @end itemize
  13661. @section vflip
  13662. Flip the input video vertically.
  13663. For example, to vertically flip a video with @command{ffmpeg}:
  13664. @example
  13665. ffmpeg -i in.avi -vf "vflip" out.avi
  13666. @end example
  13667. @section vfrdet
  13668. Detect variable frame rate video.
  13669. This filter tries to detect if the input is variable or constant frame rate.
  13670. At end it will output number of frames detected as having variable delta pts,
  13671. and ones with constant delta pts.
  13672. If there was frames with variable delta, than it will also show min and max delta
  13673. encountered.
  13674. @section vibrance
  13675. Boost or alter saturation.
  13676. The filter accepts the following options:
  13677. @table @option
  13678. @item intensity
  13679. Set strength of boost if positive value or strength of alter if negative value.
  13680. Default is 0. Allowed range is from -2 to 2.
  13681. @item rbal
  13682. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  13683. @item gbal
  13684. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  13685. @item bbal
  13686. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  13687. @item rlum
  13688. Set the red luma coefficient.
  13689. @item glum
  13690. Set the green luma coefficient.
  13691. @item blum
  13692. Set the blue luma coefficient.
  13693. @end table
  13694. @anchor{vignette}
  13695. @section vignette
  13696. Make or reverse a natural vignetting effect.
  13697. The filter accepts the following options:
  13698. @table @option
  13699. @item angle, a
  13700. Set lens angle expression as a number of radians.
  13701. The value is clipped in the @code{[0,PI/2]} range.
  13702. Default value: @code{"PI/5"}
  13703. @item x0
  13704. @item y0
  13705. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  13706. by default.
  13707. @item mode
  13708. Set forward/backward mode.
  13709. Available modes are:
  13710. @table @samp
  13711. @item forward
  13712. The larger the distance from the central point, the darker the image becomes.
  13713. @item backward
  13714. The larger the distance from the central point, the brighter the image becomes.
  13715. This can be used to reverse a vignette effect, though there is no automatic
  13716. detection to extract the lens @option{angle} and other settings (yet). It can
  13717. also be used to create a burning effect.
  13718. @end table
  13719. Default value is @samp{forward}.
  13720. @item eval
  13721. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  13722. It accepts the following values:
  13723. @table @samp
  13724. @item init
  13725. Evaluate expressions only once during the filter initialization.
  13726. @item frame
  13727. Evaluate expressions for each incoming frame. This is way slower than the
  13728. @samp{init} mode since it requires all the scalers to be re-computed, but it
  13729. allows advanced dynamic expressions.
  13730. @end table
  13731. Default value is @samp{init}.
  13732. @item dither
  13733. Set dithering to reduce the circular banding effects. Default is @code{1}
  13734. (enabled).
  13735. @item aspect
  13736. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  13737. Setting this value to the SAR of the input will make a rectangular vignetting
  13738. following the dimensions of the video.
  13739. Default is @code{1/1}.
  13740. @end table
  13741. @subsection Expressions
  13742. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  13743. following parameters.
  13744. @table @option
  13745. @item w
  13746. @item h
  13747. input width and height
  13748. @item n
  13749. the number of input frame, starting from 0
  13750. @item pts
  13751. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  13752. @var{TB} units, NAN if undefined
  13753. @item r
  13754. frame rate of the input video, NAN if the input frame rate is unknown
  13755. @item t
  13756. the PTS (Presentation TimeStamp) of the filtered video frame,
  13757. expressed in seconds, NAN if undefined
  13758. @item tb
  13759. time base of the input video
  13760. @end table
  13761. @subsection Examples
  13762. @itemize
  13763. @item
  13764. Apply simple strong vignetting effect:
  13765. @example
  13766. vignette=PI/4
  13767. @end example
  13768. @item
  13769. Make a flickering vignetting:
  13770. @example
  13771. vignette='PI/4+random(1)*PI/50':eval=frame
  13772. @end example
  13773. @end itemize
  13774. @section vmafmotion
  13775. Obtain the average vmaf motion score of a video.
  13776. It is one of the component filters of VMAF.
  13777. The obtained average motion score is printed through the logging system.
  13778. In the below example the input file @file{ref.mpg} is being processed and score
  13779. is computed.
  13780. @example
  13781. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  13782. @end example
  13783. @section vstack
  13784. Stack input videos vertically.
  13785. All streams must be of same pixel format and of same width.
  13786. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  13787. to create same output.
  13788. The filter accept the following option:
  13789. @table @option
  13790. @item inputs
  13791. Set number of input streams. Default is 2.
  13792. @item shortest
  13793. If set to 1, force the output to terminate when the shortest input
  13794. terminates. Default value is 0.
  13795. @end table
  13796. @section w3fdif
  13797. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  13798. Deinterlacing Filter").
  13799. Based on the process described by Martin Weston for BBC R&D, and
  13800. implemented based on the de-interlace algorithm written by Jim
  13801. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  13802. uses filter coefficients calculated by BBC R&D.
  13803. There are two sets of filter coefficients, so called "simple":
  13804. and "complex". Which set of filter coefficients is used can
  13805. be set by passing an optional parameter:
  13806. @table @option
  13807. @item filter
  13808. Set the interlacing filter coefficients. Accepts one of the following values:
  13809. @table @samp
  13810. @item simple
  13811. Simple filter coefficient set.
  13812. @item complex
  13813. More-complex filter coefficient set.
  13814. @end table
  13815. Default value is @samp{complex}.
  13816. @item deint
  13817. Specify which frames to deinterlace. Accept one of the following values:
  13818. @table @samp
  13819. @item all
  13820. Deinterlace all frames,
  13821. @item interlaced
  13822. Only deinterlace frames marked as interlaced.
  13823. @end table
  13824. Default value is @samp{all}.
  13825. @end table
  13826. @section waveform
  13827. Video waveform monitor.
  13828. The waveform monitor plots color component intensity. By default luminance
  13829. only. Each column of the waveform corresponds to a column of pixels in the
  13830. source video.
  13831. It accepts the following options:
  13832. @table @option
  13833. @item mode, m
  13834. Can be either @code{row}, or @code{column}. Default is @code{column}.
  13835. In row mode, the graph on the left side represents color component value 0 and
  13836. the right side represents value = 255. In column mode, the top side represents
  13837. color component value = 0 and bottom side represents value = 255.
  13838. @item intensity, i
  13839. Set intensity. Smaller values are useful to find out how many values of the same
  13840. luminance are distributed across input rows/columns.
  13841. Default value is @code{0.04}. Allowed range is [0, 1].
  13842. @item mirror, r
  13843. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  13844. In mirrored mode, higher values will be represented on the left
  13845. side for @code{row} mode and at the top for @code{column} mode. Default is
  13846. @code{1} (mirrored).
  13847. @item display, d
  13848. Set display mode.
  13849. It accepts the following values:
  13850. @table @samp
  13851. @item overlay
  13852. Presents information identical to that in the @code{parade}, except
  13853. that the graphs representing color components are superimposed directly
  13854. over one another.
  13855. This display mode makes it easier to spot relative differences or similarities
  13856. in overlapping areas of the color components that are supposed to be identical,
  13857. such as neutral whites, grays, or blacks.
  13858. @item stack
  13859. Display separate graph for the color components side by side in
  13860. @code{row} mode or one below the other in @code{column} mode.
  13861. @item parade
  13862. Display separate graph for the color components side by side in
  13863. @code{column} mode or one below the other in @code{row} mode.
  13864. Using this display mode makes it easy to spot color casts in the highlights
  13865. and shadows of an image, by comparing the contours of the top and the bottom
  13866. graphs of each waveform. Since whites, grays, and blacks are characterized
  13867. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  13868. should display three waveforms of roughly equal width/height. If not, the
  13869. correction is easy to perform by making level adjustments the three waveforms.
  13870. @end table
  13871. Default is @code{stack}.
  13872. @item components, c
  13873. Set which color components to display. Default is 1, which means only luminance
  13874. or red color component if input is in RGB colorspace. If is set for example to
  13875. 7 it will display all 3 (if) available color components.
  13876. @item envelope, e
  13877. @table @samp
  13878. @item none
  13879. No envelope, this is default.
  13880. @item instant
  13881. Instant envelope, minimum and maximum values presented in graph will be easily
  13882. visible even with small @code{step} value.
  13883. @item peak
  13884. Hold minimum and maximum values presented in graph across time. This way you
  13885. can still spot out of range values without constantly looking at waveforms.
  13886. @item peak+instant
  13887. Peak and instant envelope combined together.
  13888. @end table
  13889. @item filter, f
  13890. @table @samp
  13891. @item lowpass
  13892. No filtering, this is default.
  13893. @item flat
  13894. Luma and chroma combined together.
  13895. @item aflat
  13896. Similar as above, but shows difference between blue and red chroma.
  13897. @item xflat
  13898. Similar as above, but use different colors.
  13899. @item chroma
  13900. Displays only chroma.
  13901. @item color
  13902. Displays actual color value on waveform.
  13903. @item acolor
  13904. Similar as above, but with luma showing frequency of chroma values.
  13905. @end table
  13906. @item graticule, g
  13907. Set which graticule to display.
  13908. @table @samp
  13909. @item none
  13910. Do not display graticule.
  13911. @item green
  13912. Display green graticule showing legal broadcast ranges.
  13913. @item orange
  13914. Display orange graticule showing legal broadcast ranges.
  13915. @end table
  13916. @item opacity, o
  13917. Set graticule opacity.
  13918. @item flags, fl
  13919. Set graticule flags.
  13920. @table @samp
  13921. @item numbers
  13922. Draw numbers above lines. By default enabled.
  13923. @item dots
  13924. Draw dots instead of lines.
  13925. @end table
  13926. @item scale, s
  13927. Set scale used for displaying graticule.
  13928. @table @samp
  13929. @item digital
  13930. @item millivolts
  13931. @item ire
  13932. @end table
  13933. Default is digital.
  13934. @item bgopacity, b
  13935. Set background opacity.
  13936. @end table
  13937. @section weave, doubleweave
  13938. The @code{weave} takes a field-based video input and join
  13939. each two sequential fields into single frame, producing a new double
  13940. height clip with half the frame rate and half the frame count.
  13941. The @code{doubleweave} works same as @code{weave} but without
  13942. halving frame rate and frame count.
  13943. It accepts the following option:
  13944. @table @option
  13945. @item first_field
  13946. Set first field. Available values are:
  13947. @table @samp
  13948. @item top, t
  13949. Set the frame as top-field-first.
  13950. @item bottom, b
  13951. Set the frame as bottom-field-first.
  13952. @end table
  13953. @end table
  13954. @subsection Examples
  13955. @itemize
  13956. @item
  13957. Interlace video using @ref{select} and @ref{separatefields} filter:
  13958. @example
  13959. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  13960. @end example
  13961. @end itemize
  13962. @section xbr
  13963. Apply the xBR high-quality magnification filter which is designed for pixel
  13964. art. It follows a set of edge-detection rules, see
  13965. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  13966. It accepts the following option:
  13967. @table @option
  13968. @item n
  13969. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  13970. @code{3xBR} and @code{4} for @code{4xBR}.
  13971. Default is @code{3}.
  13972. @end table
  13973. @section xstack
  13974. Stack video inputs into custom layout.
  13975. All streams must be of same pixel format.
  13976. The filter accept the following option:
  13977. @table @option
  13978. @item inputs
  13979. Set number of input streams. Default is 2.
  13980. @item layout
  13981. Specify layout of inputs.
  13982. This option requires the desired layout configuration to be explicitly set by the user.
  13983. This sets position of each video input in output. Each input
  13984. is separated by '|'.
  13985. The first number represents the column, and the second number represents the row.
  13986. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  13987. where X is video input from which to take width or height.
  13988. Multiple values can be used when separated by '+'. In such
  13989. case values are summed together.
  13990. @item shortest
  13991. If set to 1, force the output to terminate when the shortest input
  13992. terminates. Default value is 0.
  13993. @end table
  13994. @subsection Examples
  13995. @itemize
  13996. @item
  13997. Display 4 inputs into 2x2 grid,
  13998. note that if inputs are of different sizes unused gaps might appear,
  13999. as not all of output video is used.
  14000. @example
  14001. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  14002. @end example
  14003. @item
  14004. Display 4 inputs into 1x4 grid,
  14005. note that if inputs are of different sizes unused gaps might appear,
  14006. as not all of output video is used.
  14007. @example
  14008. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  14009. @end example
  14010. @item
  14011. Display 9 inputs into 3x3 grid,
  14012. note that if inputs are of different sizes unused gaps might appear,
  14013. as not all of output video is used.
  14014. @example
  14015. xstack=inputs=9:layout=w3_0|w3_h0+h2|w3_h0|0_h4|0_0|w3+w1_0|0_h1+h2|w3+w1_h0|w3+w1_h1+h2
  14016. @end example
  14017. @end itemize
  14018. @anchor{yadif}
  14019. @section yadif
  14020. Deinterlace the input video ("yadif" means "yet another deinterlacing
  14021. filter").
  14022. It accepts the following parameters:
  14023. @table @option
  14024. @item mode
  14025. The interlacing mode to adopt. It accepts one of the following values:
  14026. @table @option
  14027. @item 0, send_frame
  14028. Output one frame for each frame.
  14029. @item 1, send_field
  14030. Output one frame for each field.
  14031. @item 2, send_frame_nospatial
  14032. Like @code{send_frame}, but it skips the spatial interlacing check.
  14033. @item 3, send_field_nospatial
  14034. Like @code{send_field}, but it skips the spatial interlacing check.
  14035. @end table
  14036. The default value is @code{send_frame}.
  14037. @item parity
  14038. The picture field parity assumed for the input interlaced video. It accepts one
  14039. of the following values:
  14040. @table @option
  14041. @item 0, tff
  14042. Assume the top field is first.
  14043. @item 1, bff
  14044. Assume the bottom field is first.
  14045. @item -1, auto
  14046. Enable automatic detection of field parity.
  14047. @end table
  14048. The default value is @code{auto}.
  14049. If the interlacing is unknown or the decoder does not export this information,
  14050. top field first will be assumed.
  14051. @item deint
  14052. Specify which frames to deinterlace. Accept one of the following
  14053. values:
  14054. @table @option
  14055. @item 0, all
  14056. Deinterlace all frames.
  14057. @item 1, interlaced
  14058. Only deinterlace frames marked as interlaced.
  14059. @end table
  14060. The default value is @code{all}.
  14061. @end table
  14062. @section yadif_cuda
  14063. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  14064. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  14065. and/or nvenc.
  14066. It accepts the following parameters:
  14067. @table @option
  14068. @item mode
  14069. The interlacing mode to adopt. It accepts one of the following values:
  14070. @table @option
  14071. @item 0, send_frame
  14072. Output one frame for each frame.
  14073. @item 1, send_field
  14074. Output one frame for each field.
  14075. @item 2, send_frame_nospatial
  14076. Like @code{send_frame}, but it skips the spatial interlacing check.
  14077. @item 3, send_field_nospatial
  14078. Like @code{send_field}, but it skips the spatial interlacing check.
  14079. @end table
  14080. The default value is @code{send_frame}.
  14081. @item parity
  14082. The picture field parity assumed for the input interlaced video. It accepts one
  14083. of the following values:
  14084. @table @option
  14085. @item 0, tff
  14086. Assume the top field is first.
  14087. @item 1, bff
  14088. Assume the bottom field is first.
  14089. @item -1, auto
  14090. Enable automatic detection of field parity.
  14091. @end table
  14092. The default value is @code{auto}.
  14093. If the interlacing is unknown or the decoder does not export this information,
  14094. top field first will be assumed.
  14095. @item deint
  14096. Specify which frames to deinterlace. Accept one of the following
  14097. values:
  14098. @table @option
  14099. @item 0, all
  14100. Deinterlace all frames.
  14101. @item 1, interlaced
  14102. Only deinterlace frames marked as interlaced.
  14103. @end table
  14104. The default value is @code{all}.
  14105. @end table
  14106. @section zoompan
  14107. Apply Zoom & Pan effect.
  14108. This filter accepts the following options:
  14109. @table @option
  14110. @item zoom, z
  14111. Set the zoom expression. Range is 1-10. Default is 1.
  14112. @item x
  14113. @item y
  14114. Set the x and y expression. Default is 0.
  14115. @item d
  14116. Set the duration expression in number of frames.
  14117. This sets for how many number of frames effect will last for
  14118. single input image.
  14119. @item s
  14120. Set the output image size, default is 'hd720'.
  14121. @item fps
  14122. Set the output frame rate, default is '25'.
  14123. @end table
  14124. Each expression can contain the following constants:
  14125. @table @option
  14126. @item in_w, iw
  14127. Input width.
  14128. @item in_h, ih
  14129. Input height.
  14130. @item out_w, ow
  14131. Output width.
  14132. @item out_h, oh
  14133. Output height.
  14134. @item in
  14135. Input frame count.
  14136. @item on
  14137. Output frame count.
  14138. @item x
  14139. @item y
  14140. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  14141. for current input frame.
  14142. @item px
  14143. @item py
  14144. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  14145. not yet such frame (first input frame).
  14146. @item zoom
  14147. Last calculated zoom from 'z' expression for current input frame.
  14148. @item pzoom
  14149. Last calculated zoom of last output frame of previous input frame.
  14150. @item duration
  14151. Number of output frames for current input frame. Calculated from 'd' expression
  14152. for each input frame.
  14153. @item pduration
  14154. number of output frames created for previous input frame
  14155. @item a
  14156. Rational number: input width / input height
  14157. @item sar
  14158. sample aspect ratio
  14159. @item dar
  14160. display aspect ratio
  14161. @end table
  14162. @subsection Examples
  14163. @itemize
  14164. @item
  14165. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  14166. @example
  14167. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='if(gte(zoom,1.5),x,x+1/a)':y='if(gte(zoom,1.5),y,y+1)':s=640x360
  14168. @end example
  14169. @item
  14170. Zoom-in up to 1.5 and pan always at center of picture:
  14171. @example
  14172. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14173. @end example
  14174. @item
  14175. Same as above but without pausing:
  14176. @example
  14177. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14178. @end example
  14179. @end itemize
  14180. @anchor{zscale}
  14181. @section zscale
  14182. Scale (resize) the input video, using the z.lib library:
  14183. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  14184. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  14185. The zscale filter forces the output display aspect ratio to be the same
  14186. as the input, by changing the output sample aspect ratio.
  14187. If the input image format is different from the format requested by
  14188. the next filter, the zscale filter will convert the input to the
  14189. requested format.
  14190. @subsection Options
  14191. The filter accepts the following options.
  14192. @table @option
  14193. @item width, w
  14194. @item height, h
  14195. Set the output video dimension expression. Default value is the input
  14196. dimension.
  14197. If the @var{width} or @var{w} value is 0, the input width is used for
  14198. the output. If the @var{height} or @var{h} value is 0, the input height
  14199. is used for the output.
  14200. If one and only one of the values is -n with n >= 1, the zscale filter
  14201. will use a value that maintains the aspect ratio of the input image,
  14202. calculated from the other specified dimension. After that it will,
  14203. however, make sure that the calculated dimension is divisible by n and
  14204. adjust the value if necessary.
  14205. If both values are -n with n >= 1, the behavior will be identical to
  14206. both values being set to 0 as previously detailed.
  14207. See below for the list of accepted constants for use in the dimension
  14208. expression.
  14209. @item size, s
  14210. Set the video size. For the syntax of this option, check the
  14211. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14212. @item dither, d
  14213. Set the dither type.
  14214. Possible values are:
  14215. @table @var
  14216. @item none
  14217. @item ordered
  14218. @item random
  14219. @item error_diffusion
  14220. @end table
  14221. Default is none.
  14222. @item filter, f
  14223. Set the resize filter type.
  14224. Possible values are:
  14225. @table @var
  14226. @item point
  14227. @item bilinear
  14228. @item bicubic
  14229. @item spline16
  14230. @item spline36
  14231. @item lanczos
  14232. @end table
  14233. Default is bilinear.
  14234. @item range, r
  14235. Set the color range.
  14236. Possible values are:
  14237. @table @var
  14238. @item input
  14239. @item limited
  14240. @item full
  14241. @end table
  14242. Default is same as input.
  14243. @item primaries, p
  14244. Set the color primaries.
  14245. Possible values are:
  14246. @table @var
  14247. @item input
  14248. @item 709
  14249. @item unspecified
  14250. @item 170m
  14251. @item 240m
  14252. @item 2020
  14253. @end table
  14254. Default is same as input.
  14255. @item transfer, t
  14256. Set the transfer characteristics.
  14257. Possible values are:
  14258. @table @var
  14259. @item input
  14260. @item 709
  14261. @item unspecified
  14262. @item 601
  14263. @item linear
  14264. @item 2020_10
  14265. @item 2020_12
  14266. @item smpte2084
  14267. @item iec61966-2-1
  14268. @item arib-std-b67
  14269. @end table
  14270. Default is same as input.
  14271. @item matrix, m
  14272. Set the colorspace matrix.
  14273. Possible value are:
  14274. @table @var
  14275. @item input
  14276. @item 709
  14277. @item unspecified
  14278. @item 470bg
  14279. @item 170m
  14280. @item 2020_ncl
  14281. @item 2020_cl
  14282. @end table
  14283. Default is same as input.
  14284. @item rangein, rin
  14285. Set the input color range.
  14286. Possible values are:
  14287. @table @var
  14288. @item input
  14289. @item limited
  14290. @item full
  14291. @end table
  14292. Default is same as input.
  14293. @item primariesin, pin
  14294. Set the input color primaries.
  14295. Possible values are:
  14296. @table @var
  14297. @item input
  14298. @item 709
  14299. @item unspecified
  14300. @item 170m
  14301. @item 240m
  14302. @item 2020
  14303. @end table
  14304. Default is same as input.
  14305. @item transferin, tin
  14306. Set the input transfer characteristics.
  14307. Possible values are:
  14308. @table @var
  14309. @item input
  14310. @item 709
  14311. @item unspecified
  14312. @item 601
  14313. @item linear
  14314. @item 2020_10
  14315. @item 2020_12
  14316. @end table
  14317. Default is same as input.
  14318. @item matrixin, min
  14319. Set the input colorspace matrix.
  14320. Possible value are:
  14321. @table @var
  14322. @item input
  14323. @item 709
  14324. @item unspecified
  14325. @item 470bg
  14326. @item 170m
  14327. @item 2020_ncl
  14328. @item 2020_cl
  14329. @end table
  14330. @item chromal, c
  14331. Set the output chroma location.
  14332. Possible values are:
  14333. @table @var
  14334. @item input
  14335. @item left
  14336. @item center
  14337. @item topleft
  14338. @item top
  14339. @item bottomleft
  14340. @item bottom
  14341. @end table
  14342. @item chromalin, cin
  14343. Set the input chroma location.
  14344. Possible values are:
  14345. @table @var
  14346. @item input
  14347. @item left
  14348. @item center
  14349. @item topleft
  14350. @item top
  14351. @item bottomleft
  14352. @item bottom
  14353. @end table
  14354. @item npl
  14355. Set the nominal peak luminance.
  14356. @end table
  14357. The values of the @option{w} and @option{h} options are expressions
  14358. containing the following constants:
  14359. @table @var
  14360. @item in_w
  14361. @item in_h
  14362. The input width and height
  14363. @item iw
  14364. @item ih
  14365. These are the same as @var{in_w} and @var{in_h}.
  14366. @item out_w
  14367. @item out_h
  14368. The output (scaled) width and height
  14369. @item ow
  14370. @item oh
  14371. These are the same as @var{out_w} and @var{out_h}
  14372. @item a
  14373. The same as @var{iw} / @var{ih}
  14374. @item sar
  14375. input sample aspect ratio
  14376. @item dar
  14377. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  14378. @item hsub
  14379. @item vsub
  14380. horizontal and vertical input chroma subsample values. For example for the
  14381. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14382. @item ohsub
  14383. @item ovsub
  14384. horizontal and vertical output chroma subsample values. For example for the
  14385. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14386. @end table
  14387. @table @option
  14388. @end table
  14389. @c man end VIDEO FILTERS
  14390. @chapter OpenCL Video Filters
  14391. @c man begin OPENCL VIDEO FILTERS
  14392. Below is a description of the currently available OpenCL video filters.
  14393. To enable compilation of these filters you need to configure FFmpeg with
  14394. @code{--enable-opencl}.
  14395. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  14396. @table @option
  14397. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  14398. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  14399. given device parameters.
  14400. @item -filter_hw_device @var{name}
  14401. Pass the hardware device called @var{name} to all filters in any filter graph.
  14402. @end table
  14403. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  14404. @itemize
  14405. @item
  14406. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  14407. @example
  14408. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  14409. @end example
  14410. @end itemize
  14411. Since OpenCL filters are not able to access frame data in normal memory, all frame data needs to be uploaded(@ref{hwupload}) to hardware surfaces connected to the appropriate device before being used and then downloaded(@ref{hwdownload}) back to normal memory. Note that @ref{hwupload} will upload to a surface with the same layout as the software frame, so it may be necessary to add a @ref{format} filter immediately before to get the input into the right format and @ref{hwdownload} does not support all formats on the output - it may be necessary to insert an additional @ref{format} filter immediately following in the graph to get the output in a supported format.
  14412. @section avgblur_opencl
  14413. Apply average blur filter.
  14414. The filter accepts the following options:
  14415. @table @option
  14416. @item sizeX
  14417. Set horizontal radius size.
  14418. Range is @code{[1, 1024]} and default value is @code{1}.
  14419. @item planes
  14420. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14421. @item sizeY
  14422. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  14423. @end table
  14424. @subsection Example
  14425. @itemize
  14426. @item
  14427. Apply average blur filter with horizontal and vertical size of 3, setting each pixel of the output to the average value of the 7x7 region centered on it in the input. For pixels on the edges of the image, the region does not extend beyond the image boundaries, and so out-of-range coordinates are not used in the calculations.
  14428. @example
  14429. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  14430. @end example
  14431. @end itemize
  14432. @section boxblur_opencl
  14433. Apply a boxblur algorithm to the input video.
  14434. It accepts the following parameters:
  14435. @table @option
  14436. @item luma_radius, lr
  14437. @item luma_power, lp
  14438. @item chroma_radius, cr
  14439. @item chroma_power, cp
  14440. @item alpha_radius, ar
  14441. @item alpha_power, ap
  14442. @end table
  14443. A description of the accepted options follows.
  14444. @table @option
  14445. @item luma_radius, lr
  14446. @item chroma_radius, cr
  14447. @item alpha_radius, ar
  14448. Set an expression for the box radius in pixels used for blurring the
  14449. corresponding input plane.
  14450. The radius value must be a non-negative number, and must not be
  14451. greater than the value of the expression @code{min(w,h)/2} for the
  14452. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  14453. planes.
  14454. Default value for @option{luma_radius} is "2". If not specified,
  14455. @option{chroma_radius} and @option{alpha_radius} default to the
  14456. corresponding value set for @option{luma_radius}.
  14457. The expressions can contain the following constants:
  14458. @table @option
  14459. @item w
  14460. @item h
  14461. The input width and height in pixels.
  14462. @item cw
  14463. @item ch
  14464. The input chroma image width and height in pixels.
  14465. @item hsub
  14466. @item vsub
  14467. The horizontal and vertical chroma subsample values. For example, for the
  14468. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  14469. @end table
  14470. @item luma_power, lp
  14471. @item chroma_power, cp
  14472. @item alpha_power, ap
  14473. Specify how many times the boxblur filter is applied to the
  14474. corresponding plane.
  14475. Default value for @option{luma_power} is 2. If not specified,
  14476. @option{chroma_power} and @option{alpha_power} default to the
  14477. corresponding value set for @option{luma_power}.
  14478. A value of 0 will disable the effect.
  14479. @end table
  14480. @subsection Examples
  14481. Apply boxblur filter, setting each pixel of the output to the average value of box-radiuses @var{luma_radius}, @var{chroma_radius}, @var{alpha_radius} for each plane respectively. The filter will apply @var{luma_power}, @var{chroma_power}, @var{alpha_power} times onto the corresponding plane. For pixels on the edges of the image, the radius does not extend beyond the image boundaries, and so out-of-range coordinates are not used in the calculations.
  14482. @itemize
  14483. @item
  14484. Apply a boxblur filter with the luma, chroma, and alpha radius
  14485. set to 2 and luma, chroma, and alpha power set to 3. The filter will run 3 times with box-radius set to 2 for every plane of the image.
  14486. @example
  14487. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  14488. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  14489. @end example
  14490. @item
  14491. Apply a boxblur filter with luma radius set to 2, luma_power to 1, chroma_radius to 4, chroma_power to 5, alpha_radius to 3 and alpha_power to 7.
  14492. For the luma plane, a 2x2 box radius will be run once.
  14493. For the chroma plane, a 4x4 box radius will be run 5 times.
  14494. For the alpha plane, a 3x3 box radius will be run 7 times.
  14495. @example
  14496. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  14497. @end example
  14498. @end itemize
  14499. @section convolution_opencl
  14500. Apply convolution of 3x3, 5x5, 7x7 matrix.
  14501. The filter accepts the following options:
  14502. @table @option
  14503. @item 0m
  14504. @item 1m
  14505. @item 2m
  14506. @item 3m
  14507. Set matrix for each plane.
  14508. Matrix is sequence of 9, 25 or 49 signed numbers.
  14509. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  14510. @item 0rdiv
  14511. @item 1rdiv
  14512. @item 2rdiv
  14513. @item 3rdiv
  14514. Set multiplier for calculated value for each plane.
  14515. If unset or 0, it will be sum of all matrix elements.
  14516. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  14517. @item 0bias
  14518. @item 1bias
  14519. @item 2bias
  14520. @item 3bias
  14521. Set bias for each plane. This value is added to the result of the multiplication.
  14522. Useful for making the overall image brighter or darker.
  14523. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  14524. @end table
  14525. @subsection Examples
  14526. @itemize
  14527. @item
  14528. Apply sharpen:
  14529. @example
  14530. -i INPUT -vf "hwupload, convolution_opencl=0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0, hwdownload" OUTPUT
  14531. @end example
  14532. @item
  14533. Apply blur:
  14534. @example
  14535. -i INPUT -vf "hwupload, convolution_opencl=1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1/9:1/9:1/9:1/9, hwdownload" OUTPUT
  14536. @end example
  14537. @item
  14538. Apply edge enhance:
  14539. @example
  14540. -i INPUT -vf "hwupload, convolution_opencl=0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:5:1:1:1:0:128:128:128, hwdownload" OUTPUT
  14541. @end example
  14542. @item
  14543. Apply edge detect:
  14544. @example
  14545. -i INPUT -vf "hwupload, convolution_opencl=0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:5:5:5:1:0:128:128:128, hwdownload" OUTPUT
  14546. @end example
  14547. @item
  14548. Apply laplacian edge detector which includes diagonals:
  14549. @example
  14550. -i INPUT -vf "hwupload, convolution_opencl=1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:5:5:5:1:0:128:128:0, hwdownload" OUTPUT
  14551. @end example
  14552. @item
  14553. Apply emboss:
  14554. @example
  14555. -i INPUT -vf "hwupload, convolution_opencl=-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2, hwdownload" OUTPUT
  14556. @end example
  14557. @end itemize
  14558. @section dilation_opencl
  14559. Apply dilation effect to the video.
  14560. This filter replaces the pixel by the local(3x3) maximum.
  14561. It accepts the following options:
  14562. @table @option
  14563. @item threshold0
  14564. @item threshold1
  14565. @item threshold2
  14566. @item threshold3
  14567. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14568. If @code{0}, plane will remain unchanged.
  14569. @item coordinates
  14570. Flag which specifies the pixel to refer to.
  14571. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14572. Flags to local 3x3 coordinates region centered on @code{x}:
  14573. 1 2 3
  14574. 4 x 5
  14575. 6 7 8
  14576. @end table
  14577. @subsection Example
  14578. @itemize
  14579. @item
  14580. Apply dilation filter with threshold0 set to 30, threshold1 set 40, threshold2 set to 50 and coordinates set to 231, setting each pixel of the output to the local maximum between pixels: 1, 2, 3, 6, 7, 8 of the 3x3 region centered on it in the input. If the difference between input pixel and local maximum is more then threshold of the corresponding plane, output pixel will be set to input pixel + threshold of corresponding plane.
  14581. @example
  14582. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14583. @end example
  14584. @end itemize
  14585. @section erosion_opencl
  14586. Apply erosion effect to the video.
  14587. This filter replaces the pixel by the local(3x3) minimum.
  14588. It accepts the following options:
  14589. @table @option
  14590. @item threshold0
  14591. @item threshold1
  14592. @item threshold2
  14593. @item threshold3
  14594. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14595. If @code{0}, plane will remain unchanged.
  14596. @item coordinates
  14597. Flag which specifies the pixel to refer to.
  14598. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14599. Flags to local 3x3 coordinates region centered on @code{x}:
  14600. 1 2 3
  14601. 4 x 5
  14602. 6 7 8
  14603. @end table
  14604. @subsection Example
  14605. @itemize
  14606. @item
  14607. Apply erosion filter with threshold0 set to 30, threshold1 set 40, threshold2 set to 50 and coordinates set to 231, setting each pixel of the output to the local minimum between pixels: 1, 2, 3, 6, 7, 8 of the 3x3 region centered on it in the input. If the difference between input pixel and local minimum is more then threshold of the corresponding plane, output pixel will be set to input pixel - threshold of corresponding plane.
  14608. @example
  14609. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14610. @end example
  14611. @end itemize
  14612. @section colorkey_opencl
  14613. RGB colorspace color keying.
  14614. The filter accepts the following options:
  14615. @table @option
  14616. @item color
  14617. The color which will be replaced with transparency.
  14618. @item similarity
  14619. Similarity percentage with the key color.
  14620. 0.01 matches only the exact key color, while 1.0 matches everything.
  14621. @item blend
  14622. Blend percentage.
  14623. 0.0 makes pixels either fully transparent, or not transparent at all.
  14624. Higher values result in semi-transparent pixels, with a higher transparency
  14625. the more similar the pixels color is to the key color.
  14626. @end table
  14627. @subsection Examples
  14628. @itemize
  14629. @item
  14630. Make every semi-green pixel in the input transparent with some slight blending:
  14631. @example
  14632. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  14633. @end example
  14634. @end itemize
  14635. @section overlay_opencl
  14636. Overlay one video on top of another.
  14637. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  14638. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  14639. The filter accepts the following options:
  14640. @table @option
  14641. @item x
  14642. Set the x coordinate of the overlaid video on the main video.
  14643. Default value is @code{0}.
  14644. @item y
  14645. Set the x coordinate of the overlaid video on the main video.
  14646. Default value is @code{0}.
  14647. @end table
  14648. @subsection Examples
  14649. @itemize
  14650. @item
  14651. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  14652. @example
  14653. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14654. @end example
  14655. @item
  14656. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  14657. @example
  14658. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14659. @end example
  14660. @end itemize
  14661. @section prewitt_opencl
  14662. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  14663. The filter accepts the following option:
  14664. @table @option
  14665. @item planes
  14666. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14667. @item scale
  14668. Set value which will be multiplied with filtered result.
  14669. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14670. @item delta
  14671. Set value which will be added to filtered result.
  14672. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14673. @end table
  14674. @subsection Example
  14675. @itemize
  14676. @item
  14677. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  14678. @example
  14679. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14680. @end example
  14681. @end itemize
  14682. @section roberts_opencl
  14683. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  14684. The filter accepts the following option:
  14685. @table @option
  14686. @item planes
  14687. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14688. @item scale
  14689. Set value which will be multiplied with filtered result.
  14690. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14691. @item delta
  14692. Set value which will be added to filtered result.
  14693. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14694. @end table
  14695. @subsection Example
  14696. @itemize
  14697. @item
  14698. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  14699. @example
  14700. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14701. @end example
  14702. @end itemize
  14703. @section sobel_opencl
  14704. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  14705. The filter accepts the following option:
  14706. @table @option
  14707. @item planes
  14708. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14709. @item scale
  14710. Set value which will be multiplied with filtered result.
  14711. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14712. @item delta
  14713. Set value which will be added to filtered result.
  14714. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14715. @end table
  14716. @subsection Example
  14717. @itemize
  14718. @item
  14719. Apply sobel operator with scale set to 2 and delta set to 10
  14720. @example
  14721. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14722. @end example
  14723. @end itemize
  14724. @section tonemap_opencl
  14725. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  14726. It accepts the following parameters:
  14727. @table @option
  14728. @item tonemap
  14729. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  14730. @item param
  14731. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  14732. @item desat
  14733. Apply desaturation for highlights that exceed this level of brightness. The
  14734. higher the parameter, the more color information will be preserved. This
  14735. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14736. (smoothly) turning into white instead. This makes images feel more natural,
  14737. at the cost of reducing information about out-of-range colors.
  14738. The default value is 0.5, and the algorithm here is a little different from
  14739. the cpu version tonemap currently. A setting of 0.0 disables this option.
  14740. @item threshold
  14741. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  14742. is used to detect whether the scene has changed or not. If the distance between
  14743. the current frame average brightness and the current running average exceeds
  14744. a threshold value, we would re-calculate scene average and peak brightness.
  14745. The default value is 0.2.
  14746. @item format
  14747. Specify the output pixel format.
  14748. Currently supported formats are:
  14749. @table @var
  14750. @item p010
  14751. @item nv12
  14752. @end table
  14753. @item range, r
  14754. Set the output color range.
  14755. Possible values are:
  14756. @table @var
  14757. @item tv/mpeg
  14758. @item pc/jpeg
  14759. @end table
  14760. Default is same as input.
  14761. @item primaries, p
  14762. Set the output color primaries.
  14763. Possible values are:
  14764. @table @var
  14765. @item bt709
  14766. @item bt2020
  14767. @end table
  14768. Default is same as input.
  14769. @item transfer, t
  14770. Set the output transfer characteristics.
  14771. Possible values are:
  14772. @table @var
  14773. @item bt709
  14774. @item bt2020
  14775. @end table
  14776. Default is bt709.
  14777. @item matrix, m
  14778. Set the output colorspace matrix.
  14779. Possible value are:
  14780. @table @var
  14781. @item bt709
  14782. @item bt2020
  14783. @end table
  14784. Default is same as input.
  14785. @end table
  14786. @subsection Example
  14787. @itemize
  14788. @item
  14789. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  14790. @example
  14791. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  14792. @end example
  14793. @end itemize
  14794. @section unsharp_opencl
  14795. Sharpen or blur the input video.
  14796. It accepts the following parameters:
  14797. @table @option
  14798. @item luma_msize_x, lx
  14799. Set the luma matrix horizontal size.
  14800. Range is @code{[1, 23]} and default value is @code{5}.
  14801. @item luma_msize_y, ly
  14802. Set the luma matrix vertical size.
  14803. Range is @code{[1, 23]} and default value is @code{5}.
  14804. @item luma_amount, la
  14805. Set the luma effect strength.
  14806. Range is @code{[-10, 10]} and default value is @code{1.0}.
  14807. Negative values will blur the input video, while positive values will
  14808. sharpen it, a value of zero will disable the effect.
  14809. @item chroma_msize_x, cx
  14810. Set the chroma matrix horizontal size.
  14811. Range is @code{[1, 23]} and default value is @code{5}.
  14812. @item chroma_msize_y, cy
  14813. Set the chroma matrix vertical size.
  14814. Range is @code{[1, 23]} and default value is @code{5}.
  14815. @item chroma_amount, ca
  14816. Set the chroma effect strength.
  14817. Range is @code{[-10, 10]} and default value is @code{0.0}.
  14818. Negative values will blur the input video, while positive values will
  14819. sharpen it, a value of zero will disable the effect.
  14820. @end table
  14821. All parameters are optional and default to the equivalent of the
  14822. string '5:5:1.0:5:5:0.0'.
  14823. @subsection Examples
  14824. @itemize
  14825. @item
  14826. Apply strong luma sharpen effect:
  14827. @example
  14828. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  14829. @end example
  14830. @item
  14831. Apply a strong blur of both luma and chroma parameters:
  14832. @example
  14833. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  14834. @end example
  14835. @end itemize
  14836. @c man end OPENCL VIDEO FILTERS
  14837. @chapter Video Sources
  14838. @c man begin VIDEO SOURCES
  14839. Below is a description of the currently available video sources.
  14840. @section buffer
  14841. Buffer video frames, and make them available to the filter chain.
  14842. This source is mainly intended for a programmatic use, in particular
  14843. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  14844. It accepts the following parameters:
  14845. @table @option
  14846. @item video_size
  14847. Specify the size (width and height) of the buffered video frames. For the
  14848. syntax of this option, check the
  14849. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14850. @item width
  14851. The input video width.
  14852. @item height
  14853. The input video height.
  14854. @item pix_fmt
  14855. A string representing the pixel format of the buffered video frames.
  14856. It may be a number corresponding to a pixel format, or a pixel format
  14857. name.
  14858. @item time_base
  14859. Specify the timebase assumed by the timestamps of the buffered frames.
  14860. @item frame_rate
  14861. Specify the frame rate expected for the video stream.
  14862. @item pixel_aspect, sar
  14863. The sample (pixel) aspect ratio of the input video.
  14864. @item sws_param
  14865. Specify the optional parameters to be used for the scale filter which
  14866. is automatically inserted when an input change is detected in the
  14867. input size or format.
  14868. @item hw_frames_ctx
  14869. When using a hardware pixel format, this should be a reference to an
  14870. AVHWFramesContext describing input frames.
  14871. @end table
  14872. For example:
  14873. @example
  14874. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  14875. @end example
  14876. will instruct the source to accept video frames with size 320x240 and
  14877. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  14878. square pixels (1:1 sample aspect ratio).
  14879. Since the pixel format with name "yuv410p" corresponds to the number 6
  14880. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  14881. this example corresponds to:
  14882. @example
  14883. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  14884. @end example
  14885. Alternatively, the options can be specified as a flat string, but this
  14886. syntax is deprecated:
  14887. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}[:@var{sws_param}]
  14888. @section cellauto
  14889. Create a pattern generated by an elementary cellular automaton.
  14890. The initial state of the cellular automaton can be defined through the
  14891. @option{filename} and @option{pattern} options. If such options are
  14892. not specified an initial state is created randomly.
  14893. At each new frame a new row in the video is filled with the result of
  14894. the cellular automaton next generation. The behavior when the whole
  14895. frame is filled is defined by the @option{scroll} option.
  14896. This source accepts the following options:
  14897. @table @option
  14898. @item filename, f
  14899. Read the initial cellular automaton state, i.e. the starting row, from
  14900. the specified file.
  14901. In the file, each non-whitespace character is considered an alive
  14902. cell, a newline will terminate the row, and further characters in the
  14903. file will be ignored.
  14904. @item pattern, p
  14905. Read the initial cellular automaton state, i.e. the starting row, from
  14906. the specified string.
  14907. Each non-whitespace character in the string is considered an alive
  14908. cell, a newline will terminate the row, and further characters in the
  14909. string will be ignored.
  14910. @item rate, r
  14911. Set the video rate, that is the number of frames generated per second.
  14912. Default is 25.
  14913. @item random_fill_ratio, ratio
  14914. Set the random fill ratio for the initial cellular automaton row. It
  14915. is a floating point number value ranging from 0 to 1, defaults to
  14916. 1/PHI.
  14917. This option is ignored when a file or a pattern is specified.
  14918. @item random_seed, seed
  14919. Set the seed for filling randomly the initial row, must be an integer
  14920. included between 0 and UINT32_MAX. If not specified, or if explicitly
  14921. set to -1, the filter will try to use a good random seed on a best
  14922. effort basis.
  14923. @item rule
  14924. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  14925. Default value is 110.
  14926. @item size, s
  14927. Set the size of the output video. For the syntax of this option, check the
  14928. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14929. If @option{filename} or @option{pattern} is specified, the size is set
  14930. by default to the width of the specified initial state row, and the
  14931. height is set to @var{width} * PHI.
  14932. If @option{size} is set, it must contain the width of the specified
  14933. pattern string, and the specified pattern will be centered in the
  14934. larger row.
  14935. If a filename or a pattern string is not specified, the size value
  14936. defaults to "320x518" (used for a randomly generated initial state).
  14937. @item scroll
  14938. If set to 1, scroll the output upward when all the rows in the output
  14939. have been already filled. If set to 0, the new generated row will be
  14940. written over the top row just after the bottom row is filled.
  14941. Defaults to 1.
  14942. @item start_full, full
  14943. If set to 1, completely fill the output with generated rows before
  14944. outputting the first frame.
  14945. This is the default behavior, for disabling set the value to 0.
  14946. @item stitch
  14947. If set to 1, stitch the left and right row edges together.
  14948. This is the default behavior, for disabling set the value to 0.
  14949. @end table
  14950. @subsection Examples
  14951. @itemize
  14952. @item
  14953. Read the initial state from @file{pattern}, and specify an output of
  14954. size 200x400.
  14955. @example
  14956. cellauto=f=pattern:s=200x400
  14957. @end example
  14958. @item
  14959. Generate a random initial row with a width of 200 cells, with a fill
  14960. ratio of 2/3:
  14961. @example
  14962. cellauto=ratio=2/3:s=200x200
  14963. @end example
  14964. @item
  14965. Create a pattern generated by rule 18 starting by a single alive cell
  14966. centered on an initial row with width 100:
  14967. @example
  14968. cellauto=p=@@:s=100x400:full=0:rule=18
  14969. @end example
  14970. @item
  14971. Specify a more elaborated initial pattern:
  14972. @example
  14973. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  14974. @end example
  14975. @end itemize
  14976. @anchor{coreimagesrc}
  14977. @section coreimagesrc
  14978. Video source generated on GPU using Apple's CoreImage API on OSX.
  14979. This video source is a specialized version of the @ref{coreimage} video filter.
  14980. Use a core image generator at the beginning of the applied filterchain to
  14981. generate the content.
  14982. The coreimagesrc video source accepts the following options:
  14983. @table @option
  14984. @item list_generators
  14985. List all available generators along with all their respective options as well as
  14986. possible minimum and maximum values along with the default values.
  14987. @example
  14988. list_generators=true
  14989. @end example
  14990. @item size, s
  14991. Specify the size of the sourced video. For the syntax of this option, check the
  14992. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14993. The default value is @code{320x240}.
  14994. @item rate, r
  14995. Specify the frame rate of the sourced video, as the number of frames
  14996. generated per second. It has to be a string in the format
  14997. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  14998. number or a valid video frame rate abbreviation. The default value is
  14999. "25".
  15000. @item sar
  15001. Set the sample aspect ratio of the sourced video.
  15002. @item duration, d
  15003. Set the duration of the sourced video. See
  15004. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15005. for the accepted syntax.
  15006. If not specified, or the expressed duration is negative, the video is
  15007. supposed to be generated forever.
  15008. @end table
  15009. Additionally, all options of the @ref{coreimage} video filter are accepted.
  15010. A complete filterchain can be used for further processing of the
  15011. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  15012. and examples for details.
  15013. @subsection Examples
  15014. @itemize
  15015. @item
  15016. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  15017. given as complete and escaped command-line for Apple's standard bash shell:
  15018. @example
  15019. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  15020. @end example
  15021. This example is equivalent to the QRCode example of @ref{coreimage} without the
  15022. need for a nullsrc video source.
  15023. @end itemize
  15024. @section mandelbrot
  15025. Generate a Mandelbrot set fractal, and progressively zoom towards the
  15026. point specified with @var{start_x} and @var{start_y}.
  15027. This source accepts the following options:
  15028. @table @option
  15029. @item end_pts
  15030. Set the terminal pts value. Default value is 400.
  15031. @item end_scale
  15032. Set the terminal scale value.
  15033. Must be a floating point value. Default value is 0.3.
  15034. @item inner
  15035. Set the inner coloring mode, that is the algorithm used to draw the
  15036. Mandelbrot fractal internal region.
  15037. It shall assume one of the following values:
  15038. @table @option
  15039. @item black
  15040. Set black mode.
  15041. @item convergence
  15042. Show time until convergence.
  15043. @item mincol
  15044. Set color based on point closest to the origin of the iterations.
  15045. @item period
  15046. Set period mode.
  15047. @end table
  15048. Default value is @var{mincol}.
  15049. @item bailout
  15050. Set the bailout value. Default value is 10.0.
  15051. @item maxiter
  15052. Set the maximum of iterations performed by the rendering
  15053. algorithm. Default value is 7189.
  15054. @item outer
  15055. Set outer coloring mode.
  15056. It shall assume one of following values:
  15057. @table @option
  15058. @item iteration_count
  15059. Set iteration count mode.
  15060. @item normalized_iteration_count
  15061. set normalized iteration count mode.
  15062. @end table
  15063. Default value is @var{normalized_iteration_count}.
  15064. @item rate, r
  15065. Set frame rate, expressed as number of frames per second. Default
  15066. value is "25".
  15067. @item size, s
  15068. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  15069. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  15070. @item start_scale
  15071. Set the initial scale value. Default value is 3.0.
  15072. @item start_x
  15073. Set the initial x position. Must be a floating point value between
  15074. -100 and 100. Default value is -0.743643887037158704752191506114774.
  15075. @item start_y
  15076. Set the initial y position. Must be a floating point value between
  15077. -100 and 100. Default value is -0.131825904205311970493132056385139.
  15078. @end table
  15079. @section mptestsrc
  15080. Generate various test patterns, as generated by the MPlayer test filter.
  15081. The size of the generated video is fixed, and is 256x256.
  15082. This source is useful in particular for testing encoding features.
  15083. This source accepts the following options:
  15084. @table @option
  15085. @item rate, r
  15086. Specify the frame rate of the sourced video, as the number of frames
  15087. generated per second. It has to be a string in the format
  15088. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15089. number or a valid video frame rate abbreviation. The default value is
  15090. "25".
  15091. @item duration, d
  15092. Set the duration of the sourced video. See
  15093. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15094. for the accepted syntax.
  15095. If not specified, or the expressed duration is negative, the video is
  15096. supposed to be generated forever.
  15097. @item test, t
  15098. Set the number or the name of the test to perform. Supported tests are:
  15099. @table @option
  15100. @item dc_luma
  15101. @item dc_chroma
  15102. @item freq_luma
  15103. @item freq_chroma
  15104. @item amp_luma
  15105. @item amp_chroma
  15106. @item cbp
  15107. @item mv
  15108. @item ring1
  15109. @item ring2
  15110. @item all
  15111. @end table
  15112. Default value is "all", which will cycle through the list of all tests.
  15113. @end table
  15114. Some examples:
  15115. @example
  15116. mptestsrc=t=dc_luma
  15117. @end example
  15118. will generate a "dc_luma" test pattern.
  15119. @section frei0r_src
  15120. Provide a frei0r source.
  15121. To enable compilation of this filter you need to install the frei0r
  15122. header and configure FFmpeg with @code{--enable-frei0r}.
  15123. This source accepts the following parameters:
  15124. @table @option
  15125. @item size
  15126. The size of the video to generate. For the syntax of this option, check the
  15127. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15128. @item framerate
  15129. The framerate of the generated video. It may be a string of the form
  15130. @var{num}/@var{den} or a frame rate abbreviation.
  15131. @item filter_name
  15132. The name to the frei0r source to load. For more information regarding frei0r and
  15133. how to set the parameters, read the @ref{frei0r} section in the video filters
  15134. documentation.
  15135. @item filter_params
  15136. A '|'-separated list of parameters to pass to the frei0r source.
  15137. @end table
  15138. For example, to generate a frei0r partik0l source with size 200x200
  15139. and frame rate 10 which is overlaid on the overlay filter main input:
  15140. @example
  15141. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  15142. @end example
  15143. @section life
  15144. Generate a life pattern.
  15145. This source is based on a generalization of John Conway's life game.
  15146. The sourced input represents a life grid, each pixel represents a cell
  15147. which can be in one of two possible states, alive or dead. Every cell
  15148. interacts with its eight neighbours, which are the cells that are
  15149. horizontally, vertically, or diagonally adjacent.
  15150. At each interaction the grid evolves according to the adopted rule,
  15151. which specifies the number of neighbor alive cells which will make a
  15152. cell stay alive or born. The @option{rule} option allows one to specify
  15153. the rule to adopt.
  15154. This source accepts the following options:
  15155. @table @option
  15156. @item filename, f
  15157. Set the file from which to read the initial grid state. In the file,
  15158. each non-whitespace character is considered an alive cell, and newline
  15159. is used to delimit the end of each row.
  15160. If this option is not specified, the initial grid is generated
  15161. randomly.
  15162. @item rate, r
  15163. Set the video rate, that is the number of frames generated per second.
  15164. Default is 25.
  15165. @item random_fill_ratio, ratio
  15166. Set the random fill ratio for the initial random grid. It is a
  15167. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  15168. It is ignored when a file is specified.
  15169. @item random_seed, seed
  15170. Set the seed for filling the initial random grid, must be an integer
  15171. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15172. set to -1, the filter will try to use a good random seed on a best
  15173. effort basis.
  15174. @item rule
  15175. Set the life rule.
  15176. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  15177. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  15178. @var{NS} specifies the number of alive neighbor cells which make a
  15179. live cell stay alive, and @var{NB} the number of alive neighbor cells
  15180. which make a dead cell to become alive (i.e. to "born").
  15181. "s" and "b" can be used in place of "S" and "B", respectively.
  15182. Alternatively a rule can be specified by an 18-bits integer. The 9
  15183. high order bits are used to encode the next cell state if it is alive
  15184. for each number of neighbor alive cells, the low order bits specify
  15185. the rule for "borning" new cells. Higher order bits encode for an
  15186. higher number of neighbor cells.
  15187. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  15188. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  15189. Default value is "S23/B3", which is the original Conway's game of life
  15190. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  15191. cells, and will born a new cell if there are three alive cells around
  15192. a dead cell.
  15193. @item size, s
  15194. Set the size of the output video. For the syntax of this option, check the
  15195. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15196. If @option{filename} is specified, the size is set by default to the
  15197. same size of the input file. If @option{size} is set, it must contain
  15198. the size specified in the input file, and the initial grid defined in
  15199. that file is centered in the larger resulting area.
  15200. If a filename is not specified, the size value defaults to "320x240"
  15201. (used for a randomly generated initial grid).
  15202. @item stitch
  15203. If set to 1, stitch the left and right grid edges together, and the
  15204. top and bottom edges also. Defaults to 1.
  15205. @item mold
  15206. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  15207. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  15208. value from 0 to 255.
  15209. @item life_color
  15210. Set the color of living (or new born) cells.
  15211. @item death_color
  15212. Set the color of dead cells. If @option{mold} is set, this is the first color
  15213. used to represent a dead cell.
  15214. @item mold_color
  15215. Set mold color, for definitely dead and moldy cells.
  15216. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  15217. ffmpeg-utils manual,ffmpeg-utils}.
  15218. @end table
  15219. @subsection Examples
  15220. @itemize
  15221. @item
  15222. Read a grid from @file{pattern}, and center it on a grid of size
  15223. 300x300 pixels:
  15224. @example
  15225. life=f=pattern:s=300x300
  15226. @end example
  15227. @item
  15228. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  15229. @example
  15230. life=ratio=2/3:s=200x200
  15231. @end example
  15232. @item
  15233. Specify a custom rule for evolving a randomly generated grid:
  15234. @example
  15235. life=rule=S14/B34
  15236. @end example
  15237. @item
  15238. Full example with slow death effect (mold) using @command{ffplay}:
  15239. @example
  15240. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  15241. @end example
  15242. @end itemize
  15243. @anchor{allrgb}
  15244. @anchor{allyuv}
  15245. @anchor{color}
  15246. @anchor{haldclutsrc}
  15247. @anchor{nullsrc}
  15248. @anchor{pal75bars}
  15249. @anchor{pal100bars}
  15250. @anchor{rgbtestsrc}
  15251. @anchor{smptebars}
  15252. @anchor{smptehdbars}
  15253. @anchor{testsrc}
  15254. @anchor{testsrc2}
  15255. @anchor{yuvtestsrc}
  15256. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  15257. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  15258. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  15259. The @code{color} source provides an uniformly colored input.
  15260. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  15261. @ref{haldclut} filter.
  15262. The @code{nullsrc} source returns unprocessed video frames. It is
  15263. mainly useful to be employed in analysis / debugging tools, or as the
  15264. source for filters which ignore the input data.
  15265. The @code{pal75bars} source generates a color bars pattern, based on
  15266. EBU PAL recommendations with 75% color levels.
  15267. The @code{pal100bars} source generates a color bars pattern, based on
  15268. EBU PAL recommendations with 100% color levels.
  15269. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  15270. detecting RGB vs BGR issues. You should see a red, green and blue
  15271. stripe from top to bottom.
  15272. The @code{smptebars} source generates a color bars pattern, based on
  15273. the SMPTE Engineering Guideline EG 1-1990.
  15274. The @code{smptehdbars} source generates a color bars pattern, based on
  15275. the SMPTE RP 219-2002.
  15276. The @code{testsrc} source generates a test video pattern, showing a
  15277. color pattern, a scrolling gradient and a timestamp. This is mainly
  15278. intended for testing purposes.
  15279. The @code{testsrc2} source is similar to testsrc, but supports more
  15280. pixel formats instead of just @code{rgb24}. This allows using it as an
  15281. input for other tests without requiring a format conversion.
  15282. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  15283. see a y, cb and cr stripe from top to bottom.
  15284. The sources accept the following parameters:
  15285. @table @option
  15286. @item level
  15287. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  15288. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  15289. pixels to be used as identity matrix for 3D lookup tables. Each component is
  15290. coded on a @code{1/(N*N)} scale.
  15291. @item color, c
  15292. Specify the color of the source, only available in the @code{color}
  15293. source. For the syntax of this option, check the
  15294. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15295. @item size, s
  15296. Specify the size of the sourced video. For the syntax of this option, check the
  15297. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15298. The default value is @code{320x240}.
  15299. This option is not available with the @code{allrgb}, @code{allyuv}, and
  15300. @code{haldclutsrc} filters.
  15301. @item rate, r
  15302. Specify the frame rate of the sourced video, as the number of frames
  15303. generated per second. It has to be a string in the format
  15304. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15305. number or a valid video frame rate abbreviation. The default value is
  15306. "25".
  15307. @item duration, d
  15308. Set the duration of the sourced video. See
  15309. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15310. for the accepted syntax.
  15311. If not specified, or the expressed duration is negative, the video is
  15312. supposed to be generated forever.
  15313. @item sar
  15314. Set the sample aspect ratio of the sourced video.
  15315. @item alpha
  15316. Specify the alpha (opacity) of the background, only available in the
  15317. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  15318. 255 (fully opaque, the default).
  15319. @item decimals, n
  15320. Set the number of decimals to show in the timestamp, only available in the
  15321. @code{testsrc} source.
  15322. The displayed timestamp value will correspond to the original
  15323. timestamp value multiplied by the power of 10 of the specified
  15324. value. Default value is 0.
  15325. @end table
  15326. @subsection Examples
  15327. @itemize
  15328. @item
  15329. Generate a video with a duration of 5.3 seconds, with size
  15330. 176x144 and a frame rate of 10 frames per second:
  15331. @example
  15332. testsrc=duration=5.3:size=qcif:rate=10
  15333. @end example
  15334. @item
  15335. The following graph description will generate a red source
  15336. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  15337. frames per second:
  15338. @example
  15339. color=c=red@@0.2:s=qcif:r=10
  15340. @end example
  15341. @item
  15342. If the input content is to be ignored, @code{nullsrc} can be used. The
  15343. following command generates noise in the luminance plane by employing
  15344. the @code{geq} filter:
  15345. @example
  15346. nullsrc=s=256x256, geq=random(1)*255:128:128
  15347. @end example
  15348. @end itemize
  15349. @subsection Commands
  15350. The @code{color} source supports the following commands:
  15351. @table @option
  15352. @item c, color
  15353. Set the color of the created image. Accepts the same syntax of the
  15354. corresponding @option{color} option.
  15355. @end table
  15356. @section openclsrc
  15357. Generate video using an OpenCL program.
  15358. @table @option
  15359. @item source
  15360. OpenCL program source file.
  15361. @item kernel
  15362. Kernel name in program.
  15363. @item size, s
  15364. Size of frames to generate. This must be set.
  15365. @item format
  15366. Pixel format to use for the generated frames. This must be set.
  15367. @item rate, r
  15368. Number of frames generated every second. Default value is '25'.
  15369. @end table
  15370. For details of how the program loading works, see the @ref{program_opencl}
  15371. filter.
  15372. Example programs:
  15373. @itemize
  15374. @item
  15375. Generate a colour ramp by setting pixel values from the position of the pixel
  15376. in the output image. (Note that this will work with all pixel formats, but
  15377. the generated output will not be the same.)
  15378. @verbatim
  15379. __kernel void ramp(__write_only image2d_t dst,
  15380. unsigned int index)
  15381. {
  15382. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15383. float4 val;
  15384. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  15385. write_imagef(dst, loc, val);
  15386. }
  15387. @end verbatim
  15388. @item
  15389. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  15390. @verbatim
  15391. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  15392. unsigned int index)
  15393. {
  15394. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15395. float4 value = 0.0f;
  15396. int x = loc.x + index;
  15397. int y = loc.y + index;
  15398. while (x > 0 || y > 0) {
  15399. if (x % 3 == 1 && y % 3 == 1) {
  15400. value = 1.0f;
  15401. break;
  15402. }
  15403. x /= 3;
  15404. y /= 3;
  15405. }
  15406. write_imagef(dst, loc, value);
  15407. }
  15408. @end verbatim
  15409. @end itemize
  15410. @c man end VIDEO SOURCES
  15411. @chapter Video Sinks
  15412. @c man begin VIDEO SINKS
  15413. Below is a description of the currently available video sinks.
  15414. @section buffersink
  15415. Buffer video frames, and make them available to the end of the filter
  15416. graph.
  15417. This sink is mainly intended for programmatic use, in particular
  15418. through the interface defined in @file{libavfilter/buffersink.h}
  15419. or the options system.
  15420. It accepts a pointer to an AVBufferSinkContext structure, which
  15421. defines the incoming buffers' formats, to be passed as the opaque
  15422. parameter to @code{avfilter_init_filter} for initialization.
  15423. @section nullsink
  15424. Null video sink: do absolutely nothing with the input video. It is
  15425. mainly useful as a template and for use in analysis / debugging
  15426. tools.
  15427. @c man end VIDEO SINKS
  15428. @chapter Multimedia Filters
  15429. @c man begin MULTIMEDIA FILTERS
  15430. Below is a description of the currently available multimedia filters.
  15431. @section abitscope
  15432. Convert input audio to a video output, displaying the audio bit scope.
  15433. The filter accepts the following options:
  15434. @table @option
  15435. @item rate, r
  15436. Set frame rate, expressed as number of frames per second. Default
  15437. value is "25".
  15438. @item size, s
  15439. Specify the video size for the output. For the syntax of this option, check the
  15440. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15441. Default value is @code{1024x256}.
  15442. @item colors
  15443. Specify list of colors separated by space or by '|' which will be used to
  15444. draw channels. Unrecognized or missing colors will be replaced
  15445. by white color.
  15446. @end table
  15447. @section ahistogram
  15448. Convert input audio to a video output, displaying the volume histogram.
  15449. The filter accepts the following options:
  15450. @table @option
  15451. @item dmode
  15452. Specify how histogram is calculated.
  15453. It accepts the following values:
  15454. @table @samp
  15455. @item single
  15456. Use single histogram for all channels.
  15457. @item separate
  15458. Use separate histogram for each channel.
  15459. @end table
  15460. Default is @code{single}.
  15461. @item rate, r
  15462. Set frame rate, expressed as number of frames per second. Default
  15463. value is "25".
  15464. @item size, s
  15465. Specify the video size for the output. For the syntax of this option, check the
  15466. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15467. Default value is @code{hd720}.
  15468. @item scale
  15469. Set display scale.
  15470. It accepts the following values:
  15471. @table @samp
  15472. @item log
  15473. logarithmic
  15474. @item sqrt
  15475. square root
  15476. @item cbrt
  15477. cubic root
  15478. @item lin
  15479. linear
  15480. @item rlog
  15481. reverse logarithmic
  15482. @end table
  15483. Default is @code{log}.
  15484. @item ascale
  15485. Set amplitude scale.
  15486. It accepts the following values:
  15487. @table @samp
  15488. @item log
  15489. logarithmic
  15490. @item lin
  15491. linear
  15492. @end table
  15493. Default is @code{log}.
  15494. @item acount
  15495. Set how much frames to accumulate in histogram.
  15496. Default is 1. Setting this to -1 accumulates all frames.
  15497. @item rheight
  15498. Set histogram ratio of window height.
  15499. @item slide
  15500. Set sonogram sliding.
  15501. It accepts the following values:
  15502. @table @samp
  15503. @item replace
  15504. replace old rows with new ones.
  15505. @item scroll
  15506. scroll from top to bottom.
  15507. @end table
  15508. Default is @code{replace}.
  15509. @end table
  15510. @section aphasemeter
  15511. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  15512. representing mean phase of current audio frame. A video output can also be produced and is
  15513. enabled by default. The audio is passed through as first output.
  15514. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  15515. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  15516. and @code{1} means channels are in phase.
  15517. The filter accepts the following options, all related to its video output:
  15518. @table @option
  15519. @item rate, r
  15520. Set the output frame rate. Default value is @code{25}.
  15521. @item size, s
  15522. Set the video size for the output. For the syntax of this option, check the
  15523. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15524. Default value is @code{800x400}.
  15525. @item rc
  15526. @item gc
  15527. @item bc
  15528. Specify the red, green, blue contrast. Default values are @code{2},
  15529. @code{7} and @code{1}.
  15530. Allowed range is @code{[0, 255]}.
  15531. @item mpc
  15532. Set color which will be used for drawing median phase. If color is
  15533. @code{none} which is default, no median phase value will be drawn.
  15534. @item video
  15535. Enable video output. Default is enabled.
  15536. @end table
  15537. @section avectorscope
  15538. Convert input audio to a video output, representing the audio vector
  15539. scope.
  15540. The filter is used to measure the difference between channels of stereo
  15541. audio stream. A monoaural signal, consisting of identical left and right
  15542. signal, results in straight vertical line. Any stereo separation is visible
  15543. as a deviation from this line, creating a Lissajous figure.
  15544. If the straight (or deviation from it) but horizontal line appears this
  15545. indicates that the left and right channels are out of phase.
  15546. The filter accepts the following options:
  15547. @table @option
  15548. @item mode, m
  15549. Set the vectorscope mode.
  15550. Available values are:
  15551. @table @samp
  15552. @item lissajous
  15553. Lissajous rotated by 45 degrees.
  15554. @item lissajous_xy
  15555. Same as above but not rotated.
  15556. @item polar
  15557. Shape resembling half of circle.
  15558. @end table
  15559. Default value is @samp{lissajous}.
  15560. @item size, s
  15561. Set the video size for the output. For the syntax of this option, check the
  15562. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15563. Default value is @code{400x400}.
  15564. @item rate, r
  15565. Set the output frame rate. Default value is @code{25}.
  15566. @item rc
  15567. @item gc
  15568. @item bc
  15569. @item ac
  15570. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  15571. @code{160}, @code{80} and @code{255}.
  15572. Allowed range is @code{[0, 255]}.
  15573. @item rf
  15574. @item gf
  15575. @item bf
  15576. @item af
  15577. Specify the red, green, blue and alpha fade. Default values are @code{15},
  15578. @code{10}, @code{5} and @code{5}.
  15579. Allowed range is @code{[0, 255]}.
  15580. @item zoom
  15581. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  15582. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  15583. @item draw
  15584. Set the vectorscope drawing mode.
  15585. Available values are:
  15586. @table @samp
  15587. @item dot
  15588. Draw dot for each sample.
  15589. @item line
  15590. Draw line between previous and current sample.
  15591. @end table
  15592. Default value is @samp{dot}.
  15593. @item scale
  15594. Specify amplitude scale of audio samples.
  15595. Available values are:
  15596. @table @samp
  15597. @item lin
  15598. Linear.
  15599. @item sqrt
  15600. Square root.
  15601. @item cbrt
  15602. Cubic root.
  15603. @item log
  15604. Logarithmic.
  15605. @end table
  15606. @item swap
  15607. Swap left channel axis with right channel axis.
  15608. @item mirror
  15609. Mirror axis.
  15610. @table @samp
  15611. @item none
  15612. No mirror.
  15613. @item x
  15614. Mirror only x axis.
  15615. @item y
  15616. Mirror only y axis.
  15617. @item xy
  15618. Mirror both axis.
  15619. @end table
  15620. @end table
  15621. @subsection Examples
  15622. @itemize
  15623. @item
  15624. Complete example using @command{ffplay}:
  15625. @example
  15626. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15627. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  15628. @end example
  15629. @end itemize
  15630. @section bench, abench
  15631. Benchmark part of a filtergraph.
  15632. The filter accepts the following options:
  15633. @table @option
  15634. @item action
  15635. Start or stop a timer.
  15636. Available values are:
  15637. @table @samp
  15638. @item start
  15639. Get the current time, set it as frame metadata (using the key
  15640. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  15641. @item stop
  15642. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  15643. the input frame metadata to get the time difference. Time difference, average,
  15644. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  15645. @code{min}) are then printed. The timestamps are expressed in seconds.
  15646. @end table
  15647. @end table
  15648. @subsection Examples
  15649. @itemize
  15650. @item
  15651. Benchmark @ref{selectivecolor} filter:
  15652. @example
  15653. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  15654. @end example
  15655. @end itemize
  15656. @section concat
  15657. Concatenate audio and video streams, joining them together one after the
  15658. other.
  15659. The filter works on segments of synchronized video and audio streams. All
  15660. segments must have the same number of streams of each type, and that will
  15661. also be the number of streams at output.
  15662. The filter accepts the following options:
  15663. @table @option
  15664. @item n
  15665. Set the number of segments. Default is 2.
  15666. @item v
  15667. Set the number of output video streams, that is also the number of video
  15668. streams in each segment. Default is 1.
  15669. @item a
  15670. Set the number of output audio streams, that is also the number of audio
  15671. streams in each segment. Default is 0.
  15672. @item unsafe
  15673. Activate unsafe mode: do not fail if segments have a different format.
  15674. @end table
  15675. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  15676. @var{a} audio outputs.
  15677. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  15678. segment, in the same order as the outputs, then the inputs for the second
  15679. segment, etc.
  15680. Related streams do not always have exactly the same duration, for various
  15681. reasons including codec frame size or sloppy authoring. For that reason,
  15682. related synchronized streams (e.g. a video and its audio track) should be
  15683. concatenated at once. The concat filter will use the duration of the longest
  15684. stream in each segment (except the last one), and if necessary pad shorter
  15685. audio streams with silence.
  15686. For this filter to work correctly, all segments must start at timestamp 0.
  15687. All corresponding streams must have the same parameters in all segments; the
  15688. filtering system will automatically select a common pixel format for video
  15689. streams, and a common sample format, sample rate and channel layout for
  15690. audio streams, but other settings, such as resolution, must be converted
  15691. explicitly by the user.
  15692. Different frame rates are acceptable but will result in variable frame rate
  15693. at output; be sure to configure the output file to handle it.
  15694. @subsection Examples
  15695. @itemize
  15696. @item
  15697. Concatenate an opening, an episode and an ending, all in bilingual version
  15698. (video in stream 0, audio in streams 1 and 2):
  15699. @example
  15700. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  15701. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  15702. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  15703. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  15704. @end example
  15705. @item
  15706. Concatenate two parts, handling audio and video separately, using the
  15707. (a)movie sources, and adjusting the resolution:
  15708. @example
  15709. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  15710. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  15711. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  15712. @end example
  15713. Note that a desync will happen at the stitch if the audio and video streams
  15714. do not have exactly the same duration in the first file.
  15715. @end itemize
  15716. @subsection Commands
  15717. This filter supports the following commands:
  15718. @table @option
  15719. @item next
  15720. Close the current segment and step to the next one
  15721. @end table
  15722. @section drawgraph, adrawgraph
  15723. Draw a graph using input video or audio metadata.
  15724. It accepts the following parameters:
  15725. @table @option
  15726. @item m1
  15727. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  15728. @item fg1
  15729. Set 1st foreground color expression.
  15730. @item m2
  15731. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  15732. @item fg2
  15733. Set 2nd foreground color expression.
  15734. @item m3
  15735. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  15736. @item fg3
  15737. Set 3rd foreground color expression.
  15738. @item m4
  15739. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  15740. @item fg4
  15741. Set 4th foreground color expression.
  15742. @item min
  15743. Set minimal value of metadata value.
  15744. @item max
  15745. Set maximal value of metadata value.
  15746. @item bg
  15747. Set graph background color. Default is white.
  15748. @item mode
  15749. Set graph mode.
  15750. Available values for mode is:
  15751. @table @samp
  15752. @item bar
  15753. @item dot
  15754. @item line
  15755. @end table
  15756. Default is @code{line}.
  15757. @item slide
  15758. Set slide mode.
  15759. Available values for slide is:
  15760. @table @samp
  15761. @item frame
  15762. Draw new frame when right border is reached.
  15763. @item replace
  15764. Replace old columns with new ones.
  15765. @item scroll
  15766. Scroll from right to left.
  15767. @item rscroll
  15768. Scroll from left to right.
  15769. @item picture
  15770. Draw single picture.
  15771. @end table
  15772. Default is @code{frame}.
  15773. @item size
  15774. Set size of graph video. For the syntax of this option, check the
  15775. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15776. The default value is @code{900x256}.
  15777. The foreground color expressions can use the following variables:
  15778. @table @option
  15779. @item MIN
  15780. Minimal value of metadata value.
  15781. @item MAX
  15782. Maximal value of metadata value.
  15783. @item VAL
  15784. Current metadata key value.
  15785. @end table
  15786. The color is defined as 0xAABBGGRR.
  15787. @end table
  15788. Example using metadata from @ref{signalstats} filter:
  15789. @example
  15790. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  15791. @end example
  15792. Example using metadata from @ref{ebur128} filter:
  15793. @example
  15794. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  15795. @end example
  15796. @anchor{ebur128}
  15797. @section ebur128
  15798. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  15799. level. By default, it logs a message at a frequency of 10Hz with the
  15800. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  15801. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  15802. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  15803. sample format is double-precision floating point. The input stream will be converted to
  15804. this specification, if needed. Users may need to insert aformat and/or aresample filters
  15805. after this filter to obtain the original parameters.
  15806. The filter also has a video output (see the @var{video} option) with a real
  15807. time graph to observe the loudness evolution. The graphic contains the logged
  15808. message mentioned above, so it is not printed anymore when this option is set,
  15809. unless the verbose logging is set. The main graphing area contains the
  15810. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  15811. the momentary loudness (400 milliseconds), but can optionally be configured
  15812. to instead display short-term loudness (see @var{gauge}).
  15813. The green area marks a +/- 1LU target range around the target loudness
  15814. (-23LUFS by default, unless modified through @var{target}).
  15815. More information about the Loudness Recommendation EBU R128 on
  15816. @url{http://tech.ebu.ch/loudness}.
  15817. The filter accepts the following options:
  15818. @table @option
  15819. @item video
  15820. Activate the video output. The audio stream is passed unchanged whether this
  15821. option is set or no. The video stream will be the first output stream if
  15822. activated. Default is @code{0}.
  15823. @item size
  15824. Set the video size. This option is for video only. For the syntax of this
  15825. option, check the
  15826. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15827. Default and minimum resolution is @code{640x480}.
  15828. @item meter
  15829. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  15830. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  15831. other integer value between this range is allowed.
  15832. @item metadata
  15833. Set metadata injection. If set to @code{1}, the audio input will be segmented
  15834. into 100ms output frames, each of them containing various loudness information
  15835. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  15836. Default is @code{0}.
  15837. @item framelog
  15838. Force the frame logging level.
  15839. Available values are:
  15840. @table @samp
  15841. @item info
  15842. information logging level
  15843. @item verbose
  15844. verbose logging level
  15845. @end table
  15846. By default, the logging level is set to @var{info}. If the @option{video} or
  15847. the @option{metadata} options are set, it switches to @var{verbose}.
  15848. @item peak
  15849. Set peak mode(s).
  15850. Available modes can be cumulated (the option is a @code{flag} type). Possible
  15851. values are:
  15852. @table @samp
  15853. @item none
  15854. Disable any peak mode (default).
  15855. @item sample
  15856. Enable sample-peak mode.
  15857. Simple peak mode looking for the higher sample value. It logs a message
  15858. for sample-peak (identified by @code{SPK}).
  15859. @item true
  15860. Enable true-peak mode.
  15861. If enabled, the peak lookup is done on an over-sampled version of the input
  15862. stream for better peak accuracy. It logs a message for true-peak.
  15863. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  15864. This mode requires a build with @code{libswresample}.
  15865. @end table
  15866. @item dualmono
  15867. Treat mono input files as "dual mono". If a mono file is intended for playback
  15868. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  15869. If set to @code{true}, this option will compensate for this effect.
  15870. Multi-channel input files are not affected by this option.
  15871. @item panlaw
  15872. Set a specific pan law to be used for the measurement of dual mono files.
  15873. This parameter is optional, and has a default value of -3.01dB.
  15874. @item target
  15875. Set a specific target level (in LUFS) used as relative zero in the visualization.
  15876. This parameter is optional and has a default value of -23LUFS as specified
  15877. by EBU R128. However, material published online may prefer a level of -16LUFS
  15878. (e.g. for use with podcasts or video platforms).
  15879. @item gauge
  15880. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  15881. @code{shortterm}. By default the momentary value will be used, but in certain
  15882. scenarios it may be more useful to observe the short term value instead (e.g.
  15883. live mixing).
  15884. @item scale
  15885. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  15886. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  15887. video output, not the summary or continuous log output.
  15888. @end table
  15889. @subsection Examples
  15890. @itemize
  15891. @item
  15892. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  15893. @example
  15894. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  15895. @end example
  15896. @item
  15897. Run an analysis with @command{ffmpeg}:
  15898. @example
  15899. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  15900. @end example
  15901. @end itemize
  15902. @section interleave, ainterleave
  15903. Temporally interleave frames from several inputs.
  15904. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  15905. These filters read frames from several inputs and send the oldest
  15906. queued frame to the output.
  15907. Input streams must have well defined, monotonically increasing frame
  15908. timestamp values.
  15909. In order to submit one frame to output, these filters need to enqueue
  15910. at least one frame for each input, so they cannot work in case one
  15911. input is not yet terminated and will not receive incoming frames.
  15912. For example consider the case when one input is a @code{select} filter
  15913. which always drops input frames. The @code{interleave} filter will keep
  15914. reading from that input, but it will never be able to send new frames
  15915. to output until the input sends an end-of-stream signal.
  15916. Also, depending on inputs synchronization, the filters will drop
  15917. frames in case one input receives more frames than the other ones, and
  15918. the queue is already filled.
  15919. These filters accept the following options:
  15920. @table @option
  15921. @item nb_inputs, n
  15922. Set the number of different inputs, it is 2 by default.
  15923. @end table
  15924. @subsection Examples
  15925. @itemize
  15926. @item
  15927. Interleave frames belonging to different streams using @command{ffmpeg}:
  15928. @example
  15929. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  15930. @end example
  15931. @item
  15932. Add flickering blur effect:
  15933. @example
  15934. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  15935. @end example
  15936. @end itemize
  15937. @section metadata, ametadata
  15938. Manipulate frame metadata.
  15939. This filter accepts the following options:
  15940. @table @option
  15941. @item mode
  15942. Set mode of operation of the filter.
  15943. Can be one of the following:
  15944. @table @samp
  15945. @item select
  15946. If both @code{value} and @code{key} is set, select frames
  15947. which have such metadata. If only @code{key} is set, select
  15948. every frame that has such key in metadata.
  15949. @item add
  15950. Add new metadata @code{key} and @code{value}. If key is already available
  15951. do nothing.
  15952. @item modify
  15953. Modify value of already present key.
  15954. @item delete
  15955. If @code{value} is set, delete only keys that have such value.
  15956. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  15957. the frame.
  15958. @item print
  15959. Print key and its value if metadata was found. If @code{key} is not set print all
  15960. metadata values available in frame.
  15961. @end table
  15962. @item key
  15963. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  15964. @item value
  15965. Set metadata value which will be used. This option is mandatory for
  15966. @code{modify} and @code{add} mode.
  15967. @item function
  15968. Which function to use when comparing metadata value and @code{value}.
  15969. Can be one of following:
  15970. @table @samp
  15971. @item same_str
  15972. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  15973. @item starts_with
  15974. Values are interpreted as strings, returns true if metadata value starts with
  15975. the @code{value} option string.
  15976. @item less
  15977. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  15978. @item equal
  15979. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  15980. @item greater
  15981. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  15982. @item expr
  15983. Values are interpreted as floats, returns true if expression from option @code{expr}
  15984. evaluates to true.
  15985. @end table
  15986. @item expr
  15987. Set expression which is used when @code{function} is set to @code{expr}.
  15988. The expression is evaluated through the eval API and can contain the following
  15989. constants:
  15990. @table @option
  15991. @item VALUE1
  15992. Float representation of @code{value} from metadata key.
  15993. @item VALUE2
  15994. Float representation of @code{value} as supplied by user in @code{value} option.
  15995. @end table
  15996. @item file
  15997. If specified in @code{print} mode, output is written to the named file. Instead of
  15998. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  15999. for standard output. If @code{file} option is not set, output is written to the log
  16000. with AV_LOG_INFO loglevel.
  16001. @end table
  16002. @subsection Examples
  16003. @itemize
  16004. @item
  16005. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  16006. between 0 and 1.
  16007. @example
  16008. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  16009. @end example
  16010. @item
  16011. Print silencedetect output to file @file{metadata.txt}.
  16012. @example
  16013. silencedetect,ametadata=mode=print:file=metadata.txt
  16014. @end example
  16015. @item
  16016. Direct all metadata to a pipe with file descriptor 4.
  16017. @example
  16018. metadata=mode=print:file='pipe\:4'
  16019. @end example
  16020. @end itemize
  16021. @section perms, aperms
  16022. Set read/write permissions for the output frames.
  16023. These filters are mainly aimed at developers to test direct path in the
  16024. following filter in the filtergraph.
  16025. The filters accept the following options:
  16026. @table @option
  16027. @item mode
  16028. Select the permissions mode.
  16029. It accepts the following values:
  16030. @table @samp
  16031. @item none
  16032. Do nothing. This is the default.
  16033. @item ro
  16034. Set all the output frames read-only.
  16035. @item rw
  16036. Set all the output frames directly writable.
  16037. @item toggle
  16038. Make the frame read-only if writable, and writable if read-only.
  16039. @item random
  16040. Set each output frame read-only or writable randomly.
  16041. @end table
  16042. @item seed
  16043. Set the seed for the @var{random} mode, must be an integer included between
  16044. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  16045. @code{-1}, the filter will try to use a good random seed on a best effort
  16046. basis.
  16047. @end table
  16048. Note: in case of auto-inserted filter between the permission filter and the
  16049. following one, the permission might not be received as expected in that
  16050. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  16051. perms/aperms filter can avoid this problem.
  16052. @section realtime, arealtime
  16053. Slow down filtering to match real time approximately.
  16054. These filters will pause the filtering for a variable amount of time to
  16055. match the output rate with the input timestamps.
  16056. They are similar to the @option{re} option to @code{ffmpeg}.
  16057. They accept the following options:
  16058. @table @option
  16059. @item limit
  16060. Time limit for the pauses. Any pause longer than that will be considered
  16061. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  16062. @end table
  16063. @anchor{select}
  16064. @section select, aselect
  16065. Select frames to pass in output.
  16066. This filter accepts the following options:
  16067. @table @option
  16068. @item expr, e
  16069. Set expression, which is evaluated for each input frame.
  16070. If the expression is evaluated to zero, the frame is discarded.
  16071. If the evaluation result is negative or NaN, the frame is sent to the
  16072. first output; otherwise it is sent to the output with index
  16073. @code{ceil(val)-1}, assuming that the input index starts from 0.
  16074. For example a value of @code{1.2} corresponds to the output with index
  16075. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  16076. @item outputs, n
  16077. Set the number of outputs. The output to which to send the selected
  16078. frame is based on the result of the evaluation. Default value is 1.
  16079. @end table
  16080. The expression can contain the following constants:
  16081. @table @option
  16082. @item n
  16083. The (sequential) number of the filtered frame, starting from 0.
  16084. @item selected_n
  16085. The (sequential) number of the selected frame, starting from 0.
  16086. @item prev_selected_n
  16087. The sequential number of the last selected frame. It's NAN if undefined.
  16088. @item TB
  16089. The timebase of the input timestamps.
  16090. @item pts
  16091. The PTS (Presentation TimeStamp) of the filtered video frame,
  16092. expressed in @var{TB} units. It's NAN if undefined.
  16093. @item t
  16094. The PTS of the filtered video frame,
  16095. expressed in seconds. It's NAN if undefined.
  16096. @item prev_pts
  16097. The PTS of the previously filtered video frame. It's NAN if undefined.
  16098. @item prev_selected_pts
  16099. The PTS of the last previously filtered video frame. It's NAN if undefined.
  16100. @item prev_selected_t
  16101. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  16102. @item start_pts
  16103. The PTS of the first video frame in the video. It's NAN if undefined.
  16104. @item start_t
  16105. The time of the first video frame in the video. It's NAN if undefined.
  16106. @item pict_type @emph{(video only)}
  16107. The type of the filtered frame. It can assume one of the following
  16108. values:
  16109. @table @option
  16110. @item I
  16111. @item P
  16112. @item B
  16113. @item S
  16114. @item SI
  16115. @item SP
  16116. @item BI
  16117. @end table
  16118. @item interlace_type @emph{(video only)}
  16119. The frame interlace type. It can assume one of the following values:
  16120. @table @option
  16121. @item PROGRESSIVE
  16122. The frame is progressive (not interlaced).
  16123. @item TOPFIRST
  16124. The frame is top-field-first.
  16125. @item BOTTOMFIRST
  16126. The frame is bottom-field-first.
  16127. @end table
  16128. @item consumed_sample_n @emph{(audio only)}
  16129. the number of selected samples before the current frame
  16130. @item samples_n @emph{(audio only)}
  16131. the number of samples in the current frame
  16132. @item sample_rate @emph{(audio only)}
  16133. the input sample rate
  16134. @item key
  16135. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  16136. @item pos
  16137. the position in the file of the filtered frame, -1 if the information
  16138. is not available (e.g. for synthetic video)
  16139. @item scene @emph{(video only)}
  16140. value between 0 and 1 to indicate a new scene; a low value reflects a low
  16141. probability for the current frame to introduce a new scene, while a higher
  16142. value means the current frame is more likely to be one (see the example below)
  16143. @item concatdec_select
  16144. The concat demuxer can select only part of a concat input file by setting an
  16145. inpoint and an outpoint, but the output packets may not be entirely contained
  16146. in the selected interval. By using this variable, it is possible to skip frames
  16147. generated by the concat demuxer which are not exactly contained in the selected
  16148. interval.
  16149. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  16150. and the @var{lavf.concat.duration} packet metadata values which are also
  16151. present in the decoded frames.
  16152. The @var{concatdec_select} variable is -1 if the frame pts is at least
  16153. start_time and either the duration metadata is missing or the frame pts is less
  16154. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  16155. missing.
  16156. That basically means that an input frame is selected if its pts is within the
  16157. interval set by the concat demuxer.
  16158. @end table
  16159. The default value of the select expression is "1".
  16160. @subsection Examples
  16161. @itemize
  16162. @item
  16163. Select all frames in input:
  16164. @example
  16165. select
  16166. @end example
  16167. The example above is the same as:
  16168. @example
  16169. select=1
  16170. @end example
  16171. @item
  16172. Skip all frames:
  16173. @example
  16174. select=0
  16175. @end example
  16176. @item
  16177. Select only I-frames:
  16178. @example
  16179. select='eq(pict_type\,I)'
  16180. @end example
  16181. @item
  16182. Select one frame every 100:
  16183. @example
  16184. select='not(mod(n\,100))'
  16185. @end example
  16186. @item
  16187. Select only frames contained in the 10-20 time interval:
  16188. @example
  16189. select=between(t\,10\,20)
  16190. @end example
  16191. @item
  16192. Select only I-frames contained in the 10-20 time interval:
  16193. @example
  16194. select=between(t\,10\,20)*eq(pict_type\,I)
  16195. @end example
  16196. @item
  16197. Select frames with a minimum distance of 10 seconds:
  16198. @example
  16199. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  16200. @end example
  16201. @item
  16202. Use aselect to select only audio frames with samples number > 100:
  16203. @example
  16204. aselect='gt(samples_n\,100)'
  16205. @end example
  16206. @item
  16207. Create a mosaic of the first scenes:
  16208. @example
  16209. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  16210. @end example
  16211. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  16212. choice.
  16213. @item
  16214. Send even and odd frames to separate outputs, and compose them:
  16215. @example
  16216. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  16217. @end example
  16218. @item
  16219. Select useful frames from an ffconcat file which is using inpoints and
  16220. outpoints but where the source files are not intra frame only.
  16221. @example
  16222. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  16223. @end example
  16224. @end itemize
  16225. @section sendcmd, asendcmd
  16226. Send commands to filters in the filtergraph.
  16227. These filters read commands to be sent to other filters in the
  16228. filtergraph.
  16229. @code{sendcmd} must be inserted between two video filters,
  16230. @code{asendcmd} must be inserted between two audio filters, but apart
  16231. from that they act the same way.
  16232. The specification of commands can be provided in the filter arguments
  16233. with the @var{commands} option, or in a file specified by the
  16234. @var{filename} option.
  16235. These filters accept the following options:
  16236. @table @option
  16237. @item commands, c
  16238. Set the commands to be read and sent to the other filters.
  16239. @item filename, f
  16240. Set the filename of the commands to be read and sent to the other
  16241. filters.
  16242. @end table
  16243. @subsection Commands syntax
  16244. A commands description consists of a sequence of interval
  16245. specifications, comprising a list of commands to be executed when a
  16246. particular event related to that interval occurs. The occurring event
  16247. is typically the current frame time entering or leaving a given time
  16248. interval.
  16249. An interval is specified by the following syntax:
  16250. @example
  16251. @var{START}[-@var{END}] @var{COMMANDS};
  16252. @end example
  16253. The time interval is specified by the @var{START} and @var{END} times.
  16254. @var{END} is optional and defaults to the maximum time.
  16255. The current frame time is considered within the specified interval if
  16256. it is included in the interval [@var{START}, @var{END}), that is when
  16257. the time is greater or equal to @var{START} and is lesser than
  16258. @var{END}.
  16259. @var{COMMANDS} consists of a sequence of one or more command
  16260. specifications, separated by ",", relating to that interval. The
  16261. syntax of a command specification is given by:
  16262. @example
  16263. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  16264. @end example
  16265. @var{FLAGS} is optional and specifies the type of events relating to
  16266. the time interval which enable sending the specified command, and must
  16267. be a non-null sequence of identifier flags separated by "+" or "|" and
  16268. enclosed between "[" and "]".
  16269. The following flags are recognized:
  16270. @table @option
  16271. @item enter
  16272. The command is sent when the current frame timestamp enters the
  16273. specified interval. In other words, the command is sent when the
  16274. previous frame timestamp was not in the given interval, and the
  16275. current is.
  16276. @item leave
  16277. The command is sent when the current frame timestamp leaves the
  16278. specified interval. In other words, the command is sent when the
  16279. previous frame timestamp was in the given interval, and the
  16280. current is not.
  16281. @end table
  16282. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  16283. assumed.
  16284. @var{TARGET} specifies the target of the command, usually the name of
  16285. the filter class or a specific filter instance name.
  16286. @var{COMMAND} specifies the name of the command for the target filter.
  16287. @var{ARG} is optional and specifies the optional list of argument for
  16288. the given @var{COMMAND}.
  16289. Between one interval specification and another, whitespaces, or
  16290. sequences of characters starting with @code{#} until the end of line,
  16291. are ignored and can be used to annotate comments.
  16292. A simplified BNF description of the commands specification syntax
  16293. follows:
  16294. @example
  16295. @var{COMMAND_FLAG} ::= "enter" | "leave"
  16296. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  16297. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  16298. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  16299. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  16300. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  16301. @end example
  16302. @subsection Examples
  16303. @itemize
  16304. @item
  16305. Specify audio tempo change at second 4:
  16306. @example
  16307. asendcmd=c='4.0 atempo tempo 1.5',atempo
  16308. @end example
  16309. @item
  16310. Target a specific filter instance:
  16311. @example
  16312. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  16313. @end example
  16314. @item
  16315. Specify a list of drawtext and hue commands in a file.
  16316. @example
  16317. # show text in the interval 5-10
  16318. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  16319. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  16320. # desaturate the image in the interval 15-20
  16321. 15.0-20.0 [enter] hue s 0,
  16322. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  16323. [leave] hue s 1,
  16324. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  16325. # apply an exponential saturation fade-out effect, starting from time 25
  16326. 25 [enter] hue s exp(25-t)
  16327. @end example
  16328. A filtergraph allowing to read and process the above command list
  16329. stored in a file @file{test.cmd}, can be specified with:
  16330. @example
  16331. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  16332. @end example
  16333. @end itemize
  16334. @anchor{setpts}
  16335. @section setpts, asetpts
  16336. Change the PTS (presentation timestamp) of the input frames.
  16337. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  16338. This filter accepts the following options:
  16339. @table @option
  16340. @item expr
  16341. The expression which is evaluated for each frame to construct its timestamp.
  16342. @end table
  16343. The expression is evaluated through the eval API and can contain the following
  16344. constants:
  16345. @table @option
  16346. @item FRAME_RATE, FR
  16347. frame rate, only defined for constant frame-rate video
  16348. @item PTS
  16349. The presentation timestamp in input
  16350. @item N
  16351. The count of the input frame for video or the number of consumed samples,
  16352. not including the current frame for audio, starting from 0.
  16353. @item NB_CONSUMED_SAMPLES
  16354. The number of consumed samples, not including the current frame (only
  16355. audio)
  16356. @item NB_SAMPLES, S
  16357. The number of samples in the current frame (only audio)
  16358. @item SAMPLE_RATE, SR
  16359. The audio sample rate.
  16360. @item STARTPTS
  16361. The PTS of the first frame.
  16362. @item STARTT
  16363. the time in seconds of the first frame
  16364. @item INTERLACED
  16365. State whether the current frame is interlaced.
  16366. @item T
  16367. the time in seconds of the current frame
  16368. @item POS
  16369. original position in the file of the frame, or undefined if undefined
  16370. for the current frame
  16371. @item PREV_INPTS
  16372. The previous input PTS.
  16373. @item PREV_INT
  16374. previous input time in seconds
  16375. @item PREV_OUTPTS
  16376. The previous output PTS.
  16377. @item PREV_OUTT
  16378. previous output time in seconds
  16379. @item RTCTIME
  16380. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  16381. instead.
  16382. @item RTCSTART
  16383. The wallclock (RTC) time at the start of the movie in microseconds.
  16384. @item TB
  16385. The timebase of the input timestamps.
  16386. @end table
  16387. @subsection Examples
  16388. @itemize
  16389. @item
  16390. Start counting PTS from zero
  16391. @example
  16392. setpts=PTS-STARTPTS
  16393. @end example
  16394. @item
  16395. Apply fast motion effect:
  16396. @example
  16397. setpts=0.5*PTS
  16398. @end example
  16399. @item
  16400. Apply slow motion effect:
  16401. @example
  16402. setpts=2.0*PTS
  16403. @end example
  16404. @item
  16405. Set fixed rate of 25 frames per second:
  16406. @example
  16407. setpts=N/(25*TB)
  16408. @end example
  16409. @item
  16410. Set fixed rate 25 fps with some jitter:
  16411. @example
  16412. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  16413. @end example
  16414. @item
  16415. Apply an offset of 10 seconds to the input PTS:
  16416. @example
  16417. setpts=PTS+10/TB
  16418. @end example
  16419. @item
  16420. Generate timestamps from a "live source" and rebase onto the current timebase:
  16421. @example
  16422. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  16423. @end example
  16424. @item
  16425. Generate timestamps by counting samples:
  16426. @example
  16427. asetpts=N/SR/TB
  16428. @end example
  16429. @end itemize
  16430. @section setrange
  16431. Force color range for the output video frame.
  16432. The @code{setrange} filter marks the color range property for the
  16433. output frames. It does not change the input frame, but only sets the
  16434. corresponding property, which affects how the frame is treated by
  16435. following filters.
  16436. The filter accepts the following options:
  16437. @table @option
  16438. @item range
  16439. Available values are:
  16440. @table @samp
  16441. @item auto
  16442. Keep the same color range property.
  16443. @item unspecified, unknown
  16444. Set the color range as unspecified.
  16445. @item limited, tv, mpeg
  16446. Set the color range as limited.
  16447. @item full, pc, jpeg
  16448. Set the color range as full.
  16449. @end table
  16450. @end table
  16451. @section settb, asettb
  16452. Set the timebase to use for the output frames timestamps.
  16453. It is mainly useful for testing timebase configuration.
  16454. It accepts the following parameters:
  16455. @table @option
  16456. @item expr, tb
  16457. The expression which is evaluated into the output timebase.
  16458. @end table
  16459. The value for @option{tb} is an arithmetic expression representing a
  16460. rational. The expression can contain the constants "AVTB" (the default
  16461. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  16462. audio only). Default value is "intb".
  16463. @subsection Examples
  16464. @itemize
  16465. @item
  16466. Set the timebase to 1/25:
  16467. @example
  16468. settb=expr=1/25
  16469. @end example
  16470. @item
  16471. Set the timebase to 1/10:
  16472. @example
  16473. settb=expr=0.1
  16474. @end example
  16475. @item
  16476. Set the timebase to 1001/1000:
  16477. @example
  16478. settb=1+0.001
  16479. @end example
  16480. @item
  16481. Set the timebase to 2*intb:
  16482. @example
  16483. settb=2*intb
  16484. @end example
  16485. @item
  16486. Set the default timebase value:
  16487. @example
  16488. settb=AVTB
  16489. @end example
  16490. @end itemize
  16491. @section showcqt
  16492. Convert input audio to a video output representing frequency spectrum
  16493. logarithmically using Brown-Puckette constant Q transform algorithm with
  16494. direct frequency domain coefficient calculation (but the transform itself
  16495. is not really constant Q, instead the Q factor is actually variable/clamped),
  16496. with musical tone scale, from E0 to D#10.
  16497. The filter accepts the following options:
  16498. @table @option
  16499. @item size, s
  16500. Specify the video size for the output. It must be even. For the syntax of this option,
  16501. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16502. Default value is @code{1920x1080}.
  16503. @item fps, rate, r
  16504. Set the output frame rate. Default value is @code{25}.
  16505. @item bar_h
  16506. Set the bargraph height. It must be even. Default value is @code{-1} which
  16507. computes the bargraph height automatically.
  16508. @item axis_h
  16509. Set the axis height. It must be even. Default value is @code{-1} which computes
  16510. the axis height automatically.
  16511. @item sono_h
  16512. Set the sonogram height. It must be even. Default value is @code{-1} which
  16513. computes the sonogram height automatically.
  16514. @item fullhd
  16515. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  16516. instead. Default value is @code{1}.
  16517. @item sono_v, volume
  16518. Specify the sonogram volume expression. It can contain variables:
  16519. @table @option
  16520. @item bar_v
  16521. the @var{bar_v} evaluated expression
  16522. @item frequency, freq, f
  16523. the frequency where it is evaluated
  16524. @item timeclamp, tc
  16525. the value of @var{timeclamp} option
  16526. @end table
  16527. and functions:
  16528. @table @option
  16529. @item a_weighting(f)
  16530. A-weighting of equal loudness
  16531. @item b_weighting(f)
  16532. B-weighting of equal loudness
  16533. @item c_weighting(f)
  16534. C-weighting of equal loudness.
  16535. @end table
  16536. Default value is @code{16}.
  16537. @item bar_v, volume2
  16538. Specify the bargraph volume expression. It can contain variables:
  16539. @table @option
  16540. @item sono_v
  16541. the @var{sono_v} evaluated expression
  16542. @item frequency, freq, f
  16543. the frequency where it is evaluated
  16544. @item timeclamp, tc
  16545. the value of @var{timeclamp} option
  16546. @end table
  16547. and functions:
  16548. @table @option
  16549. @item a_weighting(f)
  16550. A-weighting of equal loudness
  16551. @item b_weighting(f)
  16552. B-weighting of equal loudness
  16553. @item c_weighting(f)
  16554. C-weighting of equal loudness.
  16555. @end table
  16556. Default value is @code{sono_v}.
  16557. @item sono_g, gamma
  16558. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  16559. higher gamma makes the spectrum having more range. Default value is @code{3}.
  16560. Acceptable range is @code{[1, 7]}.
  16561. @item bar_g, gamma2
  16562. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  16563. @code{[1, 7]}.
  16564. @item bar_t
  16565. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  16566. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  16567. @item timeclamp, tc
  16568. Specify the transform timeclamp. At low frequency, there is trade-off between
  16569. accuracy in time domain and frequency domain. If timeclamp is lower,
  16570. event in time domain is represented more accurately (such as fast bass drum),
  16571. otherwise event in frequency domain is represented more accurately
  16572. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  16573. @item attack
  16574. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  16575. limits future samples by applying asymmetric windowing in time domain, useful
  16576. when low latency is required. Accepted range is @code{[0, 1]}.
  16577. @item basefreq
  16578. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  16579. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  16580. @item endfreq
  16581. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  16582. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  16583. @item coeffclamp
  16584. This option is deprecated and ignored.
  16585. @item tlength
  16586. Specify the transform length in time domain. Use this option to control accuracy
  16587. trade-off between time domain and frequency domain at every frequency sample.
  16588. It can contain variables:
  16589. @table @option
  16590. @item frequency, freq, f
  16591. the frequency where it is evaluated
  16592. @item timeclamp, tc
  16593. the value of @var{timeclamp} option.
  16594. @end table
  16595. Default value is @code{384*tc/(384+tc*f)}.
  16596. @item count
  16597. Specify the transform count for every video frame. Default value is @code{6}.
  16598. Acceptable range is @code{[1, 30]}.
  16599. @item fcount
  16600. Specify the transform count for every single pixel. Default value is @code{0},
  16601. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  16602. @item fontfile
  16603. Specify font file for use with freetype to draw the axis. If not specified,
  16604. use embedded font. Note that drawing with font file or embedded font is not
  16605. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  16606. option instead.
  16607. @item font
  16608. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  16609. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  16610. @item fontcolor
  16611. Specify font color expression. This is arithmetic expression that should return
  16612. integer value 0xRRGGBB. It can contain variables:
  16613. @table @option
  16614. @item frequency, freq, f
  16615. the frequency where it is evaluated
  16616. @item timeclamp, tc
  16617. the value of @var{timeclamp} option
  16618. @end table
  16619. and functions:
  16620. @table @option
  16621. @item midi(f)
  16622. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  16623. @item r(x), g(x), b(x)
  16624. red, green, and blue value of intensity x.
  16625. @end table
  16626. Default value is @code{st(0, (midi(f)-59.5)/12);
  16627. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  16628. r(1-ld(1)) + b(ld(1))}.
  16629. @item axisfile
  16630. Specify image file to draw the axis. This option override @var{fontfile} and
  16631. @var{fontcolor} option.
  16632. @item axis, text
  16633. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  16634. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  16635. Default value is @code{1}.
  16636. @item csp
  16637. Set colorspace. The accepted values are:
  16638. @table @samp
  16639. @item unspecified
  16640. Unspecified (default)
  16641. @item bt709
  16642. BT.709
  16643. @item fcc
  16644. FCC
  16645. @item bt470bg
  16646. BT.470BG or BT.601-6 625
  16647. @item smpte170m
  16648. SMPTE-170M or BT.601-6 525
  16649. @item smpte240m
  16650. SMPTE-240M
  16651. @item bt2020ncl
  16652. BT.2020 with non-constant luminance
  16653. @end table
  16654. @item cscheme
  16655. Set spectrogram color scheme. This is list of floating point values with format
  16656. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  16657. The default is @code{1|0.5|0|0|0.5|1}.
  16658. @end table
  16659. @subsection Examples
  16660. @itemize
  16661. @item
  16662. Playing audio while showing the spectrum:
  16663. @example
  16664. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  16665. @end example
  16666. @item
  16667. Same as above, but with frame rate 30 fps:
  16668. @example
  16669. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  16670. @end example
  16671. @item
  16672. Playing at 1280x720:
  16673. @example
  16674. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  16675. @end example
  16676. @item
  16677. Disable sonogram display:
  16678. @example
  16679. sono_h=0
  16680. @end example
  16681. @item
  16682. A1 and its harmonics: A1, A2, (near)E3, A3:
  16683. @example
  16684. ffplay -f lavfi 'aevalsrc=0.1*sin(2*PI*55*t)+0.1*sin(4*PI*55*t)+0.1*sin(6*PI*55*t)+0.1*sin(8*PI*55*t),
  16685. asplit[a][out1]; [a] showcqt [out0]'
  16686. @end example
  16687. @item
  16688. Same as above, but with more accuracy in frequency domain:
  16689. @example
  16690. ffplay -f lavfi 'aevalsrc=0.1*sin(2*PI*55*t)+0.1*sin(4*PI*55*t)+0.1*sin(6*PI*55*t)+0.1*sin(8*PI*55*t),
  16691. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  16692. @end example
  16693. @item
  16694. Custom volume:
  16695. @example
  16696. bar_v=10:sono_v=bar_v*a_weighting(f)
  16697. @end example
  16698. @item
  16699. Custom gamma, now spectrum is linear to the amplitude.
  16700. @example
  16701. bar_g=2:sono_g=2
  16702. @end example
  16703. @item
  16704. Custom tlength equation:
  16705. @example
  16706. tc=0.33:tlength='st(0,0.17); 384*tc / (384 / ld(0) + tc*f /(1-ld(0))) + 384*tc / (tc*f / ld(0) + 384 /(1-ld(0)))'
  16707. @end example
  16708. @item
  16709. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  16710. @example
  16711. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  16712. @end example
  16713. @item
  16714. Custom font using fontconfig:
  16715. @example
  16716. font='Courier New,Monospace,mono|bold'
  16717. @end example
  16718. @item
  16719. Custom frequency range with custom axis using image file:
  16720. @example
  16721. axisfile=myaxis.png:basefreq=40:endfreq=10000
  16722. @end example
  16723. @end itemize
  16724. @section showfreqs
  16725. Convert input audio to video output representing the audio power spectrum.
  16726. Audio amplitude is on Y-axis while frequency is on X-axis.
  16727. The filter accepts the following options:
  16728. @table @option
  16729. @item size, s
  16730. Specify size of video. For the syntax of this option, check the
  16731. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16732. Default is @code{1024x512}.
  16733. @item mode
  16734. Set display mode.
  16735. This set how each frequency bin will be represented.
  16736. It accepts the following values:
  16737. @table @samp
  16738. @item line
  16739. @item bar
  16740. @item dot
  16741. @end table
  16742. Default is @code{bar}.
  16743. @item ascale
  16744. Set amplitude scale.
  16745. It accepts the following values:
  16746. @table @samp
  16747. @item lin
  16748. Linear scale.
  16749. @item sqrt
  16750. Square root scale.
  16751. @item cbrt
  16752. Cubic root scale.
  16753. @item log
  16754. Logarithmic scale.
  16755. @end table
  16756. Default is @code{log}.
  16757. @item fscale
  16758. Set frequency scale.
  16759. It accepts the following values:
  16760. @table @samp
  16761. @item lin
  16762. Linear scale.
  16763. @item log
  16764. Logarithmic scale.
  16765. @item rlog
  16766. Reverse logarithmic scale.
  16767. @end table
  16768. Default is @code{lin}.
  16769. @item win_size
  16770. Set window size.
  16771. It accepts the following values:
  16772. @table @samp
  16773. @item w16
  16774. @item w32
  16775. @item w64
  16776. @item w128
  16777. @item w256
  16778. @item w512
  16779. @item w1024
  16780. @item w2048
  16781. @item w4096
  16782. @item w8192
  16783. @item w16384
  16784. @item w32768
  16785. @item w65536
  16786. @end table
  16787. Default is @code{w2048}
  16788. @item win_func
  16789. Set windowing function.
  16790. It accepts the following values:
  16791. @table @samp
  16792. @item rect
  16793. @item bartlett
  16794. @item hanning
  16795. @item hamming
  16796. @item blackman
  16797. @item welch
  16798. @item flattop
  16799. @item bharris
  16800. @item bnuttall
  16801. @item bhann
  16802. @item sine
  16803. @item nuttall
  16804. @item lanczos
  16805. @item gauss
  16806. @item tukey
  16807. @item dolph
  16808. @item cauchy
  16809. @item parzen
  16810. @item poisson
  16811. @item bohman
  16812. @end table
  16813. Default is @code{hanning}.
  16814. @item overlap
  16815. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  16816. which means optimal overlap for selected window function will be picked.
  16817. @item averaging
  16818. Set time averaging. Setting this to 0 will display current maximal peaks.
  16819. Default is @code{1}, which means time averaging is disabled.
  16820. @item colors
  16821. Specify list of colors separated by space or by '|' which will be used to
  16822. draw channel frequencies. Unrecognized or missing colors will be replaced
  16823. by white color.
  16824. @item cmode
  16825. Set channel display mode.
  16826. It accepts the following values:
  16827. @table @samp
  16828. @item combined
  16829. @item separate
  16830. @end table
  16831. Default is @code{combined}.
  16832. @item minamp
  16833. Set minimum amplitude used in @code{log} amplitude scaler.
  16834. @end table
  16835. @anchor{showspectrum}
  16836. @section showspectrum
  16837. Convert input audio to a video output, representing the audio frequency
  16838. spectrum.
  16839. The filter accepts the following options:
  16840. @table @option
  16841. @item size, s
  16842. Specify the video size for the output. For the syntax of this option, check the
  16843. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16844. Default value is @code{640x512}.
  16845. @item slide
  16846. Specify how the spectrum should slide along the window.
  16847. It accepts the following values:
  16848. @table @samp
  16849. @item replace
  16850. the samples start again on the left when they reach the right
  16851. @item scroll
  16852. the samples scroll from right to left
  16853. @item fullframe
  16854. frames are only produced when the samples reach the right
  16855. @item rscroll
  16856. the samples scroll from left to right
  16857. @end table
  16858. Default value is @code{replace}.
  16859. @item mode
  16860. Specify display mode.
  16861. It accepts the following values:
  16862. @table @samp
  16863. @item combined
  16864. all channels are displayed in the same row
  16865. @item separate
  16866. all channels are displayed in separate rows
  16867. @end table
  16868. Default value is @samp{combined}.
  16869. @item color
  16870. Specify display color mode.
  16871. It accepts the following values:
  16872. @table @samp
  16873. @item channel
  16874. each channel is displayed in a separate color
  16875. @item intensity
  16876. each channel is displayed using the same color scheme
  16877. @item rainbow
  16878. each channel is displayed using the rainbow color scheme
  16879. @item moreland
  16880. each channel is displayed using the moreland color scheme
  16881. @item nebulae
  16882. each channel is displayed using the nebulae color scheme
  16883. @item fire
  16884. each channel is displayed using the fire color scheme
  16885. @item fiery
  16886. each channel is displayed using the fiery color scheme
  16887. @item fruit
  16888. each channel is displayed using the fruit color scheme
  16889. @item cool
  16890. each channel is displayed using the cool color scheme
  16891. @item magma
  16892. each channel is displayed using the magma color scheme
  16893. @item green
  16894. each channel is displayed using the green color scheme
  16895. @item viridis
  16896. each channel is displayed using the viridis color scheme
  16897. @item plasma
  16898. each channel is displayed using the plasma color scheme
  16899. @item cividis
  16900. each channel is displayed using the cividis color scheme
  16901. @item terrain
  16902. each channel is displayed using the terrain color scheme
  16903. @end table
  16904. Default value is @samp{channel}.
  16905. @item scale
  16906. Specify scale used for calculating intensity color values.
  16907. It accepts the following values:
  16908. @table @samp
  16909. @item lin
  16910. linear
  16911. @item sqrt
  16912. square root, default
  16913. @item cbrt
  16914. cubic root
  16915. @item log
  16916. logarithmic
  16917. @item 4thrt
  16918. 4th root
  16919. @item 5thrt
  16920. 5th root
  16921. @end table
  16922. Default value is @samp{sqrt}.
  16923. @item saturation
  16924. Set saturation modifier for displayed colors. Negative values provide
  16925. alternative color scheme. @code{0} is no saturation at all.
  16926. Saturation must be in [-10.0, 10.0] range.
  16927. Default value is @code{1}.
  16928. @item win_func
  16929. Set window function.
  16930. It accepts the following values:
  16931. @table @samp
  16932. @item rect
  16933. @item bartlett
  16934. @item hann
  16935. @item hanning
  16936. @item hamming
  16937. @item blackman
  16938. @item welch
  16939. @item flattop
  16940. @item bharris
  16941. @item bnuttall
  16942. @item bhann
  16943. @item sine
  16944. @item nuttall
  16945. @item lanczos
  16946. @item gauss
  16947. @item tukey
  16948. @item dolph
  16949. @item cauchy
  16950. @item parzen
  16951. @item poisson
  16952. @item bohman
  16953. @end table
  16954. Default value is @code{hann}.
  16955. @item orientation
  16956. Set orientation of time vs frequency axis. Can be @code{vertical} or
  16957. @code{horizontal}. Default is @code{vertical}.
  16958. @item overlap
  16959. Set ratio of overlap window. Default value is @code{0}.
  16960. When value is @code{1} overlap is set to recommended size for specific
  16961. window function currently used.
  16962. @item gain
  16963. Set scale gain for calculating intensity color values.
  16964. Default value is @code{1}.
  16965. @item data
  16966. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  16967. @item rotation
  16968. Set color rotation, must be in [-1.0, 1.0] range.
  16969. Default value is @code{0}.
  16970. @item start
  16971. Set start frequency from which to display spectrogram. Default is @code{0}.
  16972. @item stop
  16973. Set stop frequency to which to display spectrogram. Default is @code{0}.
  16974. @item fps
  16975. Set upper frame rate limit. Default is @code{auto}, unlimited.
  16976. @item legend
  16977. Draw time and frequency axes and legends. Default is disabled.
  16978. @end table
  16979. The usage is very similar to the showwaves filter; see the examples in that
  16980. section.
  16981. @subsection Examples
  16982. @itemize
  16983. @item
  16984. Large window with logarithmic color scaling:
  16985. @example
  16986. showspectrum=s=1280x480:scale=log
  16987. @end example
  16988. @item
  16989. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  16990. @example
  16991. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  16992. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  16993. @end example
  16994. @end itemize
  16995. @section showspectrumpic
  16996. Convert input audio to a single video frame, representing the audio frequency
  16997. spectrum.
  16998. The filter accepts the following options:
  16999. @table @option
  17000. @item size, s
  17001. Specify the video size for the output. For the syntax of this option, check the
  17002. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17003. Default value is @code{4096x2048}.
  17004. @item mode
  17005. Specify display mode.
  17006. It accepts the following values:
  17007. @table @samp
  17008. @item combined
  17009. all channels are displayed in the same row
  17010. @item separate
  17011. all channels are displayed in separate rows
  17012. @end table
  17013. Default value is @samp{combined}.
  17014. @item color
  17015. Specify display color mode.
  17016. It accepts the following values:
  17017. @table @samp
  17018. @item channel
  17019. each channel is displayed in a separate color
  17020. @item intensity
  17021. each channel is displayed using the same color scheme
  17022. @item rainbow
  17023. each channel is displayed using the rainbow color scheme
  17024. @item moreland
  17025. each channel is displayed using the moreland color scheme
  17026. @item nebulae
  17027. each channel is displayed using the nebulae color scheme
  17028. @item fire
  17029. each channel is displayed using the fire color scheme
  17030. @item fiery
  17031. each channel is displayed using the fiery color scheme
  17032. @item fruit
  17033. each channel is displayed using the fruit color scheme
  17034. @item cool
  17035. each channel is displayed using the cool color scheme
  17036. @item magma
  17037. each channel is displayed using the magma color scheme
  17038. @item green
  17039. each channel is displayed using the green color scheme
  17040. @item viridis
  17041. each channel is displayed using the viridis color scheme
  17042. @item plasma
  17043. each channel is displayed using the plasma color scheme
  17044. @item cividis
  17045. each channel is displayed using the cividis color scheme
  17046. @item terrain
  17047. each channel is displayed using the terrain color scheme
  17048. @end table
  17049. Default value is @samp{intensity}.
  17050. @item scale
  17051. Specify scale used for calculating intensity color values.
  17052. It accepts the following values:
  17053. @table @samp
  17054. @item lin
  17055. linear
  17056. @item sqrt
  17057. square root, default
  17058. @item cbrt
  17059. cubic root
  17060. @item log
  17061. logarithmic
  17062. @item 4thrt
  17063. 4th root
  17064. @item 5thrt
  17065. 5th root
  17066. @end table
  17067. Default value is @samp{log}.
  17068. @item saturation
  17069. Set saturation modifier for displayed colors. Negative values provide
  17070. alternative color scheme. @code{0} is no saturation at all.
  17071. Saturation must be in [-10.0, 10.0] range.
  17072. Default value is @code{1}.
  17073. @item win_func
  17074. Set window function.
  17075. It accepts the following values:
  17076. @table @samp
  17077. @item rect
  17078. @item bartlett
  17079. @item hann
  17080. @item hanning
  17081. @item hamming
  17082. @item blackman
  17083. @item welch
  17084. @item flattop
  17085. @item bharris
  17086. @item bnuttall
  17087. @item bhann
  17088. @item sine
  17089. @item nuttall
  17090. @item lanczos
  17091. @item gauss
  17092. @item tukey
  17093. @item dolph
  17094. @item cauchy
  17095. @item parzen
  17096. @item poisson
  17097. @item bohman
  17098. @end table
  17099. Default value is @code{hann}.
  17100. @item orientation
  17101. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17102. @code{horizontal}. Default is @code{vertical}.
  17103. @item gain
  17104. Set scale gain for calculating intensity color values.
  17105. Default value is @code{1}.
  17106. @item legend
  17107. Draw time and frequency axes and legends. Default is enabled.
  17108. @item rotation
  17109. Set color rotation, must be in [-1.0, 1.0] range.
  17110. Default value is @code{0}.
  17111. @item start
  17112. Set start frequency from which to display spectrogram. Default is @code{0}.
  17113. @item stop
  17114. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17115. @end table
  17116. @subsection Examples
  17117. @itemize
  17118. @item
  17119. Extract an audio spectrogram of a whole audio track
  17120. in a 1024x1024 picture using @command{ffmpeg}:
  17121. @example
  17122. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  17123. @end example
  17124. @end itemize
  17125. @section showvolume
  17126. Convert input audio volume to a video output.
  17127. The filter accepts the following options:
  17128. @table @option
  17129. @item rate, r
  17130. Set video rate.
  17131. @item b
  17132. Set border width, allowed range is [0, 5]. Default is 1.
  17133. @item w
  17134. Set channel width, allowed range is [80, 8192]. Default is 400.
  17135. @item h
  17136. Set channel height, allowed range is [1, 900]. Default is 20.
  17137. @item f
  17138. Set fade, allowed range is [0, 1]. Default is 0.95.
  17139. @item c
  17140. Set volume color expression.
  17141. The expression can use the following variables:
  17142. @table @option
  17143. @item VOLUME
  17144. Current max volume of channel in dB.
  17145. @item PEAK
  17146. Current peak.
  17147. @item CHANNEL
  17148. Current channel number, starting from 0.
  17149. @end table
  17150. @item t
  17151. If set, displays channel names. Default is enabled.
  17152. @item v
  17153. If set, displays volume values. Default is enabled.
  17154. @item o
  17155. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  17156. default is @code{h}.
  17157. @item s
  17158. Set step size, allowed range is [0, 5]. Default is 0, which means
  17159. step is disabled.
  17160. @item p
  17161. Set background opacity, allowed range is [0, 1]. Default is 0.
  17162. @item m
  17163. Set metering mode, can be peak: @code{p} or rms: @code{r},
  17164. default is @code{p}.
  17165. @item ds
  17166. Set display scale, can be linear: @code{lin} or log: @code{log},
  17167. default is @code{lin}.
  17168. @item dm
  17169. In second.
  17170. If set to > 0., display a line for the max level
  17171. in the previous seconds.
  17172. default is disabled: @code{0.}
  17173. @item dmc
  17174. The color of the max line. Use when @code{dm} option is set to > 0.
  17175. default is: @code{orange}
  17176. @end table
  17177. @section showwaves
  17178. Convert input audio to a video output, representing the samples waves.
  17179. The filter accepts the following options:
  17180. @table @option
  17181. @item size, s
  17182. Specify the video size for the output. For the syntax of this option, check the
  17183. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17184. Default value is @code{600x240}.
  17185. @item mode
  17186. Set display mode.
  17187. Available values are:
  17188. @table @samp
  17189. @item point
  17190. Draw a point for each sample.
  17191. @item line
  17192. Draw a vertical line for each sample.
  17193. @item p2p
  17194. Draw a point for each sample and a line between them.
  17195. @item cline
  17196. Draw a centered vertical line for each sample.
  17197. @end table
  17198. Default value is @code{point}.
  17199. @item n
  17200. Set the number of samples which are printed on the same column. A
  17201. larger value will decrease the frame rate. Must be a positive
  17202. integer. This option can be set only if the value for @var{rate}
  17203. is not explicitly specified.
  17204. @item rate, r
  17205. Set the (approximate) output frame rate. This is done by setting the
  17206. option @var{n}. Default value is "25".
  17207. @item split_channels
  17208. Set if channels should be drawn separately or overlap. Default value is 0.
  17209. @item colors
  17210. Set colors separated by '|' which are going to be used for drawing of each channel.
  17211. @item scale
  17212. Set amplitude scale.
  17213. Available values are:
  17214. @table @samp
  17215. @item lin
  17216. Linear.
  17217. @item log
  17218. Logarithmic.
  17219. @item sqrt
  17220. Square root.
  17221. @item cbrt
  17222. Cubic root.
  17223. @end table
  17224. Default is linear.
  17225. @item draw
  17226. Set the draw mode. This is mostly useful to set for high @var{n}.
  17227. Available values are:
  17228. @table @samp
  17229. @item scale
  17230. Scale pixel values for each drawn sample.
  17231. @item full
  17232. Draw every sample directly.
  17233. @end table
  17234. Default value is @code{scale}.
  17235. @end table
  17236. @subsection Examples
  17237. @itemize
  17238. @item
  17239. Output the input file audio and the corresponding video representation
  17240. at the same time:
  17241. @example
  17242. amovie=a.mp3,asplit[out0],showwaves[out1]
  17243. @end example
  17244. @item
  17245. Create a synthetic signal and show it with showwaves, forcing a
  17246. frame rate of 30 frames per second:
  17247. @example
  17248. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  17249. @end example
  17250. @end itemize
  17251. @section showwavespic
  17252. Convert input audio to a single video frame, representing the samples waves.
  17253. The filter accepts the following options:
  17254. @table @option
  17255. @item size, s
  17256. Specify the video size for the output. For the syntax of this option, check the
  17257. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17258. Default value is @code{600x240}.
  17259. @item split_channels
  17260. Set if channels should be drawn separately or overlap. Default value is 0.
  17261. @item colors
  17262. Set colors separated by '|' which are going to be used for drawing of each channel.
  17263. @item scale
  17264. Set amplitude scale.
  17265. Available values are:
  17266. @table @samp
  17267. @item lin
  17268. Linear.
  17269. @item log
  17270. Logarithmic.
  17271. @item sqrt
  17272. Square root.
  17273. @item cbrt
  17274. Cubic root.
  17275. @end table
  17276. Default is linear.
  17277. @end table
  17278. @subsection Examples
  17279. @itemize
  17280. @item
  17281. Extract a channel split representation of the wave form of a whole audio track
  17282. in a 1024x800 picture using @command{ffmpeg}:
  17283. @example
  17284. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  17285. @end example
  17286. @end itemize
  17287. @section sidedata, asidedata
  17288. Delete frame side data, or select frames based on it.
  17289. This filter accepts the following options:
  17290. @table @option
  17291. @item mode
  17292. Set mode of operation of the filter.
  17293. Can be one of the following:
  17294. @table @samp
  17295. @item select
  17296. Select every frame with side data of @code{type}.
  17297. @item delete
  17298. Delete side data of @code{type}. If @code{type} is not set, delete all side
  17299. data in the frame.
  17300. @end table
  17301. @item type
  17302. Set side data type used with all modes. Must be set for @code{select} mode. For
  17303. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  17304. in @file{libavutil/frame.h}. For example, to choose
  17305. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  17306. @end table
  17307. @section spectrumsynth
  17308. Sythesize audio from 2 input video spectrums, first input stream represents
  17309. magnitude across time and second represents phase across time.
  17310. The filter will transform from frequency domain as displayed in videos back
  17311. to time domain as presented in audio output.
  17312. This filter is primarily created for reversing processed @ref{showspectrum}
  17313. filter outputs, but can synthesize sound from other spectrograms too.
  17314. But in such case results are going to be poor if the phase data is not
  17315. available, because in such cases phase data need to be recreated, usually
  17316. it's just recreated from random noise.
  17317. For best results use gray only output (@code{channel} color mode in
  17318. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  17319. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  17320. @code{data} option. Inputs videos should generally use @code{fullframe}
  17321. slide mode as that saves resources needed for decoding video.
  17322. The filter accepts the following options:
  17323. @table @option
  17324. @item sample_rate
  17325. Specify sample rate of output audio, the sample rate of audio from which
  17326. spectrum was generated may differ.
  17327. @item channels
  17328. Set number of channels represented in input video spectrums.
  17329. @item scale
  17330. Set scale which was used when generating magnitude input spectrum.
  17331. Can be @code{lin} or @code{log}. Default is @code{log}.
  17332. @item slide
  17333. Set slide which was used when generating inputs spectrums.
  17334. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  17335. Default is @code{fullframe}.
  17336. @item win_func
  17337. Set window function used for resynthesis.
  17338. @item overlap
  17339. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17340. which means optimal overlap for selected window function will be picked.
  17341. @item orientation
  17342. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  17343. Default is @code{vertical}.
  17344. @end table
  17345. @subsection Examples
  17346. @itemize
  17347. @item
  17348. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  17349. then resynthesize videos back to audio with spectrumsynth:
  17350. @example
  17351. ffmpeg -i input.flac -lavfi showspectrum=mode=separate:scale=log:overlap=0.875:color=channel:slide=fullframe:data=magnitude -an -c:v rawvideo magnitude.nut
  17352. ffmpeg -i input.flac -lavfi showspectrum=mode=separate:scale=lin:overlap=0.875:color=channel:slide=fullframe:data=phase -an -c:v rawvideo phase.nut
  17353. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  17354. @end example
  17355. @end itemize
  17356. @section split, asplit
  17357. Split input into several identical outputs.
  17358. @code{asplit} works with audio input, @code{split} with video.
  17359. The filter accepts a single parameter which specifies the number of outputs. If
  17360. unspecified, it defaults to 2.
  17361. @subsection Examples
  17362. @itemize
  17363. @item
  17364. Create two separate outputs from the same input:
  17365. @example
  17366. [in] split [out0][out1]
  17367. @end example
  17368. @item
  17369. To create 3 or more outputs, you need to specify the number of
  17370. outputs, like in:
  17371. @example
  17372. [in] asplit=3 [out0][out1][out2]
  17373. @end example
  17374. @item
  17375. Create two separate outputs from the same input, one cropped and
  17376. one padded:
  17377. @example
  17378. [in] split [splitout1][splitout2];
  17379. [splitout1] crop=100:100:0:0 [cropout];
  17380. [splitout2] pad=200:200:100:100 [padout];
  17381. @end example
  17382. @item
  17383. Create 5 copies of the input audio with @command{ffmpeg}:
  17384. @example
  17385. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  17386. @end example
  17387. @end itemize
  17388. @section zmq, azmq
  17389. Receive commands sent through a libzmq client, and forward them to
  17390. filters in the filtergraph.
  17391. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  17392. must be inserted between two video filters, @code{azmq} between two
  17393. audio filters. Both are capable to send messages to any filter type.
  17394. To enable these filters you need to install the libzmq library and
  17395. headers and configure FFmpeg with @code{--enable-libzmq}.
  17396. For more information about libzmq see:
  17397. @url{http://www.zeromq.org/}
  17398. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  17399. receives messages sent through a network interface defined by the
  17400. @option{bind_address} (or the abbreviation "@option{b}") option.
  17401. Default value of this option is @file{tcp://localhost:5555}. You may
  17402. want to alter this value to your needs, but do not forget to escape any
  17403. ':' signs (see @ref{filtergraph escaping}).
  17404. The received message must be in the form:
  17405. @example
  17406. @var{TARGET} @var{COMMAND} [@var{ARG}]
  17407. @end example
  17408. @var{TARGET} specifies the target of the command, usually the name of
  17409. the filter class or a specific filter instance name. The default
  17410. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  17411. but you can override this by using the @samp{filter_name@@id} syntax
  17412. (see @ref{Filtergraph syntax}).
  17413. @var{COMMAND} specifies the name of the command for the target filter.
  17414. @var{ARG} is optional and specifies the optional argument list for the
  17415. given @var{COMMAND}.
  17416. Upon reception, the message is processed and the corresponding command
  17417. is injected into the filtergraph. Depending on the result, the filter
  17418. will send a reply to the client, adopting the format:
  17419. @example
  17420. @var{ERROR_CODE} @var{ERROR_REASON}
  17421. @var{MESSAGE}
  17422. @end example
  17423. @var{MESSAGE} is optional.
  17424. @subsection Examples
  17425. Look at @file{tools/zmqsend} for an example of a zmq client which can
  17426. be used to send commands processed by these filters.
  17427. Consider the following filtergraph generated by @command{ffplay}.
  17428. In this example the last overlay filter has an instance name. All other
  17429. filters will have default instance names.
  17430. @example
  17431. ffplay -dumpgraph 1 -f lavfi "
  17432. color=s=100x100:c=red [l];
  17433. color=s=100x100:c=blue [r];
  17434. nullsrc=s=200x100, zmq [bg];
  17435. [bg][l] overlay [bg+l];
  17436. [bg+l][r] overlay@@my=x=100 "
  17437. @end example
  17438. To change the color of the left side of the video, the following
  17439. command can be used:
  17440. @example
  17441. echo Parsed_color_0 c yellow | tools/zmqsend
  17442. @end example
  17443. To change the right side:
  17444. @example
  17445. echo Parsed_color_1 c pink | tools/zmqsend
  17446. @end example
  17447. To change the position of the right side:
  17448. @example
  17449. echo overlay@@my x 150 | tools/zmqsend
  17450. @end example
  17451. @c man end MULTIMEDIA FILTERS
  17452. @chapter Multimedia Sources
  17453. @c man begin MULTIMEDIA SOURCES
  17454. Below is a description of the currently available multimedia sources.
  17455. @section amovie
  17456. This is the same as @ref{movie} source, except it selects an audio
  17457. stream by default.
  17458. @anchor{movie}
  17459. @section movie
  17460. Read audio and/or video stream(s) from a movie container.
  17461. It accepts the following parameters:
  17462. @table @option
  17463. @item filename
  17464. The name of the resource to read (not necessarily a file; it can also be a
  17465. device or a stream accessed through some protocol).
  17466. @item format_name, f
  17467. Specifies the format assumed for the movie to read, and can be either
  17468. the name of a container or an input device. If not specified, the
  17469. format is guessed from @var{movie_name} or by probing.
  17470. @item seek_point, sp
  17471. Specifies the seek point in seconds. The frames will be output
  17472. starting from this seek point. The parameter is evaluated with
  17473. @code{av_strtod}, so the numerical value may be suffixed by an IS
  17474. postfix. The default value is "0".
  17475. @item streams, s
  17476. Specifies the streams to read. Several streams can be specified,
  17477. separated by "+". The source will then have as many outputs, in the
  17478. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  17479. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  17480. respectively the default (best suited) video and audio stream. Default
  17481. is "dv", or "da" if the filter is called as "amovie".
  17482. @item stream_index, si
  17483. Specifies the index of the video stream to read. If the value is -1,
  17484. the most suitable video stream will be automatically selected. The default
  17485. value is "-1". Deprecated. If the filter is called "amovie", it will select
  17486. audio instead of video.
  17487. @item loop
  17488. Specifies how many times to read the stream in sequence.
  17489. If the value is 0, the stream will be looped infinitely.
  17490. Default value is "1".
  17491. Note that when the movie is looped the source timestamps are not
  17492. changed, so it will generate non monotonically increasing timestamps.
  17493. @item discontinuity
  17494. Specifies the time difference between frames above which the point is
  17495. considered a timestamp discontinuity which is removed by adjusting the later
  17496. timestamps.
  17497. @end table
  17498. It allows overlaying a second video on top of the main input of
  17499. a filtergraph, as shown in this graph:
  17500. @example
  17501. input -----------> deltapts0 --> overlay --> output
  17502. ^
  17503. |
  17504. movie --> scale--> deltapts1 -------+
  17505. @end example
  17506. @subsection Examples
  17507. @itemize
  17508. @item
  17509. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  17510. on top of the input labelled "in":
  17511. @example
  17512. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17513. [in] setpts=PTS-STARTPTS [main];
  17514. [main][over] overlay=16:16 [out]
  17515. @end example
  17516. @item
  17517. Read from a video4linux2 device, and overlay it on top of the input
  17518. labelled "in":
  17519. @example
  17520. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17521. [in] setpts=PTS-STARTPTS [main];
  17522. [main][over] overlay=16:16 [out]
  17523. @end example
  17524. @item
  17525. Read the first video stream and the audio stream with id 0x81 from
  17526. dvd.vob; the video is connected to the pad named "video" and the audio is
  17527. connected to the pad named "audio":
  17528. @example
  17529. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  17530. @end example
  17531. @end itemize
  17532. @subsection Commands
  17533. Both movie and amovie support the following commands:
  17534. @table @option
  17535. @item seek
  17536. Perform seek using "av_seek_frame".
  17537. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  17538. @itemize
  17539. @item
  17540. @var{stream_index}: If stream_index is -1, a default
  17541. stream is selected, and @var{timestamp} is automatically converted
  17542. from AV_TIME_BASE units to the stream specific time_base.
  17543. @item
  17544. @var{timestamp}: Timestamp in AVStream.time_base units
  17545. or, if no stream is specified, in AV_TIME_BASE units.
  17546. @item
  17547. @var{flags}: Flags which select direction and seeking mode.
  17548. @end itemize
  17549. @item get_duration
  17550. Get movie duration in AV_TIME_BASE units.
  17551. @end table
  17552. @c man end MULTIMEDIA SOURCES