filters.texi 824 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917
  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{commands}
  252. @chapter Changing options at runtime with a command
  253. Some options can be changed during the operation of the filter using
  254. a command. These options are marked 'T' on the output of
  255. @command{ffmpeg} @option{-h filter=<name of filter>}.
  256. The name of the command is the name of the option and the argument is
  257. the new value.
  258. @anchor{framesync}
  259. @chapter Options for filters with several inputs (framesync)
  260. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  261. Some filters with several inputs support a common set of options.
  262. These options can only be set by name, not with the short notation.
  263. @table @option
  264. @item eof_action
  265. The action to take when EOF is encountered on the secondary input; it accepts
  266. one of the following values:
  267. @table @option
  268. @item repeat
  269. Repeat the last frame (the default).
  270. @item endall
  271. End both streams.
  272. @item pass
  273. Pass the main input through.
  274. @end table
  275. @item shortest
  276. If set to 1, force the output to terminate when the shortest input
  277. terminates. Default value is 0.
  278. @item repeatlast
  279. If set to 1, force the filter to extend the last frame of secondary streams
  280. until the end of the primary stream. A value of 0 disables this behavior.
  281. Default value is 1.
  282. @item ts_sync_mode
  283. How strictly to sync streams based on secondary input timestamps; it accepts
  284. one of the following values:
  285. @table @option
  286. @item default
  287. Frame from secondary input with the nearest lower or equal timestamp to the
  288. primary input frame.
  289. @item nearest
  290. Frame from secondary input with the absolute nearest timestamp to the primary
  291. input frame.
  292. @end table
  293. @end table
  294. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  295. @chapter Audio Filters
  296. @c man begin AUDIO FILTERS
  297. When you configure your FFmpeg build, you can disable any of the
  298. existing filters using @code{--disable-filters}.
  299. The configure output will show the audio filters included in your
  300. build.
  301. Below is a description of the currently available audio filters.
  302. @section acompressor
  303. A compressor is mainly used to reduce the dynamic range of a signal.
  304. Especially modern music is mostly compressed at a high ratio to
  305. improve the overall loudness. It's done to get the highest attention
  306. of a listener, "fatten" the sound and bring more "power" to the track.
  307. If a signal is compressed too much it may sound dull or "dead"
  308. afterwards or it may start to "pump" (which could be a powerful effect
  309. but can also destroy a track completely).
  310. The right compression is the key to reach a professional sound and is
  311. the high art of mixing and mastering. Because of its complex settings
  312. it may take a long time to get the right feeling for this kind of effect.
  313. Compression is done by detecting the volume above a chosen level
  314. @code{threshold} and dividing it by the factor set with @code{ratio}.
  315. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  316. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  317. the signal would cause distortion of the waveform the reduction can be
  318. levelled over the time. This is done by setting "Attack" and "Release".
  319. @code{attack} determines how long the signal has to rise above the threshold
  320. before any reduction will occur and @code{release} sets the time the signal
  321. has to fall below the threshold to reduce the reduction again. Shorter signals
  322. than the chosen attack time will be left untouched.
  323. The overall reduction of the signal can be made up afterwards with the
  324. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  325. raising the makeup to this level results in a signal twice as loud than the
  326. source. To gain a softer entry in the compression the @code{knee} flattens the
  327. hard edge at the threshold in the range of the chosen decibels.
  328. The filter accepts the following options:
  329. @table @option
  330. @item level_in
  331. Set input gain. Default is 1. Range is between 0.015625 and 64.
  332. @item mode
  333. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  334. Default is @code{downward}.
  335. @item threshold
  336. If a signal of stream rises above this level it will affect the gain
  337. reduction.
  338. By default it is 0.125. Range is between 0.00097563 and 1.
  339. @item ratio
  340. Set a ratio by which the signal is reduced. 1:2 means that if the level
  341. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  342. Default is 2. Range is between 1 and 20.
  343. @item attack
  344. Amount of milliseconds the signal has to rise above the threshold before gain
  345. reduction starts. Default is 20. Range is between 0.01 and 2000.
  346. @item release
  347. Amount of milliseconds the signal has to fall below the threshold before
  348. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  349. @item makeup
  350. Set the amount by how much signal will be amplified after processing.
  351. Default is 1. Range is from 1 to 64.
  352. @item knee
  353. Curve the sharp knee around the threshold to enter gain reduction more softly.
  354. Default is 2.82843. Range is between 1 and 8.
  355. @item link
  356. Choose if the @code{average} level between all channels of input stream
  357. or the louder(@code{maximum}) channel of input stream affects the
  358. reduction. Default is @code{average}.
  359. @item detection
  360. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  361. of @code{rms}. Default is @code{rms} which is mostly smoother.
  362. @item mix
  363. How much to use compressed signal in output. Default is 1.
  364. Range is between 0 and 1.
  365. @end table
  366. @subsection Commands
  367. This filter supports the all above options as @ref{commands}.
  368. @section acontrast
  369. Simple audio dynamic range compression/expansion filter.
  370. The filter accepts the following options:
  371. @table @option
  372. @item contrast
  373. Set contrast. Default is 33. Allowed range is between 0 and 100.
  374. @end table
  375. @section acopy
  376. Copy the input audio source unchanged to the output. This is mainly useful for
  377. testing purposes.
  378. @section acrossfade
  379. Apply cross fade from one input audio stream to another input audio stream.
  380. The cross fade is applied for specified duration near the end of first stream.
  381. The filter accepts the following options:
  382. @table @option
  383. @item nb_samples, ns
  384. Specify the number of samples for which the cross fade effect has to last.
  385. At the end of the cross fade effect the first input audio will be completely
  386. silent. Default is 44100.
  387. @item duration, d
  388. Specify the duration of the cross fade effect. See
  389. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  390. for the accepted syntax.
  391. By default the duration is determined by @var{nb_samples}.
  392. If set this option is used instead of @var{nb_samples}.
  393. @item overlap, o
  394. Should first stream end overlap with second stream start. Default is enabled.
  395. @item curve1
  396. Set curve for cross fade transition for first stream.
  397. @item curve2
  398. Set curve for cross fade transition for second stream.
  399. For description of available curve types see @ref{afade} filter description.
  400. @end table
  401. @subsection Examples
  402. @itemize
  403. @item
  404. Cross fade from one input to another:
  405. @example
  406. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  407. @end example
  408. @item
  409. Cross fade from one input to another but without overlapping:
  410. @example
  411. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  412. @end example
  413. @end itemize
  414. @section acrossover
  415. Split audio stream into several bands.
  416. This filter splits audio stream into two or more frequency ranges.
  417. Summing all streams back will give flat output.
  418. The filter accepts the following options:
  419. @table @option
  420. @item split
  421. Set split frequencies. Those must be positive and increasing.
  422. @item order
  423. Set filter order for each band split. This controls filter roll-off or steepness
  424. of filter transfer function.
  425. Available values are:
  426. @table @samp
  427. @item 2nd
  428. 12 dB per octave.
  429. @item 4th
  430. 24 dB per octave.
  431. @item 6th
  432. 36 dB per octave.
  433. @item 8th
  434. 48 dB per octave.
  435. @item 10th
  436. 60 dB per octave.
  437. @item 12th
  438. 72 dB per octave.
  439. @item 14th
  440. 84 dB per octave.
  441. @item 16th
  442. 96 dB per octave.
  443. @item 18th
  444. 108 dB per octave.
  445. @item 20th
  446. 120 dB per octave.
  447. @end table
  448. Default is @var{4th}.
  449. @item level
  450. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  451. @item gains
  452. Set output gain for each band. Default value is 1 for all bands.
  453. @item precision
  454. Set which precision to use when processing samples.
  455. @table @option
  456. @item auto
  457. Auto pick internal sample format depending on other filters.
  458. @item float
  459. Always use single-floating point precision sample format.
  460. @item double
  461. Always use double-floating point precision sample format.
  462. @end table
  463. Default value is @code{auto}.
  464. @end table
  465. @subsection Examples
  466. @itemize
  467. @item
  468. Split input audio stream into two bands (low and high) with split frequency of 1500 Hz,
  469. each band will be in separate stream:
  470. @example
  471. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  472. @end example
  473. @item
  474. Same as above, but with higher filter order:
  475. @example
  476. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500:order=8th[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  477. @end example
  478. @item
  479. Same as above, but also with additional middle band (frequencies between 1500 and 8000):
  480. @example
  481. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500 8000:order=8th[LOW][MID][HIGH]' -map '[LOW]' low.wav -map '[MID]' mid.wav -map '[HIGH]' high.wav
  482. @end example
  483. @end itemize
  484. @section acrusher
  485. Reduce audio bit resolution.
  486. This filter is bit crusher with enhanced functionality. A bit crusher
  487. is used to audibly reduce number of bits an audio signal is sampled
  488. with. This doesn't change the bit depth at all, it just produces the
  489. effect. Material reduced in bit depth sounds more harsh and "digital".
  490. This filter is able to even round to continuous values instead of discrete
  491. bit depths.
  492. Additionally it has a D/C offset which results in different crushing of
  493. the lower and the upper half of the signal.
  494. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  495. Another feature of this filter is the logarithmic mode.
  496. This setting switches from linear distances between bits to logarithmic ones.
  497. The result is a much more "natural" sounding crusher which doesn't gate low
  498. signals for example. The human ear has a logarithmic perception,
  499. so this kind of crushing is much more pleasant.
  500. Logarithmic crushing is also able to get anti-aliased.
  501. The filter accepts the following options:
  502. @table @option
  503. @item level_in
  504. Set level in.
  505. @item level_out
  506. Set level out.
  507. @item bits
  508. Set bit reduction.
  509. @item mix
  510. Set mixing amount.
  511. @item mode
  512. Can be linear: @code{lin} or logarithmic: @code{log}.
  513. @item dc
  514. Set DC.
  515. @item aa
  516. Set anti-aliasing.
  517. @item samples
  518. Set sample reduction.
  519. @item lfo
  520. Enable LFO. By default disabled.
  521. @item lforange
  522. Set LFO range.
  523. @item lforate
  524. Set LFO rate.
  525. @end table
  526. @subsection Commands
  527. This filter supports the all above options as @ref{commands}.
  528. @section acue
  529. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  530. filter.
  531. @section adeclick
  532. Remove impulsive noise from input audio.
  533. Samples detected as impulsive noise are replaced by interpolated samples using
  534. autoregressive modelling.
  535. @table @option
  536. @item window, w
  537. Set window size, in milliseconds. Allowed range is from @code{10} to
  538. @code{100}. Default value is @code{55} milliseconds.
  539. This sets size of window which will be processed at once.
  540. @item overlap, o
  541. Set window overlap, in percentage of window size. Allowed range is from
  542. @code{50} to @code{95}. Default value is @code{75} percent.
  543. Setting this to a very high value increases impulsive noise removal but makes
  544. whole process much slower.
  545. @item arorder, a
  546. Set autoregression order, in percentage of window size. Allowed range is from
  547. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  548. controls quality of interpolated samples using neighbour good samples.
  549. @item threshold, t
  550. Set threshold value. Allowed range is from @code{1} to @code{100}.
  551. Default value is @code{2}.
  552. This controls the strength of impulsive noise which is going to be removed.
  553. The lower value, the more samples will be detected as impulsive noise.
  554. @item burst, b
  555. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  556. @code{10}. Default value is @code{2}.
  557. If any two samples detected as noise are spaced less than this value then any
  558. sample between those two samples will be also detected as noise.
  559. @item method, m
  560. Set overlap method.
  561. It accepts the following values:
  562. @table @option
  563. @item add, a
  564. Select overlap-add method. Even not interpolated samples are slightly
  565. changed with this method.
  566. @item save, s
  567. Select overlap-save method. Not interpolated samples remain unchanged.
  568. @end table
  569. Default value is @code{a}.
  570. @end table
  571. @section adeclip
  572. Remove clipped samples from input audio.
  573. Samples detected as clipped are replaced by interpolated samples using
  574. autoregressive modelling.
  575. @table @option
  576. @item window, w
  577. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  578. Default value is @code{55} milliseconds.
  579. This sets size of window which will be processed at once.
  580. @item overlap, o
  581. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  582. to @code{95}. Default value is @code{75} percent.
  583. @item arorder, a
  584. Set autoregression order, in percentage of window size. Allowed range is from
  585. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  586. quality of interpolated samples using neighbour good samples.
  587. @item threshold, t
  588. Set threshold value. Allowed range is from @code{1} to @code{100}.
  589. Default value is @code{10}. Higher values make clip detection less aggressive.
  590. @item hsize, n
  591. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  592. Default value is @code{1000}. Higher values make clip detection less aggressive.
  593. @item method, m
  594. Set overlap method.
  595. It accepts the following values:
  596. @table @option
  597. @item add, a
  598. Select overlap-add method. Even not interpolated samples are slightly changed
  599. with this method.
  600. @item save, s
  601. Select overlap-save method. Not interpolated samples remain unchanged.
  602. @end table
  603. Default value is @code{a}.
  604. @end table
  605. @section adecorrelate
  606. Apply decorrelation to input audio stream.
  607. The filter accepts the following options:
  608. @table @option
  609. @item stages
  610. Set decorrelation stages of filtering. Allowed
  611. range is from 1 to 16. Default value is 6.
  612. @item seed
  613. Set random seed used for setting delay in samples across channels.
  614. @end table
  615. @section adelay
  616. Delay one or more audio channels.
  617. Samples in delayed channel are filled with silence.
  618. The filter accepts the following option:
  619. @table @option
  620. @item delays
  621. Set list of delays in milliseconds for each channel separated by '|'.
  622. Unused delays will be silently ignored. If number of given delays is
  623. smaller than number of channels all remaining channels will not be delayed.
  624. If you want to delay exact number of samples, append 'S' to number.
  625. If you want instead to delay in seconds, append 's' to number.
  626. @item all
  627. Use last set delay for all remaining channels. By default is disabled.
  628. This option if enabled changes how option @code{delays} is interpreted.
  629. @end table
  630. @subsection Examples
  631. @itemize
  632. @item
  633. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  634. the second channel (and any other channels that may be present) unchanged.
  635. @example
  636. adelay=1500|0|500
  637. @end example
  638. @item
  639. Delay second channel by 500 samples, the third channel by 700 samples and leave
  640. the first channel (and any other channels that may be present) unchanged.
  641. @example
  642. adelay=0|500S|700S
  643. @end example
  644. @item
  645. Delay all channels by same number of samples:
  646. @example
  647. adelay=delays=64S:all=1
  648. @end example
  649. @end itemize
  650. @section adenorm
  651. Remedy denormals in audio by adding extremely low-level noise.
  652. This filter shall be placed before any filter that can produce denormals.
  653. A description of the accepted parameters follows.
  654. @table @option
  655. @item level
  656. Set level of added noise in dB. Default is @code{-351}.
  657. Allowed range is from -451 to -90.
  658. @item type
  659. Set type of added noise.
  660. @table @option
  661. @item dc
  662. Add DC signal.
  663. @item ac
  664. Add AC signal.
  665. @item square
  666. Add square signal.
  667. @item pulse
  668. Add pulse signal.
  669. @end table
  670. Default is @code{dc}.
  671. @end table
  672. @subsection Commands
  673. This filter supports the all above options as @ref{commands}.
  674. @section aderivative, aintegral
  675. Compute derivative/integral of audio stream.
  676. Applying both filters one after another produces original audio.
  677. @section adrc
  678. Apply spectral dynamic range controller filter to input audio stream.
  679. A description of the accepted options follows.
  680. @table @option
  681. @item transfer
  682. Set the transfer expression.
  683. The expression can contain the following constants:
  684. @table @option
  685. @item ch
  686. current channel number
  687. @item sn
  688. current sample number
  689. @item nb_channels
  690. number of channels
  691. @item t
  692. timestamp expressed in seconds
  693. @item sr
  694. sample rate
  695. @item p
  696. current frequency power value, in dB
  697. @item f
  698. current frequency in Hz
  699. @end table
  700. Default value is @code{p}.
  701. @item attack
  702. Set the attack in milliseconds. Default is @code{50} milliseconds.
  703. Allowed range is from 1 to 1000 milliseconds.
  704. @item release
  705. Set the release in milliseconds. Default is @code{100} milliseconds.
  706. Allowed range is from 5 to 2000 milliseconds.
  707. @item channels
  708. Set which channels to filter, by default @code{all} channels in audio stream are filtered.
  709. @end table
  710. @subsection Commands
  711. This filter supports the all above options as @ref{commands}.
  712. @subsection Examples
  713. @itemize
  714. @item
  715. Apply spectral compression to all frequencies with threshold of -50 dB and 1:6 ratio:
  716. @example
  717. adrc=transfer='if(gt(p,-50),-50+(p-(-50))/6,p)':attack=50:release=100
  718. @end example
  719. @item
  720. Similar to above but with 1:2 ratio and filtering only front center channel:
  721. @example
  722. adrc=transfer='if(gt(p,-50),-50+(p-(-50))/2,p)':attack=50:release=100:channels=FC
  723. @end example
  724. @item
  725. Apply spectral noise gate to all frequencies with threshold of -85 dB and with short attack time and short release time:
  726. @example
  727. adrc=transfer='if(lte(p,-85),p-800,p)':attack=1:release=5
  728. @end example
  729. @item
  730. Apply spectral expansion to all frequencies with threshold of -10 dB and 1:2 ratio:
  731. @example
  732. adrc=transfer='if(lt(p,-10),-10+(p-(-10))*2,p)':attack=50:release=100
  733. @end example
  734. @item
  735. Apply limiter to max -60 dB to all frequencies, with attack of 2 ms and release of 10 ms:
  736. @example
  737. adrc=transfer='min(p,-60)':attack=2:release=10
  738. @end example
  739. @end itemize
  740. @section adynamicequalizer
  741. Apply dynamic equalization to input audio stream.
  742. A description of the accepted options follows.
  743. @table @option
  744. @item threshold
  745. Set the detection threshold used to trigger equalization.
  746. Threshold detection is using bandpass filter.
  747. Default value is 0. Allowed range is from 0 to 100.
  748. @item dfrequency
  749. Set the detection frequency in Hz used for bandpass filter used to trigger equalization.
  750. Default value is 1000 Hz. Allowed range is between 2 and 1000000 Hz.
  751. @item dqfactor
  752. Set the detection resonance factor for bandpass filter used to trigger equalization.
  753. Default value is 1. Allowed range is from 0.001 to 1000.
  754. @item tfrequency
  755. Set the target frequency of equalization filter.
  756. Default value is 1000 Hz. Allowed range is between 2 and 1000000 Hz.
  757. @item tqfactor
  758. Set the target resonance factor for target equalization filter.
  759. Default value is 1. Allowed range is from 0.001 to 1000.
  760. @item attack
  761. Set the amount of milliseconds the signal from detection has to rise above
  762. the detection threshold before equalization starts.
  763. Default is 20. Allowed range is between 1 and 2000.
  764. @item release
  765. Set the amount of milliseconds the signal from detection has to fall below the
  766. detection threshold before equalization ends.
  767. Default is 200. Allowed range is between 1 and 2000.
  768. @item ratio
  769. Set the ratio by which the equalization gain is raised.
  770. Default is 1. Allowed range is between 0 and 30.
  771. @item makeup
  772. Set the makeup offset by which the equalization gain is raised.
  773. Default is 0. Allowed range is between 0 and 100.
  774. @item range
  775. Set the max allowed cut/boost amount. Default is 50.
  776. Allowed range is from 1 to 200.
  777. @item mode
  778. Set the mode of filter operation, can be one of the following:
  779. @table @samp
  780. @item listen
  781. Output only isolated bandpass signal.
  782. @item cut
  783. Cut frequencies above detection threshold.
  784. @item boost
  785. Boost frequencies bellow detection threshold.
  786. @end table
  787. Default mode is @samp{cut}.
  788. @item tftype
  789. Set the type of target filter, can be one of the following:
  790. @table @samp
  791. @item bell
  792. @item lowshelf
  793. @item highshelf
  794. @end table
  795. Default type is @samp{bell}.
  796. @item direction
  797. Set processing direction relative to threshold.
  798. @table @samp
  799. @item downward
  800. Boost/Cut if threshold is higher/lower than detected volume.
  801. @item upward
  802. Boost/Cut if threshold is lower/higher than detected volume.
  803. @end table
  804. Default direction is @samp{downward}.
  805. @item auto
  806. Automatically gather threshold from detection filter. By default
  807. is @samp{disabled}.
  808. This option is useful to detect threshold in certain time frame of
  809. input audio stream, in such case option value is changed at runtime.
  810. Available values are:
  811. @table @samp
  812. @item disabled
  813. Disable using automatically gathered threshold value.
  814. @item off
  815. Stop picking threshold value.
  816. @item on
  817. Start picking threshold value.
  818. @end table
  819. @end table
  820. @subsection Commands
  821. This filter supports the all above options as @ref{commands}.
  822. @section adynamicsmooth
  823. Apply dynamic smoothing to input audio stream.
  824. A description of the accepted options follows.
  825. @table @option
  826. @item sensitivity
  827. Set an amount of sensitivity to frequency fluctations. Default is 2.
  828. Allowed range is from 0 to 1e+06.
  829. @item basefreq
  830. Set a base frequency for smoothing. Default value is 22050.
  831. Allowed range is from 2 to 1e+06.
  832. @end table
  833. @subsection Commands
  834. This filter supports the all above options as @ref{commands}.
  835. @section aecho
  836. Apply echoing to the input audio.
  837. Echoes are reflected sound and can occur naturally amongst mountains
  838. (and sometimes large buildings) when talking or shouting; digital echo
  839. effects emulate this behaviour and are often used to help fill out the
  840. sound of a single instrument or vocal. The time difference between the
  841. original signal and the reflection is the @code{delay}, and the
  842. loudness of the reflected signal is the @code{decay}.
  843. Multiple echoes can have different delays and decays.
  844. A description of the accepted parameters follows.
  845. @table @option
  846. @item in_gain
  847. Set input gain of reflected signal. Default is @code{0.6}.
  848. @item out_gain
  849. Set output gain of reflected signal. Default is @code{0.3}.
  850. @item delays
  851. Set list of time intervals in milliseconds between original signal and reflections
  852. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  853. Default is @code{1000}.
  854. @item decays
  855. Set list of loudness of reflected signals separated by '|'.
  856. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  857. Default is @code{0.5}.
  858. @end table
  859. @subsection Examples
  860. @itemize
  861. @item
  862. Make it sound as if there are twice as many instruments as are actually playing:
  863. @example
  864. aecho=0.8:0.88:60:0.4
  865. @end example
  866. @item
  867. If delay is very short, then it sounds like a (metallic) robot playing music:
  868. @example
  869. aecho=0.8:0.88:6:0.4
  870. @end example
  871. @item
  872. A longer delay will sound like an open air concert in the mountains:
  873. @example
  874. aecho=0.8:0.9:1000:0.3
  875. @end example
  876. @item
  877. Same as above but with one more mountain:
  878. @example
  879. aecho=0.8:0.9:1000|1800:0.3|0.25
  880. @end example
  881. @end itemize
  882. @section aemphasis
  883. Audio emphasis filter creates or restores material directly taken from LPs or
  884. emphased CDs with different filter curves. E.g. to store music on vinyl the
  885. signal has to be altered by a filter first to even out the disadvantages of
  886. this recording medium.
  887. Once the material is played back the inverse filter has to be applied to
  888. restore the distortion of the frequency response.
  889. The filter accepts the following options:
  890. @table @option
  891. @item level_in
  892. Set input gain.
  893. @item level_out
  894. Set output gain.
  895. @item mode
  896. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  897. use @code{production} mode. Default is @code{reproduction} mode.
  898. @item type
  899. Set filter type. Selects medium. Can be one of the following:
  900. @table @option
  901. @item col
  902. select Columbia.
  903. @item emi
  904. select EMI.
  905. @item bsi
  906. select BSI (78RPM).
  907. @item riaa
  908. select RIAA.
  909. @item cd
  910. select Compact Disc (CD).
  911. @item 50fm
  912. select 50µs (FM).
  913. @item 75fm
  914. select 75µs (FM).
  915. @item 50kf
  916. select 50µs (FM-KF).
  917. @item 75kf
  918. select 75µs (FM-KF).
  919. @end table
  920. @end table
  921. @subsection Commands
  922. This filter supports the all above options as @ref{commands}.
  923. @section aeval
  924. Modify an audio signal according to the specified expressions.
  925. This filter accepts one or more expressions (one for each channel),
  926. which are evaluated and used to modify a corresponding audio signal.
  927. It accepts the following parameters:
  928. @table @option
  929. @item exprs
  930. Set the '|'-separated expressions list for each separate channel. If
  931. the number of input channels is greater than the number of
  932. expressions, the last specified expression is used for the remaining
  933. output channels.
  934. @item channel_layout, c
  935. Set output channel layout. If not specified, the channel layout is
  936. specified by the number of expressions. If set to @samp{same}, it will
  937. use by default the same input channel layout.
  938. @end table
  939. Each expression in @var{exprs} can contain the following constants and functions:
  940. @table @option
  941. @item ch
  942. channel number of the current expression
  943. @item n
  944. number of the evaluated sample, starting from 0
  945. @item s
  946. sample rate
  947. @item t
  948. time of the evaluated sample expressed in seconds
  949. @item nb_in_channels
  950. @item nb_out_channels
  951. input and output number of channels
  952. @item val(CH)
  953. the value of input channel with number @var{CH}
  954. @end table
  955. Note: this filter is slow. For faster processing you should use a
  956. dedicated filter.
  957. @subsection Examples
  958. @itemize
  959. @item
  960. Half volume:
  961. @example
  962. aeval=val(ch)/2:c=same
  963. @end example
  964. @item
  965. Invert phase of the second channel:
  966. @example
  967. aeval=val(0)|-val(1)
  968. @end example
  969. @end itemize
  970. @section aexciter
  971. An exciter is used to produce high sound that is not present in the
  972. original signal. This is done by creating harmonic distortions of the
  973. signal which are restricted in range and added to the original signal.
  974. An Exciter raises the upper end of an audio signal without simply raising
  975. the higher frequencies like an equalizer would do to create a more
  976. "crisp" or "brilliant" sound.
  977. The filter accepts the following options:
  978. @table @option
  979. @item level_in
  980. Set input level prior processing of signal.
  981. Allowed range is from 0 to 64.
  982. Default value is 1.
  983. @item level_out
  984. Set output level after processing of signal.
  985. Allowed range is from 0 to 64.
  986. Default value is 1.
  987. @item amount
  988. Set the amount of harmonics added to original signal.
  989. Allowed range is from 0 to 64.
  990. Default value is 1.
  991. @item drive
  992. Set the amount of newly created harmonics.
  993. Allowed range is from 0.1 to 10.
  994. Default value is 8.5.
  995. @item blend
  996. Set the octave of newly created harmonics.
  997. Allowed range is from -10 to 10.
  998. Default value is 0.
  999. @item freq
  1000. Set the lower frequency limit of producing harmonics in Hz.
  1001. Allowed range is from 2000 to 12000 Hz.
  1002. Default is 7500 Hz.
  1003. @item ceil
  1004. Set the upper frequency limit of producing harmonics.
  1005. Allowed range is from 9999 to 20000 Hz.
  1006. If value is lower than 10000 Hz no limit is applied.
  1007. @item listen
  1008. Mute the original signal and output only added harmonics.
  1009. By default is disabled.
  1010. @end table
  1011. @subsection Commands
  1012. This filter supports the all above options as @ref{commands}.
  1013. @anchor{afade}
  1014. @section afade
  1015. Apply fade-in/out effect to input audio.
  1016. A description of the accepted parameters follows.
  1017. @table @option
  1018. @item type, t
  1019. Specify the effect type, can be either @code{in} for fade-in, or
  1020. @code{out} for a fade-out effect. Default is @code{in}.
  1021. @item start_sample, ss
  1022. Specify the number of the start sample for starting to apply the fade
  1023. effect. Default is 0.
  1024. @item nb_samples, ns
  1025. Specify the number of samples for which the fade effect has to last. At
  1026. the end of the fade-in effect the output audio will have the same
  1027. volume as the input audio, at the end of the fade-out transition
  1028. the output audio will be silence. Default is 44100.
  1029. @item start_time, st
  1030. Specify the start time of the fade effect. Default is 0.
  1031. The value must be specified as a time duration; see
  1032. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1033. for the accepted syntax.
  1034. If set this option is used instead of @var{start_sample}.
  1035. @item duration, d
  1036. Specify the duration of the fade effect. See
  1037. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1038. for the accepted syntax.
  1039. At the end of the fade-in effect the output audio will have the same
  1040. volume as the input audio, at the end of the fade-out transition
  1041. the output audio will be silence.
  1042. By default the duration is determined by @var{nb_samples}.
  1043. If set this option is used instead of @var{nb_samples}.
  1044. @item curve
  1045. Set curve for fade transition.
  1046. It accepts the following values:
  1047. @table @option
  1048. @item tri
  1049. select triangular, linear slope (default)
  1050. @item qsin
  1051. select quarter of sine wave
  1052. @item hsin
  1053. select half of sine wave
  1054. @item esin
  1055. select exponential sine wave
  1056. @item log
  1057. select logarithmic
  1058. @item ipar
  1059. select inverted parabola
  1060. @item qua
  1061. select quadratic
  1062. @item cub
  1063. select cubic
  1064. @item squ
  1065. select square root
  1066. @item cbr
  1067. select cubic root
  1068. @item par
  1069. select parabola
  1070. @item exp
  1071. select exponential
  1072. @item iqsin
  1073. select inverted quarter of sine wave
  1074. @item ihsin
  1075. select inverted half of sine wave
  1076. @item dese
  1077. select double-exponential seat
  1078. @item desi
  1079. select double-exponential sigmoid
  1080. @item losi
  1081. select logistic sigmoid
  1082. @item sinc
  1083. select sine cardinal function
  1084. @item isinc
  1085. select inverted sine cardinal function
  1086. @item nofade
  1087. no fade applied
  1088. @end table
  1089. @item silence
  1090. Set the initial gain for fade-in or final gain for fade-out.
  1091. Default value is @code{0.0}.
  1092. @item unity
  1093. Set the initial gain for fade-out or final gain for fade-in.
  1094. Default value is @code{1.0}.
  1095. @end table
  1096. @subsection Commands
  1097. This filter supports the all above options as @ref{commands}.
  1098. @subsection Examples
  1099. @itemize
  1100. @item
  1101. Fade in first 15 seconds of audio:
  1102. @example
  1103. afade=t=in:ss=0:d=15
  1104. @end example
  1105. @item
  1106. Fade out last 25 seconds of a 900 seconds audio:
  1107. @example
  1108. afade=t=out:st=875:d=25
  1109. @end example
  1110. @end itemize
  1111. @section afftdn
  1112. Denoise audio samples with FFT.
  1113. A description of the accepted parameters follows.
  1114. @table @option
  1115. @item noise_reduction, nr
  1116. Set the noise reduction in dB, allowed range is 0.01 to 97.
  1117. Default value is 12 dB.
  1118. @item noise_floor, nf
  1119. Set the noise floor in dB, allowed range is -80 to -20.
  1120. Default value is -50 dB.
  1121. @item noise_type, nt
  1122. Set the noise type.
  1123. It accepts the following values:
  1124. @table @option
  1125. @item white, w
  1126. Select white noise.
  1127. @item vinyl, v
  1128. Select vinyl noise.
  1129. @item shellac, s
  1130. Select shellac noise.
  1131. @item custom, c
  1132. Select custom noise, defined in @code{bn} option.
  1133. Default value is white noise.
  1134. @end table
  1135. @item band_noise, bn
  1136. Set custom band noise profile for every one of 15 bands.
  1137. Bands are separated by ' ' or '|'.
  1138. @item residual_floor, rf
  1139. Set the residual floor in dB, allowed range is -80 to -20.
  1140. Default value is -38 dB.
  1141. @item track_noise, tn
  1142. Enable noise floor tracking. By default is disabled.
  1143. With this enabled, noise floor is automatically adjusted.
  1144. @item track_residual, tr
  1145. Enable residual tracking. By default is disabled.
  1146. @item output_mode, om
  1147. Set the output mode.
  1148. It accepts the following values:
  1149. @table @option
  1150. @item input, i
  1151. Pass input unchanged.
  1152. @item output, o
  1153. Pass noise filtered out.
  1154. @item noise, n
  1155. Pass only noise.
  1156. Default value is @var{output}.
  1157. @end table
  1158. @item adaptivity, ad
  1159. Set the adaptivity factor, used how fast to adapt gains adjustments per
  1160. each frequency bin. Value @var{0} enables instant adaptation, while higher values
  1161. react much slower.
  1162. Allowed range is from @var{0} to @var{1}. Default value is @var{0.5}.
  1163. @item floor_offset, fo
  1164. Set the noise floor offset factor. This option is used to adjust offset applied to measured
  1165. noise floor. It is only effective when noise floor tracking is enabled.
  1166. Allowed range is from @var{-2.0} to @var{2.0}. Default value is @var{1.0}.
  1167. @item noise_link, nl
  1168. Set the noise link used for multichannel audio.
  1169. It accepts the following values:
  1170. @table @option
  1171. @item none
  1172. Use unchanged channel's noise floor.
  1173. @item min
  1174. Use measured min noise floor of all channels.
  1175. @item max
  1176. Use measured max noise floor of all channels.
  1177. @item average
  1178. Use measured average noise floor of all channels.
  1179. Default value is @var{min}.
  1180. @end table
  1181. @item band_multiplier, bm
  1182. Set the band multiplier factor, used how much to spread bands across frequency bins.
  1183. Allowed range is from @var{0.2} to @var{5}. Default value is @var{1.25}.
  1184. @item sample_noise, sn
  1185. Toggle capturing and measurement of noise profile from input audio.
  1186. It accepts the following values:
  1187. @table @option
  1188. @item start, begin
  1189. Start sample noise capture.
  1190. @item stop, end
  1191. Stop sample noise capture and measure new noise band profile.
  1192. Default value is @code{none}.
  1193. @end table
  1194. @item gain_smooth, gs
  1195. Set gain smooth spatial radius, used to smooth gains applied to each frequency bin.
  1196. Useful to reduce random music noise artefacts.
  1197. Higher values increases smoothing of gains.
  1198. Allowed range is from @code{0} to @code{50}.
  1199. Default value is @code{0}.
  1200. @end table
  1201. @subsection Commands
  1202. This filter supports the some above mentioned options as @ref{commands}.
  1203. @subsection Examples
  1204. @itemize
  1205. @item
  1206. Reduce white noise by 10dB, and use previously measured noise floor of -40dB:
  1207. @example
  1208. afftdn=nr=10:nf=-40
  1209. @end example
  1210. @item
  1211. Reduce white noise by 10dB, also set initial noise floor to -80dB and enable automatic
  1212. tracking of noise floor so noise floor will gradually change during processing:
  1213. @example
  1214. afftdn=nr=10:nf=-80:tn=1
  1215. @end example
  1216. @item
  1217. Reduce noise by 20dB, using noise floor of -40dB and using commands to take noise profile
  1218. of first 0.4 seconds of input audio:
  1219. @example
  1220. asendcmd=0.0 afftdn sn start,asendcmd=0.4 afftdn sn stop,afftdn=nr=20:nf=-40
  1221. @end example
  1222. @end itemize
  1223. @section afftfilt
  1224. Apply arbitrary expressions to samples in frequency domain.
  1225. @table @option
  1226. @item real
  1227. Set frequency domain real expression for each separate channel separated
  1228. by '|'. Default is "re".
  1229. If the number of input channels is greater than the number of
  1230. expressions, the last specified expression is used for the remaining
  1231. output channels.
  1232. @item imag
  1233. Set frequency domain imaginary expression for each separate channel
  1234. separated by '|'. Default is "im".
  1235. Each expression in @var{real} and @var{imag} can contain the following
  1236. constants and functions:
  1237. @table @option
  1238. @item sr
  1239. sample rate
  1240. @item b
  1241. current frequency bin number
  1242. @item nb
  1243. number of available bins
  1244. @item ch
  1245. channel number of the current expression
  1246. @item chs
  1247. number of channels
  1248. @item pts
  1249. current frame pts
  1250. @item re
  1251. current real part of frequency bin of current channel
  1252. @item im
  1253. current imaginary part of frequency bin of current channel
  1254. @item real(b, ch)
  1255. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  1256. @item imag(b, ch)
  1257. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  1258. @end table
  1259. @item win_size
  1260. Set window size. Allowed range is from 16 to 131072.
  1261. Default is @code{4096}
  1262. @item win_func
  1263. Set window function.
  1264. It accepts the following values:
  1265. @table @samp
  1266. @item rect
  1267. @item bartlett
  1268. @item hann, hanning
  1269. @item hamming
  1270. @item blackman
  1271. @item welch
  1272. @item flattop
  1273. @item bharris
  1274. @item bnuttall
  1275. @item bhann
  1276. @item sine
  1277. @item nuttall
  1278. @item lanczos
  1279. @item gauss
  1280. @item tukey
  1281. @item dolph
  1282. @item cauchy
  1283. @item parzen
  1284. @item poisson
  1285. @item bohman
  1286. @item kaiser
  1287. @end table
  1288. Default is @code{hann}.
  1289. @item overlap
  1290. Set window overlap. If set to 1, the recommended overlap for selected
  1291. window function will be picked. Default is @code{0.75}.
  1292. @end table
  1293. @subsection Examples
  1294. @itemize
  1295. @item
  1296. Leave almost only low frequencies in audio:
  1297. @example
  1298. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  1299. @end example
  1300. @item
  1301. Apply robotize effect:
  1302. @example
  1303. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  1304. @end example
  1305. @item
  1306. Apply whisper effect:
  1307. @example
  1308. afftfilt="real='hypot(re,im)*cos((random(0)*2-1)*2*3.14)':imag='hypot(re,im)*sin((random(1)*2-1)*2*3.14)':win_size=128:overlap=0.8"
  1309. @end example
  1310. @item
  1311. Apply phase shift:
  1312. @example
  1313. afftfilt="real=re*cos(1)-im*sin(1):imag=re*sin(1)+im*cos(1)"
  1314. @end example
  1315. @end itemize
  1316. @anchor{afir}
  1317. @section afir
  1318. Apply an arbitrary Finite Impulse Response filter.
  1319. This filter is designed for applying long FIR filters,
  1320. up to 60 seconds long.
  1321. It can be used as component for digital crossover filters,
  1322. room equalization, cross talk cancellation, wavefield synthesis,
  1323. auralization, ambiophonics, ambisonics and spatialization.
  1324. This filter uses the streams higher than first one as FIR coefficients.
  1325. If the non-first stream holds a single channel, it will be used
  1326. for all input channels in the first stream, otherwise
  1327. the number of channels in the non-first stream must be same as
  1328. the number of channels in the first stream.
  1329. It accepts the following parameters:
  1330. @table @option
  1331. @item dry
  1332. Set dry gain. This sets input gain.
  1333. @item wet
  1334. Set wet gain. This sets final output gain.
  1335. @item length
  1336. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  1337. @item gtype
  1338. Enable applying gain measured from power of IR.
  1339. Set which approach to use for auto gain measurement.
  1340. @table @option
  1341. @item none
  1342. Do not apply any gain.
  1343. @item peak
  1344. select peak gain, very conservative approach. This is default value.
  1345. @item dc
  1346. select DC gain, limited application.
  1347. @item gn
  1348. select gain to noise approach, this is most popular one.
  1349. @item ac
  1350. select AC gain.
  1351. @item rms
  1352. select RMS gain.
  1353. @end table
  1354. @item irgain
  1355. Set gain to be applied to IR coefficients before filtering.
  1356. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  1357. @item irfmt
  1358. Set format of IR stream. Can be @code{mono} or @code{input}.
  1359. Default is @code{input}.
  1360. @item maxir
  1361. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  1362. Allowed range is 0.1 to 60 seconds.
  1363. @item response
  1364. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1365. By default it is disabled.
  1366. @item channel
  1367. Set for which IR channel to display frequency response. By default is first channel
  1368. displayed. This option is used only when @var{response} is enabled.
  1369. @item size
  1370. Set video stream size. This option is used only when @var{response} is enabled.
  1371. @item rate
  1372. Set video stream frame rate. This option is used only when @var{response} is enabled.
  1373. @item minp
  1374. Set minimal partition size used for convolution. Default is @var{8192}.
  1375. Allowed range is from @var{1} to @var{65536}.
  1376. Lower values decreases latency at cost of higher CPU usage.
  1377. @item maxp
  1378. Set maximal partition size used for convolution. Default is @var{8192}.
  1379. Allowed range is from @var{8} to @var{65536}.
  1380. Lower values may increase CPU usage.
  1381. @item nbirs
  1382. Set number of input impulse responses streams which will be switchable at runtime.
  1383. Allowed range is from @var{1} to @var{32}. Default is @var{1}.
  1384. @item ir
  1385. Set IR stream which will be used for convolution, starting from @var{0}, should always be
  1386. lower than supplied value by @code{nbirs} option. Default is @var{0}.
  1387. This option can be changed at runtime via @ref{commands}.
  1388. @item precision
  1389. Set which precision to use when processing samples.
  1390. @table @option
  1391. @item auto
  1392. Auto pick internal sample format depending on other filters.
  1393. @item float
  1394. Always use single-floating point precision sample format.
  1395. @item double
  1396. Always use double-floating point precision sample format.
  1397. @end table
  1398. Default value is auto.
  1399. @end table
  1400. @subsection Examples
  1401. @itemize
  1402. @item
  1403. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  1404. @example
  1405. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  1406. @end example
  1407. @item
  1408. Apply true stereo processing given input stereo stream, and two stereo impulse responses for left and right channel,
  1409. the impulse response files are files with names l_ir.wav and r_ir.wav:
  1410. @example
  1411. "pan=4C|c0=FL|c1=FL|c2=FR|c3=FR[a];amovie=l_ir.wav[LIR];amovie=r_ir.wav[RIR];[LIR][RIR]amerge[ir];[a][ir]afir=irfmt=input:gtype=gn:irgain=-5dB,pan=stereo|FL<c0+c2|FR<c1+c3"
  1412. @end example
  1413. @end itemize
  1414. @anchor{aformat}
  1415. @section aformat
  1416. Set output format constraints for the input audio. The framework will
  1417. negotiate the most appropriate format to minimize conversions.
  1418. It accepts the following parameters:
  1419. @table @option
  1420. @item sample_fmts, f
  1421. A '|'-separated list of requested sample formats.
  1422. @item sample_rates, r
  1423. A '|'-separated list of requested sample rates.
  1424. @item channel_layouts, cl
  1425. A '|'-separated list of requested channel layouts.
  1426. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1427. for the required syntax.
  1428. @end table
  1429. If a parameter is omitted, all values are allowed.
  1430. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1431. @example
  1432. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1433. @end example
  1434. @section afreqshift
  1435. Apply frequency shift to input audio samples.
  1436. The filter accepts the following options:
  1437. @table @option
  1438. @item shift
  1439. Specify frequency shift. Allowed range is -INT_MAX to INT_MAX.
  1440. Default value is 0.0.
  1441. @item level
  1442. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  1443. Default value is 1.0.
  1444. @item order
  1445. Set filter order used for filtering. Allowed range is from 1 to 16.
  1446. Default value is 8.
  1447. @end table
  1448. @subsection Commands
  1449. This filter supports the all above options as @ref{commands}.
  1450. @section afwtdn
  1451. Reduce broadband noise from input samples using Wavelets.
  1452. A description of the accepted options follows.
  1453. @table @option
  1454. @item sigma
  1455. Set the noise sigma, allowed range is from 0 to 1.
  1456. Default value is 0.
  1457. This option controls strength of denoising applied to input samples.
  1458. Most useful way to set this option is via decibels, eg. -45dB.
  1459. @item levels
  1460. Set the number of wavelet levels of decomposition.
  1461. Allowed range is from 1 to 12.
  1462. Default value is 10.
  1463. Setting this too low make denoising performance very poor.
  1464. @item wavet
  1465. Set wavelet type for decomposition of input frame.
  1466. They are sorted by number of coefficients, from lowest to highest.
  1467. More coefficients means worse filtering speed, but overall better quality.
  1468. Available wavelets are:
  1469. @table @samp
  1470. @item sym2
  1471. @item sym4
  1472. @item rbior68
  1473. @item deb10
  1474. @item sym10
  1475. @item coif5
  1476. @item bl3
  1477. @end table
  1478. @item percent
  1479. Set percent of full denoising. Allowed range is from 0 to 100 percent.
  1480. Default value is 85 percent or partial denoising.
  1481. @item profile
  1482. If enabled, first input frame will be used as noise profile.
  1483. If first frame samples contain non-noise performance will be very poor.
  1484. @item adaptive
  1485. If enabled, input frames are analyzed for presence of noise.
  1486. If noise is detected with high possibility then input frame profile will be
  1487. used for processing following frames, until new noise frame is detected.
  1488. @item samples
  1489. Set size of single frame in number of samples. Allowed range is from 512 to
  1490. 65536. Default frame size is 8192 samples.
  1491. @item softness
  1492. Set softness applied inside thresholding function. Allowed range is from 0 to
  1493. 10. Default softness is 1.
  1494. @end table
  1495. @subsection Commands
  1496. This filter supports the all above options as @ref{commands}.
  1497. @section agate
  1498. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1499. processing reduces disturbing noise between useful signals.
  1500. Gating is done by detecting the volume below a chosen level @var{threshold}
  1501. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1502. floor is set via @var{range}. Because an exact manipulation of the signal
  1503. would cause distortion of the waveform the reduction can be levelled over
  1504. time. This is done by setting @var{attack} and @var{release}.
  1505. @var{attack} determines how long the signal has to fall below the threshold
  1506. before any reduction will occur and @var{release} sets the time the signal
  1507. has to rise above the threshold to reduce the reduction again.
  1508. Shorter signals than the chosen attack time will be left untouched.
  1509. @table @option
  1510. @item level_in
  1511. Set input level before filtering.
  1512. Default is 1. Allowed range is from 0.015625 to 64.
  1513. @item mode
  1514. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1515. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1516. will be amplified, expanding dynamic range in upward direction.
  1517. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1518. @item range
  1519. Set the level of gain reduction when the signal is below the threshold.
  1520. Default is 0.06125. Allowed range is from 0 to 1.
  1521. Setting this to 0 disables reduction and then filter behaves like expander.
  1522. @item threshold
  1523. If a signal rises above this level the gain reduction is released.
  1524. Default is 0.125. Allowed range is from 0 to 1.
  1525. @item ratio
  1526. Set a ratio by which the signal is reduced.
  1527. Default is 2. Allowed range is from 1 to 9000.
  1528. @item attack
  1529. Amount of milliseconds the signal has to rise above the threshold before gain
  1530. reduction stops.
  1531. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1532. @item release
  1533. Amount of milliseconds the signal has to fall below the threshold before the
  1534. reduction is increased again. Default is 250 milliseconds.
  1535. Allowed range is from 0.01 to 9000.
  1536. @item makeup
  1537. Set amount of amplification of signal after processing.
  1538. Default is 1. Allowed range is from 1 to 64.
  1539. @item knee
  1540. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1541. Default is 2.828427125. Allowed range is from 1 to 8.
  1542. @item detection
  1543. Choose if exact signal should be taken for detection or an RMS like one.
  1544. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1545. @item link
  1546. Choose if the average level between all channels or the louder channel affects
  1547. the reduction.
  1548. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1549. @end table
  1550. @subsection Commands
  1551. This filter supports the all above options as @ref{commands}.
  1552. @section aiir
  1553. Apply an arbitrary Infinite Impulse Response filter.
  1554. It accepts the following parameters:
  1555. @table @option
  1556. @item zeros, z
  1557. Set B/numerator/zeros/reflection coefficients.
  1558. @item poles, p
  1559. Set A/denominator/poles/ladder coefficients.
  1560. @item gains, k
  1561. Set channels gains.
  1562. @item dry_gain
  1563. Set input gain.
  1564. @item wet_gain
  1565. Set output gain.
  1566. @item format, f
  1567. Set coefficients format.
  1568. @table @samp
  1569. @item ll
  1570. lattice-ladder function
  1571. @item sf
  1572. analog transfer function
  1573. @item tf
  1574. digital transfer function
  1575. @item zp
  1576. Z-plane zeros/poles, cartesian (default)
  1577. @item pr
  1578. Z-plane zeros/poles, polar radians
  1579. @item pd
  1580. Z-plane zeros/poles, polar degrees
  1581. @item sp
  1582. S-plane zeros/poles
  1583. @end table
  1584. @item process, r
  1585. Set type of processing.
  1586. @table @samp
  1587. @item d
  1588. direct processing
  1589. @item s
  1590. serial processing
  1591. @item p
  1592. parallel processing
  1593. @end table
  1594. @item precision, e
  1595. Set filtering precision.
  1596. @table @samp
  1597. @item dbl
  1598. double-precision floating-point (default)
  1599. @item flt
  1600. single-precision floating-point
  1601. @item i32
  1602. 32-bit integers
  1603. @item i16
  1604. 16-bit integers
  1605. @end table
  1606. @item normalize, n
  1607. Normalize filter coefficients, by default is enabled.
  1608. Enabling it will normalize magnitude response at DC to 0dB.
  1609. @item mix
  1610. How much to use filtered signal in output. Default is 1.
  1611. Range is between 0 and 1.
  1612. @item response
  1613. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1614. By default it is disabled.
  1615. @item channel
  1616. Set for which IR channel to display frequency response. By default is first channel
  1617. displayed. This option is used only when @var{response} is enabled.
  1618. @item size
  1619. Set video stream size. This option is used only when @var{response} is enabled.
  1620. @end table
  1621. Coefficients in @code{tf} and @code{sf} format are separated by spaces and are in ascending
  1622. order.
  1623. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1624. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1625. imaginary unit.
  1626. Different coefficients and gains can be provided for every channel, in such case
  1627. use '|' to separate coefficients or gains. Last provided coefficients will be
  1628. used for all remaining channels.
  1629. @subsection Examples
  1630. @itemize
  1631. @item
  1632. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1633. @example
  1634. 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
  1635. @end example
  1636. @item
  1637. Same as above but in @code{zp} format:
  1638. @example
  1639. 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
  1640. @end example
  1641. @item
  1642. Apply 3-rd order analog normalized Butterworth low-pass filter, using analog transfer function format:
  1643. @example
  1644. aiir=z=1.3057 0 0 0:p=1.3057 2.3892 2.1860 1:f=sf:r=d
  1645. @end example
  1646. @end itemize
  1647. @section alimiter
  1648. The limiter prevents an input signal from rising over a desired threshold.
  1649. This limiter uses lookahead technology to prevent your signal from distorting.
  1650. It means that there is a small delay after the signal is processed. Keep in mind
  1651. that the delay it produces is the attack time you set.
  1652. The filter accepts the following options:
  1653. @table @option
  1654. @item level_in
  1655. Set input gain. Default is 1.
  1656. @item level_out
  1657. Set output gain. Default is 1.
  1658. @item limit
  1659. Don't let signals above this level pass the limiter. Default is 1.
  1660. @item attack
  1661. The limiter will reach its attenuation level in this amount of time in
  1662. milliseconds. Default is 5 milliseconds.
  1663. @item release
  1664. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1665. Default is 50 milliseconds.
  1666. @item asc
  1667. When gain reduction is always needed ASC takes care of releasing to an
  1668. average reduction level rather than reaching a reduction of 0 in the release
  1669. time.
  1670. @item asc_level
  1671. Select how much the release time is affected by ASC, 0 means nearly no changes
  1672. in release time while 1 produces higher release times.
  1673. @item level
  1674. Auto level output signal. Default is enabled.
  1675. This normalizes audio back to 0dB if enabled.
  1676. @item latency
  1677. Compensate the delay introduced by using the lookahead buffer set with attack
  1678. parameter. Also flush the valid audio data in the lookahead buffer when the
  1679. stream hits EOF.
  1680. @end table
  1681. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1682. with @ref{aresample} before applying this filter.
  1683. @section allpass
  1684. Apply a two-pole all-pass filter with central frequency (in Hz)
  1685. @var{frequency}, and filter-width @var{width}.
  1686. An all-pass filter changes the audio's frequency to phase relationship
  1687. without changing its frequency to amplitude relationship.
  1688. The filter accepts the following options:
  1689. @table @option
  1690. @item frequency, f
  1691. Set frequency in Hz.
  1692. @item width_type, t
  1693. Set method to specify band-width of filter.
  1694. @table @option
  1695. @item h
  1696. Hz
  1697. @item q
  1698. Q-Factor
  1699. @item o
  1700. octave
  1701. @item s
  1702. slope
  1703. @item k
  1704. kHz
  1705. @end table
  1706. @item width, w
  1707. Specify the band-width of a filter in width_type units.
  1708. @item mix, m
  1709. How much to use filtered signal in output. Default is 1.
  1710. Range is between 0 and 1.
  1711. @item channels, c
  1712. Specify which channels to filter, by default all available are filtered.
  1713. @item normalize, n
  1714. Normalize biquad coefficients, by default is disabled.
  1715. Enabling it will normalize magnitude response at DC to 0dB.
  1716. @item order, o
  1717. Set the filter order, can be 1 or 2. Default is 2.
  1718. @item transform, a
  1719. Set transform type of IIR filter.
  1720. @table @option
  1721. @item di
  1722. @item dii
  1723. @item tdi
  1724. @item tdii
  1725. @item latt
  1726. @item svf
  1727. @item zdf
  1728. @end table
  1729. @item precision, r
  1730. Set precison of filtering.
  1731. @table @option
  1732. @item auto
  1733. Pick automatic sample format depending on surround filters.
  1734. @item s16
  1735. Always use signed 16-bit.
  1736. @item s32
  1737. Always use signed 32-bit.
  1738. @item f32
  1739. Always use float 32-bit.
  1740. @item f64
  1741. Always use float 64-bit.
  1742. @end table
  1743. @end table
  1744. @subsection Commands
  1745. This filter supports the following commands:
  1746. @table @option
  1747. @item frequency, f
  1748. Change allpass frequency.
  1749. Syntax for the command is : "@var{frequency}"
  1750. @item width_type, t
  1751. Change allpass width_type.
  1752. Syntax for the command is : "@var{width_type}"
  1753. @item width, w
  1754. Change allpass width.
  1755. Syntax for the command is : "@var{width}"
  1756. @item mix, m
  1757. Change allpass mix.
  1758. Syntax for the command is : "@var{mix}"
  1759. @end table
  1760. @section aloop
  1761. Loop audio samples.
  1762. The filter accepts the following options:
  1763. @table @option
  1764. @item loop
  1765. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1766. Default is 0.
  1767. @item size
  1768. Set maximal number of samples. Default is 0.
  1769. @item start
  1770. Set first sample of loop. Default is 0.
  1771. @end table
  1772. @anchor{amerge}
  1773. @section amerge
  1774. Merge two or more audio streams into a single multi-channel stream.
  1775. The filter accepts the following options:
  1776. @table @option
  1777. @item inputs
  1778. Set the number of inputs. Default is 2.
  1779. @end table
  1780. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1781. the channel layout of the output will be set accordingly and the channels
  1782. will be reordered as necessary. If the channel layouts of the inputs are not
  1783. disjoint, the output will have all the channels of the first input then all
  1784. the channels of the second input, in that order, and the channel layout of
  1785. the output will be the default value corresponding to the total number of
  1786. channels.
  1787. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1788. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1789. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1790. first input, b1 is the first channel of the second input).
  1791. On the other hand, if both input are in stereo, the output channels will be
  1792. in the default order: a1, a2, b1, b2, and the channel layout will be
  1793. arbitrarily set to 4.0, which may or may not be the expected value.
  1794. All inputs must have the same sample rate, and format.
  1795. If inputs do not have the same duration, the output will stop with the
  1796. shortest.
  1797. @subsection Examples
  1798. @itemize
  1799. @item
  1800. Merge two mono files into a stereo stream:
  1801. @example
  1802. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1803. @end example
  1804. @item
  1805. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1806. @example
  1807. 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
  1808. @end example
  1809. @end itemize
  1810. @section amix
  1811. Mixes multiple audio inputs into a single output.
  1812. Note that this filter only supports float samples (the @var{amerge}
  1813. and @var{pan} audio filters support many formats). If the @var{amix}
  1814. input has integer samples then @ref{aresample} will be automatically
  1815. inserted to perform the conversion to float samples.
  1816. It accepts the following parameters:
  1817. @table @option
  1818. @item inputs
  1819. The number of inputs. If unspecified, it defaults to 2.
  1820. @item duration
  1821. How to determine the end-of-stream.
  1822. @table @option
  1823. @item longest
  1824. The duration of the longest input. (default)
  1825. @item shortest
  1826. The duration of the shortest input.
  1827. @item first
  1828. The duration of the first input.
  1829. @end table
  1830. @item dropout_transition
  1831. The transition time, in seconds, for volume renormalization when an input
  1832. stream ends. The default value is 2 seconds.
  1833. @item weights
  1834. Specify weight of each input audio stream as a sequence of numbers separated
  1835. by a space. If fewer weights are specified compared to number of inputs, the
  1836. last weight is assigned to the remaining inputs.
  1837. Default weight for each input is 1.
  1838. @item normalize
  1839. Always scale inputs instead of only doing summation of samples.
  1840. Beware of heavy clipping if inputs are not normalized prior or after filtering
  1841. by this filter if this option is disabled. By default is enabled.
  1842. @end table
  1843. @subsection Examples
  1844. @itemize
  1845. @item
  1846. This will mix 3 input audio streams to a single output with the same duration as the
  1847. first input and a dropout transition time of 3 seconds:
  1848. @example
  1849. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1850. @end example
  1851. @item
  1852. This will mix one vocal and one music input audio stream to a single output with the same duration as the
  1853. longest input. The music will have quarter the weight as the vocals, and the inputs are not normalized:
  1854. @example
  1855. ffmpeg -i VOCALS -i MUSIC -filter_complex amix=inputs=2:duration=longest:dropout_transition=0:weights="1 0.25":normalize=0 OUTPUT
  1856. @end example
  1857. @end itemize
  1858. @subsection Commands
  1859. This filter supports the following commands:
  1860. @table @option
  1861. @item weights
  1862. @item normalize
  1863. Syntax is same as option with same name.
  1864. @end table
  1865. @section amultiply
  1866. Multiply first audio stream with second audio stream and store result
  1867. in output audio stream. Multiplication is done by multiplying each
  1868. sample from first stream with sample at same position from second stream.
  1869. With this element-wise multiplication one can create amplitude fades and
  1870. amplitude modulations.
  1871. @section anequalizer
  1872. High-order parametric multiband equalizer for each channel.
  1873. It accepts the following parameters:
  1874. @table @option
  1875. @item params
  1876. This option string is in format:
  1877. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1878. Each equalizer band is separated by '|'.
  1879. @table @option
  1880. @item chn
  1881. Set channel number to which equalization will be applied.
  1882. If input doesn't have that channel the entry is ignored.
  1883. @item f
  1884. Set central frequency for band.
  1885. If input doesn't have that frequency the entry is ignored.
  1886. @item w
  1887. Set band width in Hertz.
  1888. @item g
  1889. Set band gain in dB.
  1890. @item t
  1891. Set filter type for band, optional, can be:
  1892. @table @samp
  1893. @item 0
  1894. Butterworth, this is default.
  1895. @item 1
  1896. Chebyshev type 1.
  1897. @item 2
  1898. Chebyshev type 2.
  1899. @end table
  1900. @end table
  1901. @item curves
  1902. With this option activated frequency response of anequalizer is displayed
  1903. in video stream.
  1904. @item size
  1905. Set video stream size. Only useful if curves option is activated.
  1906. @item mgain
  1907. Set max gain that will be displayed. Only useful if curves option is activated.
  1908. Setting this to a reasonable value makes it possible to display gain which is derived from
  1909. neighbour bands which are too close to each other and thus produce higher gain
  1910. when both are activated.
  1911. @item fscale
  1912. Set frequency scale used to draw frequency response in video output.
  1913. Can be linear or logarithmic. Default is logarithmic.
  1914. @item colors
  1915. Set color for each channel curve which is going to be displayed in video stream.
  1916. This is list of color names separated by space or by '|'.
  1917. Unrecognised or missing colors will be replaced by white color.
  1918. @end table
  1919. @subsection Examples
  1920. @itemize
  1921. @item
  1922. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1923. for first 2 channels using Chebyshev type 1 filter:
  1924. @example
  1925. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1926. @end example
  1927. @end itemize
  1928. @subsection Commands
  1929. This filter supports the following commands:
  1930. @table @option
  1931. @item change
  1932. Alter existing filter parameters.
  1933. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1934. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1935. error is returned.
  1936. @var{freq} set new frequency parameter.
  1937. @var{width} set new width parameter in Hertz.
  1938. @var{gain} set new gain parameter in dB.
  1939. Full filter invocation with asendcmd may look like this:
  1940. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1941. @end table
  1942. @section anlmdn
  1943. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1944. Each sample is adjusted by looking for other samples with similar contexts. This
  1945. context similarity is defined by comparing their surrounding patches of size
  1946. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1947. The filter accepts the following options:
  1948. @table @option
  1949. @item strength, s
  1950. Set denoising strength. Allowed range is from 0.00001 to 10000. Default value is 0.00001.
  1951. @item patch, p
  1952. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1953. Default value is 2 milliseconds.
  1954. @item research, r
  1955. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1956. Default value is 6 milliseconds.
  1957. @item output, o
  1958. Set the output mode.
  1959. It accepts the following values:
  1960. @table @option
  1961. @item i
  1962. Pass input unchanged.
  1963. @item o
  1964. Pass noise filtered out.
  1965. @item n
  1966. Pass only noise.
  1967. Default value is @var{o}.
  1968. @end table
  1969. @item smooth, m
  1970. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{1000}.
  1971. @end table
  1972. @subsection Commands
  1973. This filter supports the all above options as @ref{commands}.
  1974. @section anlmf, anlms
  1975. Apply Normalized Least-Mean-(Squares|Fourth) algorithm to the first audio stream using the second audio stream.
  1976. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1977. relate to producing the least mean square of the error signal (difference between the desired,
  1978. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1979. A description of the accepted options follows.
  1980. @table @option
  1981. @item order
  1982. Set filter order.
  1983. @item mu
  1984. Set filter mu.
  1985. @item eps
  1986. Set the filter eps.
  1987. @item leakage
  1988. Set the filter leakage.
  1989. @item out_mode
  1990. It accepts the following values:
  1991. @table @option
  1992. @item i
  1993. Pass the 1st input.
  1994. @item d
  1995. Pass the 2nd input.
  1996. @item o
  1997. Pass filtered samples.
  1998. @item n
  1999. Pass difference between desired and filtered samples.
  2000. Default value is @var{o}.
  2001. @end table
  2002. @end table
  2003. @subsection Examples
  2004. @itemize
  2005. @item
  2006. One of many usages of this filter is noise reduction, input audio is filtered
  2007. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  2008. @example
  2009. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  2010. @end example
  2011. @end itemize
  2012. @subsection Commands
  2013. This filter supports the same commands as options, excluding option @code{order}.
  2014. @section anull
  2015. Pass the audio source unchanged to the output.
  2016. @section apad
  2017. Pad the end of an audio stream with silence.
  2018. This can be used together with @command{ffmpeg} @option{-shortest} to
  2019. extend audio streams to the same length as the video stream.
  2020. A description of the accepted options follows.
  2021. @table @option
  2022. @item packet_size
  2023. Set silence packet size. Default value is 4096.
  2024. @item pad_len
  2025. Set the number of samples of silence to add to the end. After the
  2026. value is reached, the stream is terminated. This option is mutually
  2027. exclusive with @option{whole_len}.
  2028. @item whole_len
  2029. Set the minimum total number of samples in the output audio stream. If
  2030. the value is longer than the input audio length, silence is added to
  2031. the end, until the value is reached. This option is mutually exclusive
  2032. with @option{pad_len}.
  2033. @item pad_dur
  2034. Specify the duration of samples of silence to add. See
  2035. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2036. for the accepted syntax. Used only if set to non-negative value.
  2037. @item whole_dur
  2038. Specify the minimum total duration in the output audio stream. See
  2039. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2040. for the accepted syntax. Used only if set to non-negative value. If the value is longer than
  2041. the input audio length, silence is added to the end, until the value is reached.
  2042. This option is mutually exclusive with @option{pad_dur}
  2043. @end table
  2044. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  2045. nor @option{whole_dur} option is set, the filter will add silence to the end of
  2046. the input stream indefinitely.
  2047. Note that for ffmpeg 4.4 and earlier a zero @option{pad_dur} or
  2048. @option{whole_dur} also caused the filter to add silence indefinitely.
  2049. @subsection Examples
  2050. @itemize
  2051. @item
  2052. Add 1024 samples of silence to the end of the input:
  2053. @example
  2054. apad=pad_len=1024
  2055. @end example
  2056. @item
  2057. Make sure the audio output will contain at least 10000 samples, pad
  2058. the input with silence if required:
  2059. @example
  2060. apad=whole_len=10000
  2061. @end example
  2062. @item
  2063. Use @command{ffmpeg} to pad the audio input with silence, so that the
  2064. video stream will always result the shortest and will be converted
  2065. until the end in the output file when using the @option{shortest}
  2066. option:
  2067. @example
  2068. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  2069. @end example
  2070. @end itemize
  2071. @section aphaser
  2072. Add a phasing effect to the input audio.
  2073. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  2074. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  2075. A description of the accepted parameters follows.
  2076. @table @option
  2077. @item in_gain
  2078. Set input gain. Default is 0.4.
  2079. @item out_gain
  2080. Set output gain. Default is 0.74
  2081. @item delay
  2082. Set delay in milliseconds. Default is 3.0.
  2083. @item decay
  2084. Set decay. Default is 0.4.
  2085. @item speed
  2086. Set modulation speed in Hz. Default is 0.5.
  2087. @item type
  2088. Set modulation type. Default is triangular.
  2089. It accepts the following values:
  2090. @table @samp
  2091. @item triangular, t
  2092. @item sinusoidal, s
  2093. @end table
  2094. @end table
  2095. @section aphaseshift
  2096. Apply phase shift to input audio samples.
  2097. The filter accepts the following options:
  2098. @table @option
  2099. @item shift
  2100. Specify phase shift. Allowed range is from -1.0 to 1.0.
  2101. Default value is 0.0.
  2102. @item level
  2103. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  2104. Default value is 1.0.
  2105. @item order
  2106. Set filter order used for filtering. Allowed range is from 1 to 16.
  2107. Default value is 8.
  2108. @end table
  2109. @subsection Commands
  2110. This filter supports the all above options as @ref{commands}.
  2111. @section apsyclip
  2112. Apply Psychoacoustic clipper to input audio stream.
  2113. The filter accepts the following options:
  2114. @table @option
  2115. @item level_in
  2116. Set input gain. By default it is 1. Range is [0.015625 - 64].
  2117. @item level_out
  2118. Set output gain. By default it is 1. Range is [0.015625 - 64].
  2119. @item clip
  2120. Set the clipping start value. Default value is 0dBFS or 1.
  2121. @item diff
  2122. Output only difference samples, useful to hear introduced distortions.
  2123. By default is disabled.
  2124. @item adaptive
  2125. Set strength of adaptive distortion applied. Default value is 0.5.
  2126. Allowed range is from 0 to 1.
  2127. @item iterations
  2128. Set number of iterations of psychoacoustic clipper.
  2129. Allowed range is from 1 to 20. Default value is 10.
  2130. @item level
  2131. Auto level output signal. Default is disabled.
  2132. This normalizes audio back to 0dBFS if enabled.
  2133. @end table
  2134. @subsection Commands
  2135. This filter supports the all above options as @ref{commands}.
  2136. @section apulsator
  2137. Audio pulsator is something between an autopanner and a tremolo.
  2138. But it can produce funny stereo effects as well. Pulsator changes the volume
  2139. of the left and right channel based on a LFO (low frequency oscillator) with
  2140. different waveforms and shifted phases.
  2141. This filter have the ability to define an offset between left and right
  2142. channel. An offset of 0 means that both LFO shapes match each other.
  2143. The left and right channel are altered equally - a conventional tremolo.
  2144. An offset of 50% means that the shape of the right channel is exactly shifted
  2145. in phase (or moved backwards about half of the frequency) - pulsator acts as
  2146. an autopanner. At 1 both curves match again. Every setting in between moves the
  2147. phase shift gapless between all stages and produces some "bypassing" sounds with
  2148. sine and triangle waveforms. The more you set the offset near 1 (starting from
  2149. the 0.5) the faster the signal passes from the left to the right speaker.
  2150. The filter accepts the following options:
  2151. @table @option
  2152. @item level_in
  2153. Set input gain. By default it is 1. Range is [0.015625 - 64].
  2154. @item level_out
  2155. Set output gain. By default it is 1. Range is [0.015625 - 64].
  2156. @item mode
  2157. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  2158. sawup or sawdown. Default is sine.
  2159. @item amount
  2160. Set modulation. Define how much of original signal is affected by the LFO.
  2161. @item offset_l
  2162. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  2163. @item offset_r
  2164. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  2165. @item width
  2166. Set pulse width. Default is 1. Allowed range is [0 - 2].
  2167. @item timing
  2168. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  2169. @item bpm
  2170. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  2171. is set to bpm.
  2172. @item ms
  2173. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  2174. is set to ms.
  2175. @item hz
  2176. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  2177. if timing is set to hz.
  2178. @end table
  2179. @anchor{aresample}
  2180. @section aresample
  2181. Resample the input audio to the specified parameters, using the
  2182. libswresample library. If none are specified then the filter will
  2183. automatically convert between its input and output.
  2184. This filter is also able to stretch/squeeze the audio data to make it match
  2185. the timestamps or to inject silence / cut out audio to make it match the
  2186. timestamps, do a combination of both or do neither.
  2187. The filter accepts the syntax
  2188. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  2189. expresses a sample rate and @var{resampler_options} is a list of
  2190. @var{key}=@var{value} pairs, separated by ":". See the
  2191. @ref{Resampler Options,,"Resampler Options" section in the
  2192. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  2193. for the complete list of supported options.
  2194. @subsection Examples
  2195. @itemize
  2196. @item
  2197. Resample the input audio to 44100Hz:
  2198. @example
  2199. aresample=44100
  2200. @end example
  2201. @item
  2202. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  2203. samples per second compensation:
  2204. @example
  2205. aresample=async=1000
  2206. @end example
  2207. @end itemize
  2208. @section areverse
  2209. Reverse an audio clip.
  2210. Warning: This filter requires memory to buffer the entire clip, so trimming
  2211. is suggested.
  2212. @subsection Examples
  2213. @itemize
  2214. @item
  2215. Take the first 5 seconds of a clip, and reverse it.
  2216. @example
  2217. atrim=end=5,areverse
  2218. @end example
  2219. @end itemize
  2220. @section arnndn
  2221. Reduce noise from speech using Recurrent Neural Networks.
  2222. This filter accepts the following options:
  2223. @table @option
  2224. @item model, m
  2225. Set train model file to load. This option is always required.
  2226. @item mix
  2227. Set how much to mix filtered samples into final output.
  2228. Allowed range is from -1 to 1. Default value is 1.
  2229. Negative values are special, they set how much to keep filtered noise
  2230. in the final filter output. Set this option to -1 to hear actual
  2231. noise removed from input signal.
  2232. @end table
  2233. @subsection Commands
  2234. This filter supports the all above options as @ref{commands}.
  2235. @section asdr
  2236. Measure Audio Signal-to-Distortion Ratio.
  2237. This filter takes two audio streams for input, and outputs first
  2238. audio stream.
  2239. Results are in dB per channel at end of either input.
  2240. @section asetnsamples
  2241. Set the number of samples per each output audio frame.
  2242. The last output packet may contain a different number of samples, as
  2243. the filter will flush all the remaining samples when the input audio
  2244. signals its end.
  2245. The filter accepts the following options:
  2246. @table @option
  2247. @item nb_out_samples, n
  2248. Set the number of frames per each output audio frame. The number is
  2249. intended as the number of samples @emph{per each channel}.
  2250. Default value is 1024.
  2251. @item pad, p
  2252. If set to 1, the filter will pad the last audio frame with zeroes, so
  2253. that the last frame will contain the same number of samples as the
  2254. previous ones. Default value is 1.
  2255. @end table
  2256. For example, to set the number of per-frame samples to 1234 and
  2257. disable padding for the last frame, use:
  2258. @example
  2259. asetnsamples=n=1234:p=0
  2260. @end example
  2261. @section asetrate
  2262. Set the sample rate without altering the PCM data.
  2263. This will result in a change of speed and pitch.
  2264. The filter accepts the following options:
  2265. @table @option
  2266. @item sample_rate, r
  2267. Set the output sample rate. Default is 44100 Hz.
  2268. @end table
  2269. @section ashowinfo
  2270. Show a line containing various information for each input audio frame.
  2271. The input audio is not modified.
  2272. The shown line contains a sequence of key/value pairs of the form
  2273. @var{key}:@var{value}.
  2274. The following values are shown in the output:
  2275. @table @option
  2276. @item n
  2277. The (sequential) number of the input frame, starting from 0.
  2278. @item pts
  2279. The presentation timestamp of the input frame, in time base units; the time base
  2280. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  2281. @item pts_time
  2282. The presentation timestamp of the input frame in seconds.
  2283. @item pos
  2284. position of the frame in the input stream, -1 if this information in
  2285. unavailable and/or meaningless (for example in case of synthetic audio)
  2286. @item fmt
  2287. The sample format.
  2288. @item chlayout
  2289. The channel layout.
  2290. @item rate
  2291. The sample rate for the audio frame.
  2292. @item nb_samples
  2293. The number of samples (per channel) in the frame.
  2294. @item checksum
  2295. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  2296. audio, the data is treated as if all the planes were concatenated.
  2297. @item plane_checksums
  2298. A list of Adler-32 checksums for each data plane.
  2299. @end table
  2300. @section asoftclip
  2301. Apply audio soft clipping.
  2302. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  2303. along a smooth curve, rather than the abrupt shape of hard-clipping.
  2304. This filter accepts the following options:
  2305. @table @option
  2306. @item type
  2307. Set type of soft-clipping.
  2308. It accepts the following values:
  2309. @table @option
  2310. @item hard
  2311. @item tanh
  2312. @item atan
  2313. @item cubic
  2314. @item exp
  2315. @item alg
  2316. @item quintic
  2317. @item sin
  2318. @item erf
  2319. @end table
  2320. @item threshold
  2321. Set threshold from where to start clipping. Default value is 0dB or 1.
  2322. @item output
  2323. Set gain applied to output. Default value is 0dB or 1.
  2324. @item param
  2325. Set additional parameter which controls sigmoid function.
  2326. @item oversample
  2327. Set oversampling factor.
  2328. @end table
  2329. @subsection Commands
  2330. This filter supports the all above options as @ref{commands}.
  2331. @section aspectralstats
  2332. Display frequency domain statistical information about the audio channels.
  2333. Statistics are calculated and stored as metadata for each audio channel and for each audio frame.
  2334. It accepts the following option:
  2335. @table @option
  2336. @item win_size
  2337. Set the window length in samples. Default value is 2048.
  2338. Allowed range is from 32 to 65536.
  2339. @item win_func
  2340. Set window function.
  2341. It accepts the following values:
  2342. @table @samp
  2343. @item rect
  2344. @item bartlett
  2345. @item hann, hanning
  2346. @item hamming
  2347. @item blackman
  2348. @item welch
  2349. @item flattop
  2350. @item bharris
  2351. @item bnuttall
  2352. @item bhann
  2353. @item sine
  2354. @item nuttall
  2355. @item lanczos
  2356. @item gauss
  2357. @item tukey
  2358. @item dolph
  2359. @item cauchy
  2360. @item parzen
  2361. @item poisson
  2362. @item bohman
  2363. @item kaiser
  2364. @end table
  2365. Default is @code{hann}.
  2366. @item overlap
  2367. Set window overlap. Allowed range is from @code{0}
  2368. to @code{1}. Default value is @code{0.5}.
  2369. @item measure
  2370. Select the parameters which are measured. The metadata keys can
  2371. be used as flags, default is @option{all} which measures everything.
  2372. @option{none} disables all measurement.
  2373. @end table
  2374. A list of each metadata key follows:
  2375. @table @option
  2376. @item mean
  2377. @item variance
  2378. @item centroid
  2379. @item spread
  2380. @item skewness
  2381. @item kurtosis
  2382. @item entropy
  2383. @item flatness
  2384. @item crest
  2385. @item flux
  2386. @item slope
  2387. @item decrease
  2388. @item rolloff
  2389. @end table
  2390. @section asr
  2391. Automatic Speech Recognition
  2392. This filter uses PocketSphinx for speech recognition. To enable
  2393. compilation of this filter, you need to configure FFmpeg with
  2394. @code{--enable-pocketsphinx}.
  2395. It accepts the following options:
  2396. @table @option
  2397. @item rate
  2398. Set sampling rate of input audio. Defaults is @code{16000}.
  2399. This need to match speech models, otherwise one will get poor results.
  2400. @item hmm
  2401. Set dictionary containing acoustic model files.
  2402. @item dict
  2403. Set pronunciation dictionary.
  2404. @item lm
  2405. Set language model file.
  2406. @item lmctl
  2407. Set language model set.
  2408. @item lmname
  2409. Set which language model to use.
  2410. @item logfn
  2411. Set output for log messages.
  2412. @end table
  2413. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  2414. @anchor{astats}
  2415. @section astats
  2416. Display time domain statistical information about the audio channels.
  2417. Statistics are calculated and displayed for each audio channel and,
  2418. where applicable, an overall figure is also given.
  2419. It accepts the following option:
  2420. @table @option
  2421. @item length
  2422. Short window length in seconds, used for peak and trough RMS measurement.
  2423. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0 - 10]}.
  2424. @item metadata
  2425. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  2426. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  2427. disabled.
  2428. Available keys for each channel are:
  2429. @var{Bit_depth}
  2430. @var{Crest_factor}
  2431. @var{DC_offset}
  2432. @var{Dynamic_range}
  2433. @var{Entropy}
  2434. @var{Flat_factor}
  2435. @var{Max_difference}
  2436. @var{Max_level}
  2437. @var{Mean_difference}
  2438. @var{Min_difference}
  2439. @var{Min_level}
  2440. @var{Noise_floor}
  2441. @var{Noise_floor_count}
  2442. @var{Number_of_Infs}
  2443. @var{Number_of_NaNs}
  2444. @var{Number_of_denormals}
  2445. @var{Peak_count}
  2446. @var{Peak_level}
  2447. @var{RMS_difference}
  2448. @var{RMS_peak}
  2449. @var{RMS_trough}
  2450. @var{Zero_crossings}
  2451. @var{Zero_crossings_rate}
  2452. and for @code{Overall}:
  2453. @var{Bit_depth}
  2454. @var{DC_offset}
  2455. @var{Entropy}
  2456. @var{Flat_factor}
  2457. @var{Max_difference}
  2458. @var{Max_level}
  2459. @var{Mean_difference}
  2460. @var{Min_difference}
  2461. @var{Min_level}
  2462. @var{Noise_floor}
  2463. @var{Noise_floor_count}
  2464. @var{Number_of_Infs}
  2465. @var{Number_of_NaNs}
  2466. @var{Number_of_denormals}
  2467. @var{Number_of_samples}
  2468. @var{Peak_count}
  2469. @var{Peak_level}
  2470. @var{RMS_difference}
  2471. @var{RMS_level}
  2472. @var{RMS_peak}
  2473. @var{RMS_trough}
  2474. For example, a full key looks like @code{lavfi.astats.1.DC_offset} or
  2475. @code{lavfi.astats.Overall.Peak_count}.
  2476. Read below for the description of the keys.
  2477. @item reset
  2478. Set the number of frames over which cumulative stats are calculated before
  2479. being reset. Default is disabled.
  2480. @item measure_perchannel
  2481. Select the parameters which are measured per channel. The metadata keys can
  2482. be used as flags, default is @option{all} which measures everything.
  2483. @option{none} disables all per channel measurement.
  2484. @item measure_overall
  2485. Select the parameters which are measured overall. The metadata keys can
  2486. be used as flags, default is @option{all} which measures everything.
  2487. @option{none} disables all overall measurement.
  2488. @end table
  2489. A description of the measure keys follow:
  2490. @table @option
  2491. @item none
  2492. no measures
  2493. @item all
  2494. all measures
  2495. @item Bit_depth
  2496. overall bit depth of audio, i.e. number of bits used for each sample
  2497. @item Crest_factor
  2498. standard ratio of peak to RMS level (note: not in dB)
  2499. @item DC_offset
  2500. mean amplitude displacement from zero
  2501. @item Dynamic_range
  2502. measured dynamic range of audio in dB
  2503. @item Entropy
  2504. entropy measured across whole audio, entropy of value near 1.0 is typically measured for white noise
  2505. @item Flat_factor
  2506. flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  2507. (i.e. either @var{Min_level} or @var{Max_level})
  2508. @item Max_difference
  2509. maximal difference between two consecutive samples
  2510. @item Max_level
  2511. maximal sample level
  2512. @item Mean_difference
  2513. mean difference between two consecutive samples, i.e. the average of each difference between two consecutive samples
  2514. @item Min_difference
  2515. minimal difference between two consecutive samples
  2516. @item Min_level
  2517. minimal sample level
  2518. @item Noise_floor
  2519. minimum local peak measured in dBFS over a short window
  2520. @item Noise_floor_count
  2521. number of occasions (not the number of samples) that the signal attained
  2522. @var{Noise floor}
  2523. @item Number_of_Infs
  2524. number of samples with an infinite value
  2525. @item Number_of_NaNs
  2526. number of samples with a NaN (not a number) value
  2527. @item Number_of_denormals
  2528. number of samples with a subnormal value
  2529. @item Number_of_samples
  2530. number of samples
  2531. @item Peak_count
  2532. number of occasions (not the number of samples) that the signal attained either
  2533. @var{Min_level} or @var{Max_level}
  2534. @item Peak_level
  2535. standard peak level measured in dBFS
  2536. @item RMS_difference
  2537. Root Mean Square difference between two consecutive samples
  2538. @item RMS_level
  2539. standard RMS level measured in dBFS
  2540. @item RMS_peak
  2541. @item RMS_trough
  2542. peak and trough values for RMS level measured over a short window,
  2543. measured in dBFS.
  2544. @item Zero crossings
  2545. number of points where the waveform crosses the zero level axis
  2546. @item Zero crossings rate
  2547. rate of Zero crossings and number of audio samples
  2548. @end table
  2549. @section asubboost
  2550. Boost subwoofer frequencies.
  2551. The filter accepts the following options:
  2552. @table @option
  2553. @item dry
  2554. Set dry gain, how much of original signal is kept. Allowed range is from 0 to 1.
  2555. Default value is 1.0.
  2556. @item wet
  2557. Set wet gain, how much of filtered signal is kept. Allowed range is from 0 to 1.
  2558. Default value is 1.0.
  2559. @item boost
  2560. Set max boost factor. Allowed range is from 1 to 12. Default value is 2.
  2561. @item decay
  2562. Set delay line decay gain value. Allowed range is from 0 to 1.
  2563. Default value is 0.0.
  2564. @item feedback
  2565. Set delay line feedback gain value. Allowed range is from 0 to 1.
  2566. Default value is 0.9.
  2567. @item cutoff
  2568. Set cutoff frequency in Hertz. Allowed range is 50 to 900.
  2569. Default value is 100.
  2570. @item slope
  2571. Set slope amount for cutoff frequency. Allowed range is 0.0001 to 1.
  2572. Default value is 0.5.
  2573. @item delay
  2574. Set delay. Allowed range is from 1 to 100.
  2575. Default value is 20.
  2576. @item channels
  2577. Set the channels to process. Default value is all available.
  2578. @end table
  2579. @subsection Commands
  2580. This filter supports the all above options as @ref{commands}.
  2581. @section asubcut
  2582. Cut subwoofer frequencies.
  2583. This filter allows to set custom, steeper
  2584. roll off than highpass filter, and thus is able to more attenuate
  2585. frequency content in stop-band.
  2586. The filter accepts the following options:
  2587. @table @option
  2588. @item cutoff
  2589. Set cutoff frequency in Hertz. Allowed range is 2 to 200.
  2590. Default value is 20.
  2591. @item order
  2592. Set filter order. Available values are from 3 to 20.
  2593. Default value is 10.
  2594. @item level
  2595. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2596. @end table
  2597. @subsection Commands
  2598. This filter supports the all above options as @ref{commands}.
  2599. @section asupercut
  2600. Cut super frequencies.
  2601. The filter accepts the following options:
  2602. @table @option
  2603. @item cutoff
  2604. Set cutoff frequency in Hertz. Allowed range is 20000 to 192000.
  2605. Default value is 20000.
  2606. @item order
  2607. Set filter order. Available values are from 3 to 20.
  2608. Default value is 10.
  2609. @item level
  2610. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2611. @end table
  2612. @subsection Commands
  2613. This filter supports the all above options as @ref{commands}.
  2614. @section asuperpass
  2615. Apply high order Butterworth band-pass filter.
  2616. The filter accepts the following options:
  2617. @table @option
  2618. @item centerf
  2619. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2620. Default value is 1000.
  2621. @item order
  2622. Set filter order. Available values are from 4 to 20.
  2623. Default value is 4.
  2624. @item qfactor
  2625. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2626. @item level
  2627. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2628. @end table
  2629. @subsection Commands
  2630. This filter supports the all above options as @ref{commands}.
  2631. @section asuperstop
  2632. Apply high order Butterworth band-stop filter.
  2633. The filter accepts the following options:
  2634. @table @option
  2635. @item centerf
  2636. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2637. Default value is 1000.
  2638. @item order
  2639. Set filter order. Available values are from 4 to 20.
  2640. Default value is 4.
  2641. @item qfactor
  2642. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2643. @item level
  2644. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2645. @end table
  2646. @subsection Commands
  2647. This filter supports the all above options as @ref{commands}.
  2648. @section atempo
  2649. Adjust audio tempo.
  2650. The filter accepts exactly one parameter, the audio tempo. If not
  2651. specified then the filter will assume nominal 1.0 tempo. Tempo must
  2652. be in the [0.5, 100.0] range.
  2653. Note that tempo greater than 2 will skip some samples rather than
  2654. blend them in. If for any reason this is a concern it is always
  2655. possible to daisy-chain several instances of atempo to achieve the
  2656. desired product tempo.
  2657. @subsection Examples
  2658. @itemize
  2659. @item
  2660. Slow down audio to 80% tempo:
  2661. @example
  2662. atempo=0.8
  2663. @end example
  2664. @item
  2665. To speed up audio to 300% tempo:
  2666. @example
  2667. atempo=3
  2668. @end example
  2669. @item
  2670. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  2671. @example
  2672. atempo=sqrt(3),atempo=sqrt(3)
  2673. @end example
  2674. @end itemize
  2675. @subsection Commands
  2676. This filter supports the following commands:
  2677. @table @option
  2678. @item tempo
  2679. Change filter tempo scale factor.
  2680. Syntax for the command is : "@var{tempo}"
  2681. @end table
  2682. @section atilt
  2683. Apply spectral tilt filter to audio stream.
  2684. This filter apply any spectral roll-off slope over any specified frequency band.
  2685. The filter accepts the following options:
  2686. @table @option
  2687. @item freq
  2688. Set central frequency of tilt in Hz. Default is 10000 Hz.
  2689. @item slope
  2690. Set slope direction of tilt. Default is 0. Allowed range is from -1 to 1.
  2691. @item width
  2692. Set width of tilt. Default is 1000. Allowed range is from 100 to 10000.
  2693. @item order
  2694. Set order of tilt filter.
  2695. @item level
  2696. Set input volume level. Allowed range is from 0 to 4.
  2697. Defalt is 1.
  2698. @end table
  2699. @subsection Commands
  2700. This filter supports the all above options as @ref{commands}.
  2701. @section atrim
  2702. Trim the input so that the output contains one continuous subpart of the input.
  2703. It accepts the following parameters:
  2704. @table @option
  2705. @item start
  2706. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  2707. sample with the timestamp @var{start} will be the first sample in the output.
  2708. @item end
  2709. Specify time of the first audio sample that will be dropped, i.e. the
  2710. audio sample immediately preceding the one with the timestamp @var{end} will be
  2711. the last sample in the output.
  2712. @item start_pts
  2713. Same as @var{start}, except this option sets the start timestamp in samples
  2714. instead of seconds.
  2715. @item end_pts
  2716. Same as @var{end}, except this option sets the end timestamp in samples instead
  2717. of seconds.
  2718. @item duration
  2719. The maximum duration of the output in seconds.
  2720. @item start_sample
  2721. The number of the first sample that should be output.
  2722. @item end_sample
  2723. The number of the first sample that should be dropped.
  2724. @end table
  2725. @option{start}, @option{end}, and @option{duration} are expressed as time
  2726. duration specifications; see
  2727. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  2728. Note that the first two sets of the start/end options and the @option{duration}
  2729. option look at the frame timestamp, while the _sample options simply count the
  2730. samples that pass through the filter. So start/end_pts and start/end_sample will
  2731. give different results when the timestamps are wrong, inexact or do not start at
  2732. zero. Also note that this filter does not modify the timestamps. If you wish
  2733. to have the output timestamps start at zero, insert the asetpts filter after the
  2734. atrim filter.
  2735. If multiple start or end options are set, this filter tries to be greedy and
  2736. keep all samples that match at least one of the specified constraints. To keep
  2737. only the part that matches all the constraints at once, chain multiple atrim
  2738. filters.
  2739. The defaults are such that all the input is kept. So it is possible to set e.g.
  2740. just the end values to keep everything before the specified time.
  2741. Examples:
  2742. @itemize
  2743. @item
  2744. Drop everything except the second minute of input:
  2745. @example
  2746. ffmpeg -i INPUT -af atrim=60:120
  2747. @end example
  2748. @item
  2749. Keep only the first 1000 samples:
  2750. @example
  2751. ffmpeg -i INPUT -af atrim=end_sample=1000
  2752. @end example
  2753. @end itemize
  2754. @section axcorrelate
  2755. Calculate normalized windowed cross-correlation between two input audio streams.
  2756. Resulted samples are always between -1 and 1 inclusive.
  2757. If result is 1 it means two input samples are highly correlated in that selected segment.
  2758. Result 0 means they are not correlated at all.
  2759. If result is -1 it means two input samples are out of phase, which means they cancel each
  2760. other.
  2761. The filter accepts the following options:
  2762. @table @option
  2763. @item size
  2764. Set size of segment over which cross-correlation is calculated.
  2765. Default is 256. Allowed range is from 2 to 131072.
  2766. @item algo
  2767. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast}.
  2768. Default is @code{slow}. Fast algorithm assumes mean values over any given segment
  2769. are always zero and thus need much less calculations to make.
  2770. This is generally not true, but is valid for typical audio streams.
  2771. @end table
  2772. @subsection Examples
  2773. @itemize
  2774. @item
  2775. Calculate correlation between channels in stereo audio stream:
  2776. @example
  2777. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  2778. @end example
  2779. @end itemize
  2780. @section bandpass
  2781. Apply a two-pole Butterworth band-pass filter with central
  2782. frequency @var{frequency}, and (3dB-point) band-width width.
  2783. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  2784. instead of the default: constant 0dB peak gain.
  2785. The filter roll off at 6dB per octave (20dB per decade).
  2786. The filter accepts the following options:
  2787. @table @option
  2788. @item frequency, f
  2789. Set the filter's central frequency. Default is @code{3000}.
  2790. @item csg
  2791. Constant skirt gain if set to 1. Defaults to 0.
  2792. @item width_type, t
  2793. Set method to specify band-width of filter.
  2794. @table @option
  2795. @item h
  2796. Hz
  2797. @item q
  2798. Q-Factor
  2799. @item o
  2800. octave
  2801. @item s
  2802. slope
  2803. @item k
  2804. kHz
  2805. @end table
  2806. @item width, w
  2807. Specify the band-width of a filter in width_type units.
  2808. @item mix, m
  2809. How much to use filtered signal in output. Default is 1.
  2810. Range is between 0 and 1.
  2811. @item channels, c
  2812. Specify which channels to filter, by default all available are filtered.
  2813. @item normalize, n
  2814. Normalize biquad coefficients, by default is disabled.
  2815. Enabling it will normalize magnitude response at DC to 0dB.
  2816. @item transform, a
  2817. Set transform type of IIR filter.
  2818. @table @option
  2819. @item di
  2820. @item dii
  2821. @item tdi
  2822. @item tdii
  2823. @item latt
  2824. @item svf
  2825. @item zdf
  2826. @end table
  2827. @item precision, r
  2828. Set precison of filtering.
  2829. @table @option
  2830. @item auto
  2831. Pick automatic sample format depending on surround filters.
  2832. @item s16
  2833. Always use signed 16-bit.
  2834. @item s32
  2835. Always use signed 32-bit.
  2836. @item f32
  2837. Always use float 32-bit.
  2838. @item f64
  2839. Always use float 64-bit.
  2840. @end table
  2841. @item block_size, b
  2842. Set block size used for reverse IIR processing. If this value is set to high enough
  2843. value (higher than impulse response length truncated when reaches near zero values) filtering
  2844. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  2845. Note that filter delay will be exactly this many samples when set to non-zero value.
  2846. @end table
  2847. @subsection Commands
  2848. This filter supports the following commands:
  2849. @table @option
  2850. @item frequency, f
  2851. Change bandpass frequency.
  2852. Syntax for the command is : "@var{frequency}"
  2853. @item width_type, t
  2854. Change bandpass width_type.
  2855. Syntax for the command is : "@var{width_type}"
  2856. @item width, w
  2857. Change bandpass width.
  2858. Syntax for the command is : "@var{width}"
  2859. @item mix, m
  2860. Change bandpass mix.
  2861. Syntax for the command is : "@var{mix}"
  2862. @end table
  2863. @section bandreject
  2864. Apply a two-pole Butterworth band-reject filter with central
  2865. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2866. The filter roll off at 6dB per octave (20dB per decade).
  2867. The filter accepts the following options:
  2868. @table @option
  2869. @item frequency, f
  2870. Set the filter's central frequency. Default is @code{3000}.
  2871. @item width_type, t
  2872. Set method to specify band-width of filter.
  2873. @table @option
  2874. @item h
  2875. Hz
  2876. @item q
  2877. Q-Factor
  2878. @item o
  2879. octave
  2880. @item s
  2881. slope
  2882. @item k
  2883. kHz
  2884. @end table
  2885. @item width, w
  2886. Specify the band-width of a filter in width_type units.
  2887. @item mix, m
  2888. How much to use filtered signal in output. Default is 1.
  2889. Range is between 0 and 1.
  2890. @item channels, c
  2891. Specify which channels to filter, by default all available are filtered.
  2892. @item normalize, n
  2893. Normalize biquad coefficients, by default is disabled.
  2894. Enabling it will normalize magnitude response at DC to 0dB.
  2895. @item transform, a
  2896. Set transform type of IIR filter.
  2897. @table @option
  2898. @item di
  2899. @item dii
  2900. @item tdi
  2901. @item tdii
  2902. @item latt
  2903. @item svf
  2904. @item zdf
  2905. @end table
  2906. @item precision, r
  2907. Set precison of filtering.
  2908. @table @option
  2909. @item auto
  2910. Pick automatic sample format depending on surround filters.
  2911. @item s16
  2912. Always use signed 16-bit.
  2913. @item s32
  2914. Always use signed 32-bit.
  2915. @item f32
  2916. Always use float 32-bit.
  2917. @item f64
  2918. Always use float 64-bit.
  2919. @end table
  2920. @item block_size, b
  2921. Set block size used for reverse IIR processing. If this value is set to high enough
  2922. value (higher than impulse response length truncated when reaches near zero values) filtering
  2923. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  2924. Note that filter delay will be exactly this many samples when set to non-zero value.
  2925. @end table
  2926. @subsection Commands
  2927. This filter supports the following commands:
  2928. @table @option
  2929. @item frequency, f
  2930. Change bandreject frequency.
  2931. Syntax for the command is : "@var{frequency}"
  2932. @item width_type, t
  2933. Change bandreject width_type.
  2934. Syntax for the command is : "@var{width_type}"
  2935. @item width, w
  2936. Change bandreject width.
  2937. Syntax for the command is : "@var{width}"
  2938. @item mix, m
  2939. Change bandreject mix.
  2940. Syntax for the command is : "@var{mix}"
  2941. @end table
  2942. @section bass, lowshelf
  2943. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2944. shelving filter with a response similar to that of a standard
  2945. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2946. The filter accepts the following options:
  2947. @table @option
  2948. @item gain, g
  2949. Give the gain at 0 Hz. Its useful range is about -20
  2950. (for a large cut) to +20 (for a large boost).
  2951. Beware of clipping when using a positive gain.
  2952. @item frequency, f
  2953. Set the filter's central frequency and so can be used
  2954. to extend or reduce the frequency range to be boosted or cut.
  2955. The default value is @code{100} Hz.
  2956. @item width_type, t
  2957. Set method to specify band-width of filter.
  2958. @table @option
  2959. @item h
  2960. Hz
  2961. @item q
  2962. Q-Factor
  2963. @item o
  2964. octave
  2965. @item s
  2966. slope
  2967. @item k
  2968. kHz
  2969. @end table
  2970. @item width, w
  2971. Determine how steep is the filter's shelf transition.
  2972. @item poles, p
  2973. Set number of poles. Default is 2.
  2974. @item mix, m
  2975. How much to use filtered signal in output. Default is 1.
  2976. Range is between 0 and 1.
  2977. @item channels, c
  2978. Specify which channels to filter, by default all available are filtered.
  2979. @item normalize, n
  2980. Normalize biquad coefficients, by default is disabled.
  2981. Enabling it will normalize magnitude response at DC to 0dB.
  2982. @item transform, a
  2983. Set transform type of IIR filter.
  2984. @table @option
  2985. @item di
  2986. @item dii
  2987. @item tdi
  2988. @item tdii
  2989. @item latt
  2990. @item svf
  2991. @item zdf
  2992. @end table
  2993. @item precision, r
  2994. Set precison of filtering.
  2995. @table @option
  2996. @item auto
  2997. Pick automatic sample format depending on surround filters.
  2998. @item s16
  2999. Always use signed 16-bit.
  3000. @item s32
  3001. Always use signed 32-bit.
  3002. @item f32
  3003. Always use float 32-bit.
  3004. @item f64
  3005. Always use float 64-bit.
  3006. @end table
  3007. @item block_size, b
  3008. Set block size used for reverse IIR processing. If this value is set to high enough
  3009. value (higher than impulse response length truncated when reaches near zero values) filtering
  3010. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3011. Note that filter delay will be exactly this many samples when set to non-zero value.
  3012. @end table
  3013. @subsection Commands
  3014. This filter supports the following commands:
  3015. @table @option
  3016. @item frequency, f
  3017. Change bass frequency.
  3018. Syntax for the command is : "@var{frequency}"
  3019. @item width_type, t
  3020. Change bass width_type.
  3021. Syntax for the command is : "@var{width_type}"
  3022. @item width, w
  3023. Change bass width.
  3024. Syntax for the command is : "@var{width}"
  3025. @item gain, g
  3026. Change bass gain.
  3027. Syntax for the command is : "@var{gain}"
  3028. @item mix, m
  3029. Change bass mix.
  3030. Syntax for the command is : "@var{mix}"
  3031. @end table
  3032. @section biquad
  3033. Apply a biquad IIR filter with the given coefficients.
  3034. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  3035. are the numerator and denominator coefficients respectively.
  3036. and @var{channels}, @var{c} specify which channels to filter, by default all
  3037. available are filtered.
  3038. @subsection Commands
  3039. This filter supports the following commands:
  3040. @table @option
  3041. @item a0
  3042. @item a1
  3043. @item a2
  3044. @item b0
  3045. @item b1
  3046. @item b2
  3047. Change biquad parameter.
  3048. Syntax for the command is : "@var{value}"
  3049. @item mix, m
  3050. How much to use filtered signal in output. Default is 1.
  3051. Range is between 0 and 1.
  3052. @item channels, c
  3053. Specify which channels to filter, by default all available are filtered.
  3054. @item normalize, n
  3055. Normalize biquad coefficients, by default is disabled.
  3056. Enabling it will normalize magnitude response at DC to 0dB.
  3057. @item transform, a
  3058. Set transform type of IIR filter.
  3059. @table @option
  3060. @item di
  3061. @item dii
  3062. @item tdi
  3063. @item tdii
  3064. @item latt
  3065. @item svf
  3066. @item zdf
  3067. @end table
  3068. @item precision, r
  3069. Set precison of filtering.
  3070. @table @option
  3071. @item auto
  3072. Pick automatic sample format depending on surround filters.
  3073. @item s16
  3074. Always use signed 16-bit.
  3075. @item s32
  3076. Always use signed 32-bit.
  3077. @item f32
  3078. Always use float 32-bit.
  3079. @item f64
  3080. Always use float 64-bit.
  3081. @end table
  3082. @item block_size, b
  3083. Set block size used for reverse IIR processing. If this value is set to high enough
  3084. value (higher than impulse response length truncated when reaches near zero values) filtering
  3085. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3086. Note that filter delay will be exactly this many samples when set to non-zero value.
  3087. @end table
  3088. @section bs2b
  3089. Bauer stereo to binaural transformation, which improves headphone listening of
  3090. stereo audio records.
  3091. To enable compilation of this filter you need to configure FFmpeg with
  3092. @code{--enable-libbs2b}.
  3093. It accepts the following parameters:
  3094. @table @option
  3095. @item profile
  3096. Pre-defined crossfeed level.
  3097. @table @option
  3098. @item default
  3099. Default level (fcut=700, feed=50).
  3100. @item cmoy
  3101. Chu Moy circuit (fcut=700, feed=60).
  3102. @item jmeier
  3103. Jan Meier circuit (fcut=650, feed=95).
  3104. @end table
  3105. @item fcut
  3106. Cut frequency (in Hz).
  3107. @item feed
  3108. Feed level (in Hz).
  3109. @end table
  3110. @section channelmap
  3111. Remap input channels to new locations.
  3112. It accepts the following parameters:
  3113. @table @option
  3114. @item map
  3115. Map channels from input to output. The argument is a '|'-separated list of
  3116. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  3117. @var{in_channel} form. @var{in_channel} can be either the name of the input
  3118. channel (e.g. FL for front left) or its index in the input channel layout.
  3119. @var{out_channel} is the name of the output channel or its index in the output
  3120. channel layout. If @var{out_channel} is not given then it is implicitly an
  3121. index, starting with zero and increasing by one for each mapping.
  3122. @item channel_layout
  3123. The channel layout of the output stream.
  3124. @end table
  3125. If no mapping is present, the filter will implicitly map input channels to
  3126. output channels, preserving indices.
  3127. @subsection Examples
  3128. @itemize
  3129. @item
  3130. For example, assuming a 5.1+downmix input MOV file,
  3131. @example
  3132. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  3133. @end example
  3134. will create an output WAV file tagged as stereo from the downmix channels of
  3135. the input.
  3136. @item
  3137. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  3138. @example
  3139. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  3140. @end example
  3141. @end itemize
  3142. @section channelsplit
  3143. Split each channel from an input audio stream into a separate output stream.
  3144. It accepts the following parameters:
  3145. @table @option
  3146. @item channel_layout
  3147. The channel layout of the input stream. The default is "stereo".
  3148. @item channels
  3149. A channel layout describing the channels to be extracted as separate output streams
  3150. or "all" to extract each input channel as a separate stream. The default is "all".
  3151. Choosing channels not present in channel layout in the input will result in an error.
  3152. @end table
  3153. @subsection Examples
  3154. @itemize
  3155. @item
  3156. For example, assuming a stereo input MP3 file,
  3157. @example
  3158. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  3159. @end example
  3160. will create an output Matroska file with two audio streams, one containing only
  3161. the left channel and the other the right channel.
  3162. @item
  3163. Split a 5.1 WAV file into per-channel files:
  3164. @example
  3165. ffmpeg -i in.wav -filter_complex
  3166. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  3167. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  3168. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  3169. side_right.wav
  3170. @end example
  3171. @item
  3172. Extract only LFE from a 5.1 WAV file:
  3173. @example
  3174. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  3175. -map '[LFE]' lfe.wav
  3176. @end example
  3177. @end itemize
  3178. @section chorus
  3179. Add a chorus effect to the audio.
  3180. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  3181. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  3182. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  3183. The modulation depth defines the range the modulated delay is played before or after
  3184. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  3185. sound tuned around the original one, like in a chorus where some vocals are slightly
  3186. off key.
  3187. It accepts the following parameters:
  3188. @table @option
  3189. @item in_gain
  3190. Set input gain. Default is 0.4.
  3191. @item out_gain
  3192. Set output gain. Default is 0.4.
  3193. @item delays
  3194. Set delays. A typical delay is around 40ms to 60ms.
  3195. @item decays
  3196. Set decays.
  3197. @item speeds
  3198. Set speeds.
  3199. @item depths
  3200. Set depths.
  3201. @end table
  3202. @subsection Examples
  3203. @itemize
  3204. @item
  3205. A single delay:
  3206. @example
  3207. chorus=0.7:0.9:55:0.4:0.25:2
  3208. @end example
  3209. @item
  3210. Two delays:
  3211. @example
  3212. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  3213. @end example
  3214. @item
  3215. Fuller sounding chorus with three delays:
  3216. @example
  3217. 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
  3218. @end example
  3219. @end itemize
  3220. @section compand
  3221. Compress or expand the audio's dynamic range.
  3222. It accepts the following parameters:
  3223. @table @option
  3224. @item attacks
  3225. @item decays
  3226. A list of times in seconds for each channel over which the instantaneous level
  3227. of the input signal is averaged to determine its volume. @var{attacks} refers to
  3228. increase of volume and @var{decays} refers to decrease of volume. For most
  3229. situations, the attack time (response to the audio getting louder) should be
  3230. shorter than the decay time, because the human ear is more sensitive to sudden
  3231. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  3232. a typical value for decay is 0.8 seconds.
  3233. If specified number of attacks & decays is lower than number of channels, the last
  3234. set attack/decay will be used for all remaining channels.
  3235. @item points
  3236. A list of points for the transfer function, specified in dB relative to the
  3237. maximum possible signal amplitude. Each key points list must be defined using
  3238. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  3239. @code{x0/y0 x1/y1 x2/y2 ....}
  3240. The input values must be in strictly increasing order but the transfer function
  3241. does not have to be monotonically rising. The point @code{0/0} is assumed but
  3242. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  3243. function are @code{-70/-70|-60/-20|1/0}.
  3244. @item soft-knee
  3245. Set the curve radius in dB for all joints. It defaults to 0.01.
  3246. @item gain
  3247. Set the additional gain in dB to be applied at all points on the transfer
  3248. function. This allows for easy adjustment of the overall gain.
  3249. It defaults to 0.
  3250. @item volume
  3251. Set an initial volume, in dB, to be assumed for each channel when filtering
  3252. starts. This permits the user to supply a nominal level initially, so that, for
  3253. example, a very large gain is not applied to initial signal levels before the
  3254. companding has begun to operate. A typical value for audio which is initially
  3255. quiet is -90 dB. It defaults to 0.
  3256. @item delay
  3257. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  3258. delayed before being fed to the volume adjuster. Specifying a delay
  3259. approximately equal to the attack/decay times allows the filter to effectively
  3260. operate in predictive rather than reactive mode. It defaults to 0.
  3261. @end table
  3262. @subsection Examples
  3263. @itemize
  3264. @item
  3265. Make music with both quiet and loud passages suitable for listening to in a
  3266. noisy environment:
  3267. @example
  3268. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  3269. @end example
  3270. Another example for audio with whisper and explosion parts:
  3271. @example
  3272. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  3273. @end example
  3274. @item
  3275. A noise gate for when the noise is at a lower level than the signal:
  3276. @example
  3277. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  3278. @end example
  3279. @item
  3280. Here is another noise gate, this time for when the noise is at a higher level
  3281. than the signal (making it, in some ways, similar to squelch):
  3282. @example
  3283. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  3284. @end example
  3285. @item
  3286. 2:1 compression starting at -6dB:
  3287. @example
  3288. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  3289. @end example
  3290. @item
  3291. 2:1 compression starting at -9dB:
  3292. @example
  3293. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  3294. @end example
  3295. @item
  3296. 2:1 compression starting at -12dB:
  3297. @example
  3298. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  3299. @end example
  3300. @item
  3301. 2:1 compression starting at -18dB:
  3302. @example
  3303. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  3304. @end example
  3305. @item
  3306. 3:1 compression starting at -15dB:
  3307. @example
  3308. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  3309. @end example
  3310. @item
  3311. Compressor/Gate:
  3312. @example
  3313. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  3314. @end example
  3315. @item
  3316. Expander:
  3317. @example
  3318. 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
  3319. @end example
  3320. @item
  3321. Hard limiter at -6dB:
  3322. @example
  3323. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  3324. @end example
  3325. @item
  3326. Hard limiter at -12dB:
  3327. @example
  3328. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  3329. @end example
  3330. @item
  3331. Hard noise gate at -35 dB:
  3332. @example
  3333. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  3334. @end example
  3335. @item
  3336. Soft limiter:
  3337. @example
  3338. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  3339. @end example
  3340. @end itemize
  3341. @section compensationdelay
  3342. Compensation Delay Line is a metric based delay to compensate differing
  3343. positions of microphones or speakers.
  3344. For example, you have recorded guitar with two microphones placed in
  3345. different locations. Because the front of sound wave has fixed speed in
  3346. normal conditions, the phasing of microphones can vary and depends on
  3347. their location and interposition. The best sound mix can be achieved when
  3348. these microphones are in phase (synchronized). Note that a distance of
  3349. ~30 cm between microphones makes one microphone capture the signal in
  3350. antiphase to the other microphone. That makes the final mix sound moody.
  3351. This filter helps to solve phasing problems by adding different delays
  3352. to each microphone track and make them synchronized.
  3353. The best result can be reached when you take one track as base and
  3354. synchronize other tracks one by one with it.
  3355. Remember that synchronization/delay tolerance depends on sample rate, too.
  3356. Higher sample rates will give more tolerance.
  3357. The filter accepts the following parameters:
  3358. @table @option
  3359. @item mm
  3360. Set millimeters distance. This is compensation distance for fine tuning.
  3361. Default is 0.
  3362. @item cm
  3363. Set cm distance. This is compensation distance for tightening distance setup.
  3364. Default is 0.
  3365. @item m
  3366. Set meters distance. This is compensation distance for hard distance setup.
  3367. Default is 0.
  3368. @item dry
  3369. Set dry amount. Amount of unprocessed (dry) signal.
  3370. Default is 0.
  3371. @item wet
  3372. Set wet amount. Amount of processed (wet) signal.
  3373. Default is 1.
  3374. @item temp
  3375. Set temperature in degrees Celsius. This is the temperature of the environment.
  3376. Default is 20.
  3377. @end table
  3378. @subsection Commands
  3379. This filter supports the all above options as @ref{commands}.
  3380. @section crossfeed
  3381. Apply headphone crossfeed filter.
  3382. Crossfeed is the process of blending the left and right channels of stereo
  3383. audio recording.
  3384. It is mainly used to reduce extreme stereo separation of low frequencies.
  3385. The intent is to produce more speaker like sound to the listener.
  3386. The filter accepts the following options:
  3387. @table @option
  3388. @item strength
  3389. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  3390. This sets gain of low shelf filter for side part of stereo image.
  3391. Default is -6dB. Max allowed is -30db when strength is set to 1.
  3392. @item range
  3393. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  3394. This sets cut off frequency of low shelf filter. Default is cut off near
  3395. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  3396. @item slope
  3397. Set curve slope of low shelf filter. Default is 0.5.
  3398. Allowed range is from 0.01 to 1.
  3399. @item level_in
  3400. Set input gain. Default is 0.9.
  3401. @item level_out
  3402. Set output gain. Default is 1.
  3403. @item block_size
  3404. Set block size used for reverse IIR processing. If this value is set to high enough
  3405. value (higher than impulse response length truncated when reaches near zero values) filtering
  3406. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3407. Note that filter delay will be exactly this many samples when set to non-zero value.
  3408. @end table
  3409. @subsection Commands
  3410. This filter supports the all above options as @ref{commands}.
  3411. @section crystalizer
  3412. Simple algorithm for audio noise sharpening.
  3413. This filter linearly increases differences betweeen each audio sample.
  3414. The filter accepts the following options:
  3415. @table @option
  3416. @item i
  3417. Sets the intensity of effect (default: 2.0). Must be in range between -10.0 to 0
  3418. (unchanged sound) to 10.0 (maximum effect).
  3419. To inverse filtering use negative value.
  3420. @item c
  3421. Enable clipping. By default is enabled.
  3422. @end table
  3423. @subsection Commands
  3424. This filter supports the all above options as @ref{commands}.
  3425. @section dcshift
  3426. Apply a DC shift to the audio.
  3427. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  3428. in the recording chain) from the audio. The effect of a DC offset is reduced
  3429. headroom and hence volume. The @ref{astats} filter can be used to determine if
  3430. a signal has a DC offset.
  3431. @table @option
  3432. @item shift
  3433. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  3434. the audio.
  3435. @item limitergain
  3436. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  3437. used to prevent clipping.
  3438. @end table
  3439. @section deesser
  3440. Apply de-essing to the audio samples.
  3441. @table @option
  3442. @item i
  3443. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  3444. Default is 0.
  3445. @item m
  3446. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  3447. Default is 0.5.
  3448. @item f
  3449. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  3450. Default is 0.5.
  3451. @item s
  3452. Set the output mode.
  3453. It accepts the following values:
  3454. @table @option
  3455. @item i
  3456. Pass input unchanged.
  3457. @item o
  3458. Pass ess filtered out.
  3459. @item e
  3460. Pass only ess.
  3461. Default value is @var{o}.
  3462. @end table
  3463. @end table
  3464. @section dialoguenhance
  3465. Enhance dialogue in stereo audio.
  3466. This filter accepts stereo input and produce surround (3.0) channels output.
  3467. The newly produced front center channel have enhanced speech dialogue originally
  3468. available in both stereo channels.
  3469. This filter outputs front left and front right channels same as available in stereo input.
  3470. The filter accepts the following options:
  3471. @table @option
  3472. @item original
  3473. Set the original center factor to keep in front center channel output.
  3474. Allowed range is from 0 to 1. Default value is 1.
  3475. @item enhance
  3476. Set the dialogue enhance factor to put in front center channel output.
  3477. Allowed range is from 0 to 3. Default value is 1.
  3478. @item voice
  3479. Set the voice detection factor.
  3480. Allowed range is from 2 to 32. Default value is 2.
  3481. @end table
  3482. @subsection Commands
  3483. This filter supports the all above options as @ref{commands}.
  3484. @section drmeter
  3485. Measure audio dynamic range.
  3486. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  3487. is found in transition material. And anything less that 8 have very poor dynamics
  3488. and is very compressed.
  3489. The filter accepts the following options:
  3490. @table @option
  3491. @item length
  3492. Set window length in seconds used to split audio into segments of equal length.
  3493. Default is 3 seconds.
  3494. @end table
  3495. @section dynaudnorm
  3496. Dynamic Audio Normalizer.
  3497. This filter applies a certain amount of gain to the input audio in order
  3498. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  3499. contrast to more "simple" normalization algorithms, the Dynamic Audio
  3500. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  3501. This allows for applying extra gain to the "quiet" sections of the audio
  3502. while avoiding distortions or clipping the "loud" sections. In other words:
  3503. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  3504. sections, in the sense that the volume of each section is brought to the
  3505. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  3506. this goal *without* applying "dynamic range compressing". It will retain 100%
  3507. of the dynamic range *within* each section of the audio file.
  3508. @table @option
  3509. @item framelen, f
  3510. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  3511. Default is 500 milliseconds.
  3512. The Dynamic Audio Normalizer processes the input audio in small chunks,
  3513. referred to as frames. This is required, because a peak magnitude has no
  3514. meaning for just a single sample value. Instead, we need to determine the
  3515. peak magnitude for a contiguous sequence of sample values. While a "standard"
  3516. normalizer would simply use the peak magnitude of the complete file, the
  3517. Dynamic Audio Normalizer determines the peak magnitude individually for each
  3518. frame. The length of a frame is specified in milliseconds. By default, the
  3519. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  3520. been found to give good results with most files.
  3521. Note that the exact frame length, in number of samples, will be determined
  3522. automatically, based on the sampling rate of the individual input audio file.
  3523. @item gausssize, g
  3524. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  3525. number. Default is 31.
  3526. Probably the most important parameter of the Dynamic Audio Normalizer is the
  3527. @code{window size} of the Gaussian smoothing filter. The filter's window size
  3528. is specified in frames, centered around the current frame. For the sake of
  3529. simplicity, this must be an odd number. Consequently, the default value of 31
  3530. takes into account the current frame, as well as the 15 preceding frames and
  3531. the 15 subsequent frames. Using a larger window results in a stronger
  3532. smoothing effect and thus in less gain variation, i.e. slower gain
  3533. adaptation. Conversely, using a smaller window results in a weaker smoothing
  3534. effect and thus in more gain variation, i.e. faster gain adaptation.
  3535. In other words, the more you increase this value, the more the Dynamic Audio
  3536. Normalizer will behave like a "traditional" normalization filter. On the
  3537. contrary, the more you decrease this value, the more the Dynamic Audio
  3538. Normalizer will behave like a dynamic range compressor.
  3539. @item peak, p
  3540. Set the target peak value. This specifies the highest permissible magnitude
  3541. level for the normalized audio input. This filter will try to approach the
  3542. target peak magnitude as closely as possible, but at the same time it also
  3543. makes sure that the normalized signal will never exceed the peak magnitude.
  3544. A frame's maximum local gain factor is imposed directly by the target peak
  3545. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  3546. It is not recommended to go above this value.
  3547. @item maxgain, m
  3548. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  3549. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  3550. factor for each input frame, i.e. the maximum gain factor that does not
  3551. result in clipping or distortion. The maximum gain factor is determined by
  3552. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  3553. additionally bounds the frame's maximum gain factor by a predetermined
  3554. (global) maximum gain factor. This is done in order to avoid excessive gain
  3555. factors in "silent" or almost silent frames. By default, the maximum gain
  3556. factor is 10.0, For most inputs the default value should be sufficient and
  3557. it usually is not recommended to increase this value. Though, for input
  3558. with an extremely low overall volume level, it may be necessary to allow even
  3559. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  3560. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  3561. Instead, a "sigmoid" threshold function will be applied. This way, the
  3562. gain factors will smoothly approach the threshold value, but never exceed that
  3563. value.
  3564. @item targetrms, r
  3565. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  3566. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  3567. This means that the maximum local gain factor for each frame is defined
  3568. (only) by the frame's highest magnitude sample. This way, the samples can
  3569. be amplified as much as possible without exceeding the maximum signal
  3570. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  3571. Normalizer can also take into account the frame's root mean square,
  3572. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  3573. determine the power of a time-varying signal. It is therefore considered
  3574. that the RMS is a better approximation of the "perceived loudness" than
  3575. just looking at the signal's peak magnitude. Consequently, by adjusting all
  3576. frames to a constant RMS value, a uniform "perceived loudness" can be
  3577. established. If a target RMS value has been specified, a frame's local gain
  3578. factor is defined as the factor that would result in exactly that RMS value.
  3579. Note, however, that the maximum local gain factor is still restricted by the
  3580. frame's highest magnitude sample, in order to prevent clipping.
  3581. @item coupling, n
  3582. Enable channels coupling. By default is enabled.
  3583. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  3584. amount. This means the same gain factor will be applied to all channels, i.e.
  3585. the maximum possible gain factor is determined by the "loudest" channel.
  3586. However, in some recordings, it may happen that the volume of the different
  3587. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  3588. In this case, this option can be used to disable the channel coupling. This way,
  3589. the gain factor will be determined independently for each channel, depending
  3590. only on the individual channel's highest magnitude sample. This allows for
  3591. harmonizing the volume of the different channels.
  3592. @item correctdc, c
  3593. Enable DC bias correction. By default is disabled.
  3594. An audio signal (in the time domain) is a sequence of sample values.
  3595. In the Dynamic Audio Normalizer these sample values are represented in the
  3596. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  3597. audio signal, or "waveform", should be centered around the zero point.
  3598. That means if we calculate the mean value of all samples in a file, or in a
  3599. single frame, then the result should be 0.0 or at least very close to that
  3600. value. If, however, there is a significant deviation of the mean value from
  3601. 0.0, in either positive or negative direction, this is referred to as a
  3602. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  3603. Audio Normalizer provides optional DC bias correction.
  3604. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  3605. the mean value, or "DC correction" offset, of each input frame and subtract
  3606. that value from all of the frame's sample values which ensures those samples
  3607. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  3608. boundaries, the DC correction offset values will be interpolated smoothly
  3609. between neighbouring frames.
  3610. @item altboundary, b
  3611. Enable alternative boundary mode. By default is disabled.
  3612. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  3613. around each frame. This includes the preceding frames as well as the
  3614. subsequent frames. However, for the "boundary" frames, located at the very
  3615. beginning and at the very end of the audio file, not all neighbouring
  3616. frames are available. In particular, for the first few frames in the audio
  3617. file, the preceding frames are not known. And, similarly, for the last few
  3618. frames in the audio file, the subsequent frames are not known. Thus, the
  3619. question arises which gain factors should be assumed for the missing frames
  3620. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  3621. to deal with this situation. The default boundary mode assumes a gain factor
  3622. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  3623. "fade out" at the beginning and at the end of the input, respectively.
  3624. @item compress, s
  3625. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  3626. By default, the Dynamic Audio Normalizer does not apply "traditional"
  3627. compression. This means that signal peaks will not be pruned and thus the
  3628. full dynamic range will be retained within each local neighbourhood. However,
  3629. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  3630. normalization algorithm with a more "traditional" compression.
  3631. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  3632. (thresholding) function. If (and only if) the compression feature is enabled,
  3633. all input frames will be processed by a soft knee thresholding function prior
  3634. to the actual normalization process. Put simply, the thresholding function is
  3635. going to prune all samples whose magnitude exceeds a certain threshold value.
  3636. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  3637. value. Instead, the threshold value will be adjusted for each individual
  3638. frame.
  3639. In general, smaller parameters result in stronger compression, and vice versa.
  3640. Values below 3.0 are not recommended, because audible distortion may appear.
  3641. @item threshold, t
  3642. Set the target threshold value. This specifies the lowest permissible
  3643. magnitude level for the audio input which will be normalized.
  3644. If input frame volume is above this value frame will be normalized.
  3645. Otherwise frame may not be normalized at all. The default value is set
  3646. to 0, which means all input frames will be normalized.
  3647. This option is mostly useful if digital noise is not wanted to be amplified.
  3648. @item channels, h
  3649. Specify which channels to filter, by default all available channels are filtered.
  3650. @item overlap, o
  3651. Specify overlap for frames. If set to 0 (default) no frame overlapping is done.
  3652. Using >0 and <1 values will make less conservative gain adjustments, like
  3653. when framelen option is set to smaller value, if framelen option value is
  3654. compensated for non-zero overlap then gain adjustments will be smoother across time
  3655. compared to zero overlap case.
  3656. @item curve, v
  3657. Specify the peak mapping curve expression which is going to be used when calculating
  3658. gain applied to frames. The max output frame gain will still be limited by other
  3659. options mentioned previously for this filter.
  3660. The expression can contain the following constants:
  3661. @table @option
  3662. @item ch
  3663. current channel number
  3664. @item sn
  3665. current sample number
  3666. @item nb_channels
  3667. number of channels
  3668. @item t
  3669. timestamp expressed in seconds
  3670. @item sr
  3671. sample rate
  3672. @item p
  3673. current frame peak value
  3674. @end table
  3675. @end table
  3676. @subsection Commands
  3677. This filter supports the all above options as @ref{commands}.
  3678. @section earwax
  3679. Make audio easier to listen to on headphones.
  3680. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  3681. so that when listened to on headphones the stereo image is moved from
  3682. inside your head (standard for headphones) to outside and in front of
  3683. the listener (standard for speakers).
  3684. Ported from SoX.
  3685. @section equalizer
  3686. Apply a two-pole peaking equalisation (EQ) filter. With this
  3687. filter, the signal-level at and around a selected frequency can
  3688. be increased or decreased, whilst (unlike bandpass and bandreject
  3689. filters) that at all other frequencies is unchanged.
  3690. In order to produce complex equalisation curves, this filter can
  3691. be given several times, each with a different central frequency.
  3692. The filter accepts the following options:
  3693. @table @option
  3694. @item frequency, f
  3695. Set the filter's central frequency in Hz.
  3696. @item width_type, t
  3697. Set method to specify band-width of filter.
  3698. @table @option
  3699. @item h
  3700. Hz
  3701. @item q
  3702. Q-Factor
  3703. @item o
  3704. octave
  3705. @item s
  3706. slope
  3707. @item k
  3708. kHz
  3709. @end table
  3710. @item width, w
  3711. Specify the band-width of a filter in width_type units.
  3712. @item gain, g
  3713. Set the required gain or attenuation in dB.
  3714. Beware of clipping when using a positive gain.
  3715. @item mix, m
  3716. How much to use filtered signal in output. Default is 1.
  3717. Range is between 0 and 1.
  3718. @item channels, c
  3719. Specify which channels to filter, by default all available are filtered.
  3720. @item normalize, n
  3721. Normalize biquad coefficients, by default is disabled.
  3722. Enabling it will normalize magnitude response at DC to 0dB.
  3723. @item transform, a
  3724. Set transform type of IIR filter.
  3725. @table @option
  3726. @item di
  3727. @item dii
  3728. @item tdi
  3729. @item tdii
  3730. @item latt
  3731. @item svf
  3732. @item zdf
  3733. @end table
  3734. @item precision, r
  3735. Set precison of filtering.
  3736. @table @option
  3737. @item auto
  3738. Pick automatic sample format depending on surround filters.
  3739. @item s16
  3740. Always use signed 16-bit.
  3741. @item s32
  3742. Always use signed 32-bit.
  3743. @item f32
  3744. Always use float 32-bit.
  3745. @item f64
  3746. Always use float 64-bit.
  3747. @end table
  3748. @item block_size, b
  3749. Set block size used for reverse IIR processing. If this value is set to high enough
  3750. value (higher than impulse response length truncated when reaches near zero values) filtering
  3751. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3752. Note that filter delay will be exactly this many samples when set to non-zero value.
  3753. @end table
  3754. @subsection Examples
  3755. @itemize
  3756. @item
  3757. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  3758. @example
  3759. equalizer=f=1000:t=h:width=200:g=-10
  3760. @end example
  3761. @item
  3762. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  3763. @example
  3764. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  3765. @end example
  3766. @end itemize
  3767. @subsection Commands
  3768. This filter supports the following commands:
  3769. @table @option
  3770. @item frequency, f
  3771. Change equalizer frequency.
  3772. Syntax for the command is : "@var{frequency}"
  3773. @item width_type, t
  3774. Change equalizer width_type.
  3775. Syntax for the command is : "@var{width_type}"
  3776. @item width, w
  3777. Change equalizer width.
  3778. Syntax for the command is : "@var{width}"
  3779. @item gain, g
  3780. Change equalizer gain.
  3781. Syntax for the command is : "@var{gain}"
  3782. @item mix, m
  3783. Change equalizer mix.
  3784. Syntax for the command is : "@var{mix}"
  3785. @end table
  3786. @section extrastereo
  3787. Linearly increases the difference between left and right channels which
  3788. adds some sort of "live" effect to playback.
  3789. The filter accepts the following options:
  3790. @table @option
  3791. @item m
  3792. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  3793. (average of both channels), with 1.0 sound will be unchanged, with
  3794. -1.0 left and right channels will be swapped.
  3795. @item c
  3796. Enable clipping. By default is enabled.
  3797. @end table
  3798. @subsection Commands
  3799. This filter supports the all above options as @ref{commands}.
  3800. @section firequalizer
  3801. Apply FIR Equalization using arbitrary frequency response.
  3802. The filter accepts the following option:
  3803. @table @option
  3804. @item gain
  3805. Set gain curve equation (in dB). The expression can contain variables:
  3806. @table @option
  3807. @item f
  3808. the evaluated frequency
  3809. @item sr
  3810. sample rate
  3811. @item ch
  3812. channel number, set to 0 when multichannels evaluation is disabled
  3813. @item chid
  3814. channel id, see libavutil/channel_layout.h, set to the first channel id when
  3815. multichannels evaluation is disabled
  3816. @item chs
  3817. number of channels
  3818. @item chlayout
  3819. channel_layout, see libavutil/channel_layout.h
  3820. @end table
  3821. and functions:
  3822. @table @option
  3823. @item gain_interpolate(f)
  3824. interpolate gain on frequency f based on gain_entry
  3825. @item cubic_interpolate(f)
  3826. same as gain_interpolate, but smoother
  3827. @end table
  3828. This option is also available as command. Default is @code{gain_interpolate(f)}.
  3829. @item gain_entry
  3830. Set gain entry for gain_interpolate function. The expression can
  3831. contain functions:
  3832. @table @option
  3833. @item entry(f, g)
  3834. store gain entry at frequency f with value g
  3835. @end table
  3836. This option is also available as command.
  3837. @item delay
  3838. Set filter delay in seconds. Higher value means more accurate.
  3839. Default is @code{0.01}.
  3840. @item accuracy
  3841. Set filter accuracy in Hz. Lower value means more accurate.
  3842. Default is @code{5}.
  3843. @item wfunc
  3844. Set window function. Acceptable values are:
  3845. @table @option
  3846. @item rectangular
  3847. rectangular window, useful when gain curve is already smooth
  3848. @item hann
  3849. hann window (default)
  3850. @item hamming
  3851. hamming window
  3852. @item blackman
  3853. blackman window
  3854. @item nuttall3
  3855. 3-terms continuous 1st derivative nuttall window
  3856. @item mnuttall3
  3857. minimum 3-terms discontinuous nuttall window
  3858. @item nuttall
  3859. 4-terms continuous 1st derivative nuttall window
  3860. @item bnuttall
  3861. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  3862. @item bharris
  3863. blackman-harris window
  3864. @item tukey
  3865. tukey window
  3866. @end table
  3867. @item fixed
  3868. If enabled, use fixed number of audio samples. This improves speed when
  3869. filtering with large delay. Default is disabled.
  3870. @item multi
  3871. Enable multichannels evaluation on gain. Default is disabled.
  3872. @item zero_phase
  3873. Enable zero phase mode by subtracting timestamp to compensate delay.
  3874. Default is disabled.
  3875. @item scale
  3876. Set scale used by gain. Acceptable values are:
  3877. @table @option
  3878. @item linlin
  3879. linear frequency, linear gain
  3880. @item linlog
  3881. linear frequency, logarithmic (in dB) gain (default)
  3882. @item loglin
  3883. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  3884. @item loglog
  3885. logarithmic frequency, logarithmic gain
  3886. @end table
  3887. @item dumpfile
  3888. Set file for dumping, suitable for gnuplot.
  3889. @item dumpscale
  3890. Set scale for dumpfile. Acceptable values are same with scale option.
  3891. Default is linlog.
  3892. @item fft2
  3893. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  3894. Default is disabled.
  3895. @item min_phase
  3896. Enable minimum phase impulse response. Default is disabled.
  3897. @end table
  3898. @subsection Examples
  3899. @itemize
  3900. @item
  3901. lowpass at 1000 Hz:
  3902. @example
  3903. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  3904. @end example
  3905. @item
  3906. lowpass at 1000 Hz with gain_entry:
  3907. @example
  3908. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  3909. @end example
  3910. @item
  3911. custom equalization:
  3912. @example
  3913. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  3914. @end example
  3915. @item
  3916. higher delay with zero phase to compensate delay:
  3917. @example
  3918. firequalizer=delay=0.1:fixed=on:zero_phase=on
  3919. @end example
  3920. @item
  3921. lowpass on left channel, highpass on right channel:
  3922. @example
  3923. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  3924. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  3925. @end example
  3926. @end itemize
  3927. @section flanger
  3928. Apply a flanging effect to the audio.
  3929. The filter accepts the following options:
  3930. @table @option
  3931. @item delay
  3932. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  3933. @item depth
  3934. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  3935. @item regen
  3936. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  3937. Default value is 0.
  3938. @item width
  3939. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  3940. Default value is 71.
  3941. @item speed
  3942. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  3943. @item shape
  3944. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  3945. Default value is @var{sinusoidal}.
  3946. @item phase
  3947. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  3948. Default value is 25.
  3949. @item interp
  3950. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  3951. Default is @var{linear}.
  3952. @end table
  3953. @section haas
  3954. Apply Haas effect to audio.
  3955. Note that this makes most sense to apply on mono signals.
  3956. With this filter applied to mono signals it give some directionality and
  3957. stretches its stereo image.
  3958. The filter accepts the following options:
  3959. @table @option
  3960. @item level_in
  3961. Set input level. By default is @var{1}, or 0dB
  3962. @item level_out
  3963. Set output level. By default is @var{1}, or 0dB.
  3964. @item side_gain
  3965. Set gain applied to side part of signal. By default is @var{1}.
  3966. @item middle_source
  3967. Set kind of middle source. Can be one of the following:
  3968. @table @samp
  3969. @item left
  3970. Pick left channel.
  3971. @item right
  3972. Pick right channel.
  3973. @item mid
  3974. Pick middle part signal of stereo image.
  3975. @item side
  3976. Pick side part signal of stereo image.
  3977. @end table
  3978. @item middle_phase
  3979. Change middle phase. By default is disabled.
  3980. @item left_delay
  3981. Set left channel delay. By default is @var{2.05} milliseconds.
  3982. @item left_balance
  3983. Set left channel balance. By default is @var{-1}.
  3984. @item left_gain
  3985. Set left channel gain. By default is @var{1}.
  3986. @item left_phase
  3987. Change left phase. By default is disabled.
  3988. @item right_delay
  3989. Set right channel delay. By defaults is @var{2.12} milliseconds.
  3990. @item right_balance
  3991. Set right channel balance. By default is @var{1}.
  3992. @item right_gain
  3993. Set right channel gain. By default is @var{1}.
  3994. @item right_phase
  3995. Change right phase. By default is enabled.
  3996. @end table
  3997. @section hdcd
  3998. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  3999. embedded HDCD codes is expanded into a 20-bit PCM stream.
  4000. The filter supports the Peak Extend and Low-level Gain Adjustment features
  4001. of HDCD, and detects the Transient Filter flag.
  4002. @example
  4003. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  4004. @end example
  4005. When using the filter with wav, note the default encoding for wav is 16-bit,
  4006. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  4007. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  4008. @example
  4009. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  4010. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  4011. @end example
  4012. The filter accepts the following options:
  4013. @table @option
  4014. @item disable_autoconvert
  4015. Disable any automatic format conversion or resampling in the filter graph.
  4016. @item process_stereo
  4017. Process the stereo channels together. If target_gain does not match between
  4018. channels, consider it invalid and use the last valid target_gain.
  4019. @item cdt_ms
  4020. Set the code detect timer period in ms.
  4021. @item force_pe
  4022. Always extend peaks above -3dBFS even if PE isn't signaled.
  4023. @item analyze_mode
  4024. Replace audio with a solid tone and adjust the amplitude to signal some
  4025. specific aspect of the decoding process. The output file can be loaded in
  4026. an audio editor alongside the original to aid analysis.
  4027. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  4028. Modes are:
  4029. @table @samp
  4030. @item 0, off
  4031. Disabled
  4032. @item 1, lle
  4033. Gain adjustment level at each sample
  4034. @item 2, pe
  4035. Samples where peak extend occurs
  4036. @item 3, cdt
  4037. Samples where the code detect timer is active
  4038. @item 4, tgm
  4039. Samples where the target gain does not match between channels
  4040. @end table
  4041. @end table
  4042. @section headphone
  4043. Apply head-related transfer functions (HRTFs) to create virtual
  4044. loudspeakers around the user for binaural listening via headphones.
  4045. The HRIRs are provided via additional streams, for each channel
  4046. one stereo input stream is needed.
  4047. The filter accepts the following options:
  4048. @table @option
  4049. @item map
  4050. Set mapping of input streams for convolution.
  4051. The argument is a '|'-separated list of channel names in order as they
  4052. are given as additional stream inputs for filter.
  4053. This also specify number of input streams. Number of input streams
  4054. must be not less than number of channels in first stream plus one.
  4055. @item gain
  4056. Set gain applied to audio. Value is in dB. Default is 0.
  4057. @item type
  4058. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  4059. processing audio in time domain which is slow.
  4060. @var{freq} is processing audio in frequency domain which is fast.
  4061. Default is @var{freq}.
  4062. @item lfe
  4063. Set custom gain for LFE channels. Value is in dB. Default is 0.
  4064. @item size
  4065. Set size of frame in number of samples which will be processed at once.
  4066. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  4067. @item hrir
  4068. Set format of hrir stream.
  4069. Default value is @var{stereo}. Alternative value is @var{multich}.
  4070. If value is set to @var{stereo}, number of additional streams should
  4071. be greater or equal to number of input channels in first input stream.
  4072. Also each additional stream should have stereo number of channels.
  4073. If value is set to @var{multich}, number of additional streams should
  4074. be exactly one. Also number of input channels of additional stream
  4075. should be equal or greater than twice number of channels of first input
  4076. stream.
  4077. @end table
  4078. @subsection Examples
  4079. @itemize
  4080. @item
  4081. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  4082. each amovie filter use stereo file with IR coefficients as input.
  4083. The files give coefficients for each position of virtual loudspeaker:
  4084. @example
  4085. ffmpeg -i input.wav
  4086. -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"
  4087. output.wav
  4088. @end example
  4089. @item
  4090. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  4091. but now in @var{multich} @var{hrir} format.
  4092. @example
  4093. 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"
  4094. output.wav
  4095. @end example
  4096. @end itemize
  4097. @section highpass
  4098. Apply a high-pass filter with 3dB point frequency.
  4099. The filter can be either single-pole, or double-pole (the default).
  4100. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  4101. The filter accepts the following options:
  4102. @table @option
  4103. @item frequency, f
  4104. Set frequency in Hz. Default is 3000.
  4105. @item poles, p
  4106. Set number of poles. Default is 2.
  4107. @item width_type, t
  4108. Set method to specify band-width of filter.
  4109. @table @option
  4110. @item h
  4111. Hz
  4112. @item q
  4113. Q-Factor
  4114. @item o
  4115. octave
  4116. @item s
  4117. slope
  4118. @item k
  4119. kHz
  4120. @end table
  4121. @item width, w
  4122. Specify the band-width of a filter in width_type units.
  4123. Applies only to double-pole filter.
  4124. The default is 0.707q and gives a Butterworth response.
  4125. @item mix, m
  4126. How much to use filtered signal in output. Default is 1.
  4127. Range is between 0 and 1.
  4128. @item channels, c
  4129. Specify which channels to filter, by default all available are filtered.
  4130. @item normalize, n
  4131. Normalize biquad coefficients, by default is disabled.
  4132. Enabling it will normalize magnitude response at DC to 0dB.
  4133. @item transform, a
  4134. Set transform type of IIR filter.
  4135. @table @option
  4136. @item di
  4137. @item dii
  4138. @item tdi
  4139. @item tdii
  4140. @item latt
  4141. @item svf
  4142. @item zdf
  4143. @end table
  4144. @item precision, r
  4145. Set precison of filtering.
  4146. @table @option
  4147. @item auto
  4148. Pick automatic sample format depending on surround filters.
  4149. @item s16
  4150. Always use signed 16-bit.
  4151. @item s32
  4152. Always use signed 32-bit.
  4153. @item f32
  4154. Always use float 32-bit.
  4155. @item f64
  4156. Always use float 64-bit.
  4157. @end table
  4158. @item block_size, b
  4159. Set block size used for reverse IIR processing. If this value is set to high enough
  4160. value (higher than impulse response length truncated when reaches near zero values) filtering
  4161. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  4162. Note that filter delay will be exactly this many samples when set to non-zero value.
  4163. @end table
  4164. @subsection Commands
  4165. This filter supports the following commands:
  4166. @table @option
  4167. @item frequency, f
  4168. Change highpass frequency.
  4169. Syntax for the command is : "@var{frequency}"
  4170. @item width_type, t
  4171. Change highpass width_type.
  4172. Syntax for the command is : "@var{width_type}"
  4173. @item width, w
  4174. Change highpass width.
  4175. Syntax for the command is : "@var{width}"
  4176. @item mix, m
  4177. Change highpass mix.
  4178. Syntax for the command is : "@var{mix}"
  4179. @end table
  4180. @section join
  4181. Join multiple input streams into one multi-channel stream.
  4182. It accepts the following parameters:
  4183. @table @option
  4184. @item inputs
  4185. The number of input streams. It defaults to 2.
  4186. @item channel_layout
  4187. The desired output channel layout. It defaults to stereo.
  4188. @item map
  4189. Map channels from inputs to output. The argument is a '|'-separated list of
  4190. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  4191. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  4192. can be either the name of the input channel (e.g. FL for front left) or its
  4193. index in the specified input stream. @var{out_channel} is the name of the output
  4194. channel.
  4195. @end table
  4196. The filter will attempt to guess the mappings when they are not specified
  4197. explicitly. It does so by first trying to find an unused matching input channel
  4198. and if that fails it picks the first unused input channel.
  4199. Join 3 inputs (with properly set channel layouts):
  4200. @example
  4201. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  4202. @end example
  4203. Build a 5.1 output from 6 single-channel streams:
  4204. @example
  4205. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  4206. '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'
  4207. out
  4208. @end example
  4209. @section ladspa
  4210. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  4211. To enable compilation of this filter you need to configure FFmpeg with
  4212. @code{--enable-ladspa}.
  4213. @table @option
  4214. @item file, f
  4215. Specifies the name of LADSPA plugin library to load. If the environment
  4216. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  4217. each one of the directories specified by the colon separated list in
  4218. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  4219. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  4220. @file{/usr/lib/ladspa/}.
  4221. @item plugin, p
  4222. Specifies the plugin within the library. Some libraries contain only
  4223. one plugin, but others contain many of them. If this is not set filter
  4224. will list all available plugins within the specified library.
  4225. @item controls, c
  4226. Set the '|' separated list of controls which are zero or more floating point
  4227. values that determine the behavior of the loaded plugin (for example delay,
  4228. threshold or gain).
  4229. Controls need to be defined using the following syntax:
  4230. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  4231. @var{valuei} is the value set on the @var{i}-th control.
  4232. Alternatively they can be also defined using the following syntax:
  4233. @var{value0}|@var{value1}|@var{value2}|..., where
  4234. @var{valuei} is the value set on the @var{i}-th control.
  4235. If @option{controls} is set to @code{help}, all available controls and
  4236. their valid ranges are printed.
  4237. @item sample_rate, s
  4238. Specify the sample rate, default to 44100. Only used if plugin have
  4239. zero inputs.
  4240. @item nb_samples, n
  4241. Set the number of samples per channel per each output frame, default
  4242. is 1024. Only used if plugin have zero inputs.
  4243. @item duration, d
  4244. Set the minimum duration of the sourced audio. See
  4245. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4246. for the accepted syntax.
  4247. Note that the resulting duration may be greater than the specified duration,
  4248. as the generated audio is always cut at the end of a complete frame.
  4249. If not specified, or the expressed duration is negative, the audio is
  4250. supposed to be generated forever.
  4251. Only used if plugin have zero inputs.
  4252. @item latency, l
  4253. Enable latency compensation, by default is disabled.
  4254. Only used if plugin have inputs.
  4255. @end table
  4256. @subsection Examples
  4257. @itemize
  4258. @item
  4259. List all available plugins within amp (LADSPA example plugin) library:
  4260. @example
  4261. ladspa=file=amp
  4262. @end example
  4263. @item
  4264. List all available controls and their valid ranges for @code{vcf_notch}
  4265. plugin from @code{VCF} library:
  4266. @example
  4267. ladspa=f=vcf:p=vcf_notch:c=help
  4268. @end example
  4269. @item
  4270. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  4271. plugin library:
  4272. @example
  4273. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  4274. @end example
  4275. @item
  4276. Add reverberation to the audio using TAP-plugins
  4277. (Tom's Audio Processing plugins):
  4278. @example
  4279. ladspa=file=tap_reverb:tap_reverb
  4280. @end example
  4281. @item
  4282. Generate white noise, with 0.2 amplitude:
  4283. @example
  4284. ladspa=file=cmt:noise_source_white:c=c0=.2
  4285. @end example
  4286. @item
  4287. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  4288. @code{C* Audio Plugin Suite} (CAPS) library:
  4289. @example
  4290. ladspa=file=caps:Click:c=c1=20'
  4291. @end example
  4292. @item
  4293. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  4294. @example
  4295. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  4296. @end example
  4297. @item
  4298. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  4299. @code{SWH Plugins} collection:
  4300. @example
  4301. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  4302. @end example
  4303. @item
  4304. Attenuate low frequencies using Multiband EQ from Steve Harris
  4305. @code{SWH Plugins} collection:
  4306. @example
  4307. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  4308. @end example
  4309. @item
  4310. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  4311. (CAPS) library:
  4312. @example
  4313. ladspa=caps:Narrower
  4314. @end example
  4315. @item
  4316. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  4317. @example
  4318. ladspa=caps:White:.2
  4319. @end example
  4320. @item
  4321. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  4322. @example
  4323. ladspa=caps:Fractal:c=c1=1
  4324. @end example
  4325. @item
  4326. Dynamic volume normalization using @code{VLevel} plugin:
  4327. @example
  4328. ladspa=vlevel-ladspa:vlevel_mono
  4329. @end example
  4330. @end itemize
  4331. @subsection Commands
  4332. This filter supports the following commands:
  4333. @table @option
  4334. @item cN
  4335. Modify the @var{N}-th control value.
  4336. If the specified value is not valid, it is ignored and prior one is kept.
  4337. @end table
  4338. @section loudnorm
  4339. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  4340. Support for both single pass (livestreams, files) and double pass (files) modes.
  4341. This algorithm can target IL, LRA, and maximum true peak. In dynamic mode, to accurately
  4342. detect true peaks, the audio stream will be upsampled to 192 kHz.
  4343. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  4344. The filter accepts the following options:
  4345. @table @option
  4346. @item I, i
  4347. Set integrated loudness target.
  4348. Range is -70.0 - -5.0. Default value is -24.0.
  4349. @item LRA, lra
  4350. Set loudness range target.
  4351. Range is 1.0 - 50.0. Default value is 7.0.
  4352. @item TP, tp
  4353. Set maximum true peak.
  4354. Range is -9.0 - +0.0. Default value is -2.0.
  4355. @item measured_I, measured_i
  4356. Measured IL of input file.
  4357. Range is -99.0 - +0.0.
  4358. @item measured_LRA, measured_lra
  4359. Measured LRA of input file.
  4360. Range is 0.0 - 99.0.
  4361. @item measured_TP, measured_tp
  4362. Measured true peak of input file.
  4363. Range is -99.0 - +99.0.
  4364. @item measured_thresh
  4365. Measured threshold of input file.
  4366. Range is -99.0 - +0.0.
  4367. @item offset
  4368. Set offset gain. Gain is applied before the true-peak limiter.
  4369. Range is -99.0 - +99.0. Default is +0.0.
  4370. @item linear
  4371. Normalize by linearly scaling the source audio.
  4372. @code{measured_I}, @code{measured_LRA}, @code{measured_TP},
  4373. and @code{measured_thresh} must all be specified. Target LRA shouldn't
  4374. be lower than source LRA and the change in integrated loudness shouldn't
  4375. result in a true peak which exceeds the target TP. If any of these
  4376. conditions aren't met, normalization mode will revert to @var{dynamic}.
  4377. Options are @code{true} or @code{false}. Default is @code{true}.
  4378. @item dual_mono
  4379. Treat mono input files as "dual-mono". If a mono file is intended for playback
  4380. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  4381. If set to @code{true}, this option will compensate for this effect.
  4382. Multi-channel input files are not affected by this option.
  4383. Options are true or false. Default is false.
  4384. @item print_format
  4385. Set print format for stats. Options are summary, json, or none.
  4386. Default value is none.
  4387. @end table
  4388. @section lowpass
  4389. Apply a low-pass filter with 3dB point frequency.
  4390. The filter can be either single-pole or double-pole (the default).
  4391. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  4392. The filter accepts the following options:
  4393. @table @option
  4394. @item frequency, f
  4395. Set frequency in Hz. Default is 500.
  4396. @item poles, p
  4397. Set number of poles. Default is 2.
  4398. @item width_type, t
  4399. Set method to specify band-width of filter.
  4400. @table @option
  4401. @item h
  4402. Hz
  4403. @item q
  4404. Q-Factor
  4405. @item o
  4406. octave
  4407. @item s
  4408. slope
  4409. @item k
  4410. kHz
  4411. @end table
  4412. @item width, w
  4413. Specify the band-width of a filter in width_type units.
  4414. Applies only to double-pole filter.
  4415. The default is 0.707q and gives a Butterworth response.
  4416. @item mix, m
  4417. How much to use filtered signal in output. Default is 1.
  4418. Range is between 0 and 1.
  4419. @item channels, c
  4420. Specify which channels to filter, by default all available are filtered.
  4421. @item normalize, n
  4422. Normalize biquad coefficients, by default is disabled.
  4423. Enabling it will normalize magnitude response at DC to 0dB.
  4424. @item transform, a
  4425. Set transform type of IIR filter.
  4426. @table @option
  4427. @item di
  4428. @item dii
  4429. @item tdi
  4430. @item tdii
  4431. @item latt
  4432. @item svf
  4433. @item zdf
  4434. @end table
  4435. @item precision, r
  4436. Set precison of filtering.
  4437. @table @option
  4438. @item auto
  4439. Pick automatic sample format depending on surround filters.
  4440. @item s16
  4441. Always use signed 16-bit.
  4442. @item s32
  4443. Always use signed 32-bit.
  4444. @item f32
  4445. Always use float 32-bit.
  4446. @item f64
  4447. Always use float 64-bit.
  4448. @end table
  4449. @item block_size, b
  4450. Set block size used for reverse IIR processing. If this value is set to high enough
  4451. value (higher than impulse response length truncated when reaches near zero values) filtering
  4452. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  4453. Note that filter delay will be exactly this many samples when set to non-zero value.
  4454. @end table
  4455. @subsection Examples
  4456. @itemize
  4457. @item
  4458. Lowpass only LFE channel, it LFE is not present it does nothing:
  4459. @example
  4460. lowpass=c=LFE
  4461. @end example
  4462. @end itemize
  4463. @subsection Commands
  4464. This filter supports the following commands:
  4465. @table @option
  4466. @item frequency, f
  4467. Change lowpass frequency.
  4468. Syntax for the command is : "@var{frequency}"
  4469. @item width_type, t
  4470. Change lowpass width_type.
  4471. Syntax for the command is : "@var{width_type}"
  4472. @item width, w
  4473. Change lowpass width.
  4474. Syntax for the command is : "@var{width}"
  4475. @item mix, m
  4476. Change lowpass mix.
  4477. Syntax for the command is : "@var{mix}"
  4478. @end table
  4479. @section lv2
  4480. Load a LV2 (LADSPA Version 2) plugin.
  4481. To enable compilation of this filter you need to configure FFmpeg with
  4482. @code{--enable-lv2}.
  4483. @table @option
  4484. @item plugin, p
  4485. Specifies the plugin URI. You may need to escape ':'.
  4486. @item controls, c
  4487. Set the '|' separated list of controls which are zero or more floating point
  4488. values that determine the behavior of the loaded plugin (for example delay,
  4489. threshold or gain).
  4490. If @option{controls} is set to @code{help}, all available controls and
  4491. their valid ranges are printed.
  4492. @item sample_rate, s
  4493. Specify the sample rate, default to 44100. Only used if plugin have
  4494. zero inputs.
  4495. @item nb_samples, n
  4496. Set the number of samples per channel per each output frame, default
  4497. is 1024. Only used if plugin have zero inputs.
  4498. @item duration, d
  4499. Set the minimum duration of the sourced audio. See
  4500. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4501. for the accepted syntax.
  4502. Note that the resulting duration may be greater than the specified duration,
  4503. as the generated audio is always cut at the end of a complete frame.
  4504. If not specified, or the expressed duration is negative, the audio is
  4505. supposed to be generated forever.
  4506. Only used if plugin have zero inputs.
  4507. @end table
  4508. @subsection Examples
  4509. @itemize
  4510. @item
  4511. Apply bass enhancer plugin from Calf:
  4512. @example
  4513. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  4514. @end example
  4515. @item
  4516. Apply vinyl plugin from Calf:
  4517. @example
  4518. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  4519. @end example
  4520. @item
  4521. Apply bit crusher plugin from ArtyFX:
  4522. @example
  4523. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  4524. @end example
  4525. @end itemize
  4526. @subsection Commands
  4527. This filter supports all options that are exported by plugin as commands.
  4528. @section mcompand
  4529. Multiband Compress or expand the audio's dynamic range.
  4530. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  4531. This is akin to the crossover of a loudspeaker, and results in flat frequency
  4532. response when absent compander action.
  4533. It accepts the following parameters:
  4534. @table @option
  4535. @item args
  4536. This option syntax is:
  4537. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  4538. For explanation of each item refer to compand filter documentation.
  4539. @end table
  4540. @anchor{pan}
  4541. @section pan
  4542. Mix channels with specific gain levels. The filter accepts the output
  4543. channel layout followed by a set of channels definitions.
  4544. This filter is also designed to efficiently remap the channels of an audio
  4545. stream.
  4546. The filter accepts parameters of the form:
  4547. "@var{l}|@var{outdef}|@var{outdef}|..."
  4548. @table @option
  4549. @item l
  4550. output channel layout or number of channels
  4551. @item outdef
  4552. output channel specification, of the form:
  4553. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  4554. @item out_name
  4555. output channel to define, either a channel name (FL, FR, etc.) or a channel
  4556. number (c0, c1, etc.)
  4557. @item gain
  4558. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  4559. @item in_name
  4560. input channel to use, see out_name for details; it is not possible to mix
  4561. named and numbered input channels
  4562. @end table
  4563. If the `=' in a channel specification is replaced by `<', then the gains for
  4564. that specification will be renormalized so that the total is 1, thus
  4565. avoiding clipping noise.
  4566. @subsection Mixing examples
  4567. For example, if you want to down-mix from stereo to mono, but with a bigger
  4568. factor for the left channel:
  4569. @example
  4570. pan=1c|c0=0.9*c0+0.1*c1
  4571. @end example
  4572. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  4573. 7-channels surround:
  4574. @example
  4575. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  4576. @end example
  4577. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  4578. that should be preferred (see "-ac" option) unless you have very specific
  4579. needs.
  4580. @subsection Remapping examples
  4581. The channel remapping will be effective if, and only if:
  4582. @itemize
  4583. @item gain coefficients are zeroes or ones,
  4584. @item only one input per channel output,
  4585. @end itemize
  4586. If all these conditions are satisfied, the filter will notify the user ("Pure
  4587. channel mapping detected"), and use an optimized and lossless method to do the
  4588. remapping.
  4589. For example, if you have a 5.1 source and want a stereo audio stream by
  4590. dropping the extra channels:
  4591. @example
  4592. pan="stereo| c0=FL | c1=FR"
  4593. @end example
  4594. Given the same source, you can also switch front left and front right channels
  4595. and keep the input channel layout:
  4596. @example
  4597. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  4598. @end example
  4599. If the input is a stereo audio stream, you can mute the front left channel (and
  4600. still keep the stereo channel layout) with:
  4601. @example
  4602. pan="stereo|c1=c1"
  4603. @end example
  4604. Still with a stereo audio stream input, you can copy the right channel in both
  4605. front left and right:
  4606. @example
  4607. pan="stereo| c0=FR | c1=FR"
  4608. @end example
  4609. @section replaygain
  4610. ReplayGain scanner filter. This filter takes an audio stream as an input and
  4611. outputs it unchanged.
  4612. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  4613. @section resample
  4614. Convert the audio sample format, sample rate and channel layout. It is
  4615. not meant to be used directly.
  4616. @section rubberband
  4617. Apply time-stretching and pitch-shifting with librubberband.
  4618. To enable compilation of this filter, you need to configure FFmpeg with
  4619. @code{--enable-librubberband}.
  4620. The filter accepts the following options:
  4621. @table @option
  4622. @item tempo
  4623. Set tempo scale factor.
  4624. @item pitch
  4625. Set pitch scale factor.
  4626. @item transients
  4627. Set transients detector.
  4628. Possible values are:
  4629. @table @var
  4630. @item crisp
  4631. @item mixed
  4632. @item smooth
  4633. @end table
  4634. @item detector
  4635. Set detector.
  4636. Possible values are:
  4637. @table @var
  4638. @item compound
  4639. @item percussive
  4640. @item soft
  4641. @end table
  4642. @item phase
  4643. Set phase.
  4644. Possible values are:
  4645. @table @var
  4646. @item laminar
  4647. @item independent
  4648. @end table
  4649. @item window
  4650. Set processing window size.
  4651. Possible values are:
  4652. @table @var
  4653. @item standard
  4654. @item short
  4655. @item long
  4656. @end table
  4657. @item smoothing
  4658. Set smoothing.
  4659. Possible values are:
  4660. @table @var
  4661. @item off
  4662. @item on
  4663. @end table
  4664. @item formant
  4665. Enable formant preservation when shift pitching.
  4666. Possible values are:
  4667. @table @var
  4668. @item shifted
  4669. @item preserved
  4670. @end table
  4671. @item pitchq
  4672. Set pitch quality.
  4673. Possible values are:
  4674. @table @var
  4675. @item quality
  4676. @item speed
  4677. @item consistency
  4678. @end table
  4679. @item channels
  4680. Set channels.
  4681. Possible values are:
  4682. @table @var
  4683. @item apart
  4684. @item together
  4685. @end table
  4686. @end table
  4687. @subsection Commands
  4688. This filter supports the following commands:
  4689. @table @option
  4690. @item tempo
  4691. Change filter tempo scale factor.
  4692. Syntax for the command is : "@var{tempo}"
  4693. @item pitch
  4694. Change filter pitch scale factor.
  4695. Syntax for the command is : "@var{pitch}"
  4696. @end table
  4697. @section sidechaincompress
  4698. This filter acts like normal compressor but has the ability to compress
  4699. detected signal using second input signal.
  4700. It needs two input streams and returns one output stream.
  4701. First input stream will be processed depending on second stream signal.
  4702. The filtered signal then can be filtered with other filters in later stages of
  4703. processing. See @ref{pan} and @ref{amerge} filter.
  4704. The filter accepts the following options:
  4705. @table @option
  4706. @item level_in
  4707. Set input gain. Default is 1. Range is between 0.015625 and 64.
  4708. @item mode
  4709. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  4710. Default is @code{downward}.
  4711. @item threshold
  4712. If a signal of second stream raises above this level it will affect the gain
  4713. reduction of first stream.
  4714. By default is 0.125. Range is between 0.00097563 and 1.
  4715. @item ratio
  4716. Set a ratio about which the signal is reduced. 1:2 means that if the level
  4717. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  4718. Default is 2. Range is between 1 and 20.
  4719. @item attack
  4720. Amount of milliseconds the signal has to rise above the threshold before gain
  4721. reduction starts. Default is 20. Range is between 0.01 and 2000.
  4722. @item release
  4723. Amount of milliseconds the signal has to fall below the threshold before
  4724. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  4725. @item makeup
  4726. Set the amount by how much signal will be amplified after processing.
  4727. Default is 1. Range is from 1 to 64.
  4728. @item knee
  4729. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4730. Default is 2.82843. Range is between 1 and 8.
  4731. @item link
  4732. Choose if the @code{average} level between all channels of side-chain stream
  4733. or the louder(@code{maximum}) channel of side-chain stream affects the
  4734. reduction. Default is @code{average}.
  4735. @item detection
  4736. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  4737. of @code{rms}. Default is @code{rms} which is mainly smoother.
  4738. @item level_sc
  4739. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  4740. @item mix
  4741. How much to use compressed signal in output. Default is 1.
  4742. Range is between 0 and 1.
  4743. @end table
  4744. @subsection Commands
  4745. This filter supports the all above options as @ref{commands}.
  4746. @subsection Examples
  4747. @itemize
  4748. @item
  4749. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  4750. depending on the signal of 2nd input and later compressed signal to be
  4751. merged with 2nd input:
  4752. @example
  4753. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  4754. @end example
  4755. @end itemize
  4756. @section sidechaingate
  4757. A sidechain gate acts like a normal (wideband) gate but has the ability to
  4758. filter the detected signal before sending it to the gain reduction stage.
  4759. Normally a gate uses the full range signal to detect a level above the
  4760. threshold.
  4761. For example: If you cut all lower frequencies from your sidechain signal
  4762. the gate will decrease the volume of your track only if not enough highs
  4763. appear. With this technique you are able to reduce the resonation of a
  4764. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  4765. guitar.
  4766. It needs two input streams and returns one output stream.
  4767. First input stream will be processed depending on second stream signal.
  4768. The filter accepts the following options:
  4769. @table @option
  4770. @item level_in
  4771. Set input level before filtering.
  4772. Default is 1. Allowed range is from 0.015625 to 64.
  4773. @item mode
  4774. Set the mode of operation. Can be @code{upward} or @code{downward}.
  4775. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  4776. will be amplified, expanding dynamic range in upward direction.
  4777. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  4778. @item range
  4779. Set the level of gain reduction when the signal is below the threshold.
  4780. Default is 0.06125. Allowed range is from 0 to 1.
  4781. Setting this to 0 disables reduction and then filter behaves like expander.
  4782. @item threshold
  4783. If a signal rises above this level the gain reduction is released.
  4784. Default is 0.125. Allowed range is from 0 to 1.
  4785. @item ratio
  4786. Set a ratio about which the signal is reduced.
  4787. Default is 2. Allowed range is from 1 to 9000.
  4788. @item attack
  4789. Amount of milliseconds the signal has to rise above the threshold before gain
  4790. reduction stops.
  4791. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  4792. @item release
  4793. Amount of milliseconds the signal has to fall below the threshold before the
  4794. reduction is increased again. Default is 250 milliseconds.
  4795. Allowed range is from 0.01 to 9000.
  4796. @item makeup
  4797. Set amount of amplification of signal after processing.
  4798. Default is 1. Allowed range is from 1 to 64.
  4799. @item knee
  4800. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4801. Default is 2.828427125. Allowed range is from 1 to 8.
  4802. @item detection
  4803. Choose if exact signal should be taken for detection or an RMS like one.
  4804. Default is rms. Can be peak or rms.
  4805. @item link
  4806. Choose if the average level between all channels or the louder channel affects
  4807. the reduction.
  4808. Default is average. Can be average or maximum.
  4809. @item level_sc
  4810. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  4811. @end table
  4812. @subsection Commands
  4813. This filter supports the all above options as @ref{commands}.
  4814. @section silencedetect
  4815. Detect silence in an audio stream.
  4816. This filter logs a message when it detects that the input audio volume is less
  4817. or equal to a noise tolerance value for a duration greater or equal to the
  4818. minimum detected noise duration.
  4819. The printed times and duration are expressed in seconds. The
  4820. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  4821. is set on the first frame whose timestamp equals or exceeds the detection
  4822. duration and it contains the timestamp of the first frame of the silence.
  4823. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  4824. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  4825. keys are set on the first frame after the silence. If @option{mono} is
  4826. enabled, and each channel is evaluated separately, the @code{.X}
  4827. suffixed keys are used, and @code{X} corresponds to the channel number.
  4828. The filter accepts the following options:
  4829. @table @option
  4830. @item noise, n
  4831. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  4832. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  4833. @item duration, d
  4834. Set silence duration until notification (default is 2 seconds). See
  4835. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4836. for the accepted syntax.
  4837. @item mono, m
  4838. Process each channel separately, instead of combined. By default is disabled.
  4839. @end table
  4840. @subsection Examples
  4841. @itemize
  4842. @item
  4843. Detect 5 seconds of silence with -50dB noise tolerance:
  4844. @example
  4845. silencedetect=n=-50dB:d=5
  4846. @end example
  4847. @item
  4848. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  4849. tolerance in @file{silence.mp3}:
  4850. @example
  4851. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  4852. @end example
  4853. @end itemize
  4854. @section silenceremove
  4855. Remove silence from the beginning, middle or end of the audio.
  4856. The filter accepts the following options:
  4857. @table @option
  4858. @item start_periods
  4859. This value is used to indicate if audio should be trimmed at beginning of
  4860. the audio. A value of zero indicates no silence should be trimmed from the
  4861. beginning. When specifying a non-zero value, it trims audio up until it
  4862. finds non-silence. Normally, when trimming silence from beginning of audio
  4863. the @var{start_periods} will be @code{1} but it can be increased to higher
  4864. values to trim all audio up to specific count of non-silence periods.
  4865. Default value is @code{0}.
  4866. @item start_duration
  4867. Specify the amount of time that non-silence must be detected before it stops
  4868. trimming audio. By increasing the duration, bursts of noises can be treated
  4869. as silence and trimmed off. Default value is @code{0}.
  4870. @item start_threshold
  4871. This indicates what sample value should be treated as silence. For digital
  4872. audio, a value of @code{0} may be fine but for audio recorded from analog,
  4873. you may wish to increase the value to account for background noise.
  4874. Can be specified in dB (in case "dB" is appended to the specified value)
  4875. or amplitude ratio. Default value is @code{0}.
  4876. @item start_silence
  4877. Specify max duration of silence at beginning that will be kept after
  4878. trimming. Default is 0, which is equal to trimming all samples detected
  4879. as silence.
  4880. @item start_mode
  4881. Specify mode of detection of silence end in start of multi-channel audio.
  4882. Can be @var{any} or @var{all}. Default is @var{any}.
  4883. With @var{any}, any sample that is detected as non-silence will cause
  4884. stopped trimming of silence.
  4885. With @var{all}, only if all channels are detected as non-silence will cause
  4886. stopped trimming of silence.
  4887. @item stop_periods
  4888. Set the count for trimming silence from the end of audio.
  4889. To remove silence from the middle of a file, specify a @var{stop_periods}
  4890. that is negative. This value is then treated as a positive value and is
  4891. used to indicate the effect should restart processing as specified by
  4892. @var{start_periods}, making it suitable for removing periods of silence
  4893. in the middle of the audio.
  4894. Default value is @code{0}.
  4895. @item stop_duration
  4896. Specify a duration of silence that must exist before audio is not copied any
  4897. more. By specifying a higher duration, silence that is wanted can be left in
  4898. the audio.
  4899. Default value is @code{0}.
  4900. @item stop_threshold
  4901. This is the same as @option{start_threshold} but for trimming silence from
  4902. the end of audio.
  4903. Can be specified in dB (in case "dB" is appended to the specified value)
  4904. or amplitude ratio. Default value is @code{0}.
  4905. @item stop_silence
  4906. Specify max duration of silence at end that will be kept after
  4907. trimming. Default is 0, which is equal to trimming all samples detected
  4908. as silence.
  4909. @item stop_mode
  4910. Specify mode of detection of silence start in end of multi-channel audio.
  4911. Can be @var{any} or @var{all}. Default is @var{any}.
  4912. With @var{any}, any sample that is detected as non-silence will cause
  4913. stopped trimming of silence.
  4914. With @var{all}, only if all channels are detected as non-silence will cause
  4915. stopped trimming of silence.
  4916. @item detection
  4917. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  4918. and works better with digital silence which is exactly 0.
  4919. Default value is @code{rms}.
  4920. @item window
  4921. Set duration in number of seconds used to calculate size of window in number
  4922. of samples for detecting silence.
  4923. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  4924. @end table
  4925. @subsection Examples
  4926. @itemize
  4927. @item
  4928. The following example shows how this filter can be used to start a recording
  4929. that does not contain the delay at the start which usually occurs between
  4930. pressing the record button and the start of the performance:
  4931. @example
  4932. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  4933. @end example
  4934. @item
  4935. Trim all silence encountered from beginning to end where there is more than 1
  4936. second of silence in audio:
  4937. @example
  4938. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  4939. @end example
  4940. @item
  4941. Trim all digital silence samples, using peak detection, from beginning to end
  4942. where there is more than 0 samples of digital silence in audio and digital
  4943. silence is detected in all channels at same positions in stream:
  4944. @example
  4945. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  4946. @end example
  4947. @end itemize
  4948. @section sofalizer
  4949. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  4950. loudspeakers around the user for binaural listening via headphones (audio
  4951. formats up to 9 channels supported).
  4952. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  4953. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  4954. Austrian Academy of Sciences.
  4955. To enable compilation of this filter you need to configure FFmpeg with
  4956. @code{--enable-libmysofa}.
  4957. The filter accepts the following options:
  4958. @table @option
  4959. @item sofa
  4960. Set the SOFA file used for rendering.
  4961. @item gain
  4962. Set gain applied to audio. Value is in dB. Default is 0.
  4963. @item rotation
  4964. Set rotation of virtual loudspeakers in deg. Default is 0.
  4965. @item elevation
  4966. Set elevation of virtual speakers in deg. Default is 0.
  4967. @item radius
  4968. Set distance in meters between loudspeakers and the listener with near-field
  4969. HRTFs. Default is 1.
  4970. @item type
  4971. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  4972. processing audio in time domain which is slow.
  4973. @var{freq} is processing audio in frequency domain which is fast.
  4974. Default is @var{freq}.
  4975. @item speakers
  4976. Set custom positions of virtual loudspeakers. Syntax for this option is:
  4977. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  4978. Each virtual loudspeaker is described with short channel name following with
  4979. azimuth and elevation in degrees.
  4980. Each virtual loudspeaker description is separated by '|'.
  4981. For example to override front left and front right channel positions use:
  4982. 'speakers=FL 45 15|FR 345 15'.
  4983. Descriptions with unrecognised channel names are ignored.
  4984. @item lfegain
  4985. Set custom gain for LFE channels. Value is in dB. Default is 0.
  4986. @item framesize
  4987. Set custom frame size in number of samples. Default is 1024.
  4988. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  4989. is set to @var{freq}.
  4990. @item normalize
  4991. Should all IRs be normalized upon importing SOFA file.
  4992. By default is enabled.
  4993. @item interpolate
  4994. Should nearest IRs be interpolated with neighbor IRs if exact position
  4995. does not match. By default is disabled.
  4996. @item minphase
  4997. Minphase all IRs upon loading of SOFA file. By default is disabled.
  4998. @item anglestep
  4999. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  5000. @item radstep
  5001. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  5002. @end table
  5003. @subsection Examples
  5004. @itemize
  5005. @item
  5006. Using ClubFritz6 sofa file:
  5007. @example
  5008. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  5009. @end example
  5010. @item
  5011. Using ClubFritz12 sofa file and bigger radius with small rotation:
  5012. @example
  5013. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  5014. @end example
  5015. @item
  5016. Similar as above but with custom speaker positions for front left, front right, back left and back right
  5017. and also with custom gain:
  5018. @example
  5019. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  5020. @end example
  5021. @end itemize
  5022. @section speechnorm
  5023. Speech Normalizer.
  5024. This filter expands or compresses each half-cycle of audio samples
  5025. (local set of samples all above or all below zero and between two nearest zero crossings) depending
  5026. on threshold value, so audio reaches target peak value under conditions controlled by below options.
  5027. The filter accepts the following options:
  5028. @table @option
  5029. @item peak, p
  5030. Set the expansion target peak value. This specifies the highest allowed absolute amplitude
  5031. level for the normalized audio input. Default value is 0.95. Allowed range is from 0.0 to 1.0.
  5032. @item expansion, e
  5033. Set the maximum expansion factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  5034. This option controls maximum local half-cycle of samples expansion. The maximum expansion
  5035. would be such that local peak value reaches target peak value but never to surpass it and that
  5036. ratio between new and previous peak value does not surpass this option value.
  5037. @item compression, c
  5038. Set the maximum compression factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  5039. This option controls maximum local half-cycle of samples compression. This option is used
  5040. only if @option{threshold} option is set to value greater than 0.0, then in such cases
  5041. when local peak is lower or same as value set by @option{threshold} all samples belonging to
  5042. that peak's half-cycle will be compressed by current compression factor.
  5043. @item threshold, t
  5044. Set the threshold value. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  5045. This option specifies which half-cycles of samples will be compressed and which will be expanded.
  5046. Any half-cycle samples with their local peak value below or same as this option value will be
  5047. compressed by current compression factor, otherwise, if greater than threshold value they will be
  5048. expanded with expansion factor so that it could reach peak target value but never surpass it.
  5049. @item raise, r
  5050. Set the expansion raising amount per each half-cycle of samples. Default value is 0.001.
  5051. Allowed range is from 0.0 to 1.0. This controls how fast expansion factor is raised per
  5052. each new half-cycle until it reaches @option{expansion} value.
  5053. Setting this options too high may lead to distortions.
  5054. @item fall, f
  5055. Set the compression raising amount per each half-cycle of samples. Default value is 0.001.
  5056. Allowed range is from 0.0 to 1.0. This controls how fast compression factor is raised per
  5057. each new half-cycle until it reaches @option{compression} value.
  5058. @item channels, h
  5059. Specify which channels to filter, by default all available channels are filtered.
  5060. @item invert, i
  5061. Enable inverted filtering, by default is disabled. This inverts interpretation of @option{threshold}
  5062. option. When enabled any half-cycle of samples with their local peak value below or same as
  5063. @option{threshold} option will be expanded otherwise it will be compressed.
  5064. @item link, l
  5065. Link channels when calculating gain applied to each filtered channel sample, by default is disabled.
  5066. When disabled each filtered channel gain calculation is independent, otherwise when this option
  5067. is enabled the minimum of all possible gains for each filtered channel is used.
  5068. @item rms, m
  5069. Set the expansion target RMS value. This specifies the highest allowed RMS level for the normalized
  5070. audio input. Default value is 0.0, thus disabled. Allowed range is from 0.0 to 1.0.
  5071. @end table
  5072. @subsection Commands
  5073. This filter supports the all above options as @ref{commands}.
  5074. @subsection Examples
  5075. @itemize
  5076. @item
  5077. Weak and slow amplification:
  5078. @example
  5079. speechnorm=e=3:r=0.00001:l=1
  5080. @end example
  5081. @item
  5082. Moderate and slow amplification:
  5083. @example
  5084. speechnorm=e=6.25:r=0.00001:l=1
  5085. @end example
  5086. @item
  5087. Strong and fast amplification:
  5088. @example
  5089. speechnorm=e=12.5:r=0.0001:l=1
  5090. @end example
  5091. @item
  5092. Very strong and fast amplification:
  5093. @example
  5094. speechnorm=e=25:r=0.0001:l=1
  5095. @end example
  5096. @item
  5097. Extreme and fast amplification:
  5098. @example
  5099. speechnorm=e=50:r=0.0001:l=1
  5100. @end example
  5101. @end itemize
  5102. @section stereotools
  5103. This filter has some handy utilities to manage stereo signals, for converting
  5104. M/S stereo recordings to L/R signal while having control over the parameters
  5105. or spreading the stereo image of master track.
  5106. The filter accepts the following options:
  5107. @table @option
  5108. @item level_in
  5109. Set input level before filtering for both channels. Defaults is 1.
  5110. Allowed range is from 0.015625 to 64.
  5111. @item level_out
  5112. Set output level after filtering for both channels. Defaults is 1.
  5113. Allowed range is from 0.015625 to 64.
  5114. @item balance_in
  5115. Set input balance between both channels. Default is 0.
  5116. Allowed range is from -1 to 1.
  5117. @item balance_out
  5118. Set output balance between both channels. Default is 0.
  5119. Allowed range is from -1 to 1.
  5120. @item softclip
  5121. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  5122. clipping. Disabled by default.
  5123. @item mutel
  5124. Mute the left channel. Disabled by default.
  5125. @item muter
  5126. Mute the right channel. Disabled by default.
  5127. @item phasel
  5128. Change the phase of the left channel. Disabled by default.
  5129. @item phaser
  5130. Change the phase of the right channel. Disabled by default.
  5131. @item mode
  5132. Set stereo mode. Available values are:
  5133. @table @samp
  5134. @item lr>lr
  5135. Left/Right to Left/Right, this is default.
  5136. @item lr>ms
  5137. Left/Right to Mid/Side.
  5138. @item ms>lr
  5139. Mid/Side to Left/Right.
  5140. @item lr>ll
  5141. Left/Right to Left/Left.
  5142. @item lr>rr
  5143. Left/Right to Right/Right.
  5144. @item lr>l+r
  5145. Left/Right to Left + Right.
  5146. @item lr>rl
  5147. Left/Right to Right/Left.
  5148. @item ms>ll
  5149. Mid/Side to Left/Left.
  5150. @item ms>rr
  5151. Mid/Side to Right/Right.
  5152. @item ms>rl
  5153. Mid/Side to Right/Left.
  5154. @item lr>l-r
  5155. Left/Right to Left - Right.
  5156. @end table
  5157. @item slev
  5158. Set level of side signal. Default is 1.
  5159. Allowed range is from 0.015625 to 64.
  5160. @item sbal
  5161. Set balance of side signal. Default is 0.
  5162. Allowed range is from -1 to 1.
  5163. @item mlev
  5164. Set level of the middle signal. Default is 1.
  5165. Allowed range is from 0.015625 to 64.
  5166. @item mpan
  5167. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  5168. @item base
  5169. Set stereo base between mono and inversed channels. Default is 0.
  5170. Allowed range is from -1 to 1.
  5171. @item delay
  5172. Set delay in milliseconds how much to delay left from right channel and
  5173. vice versa. Default is 0. Allowed range is from -20 to 20.
  5174. @item sclevel
  5175. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  5176. @item phase
  5177. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  5178. @item bmode_in, bmode_out
  5179. Set balance mode for balance_in/balance_out option.
  5180. Can be one of the following:
  5181. @table @samp
  5182. @item balance
  5183. Classic balance mode. Attenuate one channel at time.
  5184. Gain is raised up to 1.
  5185. @item amplitude
  5186. Similar as classic mode above but gain is raised up to 2.
  5187. @item power
  5188. Equal power distribution, from -6dB to +6dB range.
  5189. @end table
  5190. @end table
  5191. @subsection Commands
  5192. This filter supports the all above options as @ref{commands}.
  5193. @subsection Examples
  5194. @itemize
  5195. @item
  5196. Apply karaoke like effect:
  5197. @example
  5198. stereotools=mlev=0.015625
  5199. @end example
  5200. @item
  5201. Convert M/S signal to L/R:
  5202. @example
  5203. "stereotools=mode=ms>lr"
  5204. @end example
  5205. @end itemize
  5206. @section stereowiden
  5207. This filter enhance the stereo effect by suppressing signal common to both
  5208. channels and by delaying the signal of left into right and vice versa,
  5209. thereby widening the stereo effect.
  5210. The filter accepts the following options:
  5211. @table @option
  5212. @item delay
  5213. Time in milliseconds of the delay of left signal into right and vice versa.
  5214. Default is 20 milliseconds.
  5215. @item feedback
  5216. Amount of gain in delayed signal into right and vice versa. Gives a delay
  5217. effect of left signal in right output and vice versa which gives widening
  5218. effect. Default is 0.3.
  5219. @item crossfeed
  5220. Cross feed of left into right with inverted phase. This helps in suppressing
  5221. the mono. If the value is 1 it will cancel all the signal common to both
  5222. channels. Default is 0.3.
  5223. @item drymix
  5224. Set level of input signal of original channel. Default is 0.8.
  5225. @end table
  5226. @subsection Commands
  5227. This filter supports the all above options except @code{delay} as @ref{commands}.
  5228. @section superequalizer
  5229. Apply 18 band equalizer.
  5230. The filter accepts the following options:
  5231. @table @option
  5232. @item 1b
  5233. Set 65Hz band gain.
  5234. @item 2b
  5235. Set 92Hz band gain.
  5236. @item 3b
  5237. Set 131Hz band gain.
  5238. @item 4b
  5239. Set 185Hz band gain.
  5240. @item 5b
  5241. Set 262Hz band gain.
  5242. @item 6b
  5243. Set 370Hz band gain.
  5244. @item 7b
  5245. Set 523Hz band gain.
  5246. @item 8b
  5247. Set 740Hz band gain.
  5248. @item 9b
  5249. Set 1047Hz band gain.
  5250. @item 10b
  5251. Set 1480Hz band gain.
  5252. @item 11b
  5253. Set 2093Hz band gain.
  5254. @item 12b
  5255. Set 2960Hz band gain.
  5256. @item 13b
  5257. Set 4186Hz band gain.
  5258. @item 14b
  5259. Set 5920Hz band gain.
  5260. @item 15b
  5261. Set 8372Hz band gain.
  5262. @item 16b
  5263. Set 11840Hz band gain.
  5264. @item 17b
  5265. Set 16744Hz band gain.
  5266. @item 18b
  5267. Set 20000Hz band gain.
  5268. @end table
  5269. @section surround
  5270. Apply audio surround upmix filter.
  5271. This filter allows to produce multichannel output from audio stream.
  5272. The filter accepts the following options:
  5273. @table @option
  5274. @item chl_out
  5275. Set output channel layout. By default, this is @var{5.1}.
  5276. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5277. for the required syntax.
  5278. @item chl_in
  5279. Set input channel layout. By default, this is @var{stereo}.
  5280. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5281. for the required syntax.
  5282. @item level_in
  5283. Set input volume level. By default, this is @var{1}.
  5284. @item level_out
  5285. Set output volume level. By default, this is @var{1}.
  5286. @item lfe
  5287. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  5288. @item lfe_low
  5289. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  5290. @item lfe_high
  5291. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  5292. @item lfe_mode
  5293. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  5294. In @var{add} mode, LFE channel is created from input audio and added to output.
  5295. In @var{sub} mode, LFE channel is created from input audio and added to output but
  5296. also all non-LFE output channels are subtracted with output LFE channel.
  5297. @item smooth
  5298. Set temporal smoothness strength, used to gradually change factors when transforming
  5299. stereo sound in time. Allowed range is from @var{0.0} to @var{1.0}.
  5300. Useful to improve output quality with @var{focus} option values greater than @var{0.0}.
  5301. Default is @var{0.0}. Only values inside this range and without edges are effective.
  5302. @item angle
  5303. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  5304. Default is @var{90}.
  5305. @item focus
  5306. Set focus of stereo surround transform, Allowed range is from @var{-1} to @var{1}.
  5307. Default is @var{0}.
  5308. @item fc_in
  5309. Set front center input volume. By default, this is @var{1}.
  5310. @item fc_out
  5311. Set front center output volume. By default, this is @var{1}.
  5312. @item fl_in
  5313. Set front left input volume. By default, this is @var{1}.
  5314. @item fl_out
  5315. Set front left output volume. By default, this is @var{1}.
  5316. @item fr_in
  5317. Set front right input volume. By default, this is @var{1}.
  5318. @item fr_out
  5319. Set front right output volume. By default, this is @var{1}.
  5320. @item sl_in
  5321. Set side left input volume. By default, this is @var{1}.
  5322. @item sl_out
  5323. Set side left output volume. By default, this is @var{1}.
  5324. @item sr_in
  5325. Set side right input volume. By default, this is @var{1}.
  5326. @item sr_out
  5327. Set side right output volume. By default, this is @var{1}.
  5328. @item bl_in
  5329. Set back left input volume. By default, this is @var{1}.
  5330. @item bl_out
  5331. Set back left output volume. By default, this is @var{1}.
  5332. @item br_in
  5333. Set back right input volume. By default, this is @var{1}.
  5334. @item br_out
  5335. Set back right output volume. By default, this is @var{1}.
  5336. @item bc_in
  5337. Set back center input volume. By default, this is @var{1}.
  5338. @item bc_out
  5339. Set back center output volume. By default, this is @var{1}.
  5340. @item lfe_in
  5341. Set LFE input volume. By default, this is @var{1}.
  5342. @item lfe_out
  5343. Set LFE output volume. By default, this is @var{1}.
  5344. @item allx
  5345. Set spread usage of stereo image across X axis for all channels.
  5346. Allowed range is from @var{-1} to @var{15}.
  5347. By default this value is negative @var{-1}, and thus unused.
  5348. @item ally
  5349. Set spread usage of stereo image across Y axis for all channels.
  5350. Allowed range is from @var{-1} to @var{15}.
  5351. By default this value is negative @var{-1}, and thus unused.
  5352. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  5353. Set spread usage of stereo image across X axis for each channel.
  5354. Allowed range is from @var{0.06} to @var{15}.
  5355. By default this value is @var{0.5}.
  5356. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  5357. Set spread usage of stereo image across Y axis for each channel.
  5358. Allowed range is from @var{0.06} to @var{15}.
  5359. By default this value is @var{0.5}.
  5360. @item win_size
  5361. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  5362. @item win_func
  5363. Set window function.
  5364. It accepts the following values:
  5365. @table @samp
  5366. @item rect
  5367. @item bartlett
  5368. @item hann, hanning
  5369. @item hamming
  5370. @item blackman
  5371. @item welch
  5372. @item flattop
  5373. @item bharris
  5374. @item bnuttall
  5375. @item bhann
  5376. @item sine
  5377. @item nuttall
  5378. @item lanczos
  5379. @item gauss
  5380. @item tukey
  5381. @item dolph
  5382. @item cauchy
  5383. @item parzen
  5384. @item poisson
  5385. @item bohman
  5386. @item kaiser
  5387. @end table
  5388. Default is @code{hann}.
  5389. @item overlap
  5390. Set window overlap. If set to 1, the recommended overlap for selected
  5391. window function will be picked. Default is @code{0.5}.
  5392. @end table
  5393. @section tiltshelf
  5394. Boost or cut the lower frequencies and cut or boost higher frequencies
  5395. of the audio using a two-pole shelving filter with a response similar to
  5396. that of a standard hi-fi's tone-controls.
  5397. This is also known as shelving equalisation (EQ).
  5398. The filter accepts the following options:
  5399. @table @option
  5400. @item gain, g
  5401. Give the gain at 0 Hz. Its useful range is about -20
  5402. (for a large cut) to +20 (for a large boost).
  5403. Beware of clipping when using a positive gain.
  5404. @item frequency, f
  5405. Set the filter's central frequency and so can be used
  5406. to extend or reduce the frequency range to be boosted or cut.
  5407. The default value is @code{3000} Hz.
  5408. @item width_type, t
  5409. Set method to specify band-width of filter.
  5410. @table @option
  5411. @item h
  5412. Hz
  5413. @item q
  5414. Q-Factor
  5415. @item o
  5416. octave
  5417. @item s
  5418. slope
  5419. @item k
  5420. kHz
  5421. @end table
  5422. @item width, w
  5423. Determine how steep is the filter's shelf transition.
  5424. @item poles, p
  5425. Set number of poles. Default is 2.
  5426. @item mix, m
  5427. How much to use filtered signal in output. Default is 1.
  5428. Range is between 0 and 1.
  5429. @item channels, c
  5430. Specify which channels to filter, by default all available are filtered.
  5431. @item normalize, n
  5432. Normalize biquad coefficients, by default is disabled.
  5433. Enabling it will normalize magnitude response at DC to 0dB.
  5434. @item transform, a
  5435. Set transform type of IIR filter.
  5436. @table @option
  5437. @item di
  5438. @item dii
  5439. @item tdi
  5440. @item tdii
  5441. @item latt
  5442. @item svf
  5443. @item zdf
  5444. @end table
  5445. @item precision, r
  5446. Set precison of filtering.
  5447. @table @option
  5448. @item auto
  5449. Pick automatic sample format depending on surround filters.
  5450. @item s16
  5451. Always use signed 16-bit.
  5452. @item s32
  5453. Always use signed 32-bit.
  5454. @item f32
  5455. Always use float 32-bit.
  5456. @item f64
  5457. Always use float 64-bit.
  5458. @end table
  5459. @item block_size, b
  5460. Set block size used for reverse IIR processing. If this value is set to high enough
  5461. value (higher than impulse response length truncated when reaches near zero values) filtering
  5462. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  5463. Note that filter delay will be exactly this many samples when set to non-zero value.
  5464. @end table
  5465. @subsection Commands
  5466. This filter supports some options as @ref{commands}.
  5467. @section treble, highshelf
  5468. Boost or cut treble (upper) frequencies of the audio using a two-pole
  5469. shelving filter with a response similar to that of a standard
  5470. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  5471. The filter accepts the following options:
  5472. @table @option
  5473. @item gain, g
  5474. Give the gain at whichever is the lower of ~22 kHz and the
  5475. Nyquist frequency. Its useful range is about -20 (for a large cut)
  5476. to +20 (for a large boost). Beware of clipping when using a positive gain.
  5477. @item frequency, f
  5478. Set the filter's central frequency and so can be used
  5479. to extend or reduce the frequency range to be boosted or cut.
  5480. The default value is @code{3000} Hz.
  5481. @item width_type, t
  5482. Set method to specify band-width of filter.
  5483. @table @option
  5484. @item h
  5485. Hz
  5486. @item q
  5487. Q-Factor
  5488. @item o
  5489. octave
  5490. @item s
  5491. slope
  5492. @item k
  5493. kHz
  5494. @end table
  5495. @item width, w
  5496. Determine how steep is the filter's shelf transition.
  5497. @item poles, p
  5498. Set number of poles. Default is 2.
  5499. @item mix, m
  5500. How much to use filtered signal in output. Default is 1.
  5501. Range is between 0 and 1.
  5502. @item channels, c
  5503. Specify which channels to filter, by default all available are filtered.
  5504. @item normalize, n
  5505. Normalize biquad coefficients, by default is disabled.
  5506. Enabling it will normalize magnitude response at DC to 0dB.
  5507. @item transform, a
  5508. Set transform type of IIR filter.
  5509. @table @option
  5510. @item di
  5511. @item dii
  5512. @item tdi
  5513. @item tdii
  5514. @item latt
  5515. @item svf
  5516. @item zdf
  5517. @end table
  5518. @item precision, r
  5519. Set precison of filtering.
  5520. @table @option
  5521. @item auto
  5522. Pick automatic sample format depending on surround filters.
  5523. @item s16
  5524. Always use signed 16-bit.
  5525. @item s32
  5526. Always use signed 32-bit.
  5527. @item f32
  5528. Always use float 32-bit.
  5529. @item f64
  5530. Always use float 64-bit.
  5531. @end table
  5532. @item block_size, b
  5533. Set block size used for reverse IIR processing. If this value is set to high enough
  5534. value (higher than impulse response length truncated when reaches near zero values) filtering
  5535. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  5536. Note that filter delay will be exactly this many samples when set to non-zero value.
  5537. @end table
  5538. @subsection Commands
  5539. This filter supports the following commands:
  5540. @table @option
  5541. @item frequency, f
  5542. Change treble frequency.
  5543. Syntax for the command is : "@var{frequency}"
  5544. @item width_type, t
  5545. Change treble width_type.
  5546. Syntax for the command is : "@var{width_type}"
  5547. @item width, w
  5548. Change treble width.
  5549. Syntax for the command is : "@var{width}"
  5550. @item gain, g
  5551. Change treble gain.
  5552. Syntax for the command is : "@var{gain}"
  5553. @item mix, m
  5554. Change treble mix.
  5555. Syntax for the command is : "@var{mix}"
  5556. @end table
  5557. @section tremolo
  5558. Sinusoidal amplitude modulation.
  5559. The filter accepts the following options:
  5560. @table @option
  5561. @item f
  5562. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  5563. (20 Hz or lower) will result in a tremolo effect.
  5564. This filter may also be used as a ring modulator by specifying
  5565. a modulation frequency higher than 20 Hz.
  5566. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  5567. @item d
  5568. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  5569. Default value is 0.5.
  5570. @end table
  5571. @section vibrato
  5572. Sinusoidal phase modulation.
  5573. The filter accepts the following options:
  5574. @table @option
  5575. @item f
  5576. Modulation frequency in Hertz.
  5577. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  5578. @item d
  5579. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  5580. Default value is 0.5.
  5581. @end table
  5582. @section virtualbass
  5583. Apply audio Virtual Bass filter.
  5584. This filter accepts stereo input and produce stereo with LFE (2.1) channels output.
  5585. The newly produced LFE channel have enhanced virtual bass originally obtained from both stereo channels.
  5586. This filter outputs front left and front right channels unchanged as available in stereo input.
  5587. The filter accepts the following options:
  5588. @table @option
  5589. @item cutoff
  5590. Set the virtual bass cutoff frequency. Default value is 250 Hz.
  5591. Allowed range is from 100 to 500 Hz.
  5592. @item strength
  5593. Set the virtual bass strength. Allowed range is from 0.5 to 3.
  5594. Default value is 3.
  5595. @end table
  5596. @section volume
  5597. Adjust the input audio volume.
  5598. It accepts the following parameters:
  5599. @table @option
  5600. @item volume
  5601. Set audio volume expression.
  5602. Output values are clipped to the maximum value.
  5603. The output audio volume is given by the relation:
  5604. @example
  5605. @var{output_volume} = @var{volume} * @var{input_volume}
  5606. @end example
  5607. The default value for @var{volume} is "1.0".
  5608. @item precision
  5609. This parameter represents the mathematical precision.
  5610. It determines which input sample formats will be allowed, which affects the
  5611. precision of the volume scaling.
  5612. @table @option
  5613. @item fixed
  5614. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  5615. @item float
  5616. 32-bit floating-point; this limits input sample format to FLT. (default)
  5617. @item double
  5618. 64-bit floating-point; this limits input sample format to DBL.
  5619. @end table
  5620. @item replaygain
  5621. Choose the behaviour on encountering ReplayGain side data in input frames.
  5622. @table @option
  5623. @item drop
  5624. Remove ReplayGain side data, ignoring its contents (the default).
  5625. @item ignore
  5626. Ignore ReplayGain side data, but leave it in the frame.
  5627. @item track
  5628. Prefer the track gain, if present.
  5629. @item album
  5630. Prefer the album gain, if present.
  5631. @end table
  5632. @item replaygain_preamp
  5633. Pre-amplification gain in dB to apply to the selected replaygain gain.
  5634. Default value for @var{replaygain_preamp} is 0.0.
  5635. @item replaygain_noclip
  5636. Prevent clipping by limiting the gain applied.
  5637. Default value for @var{replaygain_noclip} is 1.
  5638. @item eval
  5639. Set when the volume expression is evaluated.
  5640. It accepts the following values:
  5641. @table @samp
  5642. @item once
  5643. only evaluate expression once during the filter initialization, or
  5644. when the @samp{volume} command is sent
  5645. @item frame
  5646. evaluate expression for each incoming frame
  5647. @end table
  5648. Default value is @samp{once}.
  5649. @end table
  5650. The volume expression can contain the following parameters.
  5651. @table @option
  5652. @item n
  5653. frame number (starting at zero)
  5654. @item nb_channels
  5655. number of channels
  5656. @item nb_consumed_samples
  5657. number of samples consumed by the filter
  5658. @item nb_samples
  5659. number of samples in the current frame
  5660. @item pos
  5661. original frame position in the file
  5662. @item pts
  5663. frame PTS
  5664. @item sample_rate
  5665. sample rate
  5666. @item startpts
  5667. PTS at start of stream
  5668. @item startt
  5669. time at start of stream
  5670. @item t
  5671. frame time
  5672. @item tb
  5673. timestamp timebase
  5674. @item volume
  5675. last set volume value
  5676. @end table
  5677. Note that when @option{eval} is set to @samp{once} only the
  5678. @var{sample_rate} and @var{tb} variables are available, all other
  5679. variables will evaluate to NAN.
  5680. @subsection Commands
  5681. This filter supports the following commands:
  5682. @table @option
  5683. @item volume
  5684. Modify the volume expression.
  5685. The command accepts the same syntax of the corresponding option.
  5686. If the specified expression is not valid, it is kept at its current
  5687. value.
  5688. @end table
  5689. @subsection Examples
  5690. @itemize
  5691. @item
  5692. Halve the input audio volume:
  5693. @example
  5694. volume=volume=0.5
  5695. volume=volume=1/2
  5696. volume=volume=-6.0206dB
  5697. @end example
  5698. In all the above example the named key for @option{volume} can be
  5699. omitted, for example like in:
  5700. @example
  5701. volume=0.5
  5702. @end example
  5703. @item
  5704. Increase input audio power by 6 decibels using fixed-point precision:
  5705. @example
  5706. volume=volume=6dB:precision=fixed
  5707. @end example
  5708. @item
  5709. Fade volume after time 10 with an annihilation period of 5 seconds:
  5710. @example
  5711. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  5712. @end example
  5713. @end itemize
  5714. @section volumedetect
  5715. Detect the volume of the input video.
  5716. The filter has no parameters. It supports only 16-bit signed integer samples,
  5717. so the input will be converted when needed. Statistics about the volume will
  5718. be printed in the log when the input stream end is reached.
  5719. In particular it will show the mean volume (root mean square), maximum
  5720. volume (on a per-sample basis), and the beginning of a histogram of the
  5721. registered volume values (from the maximum value to a cumulated 1/1000 of
  5722. the samples).
  5723. All volumes are in decibels relative to the maximum PCM value.
  5724. @subsection Examples
  5725. Here is an excerpt of the output:
  5726. @example
  5727. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  5728. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  5729. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  5730. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  5731. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  5732. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  5733. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  5734. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  5735. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  5736. @end example
  5737. It means that:
  5738. @itemize
  5739. @item
  5740. The mean square energy is approximately -27 dB, or 10^-2.7.
  5741. @item
  5742. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  5743. @item
  5744. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  5745. @end itemize
  5746. In other words, raising the volume by +4 dB does not cause any clipping,
  5747. raising it by +5 dB causes clipping for 6 samples, etc.
  5748. @c man end AUDIO FILTERS
  5749. @chapter Audio Sources
  5750. @c man begin AUDIO SOURCES
  5751. Below is a description of the currently available audio sources.
  5752. @section abuffer
  5753. Buffer audio frames, and make them available to the filter chain.
  5754. This source is mainly intended for a programmatic use, in particular
  5755. through the interface defined in @file{libavfilter/buffersrc.h}.
  5756. It accepts the following parameters:
  5757. @table @option
  5758. @item time_base
  5759. The timebase which will be used for timestamps of submitted frames. It must be
  5760. either a floating-point number or in @var{numerator}/@var{denominator} form.
  5761. @item sample_rate
  5762. The sample rate of the incoming audio buffers.
  5763. @item sample_fmt
  5764. The sample format of the incoming audio buffers.
  5765. Either a sample format name or its corresponding integer representation from
  5766. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  5767. @item channel_layout
  5768. The channel layout of the incoming audio buffers.
  5769. Either a channel layout name from channel_layout_map in
  5770. @file{libavutil/channel_layout.c} or its corresponding integer representation
  5771. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  5772. @item channels
  5773. The number of channels of the incoming audio buffers.
  5774. If both @var{channels} and @var{channel_layout} are specified, then they
  5775. must be consistent.
  5776. @end table
  5777. @subsection Examples
  5778. @example
  5779. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  5780. @end example
  5781. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  5782. Since the sample format with name "s16p" corresponds to the number
  5783. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  5784. equivalent to:
  5785. @example
  5786. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  5787. @end example
  5788. @section aevalsrc
  5789. Generate an audio signal specified by an expression.
  5790. This source accepts in input one or more expressions (one for each
  5791. channel), which are evaluated and used to generate a corresponding
  5792. audio signal.
  5793. This source accepts the following options:
  5794. @table @option
  5795. @item exprs
  5796. Set the '|'-separated expressions list for each separate channel. In case the
  5797. @option{channel_layout} option is not specified, the selected channel layout
  5798. depends on the number of provided expressions. Otherwise the last
  5799. specified expression is applied to the remaining output channels.
  5800. @item channel_layout, c
  5801. Set the channel layout. The number of channels in the specified layout
  5802. must be equal to the number of specified expressions.
  5803. @item duration, d
  5804. Set the minimum duration of the sourced audio. See
  5805. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5806. for the accepted syntax.
  5807. Note that the resulting duration may be greater than the specified
  5808. duration, as the generated audio is always cut at the end of a
  5809. complete frame.
  5810. If not specified, or the expressed duration is negative, the audio is
  5811. supposed to be generated forever.
  5812. @item nb_samples, n
  5813. Set the number of samples per channel per each output frame,
  5814. default to 1024.
  5815. @item sample_rate, s
  5816. Specify the sample rate, default to 44100.
  5817. @end table
  5818. Each expression in @var{exprs} can contain the following constants:
  5819. @table @option
  5820. @item n
  5821. number of the evaluated sample, starting from 0
  5822. @item t
  5823. time of the evaluated sample expressed in seconds, starting from 0
  5824. @item s
  5825. sample rate
  5826. @end table
  5827. @subsection Examples
  5828. @itemize
  5829. @item
  5830. Generate silence:
  5831. @example
  5832. aevalsrc=0
  5833. @end example
  5834. @item
  5835. Generate a sin signal with frequency of 440 Hz, set sample rate to
  5836. 8000 Hz:
  5837. @example
  5838. aevalsrc="sin(440*2*PI*t):s=8000"
  5839. @end example
  5840. @item
  5841. Generate a two channels signal, specify the channel layout (Front
  5842. Center + Back Center) explicitly:
  5843. @example
  5844. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  5845. @end example
  5846. @item
  5847. Generate white noise:
  5848. @example
  5849. aevalsrc="-2+random(0)"
  5850. @end example
  5851. @item
  5852. Generate an amplitude modulated signal:
  5853. @example
  5854. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  5855. @end example
  5856. @item
  5857. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  5858. @example
  5859. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  5860. @end example
  5861. @end itemize
  5862. @section afdelaysrc
  5863. Generate a fractional delay FIR coefficients.
  5864. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  5865. The filter accepts the following options:
  5866. @table @option
  5867. @item delay, d
  5868. Set the fractional delay. Default is 0.
  5869. @item sample_rate, r
  5870. Set the sample rate, default is 44100.
  5871. @item nb_samples, n
  5872. Set the number of samples per each frame. Default is 1024.
  5873. @item taps, t
  5874. Set the number of filter coefficents in output audio stream.
  5875. Default value is 0.
  5876. @item channel_layout, c
  5877. Specifies the channel layout, and can be a string representing a channel layout.
  5878. The default value of @var{channel_layout} is "stereo".
  5879. @end table
  5880. @section afirsrc
  5881. Generate a FIR coefficients using frequency sampling method.
  5882. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  5883. The filter accepts the following options:
  5884. @table @option
  5885. @item taps, t
  5886. Set number of filter coefficents in output audio stream.
  5887. Default value is 1025.
  5888. @item frequency, f
  5889. Set frequency points from where magnitude and phase are set.
  5890. This must be in non decreasing order, and first element must be 0, while last element
  5891. must be 1. Elements are separated by white spaces.
  5892. @item magnitude, m
  5893. Set magnitude value for every frequency point set by @option{frequency}.
  5894. Number of values must be same as number of frequency points.
  5895. Values are separated by white spaces.
  5896. @item phase, p
  5897. Set phase value for every frequency point set by @option{frequency}.
  5898. Number of values must be same as number of frequency points.
  5899. Values are separated by white spaces.
  5900. @item sample_rate, r
  5901. Set sample rate, default is 44100.
  5902. @item nb_samples, n
  5903. Set number of samples per each frame. Default is 1024.
  5904. @item win_func, w
  5905. Set window function. Default is blackman.
  5906. @end table
  5907. @section anullsrc
  5908. The null audio source, return unprocessed audio frames. It is mainly useful
  5909. as a template and to be employed in analysis / debugging tools, or as
  5910. the source for filters which ignore the input data (for example the sox
  5911. synth filter).
  5912. This source accepts the following options:
  5913. @table @option
  5914. @item channel_layout, cl
  5915. Specifies the channel layout, and can be either an integer or a string
  5916. representing a channel layout. The default value of @var{channel_layout}
  5917. is "stereo".
  5918. Check the channel_layout_map definition in
  5919. @file{libavutil/channel_layout.c} for the mapping between strings and
  5920. channel layout values.
  5921. @item sample_rate, r
  5922. Specifies the sample rate, and defaults to 44100.
  5923. @item nb_samples, n
  5924. Set the number of samples per requested frames.
  5925. @item duration, d
  5926. Set the duration of the sourced audio. See
  5927. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5928. for the accepted syntax.
  5929. If not specified, or the expressed duration is negative, the audio is
  5930. supposed to be generated forever.
  5931. @end table
  5932. @subsection Examples
  5933. @itemize
  5934. @item
  5935. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  5936. @example
  5937. anullsrc=r=48000:cl=4
  5938. @end example
  5939. @item
  5940. Do the same operation with a more obvious syntax:
  5941. @example
  5942. anullsrc=r=48000:cl=mono
  5943. @end example
  5944. @end itemize
  5945. All the parameters need to be explicitly defined.
  5946. @section flite
  5947. Synthesize a voice utterance using the libflite library.
  5948. To enable compilation of this filter you need to configure FFmpeg with
  5949. @code{--enable-libflite}.
  5950. Note that versions of the flite library prior to 2.0 are not thread-safe.
  5951. The filter accepts the following options:
  5952. @table @option
  5953. @item list_voices
  5954. If set to 1, list the names of the available voices and exit
  5955. immediately. Default value is 0.
  5956. @item nb_samples, n
  5957. Set the maximum number of samples per frame. Default value is 512.
  5958. @item textfile
  5959. Set the filename containing the text to speak.
  5960. @item text
  5961. Set the text to speak.
  5962. @item voice, v
  5963. Set the voice to use for the speech synthesis. Default value is
  5964. @code{kal}. See also the @var{list_voices} option.
  5965. @end table
  5966. @subsection Examples
  5967. @itemize
  5968. @item
  5969. Read from file @file{speech.txt}, and synthesize the text using the
  5970. standard flite voice:
  5971. @example
  5972. flite=textfile=speech.txt
  5973. @end example
  5974. @item
  5975. Read the specified text selecting the @code{slt} voice:
  5976. @example
  5977. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  5978. @end example
  5979. @item
  5980. Input text to ffmpeg:
  5981. @example
  5982. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  5983. @end example
  5984. @item
  5985. Make @file{ffplay} speak the specified text, using @code{flite} and
  5986. the @code{lavfi} device:
  5987. @example
  5988. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  5989. @end example
  5990. @end itemize
  5991. For more information about libflite, check:
  5992. @url{http://www.festvox.org/flite/}
  5993. @section anoisesrc
  5994. Generate a noise audio signal.
  5995. The filter accepts the following options:
  5996. @table @option
  5997. @item sample_rate, r
  5998. Specify the sample rate. Default value is 48000 Hz.
  5999. @item amplitude, a
  6000. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  6001. is 1.0.
  6002. @item duration, d
  6003. Specify the duration of the generated audio stream. Not specifying this option
  6004. results in noise with an infinite length.
  6005. @item color, colour, c
  6006. Specify the color of noise. Available noise colors are white, pink, brown,
  6007. blue, violet and velvet. Default color is white.
  6008. @item seed, s
  6009. Specify a value used to seed the PRNG.
  6010. @item nb_samples, n
  6011. Set the number of samples per each output frame, default is 1024.
  6012. @end table
  6013. @subsection Examples
  6014. @itemize
  6015. @item
  6016. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  6017. @example
  6018. anoisesrc=d=60:c=pink:r=44100:a=0.5
  6019. @end example
  6020. @end itemize
  6021. @section hilbert
  6022. Generate odd-tap Hilbert transform FIR coefficients.
  6023. The resulting stream can be used with @ref{afir} filter for phase-shifting
  6024. the signal by 90 degrees.
  6025. This is used in many matrix coding schemes and for analytic signal generation.
  6026. The process is often written as a multiplication by i (or j), the imaginary unit.
  6027. The filter accepts the following options:
  6028. @table @option
  6029. @item sample_rate, s
  6030. Set sample rate, default is 44100.
  6031. @item taps, t
  6032. Set length of FIR filter, default is 22051.
  6033. @item nb_samples, n
  6034. Set number of samples per each frame.
  6035. @item win_func, w
  6036. Set window function to be used when generating FIR coefficients.
  6037. @end table
  6038. @section sinc
  6039. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  6040. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  6041. The filter accepts the following options:
  6042. @table @option
  6043. @item sample_rate, r
  6044. Set sample rate, default is 44100.
  6045. @item nb_samples, n
  6046. Set number of samples per each frame. Default is 1024.
  6047. @item hp
  6048. Set high-pass frequency. Default is 0.
  6049. @item lp
  6050. Set low-pass frequency. Default is 0.
  6051. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  6052. is higher than 0 then filter will create band-pass filter coefficients,
  6053. otherwise band-reject filter coefficients.
  6054. @item phase
  6055. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  6056. @item beta
  6057. Set Kaiser window beta.
  6058. @item att
  6059. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  6060. @item round
  6061. Enable rounding, by default is disabled.
  6062. @item hptaps
  6063. Set number of taps for high-pass filter.
  6064. @item lptaps
  6065. Set number of taps for low-pass filter.
  6066. @end table
  6067. @section sine
  6068. Generate an audio signal made of a sine wave with amplitude 1/8.
  6069. The audio signal is bit-exact.
  6070. The filter accepts the following options:
  6071. @table @option
  6072. @item frequency, f
  6073. Set the carrier frequency. Default is 440 Hz.
  6074. @item beep_factor, b
  6075. Enable a periodic beep every second with frequency @var{beep_factor} times
  6076. the carrier frequency. Default is 0, meaning the beep is disabled.
  6077. @item sample_rate, r
  6078. Specify the sample rate, default is 44100.
  6079. @item duration, d
  6080. Specify the duration of the generated audio stream.
  6081. @item samples_per_frame
  6082. Set the number of samples per output frame.
  6083. The expression can contain the following constants:
  6084. @table @option
  6085. @item n
  6086. The (sequential) number of the output audio frame, starting from 0.
  6087. @item pts
  6088. The PTS (Presentation TimeStamp) of the output audio frame,
  6089. expressed in @var{TB} units.
  6090. @item t
  6091. The PTS of the output audio frame, expressed in seconds.
  6092. @item TB
  6093. The timebase of the output audio frames.
  6094. @end table
  6095. Default is @code{1024}.
  6096. @end table
  6097. @subsection Examples
  6098. @itemize
  6099. @item
  6100. Generate a simple 440 Hz sine wave:
  6101. @example
  6102. sine
  6103. @end example
  6104. @item
  6105. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  6106. @example
  6107. sine=220:4:d=5
  6108. sine=f=220:b=4:d=5
  6109. sine=frequency=220:beep_factor=4:duration=5
  6110. @end example
  6111. @item
  6112. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  6113. pattern:
  6114. @example
  6115. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  6116. @end example
  6117. @end itemize
  6118. @c man end AUDIO SOURCES
  6119. @chapter Audio Sinks
  6120. @c man begin AUDIO SINKS
  6121. Below is a description of the currently available audio sinks.
  6122. @section abuffersink
  6123. Buffer audio frames, and make them available to the end of filter chain.
  6124. This sink is mainly intended for programmatic use, in particular
  6125. through the interface defined in @file{libavfilter/buffersink.h}
  6126. or the options system.
  6127. It accepts a pointer to an AVABufferSinkContext structure, which
  6128. defines the incoming buffers' formats, to be passed as the opaque
  6129. parameter to @code{avfilter_init_filter} for initialization.
  6130. @section anullsink
  6131. Null audio sink; do absolutely nothing with the input audio. It is
  6132. mainly useful as a template and for use in analysis / debugging
  6133. tools.
  6134. @c man end AUDIO SINKS
  6135. @chapter Video Filters
  6136. @c man begin VIDEO FILTERS
  6137. When you configure your FFmpeg build, you can disable any of the
  6138. existing filters using @code{--disable-filters}.
  6139. The configure output will show the video filters included in your
  6140. build.
  6141. Below is a description of the currently available video filters.
  6142. @section addroi
  6143. Mark a region of interest in a video frame.
  6144. The frame data is passed through unchanged, but metadata is attached
  6145. to the frame indicating regions of interest which can affect the
  6146. behaviour of later encoding. Multiple regions can be marked by
  6147. applying the filter multiple times.
  6148. @table @option
  6149. @item x
  6150. Region distance in pixels from the left edge of the frame.
  6151. @item y
  6152. Region distance in pixels from the top edge of the frame.
  6153. @item w
  6154. Region width in pixels.
  6155. @item h
  6156. Region height in pixels.
  6157. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  6158. and may contain the following variables:
  6159. @table @option
  6160. @item iw
  6161. Width of the input frame.
  6162. @item ih
  6163. Height of the input frame.
  6164. @end table
  6165. @item qoffset
  6166. Quantisation offset to apply within the region.
  6167. This must be a real value in the range -1 to +1. A value of zero
  6168. indicates no quality change. A negative value asks for better quality
  6169. (less quantisation), while a positive value asks for worse quality
  6170. (greater quantisation).
  6171. The range is calibrated so that the extreme values indicate the
  6172. largest possible offset - if the rest of the frame is encoded with the
  6173. worst possible quality, an offset of -1 indicates that this region
  6174. should be encoded with the best possible quality anyway. Intermediate
  6175. values are then interpolated in some codec-dependent way.
  6176. For example, in 10-bit H.264 the quantisation parameter varies between
  6177. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  6178. this region should be encoded with a QP around one-tenth of the full
  6179. range better than the rest of the frame. So, if most of the frame
  6180. were to be encoded with a QP of around 30, this region would get a QP
  6181. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  6182. An extreme value of -1 would indicate that this region should be
  6183. encoded with the best possible quality regardless of the treatment of
  6184. the rest of the frame - that is, should be encoded at a QP of -12.
  6185. @item clear
  6186. If set to true, remove any existing regions of interest marked on the
  6187. frame before adding the new one.
  6188. @end table
  6189. @subsection Examples
  6190. @itemize
  6191. @item
  6192. Mark the centre quarter of the frame as interesting.
  6193. @example
  6194. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  6195. @end example
  6196. @item
  6197. Mark the 100-pixel-wide region on the left edge of the frame as very
  6198. uninteresting (to be encoded at much lower quality than the rest of
  6199. the frame).
  6200. @example
  6201. addroi=0:0:100:ih:+1/5
  6202. @end example
  6203. @end itemize
  6204. @section alphaextract
  6205. Extract the alpha component from the input as a grayscale video. This
  6206. is especially useful with the @var{alphamerge} filter.
  6207. @section alphamerge
  6208. Add or replace the alpha component of the primary input with the
  6209. grayscale value of a second input. This is intended for use with
  6210. @var{alphaextract} to allow the transmission or storage of frame
  6211. sequences that have alpha in a format that doesn't support an alpha
  6212. channel.
  6213. For example, to reconstruct full frames from a normal YUV-encoded video
  6214. and a separate video created with @var{alphaextract}, you might use:
  6215. @example
  6216. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  6217. @end example
  6218. @section amplify
  6219. Amplify differences between current pixel and pixels of adjacent frames in
  6220. same pixel location.
  6221. This filter accepts the following options:
  6222. @table @option
  6223. @item radius
  6224. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  6225. For example radius of 3 will instruct filter to calculate average of 7 frames.
  6226. @item factor
  6227. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  6228. @item threshold
  6229. Set threshold for difference amplification. Any difference greater or equal to
  6230. this value will not alter source pixel. Default is 10.
  6231. Allowed range is from 0 to 65535.
  6232. @item tolerance
  6233. Set tolerance for difference amplification. Any difference lower to
  6234. this value will not alter source pixel. Default is 0.
  6235. Allowed range is from 0 to 65535.
  6236. @item low
  6237. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  6238. This option controls maximum possible value that will decrease source pixel value.
  6239. @item high
  6240. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  6241. This option controls maximum possible value that will increase source pixel value.
  6242. @item planes
  6243. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  6244. @end table
  6245. @subsection Commands
  6246. This filter supports the following @ref{commands} that corresponds to option of same name:
  6247. @table @option
  6248. @item factor
  6249. @item threshold
  6250. @item tolerance
  6251. @item low
  6252. @item high
  6253. @item planes
  6254. @end table
  6255. @section ass
  6256. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  6257. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  6258. Substation Alpha) subtitles files.
  6259. This filter accepts the following option in addition to the common options from
  6260. the @ref{subtitles} filter:
  6261. @table @option
  6262. @item shaping
  6263. Set the shaping engine
  6264. Available values are:
  6265. @table @samp
  6266. @item auto
  6267. The default libass shaping engine, which is the best available.
  6268. @item simple
  6269. Fast, font-agnostic shaper that can do only substitutions
  6270. @item complex
  6271. Slower shaper using OpenType for substitutions and positioning
  6272. @end table
  6273. The default is @code{auto}.
  6274. @end table
  6275. @section atadenoise
  6276. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  6277. The filter accepts the following options:
  6278. @table @option
  6279. @item 0a
  6280. Set threshold A for 1st plane. Default is 0.02.
  6281. Valid range is 0 to 0.3.
  6282. @item 0b
  6283. Set threshold B for 1st plane. Default is 0.04.
  6284. Valid range is 0 to 5.
  6285. @item 1a
  6286. Set threshold A for 2nd plane. Default is 0.02.
  6287. Valid range is 0 to 0.3.
  6288. @item 1b
  6289. Set threshold B for 2nd plane. Default is 0.04.
  6290. Valid range is 0 to 5.
  6291. @item 2a
  6292. Set threshold A for 3rd plane. Default is 0.02.
  6293. Valid range is 0 to 0.3.
  6294. @item 2b
  6295. Set threshold B for 3rd plane. Default is 0.04.
  6296. Valid range is 0 to 5.
  6297. Threshold A is designed to react on abrupt changes in the input signal and
  6298. threshold B is designed to react on continuous changes in the input signal.
  6299. @item s
  6300. Set number of frames filter will use for averaging. Default is 9. Must be odd
  6301. number in range [5, 129].
  6302. @item p
  6303. Set what planes of frame filter will use for averaging. Default is all.
  6304. @item a
  6305. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  6306. Alternatively can be set to @code{s} serial.
  6307. Parallel can be faster then serial, while other way around is never true.
  6308. Parallel will abort early on first change being greater then thresholds, while serial
  6309. will continue processing other side of frames if they are equal or below thresholds.
  6310. @item 0s
  6311. @item 1s
  6312. @item 2s
  6313. Set sigma for 1st plane, 2nd plane or 3rd plane. Default is 32767.
  6314. Valid range is from 0 to 32767.
  6315. This options controls weight for each pixel in radius defined by size.
  6316. Default value means every pixel have same weight.
  6317. Setting this option to 0 effectively disables filtering.
  6318. @end table
  6319. @subsection Commands
  6320. This filter supports same @ref{commands} as options except option @code{s}.
  6321. The command accepts the same syntax of the corresponding option.
  6322. @section avgblur
  6323. Apply average blur filter.
  6324. The filter accepts the following options:
  6325. @table @option
  6326. @item sizeX
  6327. Set horizontal radius size.
  6328. @item planes
  6329. Set which planes to filter. By default all planes are filtered.
  6330. @item sizeY
  6331. Set vertical radius size, if zero it will be same as @code{sizeX}.
  6332. Default is @code{0}.
  6333. @end table
  6334. @subsection Commands
  6335. This filter supports same commands as options.
  6336. The command accepts the same syntax of the corresponding option.
  6337. If the specified expression is not valid, it is kept at its current
  6338. value.
  6339. @section backgroundkey
  6340. Turns a static background into transparency.
  6341. The filter accepts the following option:
  6342. @table @option
  6343. @item threshold
  6344. Threshold for scene change detection.
  6345. @item similarity
  6346. Similarity percentage with the background.
  6347. @item blend
  6348. Set the blend amount for pixels that are not similar.
  6349. @end table
  6350. @subsection Commands
  6351. This filter supports the all above options as @ref{commands}.
  6352. @section bbox
  6353. Compute the bounding box for the non-black pixels in the input frame
  6354. luminance plane.
  6355. This filter computes the bounding box containing all the pixels with a
  6356. luminance value greater than the minimum allowed value.
  6357. The parameters describing the bounding box are printed on the filter
  6358. log.
  6359. The filter accepts the following option:
  6360. @table @option
  6361. @item min_val
  6362. Set the minimal luminance value. Default is @code{16}.
  6363. @end table
  6364. @subsection Commands
  6365. This filter supports the all above options as @ref{commands}.
  6366. @section bilateral
  6367. Apply bilateral filter, spatial smoothing while preserving edges.
  6368. The filter accepts the following options:
  6369. @table @option
  6370. @item sigmaS
  6371. Set sigma of gaussian function to calculate spatial weight.
  6372. Allowed range is 0 to 512. Default is 0.1.
  6373. @item sigmaR
  6374. Set sigma of gaussian function to calculate range weight.
  6375. Allowed range is 0 to 1. Default is 0.1.
  6376. @item planes
  6377. Set planes to filter. Default is first only.
  6378. @end table
  6379. @subsection Commands
  6380. This filter supports the all above options as @ref{commands}.
  6381. @section bilateral_cuda
  6382. CUDA accelerated bilateral filter, an edge preserving filter.
  6383. This filter is mathematically accurate thanks to the use of GPU acceleration.
  6384. For best output quality, use one to one chroma subsampling, i.e. yuv444p format.
  6385. The filter accepts the following options:
  6386. @table @option
  6387. @item sigmaS
  6388. Set sigma of gaussian function to calculate spatial weight, also called sigma space.
  6389. Allowed range is 0.1 to 512. Default is 0.1.
  6390. @item sigmaR
  6391. Set sigma of gaussian function to calculate color range weight, also called sigma color.
  6392. Allowed range is 0.1 to 512. Default is 0.1.
  6393. @item window_size
  6394. Set window size of the bilateral function to determine the number of neighbours to loop on.
  6395. If the number entered is even, one will be added automatically.
  6396. Allowed range is 1 to 255. Default is 1.
  6397. @end table
  6398. @subsection Examples
  6399. @itemize
  6400. @item
  6401. Apply the bilateral filter on a video.
  6402. @example
  6403. ./ffmpeg -v verbose \
  6404. -hwaccel cuda -hwaccel_output_format cuda -i input.mp4 \
  6405. -init_hw_device cuda \
  6406. -filter_complex \
  6407. " \
  6408. [0:v]scale_cuda=format=yuv444p[scaled_video];
  6409. [scaled_video]bilateral_cuda=window_size=9:sigmaS=3.0:sigmaR=50.0" \
  6410. -an -sn -c:v h264_nvenc -cq 20 out.mp4
  6411. @end example
  6412. @end itemize
  6413. @section bitplanenoise
  6414. Show and measure bit plane noise.
  6415. The filter accepts the following options:
  6416. @table @option
  6417. @item bitplane
  6418. Set which plane to analyze. Default is @code{1}.
  6419. @item filter
  6420. Filter out noisy pixels from @code{bitplane} set above.
  6421. Default is disabled.
  6422. @end table
  6423. @section blackdetect
  6424. Detect video intervals that are (almost) completely black. Can be
  6425. useful to detect chapter transitions, commercials, or invalid
  6426. recordings.
  6427. The filter outputs its detection analysis to both the log as well as
  6428. frame metadata. If a black segment of at least the specified minimum
  6429. duration is found, a line with the start and end timestamps as well
  6430. as duration is printed to the log with level @code{info}. In addition,
  6431. a log line with level @code{debug} is printed per frame showing the
  6432. black amount detected for that frame.
  6433. The filter also attaches metadata to the first frame of a black
  6434. segment with key @code{lavfi.black_start} and to the first frame
  6435. after the black segment ends with key @code{lavfi.black_end}. The
  6436. value is the frame's timestamp. This metadata is added regardless
  6437. of the minimum duration specified.
  6438. The filter accepts the following options:
  6439. @table @option
  6440. @item black_min_duration, d
  6441. Set the minimum detected black duration expressed in seconds. It must
  6442. be a non-negative floating point number.
  6443. Default value is 2.0.
  6444. @item picture_black_ratio_th, pic_th
  6445. Set the threshold for considering a picture "black".
  6446. Express the minimum value for the ratio:
  6447. @example
  6448. @var{nb_black_pixels} / @var{nb_pixels}
  6449. @end example
  6450. for which a picture is considered black.
  6451. Default value is 0.98.
  6452. @item pixel_black_th, pix_th
  6453. Set the threshold for considering a pixel "black".
  6454. The threshold expresses the maximum pixel luminance value for which a
  6455. pixel is considered "black". The provided value is scaled according to
  6456. the following equation:
  6457. @example
  6458. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  6459. @end example
  6460. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  6461. the input video format, the range is [0-255] for YUV full-range
  6462. formats and [16-235] for YUV non full-range formats.
  6463. Default value is 0.10.
  6464. @end table
  6465. The following example sets the maximum pixel threshold to the minimum
  6466. value, and detects only black intervals of 2 or more seconds:
  6467. @example
  6468. blackdetect=d=2:pix_th=0.00
  6469. @end example
  6470. @section blackframe
  6471. Detect frames that are (almost) completely black. Can be useful to
  6472. detect chapter transitions or commercials. Output lines consist of
  6473. the frame number of the detected frame, the percentage of blackness,
  6474. the position in the file if known or -1 and the timestamp in seconds.
  6475. In order to display the output lines, you need to set the loglevel at
  6476. least to the AV_LOG_INFO value.
  6477. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  6478. The value represents the percentage of pixels in the picture that
  6479. are below the threshold value.
  6480. It accepts the following parameters:
  6481. @table @option
  6482. @item amount
  6483. The percentage of the pixels that have to be below the threshold; it defaults to
  6484. @code{98}.
  6485. @item threshold, thresh
  6486. The threshold below which a pixel value is considered black; it defaults to
  6487. @code{32}.
  6488. @end table
  6489. @anchor{blend}
  6490. @section blend
  6491. Blend two video frames into each other.
  6492. The @code{blend} filter takes two input streams and outputs one
  6493. stream, the first input is the "top" layer and second input is
  6494. "bottom" layer. By default, the output terminates when the longest input terminates.
  6495. The @code{tblend} (time blend) filter takes two consecutive frames
  6496. from one single stream, and outputs the result obtained by blending
  6497. the new frame on top of the old frame.
  6498. A description of the accepted options follows.
  6499. @table @option
  6500. @item c0_mode
  6501. @item c1_mode
  6502. @item c2_mode
  6503. @item c3_mode
  6504. @item all_mode
  6505. Set blend mode for specific pixel component or all pixel components in case
  6506. of @var{all_mode}. Default value is @code{normal}.
  6507. Available values for component modes are:
  6508. @table @samp
  6509. @item addition
  6510. @item and
  6511. @item average
  6512. @item bleach
  6513. @item burn
  6514. @item darken
  6515. @item difference
  6516. @item divide
  6517. @item dodge
  6518. @item exclusion
  6519. @item extremity
  6520. @item freeze
  6521. @item geometric
  6522. @item glow
  6523. @item grainextract
  6524. @item grainmerge
  6525. @item hardlight
  6526. @item hardmix
  6527. @item hardoverlay
  6528. @item harmonic
  6529. @item heat
  6530. @item interpolate
  6531. @item lighten
  6532. @item linearlight
  6533. @item multiply
  6534. @item multiply128
  6535. @item negation
  6536. @item normal
  6537. @item or
  6538. @item overlay
  6539. @item phoenix
  6540. @item pinlight
  6541. @item reflect
  6542. @item screen
  6543. @item softdifference
  6544. @item softlight
  6545. @item stain
  6546. @item subtract
  6547. @item vividlight
  6548. @item xor
  6549. @end table
  6550. @item c0_opacity
  6551. @item c1_opacity
  6552. @item c2_opacity
  6553. @item c3_opacity
  6554. @item all_opacity
  6555. Set blend opacity for specific pixel component or all pixel components in case
  6556. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  6557. @item c0_expr
  6558. @item c1_expr
  6559. @item c2_expr
  6560. @item c3_expr
  6561. @item all_expr
  6562. Set blend expression for specific pixel component or all pixel components in case
  6563. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  6564. The expressions can use the following variables:
  6565. @table @option
  6566. @item N
  6567. The sequential number of the filtered frame, starting from @code{0}.
  6568. @item X
  6569. @item Y
  6570. the coordinates of the current sample
  6571. @item W
  6572. @item H
  6573. the width and height of currently filtered plane
  6574. @item SW
  6575. @item SH
  6576. Width and height scale for the plane being filtered. It is the
  6577. ratio between the dimensions of the current plane to the luma plane,
  6578. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  6579. the luma plane and @code{0.5,0.5} for the chroma planes.
  6580. @item T
  6581. Time of the current frame, expressed in seconds.
  6582. @item TOP, A
  6583. Value of pixel component at current location for first video frame (top layer).
  6584. @item BOTTOM, B
  6585. Value of pixel component at current location for second video frame (bottom layer).
  6586. @end table
  6587. @end table
  6588. The @code{blend} filter also supports the @ref{framesync} options.
  6589. @subsection Examples
  6590. @itemize
  6591. @item
  6592. Apply transition from bottom layer to top layer in first 10 seconds:
  6593. @example
  6594. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  6595. @end example
  6596. @item
  6597. Apply linear horizontal transition from top layer to bottom layer:
  6598. @example
  6599. blend=all_expr='A*(X/W)+B*(1-X/W)'
  6600. @end example
  6601. @item
  6602. Apply 1x1 checkerboard effect:
  6603. @example
  6604. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  6605. @end example
  6606. @item
  6607. Apply uncover left effect:
  6608. @example
  6609. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  6610. @end example
  6611. @item
  6612. Apply uncover down effect:
  6613. @example
  6614. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  6615. @end example
  6616. @item
  6617. Apply uncover up-left effect:
  6618. @example
  6619. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  6620. @end example
  6621. @item
  6622. Split diagonally video and shows top and bottom layer on each side:
  6623. @example
  6624. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  6625. @end example
  6626. @item
  6627. Display differences between the current and the previous frame:
  6628. @example
  6629. tblend=all_mode=grainextract
  6630. @end example
  6631. @end itemize
  6632. @subsection Commands
  6633. This filter supports same @ref{commands} as options.
  6634. @anchor{blockdetect}
  6635. @section blockdetect
  6636. Determines blockiness of frames without altering the input frames.
  6637. Based on Remco Muijs and Ihor Kirenko: "A no-reference blocking artifact measure for adaptive video processing." 2005 13th European signal processing conference.
  6638. The filter accepts the following options:
  6639. @table @option
  6640. @item period_min
  6641. @item period_max
  6642. Set minimum and maximum values for determining pixel grids (periods).
  6643. Default values are [3,24].
  6644. @item planes
  6645. Set planes to filter. Default is first only.
  6646. @end table
  6647. @subsection Examples
  6648. @itemize
  6649. @item
  6650. Determine blockiness for the first plane and search for periods within [8,32]:
  6651. @example
  6652. blockdetect=period_min=8:period_max=32:planes=1
  6653. @end example
  6654. @end itemize
  6655. @anchor{blurdetect}
  6656. @section blurdetect
  6657. Determines blurriness of frames without altering the input frames.
  6658. Based on Marziliano, Pina, et al. "A no-reference perceptual blur metric."
  6659. Allows for a block-based abbreviation.
  6660. The filter accepts the following options:
  6661. @table @option
  6662. @item low
  6663. @item high
  6664. Set low and high threshold values used by the Canny thresholding
  6665. algorithm.
  6666. The high threshold selects the "strong" edge pixels, which are then
  6667. connected through 8-connectivity with the "weak" edge pixels selected
  6668. by the low threshold.
  6669. @var{low} and @var{high} threshold values must be chosen in the range
  6670. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6671. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6672. is @code{50/255}.
  6673. @item radius
  6674. Define the radius to search around an edge pixel for local maxima.
  6675. @item block_pct
  6676. Determine blurriness only for the most significant blocks, given in percentage.
  6677. @item block_width
  6678. Determine blurriness for blocks of width @var{block_width}. If set to any value smaller 1, no blocks are used and the whole image is processed as one no matter of @var{block_height}.
  6679. @item block_height
  6680. Determine blurriness for blocks of height @var{block_height}. If set to any value smaller 1, no blocks are used and the whole image is processed as one no matter of @var{block_width}.
  6681. @item planes
  6682. Set planes to filter. Default is first only.
  6683. @end table
  6684. @subsection Examples
  6685. @itemize
  6686. @item
  6687. Determine blur for 80% of most significant 32x32 blocks:
  6688. @example
  6689. blurdetect=block_width=32:block_height=32:block_pct=80
  6690. @end example
  6691. @end itemize
  6692. @section bm3d
  6693. Denoise frames using Block-Matching 3D algorithm.
  6694. The filter accepts the following options.
  6695. @table @option
  6696. @item sigma
  6697. Set denoising strength. Default value is 1.
  6698. Allowed range is from 0 to 999.9.
  6699. The denoising algorithm is very sensitive to sigma, so adjust it
  6700. according to the source.
  6701. @item block
  6702. Set local patch size. This sets dimensions in 2D.
  6703. @item bstep
  6704. Set sliding step for processing blocks. Default value is 4.
  6705. Allowed range is from 1 to 64.
  6706. Smaller values allows processing more reference blocks and is slower.
  6707. @item group
  6708. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  6709. When set to 1, no block matching is done. Larger values allows more blocks
  6710. in single group.
  6711. Allowed range is from 1 to 256.
  6712. @item range
  6713. Set radius for search block matching. Default is 9.
  6714. Allowed range is from 1 to INT32_MAX.
  6715. @item mstep
  6716. Set step between two search locations for block matching. Default is 1.
  6717. Allowed range is from 1 to 64. Smaller is slower.
  6718. @item thmse
  6719. Set threshold of mean square error for block matching. Valid range is 0 to
  6720. INT32_MAX.
  6721. @item hdthr
  6722. Set thresholding parameter for hard thresholding in 3D transformed domain.
  6723. Larger values results in stronger hard-thresholding filtering in frequency
  6724. domain.
  6725. @item estim
  6726. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  6727. Default is @code{basic}.
  6728. @item ref
  6729. If enabled, filter will use 2nd stream for block matching.
  6730. Default is disabled for @code{basic} value of @var{estim} option,
  6731. and always enabled if value of @var{estim} is @code{final}.
  6732. @item planes
  6733. Set planes to filter. Default is all available except alpha.
  6734. @end table
  6735. @subsection Examples
  6736. @itemize
  6737. @item
  6738. Basic filtering with bm3d:
  6739. @example
  6740. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  6741. @end example
  6742. @item
  6743. Same as above, but filtering only luma:
  6744. @example
  6745. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  6746. @end example
  6747. @item
  6748. Same as above, but with both estimation modes:
  6749. @example
  6750. 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
  6751. @end example
  6752. @item
  6753. Same as above, but prefilter with @ref{nlmeans} filter instead:
  6754. @example
  6755. 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
  6756. @end example
  6757. @end itemize
  6758. @section boxblur
  6759. Apply a boxblur algorithm to the input video.
  6760. It accepts the following parameters:
  6761. @table @option
  6762. @item luma_radius, lr
  6763. @item luma_power, lp
  6764. @item chroma_radius, cr
  6765. @item chroma_power, cp
  6766. @item alpha_radius, ar
  6767. @item alpha_power, ap
  6768. @end table
  6769. A description of the accepted options follows.
  6770. @table @option
  6771. @item luma_radius, lr
  6772. @item chroma_radius, cr
  6773. @item alpha_radius, ar
  6774. Set an expression for the box radius in pixels used for blurring the
  6775. corresponding input plane.
  6776. The radius value must be a non-negative number, and must not be
  6777. greater than the value of the expression @code{min(w,h)/2} for the
  6778. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  6779. planes.
  6780. Default value for @option{luma_radius} is "2". If not specified,
  6781. @option{chroma_radius} and @option{alpha_radius} default to the
  6782. corresponding value set for @option{luma_radius}.
  6783. The expressions can contain the following constants:
  6784. @table @option
  6785. @item w
  6786. @item h
  6787. The input width and height in pixels.
  6788. @item cw
  6789. @item ch
  6790. The input chroma image width and height in pixels.
  6791. @item hsub
  6792. @item vsub
  6793. The horizontal and vertical chroma subsample values. For example, for the
  6794. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  6795. @end table
  6796. @item luma_power, lp
  6797. @item chroma_power, cp
  6798. @item alpha_power, ap
  6799. Specify how many times the boxblur filter is applied to the
  6800. corresponding plane.
  6801. Default value for @option{luma_power} is 2. If not specified,
  6802. @option{chroma_power} and @option{alpha_power} default to the
  6803. corresponding value set for @option{luma_power}.
  6804. A value of 0 will disable the effect.
  6805. @end table
  6806. @subsection Examples
  6807. @itemize
  6808. @item
  6809. Apply a boxblur filter with the luma, chroma, and alpha radii
  6810. set to 2:
  6811. @example
  6812. boxblur=luma_radius=2:luma_power=1
  6813. boxblur=2:1
  6814. @end example
  6815. @item
  6816. Set the luma radius to 2, and alpha and chroma radius to 0:
  6817. @example
  6818. boxblur=2:1:cr=0:ar=0
  6819. @end example
  6820. @item
  6821. Set the luma and chroma radii to a fraction of the video dimension:
  6822. @example
  6823. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  6824. @end example
  6825. @end itemize
  6826. @section bwdif
  6827. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  6828. Deinterlacing Filter").
  6829. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  6830. interpolation algorithms.
  6831. It accepts the following parameters:
  6832. @table @option
  6833. @item mode
  6834. The interlacing mode to adopt. It accepts one of the following values:
  6835. @table @option
  6836. @item 0, send_frame
  6837. Output one frame for each frame.
  6838. @item 1, send_field
  6839. Output one frame for each field.
  6840. @end table
  6841. The default value is @code{send_field}.
  6842. @item parity
  6843. The picture field parity assumed for the input interlaced video. It accepts one
  6844. of the following values:
  6845. @table @option
  6846. @item 0, tff
  6847. Assume the top field is first.
  6848. @item 1, bff
  6849. Assume the bottom field is first.
  6850. @item -1, auto
  6851. Enable automatic detection of field parity.
  6852. @end table
  6853. The default value is @code{auto}.
  6854. If the interlacing is unknown or the decoder does not export this information,
  6855. top field first will be assumed.
  6856. @item deint
  6857. Specify which frames to deinterlace. Accepts one of the following
  6858. values:
  6859. @table @option
  6860. @item 0, all
  6861. Deinterlace all frames.
  6862. @item 1, interlaced
  6863. Only deinterlace frames marked as interlaced.
  6864. @end table
  6865. The default value is @code{all}.
  6866. @end table
  6867. @section cas
  6868. Apply Contrast Adaptive Sharpen filter to video stream.
  6869. The filter accepts the following options:
  6870. @table @option
  6871. @item strength
  6872. Set the sharpening strength. Default value is 0.
  6873. @item planes
  6874. Set planes to filter. Default value is to filter all
  6875. planes except alpha plane.
  6876. @end table
  6877. @subsection Commands
  6878. This filter supports same @ref{commands} as options.
  6879. @section chromahold
  6880. Remove all color information for all colors except for certain one.
  6881. The filter accepts the following options:
  6882. @table @option
  6883. @item color
  6884. The color which will not be replaced with neutral chroma.
  6885. @item similarity
  6886. Similarity percentage with the above color.
  6887. 0.01 matches only the exact key color, while 1.0 matches everything.
  6888. @item blend
  6889. Blend percentage.
  6890. 0.0 makes pixels either fully gray, or not gray at all.
  6891. Higher values result in more preserved color.
  6892. @item yuv
  6893. Signals that the color passed is already in YUV instead of RGB.
  6894. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  6895. This can be used to pass exact YUV values as hexadecimal numbers.
  6896. @end table
  6897. @subsection Commands
  6898. This filter supports same @ref{commands} as options.
  6899. The command accepts the same syntax of the corresponding option.
  6900. If the specified expression is not valid, it is kept at its current
  6901. value.
  6902. @anchor{chromakey}
  6903. @section chromakey
  6904. YUV colorspace color/chroma keying.
  6905. The filter accepts the following options:
  6906. @table @option
  6907. @item color
  6908. The color which will be replaced with transparency.
  6909. @item similarity
  6910. Similarity percentage with the key color.
  6911. 0.01 matches only the exact key color, while 1.0 matches everything.
  6912. @item blend
  6913. Blend percentage.
  6914. 0.0 makes pixels either fully transparent, or not transparent at all.
  6915. Higher values result in semi-transparent pixels, with a higher transparency
  6916. the more similar the pixels color is to the key color.
  6917. @item yuv
  6918. Signals that the color passed is already in YUV instead of RGB.
  6919. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  6920. This can be used to pass exact YUV values as hexadecimal numbers.
  6921. @end table
  6922. @subsection Commands
  6923. This filter supports same @ref{commands} as options.
  6924. The command accepts the same syntax of the corresponding option.
  6925. If the specified expression is not valid, it is kept at its current
  6926. value.
  6927. @subsection Examples
  6928. @itemize
  6929. @item
  6930. Make every green pixel in the input image transparent:
  6931. @example
  6932. ffmpeg -i input.png -vf chromakey=green out.png
  6933. @end example
  6934. @item
  6935. Overlay a greenscreen-video on top of a static black background.
  6936. @example
  6937. 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
  6938. @end example
  6939. @end itemize
  6940. @section chromakey_cuda
  6941. CUDA accelerated YUV colorspace color/chroma keying.
  6942. This filter works like normal chromakey filter but operates on CUDA frames.
  6943. for more details and parameters see @ref{chromakey}.
  6944. @subsection Examples
  6945. @itemize
  6946. @item
  6947. Make all the green pixels in the input video transparent and use it as an overlay for another video:
  6948. @example
  6949. ./ffmpeg \
  6950. -hwaccel cuda -hwaccel_output_format cuda -i input_green.mp4 \
  6951. -hwaccel cuda -hwaccel_output_format cuda -i base_video.mp4 \
  6952. -init_hw_device cuda \
  6953. -filter_complex \
  6954. " \
  6955. [0:v]chromakey_cuda=0x25302D:0.1:0.12:1[overlay_video]; \
  6956. [1:v]scale_cuda=format=yuv420p[base]; \
  6957. [base][overlay_video]overlay_cuda" \
  6958. -an -sn -c:v h264_nvenc -cq 20 output.mp4
  6959. @end example
  6960. @item
  6961. Process two software sources, explicitly uploading the frames:
  6962. @example
  6963. ./ffmpeg -init_hw_device cuda=cuda -filter_hw_device cuda \
  6964. -f lavfi -i color=size=800x600:color=white,format=yuv420p \
  6965. -f lavfi -i yuvtestsrc=size=200x200,format=yuv420p \
  6966. -filter_complex \
  6967. " \
  6968. [0]hwupload[under]; \
  6969. [1]hwupload,chromakey_cuda=green:0.1:0.12[over]; \
  6970. [under][over]overlay_cuda" \
  6971. -c:v hevc_nvenc -cq 18 -preset slow output.mp4
  6972. @end example
  6973. @end itemize
  6974. @section chromanr
  6975. Reduce chrominance noise.
  6976. The filter accepts the following options:
  6977. @table @option
  6978. @item thres
  6979. Set threshold for averaging chrominance values.
  6980. Sum of absolute difference of Y, U and V pixel components of current
  6981. pixel and neighbour pixels lower than this threshold will be used in
  6982. averaging. Luma component is left unchanged and is copied to output.
  6983. Default value is 30. Allowed range is from 1 to 200.
  6984. @item sizew
  6985. Set horizontal radius of rectangle used for averaging.
  6986. Allowed range is from 1 to 100. Default value is 5.
  6987. @item sizeh
  6988. Set vertical radius of rectangle used for averaging.
  6989. Allowed range is from 1 to 100. Default value is 5.
  6990. @item stepw
  6991. Set horizontal step when averaging. Default value is 1.
  6992. Allowed range is from 1 to 50.
  6993. Mostly useful to speed-up filtering.
  6994. @item steph
  6995. Set vertical step when averaging. Default value is 1.
  6996. Allowed range is from 1 to 50.
  6997. Mostly useful to speed-up filtering.
  6998. @item threy
  6999. Set Y threshold for averaging chrominance values.
  7000. Set finer control for max allowed difference between Y components
  7001. of current pixel and neigbour pixels.
  7002. Default value is 200. Allowed range is from 1 to 200.
  7003. @item threu
  7004. Set U threshold for averaging chrominance values.
  7005. Set finer control for max allowed difference between U components
  7006. of current pixel and neigbour pixels.
  7007. Default value is 200. Allowed range is from 1 to 200.
  7008. @item threv
  7009. Set V threshold for averaging chrominance values.
  7010. Set finer control for max allowed difference between V components
  7011. of current pixel and neigbour pixels.
  7012. Default value is 200. Allowed range is from 1 to 200.
  7013. @item distance
  7014. Set distance type used in calculations.
  7015. @table @samp
  7016. @item manhattan
  7017. Absolute difference.
  7018. @item euclidean
  7019. Difference squared.
  7020. @end table
  7021. Default distance type is manhattan.
  7022. @end table
  7023. @subsection Commands
  7024. This filter supports same @ref{commands} as options.
  7025. The command accepts the same syntax of the corresponding option.
  7026. @section chromashift
  7027. Shift chroma pixels horizontally and/or vertically.
  7028. The filter accepts the following options:
  7029. @table @option
  7030. @item cbh
  7031. Set amount to shift chroma-blue horizontally.
  7032. @item cbv
  7033. Set amount to shift chroma-blue vertically.
  7034. @item crh
  7035. Set amount to shift chroma-red horizontally.
  7036. @item crv
  7037. Set amount to shift chroma-red vertically.
  7038. @item edge
  7039. Set edge mode, can be @var{smear}, default, or @var{warp}.
  7040. @end table
  7041. @subsection Commands
  7042. This filter supports the all above options as @ref{commands}.
  7043. @section ciescope
  7044. Display CIE color diagram with pixels overlaid onto it.
  7045. The filter accepts the following options:
  7046. @table @option
  7047. @item system
  7048. Set color system.
  7049. @table @samp
  7050. @item ntsc, 470m
  7051. @item ebu, 470bg
  7052. @item smpte
  7053. @item 240m
  7054. @item apple
  7055. @item widergb
  7056. @item cie1931
  7057. @item rec709, hdtv
  7058. @item uhdtv, rec2020
  7059. @item dcip3
  7060. @end table
  7061. @item cie
  7062. Set CIE system.
  7063. @table @samp
  7064. @item xyy
  7065. @item ucs
  7066. @item luv
  7067. @end table
  7068. @item gamuts
  7069. Set what gamuts to draw.
  7070. See @code{system} option for available values.
  7071. @item size, s
  7072. Set ciescope size, by default set to 512.
  7073. @item intensity, i
  7074. Set intensity used to map input pixel values to CIE diagram.
  7075. @item contrast
  7076. Set contrast used to draw tongue colors that are out of active color system gamut.
  7077. @item corrgamma
  7078. Correct gamma displayed on scope, by default enabled.
  7079. @item showwhite
  7080. Show white point on CIE diagram, by default disabled.
  7081. @item gamma
  7082. Set input gamma. Used only with XYZ input color space.
  7083. @item fill
  7084. Fill with CIE colors. By default is enabled.
  7085. @end table
  7086. @section codecview
  7087. Visualize information exported by some codecs.
  7088. Some codecs can export information through frames using side-data or other
  7089. means. For example, some MPEG based codecs export motion vectors through the
  7090. @var{export_mvs} flag in the codec @option{flags2} option.
  7091. The filter accepts the following option:
  7092. @table @option
  7093. @item block
  7094. Display block partition structure using the luma plane.
  7095. @item mv
  7096. Set motion vectors to visualize.
  7097. Available flags for @var{mv} are:
  7098. @table @samp
  7099. @item pf
  7100. forward predicted MVs of P-frames
  7101. @item bf
  7102. forward predicted MVs of B-frames
  7103. @item bb
  7104. backward predicted MVs of B-frames
  7105. @end table
  7106. @item qp
  7107. Display quantization parameters using the chroma planes.
  7108. @item mv_type, mvt
  7109. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  7110. Available flags for @var{mv_type} are:
  7111. @table @samp
  7112. @item fp
  7113. forward predicted MVs
  7114. @item bp
  7115. backward predicted MVs
  7116. @end table
  7117. @item frame_type, ft
  7118. Set frame type to visualize motion vectors of.
  7119. Available flags for @var{frame_type} are:
  7120. @table @samp
  7121. @item if
  7122. intra-coded frames (I-frames)
  7123. @item pf
  7124. predicted frames (P-frames)
  7125. @item bf
  7126. bi-directionally predicted frames (B-frames)
  7127. @end table
  7128. @end table
  7129. @subsection Examples
  7130. @itemize
  7131. @item
  7132. Visualize forward predicted MVs of all frames using @command{ffplay}:
  7133. @example
  7134. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  7135. @end example
  7136. @item
  7137. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  7138. @example
  7139. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  7140. @end example
  7141. @end itemize
  7142. @section colorbalance
  7143. Modify intensity of primary colors (red, green and blue) of input frames.
  7144. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  7145. regions for the red-cyan, green-magenta or blue-yellow balance.
  7146. A positive adjustment value shifts the balance towards the primary color, a negative
  7147. value towards the complementary color.
  7148. The filter accepts the following options:
  7149. @table @option
  7150. @item rs
  7151. @item gs
  7152. @item bs
  7153. Adjust red, green and blue shadows (darkest pixels).
  7154. @item rm
  7155. @item gm
  7156. @item bm
  7157. Adjust red, green and blue midtones (medium pixels).
  7158. @item rh
  7159. @item gh
  7160. @item bh
  7161. Adjust red, green and blue highlights (brightest pixels).
  7162. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  7163. @item pl
  7164. Preserve lightness when changing color balance. Default is disabled.
  7165. @end table
  7166. @subsection Examples
  7167. @itemize
  7168. @item
  7169. Add red color cast to shadows:
  7170. @example
  7171. colorbalance=rs=.3
  7172. @end example
  7173. @end itemize
  7174. @subsection Commands
  7175. This filter supports the all above options as @ref{commands}.
  7176. @section colorcontrast
  7177. Adjust color contrast between RGB components.
  7178. The filter accepts the following options:
  7179. @table @option
  7180. @item rc
  7181. Set the red-cyan contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  7182. @item gm
  7183. Set the green-magenta contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  7184. @item by
  7185. Set the blue-yellow contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  7186. @item rcw
  7187. @item gmw
  7188. @item byw
  7189. Set the weight of each @code{rc}, @code{gm}, @code{by} option value. Default value is 0.0.
  7190. Allowed range is from 0.0 to 1.0. If all weights are 0.0 filtering is disabled.
  7191. @item pl
  7192. Set the amount of preserving lightness. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  7193. @end table
  7194. @subsection Commands
  7195. This filter supports the all above options as @ref{commands}.
  7196. @section colorcorrect
  7197. Adjust color white balance selectively for blacks and whites.
  7198. This filter operates in YUV colorspace.
  7199. The filter accepts the following options:
  7200. @table @option
  7201. @item rl
  7202. Set the red shadow spot. Allowed range is from -1.0 to 1.0.
  7203. Default value is 0.
  7204. @item bl
  7205. Set the blue shadow spot. Allowed range is from -1.0 to 1.0.
  7206. Default value is 0.
  7207. @item rh
  7208. Set the red highlight spot. Allowed range is from -1.0 to 1.0.
  7209. Default value is 0.
  7210. @item bh
  7211. Set the red highlight spot. Allowed range is from -1.0 to 1.0.
  7212. Default value is 0.
  7213. @item saturation
  7214. Set the amount of saturation. Allowed range is from -3.0 to 3.0.
  7215. Default value is 1.
  7216. @item analyze
  7217. If set to anything other than @code{manual} it will analyze every frame and use derived
  7218. parameters for filtering output frame.
  7219. Possible values are:
  7220. @table @samp
  7221. @item manual
  7222. @item average
  7223. @item minmax
  7224. @item median
  7225. @end table
  7226. Default value is @code{manual}.
  7227. @end table
  7228. @subsection Commands
  7229. This filter supports the all above options as @ref{commands}.
  7230. @section colorchannelmixer
  7231. Adjust video input frames by re-mixing color channels.
  7232. This filter modifies a color channel by adding the values associated to
  7233. the other channels of the same pixels. For example if the value to
  7234. modify is red, the output value will be:
  7235. @example
  7236. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  7237. @end example
  7238. The filter accepts the following options:
  7239. @table @option
  7240. @item rr
  7241. @item rg
  7242. @item rb
  7243. @item ra
  7244. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  7245. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  7246. @item gr
  7247. @item gg
  7248. @item gb
  7249. @item ga
  7250. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  7251. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  7252. @item br
  7253. @item bg
  7254. @item bb
  7255. @item ba
  7256. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  7257. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  7258. @item ar
  7259. @item ag
  7260. @item ab
  7261. @item aa
  7262. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  7263. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  7264. Allowed ranges for options are @code{[-2.0, 2.0]}.
  7265. @item pc
  7266. Set preserve color mode. The accepted values are:
  7267. @table @samp
  7268. @item none
  7269. Disable color preserving, this is default.
  7270. @item lum
  7271. Preserve luminance.
  7272. @item max
  7273. Preserve max value of RGB triplet.
  7274. @item avg
  7275. Preserve average value of RGB triplet.
  7276. @item sum
  7277. Preserve sum value of RGB triplet.
  7278. @item nrm
  7279. Preserve normalized value of RGB triplet.
  7280. @item pwr
  7281. Preserve power value of RGB triplet.
  7282. @end table
  7283. @item pa
  7284. Set the preserve color amount when changing colors. Allowed range is from @code{[0.0, 1.0]}.
  7285. Default is @code{0.0}, thus disabled.
  7286. @end table
  7287. @subsection Examples
  7288. @itemize
  7289. @item
  7290. Convert source to grayscale:
  7291. @example
  7292. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  7293. @end example
  7294. @item
  7295. Simulate sepia tones:
  7296. @example
  7297. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  7298. @end example
  7299. @end itemize
  7300. @subsection Commands
  7301. This filter supports the all above options as @ref{commands}.
  7302. @section colorize
  7303. Overlay a solid color on the video stream.
  7304. The filter accepts the following options:
  7305. @table @option
  7306. @item hue
  7307. Set the color hue. Allowed range is from 0 to 360.
  7308. Default value is 0.
  7309. @item saturation
  7310. Set the color saturation. Allowed range is from 0 to 1.
  7311. Default value is 0.5.
  7312. @item lightness
  7313. Set the color lightness. Allowed range is from 0 to 1.
  7314. Default value is 0.5.
  7315. @item mix
  7316. Set the mix of source lightness. By default is set to 1.0.
  7317. Allowed range is from 0.0 to 1.0.
  7318. @end table
  7319. @subsection Commands
  7320. This filter supports the all above options as @ref{commands}.
  7321. @section colorkey
  7322. RGB colorspace color keying.
  7323. This filter operates on 8-bit RGB format frames by setting the alpha component of each pixel
  7324. which falls within the similarity radius of the key color to 0. The alpha value for pixels outside
  7325. the similarity radius depends on the value of the blend option.
  7326. The filter accepts the following options:
  7327. @table @option
  7328. @item color
  7329. Set the color for which alpha will be set to 0 (full transparency).
  7330. See @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7331. Default is @code{black}.
  7332. @item similarity
  7333. Set the radius from the key color within which other colors also have full transparency.
  7334. The computed distance is related to the unit fractional distance in 3D space between the RGB values
  7335. of the key color and the pixel's color. Range is 0.01 to 1.0. 0.01 matches within a very small radius
  7336. around the exact key color, while 1.0 matches everything.
  7337. Default is @code{0.01}.
  7338. @item blend
  7339. Set how the alpha value for pixels that fall outside the similarity radius is computed.
  7340. 0.0 makes pixels either fully transparent or fully opaque.
  7341. Higher values result in semi-transparent pixels, with greater transparency
  7342. the more similar the pixel color is to the key color.
  7343. Range is 0.0 to 1.0. Default is @code{0.0}.
  7344. @end table
  7345. @subsection Examples
  7346. @itemize
  7347. @item
  7348. Make every green pixel in the input image transparent:
  7349. @example
  7350. ffmpeg -i input.png -vf colorkey=green out.png
  7351. @end example
  7352. @item
  7353. Overlay a greenscreen-video on top of a static background image.
  7354. @example
  7355. 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
  7356. @end example
  7357. @end itemize
  7358. @subsection Commands
  7359. This filter supports same @ref{commands} as options.
  7360. The command accepts the same syntax of the corresponding option.
  7361. If the specified expression is not valid, it is kept at its current
  7362. value.
  7363. @section colorhold
  7364. Remove all color information for all RGB colors except for certain one.
  7365. The filter accepts the following options:
  7366. @table @option
  7367. @item color
  7368. The color which will not be replaced with neutral gray.
  7369. @item similarity
  7370. Similarity percentage with the above color.
  7371. 0.01 matches only the exact key color, while 1.0 matches everything.
  7372. @item blend
  7373. Blend percentage. 0.0 makes pixels fully gray.
  7374. Higher values result in more preserved color.
  7375. @end table
  7376. @subsection Commands
  7377. This filter supports same @ref{commands} as options.
  7378. The command accepts the same syntax of the corresponding option.
  7379. If the specified expression is not valid, it is kept at its current
  7380. value.
  7381. @section colorlevels
  7382. Adjust video input frames using levels.
  7383. The filter accepts the following options:
  7384. @table @option
  7385. @item rimin
  7386. @item gimin
  7387. @item bimin
  7388. @item aimin
  7389. Adjust red, green, blue and alpha input black point.
  7390. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  7391. @item rimax
  7392. @item gimax
  7393. @item bimax
  7394. @item aimax
  7395. Adjust red, green, blue and alpha input white point.
  7396. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  7397. Input levels are used to lighten highlights (bright tones), darken shadows
  7398. (dark tones), change the balance of bright and dark tones.
  7399. @item romin
  7400. @item gomin
  7401. @item bomin
  7402. @item aomin
  7403. Adjust red, green, blue and alpha output black point.
  7404. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  7405. @item romax
  7406. @item gomax
  7407. @item bomax
  7408. @item aomax
  7409. Adjust red, green, blue and alpha output white point.
  7410. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  7411. Output levels allows manual selection of a constrained output level range.
  7412. @item preserve
  7413. Set preserve color mode. The accepted values are:
  7414. @table @samp
  7415. @item none
  7416. Disable color preserving, this is default.
  7417. @item lum
  7418. Preserve luminance.
  7419. @item max
  7420. Preserve max value of RGB triplet.
  7421. @item avg
  7422. Preserve average value of RGB triplet.
  7423. @item sum
  7424. Preserve sum value of RGB triplet.
  7425. @item nrm
  7426. Preserve normalized value of RGB triplet.
  7427. @item pwr
  7428. Preserve power value of RGB triplet.
  7429. @end table
  7430. @end table
  7431. @subsection Examples
  7432. @itemize
  7433. @item
  7434. Make video output darker:
  7435. @example
  7436. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  7437. @end example
  7438. @item
  7439. Increase contrast:
  7440. @example
  7441. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  7442. @end example
  7443. @item
  7444. Make video output lighter:
  7445. @example
  7446. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  7447. @end example
  7448. @item
  7449. Increase brightness:
  7450. @example
  7451. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  7452. @end example
  7453. @end itemize
  7454. @subsection Commands
  7455. This filter supports the all above options as @ref{commands}.
  7456. @section colormap
  7457. Apply custom color maps to video stream.
  7458. This filter needs three input video streams.
  7459. First stream is video stream that is going to be filtered out.
  7460. Second and third video stream specify color patches for source
  7461. color to target color mapping.
  7462. The filter accepts the following options:
  7463. @table @option
  7464. @item patch_size
  7465. Set the source and target video stream patch size in pixels.
  7466. @item nb_patches
  7467. Set the max number of used patches from source and target video stream.
  7468. Default value is number of patches available in additional video streams.
  7469. Max allowed number of patches is @code{64}.
  7470. @item type
  7471. Set the adjustments used for target colors. Can be @code{relative} or @code{absolute}.
  7472. Defaults is @code{absolute}.
  7473. @item kernel
  7474. Set the kernel used to measure color differences between mapped colors.
  7475. The accepted values are:
  7476. @table @samp
  7477. @item euclidean
  7478. @item weuclidean
  7479. @end table
  7480. Default is @code{euclidean}.
  7481. @end table
  7482. @section colormatrix
  7483. Convert color matrix.
  7484. The filter accepts the following options:
  7485. @table @option
  7486. @item src
  7487. @item dst
  7488. Specify the source and destination color matrix. Both values must be
  7489. specified.
  7490. The accepted values are:
  7491. @table @samp
  7492. @item bt709
  7493. BT.709
  7494. @item fcc
  7495. FCC
  7496. @item bt601
  7497. BT.601
  7498. @item bt470
  7499. BT.470
  7500. @item bt470bg
  7501. BT.470BG
  7502. @item smpte170m
  7503. SMPTE-170M
  7504. @item smpte240m
  7505. SMPTE-240M
  7506. @item bt2020
  7507. BT.2020
  7508. @end table
  7509. @end table
  7510. For example to convert from BT.601 to SMPTE-240M, use the command:
  7511. @example
  7512. colormatrix=bt601:smpte240m
  7513. @end example
  7514. @section colorspace
  7515. Convert colorspace, transfer characteristics or color primaries.
  7516. Input video needs to have an even size.
  7517. The filter accepts the following options:
  7518. @table @option
  7519. @anchor{all}
  7520. @item all
  7521. Specify all color properties at once.
  7522. The accepted values are:
  7523. @table @samp
  7524. @item bt470m
  7525. BT.470M
  7526. @item bt470bg
  7527. BT.470BG
  7528. @item bt601-6-525
  7529. BT.601-6 525
  7530. @item bt601-6-625
  7531. BT.601-6 625
  7532. @item bt709
  7533. BT.709
  7534. @item smpte170m
  7535. SMPTE-170M
  7536. @item smpte240m
  7537. SMPTE-240M
  7538. @item bt2020
  7539. BT.2020
  7540. @end table
  7541. @anchor{space}
  7542. @item space
  7543. Specify output colorspace.
  7544. The accepted values are:
  7545. @table @samp
  7546. @item bt709
  7547. BT.709
  7548. @item fcc
  7549. FCC
  7550. @item bt470bg
  7551. BT.470BG or BT.601-6 625
  7552. @item smpte170m
  7553. SMPTE-170M or BT.601-6 525
  7554. @item smpte240m
  7555. SMPTE-240M
  7556. @item ycgco
  7557. YCgCo
  7558. @item bt2020ncl
  7559. BT.2020 with non-constant luminance
  7560. @end table
  7561. @anchor{trc}
  7562. @item trc
  7563. Specify output transfer characteristics.
  7564. The accepted values are:
  7565. @table @samp
  7566. @item bt709
  7567. BT.709
  7568. @item bt470m
  7569. BT.470M
  7570. @item bt470bg
  7571. BT.470BG
  7572. @item gamma22
  7573. Constant gamma of 2.2
  7574. @item gamma28
  7575. Constant gamma of 2.8
  7576. @item smpte170m
  7577. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  7578. @item smpte240m
  7579. SMPTE-240M
  7580. @item srgb
  7581. SRGB
  7582. @item iec61966-2-1
  7583. iec61966-2-1
  7584. @item iec61966-2-4
  7585. iec61966-2-4
  7586. @item xvycc
  7587. xvycc
  7588. @item bt2020-10
  7589. BT.2020 for 10-bits content
  7590. @item bt2020-12
  7591. BT.2020 for 12-bits content
  7592. @end table
  7593. @anchor{primaries}
  7594. @item primaries
  7595. Specify output color primaries.
  7596. The accepted values are:
  7597. @table @samp
  7598. @item bt709
  7599. BT.709
  7600. @item bt470m
  7601. BT.470M
  7602. @item bt470bg
  7603. BT.470BG or BT.601-6 625
  7604. @item smpte170m
  7605. SMPTE-170M or BT.601-6 525
  7606. @item smpte240m
  7607. SMPTE-240M
  7608. @item film
  7609. film
  7610. @item smpte431
  7611. SMPTE-431
  7612. @item smpte432
  7613. SMPTE-432
  7614. @item bt2020
  7615. BT.2020
  7616. @item jedec-p22
  7617. JEDEC P22 phosphors
  7618. @end table
  7619. @anchor{range}
  7620. @item range
  7621. Specify output color range.
  7622. The accepted values are:
  7623. @table @samp
  7624. @item tv
  7625. TV (restricted) range
  7626. @item mpeg
  7627. MPEG (restricted) range
  7628. @item pc
  7629. PC (full) range
  7630. @item jpeg
  7631. JPEG (full) range
  7632. @end table
  7633. @item format
  7634. Specify output color format.
  7635. The accepted values are:
  7636. @table @samp
  7637. @item yuv420p
  7638. YUV 4:2:0 planar 8-bits
  7639. @item yuv420p10
  7640. YUV 4:2:0 planar 10-bits
  7641. @item yuv420p12
  7642. YUV 4:2:0 planar 12-bits
  7643. @item yuv422p
  7644. YUV 4:2:2 planar 8-bits
  7645. @item yuv422p10
  7646. YUV 4:2:2 planar 10-bits
  7647. @item yuv422p12
  7648. YUV 4:2:2 planar 12-bits
  7649. @item yuv444p
  7650. YUV 4:4:4 planar 8-bits
  7651. @item yuv444p10
  7652. YUV 4:4:4 planar 10-bits
  7653. @item yuv444p12
  7654. YUV 4:4:4 planar 12-bits
  7655. @end table
  7656. @item fast
  7657. Do a fast conversion, which skips gamma/primary correction. This will take
  7658. significantly less CPU, but will be mathematically incorrect. To get output
  7659. compatible with that produced by the colormatrix filter, use fast=1.
  7660. @item dither
  7661. Specify dithering mode.
  7662. The accepted values are:
  7663. @table @samp
  7664. @item none
  7665. No dithering
  7666. @item fsb
  7667. Floyd-Steinberg dithering
  7668. @end table
  7669. @item wpadapt
  7670. Whitepoint adaptation mode.
  7671. The accepted values are:
  7672. @table @samp
  7673. @item bradford
  7674. Bradford whitepoint adaptation
  7675. @item vonkries
  7676. von Kries whitepoint adaptation
  7677. @item identity
  7678. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  7679. @end table
  7680. @item iall
  7681. Override all input properties at once. Same accepted values as @ref{all}.
  7682. @item ispace
  7683. Override input colorspace. Same accepted values as @ref{space}.
  7684. @item iprimaries
  7685. Override input color primaries. Same accepted values as @ref{primaries}.
  7686. @item itrc
  7687. Override input transfer characteristics. Same accepted values as @ref{trc}.
  7688. @item irange
  7689. Override input color range. Same accepted values as @ref{range}.
  7690. @end table
  7691. The filter converts the transfer characteristics, color space and color
  7692. primaries to the specified user values. The output value, if not specified,
  7693. is set to a default value based on the "all" property. If that property is
  7694. also not specified, the filter will log an error. The output color range and
  7695. format default to the same value as the input color range and format. The
  7696. input transfer characteristics, color space, color primaries and color range
  7697. should be set on the input data. If any of these are missing, the filter will
  7698. log an error and no conversion will take place.
  7699. For example to convert the input to SMPTE-240M, use the command:
  7700. @example
  7701. colorspace=smpte240m
  7702. @end example
  7703. @section colorspace_cuda
  7704. CUDA accelerated implementation of the colorspace filter.
  7705. It is by no means feature complete compared to the software colorspace filter,
  7706. and at the current time only supports color range conversion between jpeg/full
  7707. and mpeg/limited range.
  7708. The filter accepts the following options:
  7709. @table @option
  7710. @item range
  7711. Specify output color range.
  7712. The accepted values are:
  7713. @table @samp
  7714. @item tv
  7715. TV (restricted) range
  7716. @item mpeg
  7717. MPEG (restricted) range
  7718. @item pc
  7719. PC (full) range
  7720. @item jpeg
  7721. JPEG (full) range
  7722. @end table
  7723. @end table
  7724. @section colortemperature
  7725. Adjust color temperature in video to simulate variations in ambient color temperature.
  7726. The filter accepts the following options:
  7727. @table @option
  7728. @item temperature
  7729. Set the temperature in Kelvin. Allowed range is from 1000 to 40000.
  7730. Default value is 6500 K.
  7731. @item mix
  7732. Set mixing with filtered output. Allowed range is from 0 to 1.
  7733. Default value is 1.
  7734. @item pl
  7735. Set the amount of preserving lightness. Allowed range is from 0 to 1.
  7736. Default value is 0.
  7737. @end table
  7738. @subsection Commands
  7739. This filter supports same @ref{commands} as options.
  7740. @section convolution
  7741. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  7742. The filter accepts the following options:
  7743. @table @option
  7744. @item 0m
  7745. @item 1m
  7746. @item 2m
  7747. @item 3m
  7748. Set matrix for each plane.
  7749. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  7750. and from 1 to 49 odd number of signed integers in @var{row} mode.
  7751. @item 0rdiv
  7752. @item 1rdiv
  7753. @item 2rdiv
  7754. @item 3rdiv
  7755. Set multiplier for calculated value for each plane.
  7756. If unset or 0, it will be sum of all matrix elements.
  7757. @item 0bias
  7758. @item 1bias
  7759. @item 2bias
  7760. @item 3bias
  7761. Set bias for each plane. This value is added to the result of the multiplication.
  7762. Useful for making the overall image brighter or darker. Default is 0.0.
  7763. @item 0mode
  7764. @item 1mode
  7765. @item 2mode
  7766. @item 3mode
  7767. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  7768. Default is @var{square}.
  7769. @end table
  7770. @subsection Commands
  7771. This filter supports the all above options as @ref{commands}.
  7772. @subsection Examples
  7773. @itemize
  7774. @item
  7775. Apply sharpen:
  7776. @example
  7777. 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"
  7778. @end example
  7779. @item
  7780. Apply blur:
  7781. @example
  7782. 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"
  7783. @end example
  7784. @item
  7785. Apply edge enhance:
  7786. @example
  7787. 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"
  7788. @end example
  7789. @item
  7790. Apply edge detect:
  7791. @example
  7792. 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"
  7793. @end example
  7794. @item
  7795. Apply laplacian edge detector which includes diagonals:
  7796. @example
  7797. 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"
  7798. @end example
  7799. @item
  7800. Apply emboss:
  7801. @example
  7802. 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"
  7803. @end example
  7804. @end itemize
  7805. @section convolve
  7806. Apply 2D convolution of video stream in frequency domain using second stream
  7807. as impulse.
  7808. The filter accepts the following options:
  7809. @table @option
  7810. @item planes
  7811. Set which planes to process.
  7812. @item impulse
  7813. Set which impulse video frames will be processed, can be @var{first}
  7814. or @var{all}. Default is @var{all}.
  7815. @end table
  7816. The @code{convolve} filter also supports the @ref{framesync} options.
  7817. @section copy
  7818. Copy the input video source unchanged to the output. This is mainly useful for
  7819. testing purposes.
  7820. @anchor{coreimage}
  7821. @section coreimage
  7822. Video filtering on GPU using Apple's CoreImage API on OSX.
  7823. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  7824. processed by video hardware. However, software-based OpenGL implementations
  7825. exist which means there is no guarantee for hardware processing. It depends on
  7826. the respective OSX.
  7827. There are many filters and image generators provided by Apple that come with a
  7828. large variety of options. The filter has to be referenced by its name along
  7829. with its options.
  7830. The coreimage filter accepts the following options:
  7831. @table @option
  7832. @item list_filters
  7833. List all available filters and generators along with all their respective
  7834. options as well as possible minimum and maximum values along with the default
  7835. values.
  7836. @example
  7837. list_filters=true
  7838. @end example
  7839. @item filter
  7840. Specify all filters by their respective name and options.
  7841. Use @var{list_filters} to determine all valid filter names and options.
  7842. Numerical options are specified by a float value and are automatically clamped
  7843. to their respective value range. Vector and color options have to be specified
  7844. by a list of space separated float values. Character escaping has to be done.
  7845. A special option name @code{default} is available to use default options for a
  7846. filter.
  7847. It is required to specify either @code{default} or at least one of the filter options.
  7848. All omitted options are used with their default values.
  7849. The syntax of the filter string is as follows:
  7850. @example
  7851. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  7852. @end example
  7853. @item output_rect
  7854. Specify a rectangle where the output of the filter chain is copied into the
  7855. input image. It is given by a list of space separated float values:
  7856. @example
  7857. output_rect=x\ y\ width\ height
  7858. @end example
  7859. If not given, the output rectangle equals the dimensions of the input image.
  7860. The output rectangle is automatically cropped at the borders of the input
  7861. image. Negative values are valid for each component.
  7862. @example
  7863. output_rect=25\ 25\ 100\ 100
  7864. @end example
  7865. @end table
  7866. Several filters can be chained for successive processing without GPU-HOST
  7867. transfers allowing for fast processing of complex filter chains.
  7868. Currently, only filters with zero (generators) or exactly one (filters) input
  7869. image and one output image are supported. Also, transition filters are not yet
  7870. usable as intended.
  7871. Some filters generate output images with additional padding depending on the
  7872. respective filter kernel. The padding is automatically removed to ensure the
  7873. filter output has the same size as the input image.
  7874. For image generators, the size of the output image is determined by the
  7875. previous output image of the filter chain or the input image of the whole
  7876. filterchain, respectively. The generators do not use the pixel information of
  7877. this image to generate their output. However, the generated output is
  7878. blended onto this image, resulting in partial or complete coverage of the
  7879. output image.
  7880. The @ref{coreimagesrc} video source can be used for generating input images
  7881. which are directly fed into the filter chain. By using it, providing input
  7882. images by another video source or an input video is not required.
  7883. @subsection Examples
  7884. @itemize
  7885. @item
  7886. List all filters available:
  7887. @example
  7888. coreimage=list_filters=true
  7889. @end example
  7890. @item
  7891. Use the CIBoxBlur filter with default options to blur an image:
  7892. @example
  7893. coreimage=filter=CIBoxBlur@@default
  7894. @end example
  7895. @item
  7896. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  7897. its center at 100x100 and a radius of 50 pixels:
  7898. @example
  7899. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  7900. @end example
  7901. @item
  7902. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  7903. given as complete and escaped command-line for Apple's standard bash shell:
  7904. @example
  7905. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  7906. @end example
  7907. @end itemize
  7908. @section corr
  7909. Obtain the correlation between two input videos.
  7910. This filter takes two input videos.
  7911. Both input videos must have the same resolution and pixel format for
  7912. this filter to work correctly. Also it assumes that both inputs
  7913. have the same number of frames, which are compared one by one.
  7914. The obtained per component, average, min and max correlation is printed through
  7915. the logging system.
  7916. The filter stores the calculated correlation of each frame in frame metadata.
  7917. This filter also supports the @ref{framesync} options.
  7918. In the below example the input file @file{main.mpg} being processed is compared
  7919. with the reference file @file{ref.mpg}.
  7920. @example
  7921. ffmpeg -i main.mpg -i ref.mpg -lavfi corr -f null -
  7922. @end example
  7923. @section cover_rect
  7924. Cover a rectangular object
  7925. It accepts the following options:
  7926. @table @option
  7927. @item cover
  7928. Filepath of the optional cover image, needs to be in yuv420.
  7929. @item mode
  7930. Set covering mode.
  7931. It accepts the following values:
  7932. @table @samp
  7933. @item cover
  7934. cover it by the supplied image
  7935. @item blur
  7936. cover it by interpolating the surrounding pixels
  7937. @end table
  7938. Default value is @var{blur}.
  7939. @end table
  7940. @subsection Examples
  7941. @itemize
  7942. @item
  7943. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  7944. @example
  7945. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7946. @end example
  7947. @end itemize
  7948. @section crop
  7949. Crop the input video to given dimensions.
  7950. It accepts the following parameters:
  7951. @table @option
  7952. @item w, out_w
  7953. The width of the output video. It defaults to @code{iw}.
  7954. This expression is evaluated only once during the filter
  7955. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  7956. @item h, out_h
  7957. The height of the output video. It defaults to @code{ih}.
  7958. This expression is evaluated only once during the filter
  7959. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  7960. @item x
  7961. The horizontal position, in the input video, of the left edge of the output
  7962. video. It defaults to @code{(in_w-out_w)/2}.
  7963. This expression is evaluated per-frame.
  7964. @item y
  7965. The vertical position, in the input video, of the top edge of the output video.
  7966. It defaults to @code{(in_h-out_h)/2}.
  7967. This expression is evaluated per-frame.
  7968. @item keep_aspect
  7969. If set to 1 will force the output display aspect ratio
  7970. to be the same of the input, by changing the output sample aspect
  7971. ratio. It defaults to 0.
  7972. @item exact
  7973. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  7974. width/height/x/y as specified and will not be rounded to nearest smaller value.
  7975. It defaults to 0.
  7976. @end table
  7977. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  7978. expressions containing the following constants:
  7979. @table @option
  7980. @item x
  7981. @item y
  7982. The computed values for @var{x} and @var{y}. They are evaluated for
  7983. each new frame.
  7984. @item in_w
  7985. @item in_h
  7986. The input width and height.
  7987. @item iw
  7988. @item ih
  7989. These are the same as @var{in_w} and @var{in_h}.
  7990. @item out_w
  7991. @item out_h
  7992. The output (cropped) width and height.
  7993. @item ow
  7994. @item oh
  7995. These are the same as @var{out_w} and @var{out_h}.
  7996. @item a
  7997. same as @var{iw} / @var{ih}
  7998. @item sar
  7999. input sample aspect ratio
  8000. @item dar
  8001. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8002. @item hsub
  8003. @item vsub
  8004. horizontal and vertical chroma subsample values. For example for the
  8005. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8006. @item n
  8007. The number of the input frame, starting from 0.
  8008. @item pos
  8009. the position in the file of the input frame, NAN if unknown
  8010. @item t
  8011. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  8012. @end table
  8013. The expression for @var{out_w} may depend on the value of @var{out_h},
  8014. and the expression for @var{out_h} may depend on @var{out_w}, but they
  8015. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  8016. evaluated after @var{out_w} and @var{out_h}.
  8017. The @var{x} and @var{y} parameters specify the expressions for the
  8018. position of the top-left corner of the output (non-cropped) area. They
  8019. are evaluated for each frame. If the evaluated value is not valid, it
  8020. is approximated to the nearest valid value.
  8021. The expression for @var{x} may depend on @var{y}, and the expression
  8022. for @var{y} may depend on @var{x}.
  8023. @subsection Examples
  8024. @itemize
  8025. @item
  8026. Crop area with size 100x100 at position (12,34).
  8027. @example
  8028. crop=100:100:12:34
  8029. @end example
  8030. Using named options, the example above becomes:
  8031. @example
  8032. crop=w=100:h=100:x=12:y=34
  8033. @end example
  8034. @item
  8035. Crop the central input area with size 100x100:
  8036. @example
  8037. crop=100:100
  8038. @end example
  8039. @item
  8040. Crop the central input area with size 2/3 of the input video:
  8041. @example
  8042. crop=2/3*in_w:2/3*in_h
  8043. @end example
  8044. @item
  8045. Crop the input video central square:
  8046. @example
  8047. crop=out_w=in_h
  8048. crop=in_h
  8049. @end example
  8050. @item
  8051. Delimit the rectangle with the top-left corner placed at position
  8052. 100:100 and the right-bottom corner corresponding to the right-bottom
  8053. corner of the input image.
  8054. @example
  8055. crop=in_w-100:in_h-100:100:100
  8056. @end example
  8057. @item
  8058. Crop 10 pixels from the left and right borders, and 20 pixels from
  8059. the top and bottom borders
  8060. @example
  8061. crop=in_w-2*10:in_h-2*20
  8062. @end example
  8063. @item
  8064. Keep only the bottom right quarter of the input image:
  8065. @example
  8066. crop=in_w/2:in_h/2:in_w/2:in_h/2
  8067. @end example
  8068. @item
  8069. Crop height for getting Greek harmony:
  8070. @example
  8071. crop=in_w:1/PHI*in_w
  8072. @end example
  8073. @item
  8074. Apply trembling effect:
  8075. @example
  8076. 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)
  8077. @end example
  8078. @item
  8079. Apply erratic camera effect depending on timestamp:
  8080. @example
  8081. 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)"
  8082. @end example
  8083. @item
  8084. Set x depending on the value of y:
  8085. @example
  8086. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  8087. @end example
  8088. @end itemize
  8089. @subsection Commands
  8090. This filter supports the following commands:
  8091. @table @option
  8092. @item w, out_w
  8093. @item h, out_h
  8094. @item x
  8095. @item y
  8096. Set width/height of the output video and the horizontal/vertical position
  8097. in the input video.
  8098. The command accepts the same syntax of the corresponding option.
  8099. If the specified expression is not valid, it is kept at its current
  8100. value.
  8101. @end table
  8102. @section cropdetect
  8103. Auto-detect the crop size.
  8104. It calculates the necessary cropping parameters and prints the
  8105. recommended parameters via the logging system. The detected dimensions
  8106. correspond to the non-black or video area of the input video according to @var{mode}.
  8107. It accepts the following parameters:
  8108. @table @option
  8109. @item mode
  8110. Depending on @var{mode} crop detection is based on either the mere black value of surrounding pixels or a combination of motion vectors and edge pixels.
  8111. @table @samp
  8112. @item black
  8113. Detect black pixels surrounding the playing video. For fine control use option @var{limit}.
  8114. @item mvedges
  8115. Detect the playing video by the motion vectors inside the video and scanning for edge pixels typically forming the border of a playing video.
  8116. @end table
  8117. @item limit
  8118. Set higher black value threshold, which can be optionally specified
  8119. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  8120. value greater to the set value is considered non-black. It defaults to 24.
  8121. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  8122. on the bitdepth of the pixel format.
  8123. @item round
  8124. The value which the width/height should be divisible by. It defaults to
  8125. 16. The offset is automatically adjusted to center the video. Use 2 to
  8126. get only even dimensions (needed for 4:2:2 video). 16 is best when
  8127. encoding to most video codecs.
  8128. @item skip
  8129. Set the number of initial frames for which evaluation is skipped.
  8130. Default is 2. Range is 0 to INT_MAX.
  8131. @item reset_count, reset
  8132. Set the counter that determines after how many frames cropdetect will
  8133. reset the previously detected largest video area and start over to
  8134. detect the current optimal crop area. Default value is 0.
  8135. This can be useful when channel logos distort the video area. 0
  8136. indicates 'never reset', and returns the largest area encountered during
  8137. playback.
  8138. @item mv_threshold
  8139. Set motion in pixel units as threshold for motion detection. It defaults to 8.
  8140. @item low
  8141. @item high
  8142. Set low and high threshold values used by the Canny thresholding
  8143. algorithm.
  8144. The high threshold selects the "strong" edge pixels, which are then
  8145. connected through 8-connectivity with the "weak" edge pixels selected
  8146. by the low threshold.
  8147. @var{low} and @var{high} threshold values must be chosen in the range
  8148. [0,1], and @var{low} should be lesser or equal to @var{high}.
  8149. Default value for @var{low} is @code{5/255}, and default value for @var{high}
  8150. is @code{15/255}.
  8151. @end table
  8152. @subsection Examples
  8153. @itemize
  8154. @item
  8155. Find video area surrounded by black borders:
  8156. @example
  8157. ffmpeg -i file.mp4 -vf cropdetect,metadata=mode=print -f null -
  8158. @end example
  8159. @item
  8160. Find an embedded video area, generate motion vectors beforehand:
  8161. @example
  8162. ffmpeg -i file.mp4 -vf mestimate,cropdetect=mode=mvedges,metadata=mode=print -f null -
  8163. @end example
  8164. @item
  8165. Find an embedded video area, use motion vectors from decoder:
  8166. @example
  8167. ffmpeg -flags2 +export_mvs -i file.mp4 -vf cropdetect=mode=mvedges,metadata=mode=print -f null -
  8168. @end example
  8169. @end itemize
  8170. @subsection Commands
  8171. This filter supports the following commands:
  8172. @table @option
  8173. @item limit
  8174. The command accepts the same syntax of the corresponding option.
  8175. If the specified expression is not valid, it is kept at its current value.
  8176. @end table
  8177. @anchor{cue}
  8178. @section cue
  8179. Delay video filtering until a given wallclock timestamp. The filter first
  8180. passes on @option{preroll} amount of frames, then it buffers at most
  8181. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  8182. it forwards the buffered frames and also any subsequent frames coming in its
  8183. input.
  8184. The filter can be used synchronize the output of multiple ffmpeg processes for
  8185. realtime output devices like decklink. By putting the delay in the filtering
  8186. chain and pre-buffering frames the process can pass on data to output almost
  8187. immediately after the target wallclock timestamp is reached.
  8188. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  8189. some use cases.
  8190. @table @option
  8191. @item cue
  8192. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  8193. @item preroll
  8194. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  8195. @item buffer
  8196. The maximum duration of content to buffer before waiting for the cue expressed
  8197. in seconds. Default is 0.
  8198. @end table
  8199. @anchor{curves}
  8200. @section curves
  8201. Apply color adjustments using curves.
  8202. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  8203. component (red, green and blue) has its values defined by @var{N} key points
  8204. tied from each other using a smooth curve. The x-axis represents the pixel
  8205. values from the input frame, and the y-axis the new pixel values to be set for
  8206. the output frame.
  8207. By default, a component curve is defined by the two points @var{(0;0)} and
  8208. @var{(1;1)}. This creates a straight line where each original pixel value is
  8209. "adjusted" to its own value, which means no change to the image.
  8210. The filter allows you to redefine these two points and add some more. A new
  8211. curve will be define to pass smoothly through all these new coordinates. The
  8212. new defined points needs to be strictly increasing over the x-axis, and their
  8213. @var{x} and @var{y} values must be in the @var{[0;1]} interval. The curve is
  8214. formed by using a natural or monotonic cubic spline interpolation, depending
  8215. on the @var{interp} option (default: @code{natural}). The @code{natural}
  8216. spline produces a smoother curve in general while the monotonic (@code{pchip})
  8217. spline guarantees the transitions between the specified points to be
  8218. monotonic. If the computed curves happened to go outside the vector spaces,
  8219. the values will be clipped accordingly.
  8220. The filter accepts the following options:
  8221. @table @option
  8222. @item preset
  8223. Select one of the available color presets. This option can be used in addition
  8224. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  8225. options takes priority on the preset values.
  8226. Available presets are:
  8227. @table @samp
  8228. @item none
  8229. @item color_negative
  8230. @item cross_process
  8231. @item darker
  8232. @item increase_contrast
  8233. @item lighter
  8234. @item linear_contrast
  8235. @item medium_contrast
  8236. @item negative
  8237. @item strong_contrast
  8238. @item vintage
  8239. @end table
  8240. Default is @code{none}.
  8241. @item master, m
  8242. Set the master key points. These points will define a second pass mapping. It
  8243. is sometimes called a "luminance" or "value" mapping. It can be used with
  8244. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  8245. post-processing LUT.
  8246. @item red, r
  8247. Set the key points for the red component.
  8248. @item green, g
  8249. Set the key points for the green component.
  8250. @item blue, b
  8251. Set the key points for the blue component.
  8252. @item all
  8253. Set the key points for all components (not including master).
  8254. Can be used in addition to the other key points component
  8255. options. In this case, the unset component(s) will fallback on this
  8256. @option{all} setting.
  8257. @item psfile
  8258. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  8259. @item plot
  8260. Save Gnuplot script of the curves in specified file.
  8261. @item interp
  8262. Specify the kind of interpolation. Available algorithms are:
  8263. @table @samp
  8264. @item natural
  8265. Natural cubic spline using a piece-wise cubic polynomial that is twice continuously differentiable.
  8266. @item pchip
  8267. Monotonic cubic spline using a piecewise cubic Hermite interpolating polynomial (PCHIP).
  8268. @end table
  8269. @end table
  8270. To avoid some filtergraph syntax conflicts, each key points list need to be
  8271. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  8272. @subsection Commands
  8273. This filter supports same @ref{commands} as options.
  8274. @subsection Examples
  8275. @itemize
  8276. @item
  8277. Increase slightly the middle level of blue:
  8278. @example
  8279. curves=blue='0/0 0.5/0.58 1/1'
  8280. @end example
  8281. @item
  8282. Vintage effect:
  8283. @example
  8284. 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'
  8285. @end example
  8286. Here we obtain the following coordinates for each components:
  8287. @table @var
  8288. @item red
  8289. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  8290. @item green
  8291. @code{(0;0) (0.50;0.48) (1;1)}
  8292. @item blue
  8293. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  8294. @end table
  8295. @item
  8296. The previous example can also be achieved with the associated built-in preset:
  8297. @example
  8298. curves=preset=vintage
  8299. @end example
  8300. @item
  8301. Or simply:
  8302. @example
  8303. curves=vintage
  8304. @end example
  8305. @item
  8306. Use a Photoshop preset and redefine the points of the green component:
  8307. @example
  8308. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  8309. @end example
  8310. @item
  8311. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  8312. and @command{gnuplot}:
  8313. @example
  8314. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  8315. gnuplot -p /tmp/curves.plt
  8316. @end example
  8317. @end itemize
  8318. @section datascope
  8319. Video data analysis filter.
  8320. This filter shows hexadecimal pixel values of part of video.
  8321. The filter accepts the following options:
  8322. @table @option
  8323. @item size, s
  8324. Set output video size.
  8325. @item x
  8326. Set x offset from where to pick pixels.
  8327. @item y
  8328. Set y offset from where to pick pixels.
  8329. @item mode
  8330. Set scope mode, can be one of the following:
  8331. @table @samp
  8332. @item mono
  8333. Draw hexadecimal pixel values with white color on black background.
  8334. @item color
  8335. Draw hexadecimal pixel values with input video pixel color on black
  8336. background.
  8337. @item color2
  8338. Draw hexadecimal pixel values on color background picked from input video,
  8339. the text color is picked in such way so its always visible.
  8340. @end table
  8341. @item axis
  8342. Draw rows and columns numbers on left and top of video.
  8343. @item opacity
  8344. Set background opacity.
  8345. @item format
  8346. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  8347. @item components
  8348. Set pixel components to display. By default all pixel components are displayed.
  8349. @end table
  8350. @subsection Commands
  8351. This filter supports same @ref{commands} as options excluding @code{size} option.
  8352. @section dblur
  8353. Apply Directional blur filter.
  8354. The filter accepts the following options:
  8355. @table @option
  8356. @item angle
  8357. Set angle of directional blur. Default is @code{45}.
  8358. @item radius
  8359. Set radius of directional blur. Default is @code{5}.
  8360. @item planes
  8361. Set which planes to filter. By default all planes are filtered.
  8362. @end table
  8363. @subsection Commands
  8364. This filter supports same @ref{commands} as options.
  8365. The command accepts the same syntax of the corresponding option.
  8366. If the specified expression is not valid, it is kept at its current
  8367. value.
  8368. @section dctdnoiz
  8369. Denoise frames using 2D DCT (frequency domain filtering).
  8370. This filter is not designed for real time.
  8371. The filter accepts the following options:
  8372. @table @option
  8373. @item sigma, s
  8374. Set the noise sigma constant.
  8375. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  8376. coefficient (absolute value) below this threshold with be dropped.
  8377. If you need a more advanced filtering, see @option{expr}.
  8378. Default is @code{0}.
  8379. @item overlap
  8380. Set number overlapping pixels for each block. Since the filter can be slow, you
  8381. may want to reduce this value, at the cost of a less effective filter and the
  8382. risk of various artefacts.
  8383. If the overlapping value doesn't permit processing the whole input width or
  8384. height, a warning will be displayed and according borders won't be denoised.
  8385. Default value is @var{blocksize}-1, which is the best possible setting.
  8386. @item expr, e
  8387. Set the coefficient factor expression.
  8388. For each coefficient of a DCT block, this expression will be evaluated as a
  8389. multiplier value for the coefficient.
  8390. If this is option is set, the @option{sigma} option will be ignored.
  8391. The absolute value of the coefficient can be accessed through the @var{c}
  8392. variable.
  8393. @item n
  8394. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  8395. @var{blocksize}, which is the width and height of the processed blocks.
  8396. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  8397. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  8398. on the speed processing. Also, a larger block size does not necessarily means a
  8399. better de-noising.
  8400. @end table
  8401. @subsection Examples
  8402. Apply a denoise with a @option{sigma} of @code{4.5}:
  8403. @example
  8404. dctdnoiz=4.5
  8405. @end example
  8406. The same operation can be achieved using the expression system:
  8407. @example
  8408. dctdnoiz=e='gte(c, 4.5*3)'
  8409. @end example
  8410. Violent denoise using a block size of @code{16x16}:
  8411. @example
  8412. dctdnoiz=15:n=4
  8413. @end example
  8414. @section deband
  8415. Remove banding artifacts from input video.
  8416. It works by replacing banded pixels with average value of referenced pixels.
  8417. The filter accepts the following options:
  8418. @table @option
  8419. @item 1thr
  8420. @item 2thr
  8421. @item 3thr
  8422. @item 4thr
  8423. Set banding detection threshold for each plane. Default is 0.02.
  8424. Valid range is 0.00003 to 0.5.
  8425. If difference between current pixel and reference pixel is less than threshold,
  8426. it will be considered as banded.
  8427. @item range, r
  8428. Banding detection range in pixels. Default is 16. If positive, random number
  8429. in range 0 to set value will be used. If negative, exact absolute value
  8430. will be used.
  8431. The range defines square of four pixels around current pixel.
  8432. @item direction, d
  8433. Set direction in radians from which four pixel will be compared. If positive,
  8434. random direction from 0 to set direction will be picked. If negative, exact of
  8435. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  8436. will pick only pixels on same row and -PI/2 will pick only pixels on same
  8437. column.
  8438. @item blur, b
  8439. If enabled, current pixel is compared with average value of all four
  8440. surrounding pixels. The default is enabled. If disabled current pixel is
  8441. compared with all four surrounding pixels. The pixel is considered banded
  8442. if only all four differences with surrounding pixels are less than threshold.
  8443. @item coupling, c
  8444. If enabled, current pixel is changed if and only if all pixel components are banded,
  8445. e.g. banding detection threshold is triggered for all color components.
  8446. The default is disabled.
  8447. @end table
  8448. @subsection Commands
  8449. This filter supports the all above options as @ref{commands}.
  8450. @section deblock
  8451. Remove blocking artifacts from input video.
  8452. The filter accepts the following options:
  8453. @table @option
  8454. @item filter
  8455. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  8456. This controls what kind of deblocking is applied.
  8457. @item block
  8458. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  8459. @item alpha
  8460. @item beta
  8461. @item gamma
  8462. @item delta
  8463. Set blocking detection thresholds. Allowed range is 0 to 1.
  8464. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  8465. Using higher threshold gives more deblocking strength.
  8466. Setting @var{alpha} controls threshold detection at exact edge of block.
  8467. Remaining options controls threshold detection near the edge. Each one for
  8468. below/above or left/right. Setting any of those to @var{0} disables
  8469. deblocking.
  8470. @item planes
  8471. Set planes to filter. Default is to filter all available planes.
  8472. @end table
  8473. @subsection Examples
  8474. @itemize
  8475. @item
  8476. Deblock using weak filter and block size of 4 pixels.
  8477. @example
  8478. deblock=filter=weak:block=4
  8479. @end example
  8480. @item
  8481. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  8482. deblocking more edges.
  8483. @example
  8484. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  8485. @end example
  8486. @item
  8487. Similar as above, but filter only first plane.
  8488. @example
  8489. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  8490. @end example
  8491. @item
  8492. Similar as above, but filter only second and third plane.
  8493. @example
  8494. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  8495. @end example
  8496. @end itemize
  8497. @subsection Commands
  8498. This filter supports the all above options as @ref{commands}.
  8499. @anchor{decimate}
  8500. @section decimate
  8501. Drop duplicated frames at regular intervals.
  8502. The filter accepts the following options:
  8503. @table @option
  8504. @item cycle
  8505. Set the number of frames from which one will be dropped. Setting this to
  8506. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  8507. Default is @code{5}.
  8508. @item dupthresh
  8509. Set the threshold for duplicate detection. If the difference metric for a frame
  8510. is less than or equal to this value, then it is declared as duplicate. Default
  8511. is @code{1.1}
  8512. @item scthresh
  8513. Set scene change threshold. Default is @code{15}.
  8514. @item blockx
  8515. @item blocky
  8516. Set the size of the x and y-axis blocks used during metric calculations.
  8517. Larger blocks give better noise suppression, but also give worse detection of
  8518. small movements. Must be a power of two. Default is @code{32}.
  8519. @item ppsrc
  8520. Mark main input as a pre-processed input and activate clean source input
  8521. stream. This allows the input to be pre-processed with various filters to help
  8522. the metrics calculation while keeping the frame selection lossless. When set to
  8523. @code{1}, the first stream is for the pre-processed input, and the second
  8524. stream is the clean source from where the kept frames are chosen. Default is
  8525. @code{0}.
  8526. @item chroma
  8527. Set whether or not chroma is considered in the metric calculations. Default is
  8528. @code{1}.
  8529. @item mixed
  8530. Set whether or not the input only partially contains content to be decimated.
  8531. Default is @code{false}.
  8532. If enabled video output stream will be in variable frame rate.
  8533. @end table
  8534. @section deconvolve
  8535. Apply 2D deconvolution of video stream in frequency domain using second stream
  8536. as impulse.
  8537. The filter accepts the following options:
  8538. @table @option
  8539. @item planes
  8540. Set which planes to process.
  8541. @item impulse
  8542. Set which impulse video frames will be processed, can be @var{first}
  8543. or @var{all}. Default is @var{all}.
  8544. @item noise
  8545. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  8546. and height are not same and not power of 2 or if stream prior to convolving
  8547. had noise.
  8548. @end table
  8549. The @code{deconvolve} filter also supports the @ref{framesync} options.
  8550. @section dedot
  8551. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  8552. It accepts the following options:
  8553. @table @option
  8554. @item m
  8555. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  8556. @var{rainbows} for cross-color reduction.
  8557. @item lt
  8558. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  8559. @item tl
  8560. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  8561. @item tc
  8562. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  8563. @item ct
  8564. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  8565. @end table
  8566. @section deflate
  8567. Apply deflate effect to the video.
  8568. This filter replaces the pixel by the local(3x3) average by taking into account
  8569. only values lower than the pixel.
  8570. It accepts the following options:
  8571. @table @option
  8572. @item threshold0
  8573. @item threshold1
  8574. @item threshold2
  8575. @item threshold3
  8576. Limit the maximum change for each plane, default is 65535.
  8577. If 0, plane will remain unchanged.
  8578. @end table
  8579. @subsection Commands
  8580. This filter supports the all above options as @ref{commands}.
  8581. @section deflicker
  8582. Remove temporal frame luminance variations.
  8583. It accepts the following options:
  8584. @table @option
  8585. @item size, s
  8586. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  8587. @item mode, m
  8588. Set averaging mode to smooth temporal luminance variations.
  8589. Available values are:
  8590. @table @samp
  8591. @item am
  8592. Arithmetic mean
  8593. @item gm
  8594. Geometric mean
  8595. @item hm
  8596. Harmonic mean
  8597. @item qm
  8598. Quadratic mean
  8599. @item cm
  8600. Cubic mean
  8601. @item pm
  8602. Power mean
  8603. @item median
  8604. Median
  8605. @end table
  8606. @item bypass
  8607. Do not actually modify frame. Useful when one only wants metadata.
  8608. @end table
  8609. @section dejudder
  8610. Remove judder produced by partially interlaced telecined content.
  8611. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  8612. source was partially telecined content then the output of @code{pullup,dejudder}
  8613. will have a variable frame rate. May change the recorded frame rate of the
  8614. container. Aside from that change, this filter will not affect constant frame
  8615. rate video.
  8616. The option available in this filter is:
  8617. @table @option
  8618. @item cycle
  8619. Specify the length of the window over which the judder repeats.
  8620. Accepts any integer greater than 1. Useful values are:
  8621. @table @samp
  8622. @item 4
  8623. If the original was telecined from 24 to 30 fps (Film to NTSC).
  8624. @item 5
  8625. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  8626. @item 20
  8627. If a mixture of the two.
  8628. @end table
  8629. The default is @samp{4}.
  8630. @end table
  8631. @section delogo
  8632. Suppress a TV station logo by a simple interpolation of the surrounding
  8633. pixels. Just set a rectangle covering the logo and watch it disappear
  8634. (and sometimes something even uglier appear - your mileage may vary).
  8635. It accepts the following parameters:
  8636. @table @option
  8637. @item x
  8638. @item y
  8639. Specify the top left corner coordinates of the logo. They must be
  8640. specified.
  8641. @item w
  8642. @item h
  8643. Specify the width and height of the logo to clear. They must be
  8644. specified.
  8645. @item show
  8646. When set to 1, a green rectangle is drawn on the screen to simplify
  8647. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  8648. The default value is 0.
  8649. The rectangle is drawn on the outermost pixels which will be (partly)
  8650. replaced with interpolated values. The values of the next pixels
  8651. immediately outside this rectangle in each direction will be used to
  8652. compute the interpolated pixel values inside the rectangle.
  8653. @end table
  8654. @subsection Examples
  8655. @itemize
  8656. @item
  8657. Set a rectangle covering the area with top left corner coordinates 0,0
  8658. and size 100x77:
  8659. @example
  8660. delogo=x=0:y=0:w=100:h=77
  8661. @end example
  8662. @end itemize
  8663. @anchor{derain}
  8664. @section derain
  8665. Remove the rain in the input image/video by applying the derain methods based on
  8666. convolutional neural networks. Supported models:
  8667. @itemize
  8668. @item
  8669. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  8670. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  8671. @end itemize
  8672. Training as well as model generation scripts are provided in
  8673. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  8674. Native model files (.model) can be generated from TensorFlow model
  8675. files (.pb) by using tools/python/convert.py
  8676. The filter accepts the following options:
  8677. @table @option
  8678. @item filter_type
  8679. Specify which filter to use. This option accepts the following values:
  8680. @table @samp
  8681. @item derain
  8682. Derain filter. To conduct derain filter, you need to use a derain model.
  8683. @item dehaze
  8684. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  8685. @end table
  8686. Default value is @samp{derain}.
  8687. @item dnn_backend
  8688. Specify which DNN backend to use for model loading and execution. This option accepts
  8689. the following values:
  8690. @table @samp
  8691. @item native
  8692. Native implementation of DNN loading and execution.
  8693. @item tensorflow
  8694. TensorFlow backend. To enable this backend you
  8695. need to install the TensorFlow for C library (see
  8696. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  8697. @code{--enable-libtensorflow}
  8698. @end table
  8699. Default value is @samp{native}.
  8700. @item model
  8701. Set path to model file specifying network architecture and its parameters.
  8702. Note that different backends use different file formats. TensorFlow and native
  8703. backend can load files for only its format.
  8704. @end table
  8705. To get full functionality (such as async execution), please use the @ref{dnn_processing} filter.
  8706. @section deshake
  8707. Attempt to fix small changes in horizontal and/or vertical shift. This
  8708. filter helps remove camera shake from hand-holding a camera, bumping a
  8709. tripod, moving on a vehicle, etc.
  8710. The filter accepts the following options:
  8711. @table @option
  8712. @item x
  8713. @item y
  8714. @item w
  8715. @item h
  8716. Specify a rectangular area where to limit the search for motion
  8717. vectors.
  8718. If desired the search for motion vectors can be limited to a
  8719. rectangular area of the frame defined by its top left corner, width
  8720. and height. These parameters have the same meaning as the drawbox
  8721. filter which can be used to visualise the position of the bounding
  8722. box.
  8723. This is useful when simultaneous movement of subjects within the frame
  8724. might be confused for camera motion by the motion vector search.
  8725. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  8726. then the full frame is used. This allows later options to be set
  8727. without specifying the bounding box for the motion vector search.
  8728. Default - search the whole frame.
  8729. @item rx
  8730. @item ry
  8731. Specify the maximum extent of movement in x and y directions in the
  8732. range 0-64 pixels. Default 16.
  8733. @item edge
  8734. Specify how to generate pixels to fill blanks at the edge of the
  8735. frame. Available values are:
  8736. @table @samp
  8737. @item blank, 0
  8738. Fill zeroes at blank locations
  8739. @item original, 1
  8740. Original image at blank locations
  8741. @item clamp, 2
  8742. Extruded edge value at blank locations
  8743. @item mirror, 3
  8744. Mirrored edge at blank locations
  8745. @end table
  8746. Default value is @samp{mirror}.
  8747. @item blocksize
  8748. Specify the blocksize to use for motion search. Range 4-128 pixels,
  8749. default 8.
  8750. @item contrast
  8751. Specify the contrast threshold for blocks. Only blocks with more than
  8752. the specified contrast (difference between darkest and lightest
  8753. pixels) will be considered. Range 1-255, default 125.
  8754. @item search
  8755. Specify the search strategy. Available values are:
  8756. @table @samp
  8757. @item exhaustive, 0
  8758. Set exhaustive search
  8759. @item less, 1
  8760. Set less exhaustive search.
  8761. @end table
  8762. Default value is @samp{exhaustive}.
  8763. @item filename
  8764. If set then a detailed log of the motion search is written to the
  8765. specified file.
  8766. @end table
  8767. @section despill
  8768. Remove unwanted contamination of foreground colors, caused by reflected color of
  8769. greenscreen or bluescreen.
  8770. This filter accepts the following options:
  8771. @table @option
  8772. @item type
  8773. Set what type of despill to use.
  8774. @item mix
  8775. Set how spillmap will be generated.
  8776. @item expand
  8777. Set how much to get rid of still remaining spill.
  8778. @item red
  8779. Controls amount of red in spill area.
  8780. @item green
  8781. Controls amount of green in spill area.
  8782. Should be -1 for greenscreen.
  8783. @item blue
  8784. Controls amount of blue in spill area.
  8785. Should be -1 for bluescreen.
  8786. @item brightness
  8787. Controls brightness of spill area, preserving colors.
  8788. @item alpha
  8789. Modify alpha from generated spillmap.
  8790. @end table
  8791. @subsection Commands
  8792. This filter supports the all above options as @ref{commands}.
  8793. @section detelecine
  8794. Apply an exact inverse of the telecine operation. It requires a predefined
  8795. pattern specified using the pattern option which must be the same as that passed
  8796. to the telecine filter.
  8797. This filter accepts the following options:
  8798. @table @option
  8799. @item first_field
  8800. @table @samp
  8801. @item top, t
  8802. top field first
  8803. @item bottom, b
  8804. bottom field first
  8805. The default value is @code{top}.
  8806. @end table
  8807. @item pattern
  8808. A string of numbers representing the pulldown pattern you wish to apply.
  8809. The default value is @code{23}.
  8810. @item start_frame
  8811. A number representing position of the first frame with respect to the telecine
  8812. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  8813. @end table
  8814. @anchor{dilation}
  8815. @section dilation
  8816. Apply dilation effect to the video.
  8817. This filter replaces the pixel by the local(3x3) maximum.
  8818. It accepts the following options:
  8819. @table @option
  8820. @item threshold0
  8821. @item threshold1
  8822. @item threshold2
  8823. @item threshold3
  8824. Limit the maximum change for each plane, default is 65535.
  8825. If 0, plane will remain unchanged.
  8826. @item coordinates
  8827. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  8828. pixels are used.
  8829. Flags to local 3x3 coordinates maps like this:
  8830. 1 2 3
  8831. 4 5
  8832. 6 7 8
  8833. @end table
  8834. @subsection Commands
  8835. This filter supports the all above options as @ref{commands}.
  8836. @section displace
  8837. Displace pixels as indicated by second and third input stream.
  8838. It takes three input streams and outputs one stream, the first input is the
  8839. source, and second and third input are displacement maps.
  8840. The second input specifies how much to displace pixels along the
  8841. x-axis, while the third input specifies how much to displace pixels
  8842. along the y-axis.
  8843. If one of displacement map streams terminates, last frame from that
  8844. displacement map will be used.
  8845. Note that once generated, displacements maps can be reused over and over again.
  8846. A description of the accepted options follows.
  8847. @table @option
  8848. @item edge
  8849. Set displace behavior for pixels that are out of range.
  8850. Available values are:
  8851. @table @samp
  8852. @item blank
  8853. Missing pixels are replaced by black pixels.
  8854. @item smear
  8855. Adjacent pixels will spread out to replace missing pixels.
  8856. @item wrap
  8857. Out of range pixels are wrapped so they point to pixels of other side.
  8858. @item mirror
  8859. Out of range pixels will be replaced with mirrored pixels.
  8860. @end table
  8861. Default is @samp{smear}.
  8862. @end table
  8863. @subsection Examples
  8864. @itemize
  8865. @item
  8866. Add ripple effect to rgb input of video size hd720:
  8867. @example
  8868. 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
  8869. @end example
  8870. @item
  8871. Add wave effect to rgb input of video size hd720:
  8872. @example
  8873. 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
  8874. @end example
  8875. @end itemize
  8876. @section dnn_classify
  8877. Do classification with deep neural networks based on bounding boxes.
  8878. The filter accepts the following options:
  8879. @table @option
  8880. @item dnn_backend
  8881. Specify which DNN backend to use for model loading and execution. This option accepts
  8882. only openvino now, tensorflow backends will be added.
  8883. @item model
  8884. Set path to model file specifying network architecture and its parameters.
  8885. Note that different backends use different file formats.
  8886. @item input
  8887. Set the input name of the dnn network.
  8888. @item output
  8889. Set the output name of the dnn network.
  8890. @item confidence
  8891. Set the confidence threshold (default: 0.5).
  8892. @item labels
  8893. Set path to label file specifying the mapping between label id and name.
  8894. Each label name is written in one line, tailing spaces and empty lines are skipped.
  8895. The first line is the name of label id 0,
  8896. and the second line is the name of label id 1, etc.
  8897. The label id is considered as name if the label file is not provided.
  8898. @item backend_configs
  8899. Set the configs to be passed into backend
  8900. For tensorflow backend, you can set its configs with @option{sess_config} options,
  8901. please use tools/python/tf_sess_config.py to get the configs for your system.
  8902. @end table
  8903. @section dnn_detect
  8904. Do object detection with deep neural networks.
  8905. The filter accepts the following options:
  8906. @table @option
  8907. @item dnn_backend
  8908. Specify which DNN backend to use for model loading and execution. This option accepts
  8909. only openvino now, tensorflow backends will be added.
  8910. @item model
  8911. Set path to model file specifying network architecture and its parameters.
  8912. Note that different backends use different file formats.
  8913. @item input
  8914. Set the input name of the dnn network.
  8915. @item output
  8916. Set the output name of the dnn network.
  8917. @item confidence
  8918. Set the confidence threshold (default: 0.5).
  8919. @item labels
  8920. Set path to label file specifying the mapping between label id and name.
  8921. Each label name is written in one line, tailing spaces and empty lines are skipped.
  8922. The first line is the name of label id 0 (usually it is 'background'),
  8923. and the second line is the name of label id 1, etc.
  8924. The label id is considered as name if the label file is not provided.
  8925. @item backend_configs
  8926. Set the configs to be passed into backend. To use async execution, set async (default: set).
  8927. Roll back to sync execution if the backend does not support async.
  8928. @end table
  8929. @anchor{dnn_processing}
  8930. @section dnn_processing
  8931. Do image processing with deep neural networks. It works together with another filter
  8932. which converts the pixel format of the Frame to what the dnn network requires.
  8933. The filter accepts the following options:
  8934. @table @option
  8935. @item dnn_backend
  8936. Specify which DNN backend to use for model loading and execution. This option accepts
  8937. the following values:
  8938. @table @samp
  8939. @item native
  8940. Native implementation of DNN loading and execution.
  8941. @item tensorflow
  8942. TensorFlow backend. To enable this backend you
  8943. need to install the TensorFlow for C library (see
  8944. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  8945. @code{--enable-libtensorflow}
  8946. @item openvino
  8947. OpenVINO backend. To enable this backend you
  8948. need to build and install the OpenVINO for C library (see
  8949. @url{https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md}) and configure FFmpeg with
  8950. @code{--enable-libopenvino} (--extra-cflags=-I... --extra-ldflags=-L... might
  8951. be needed if the header files and libraries are not installed into system path)
  8952. @end table
  8953. Default value is @samp{native}.
  8954. @item model
  8955. Set path to model file specifying network architecture and its parameters.
  8956. Note that different backends use different file formats. TensorFlow, OpenVINO and native
  8957. backend can load files for only its format.
  8958. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  8959. @item input
  8960. Set the input name of the dnn network.
  8961. @item output
  8962. Set the output name of the dnn network.
  8963. @item backend_configs
  8964. Set the configs to be passed into backend. To use async execution, set async (default: set).
  8965. Roll back to sync execution if the backend does not support async.
  8966. For tensorflow backend, you can set its configs with @option{sess_config} options,
  8967. please use tools/python/tf_sess_config.py to get the configs of TensorFlow backend for your system.
  8968. @end table
  8969. @subsection Examples
  8970. @itemize
  8971. @item
  8972. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  8973. @example
  8974. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  8975. @end example
  8976. @item
  8977. Halve the pixel value of the frame with format gray32f:
  8978. @example
  8979. ffmpeg -i input.jpg -vf format=grayf32,dnn_processing=model=halve_gray_float.model:input=dnn_in:output=dnn_out:dnn_backend=native -y out.native.png
  8980. @end example
  8981. @item
  8982. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  8983. @example
  8984. ./ffmpeg -i 480p.jpg -vf format=yuv420p,scale=w=iw*2:h=ih*2,dnn_processing=dnn_backend=tensorflow:model=srcnn.pb:input=x:output=y -y srcnn.jpg
  8985. @end example
  8986. @item
  8987. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported),
  8988. please use tools/python/tf_sess_config.py to get the configs of TensorFlow backend for your system.
  8989. @example
  8990. ./ffmpeg -i 480p.jpg -vf format=yuv420p,dnn_processing=dnn_backend=tensorflow:model=espcn.pb:input=x:output=y:backend_configs=sess_config=0x10022805320e09cdccccccccccec3f20012a01303801 -y tmp.espcn.jpg
  8991. @end example
  8992. @end itemize
  8993. @section drawbox
  8994. Draw a colored box on the input image.
  8995. It accepts the following parameters:
  8996. @table @option
  8997. @item x
  8998. @item y
  8999. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  9000. @item width, w
  9001. @item height, h
  9002. The expressions which specify the width and height of the box; if 0 they are interpreted as
  9003. the input width and height. It defaults to 0.
  9004. @item color, c
  9005. Specify the color of the box to write. For the general syntax of this option,
  9006. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  9007. value @code{invert} is used, the box edge color is the same as the
  9008. video with inverted luma.
  9009. @item thickness, t
  9010. The expression which sets the thickness of the box edge.
  9011. A value of @code{fill} will create a filled box. Default value is @code{3}.
  9012. See below for the list of accepted constants.
  9013. @item replace
  9014. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  9015. will overwrite the video's color and alpha pixels.
  9016. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  9017. @end table
  9018. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  9019. following constants:
  9020. @table @option
  9021. @item dar
  9022. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  9023. @item hsub
  9024. @item vsub
  9025. horizontal and vertical chroma subsample values. For example for the
  9026. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9027. @item in_h, ih
  9028. @item in_w, iw
  9029. The input width and height.
  9030. @item sar
  9031. The input sample aspect ratio.
  9032. @item x
  9033. @item y
  9034. The x and y offset coordinates where the box is drawn.
  9035. @item w
  9036. @item h
  9037. The width and height of the drawn box.
  9038. @item box_source
  9039. Box source can be set as side_data_detection_bboxes if you want to use box data in
  9040. detection bboxes of side data.
  9041. If @var{box_source} is set, the @var{x}, @var{y}, @var{width} and @var{height} will be ignored and
  9042. still use box data in detection bboxes of side data. So please do not use this parameter if you were
  9043. not sure about the box source.
  9044. @item t
  9045. The thickness of the drawn box.
  9046. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  9047. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  9048. @end table
  9049. @subsection Examples
  9050. @itemize
  9051. @item
  9052. Draw a black box around the edge of the input image:
  9053. @example
  9054. drawbox
  9055. @end example
  9056. @item
  9057. Draw a box with color red and an opacity of 50%:
  9058. @example
  9059. drawbox=10:20:200:60:red@@0.5
  9060. @end example
  9061. The previous example can be specified as:
  9062. @example
  9063. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  9064. @end example
  9065. @item
  9066. Fill the box with pink color:
  9067. @example
  9068. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  9069. @end example
  9070. @item
  9071. Draw a 2-pixel red 2.40:1 mask:
  9072. @example
  9073. 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
  9074. @end example
  9075. @end itemize
  9076. @subsection Commands
  9077. This filter supports same commands as options.
  9078. The command accepts the same syntax of the corresponding option.
  9079. If the specified expression is not valid, it is kept at its current
  9080. value.
  9081. @anchor{drawgraph}
  9082. @section drawgraph
  9083. Draw a graph using input video metadata.
  9084. It accepts the following parameters:
  9085. @table @option
  9086. @item m1
  9087. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  9088. @item fg1
  9089. Set 1st foreground color expression.
  9090. @item m2
  9091. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  9092. @item fg2
  9093. Set 2nd foreground color expression.
  9094. @item m3
  9095. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  9096. @item fg3
  9097. Set 3rd foreground color expression.
  9098. @item m4
  9099. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  9100. @item fg4
  9101. Set 4th foreground color expression.
  9102. @item min
  9103. Set minimal value of metadata value.
  9104. @item max
  9105. Set maximal value of metadata value.
  9106. @item bg
  9107. Set graph background color. Default is white.
  9108. @item mode
  9109. Set graph mode.
  9110. Available values for mode is:
  9111. @table @samp
  9112. @item bar
  9113. @item dot
  9114. @item line
  9115. @end table
  9116. Default is @code{line}.
  9117. @item slide
  9118. Set slide mode.
  9119. Available values for slide is:
  9120. @table @samp
  9121. @item frame
  9122. Draw new frame when right border is reached.
  9123. @item replace
  9124. Replace old columns with new ones.
  9125. @item scroll
  9126. Scroll from right to left.
  9127. @item rscroll
  9128. Scroll from left to right.
  9129. @item picture
  9130. Draw single picture.
  9131. @end table
  9132. Default is @code{frame}.
  9133. @item size
  9134. Set size of graph video. For the syntax of this option, check the
  9135. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9136. The default value is @code{900x256}.
  9137. @item rate, r
  9138. Set the output frame rate. Default value is @code{25}.
  9139. The foreground color expressions can use the following variables:
  9140. @table @option
  9141. @item MIN
  9142. Minimal value of metadata value.
  9143. @item MAX
  9144. Maximal value of metadata value.
  9145. @item VAL
  9146. Current metadata key value.
  9147. @end table
  9148. The color is defined as 0xAABBGGRR.
  9149. @end table
  9150. Example using metadata from @ref{signalstats} filter:
  9151. @example
  9152. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  9153. @end example
  9154. Example using metadata from @ref{ebur128} filter:
  9155. @example
  9156. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  9157. @end example
  9158. @section drawgrid
  9159. Draw a grid on the input image.
  9160. It accepts the following parameters:
  9161. @table @option
  9162. @item x
  9163. @item y
  9164. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  9165. @item width, w
  9166. @item height, h
  9167. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  9168. input width and height, respectively, minus @code{thickness}, so image gets
  9169. framed. Default to 0.
  9170. @item color, c
  9171. Specify the color of the grid. For the general syntax of this option,
  9172. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  9173. value @code{invert} is used, the grid color is the same as the
  9174. video with inverted luma.
  9175. @item thickness, t
  9176. The expression which sets the thickness of the grid line. Default value is @code{1}.
  9177. See below for the list of accepted constants.
  9178. @item replace
  9179. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  9180. will overwrite the video's color and alpha pixels.
  9181. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  9182. @end table
  9183. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  9184. following constants:
  9185. @table @option
  9186. @item dar
  9187. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  9188. @item hsub
  9189. @item vsub
  9190. horizontal and vertical chroma subsample values. For example for the
  9191. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9192. @item in_h, ih
  9193. @item in_w, iw
  9194. The input grid cell width and height.
  9195. @item sar
  9196. The input sample aspect ratio.
  9197. @item x
  9198. @item y
  9199. The x and y coordinates of some point of grid intersection (meant to configure offset).
  9200. @item w
  9201. @item h
  9202. The width and height of the drawn cell.
  9203. @item t
  9204. The thickness of the drawn cell.
  9205. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  9206. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  9207. @end table
  9208. @subsection Examples
  9209. @itemize
  9210. @item
  9211. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  9212. @example
  9213. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  9214. @end example
  9215. @item
  9216. Draw a white 3x3 grid with an opacity of 50%:
  9217. @example
  9218. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  9219. @end example
  9220. @end itemize
  9221. @subsection Commands
  9222. This filter supports same commands as options.
  9223. The command accepts the same syntax of the corresponding option.
  9224. If the specified expression is not valid, it is kept at its current
  9225. value.
  9226. @anchor{drawtext}
  9227. @section drawtext
  9228. Draw a text string or text from a specified file on top of a video, using the
  9229. libfreetype library.
  9230. To enable compilation of this filter, you need to configure FFmpeg with
  9231. @code{--enable-libfreetype}.
  9232. To enable default font fallback and the @var{font} option you need to
  9233. configure FFmpeg with @code{--enable-libfontconfig}.
  9234. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  9235. @code{--enable-libfribidi}.
  9236. @subsection Syntax
  9237. It accepts the following parameters:
  9238. @table @option
  9239. @item box
  9240. Used to draw a box around text using the background color.
  9241. The value must be either 1 (enable) or 0 (disable).
  9242. The default value of @var{box} is 0.
  9243. @item boxborderw
  9244. Set the width of the border to be drawn around the box using @var{boxcolor}.
  9245. The default value of @var{boxborderw} is 0.
  9246. @item boxcolor
  9247. The color to be used for drawing box around text. For the syntax of this
  9248. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9249. The default value of @var{boxcolor} is "white".
  9250. @item line_spacing
  9251. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  9252. The default value of @var{line_spacing} is 0.
  9253. @item borderw
  9254. Set the width of the border to be drawn around the text using @var{bordercolor}.
  9255. The default value of @var{borderw} is 0.
  9256. @item bordercolor
  9257. Set the color to be used for drawing border around text. For the syntax of this
  9258. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9259. The default value of @var{bordercolor} is "black".
  9260. @item expansion
  9261. Select how the @var{text} is expanded. Can be either @code{none},
  9262. @code{strftime} (deprecated) or
  9263. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  9264. below for details.
  9265. @item basetime
  9266. Set a start time for the count. Value is in microseconds. Only applied
  9267. in the deprecated strftime expansion mode. To emulate in normal expansion
  9268. mode use the @code{pts} function, supplying the start time (in seconds)
  9269. as the second argument.
  9270. @item fix_bounds
  9271. If true, check and fix text coords to avoid clipping.
  9272. @item fontcolor
  9273. The color to be used for drawing fonts. For the syntax of this option, check
  9274. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9275. The default value of @var{fontcolor} is "black".
  9276. @item fontcolor_expr
  9277. String which is expanded the same way as @var{text} to obtain dynamic
  9278. @var{fontcolor} value. By default this option has empty value and is not
  9279. processed. When this option is set, it overrides @var{fontcolor} option.
  9280. @item font
  9281. The font family to be used for drawing text. By default Sans.
  9282. @item fontfile
  9283. The font file to be used for drawing text. The path must be included.
  9284. This parameter is mandatory if the fontconfig support is disabled.
  9285. @item alpha
  9286. Draw the text applying alpha blending. The value can
  9287. be a number between 0.0 and 1.0.
  9288. The expression accepts the same variables @var{x, y} as well.
  9289. The default value is 1.
  9290. Please see @var{fontcolor_expr}.
  9291. @item fontsize
  9292. The font size to be used for drawing text.
  9293. The default value of @var{fontsize} is 16.
  9294. @item text_shaping
  9295. If set to 1, attempt to shape the text (for example, reverse the order of
  9296. right-to-left text and join Arabic characters) before drawing it.
  9297. Otherwise, just draw the text exactly as given.
  9298. By default 1 (if supported).
  9299. @item ft_load_flags
  9300. The flags to be used for loading the fonts.
  9301. The flags map the corresponding flags supported by libfreetype, and are
  9302. a combination of the following values:
  9303. @table @var
  9304. @item default
  9305. @item no_scale
  9306. @item no_hinting
  9307. @item render
  9308. @item no_bitmap
  9309. @item vertical_layout
  9310. @item force_autohint
  9311. @item crop_bitmap
  9312. @item pedantic
  9313. @item ignore_global_advance_width
  9314. @item no_recurse
  9315. @item ignore_transform
  9316. @item monochrome
  9317. @item linear_design
  9318. @item no_autohint
  9319. @end table
  9320. Default value is "default".
  9321. For more information consult the documentation for the FT_LOAD_*
  9322. libfreetype flags.
  9323. @item shadowcolor
  9324. The color to be used for drawing a shadow behind the drawn text. For the
  9325. syntax of this option, check the @ref{color syntax,,"Color" section in the
  9326. ffmpeg-utils manual,ffmpeg-utils}.
  9327. The default value of @var{shadowcolor} is "black".
  9328. @item shadowx
  9329. @item shadowy
  9330. The x and y offsets for the text shadow position with respect to the
  9331. position of the text. They can be either positive or negative
  9332. values. The default value for both is "0".
  9333. @item start_number
  9334. The starting frame number for the n/frame_num variable. The default value
  9335. is "0".
  9336. @item tabsize
  9337. The size in number of spaces to use for rendering the tab.
  9338. Default value is 4.
  9339. @item timecode
  9340. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  9341. format. It can be used with or without text parameter. @var{timecode_rate}
  9342. option must be specified.
  9343. @item timecode_rate, rate, r
  9344. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  9345. integer. Minimum value is "1".
  9346. Drop-frame timecode is supported for frame rates 30 & 60.
  9347. @item tc24hmax
  9348. If set to 1, the output of the timecode option will wrap around at 24 hours.
  9349. Default is 0 (disabled).
  9350. @item text
  9351. The text string to be drawn. The text must be a sequence of UTF-8
  9352. encoded characters.
  9353. This parameter is mandatory if no file is specified with the parameter
  9354. @var{textfile}.
  9355. @item textfile
  9356. A text file containing text to be drawn. The text must be a sequence
  9357. of UTF-8 encoded characters.
  9358. This parameter is mandatory if no text string is specified with the
  9359. parameter @var{text}.
  9360. If both @var{text} and @var{textfile} are specified, an error is thrown.
  9361. @item text_source
  9362. Text source should be set as side_data_detection_bboxes if you want to use text data in
  9363. detection bboxes of side data.
  9364. If text source is set, @var{text} and @var{textfile} will be ignored and still use
  9365. text data in detection bboxes of side data. So please do not use this parameter
  9366. if you are not sure about the text source.
  9367. @item reload
  9368. The @var{textfile} will be reloaded at specified frame interval.
  9369. Be sure to update @var{textfile} atomically, or it may be read partially,
  9370. or even fail.
  9371. Range is 0 to INT_MAX. Default is 0.
  9372. @item x
  9373. @item y
  9374. The expressions which specify the offsets where text will be drawn
  9375. within the video frame. They are relative to the top/left border of the
  9376. output image.
  9377. The default value of @var{x} and @var{y} is "0".
  9378. See below for the list of accepted constants and functions.
  9379. @end table
  9380. The parameters for @var{x} and @var{y} are expressions containing the
  9381. following constants and functions:
  9382. @table @option
  9383. @item dar
  9384. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  9385. @item hsub
  9386. @item vsub
  9387. horizontal and vertical chroma subsample values. For example for the
  9388. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9389. @item line_h, lh
  9390. the height of each text line
  9391. @item main_h, h, H
  9392. the input height
  9393. @item main_w, w, W
  9394. the input width
  9395. @item max_glyph_a, ascent
  9396. the maximum distance from the baseline to the highest/upper grid
  9397. coordinate used to place a glyph outline point, for all the rendered
  9398. glyphs.
  9399. It is a positive value, due to the grid's orientation with the Y axis
  9400. upwards.
  9401. @item max_glyph_d, descent
  9402. the maximum distance from the baseline to the lowest grid coordinate
  9403. used to place a glyph outline point, for all the rendered glyphs.
  9404. This is a negative value, due to the grid's orientation, with the Y axis
  9405. upwards.
  9406. @item max_glyph_h
  9407. maximum glyph height, that is the maximum height for all the glyphs
  9408. contained in the rendered text, it is equivalent to @var{ascent} -
  9409. @var{descent}.
  9410. @item max_glyph_w
  9411. maximum glyph width, that is the maximum width for all the glyphs
  9412. contained in the rendered text
  9413. @item n
  9414. the number of input frame, starting from 0
  9415. @item rand(min, max)
  9416. return a random number included between @var{min} and @var{max}
  9417. @item sar
  9418. The input sample aspect ratio.
  9419. @item t
  9420. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9421. @item text_h, th
  9422. the height of the rendered text
  9423. @item text_w, tw
  9424. the width of the rendered text
  9425. @item x
  9426. @item y
  9427. the x and y offset coordinates where the text is drawn.
  9428. These parameters allow the @var{x} and @var{y} expressions to refer
  9429. to each other, so you can for example specify @code{y=x/dar}.
  9430. @item pict_type
  9431. A one character description of the current frame's picture type.
  9432. @item pkt_pos
  9433. The current packet's position in the input file or stream
  9434. (in bytes, from the start of the input). A value of -1 indicates
  9435. this info is not available.
  9436. @item duration
  9437. The current packet's duration, in seconds.
  9438. @item pkt_size
  9439. The current packet's size (in bytes).
  9440. @end table
  9441. @anchor{drawtext_expansion}
  9442. @subsection Text expansion
  9443. If @option{expansion} is set to @code{strftime},
  9444. the filter recognizes strftime() sequences in the provided text and
  9445. expands them accordingly. Check the documentation of strftime(). This
  9446. feature is deprecated.
  9447. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  9448. If @option{expansion} is set to @code{normal} (which is the default),
  9449. the following expansion mechanism is used.
  9450. The backslash character @samp{\}, followed by any character, always expands to
  9451. the second character.
  9452. Sequences of the form @code{%@{...@}} are expanded. The text between the
  9453. braces is a function name, possibly followed by arguments separated by ':'.
  9454. If the arguments contain special characters or delimiters (':' or '@}'),
  9455. they should be escaped.
  9456. Note that they probably must also be escaped as the value for the
  9457. @option{text} option in the filter argument string and as the filter
  9458. argument in the filtergraph description, and possibly also for the shell,
  9459. that makes up to four levels of escaping; using a text file avoids these
  9460. problems.
  9461. The following functions are available:
  9462. @table @command
  9463. @item expr, e
  9464. The expression evaluation result.
  9465. It must take one argument specifying the expression to be evaluated,
  9466. which accepts the same constants and functions as the @var{x} and
  9467. @var{y} values. Note that not all constants should be used, for
  9468. example the text size is not known when evaluating the expression, so
  9469. the constants @var{text_w} and @var{text_h} will have an undefined
  9470. value.
  9471. @item expr_int_format, eif
  9472. Evaluate the expression's value and output as formatted integer.
  9473. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  9474. The second argument specifies the output format. Allowed values are @samp{x},
  9475. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  9476. @code{printf} function.
  9477. The third parameter is optional and sets the number of positions taken by the output.
  9478. It can be used to add padding with zeros from the left.
  9479. @item gmtime
  9480. The time at which the filter is running, expressed in UTC.
  9481. It can accept an argument: a strftime() format string.
  9482. The format string is extended to support the variable @var{%[1-6]N}
  9483. which prints fractions of the second with optionally specified number of digits.
  9484. @item localtime
  9485. The time at which the filter is running, expressed in the local time zone.
  9486. It can accept an argument: a strftime() format string.
  9487. The format string is extended to support the variable @var{%[1-6]N}
  9488. which prints fractions of the second with optionally specified number of digits.
  9489. @item metadata
  9490. Frame metadata. Takes one or two arguments.
  9491. The first argument is mandatory and specifies the metadata key.
  9492. The second argument is optional and specifies a default value, used when the
  9493. metadata key is not found or empty.
  9494. Available metadata can be identified by inspecting entries
  9495. starting with TAG included within each frame section
  9496. printed by running @code{ffprobe -show_frames}.
  9497. String metadata generated in filters leading to
  9498. the drawtext filter are also available.
  9499. @item n, frame_num
  9500. The frame number, starting from 0.
  9501. @item pict_type
  9502. A one character description of the current picture type.
  9503. @item pts
  9504. The timestamp of the current frame.
  9505. It can take up to three arguments.
  9506. The first argument is the format of the timestamp; it defaults to @code{flt}
  9507. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  9508. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  9509. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  9510. @code{localtime} stands for the timestamp of the frame formatted as
  9511. local time zone time.
  9512. The second argument is an offset added to the timestamp.
  9513. If the format is set to @code{hms}, a third argument @code{24HH} may be
  9514. supplied to present the hour part of the formatted timestamp in 24h format
  9515. (00-23).
  9516. If the format is set to @code{localtime} or @code{gmtime},
  9517. a third argument may be supplied: a strftime() format string.
  9518. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  9519. @end table
  9520. @subsection Commands
  9521. This filter supports altering parameters via commands:
  9522. @table @option
  9523. @item reinit
  9524. Alter existing filter parameters.
  9525. Syntax for the argument is the same as for filter invocation, e.g.
  9526. @example
  9527. fontsize=56:fontcolor=green:text='Hello World'
  9528. @end example
  9529. Full filter invocation with sendcmd would look like this:
  9530. @example
  9531. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  9532. @end example
  9533. @end table
  9534. If the entire argument can't be parsed or applied as valid values then the filter will
  9535. continue with its existing parameters.
  9536. @subsection Examples
  9537. @itemize
  9538. @item
  9539. Draw "Test Text" with font FreeSerif, using the default values for the
  9540. optional parameters.
  9541. @example
  9542. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  9543. @end example
  9544. @item
  9545. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  9546. and y=50 (counting from the top-left corner of the screen), text is
  9547. yellow with a red box around it. Both the text and the box have an
  9548. opacity of 20%.
  9549. @example
  9550. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  9551. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  9552. @end example
  9553. Note that the double quotes are not necessary if spaces are not used
  9554. within the parameter list.
  9555. @item
  9556. Show the text at the center of the video frame:
  9557. @example
  9558. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  9559. @end example
  9560. @item
  9561. Show the text at a random position, switching to a new position every 30 seconds:
  9562. @example
  9563. 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)"
  9564. @end example
  9565. @item
  9566. Show a text line sliding from right to left in the last row of the video
  9567. frame. The file @file{LONG_LINE} is assumed to contain a single line
  9568. with no newlines.
  9569. @example
  9570. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  9571. @end example
  9572. @item
  9573. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  9574. @example
  9575. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  9576. @end example
  9577. @item
  9578. Draw a single green letter "g", at the center of the input video.
  9579. The glyph baseline is placed at half screen height.
  9580. @example
  9581. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  9582. @end example
  9583. @item
  9584. Show text for 1 second every 3 seconds:
  9585. @example
  9586. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  9587. @end example
  9588. @item
  9589. Use fontconfig to set the font. Note that the colons need to be escaped.
  9590. @example
  9591. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  9592. @end example
  9593. @item
  9594. Draw "Test Text" with font size dependent on height of the video.
  9595. @example
  9596. drawtext="text='Test Text': fontsize=h/30: x=(w-text_w)/2: y=(h-text_h*2)"
  9597. @end example
  9598. @item
  9599. Print the date of a real-time encoding (see strftime(3)):
  9600. @example
  9601. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  9602. @end example
  9603. @item
  9604. Show text fading in and out (appearing/disappearing):
  9605. @example
  9606. #!/bin/sh
  9607. DS=1.0 # display start
  9608. DE=10.0 # display end
  9609. FID=1.5 # fade in duration
  9610. FOD=5 # fade out duration
  9611. 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 @}"
  9612. @end example
  9613. @item
  9614. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  9615. and the @option{fontsize} value are included in the @option{y} offset.
  9616. @example
  9617. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  9618. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  9619. @end example
  9620. @item
  9621. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  9622. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  9623. must have option @option{-export_path_metadata 1} for the special metadata fields
  9624. to be available for filters.
  9625. @example
  9626. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  9627. @end example
  9628. @end itemize
  9629. For more information about libfreetype, check:
  9630. @url{http://www.freetype.org/}.
  9631. For more information about fontconfig, check:
  9632. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  9633. For more information about libfribidi, check:
  9634. @url{http://fribidi.org/}.
  9635. @section edgedetect
  9636. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  9637. The filter accepts the following options:
  9638. @table @option
  9639. @item low
  9640. @item high
  9641. Set low and high threshold values used by the Canny thresholding
  9642. algorithm.
  9643. The high threshold selects the "strong" edge pixels, which are then
  9644. connected through 8-connectivity with the "weak" edge pixels selected
  9645. by the low threshold.
  9646. @var{low} and @var{high} threshold values must be chosen in the range
  9647. [0,1], and @var{low} should be lesser or equal to @var{high}.
  9648. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  9649. is @code{50/255}.
  9650. @item mode
  9651. Define the drawing mode.
  9652. @table @samp
  9653. @item wires
  9654. Draw white/gray wires on black background.
  9655. @item colormix
  9656. Mix the colors to create a paint/cartoon effect.
  9657. @item canny
  9658. Apply Canny edge detector on all selected planes.
  9659. @end table
  9660. Default value is @var{wires}.
  9661. @item planes
  9662. Select planes for filtering. By default all available planes are filtered.
  9663. @end table
  9664. @subsection Examples
  9665. @itemize
  9666. @item
  9667. Standard edge detection with custom values for the hysteresis thresholding:
  9668. @example
  9669. edgedetect=low=0.1:high=0.4
  9670. @end example
  9671. @item
  9672. Painting effect without thresholding:
  9673. @example
  9674. edgedetect=mode=colormix:high=0
  9675. @end example
  9676. @end itemize
  9677. @section elbg
  9678. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  9679. For each input image, the filter will compute the optimal mapping from
  9680. the input to the output given the codebook length, that is the number
  9681. of distinct output colors.
  9682. This filter accepts the following options.
  9683. @table @option
  9684. @item codebook_length, l
  9685. Set codebook length. The value must be a positive integer, and
  9686. represents the number of distinct output colors. Default value is 256.
  9687. @item nb_steps, n
  9688. Set the maximum number of iterations to apply for computing the optimal
  9689. mapping. The higher the value the better the result and the higher the
  9690. computation time. Default value is 1.
  9691. @item seed, s
  9692. Set a random seed, must be an integer included between 0 and
  9693. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  9694. will try to use a good random seed on a best effort basis.
  9695. @item pal8
  9696. Set pal8 output pixel format. This option does not work with codebook
  9697. length greater than 256. Default is disabled.
  9698. @item use_alpha
  9699. Include alpha values in the quantization calculation. Allows creating
  9700. palettized output images (e.g. PNG8) with multiple alpha smooth blending.
  9701. @end table
  9702. @section entropy
  9703. Measure graylevel entropy in histogram of color channels of video frames.
  9704. It accepts the following parameters:
  9705. @table @option
  9706. @item mode
  9707. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  9708. @var{diff} mode measures entropy of histogram delta values, absolute differences
  9709. between neighbour histogram values.
  9710. @end table
  9711. @section epx
  9712. Apply the EPX magnification filter which is designed for pixel art.
  9713. It accepts the following option:
  9714. @table @option
  9715. @item n
  9716. Set the scaling dimension: @code{2} for @code{2xEPX}, @code{3} for
  9717. @code{3xEPX}.
  9718. Default is @code{3}.
  9719. @end table
  9720. @section eq
  9721. Set brightness, contrast, saturation and approximate gamma adjustment.
  9722. The filter accepts the following options:
  9723. @table @option
  9724. @item contrast
  9725. Set the contrast expression. The value must be a float value in range
  9726. @code{-1000.0} to @code{1000.0}. The default value is "1".
  9727. @item brightness
  9728. Set the brightness expression. The value must be a float value in
  9729. range @code{-1.0} to @code{1.0}. The default value is "0".
  9730. @item saturation
  9731. Set the saturation expression. The value must be a float in
  9732. range @code{0.0} to @code{3.0}. The default value is "1".
  9733. @item gamma
  9734. Set the gamma expression. The value must be a float in range
  9735. @code{0.1} to @code{10.0}. The default value is "1".
  9736. @item gamma_r
  9737. Set the gamma expression for red. The value must be a float in
  9738. range @code{0.1} to @code{10.0}. The default value is "1".
  9739. @item gamma_g
  9740. Set the gamma expression for green. The value must be a float in range
  9741. @code{0.1} to @code{10.0}. The default value is "1".
  9742. @item gamma_b
  9743. Set the gamma expression for blue. The value must be a float in range
  9744. @code{0.1} to @code{10.0}. The default value is "1".
  9745. @item gamma_weight
  9746. Set the gamma weight expression. It can be used to reduce the effect
  9747. of a high gamma value on bright image areas, e.g. keep them from
  9748. getting overamplified and just plain white. The value must be a float
  9749. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  9750. gamma correction all the way down while @code{1.0} leaves it at its
  9751. full strength. Default is "1".
  9752. @item eval
  9753. Set when the expressions for brightness, contrast, saturation and
  9754. gamma expressions are evaluated.
  9755. It accepts the following values:
  9756. @table @samp
  9757. @item init
  9758. only evaluate expressions once during the filter initialization or
  9759. when a command is processed
  9760. @item frame
  9761. evaluate expressions for each incoming frame
  9762. @end table
  9763. Default value is @samp{init}.
  9764. @end table
  9765. The expressions accept the following parameters:
  9766. @table @option
  9767. @item n
  9768. frame count of the input frame starting from 0
  9769. @item pos
  9770. byte position of the corresponding packet in the input file, NAN if
  9771. unspecified
  9772. @item r
  9773. frame rate of the input video, NAN if the input frame rate is unknown
  9774. @item t
  9775. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9776. @end table
  9777. @subsection Commands
  9778. The filter supports the following commands:
  9779. @table @option
  9780. @item contrast
  9781. Set the contrast expression.
  9782. @item brightness
  9783. Set the brightness expression.
  9784. @item saturation
  9785. Set the saturation expression.
  9786. @item gamma
  9787. Set the gamma expression.
  9788. @item gamma_r
  9789. Set the gamma_r expression.
  9790. @item gamma_g
  9791. Set gamma_g expression.
  9792. @item gamma_b
  9793. Set gamma_b expression.
  9794. @item gamma_weight
  9795. Set gamma_weight expression.
  9796. The command accepts the same syntax of the corresponding option.
  9797. If the specified expression is not valid, it is kept at its current
  9798. value.
  9799. @end table
  9800. @anchor{erosion}
  9801. @section erosion
  9802. Apply erosion effect to the video.
  9803. This filter replaces the pixel by the local(3x3) minimum.
  9804. It accepts the following options:
  9805. @table @option
  9806. @item threshold0
  9807. @item threshold1
  9808. @item threshold2
  9809. @item threshold3
  9810. Limit the maximum change for each plane, default is 65535.
  9811. If 0, plane will remain unchanged.
  9812. @item coordinates
  9813. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  9814. pixels are used.
  9815. Flags to local 3x3 coordinates maps like this:
  9816. 1 2 3
  9817. 4 5
  9818. 6 7 8
  9819. @end table
  9820. @subsection Commands
  9821. This filter supports the all above options as @ref{commands}.
  9822. @section estdif
  9823. Deinterlace the input video ("estdif" stands for "Edge Slope
  9824. Tracing Deinterlacing Filter").
  9825. Spatial only filter that uses edge slope tracing algorithm
  9826. to interpolate missing lines.
  9827. It accepts the following parameters:
  9828. @table @option
  9829. @item mode
  9830. The interlacing mode to adopt. It accepts one of the following values:
  9831. @table @option
  9832. @item frame
  9833. Output one frame for each frame.
  9834. @item field
  9835. Output one frame for each field.
  9836. @end table
  9837. The default value is @code{field}.
  9838. @item parity
  9839. The picture field parity assumed for the input interlaced video. It accepts one
  9840. of the following values:
  9841. @table @option
  9842. @item tff
  9843. Assume the top field is first.
  9844. @item bff
  9845. Assume the bottom field is first.
  9846. @item auto
  9847. Enable automatic detection of field parity.
  9848. @end table
  9849. The default value is @code{auto}.
  9850. If the interlacing is unknown or the decoder does not export this information,
  9851. top field first will be assumed.
  9852. @item deint
  9853. Specify which frames to deinterlace. Accepts one of the following
  9854. values:
  9855. @table @option
  9856. @item all
  9857. Deinterlace all frames.
  9858. @item interlaced
  9859. Only deinterlace frames marked as interlaced.
  9860. @end table
  9861. The default value is @code{all}.
  9862. @item rslope
  9863. Specify the search radius for edge slope tracing. Default value is 1.
  9864. Allowed range is from 1 to 15.
  9865. @item redge
  9866. Specify the search radius for best edge matching. Default value is 2.
  9867. Allowed range is from 0 to 15.
  9868. @item ecost
  9869. Specify the edge cost for edge matching. Default value is 1.0.
  9870. Allowed range is from 0 to 9.
  9871. @item mcost
  9872. Specify the middle cost for edge matching. Default value is 0.5.
  9873. Allowed range is from 0 to 1.
  9874. @item dcost
  9875. Specify the distance cost for edge matching. Default value is 0.5.
  9876. Allowed range is from 0 to 1.
  9877. @item interp
  9878. Specify the interpolation used. Default is 4-point interpolation. It accepts one
  9879. of the following values:
  9880. @table @option
  9881. @item 2p
  9882. Two-point interpolation.
  9883. @item 4p
  9884. Four-point interpolation.
  9885. @item 6p
  9886. Six-point interpolation.
  9887. @end table
  9888. @end table
  9889. @subsection Commands
  9890. This filter supports same @ref{commands} as options.
  9891. @section exposure
  9892. Adjust exposure of the video stream.
  9893. The filter accepts the following options:
  9894. @table @option
  9895. @item exposure
  9896. Set the exposure correction in EV. Allowed range is from -3.0 to 3.0 EV
  9897. Default value is 0 EV.
  9898. @item black
  9899. Set the black level correction. Allowed range is from -1.0 to 1.0.
  9900. Default value is 0.
  9901. @end table
  9902. @subsection Commands
  9903. This filter supports same @ref{commands} as options.
  9904. @section extractplanes
  9905. Extract color channel components from input video stream into
  9906. separate grayscale video streams.
  9907. The filter accepts the following option:
  9908. @table @option
  9909. @item planes
  9910. Set plane(s) to extract.
  9911. Available values for planes are:
  9912. @table @samp
  9913. @item y
  9914. @item u
  9915. @item v
  9916. @item a
  9917. @item r
  9918. @item g
  9919. @item b
  9920. @end table
  9921. Choosing planes not available in the input will result in an error.
  9922. That means you cannot select @code{r}, @code{g}, @code{b} planes
  9923. with @code{y}, @code{u}, @code{v} planes at same time.
  9924. @end table
  9925. @subsection Examples
  9926. @itemize
  9927. @item
  9928. Extract luma, u and v color channel component from input video frame
  9929. into 3 grayscale outputs:
  9930. @example
  9931. 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
  9932. @end example
  9933. @end itemize
  9934. @section fade
  9935. Apply a fade-in/out effect to the input video.
  9936. It accepts the following parameters:
  9937. @table @option
  9938. @item type, t
  9939. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  9940. effect.
  9941. Default is @code{in}.
  9942. @item start_frame, s
  9943. Specify the number of the frame to start applying the fade
  9944. effect at. Default is 0.
  9945. @item nb_frames, n
  9946. The number of frames that the fade effect lasts. At the end of the
  9947. fade-in effect, the output video will have the same intensity as the input video.
  9948. At the end of the fade-out transition, the output video will be filled with the
  9949. selected @option{color}.
  9950. Default is 25.
  9951. @item alpha
  9952. If set to 1, fade only alpha channel, if one exists on the input.
  9953. Default value is 0.
  9954. @item start_time, st
  9955. Specify the timestamp (in seconds) of the frame to start to apply the fade
  9956. effect. If both start_frame and start_time are specified, the fade will start at
  9957. whichever comes last. Default is 0.
  9958. @item duration, d
  9959. The number of seconds for which the fade effect has to last. At the end of the
  9960. fade-in effect the output video will have the same intensity as the input video,
  9961. at the end of the fade-out transition the output video will be filled with the
  9962. selected @option{color}.
  9963. If both duration and nb_frames are specified, duration is used. Default is 0
  9964. (nb_frames is used by default).
  9965. @item color, c
  9966. Specify the color of the fade. Default is "black".
  9967. @end table
  9968. @subsection Examples
  9969. @itemize
  9970. @item
  9971. Fade in the first 30 frames of video:
  9972. @example
  9973. fade=in:0:30
  9974. @end example
  9975. The command above is equivalent to:
  9976. @example
  9977. fade=t=in:s=0:n=30
  9978. @end example
  9979. @item
  9980. Fade out the last 45 frames of a 200-frame video:
  9981. @example
  9982. fade=out:155:45
  9983. fade=type=out:start_frame=155:nb_frames=45
  9984. @end example
  9985. @item
  9986. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  9987. @example
  9988. fade=in:0:25, fade=out:975:25
  9989. @end example
  9990. @item
  9991. Make the first 5 frames yellow, then fade in from frame 5-24:
  9992. @example
  9993. fade=in:5:20:color=yellow
  9994. @end example
  9995. @item
  9996. Fade in alpha over first 25 frames of video:
  9997. @example
  9998. fade=in:0:25:alpha=1
  9999. @end example
  10000. @item
  10001. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  10002. @example
  10003. fade=t=in:st=5.5:d=0.5
  10004. @end example
  10005. @end itemize
  10006. @section feedback
  10007. Apply feedback video filter.
  10008. This filter pass cropped input frames to 2nd output.
  10009. From there it can be filtered with other video filters.
  10010. After filter receives frame from 2nd input, that frame
  10011. is combined on top of original frame from 1st input and passed
  10012. to 1st output.
  10013. The typical usage is filter only part of frame.
  10014. The filter accepts the following options:
  10015. @table @option
  10016. @item x
  10017. @item y
  10018. Set the top left crop position.
  10019. @item w
  10020. @item h
  10021. Set the crop size.
  10022. @end table
  10023. @subsection Examples
  10024. @itemize
  10025. @item
  10026. Blur only top left rectangular part of video frame size 100x100 with gblur filter.
  10027. @example
  10028. [in][blurin]feedback=x=0:y=0:w=100:h=100[out][blurout];[blurout]gblur=8[blurin]
  10029. @end example
  10030. @item
  10031. Draw black box on top left part of video frame of size 100x100 with drawbox filter.
  10032. @example
  10033. [in][blurin]feedback=x=0:y=0:w=100:h=100[out][blurout];[blurout]drawbox=x=0:y=0:w=100:h=100:t=100[blurin]
  10034. @end example
  10035. @end itemize
  10036. @section fftdnoiz
  10037. Denoise frames using 3D FFT (frequency domain filtering).
  10038. The filter accepts the following options:
  10039. @table @option
  10040. @item sigma
  10041. Set the noise sigma constant. This sets denoising strength.
  10042. Default value is 1. Allowed range is from 0 to 30.
  10043. Using very high sigma with low overlap may give blocking artifacts.
  10044. @item amount
  10045. Set amount of denoising. By default all detected noise is reduced.
  10046. Default value is 1. Allowed range is from 0 to 1.
  10047. @item block
  10048. Set size of block in pixels, Default is 32, can be 8 to 256.
  10049. @item overlap
  10050. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  10051. @item method
  10052. Set denoising method. Default is @code{wiener}, can also be @code{hard}.
  10053. @item prev
  10054. Set number of previous frames to use for denoising. By default is set to 0.
  10055. @item next
  10056. Set number of next frames to to use for denoising. By default is set to 0.
  10057. @item planes
  10058. Set planes which will be filtered, by default are all available filtered
  10059. except alpha.
  10060. @end table
  10061. @section fftfilt
  10062. Apply arbitrary expressions to samples in frequency domain
  10063. @table @option
  10064. @item dc_Y
  10065. Adjust the dc value (gain) of the luma plane of the image. The filter
  10066. accepts an integer value in range @code{0} to @code{1000}. The default
  10067. value is set to @code{0}.
  10068. @item dc_U
  10069. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  10070. filter accepts an integer value in range @code{0} to @code{1000}. The
  10071. default value is set to @code{0}.
  10072. @item dc_V
  10073. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  10074. filter accepts an integer value in range @code{0} to @code{1000}. The
  10075. default value is set to @code{0}.
  10076. @item weight_Y
  10077. Set the frequency domain weight expression for the luma plane.
  10078. @item weight_U
  10079. Set the frequency domain weight expression for the 1st chroma plane.
  10080. @item weight_V
  10081. Set the frequency domain weight expression for the 2nd chroma plane.
  10082. @item eval
  10083. Set when the expressions are evaluated.
  10084. It accepts the following values:
  10085. @table @samp
  10086. @item init
  10087. Only evaluate expressions once during the filter initialization.
  10088. @item frame
  10089. Evaluate expressions for each incoming frame.
  10090. @end table
  10091. Default value is @samp{init}.
  10092. The filter accepts the following variables:
  10093. @item X
  10094. @item Y
  10095. The coordinates of the current sample.
  10096. @item W
  10097. @item H
  10098. The width and height of the image.
  10099. @item N
  10100. The number of input frame, starting from 0.
  10101. @item WS
  10102. @item HS
  10103. The size of FFT array for horizontal and vertical processing.
  10104. @end table
  10105. @subsection Examples
  10106. @itemize
  10107. @item
  10108. High-pass:
  10109. @example
  10110. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  10111. @end example
  10112. @item
  10113. Low-pass:
  10114. @example
  10115. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  10116. @end example
  10117. @item
  10118. Sharpen:
  10119. @example
  10120. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  10121. @end example
  10122. @item
  10123. Blur:
  10124. @example
  10125. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  10126. @end example
  10127. @end itemize
  10128. @section field
  10129. Extract a single field from an interlaced image using stride
  10130. arithmetic to avoid wasting CPU time. The output frames are marked as
  10131. non-interlaced.
  10132. The filter accepts the following options:
  10133. @table @option
  10134. @item type
  10135. Specify whether to extract the top (if the value is @code{0} or
  10136. @code{top}) or the bottom field (if the value is @code{1} or
  10137. @code{bottom}).
  10138. @end table
  10139. @section fieldhint
  10140. Create new frames by copying the top and bottom fields from surrounding frames
  10141. supplied as numbers by the hint file.
  10142. @table @option
  10143. @item hint
  10144. Set file containing hints: absolute/relative frame numbers.
  10145. There must be one line for each frame in a clip. Each line must contain two
  10146. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  10147. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  10148. is current frame number for @code{absolute} mode or out of [-1, 1] range
  10149. for @code{relative} mode. First number tells from which frame to pick up top
  10150. field and second number tells from which frame to pick up bottom field.
  10151. If optionally followed by @code{+} output frame will be marked as interlaced,
  10152. else if followed by @code{-} output frame will be marked as progressive, else
  10153. it will be marked same as input frame.
  10154. If optionally followed by @code{t} output frame will use only top field, or in
  10155. case of @code{b} it will use only bottom field.
  10156. If line starts with @code{#} or @code{;} that line is skipped.
  10157. @item mode
  10158. Can be item @code{absolute} or @code{relative} or @code{pattern}. Default is @code{absolute}.
  10159. The @code{pattern} mode is same as @code{relative} mode, except at last entry of file if there
  10160. are more frames to process than @code{hint} file is seek back to start.
  10161. @end table
  10162. Example of first several lines of @code{hint} file for @code{relative} mode:
  10163. @example
  10164. 0,0 - # first frame
  10165. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  10166. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  10167. 1,0 -
  10168. 0,0 -
  10169. 0,0 -
  10170. 1,0 -
  10171. 1,0 -
  10172. 1,0 -
  10173. 0,0 -
  10174. 0,0 -
  10175. 1,0 -
  10176. 1,0 -
  10177. 1,0 -
  10178. 0,0 -
  10179. @end example
  10180. @section fieldmatch
  10181. Field matching filter for inverse telecine. It is meant to reconstruct the
  10182. progressive frames from a telecined stream. The filter does not drop duplicated
  10183. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  10184. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  10185. The separation of the field matching and the decimation is notably motivated by
  10186. the possibility of inserting a de-interlacing filter fallback between the two.
  10187. If the source has mixed telecined and real interlaced content,
  10188. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  10189. But these remaining combed frames will be marked as interlaced, and thus can be
  10190. de-interlaced by a later filter such as @ref{yadif} before decimation.
  10191. In addition to the various configuration options, @code{fieldmatch} can take an
  10192. optional second stream, activated through the @option{ppsrc} option. If
  10193. enabled, the frames reconstruction will be based on the fields and frames from
  10194. this second stream. This allows the first input to be pre-processed in order to
  10195. help the various algorithms of the filter, while keeping the output lossless
  10196. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  10197. or brightness/contrast adjustments can help.
  10198. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  10199. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  10200. which @code{fieldmatch} is based on. While the semantic and usage are very
  10201. close, some behaviour and options names can differ.
  10202. The @ref{decimate} filter currently only works for constant frame rate input.
  10203. If your input has mixed telecined (30fps) and progressive content with a lower
  10204. framerate like 24fps use the following filterchain to produce the necessary cfr
  10205. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  10206. The filter accepts the following options:
  10207. @table @option
  10208. @item order
  10209. Specify the assumed field order of the input stream. Available values are:
  10210. @table @samp
  10211. @item auto
  10212. Auto detect parity (use FFmpeg's internal parity value).
  10213. @item bff
  10214. Assume bottom field first.
  10215. @item tff
  10216. Assume top field first.
  10217. @end table
  10218. Note that it is sometimes recommended not to trust the parity announced by the
  10219. stream.
  10220. Default value is @var{auto}.
  10221. @item mode
  10222. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  10223. sense that it won't risk creating jerkiness due to duplicate frames when
  10224. possible, but if there are bad edits or blended fields it will end up
  10225. outputting combed frames when a good match might actually exist. On the other
  10226. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  10227. but will almost always find a good frame if there is one. The other values are
  10228. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  10229. jerkiness and creating duplicate frames versus finding good matches in sections
  10230. with bad edits, orphaned fields, blended fields, etc.
  10231. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  10232. Available values are:
  10233. @table @samp
  10234. @item pc
  10235. 2-way matching (p/c)
  10236. @item pc_n
  10237. 2-way matching, and trying 3rd match if still combed (p/c + n)
  10238. @item pc_u
  10239. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  10240. @item pc_n_ub
  10241. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  10242. still combed (p/c + n + u/b)
  10243. @item pcn
  10244. 3-way matching (p/c/n)
  10245. @item pcn_ub
  10246. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  10247. detected as combed (p/c/n + u/b)
  10248. @end table
  10249. The parenthesis at the end indicate the matches that would be used for that
  10250. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  10251. @var{top}).
  10252. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  10253. the slowest.
  10254. Default value is @var{pc_n}.
  10255. @item ppsrc
  10256. Mark the main input stream as a pre-processed input, and enable the secondary
  10257. input stream as the clean source to pick the fields from. See the filter
  10258. introduction for more details. It is similar to the @option{clip2} feature from
  10259. VFM/TFM.
  10260. Default value is @code{0} (disabled).
  10261. @item field
  10262. Set the field to match from. It is recommended to set this to the same value as
  10263. @option{order} unless you experience matching failures with that setting. In
  10264. certain circumstances changing the field that is used to match from can have a
  10265. large impact on matching performance. Available values are:
  10266. @table @samp
  10267. @item auto
  10268. Automatic (same value as @option{order}).
  10269. @item bottom
  10270. Match from the bottom field.
  10271. @item top
  10272. Match from the top field.
  10273. @end table
  10274. Default value is @var{auto}.
  10275. @item mchroma
  10276. Set whether or not chroma is included during the match comparisons. In most
  10277. cases it is recommended to leave this enabled. You should set this to @code{0}
  10278. only if your clip has bad chroma problems such as heavy rainbowing or other
  10279. artifacts. Setting this to @code{0} could also be used to speed things up at
  10280. the cost of some accuracy.
  10281. Default value is @code{1}.
  10282. @item y0
  10283. @item y1
  10284. These define an exclusion band which excludes the lines between @option{y0} and
  10285. @option{y1} from being included in the field matching decision. An exclusion
  10286. band can be used to ignore subtitles, a logo, or other things that may
  10287. interfere with the matching. @option{y0} sets the starting scan line and
  10288. @option{y1} sets the ending line; all lines in between @option{y0} and
  10289. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  10290. @option{y0} and @option{y1} to the same value will disable the feature.
  10291. @option{y0} and @option{y1} defaults to @code{0}.
  10292. @item scthresh
  10293. Set the scene change detection threshold as a percentage of maximum change on
  10294. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  10295. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  10296. @option{scthresh} is @code{[0.0, 100.0]}.
  10297. Default value is @code{12.0}.
  10298. @item combmatch
  10299. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  10300. account the combed scores of matches when deciding what match to use as the
  10301. final match. Available values are:
  10302. @table @samp
  10303. @item none
  10304. No final matching based on combed scores.
  10305. @item sc
  10306. Combed scores are only used when a scene change is detected.
  10307. @item full
  10308. Use combed scores all the time.
  10309. @end table
  10310. Default is @var{sc}.
  10311. @item combdbg
  10312. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  10313. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  10314. Available values are:
  10315. @table @samp
  10316. @item none
  10317. No forced calculation.
  10318. @item pcn
  10319. Force p/c/n calculations.
  10320. @item pcnub
  10321. Force p/c/n/u/b calculations.
  10322. @end table
  10323. Default value is @var{none}.
  10324. @item cthresh
  10325. This is the area combing threshold used for combed frame detection. This
  10326. essentially controls how "strong" or "visible" combing must be to be detected.
  10327. Larger values mean combing must be more visible and smaller values mean combing
  10328. can be less visible or strong and still be detected. Valid settings are from
  10329. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  10330. be detected as combed). This is basically a pixel difference value. A good
  10331. range is @code{[8, 12]}.
  10332. Default value is @code{9}.
  10333. @item chroma
  10334. Sets whether or not chroma is considered in the combed frame decision. Only
  10335. disable this if your source has chroma problems (rainbowing, etc.) that are
  10336. causing problems for the combed frame detection with chroma enabled. Actually,
  10337. using @option{chroma}=@var{0} is usually more reliable, except for the case
  10338. where there is chroma only combing in the source.
  10339. Default value is @code{0}.
  10340. @item blockx
  10341. @item blocky
  10342. Respectively set the x-axis and y-axis size of the window used during combed
  10343. frame detection. This has to do with the size of the area in which
  10344. @option{combpel} pixels are required to be detected as combed for a frame to be
  10345. declared combed. See the @option{combpel} parameter description for more info.
  10346. Possible values are any number that is a power of 2 starting at 4 and going up
  10347. to 512.
  10348. Default value is @code{16}.
  10349. @item combpel
  10350. The number of combed pixels inside any of the @option{blocky} by
  10351. @option{blockx} size blocks on the frame for the frame to be detected as
  10352. combed. While @option{cthresh} controls how "visible" the combing must be, this
  10353. setting controls "how much" combing there must be in any localized area (a
  10354. window defined by the @option{blockx} and @option{blocky} settings) on the
  10355. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  10356. which point no frames will ever be detected as combed). This setting is known
  10357. as @option{MI} in TFM/VFM vocabulary.
  10358. Default value is @code{80}.
  10359. @end table
  10360. @anchor{p/c/n/u/b meaning}
  10361. @subsection p/c/n/u/b meaning
  10362. @subsubsection p/c/n
  10363. We assume the following telecined stream:
  10364. @example
  10365. Top fields: 1 2 2 3 4
  10366. Bottom fields: 1 2 3 4 4
  10367. @end example
  10368. The numbers correspond to the progressive frame the fields relate to. Here, the
  10369. first two frames are progressive, the 3rd and 4th are combed, and so on.
  10370. When @code{fieldmatch} is configured to run a matching from bottom
  10371. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  10372. @example
  10373. Input stream:
  10374. T 1 2 2 3 4
  10375. B 1 2 3 4 4 <-- matching reference
  10376. Matches: c c n n c
  10377. Output stream:
  10378. T 1 2 3 4 4
  10379. B 1 2 3 4 4
  10380. @end example
  10381. As a result of the field matching, we can see that some frames get duplicated.
  10382. To perform a complete inverse telecine, you need to rely on a decimation filter
  10383. after this operation. See for instance the @ref{decimate} filter.
  10384. The same operation now matching from top fields (@option{field}=@var{top})
  10385. looks like this:
  10386. @example
  10387. Input stream:
  10388. T 1 2 2 3 4 <-- matching reference
  10389. B 1 2 3 4 4
  10390. Matches: c c p p c
  10391. Output stream:
  10392. T 1 2 2 3 4
  10393. B 1 2 2 3 4
  10394. @end example
  10395. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  10396. basically, they refer to the frame and field of the opposite parity:
  10397. @itemize
  10398. @item @var{p} matches the field of the opposite parity in the previous frame
  10399. @item @var{c} matches the field of the opposite parity in the current frame
  10400. @item @var{n} matches the field of the opposite parity in the next frame
  10401. @end itemize
  10402. @subsubsection u/b
  10403. The @var{u} and @var{b} matching are a bit special in the sense that they match
  10404. from the opposite parity flag. In the following examples, we assume that we are
  10405. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  10406. 'x' is placed above and below each matched fields.
  10407. With bottom matching (@option{field}=@var{bottom}):
  10408. @example
  10409. Match: c p n b u
  10410. x x x x x
  10411. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  10412. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  10413. x x x x x
  10414. Output frames:
  10415. 2 1 2 2 2
  10416. 2 2 2 1 3
  10417. @end example
  10418. With top matching (@option{field}=@var{top}):
  10419. @example
  10420. Match: c p n b u
  10421. x x x x x
  10422. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  10423. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  10424. x x x x x
  10425. Output frames:
  10426. 2 2 2 1 2
  10427. 2 1 3 2 2
  10428. @end example
  10429. @subsection Examples
  10430. Simple IVTC of a top field first telecined stream:
  10431. @example
  10432. fieldmatch=order=tff:combmatch=none, decimate
  10433. @end example
  10434. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  10435. @example
  10436. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  10437. @end example
  10438. @section fieldorder
  10439. Transform the field order of the input video.
  10440. It accepts the following parameters:
  10441. @table @option
  10442. @item order
  10443. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  10444. for bottom field first.
  10445. @end table
  10446. The default value is @samp{tff}.
  10447. The transformation is done by shifting the picture content up or down
  10448. by one line, and filling the remaining line with appropriate picture content.
  10449. This method is consistent with most broadcast field order converters.
  10450. If the input video is not flagged as being interlaced, or it is already
  10451. flagged as being of the required output field order, then this filter does
  10452. not alter the incoming video.
  10453. It is very useful when converting to or from PAL DV material,
  10454. which is bottom field first.
  10455. For example:
  10456. @example
  10457. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  10458. @end example
  10459. @section fifo, afifo
  10460. Buffer input images and send them when they are requested.
  10461. It is mainly useful when auto-inserted by the libavfilter
  10462. framework.
  10463. It does not take parameters.
  10464. @section fillborders
  10465. Fill borders of the input video, without changing video stream dimensions.
  10466. Sometimes video can have garbage at the four edges and you may not want to
  10467. crop video input to keep size multiple of some number.
  10468. This filter accepts the following options:
  10469. @table @option
  10470. @item left
  10471. Number of pixels to fill from left border.
  10472. @item right
  10473. Number of pixels to fill from right border.
  10474. @item top
  10475. Number of pixels to fill from top border.
  10476. @item bottom
  10477. Number of pixels to fill from bottom border.
  10478. @item mode
  10479. Set fill mode.
  10480. It accepts the following values:
  10481. @table @samp
  10482. @item smear
  10483. fill pixels using outermost pixels
  10484. @item mirror
  10485. fill pixels using mirroring (half sample symmetric)
  10486. @item fixed
  10487. fill pixels with constant value
  10488. @item reflect
  10489. fill pixels using reflecting (whole sample symmetric)
  10490. @item wrap
  10491. fill pixels using wrapping
  10492. @item fade
  10493. fade pixels to constant value
  10494. @item margins
  10495. fill pixels at top and bottom with weighted averages pixels near borders
  10496. @end table
  10497. Default is @var{smear}.
  10498. @item color
  10499. Set color for pixels in fixed or fade mode. Default is @var{black}.
  10500. @end table
  10501. @subsection Commands
  10502. This filter supports same @ref{commands} as options.
  10503. The command accepts the same syntax of the corresponding option.
  10504. If the specified expression is not valid, it is kept at its current
  10505. value.
  10506. @section find_rect
  10507. Find a rectangular object
  10508. It accepts the following options:
  10509. @table @option
  10510. @item object
  10511. Filepath of the object image, needs to be in gray8.
  10512. @item threshold
  10513. Detection threshold, default is 0.5.
  10514. @item mipmaps
  10515. Number of mipmaps, default is 3.
  10516. @item xmin, ymin, xmax, ymax
  10517. Specifies the rectangle in which to search.
  10518. @item discard
  10519. Discard frames where object is not detected. Default is disabled.
  10520. @end table
  10521. @subsection Examples
  10522. @itemize
  10523. @item
  10524. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  10525. @example
  10526. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  10527. @end example
  10528. @end itemize
  10529. @section floodfill
  10530. Flood area with values of same pixel components with another values.
  10531. It accepts the following options:
  10532. @table @option
  10533. @item x
  10534. Set pixel x coordinate.
  10535. @item y
  10536. Set pixel y coordinate.
  10537. @item s0
  10538. Set source #0 component value.
  10539. @item s1
  10540. Set source #1 component value.
  10541. @item s2
  10542. Set source #2 component value.
  10543. @item s3
  10544. Set source #3 component value.
  10545. @item d0
  10546. Set destination #0 component value.
  10547. @item d1
  10548. Set destination #1 component value.
  10549. @item d2
  10550. Set destination #2 component value.
  10551. @item d3
  10552. Set destination #3 component value.
  10553. @end table
  10554. @anchor{format}
  10555. @section format
  10556. Convert the input video to one of the specified pixel formats.
  10557. Libavfilter will try to pick one that is suitable as input to
  10558. the next filter.
  10559. It accepts the following parameters:
  10560. @table @option
  10561. @item pix_fmts
  10562. A '|'-separated list of pixel format names, such as
  10563. "pix_fmts=yuv420p|monow|rgb24".
  10564. @end table
  10565. @subsection Examples
  10566. @itemize
  10567. @item
  10568. Convert the input video to the @var{yuv420p} format
  10569. @example
  10570. format=pix_fmts=yuv420p
  10571. @end example
  10572. Convert the input video to any of the formats in the list
  10573. @example
  10574. format=pix_fmts=yuv420p|yuv444p|yuv410p
  10575. @end example
  10576. @end itemize
  10577. @anchor{fps}
  10578. @section fps
  10579. Convert the video to specified constant frame rate by duplicating or dropping
  10580. frames as necessary.
  10581. It accepts the following parameters:
  10582. @table @option
  10583. @item fps
  10584. The desired output frame rate. It accepts expressions containing the following
  10585. constants:
  10586. @table @samp
  10587. @item source_fps
  10588. The input's frame rate
  10589. @item ntsc
  10590. NTSC frame rate of @code{30000/1001}
  10591. @item pal
  10592. PAL frame rate of @code{25.0}
  10593. @item film
  10594. Film frame rate of @code{24.0}
  10595. @item ntsc_film
  10596. NTSC-film frame rate of @code{24000/1001}
  10597. @end table
  10598. The default is @code{25}.
  10599. @item start_time
  10600. Assume the first PTS should be the given value, in seconds. This allows for
  10601. padding/trimming at the start of stream. By default, no assumption is made
  10602. about the first frame's expected PTS, so no padding or trimming is done.
  10603. For example, this could be set to 0 to pad the beginning with duplicates of
  10604. the first frame if a video stream starts after the audio stream or to trim any
  10605. frames with a negative PTS.
  10606. @item round
  10607. Timestamp (PTS) rounding method.
  10608. Possible values are:
  10609. @table @option
  10610. @item zero
  10611. round towards 0
  10612. @item inf
  10613. round away from 0
  10614. @item down
  10615. round towards -infinity
  10616. @item up
  10617. round towards +infinity
  10618. @item near
  10619. round to nearest
  10620. @end table
  10621. The default is @code{near}.
  10622. @item eof_action
  10623. Action performed when reading the last frame.
  10624. Possible values are:
  10625. @table @option
  10626. @item round
  10627. Use same timestamp rounding method as used for other frames.
  10628. @item pass
  10629. Pass through last frame if input duration has not been reached yet.
  10630. @end table
  10631. The default is @code{round}.
  10632. @end table
  10633. Alternatively, the options can be specified as a flat string:
  10634. @var{fps}[:@var{start_time}[:@var{round}]].
  10635. See also the @ref{setpts} filter.
  10636. @subsection Examples
  10637. @itemize
  10638. @item
  10639. A typical usage in order to set the fps to 25:
  10640. @example
  10641. fps=fps=25
  10642. @end example
  10643. @item
  10644. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  10645. @example
  10646. fps=fps=film:round=near
  10647. @end example
  10648. @end itemize
  10649. @section framepack
  10650. Pack two different video streams into a stereoscopic video, setting proper
  10651. metadata on supported codecs. The two views should have the same size and
  10652. framerate and processing will stop when the shorter video ends. Please note
  10653. that you may conveniently adjust view properties with the @ref{scale} and
  10654. @ref{fps} filters.
  10655. It accepts the following parameters:
  10656. @table @option
  10657. @item format
  10658. The desired packing format. Supported values are:
  10659. @table @option
  10660. @item sbs
  10661. The views are next to each other (default).
  10662. @item tab
  10663. The views are on top of each other.
  10664. @item lines
  10665. The views are packed by line.
  10666. @item columns
  10667. The views are packed by column.
  10668. @item frameseq
  10669. The views are temporally interleaved.
  10670. @end table
  10671. @end table
  10672. Some examples:
  10673. @example
  10674. # Convert left and right views into a frame-sequential video
  10675. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  10676. # Convert views into a side-by-side video with the same output resolution as the input
  10677. 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
  10678. @end example
  10679. @section framerate
  10680. Change the frame rate by interpolating new video output frames from the source
  10681. frames.
  10682. This filter is not designed to function correctly with interlaced media. If
  10683. you wish to change the frame rate of interlaced media then you are required
  10684. to deinterlace before this filter and re-interlace after this filter.
  10685. A description of the accepted options follows.
  10686. @table @option
  10687. @item fps
  10688. Specify the output frames per second. This option can also be specified
  10689. as a value alone. The default is @code{50}.
  10690. @item interp_start
  10691. Specify the start of a range where the output frame will be created as a
  10692. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  10693. the default is @code{15}.
  10694. @item interp_end
  10695. Specify the end of a range where the output frame will be created as a
  10696. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  10697. the default is @code{240}.
  10698. @item scene
  10699. Specify the level at which a scene change is detected as a value between
  10700. 0 and 100 to indicate a new scene; a low value reflects a low
  10701. probability for the current frame to introduce a new scene, while a higher
  10702. value means the current frame is more likely to be one.
  10703. The default is @code{8.2}.
  10704. @item flags
  10705. Specify flags influencing the filter process.
  10706. Available value for @var{flags} is:
  10707. @table @option
  10708. @item scene_change_detect, scd
  10709. Enable scene change detection using the value of the option @var{scene}.
  10710. This flag is enabled by default.
  10711. @end table
  10712. @end table
  10713. @section framestep
  10714. Select one frame every N-th frame.
  10715. This filter accepts the following option:
  10716. @table @option
  10717. @item step
  10718. Select frame after every @code{step} frames.
  10719. Allowed values are positive integers higher than 0. Default value is @code{1}.
  10720. @end table
  10721. @section freezedetect
  10722. Detect frozen video.
  10723. This filter logs a message and sets frame metadata when it detects that the
  10724. input video has no significant change in content during a specified duration.
  10725. Video freeze detection calculates the mean average absolute difference of all
  10726. the components of video frames and compares it to a noise floor.
  10727. The printed times and duration are expressed in seconds. The
  10728. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  10729. whose timestamp equals or exceeds the detection duration and it contains the
  10730. timestamp of the first frame of the freeze. The
  10731. @code{lavfi.freezedetect.freeze_duration} and
  10732. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  10733. after the freeze.
  10734. The filter accepts the following options:
  10735. @table @option
  10736. @item noise, n
  10737. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  10738. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  10739. 0.001.
  10740. @item duration, d
  10741. Set freeze duration until notification (default is 2 seconds).
  10742. @end table
  10743. @section freezeframes
  10744. Freeze video frames.
  10745. This filter freezes video frames using frame from 2nd input.
  10746. The filter accepts the following options:
  10747. @table @option
  10748. @item first
  10749. Set number of first frame from which to start freeze.
  10750. @item last
  10751. Set number of last frame from which to end freeze.
  10752. @item replace
  10753. Set number of frame from 2nd input which will be used instead of replaced frames.
  10754. @end table
  10755. @anchor{frei0r}
  10756. @section frei0r
  10757. Apply a frei0r effect to the input video.
  10758. To enable the compilation of this filter, you need to install the frei0r
  10759. header and configure FFmpeg with @code{--enable-frei0r}.
  10760. It accepts the following parameters:
  10761. @table @option
  10762. @item filter_name
  10763. The name of the frei0r effect to load. If the environment variable
  10764. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  10765. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  10766. Otherwise, the standard frei0r paths are searched, in this order:
  10767. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  10768. @file{/usr/lib/frei0r-1/}.
  10769. @item filter_params
  10770. A '|'-separated list of parameters to pass to the frei0r effect.
  10771. @end table
  10772. A frei0r effect parameter can be a boolean (its value is either
  10773. "y" or "n"), a double, a color (specified as
  10774. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  10775. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  10776. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  10777. a position (specified as @var{X}/@var{Y}, where
  10778. @var{X} and @var{Y} are floating point numbers) and/or a string.
  10779. The number and types of parameters depend on the loaded effect. If an
  10780. effect parameter is not specified, the default value is set.
  10781. @subsection Examples
  10782. @itemize
  10783. @item
  10784. Apply the distort0r effect, setting the first two double parameters:
  10785. @example
  10786. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  10787. @end example
  10788. @item
  10789. Apply the colordistance effect, taking a color as the first parameter:
  10790. @example
  10791. frei0r=colordistance:0.2/0.3/0.4
  10792. frei0r=colordistance:violet
  10793. frei0r=colordistance:0x112233
  10794. @end example
  10795. @item
  10796. Apply the perspective effect, specifying the top left and top right image
  10797. positions:
  10798. @example
  10799. frei0r=perspective:0.2/0.2|0.8/0.2
  10800. @end example
  10801. @end itemize
  10802. For more information, see
  10803. @url{http://frei0r.dyne.org}
  10804. @subsection Commands
  10805. This filter supports the @option{filter_params} option as @ref{commands}.
  10806. @section fspp
  10807. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  10808. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  10809. processing filter, one of them is performed once per block, not per pixel.
  10810. This allows for much higher speed.
  10811. The filter accepts the following options:
  10812. @table @option
  10813. @item quality
  10814. Set quality. This option defines the number of levels for averaging. It accepts
  10815. an integer in the range 4-5. Default value is @code{4}.
  10816. @item qp
  10817. Force a constant quantization parameter. It accepts an integer in range 0-63.
  10818. If not set, the filter will use the QP from the video stream (if available).
  10819. @item strength
  10820. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  10821. more details but also more artifacts, while higher values make the image smoother
  10822. but also blurrier. Default value is @code{0} − PSNR optimal.
  10823. @item use_bframe_qp
  10824. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  10825. option may cause flicker since the B-Frames have often larger QP. Default is
  10826. @code{0} (not enabled).
  10827. @end table
  10828. @section gblur
  10829. Apply Gaussian blur filter.
  10830. The filter accepts the following options:
  10831. @table @option
  10832. @item sigma
  10833. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  10834. @item steps
  10835. Set number of steps for Gaussian approximation. Default is @code{1}.
  10836. @item planes
  10837. Set which planes to filter. By default all planes are filtered.
  10838. @item sigmaV
  10839. Set vertical sigma, if negative it will be same as @code{sigma}.
  10840. Default is @code{-1}.
  10841. @end table
  10842. @subsection Commands
  10843. This filter supports same commands as options.
  10844. The command accepts the same syntax of the corresponding option.
  10845. If the specified expression is not valid, it is kept at its current
  10846. value.
  10847. @section geq
  10848. Apply generic equation to each pixel.
  10849. The filter accepts the following options:
  10850. @table @option
  10851. @item lum_expr, lum
  10852. Set the luminance expression.
  10853. @item cb_expr, cb
  10854. Set the chrominance blue expression.
  10855. @item cr_expr, cr
  10856. Set the chrominance red expression.
  10857. @item alpha_expr, a
  10858. Set the alpha expression.
  10859. @item red_expr, r
  10860. Set the red expression.
  10861. @item green_expr, g
  10862. Set the green expression.
  10863. @item blue_expr, b
  10864. Set the blue expression.
  10865. @end table
  10866. The colorspace is selected according to the specified options. If one
  10867. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  10868. options is specified, the filter will automatically select a YCbCr
  10869. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  10870. @option{blue_expr} options is specified, it will select an RGB
  10871. colorspace.
  10872. If one of the chrominance expression is not defined, it falls back on the other
  10873. one. If no alpha expression is specified it will evaluate to opaque value.
  10874. If none of chrominance expressions are specified, they will evaluate
  10875. to the luminance expression.
  10876. The expressions can use the following variables and functions:
  10877. @table @option
  10878. @item N
  10879. The sequential number of the filtered frame, starting from @code{0}.
  10880. @item X
  10881. @item Y
  10882. The coordinates of the current sample.
  10883. @item W
  10884. @item H
  10885. The width and height of the image.
  10886. @item SW
  10887. @item SH
  10888. Width and height scale depending on the currently filtered plane. It is the
  10889. ratio between the corresponding luma plane number of pixels and the current
  10890. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  10891. @code{0.5,0.5} for chroma planes.
  10892. @item T
  10893. Time of the current frame, expressed in seconds.
  10894. @item p(x, y)
  10895. Return the value of the pixel at location (@var{x},@var{y}) of the current
  10896. plane.
  10897. @item lum(x, y)
  10898. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  10899. plane.
  10900. @item cb(x, y)
  10901. Return the value of the pixel at location (@var{x},@var{y}) of the
  10902. blue-difference chroma plane. Return 0 if there is no such plane.
  10903. @item cr(x, y)
  10904. Return the value of the pixel at location (@var{x},@var{y}) of the
  10905. red-difference chroma plane. Return 0 if there is no such plane.
  10906. @item r(x, y)
  10907. @item g(x, y)
  10908. @item b(x, y)
  10909. Return the value of the pixel at location (@var{x},@var{y}) of the
  10910. red/green/blue component. Return 0 if there is no such component.
  10911. @item alpha(x, y)
  10912. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  10913. plane. Return 0 if there is no such plane.
  10914. @item psum(x,y), lumsum(x, y), cbsum(x,y), crsum(x,y), rsum(x,y), gsum(x,y), bsum(x,y), alphasum(x,y)
  10915. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  10916. sums of samples within a rectangle. See the functions without the sum postfix.
  10917. @item interpolation
  10918. Set one of interpolation methods:
  10919. @table @option
  10920. @item nearest, n
  10921. @item bilinear, b
  10922. @end table
  10923. Default is bilinear.
  10924. @end table
  10925. For functions, if @var{x} and @var{y} are outside the area, the value will be
  10926. automatically clipped to the closer edge.
  10927. Please note that this filter can use multiple threads in which case each slice
  10928. will have its own expression state. If you want to use only a single expression
  10929. state because your expressions depend on previous state then you should limit
  10930. the number of filter threads to 1.
  10931. @subsection Examples
  10932. @itemize
  10933. @item
  10934. Flip the image horizontally:
  10935. @example
  10936. geq=p(W-X\,Y)
  10937. @end example
  10938. @item
  10939. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  10940. wavelength of 100 pixels:
  10941. @example
  10942. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  10943. @end example
  10944. @item
  10945. Generate a fancy enigmatic moving light:
  10946. @example
  10947. 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
  10948. @end example
  10949. @item
  10950. Generate a quick emboss effect:
  10951. @example
  10952. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  10953. @end example
  10954. @item
  10955. Modify RGB components depending on pixel position:
  10956. @example
  10957. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  10958. @end example
  10959. @item
  10960. Create a radial gradient that is the same size as the input (also see
  10961. the @ref{vignette} filter):
  10962. @example
  10963. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  10964. @end example
  10965. @end itemize
  10966. @section gradfun
  10967. Fix the banding artifacts that are sometimes introduced into nearly flat
  10968. regions by truncation to 8-bit color depth.
  10969. Interpolate the gradients that should go where the bands are, and
  10970. dither them.
  10971. It is designed for playback only. Do not use it prior to
  10972. lossy compression, because compression tends to lose the dither and
  10973. bring back the bands.
  10974. It accepts the following parameters:
  10975. @table @option
  10976. @item strength
  10977. The maximum amount by which the filter will change any one pixel. This is also
  10978. the threshold for detecting nearly flat regions. Acceptable values range from
  10979. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  10980. valid range.
  10981. @item radius
  10982. The neighborhood to fit the gradient to. A larger radius makes for smoother
  10983. gradients, but also prevents the filter from modifying the pixels near detailed
  10984. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  10985. values will be clipped to the valid range.
  10986. @end table
  10987. Alternatively, the options can be specified as a flat string:
  10988. @var{strength}[:@var{radius}]
  10989. @subsection Examples
  10990. @itemize
  10991. @item
  10992. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  10993. @example
  10994. gradfun=3.5:8
  10995. @end example
  10996. @item
  10997. Specify radius, omitting the strength (which will fall-back to the default
  10998. value):
  10999. @example
  11000. gradfun=radius=8
  11001. @end example
  11002. @end itemize
  11003. @anchor{graphmonitor}
  11004. @section graphmonitor
  11005. Show various filtergraph stats.
  11006. With this filter one can debug complete filtergraph.
  11007. Especially issues with links filling with queued frames.
  11008. The filter accepts the following options:
  11009. @table @option
  11010. @item size, s
  11011. Set video output size. Default is @var{hd720}.
  11012. @item opacity, o
  11013. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  11014. @item mode, m
  11015. Set output mode, can be @var{fulll} or @var{compact}.
  11016. In @var{compact} mode only filters with some queued frames have displayed stats.
  11017. @item flags, f
  11018. Set flags which enable which stats are shown in video.
  11019. Available values for flags are:
  11020. @table @samp
  11021. @item queue
  11022. Display number of queued frames in each link.
  11023. @item frame_count_in
  11024. Display number of frames taken from filter.
  11025. @item frame_count_out
  11026. Display number of frames given out from filter.
  11027. @item frame_count_delta
  11028. Display delta number of frames between above two values.
  11029. @item pts
  11030. Display current filtered frame pts.
  11031. @item pts_delta
  11032. Display pts delta between current and previous frame.
  11033. @item time
  11034. Display current filtered frame time.
  11035. @item time_delta
  11036. Display time delta between current and previous frame.
  11037. @item timebase
  11038. Display time base for filter link.
  11039. @item format
  11040. Display used format for filter link.
  11041. @item size
  11042. Display video size or number of audio channels in case of audio used by filter link.
  11043. @item rate
  11044. Display video frame rate or sample rate in case of audio used by filter link.
  11045. @item eof
  11046. Display link output status.
  11047. @item sample_count_in
  11048. Display number of samples taken from filter.
  11049. @item sample_count_out
  11050. Display number of samples given out from filter.
  11051. @item sample_count_delta
  11052. Display delta number of samples between above two values.
  11053. @end table
  11054. @item rate, r
  11055. Set upper limit for video rate of output stream, Default value is @var{25}.
  11056. This guarantee that output video frame rate will not be higher than this value.
  11057. @end table
  11058. @section grayworld
  11059. A color constancy filter that applies color correction based on the grayworld assumption
  11060. See: @url{https://www.researchgate.net/publication/275213614_A_New_Color_Correction_Method_for_Underwater_Imaging}
  11061. The algorithm uses linear light, so input
  11062. data should be linearized beforehand (and possibly correctly tagged).
  11063. @example
  11064. ffmpeg -i INPUT -vf zscale=transfer=linear,grayworld,zscale=transfer=bt709,format=yuv420p OUTPUT
  11065. @end example
  11066. @section greyedge
  11067. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  11068. and corrects the scene colors accordingly.
  11069. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  11070. The filter accepts the following options:
  11071. @table @option
  11072. @item difford
  11073. The order of differentiation to be applied on the scene. Must be chosen in the range
  11074. [0,2] and default value is 1.
  11075. @item minknorm
  11076. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  11077. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  11078. max value instead of calculating Minkowski distance.
  11079. @item sigma
  11080. The standard deviation of Gaussian blur to be applied on the scene. Must be
  11081. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  11082. can't be equal to 0 if @var{difford} is greater than 0.
  11083. @end table
  11084. @subsection Examples
  11085. @itemize
  11086. @item
  11087. Grey Edge:
  11088. @example
  11089. greyedge=difford=1:minknorm=5:sigma=2
  11090. @end example
  11091. @item
  11092. Max Edge:
  11093. @example
  11094. greyedge=difford=1:minknorm=0:sigma=2
  11095. @end example
  11096. @end itemize
  11097. @section guided
  11098. Apply guided filter for edge-preserving smoothing, dehazing and so on.
  11099. The filter accepts the following options:
  11100. @table @option
  11101. @item radius
  11102. Set the box radius in pixels.
  11103. Allowed range is 1 to 20. Default is 3.
  11104. @item eps
  11105. Set regularization parameter (with square).
  11106. Allowed range is 0 to 1. Default is 0.01.
  11107. @item mode
  11108. Set filter mode. Can be @code{basic} or @code{fast}.
  11109. Default is @code{basic}.
  11110. @item sub
  11111. Set subsampling ratio for @code{fast} mode.
  11112. Range is 2 to 64. Default is 4.
  11113. No subsampling occurs in @code{basic} mode.
  11114. @item guidance
  11115. Set guidance mode. Can be @code{off} or @code{on}. Default is @code{off}.
  11116. If @code{off}, single input is required.
  11117. If @code{on}, two inputs of the same resolution and pixel format are required.
  11118. The second input serves as the guidance.
  11119. @item planes
  11120. Set planes to filter. Default is first only.
  11121. @end table
  11122. @subsection Commands
  11123. This filter supports the all above options as @ref{commands}.
  11124. @subsection Examples
  11125. @itemize
  11126. @item
  11127. Edge-preserving smoothing with guided filter:
  11128. @example
  11129. ffmpeg -i in.png -vf guided out.png
  11130. @end example
  11131. @item
  11132. Dehazing, structure-transferring filtering, detail enhancement with guided filter.
  11133. For the generation of guidance image, refer to paper "Guided Image Filtering".
  11134. See: @url{http://kaiminghe.com/publications/pami12guidedfilter.pdf}.
  11135. @example
  11136. ffmpeg -i in.png -i guidance.png -filter_complex guided=guidance=on out.png
  11137. @end example
  11138. @end itemize
  11139. @anchor{haldclut}
  11140. @section haldclut
  11141. Apply a Hald CLUT to a video stream.
  11142. First input is the video stream to process, and second one is the Hald CLUT.
  11143. The Hald CLUT input can be a simple picture or a complete video stream.
  11144. The filter accepts the following options:
  11145. @table @option
  11146. @item clut
  11147. Set which CLUT video frames will be processed from second input stream,
  11148. can be @var{first} or @var{all}. Default is @var{all}.
  11149. @item shortest
  11150. Force termination when the shortest input terminates. Default is @code{0}.
  11151. @item repeatlast
  11152. Continue applying the last CLUT after the end of the stream. A value of
  11153. @code{0} disable the filter after the last frame of the CLUT is reached.
  11154. Default is @code{1}.
  11155. @end table
  11156. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  11157. filters share the same internals).
  11158. This filter also supports the @ref{framesync} options.
  11159. More information about the Hald CLUT can be found on Eskil Steenberg's website
  11160. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  11161. @subsection Commands
  11162. This filter supports the @code{interp} option as @ref{commands}.
  11163. @subsection Workflow examples
  11164. @subsubsection Hald CLUT video stream
  11165. Generate an identity Hald CLUT stream altered with various effects:
  11166. @example
  11167. 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
  11168. @end example
  11169. Note: make sure you use a lossless codec.
  11170. Then use it with @code{haldclut} to apply it on some random stream:
  11171. @example
  11172. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  11173. @end example
  11174. The Hald CLUT will be applied to the 10 first seconds (duration of
  11175. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  11176. to the remaining frames of the @code{mandelbrot} stream.
  11177. @subsubsection Hald CLUT with preview
  11178. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  11179. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  11180. biggest possible square starting at the top left of the picture. The remaining
  11181. padding pixels (bottom or right) will be ignored. This area can be used to add
  11182. a preview of the Hald CLUT.
  11183. Typically, the following generated Hald CLUT will be supported by the
  11184. @code{haldclut} filter:
  11185. @example
  11186. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  11187. pad=iw+320 [padded_clut];
  11188. smptebars=s=320x256, split [a][b];
  11189. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  11190. [main][b] overlay=W-320" -frames:v 1 clut.png
  11191. @end example
  11192. It contains the original and a preview of the effect of the CLUT: SMPTE color
  11193. bars are displayed on the right-top, and below the same color bars processed by
  11194. the color changes.
  11195. Then, the effect of this Hald CLUT can be visualized with:
  11196. @example
  11197. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  11198. @end example
  11199. @section hflip
  11200. Flip the input video horizontally.
  11201. For example, to horizontally flip the input video with @command{ffmpeg}:
  11202. @example
  11203. ffmpeg -i in.avi -vf "hflip" out.avi
  11204. @end example
  11205. @section histeq
  11206. This filter applies a global color histogram equalization on a
  11207. per-frame basis.
  11208. It can be used to correct video that has a compressed range of pixel
  11209. intensities. The filter redistributes the pixel intensities to
  11210. equalize their distribution across the intensity range. It may be
  11211. viewed as an "automatically adjusting contrast filter". This filter is
  11212. useful only for correcting degraded or poorly captured source
  11213. video.
  11214. The filter accepts the following options:
  11215. @table @option
  11216. @item strength
  11217. Determine the amount of equalization to be applied. As the strength
  11218. is reduced, the distribution of pixel intensities more-and-more
  11219. approaches that of the input frame. The value must be a float number
  11220. in the range [0,1] and defaults to 0.200.
  11221. @item intensity
  11222. Set the maximum intensity that can generated and scale the output
  11223. values appropriately. The strength should be set as desired and then
  11224. the intensity can be limited if needed to avoid washing-out. The value
  11225. must be a float number in the range [0,1] and defaults to 0.210.
  11226. @item antibanding
  11227. Set the antibanding level. If enabled the filter will randomly vary
  11228. the luminance of output pixels by a small amount to avoid banding of
  11229. the histogram. Possible values are @code{none}, @code{weak} or
  11230. @code{strong}. It defaults to @code{none}.
  11231. @end table
  11232. @anchor{histogram}
  11233. @section histogram
  11234. Compute and draw a color distribution histogram for the input video.
  11235. The computed histogram is a representation of the color component
  11236. distribution in an image.
  11237. Standard histogram displays the color components distribution in an image.
  11238. Displays color graph for each color component. Shows distribution of
  11239. the Y, U, V, A or R, G, B components, depending on input format, in the
  11240. current frame. Below each graph a color component scale meter is shown.
  11241. The filter accepts the following options:
  11242. @table @option
  11243. @item level_height
  11244. Set height of level. Default value is @code{200}.
  11245. Allowed range is [50, 2048].
  11246. @item scale_height
  11247. Set height of color scale. Default value is @code{12}.
  11248. Allowed range is [0, 40].
  11249. @item display_mode
  11250. Set display mode.
  11251. It accepts the following values:
  11252. @table @samp
  11253. @item stack
  11254. Per color component graphs are placed below each other.
  11255. @item parade
  11256. Per color component graphs are placed side by side.
  11257. @item overlay
  11258. Presents information identical to that in the @code{parade}, except
  11259. that the graphs representing color components are superimposed directly
  11260. over one another.
  11261. @end table
  11262. Default is @code{stack}.
  11263. @item levels_mode
  11264. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  11265. Default is @code{linear}.
  11266. @item components
  11267. Set what color components to display.
  11268. Default is @code{7}.
  11269. @item fgopacity
  11270. Set foreground opacity. Default is @code{0.7}.
  11271. @item bgopacity
  11272. Set background opacity. Default is @code{0.5}.
  11273. @item colors_mode
  11274. Set colors mode.
  11275. It accepts the following values:
  11276. @table @samp
  11277. @item whiteonblack
  11278. @item blackonwhite
  11279. @item whiteongray
  11280. @item blackongray
  11281. @item coloronblack
  11282. @item coloronwhite
  11283. @item colorongray
  11284. @item blackoncolor
  11285. @item whiteoncolor
  11286. @item grayoncolor
  11287. @end table
  11288. Default is @code{whiteonblack}.
  11289. @end table
  11290. @subsection Examples
  11291. @itemize
  11292. @item
  11293. Calculate and draw histogram:
  11294. @example
  11295. ffplay -i input -vf histogram
  11296. @end example
  11297. @end itemize
  11298. @anchor{hqdn3d}
  11299. @section hqdn3d
  11300. This is a high precision/quality 3d denoise filter. It aims to reduce
  11301. image noise, producing smooth images and making still images really
  11302. still. It should enhance compressibility.
  11303. It accepts the following optional parameters:
  11304. @table @option
  11305. @item luma_spatial
  11306. A non-negative floating point number which specifies spatial luma strength.
  11307. It defaults to 4.0.
  11308. @item chroma_spatial
  11309. A non-negative floating point number which specifies spatial chroma strength.
  11310. It defaults to 3.0*@var{luma_spatial}/4.0.
  11311. @item luma_tmp
  11312. A floating point number which specifies luma temporal strength. It defaults to
  11313. 6.0*@var{luma_spatial}/4.0.
  11314. @item chroma_tmp
  11315. A floating point number which specifies chroma temporal strength. It defaults to
  11316. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  11317. @end table
  11318. @subsection Commands
  11319. This filter supports same @ref{commands} as options.
  11320. The command accepts the same syntax of the corresponding option.
  11321. If the specified expression is not valid, it is kept at its current
  11322. value.
  11323. @anchor{hwdownload}
  11324. @section hwdownload
  11325. Download hardware frames to system memory.
  11326. The input must be in hardware frames, and the output a non-hardware format.
  11327. Not all formats will be supported on the output - it may be necessary to insert
  11328. an additional @option{format} filter immediately following in the graph to get
  11329. the output in a supported format.
  11330. @section hwmap
  11331. Map hardware frames to system memory or to another device.
  11332. This filter has several different modes of operation; which one is used depends
  11333. on the input and output formats:
  11334. @itemize
  11335. @item
  11336. Hardware frame input, normal frame output
  11337. Map the input frames to system memory and pass them to the output. If the
  11338. original hardware frame is later required (for example, after overlaying
  11339. something else on part of it), the @option{hwmap} filter can be used again
  11340. in the next mode to retrieve it.
  11341. @item
  11342. Normal frame input, hardware frame output
  11343. If the input is actually a software-mapped hardware frame, then unmap it -
  11344. that is, return the original hardware frame.
  11345. Otherwise, a device must be provided. Create new hardware surfaces on that
  11346. device for the output, then map them back to the software format at the input
  11347. and give those frames to the preceding filter. This will then act like the
  11348. @option{hwupload} filter, but may be able to avoid an additional copy when
  11349. the input is already in a compatible format.
  11350. @item
  11351. Hardware frame input and output
  11352. A device must be supplied for the output, either directly or with the
  11353. @option{derive_device} option. The input and output devices must be of
  11354. different types and compatible - the exact meaning of this is
  11355. system-dependent, but typically it means that they must refer to the same
  11356. underlying hardware context (for example, refer to the same graphics card).
  11357. If the input frames were originally created on the output device, then unmap
  11358. to retrieve the original frames.
  11359. Otherwise, map the frames to the output device - create new hardware frames
  11360. on the output corresponding to the frames on the input.
  11361. @end itemize
  11362. The following additional parameters are accepted:
  11363. @table @option
  11364. @item mode
  11365. Set the frame mapping mode. Some combination of:
  11366. @table @var
  11367. @item read
  11368. The mapped frame should be readable.
  11369. @item write
  11370. The mapped frame should be writeable.
  11371. @item overwrite
  11372. The mapping will always overwrite the entire frame.
  11373. This may improve performance in some cases, as the original contents of the
  11374. frame need not be loaded.
  11375. @item direct
  11376. The mapping must not involve any copying.
  11377. Indirect mappings to copies of frames are created in some cases where either
  11378. direct mapping is not possible or it would have unexpected properties.
  11379. Setting this flag ensures that the mapping is direct and will fail if that is
  11380. not possible.
  11381. @end table
  11382. Defaults to @var{read+write} if not specified.
  11383. @item derive_device @var{type}
  11384. Rather than using the device supplied at initialisation, instead derive a new
  11385. device of type @var{type} from the device the input frames exist on.
  11386. @item reverse
  11387. In a hardware to hardware mapping, map in reverse - create frames in the sink
  11388. and map them back to the source. This may be necessary in some cases where
  11389. a mapping in one direction is required but only the opposite direction is
  11390. supported by the devices being used.
  11391. This option is dangerous - it may break the preceding filter in undefined
  11392. ways if there are any additional constraints on that filter's output.
  11393. Do not use it without fully understanding the implications of its use.
  11394. @end table
  11395. @anchor{hwupload}
  11396. @section hwupload
  11397. Upload system memory frames to hardware surfaces.
  11398. The device to upload to must be supplied when the filter is initialised. If
  11399. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  11400. option or with the @option{derive_device} option. The input and output devices
  11401. must be of different types and compatible - the exact meaning of this is
  11402. system-dependent, but typically it means that they must refer to the same
  11403. underlying hardware context (for example, refer to the same graphics card).
  11404. The following additional parameters are accepted:
  11405. @table @option
  11406. @item derive_device @var{type}
  11407. Rather than using the device supplied at initialisation, instead derive a new
  11408. device of type @var{type} from the device the input frames exist on.
  11409. @end table
  11410. @anchor{hwupload_cuda}
  11411. @section hwupload_cuda
  11412. Upload system memory frames to a CUDA device.
  11413. It accepts the following optional parameters:
  11414. @table @option
  11415. @item device
  11416. The number of the CUDA device to use
  11417. @end table
  11418. @section hqx
  11419. Apply a high-quality magnification filter designed for pixel art. This filter
  11420. was originally created by Maxim Stepin.
  11421. It accepts the following option:
  11422. @table @option
  11423. @item n
  11424. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  11425. @code{hq3x} and @code{4} for @code{hq4x}.
  11426. Default is @code{3}.
  11427. @end table
  11428. @anchor{hstack}
  11429. @section hstack
  11430. Stack input videos horizontally.
  11431. All streams must be of same pixel format and of same height.
  11432. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  11433. to create same output.
  11434. The filter accepts the following option:
  11435. @table @option
  11436. @item inputs
  11437. Set number of input streams. Default is 2.
  11438. @item shortest
  11439. If set to 1, force the output to terminate when the shortest input
  11440. terminates. Default value is 0.
  11441. @end table
  11442. @section hsvhold
  11443. Turns a certain HSV range into gray values.
  11444. This filter measures color difference between set HSV color in options
  11445. and ones measured in video stream. Depending on options, output
  11446. colors can be changed to be gray or not.
  11447. The filter accepts the following options:
  11448. @table @option
  11449. @item hue
  11450. Set the hue value which will be used in color difference calculation.
  11451. Allowed range is from -360 to 360. Default value is 0.
  11452. @item sat
  11453. Set the saturation value which will be used in color difference calculation.
  11454. Allowed range is from -1 to 1. Default value is 0.
  11455. @item val
  11456. Set the value which will be used in color difference calculation.
  11457. Allowed range is from -1 to 1. Default value is 0.
  11458. @item similarity
  11459. Set similarity percentage with the key color.
  11460. Allowed range is from 0 to 1. Default value is 0.01.
  11461. 0.00001 matches only the exact key color, while 1.0 matches everything.
  11462. @item blend
  11463. Blend percentage.
  11464. Allowed range is from 0 to 1. Default value is 0.
  11465. 0.0 makes pixels either fully gray, or not gray at all.
  11466. Higher values result in more gray pixels, with a higher gray pixel
  11467. the more similar the pixels color is to the key color.
  11468. @end table
  11469. @section hsvkey
  11470. Turns a certain HSV range into transparency.
  11471. This filter measures color difference between set HSV color in options
  11472. and ones measured in video stream. Depending on options, output
  11473. colors can be changed to transparent by adding alpha channel.
  11474. The filter accepts the following options:
  11475. @table @option
  11476. @item hue
  11477. Set the hue value which will be used in color difference calculation.
  11478. Allowed range is from -360 to 360. Default value is 0.
  11479. @item sat
  11480. Set the saturation value which will be used in color difference calculation.
  11481. Allowed range is from -1 to 1. Default value is 0.
  11482. @item val
  11483. Set the value which will be used in color difference calculation.
  11484. Allowed range is from -1 to 1. Default value is 0.
  11485. @item similarity
  11486. Set similarity percentage with the key color.
  11487. Allowed range is from 0 to 1. Default value is 0.01.
  11488. 0.00001 matches only the exact key color, while 1.0 matches everything.
  11489. @item blend
  11490. Blend percentage.
  11491. Allowed range is from 0 to 1. Default value is 0.
  11492. 0.0 makes pixels either fully transparent, or not transparent at all.
  11493. Higher values result in semi-transparent pixels, with a higher transparency
  11494. the more similar the pixels color is to the key color.
  11495. @end table
  11496. @section hue
  11497. Modify the hue and/or the saturation of the input.
  11498. It accepts the following parameters:
  11499. @table @option
  11500. @item h
  11501. Specify the hue angle as a number of degrees. It accepts an expression,
  11502. and defaults to "0".
  11503. @item s
  11504. Specify the saturation in the [-10,10] range. It accepts an expression and
  11505. defaults to "1".
  11506. @item H
  11507. Specify the hue angle as a number of radians. It accepts an
  11508. expression, and defaults to "0".
  11509. @item b
  11510. Specify the brightness in the [-10,10] range. It accepts an expression and
  11511. defaults to "0".
  11512. @end table
  11513. @option{h} and @option{H} are mutually exclusive, and can't be
  11514. specified at the same time.
  11515. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  11516. expressions containing the following constants:
  11517. @table @option
  11518. @item n
  11519. frame count of the input frame starting from 0
  11520. @item pts
  11521. presentation timestamp of the input frame expressed in time base units
  11522. @item r
  11523. frame rate of the input video, NAN if the input frame rate is unknown
  11524. @item t
  11525. timestamp expressed in seconds, NAN if the input timestamp is unknown
  11526. @item tb
  11527. time base of the input video
  11528. @end table
  11529. @subsection Examples
  11530. @itemize
  11531. @item
  11532. Set the hue to 90 degrees and the saturation to 1.0:
  11533. @example
  11534. hue=h=90:s=1
  11535. @end example
  11536. @item
  11537. Same command but expressing the hue in radians:
  11538. @example
  11539. hue=H=PI/2:s=1
  11540. @end example
  11541. @item
  11542. Rotate hue and make the saturation swing between 0
  11543. and 2 over a period of 1 second:
  11544. @example
  11545. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  11546. @end example
  11547. @item
  11548. Apply a 3 seconds saturation fade-in effect starting at 0:
  11549. @example
  11550. hue="s=min(t/3\,1)"
  11551. @end example
  11552. The general fade-in expression can be written as:
  11553. @example
  11554. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  11555. @end example
  11556. @item
  11557. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  11558. @example
  11559. hue="s=max(0\, min(1\, (8-t)/3))"
  11560. @end example
  11561. The general fade-out expression can be written as:
  11562. @example
  11563. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  11564. @end example
  11565. @end itemize
  11566. @subsection Commands
  11567. This filter supports the following commands:
  11568. @table @option
  11569. @item b
  11570. @item s
  11571. @item h
  11572. @item H
  11573. Modify the hue and/or the saturation and/or brightness of the input video.
  11574. The command accepts the same syntax of the corresponding option.
  11575. If the specified expression is not valid, it is kept at its current
  11576. value.
  11577. @end table
  11578. @section huesaturation
  11579. Apply hue-saturation-intensity adjustments to input video stream.
  11580. This filter operates in RGB colorspace.
  11581. This filter accepts the following options:
  11582. @table @option
  11583. @item hue
  11584. Set the hue shift in degrees to apply. Default is 0.
  11585. Allowed range is from -180 to 180.
  11586. @item saturation
  11587. Set the saturation shift. Default is 0.
  11588. Allowed range is from -1 to 1.
  11589. @item intensity
  11590. Set the intensity shift. Default is 0.
  11591. Allowed range is from -1 to 1.
  11592. @item colors
  11593. Set which primary and complementary colors are going to be adjusted.
  11594. This options is set by providing one or multiple values.
  11595. This can select multiple colors at once. By default all colors are selected.
  11596. @table @samp
  11597. @item r
  11598. Adjust reds.
  11599. @item y
  11600. Adjust yellows.
  11601. @item g
  11602. Adjust greens.
  11603. @item c
  11604. Adjust cyans.
  11605. @item b
  11606. Adjust blues.
  11607. @item m
  11608. Adjust magentas.
  11609. @item a
  11610. Adjust all colors.
  11611. @end table
  11612. @item strength
  11613. Set strength of filtering. Allowed range is from 0 to 100.
  11614. Default value is 1.
  11615. @item rw, gw, bw
  11616. Set weight for each RGB component. Allowed range is from 0 to 1.
  11617. By default is set to 0.333, 0.334, 0.333.
  11618. Those options are used in saturation and lightess processing.
  11619. @item lightness
  11620. Set preserving lightness, by default is disabled.
  11621. Adjusting hues can change lightness from original RGB triplet,
  11622. with this option enabled lightness is kept at same value.
  11623. @end table
  11624. @section hysteresis
  11625. Grow first stream into second stream by connecting components.
  11626. This makes it possible to build more robust edge masks.
  11627. This filter accepts the following options:
  11628. @table @option
  11629. @item planes
  11630. Set which planes will be processed as bitmap, unprocessed planes will be
  11631. copied from first stream.
  11632. By default value 0xf, all planes will be processed.
  11633. @item threshold
  11634. Set threshold which is used in filtering. If pixel component value is higher than
  11635. this value filter algorithm for connecting components is activated.
  11636. By default value is 0.
  11637. @end table
  11638. The @code{hysteresis} filter also supports the @ref{framesync} options.
  11639. @section iccdetect
  11640. Detect the colorspace from an embedded ICC profile (if present), and update
  11641. the frame's tags accordingly.
  11642. This filter accepts the following options:
  11643. @table @option
  11644. @item force
  11645. If true, the frame's existing colorspace tags will always be overridden by
  11646. values detected from an ICC profile. Otherwise, they will only be assigned if
  11647. they contain @code{unknown}. Enabled by default.
  11648. @end table
  11649. @section iccgen
  11650. Generate ICC profiles and attach them to frames.
  11651. This filter accepts the following options:
  11652. @table @option
  11653. @item color_primaries
  11654. @item color_trc
  11655. Configure the colorspace that the ICC profile will be generated for. The
  11656. default value of @code{auto} infers the value from the input frame's metadata,
  11657. defaulting to BT.709/sRGB as appropriate.
  11658. See the @ref{setparams} filter for a list of possible values, but note that
  11659. @code{unknown} are not valid values for this filter.
  11660. @item force
  11661. If true, an ICC profile will be generated even if it would overwrite an
  11662. already existing ICC profile. Disabled by default.
  11663. @end table
  11664. @section identity
  11665. Obtain the identity score between two input videos.
  11666. This filter takes two input videos.
  11667. Both input videos must have the same resolution and pixel format for
  11668. this filter to work correctly. Also it assumes that both inputs
  11669. have the same number of frames, which are compared one by one.
  11670. The obtained per component, average, min and max identity score is printed through
  11671. the logging system.
  11672. The filter stores the calculated identity scores of each frame in frame metadata.
  11673. This filter also supports the @ref{framesync} options.
  11674. In the below example the input file @file{main.mpg} being processed is compared
  11675. with the reference file @file{ref.mpg}.
  11676. @example
  11677. ffmpeg -i main.mpg -i ref.mpg -lavfi identity -f null -
  11678. @end example
  11679. @section idet
  11680. Detect video interlacing type.
  11681. This filter tries to detect if the input frames are interlaced, progressive,
  11682. top or bottom field first. It will also try to detect fields that are
  11683. repeated between adjacent frames (a sign of telecine).
  11684. Single frame detection considers only immediately adjacent frames when classifying each frame.
  11685. Multiple frame detection incorporates the classification history of previous frames.
  11686. The filter will log these metadata values:
  11687. @table @option
  11688. @item single.current_frame
  11689. Detected type of current frame using single-frame detection. One of:
  11690. ``tff'' (top field first), ``bff'' (bottom field first),
  11691. ``progressive'', or ``undetermined''
  11692. @item single.tff
  11693. Cumulative number of frames detected as top field first using single-frame detection.
  11694. @item multiple.tff
  11695. Cumulative number of frames detected as top field first using multiple-frame detection.
  11696. @item single.bff
  11697. Cumulative number of frames detected as bottom field first using single-frame detection.
  11698. @item multiple.current_frame
  11699. Detected type of current frame using multiple-frame detection. One of:
  11700. ``tff'' (top field first), ``bff'' (bottom field first),
  11701. ``progressive'', or ``undetermined''
  11702. @item multiple.bff
  11703. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  11704. @item single.progressive
  11705. Cumulative number of frames detected as progressive using single-frame detection.
  11706. @item multiple.progressive
  11707. Cumulative number of frames detected as progressive using multiple-frame detection.
  11708. @item single.undetermined
  11709. Cumulative number of frames that could not be classified using single-frame detection.
  11710. @item multiple.undetermined
  11711. Cumulative number of frames that could not be classified using multiple-frame detection.
  11712. @item repeated.current_frame
  11713. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  11714. @item repeated.neither
  11715. Cumulative number of frames with no repeated field.
  11716. @item repeated.top
  11717. Cumulative number of frames with the top field repeated from the previous frame's top field.
  11718. @item repeated.bottom
  11719. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  11720. @end table
  11721. The filter accepts the following options:
  11722. @table @option
  11723. @item intl_thres
  11724. Set interlacing threshold.
  11725. @item prog_thres
  11726. Set progressive threshold.
  11727. @item rep_thres
  11728. Threshold for repeated field detection.
  11729. @item half_life
  11730. Number of frames after which a given frame's contribution to the
  11731. statistics is halved (i.e., it contributes only 0.5 to its
  11732. classification). The default of 0 means that all frames seen are given
  11733. full weight of 1.0 forever.
  11734. @item analyze_interlaced_flag
  11735. When this is not 0 then idet will use the specified number of frames to determine
  11736. if the interlaced flag is accurate, it will not count undetermined frames.
  11737. If the flag is found to be accurate it will be used without any further
  11738. computations, if it is found to be inaccurate it will be cleared without any
  11739. further computations. This allows inserting the idet filter as a low computational
  11740. method to clean up the interlaced flag
  11741. @end table
  11742. @section il
  11743. Deinterleave or interleave fields.
  11744. This filter allows one to process interlaced images fields without
  11745. deinterlacing them. Deinterleaving splits the input frame into 2
  11746. fields (so called half pictures). Odd lines are moved to the top
  11747. half of the output image, even lines to the bottom half.
  11748. You can process (filter) them independently and then re-interleave them.
  11749. The filter accepts the following options:
  11750. @table @option
  11751. @item luma_mode, l
  11752. @item chroma_mode, c
  11753. @item alpha_mode, a
  11754. Available values for @var{luma_mode}, @var{chroma_mode} and
  11755. @var{alpha_mode} are:
  11756. @table @samp
  11757. @item none
  11758. Do nothing.
  11759. @item deinterleave, d
  11760. Deinterleave fields, placing one above the other.
  11761. @item interleave, i
  11762. Interleave fields. Reverse the effect of deinterleaving.
  11763. @end table
  11764. Default value is @code{none}.
  11765. @item luma_swap, ls
  11766. @item chroma_swap, cs
  11767. @item alpha_swap, as
  11768. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  11769. @end table
  11770. @subsection Commands
  11771. This filter supports the all above options as @ref{commands}.
  11772. @section inflate
  11773. Apply inflate effect to the video.
  11774. This filter replaces the pixel by the local(3x3) average by taking into account
  11775. only values higher than the pixel.
  11776. It accepts the following options:
  11777. @table @option
  11778. @item threshold0
  11779. @item threshold1
  11780. @item threshold2
  11781. @item threshold3
  11782. Limit the maximum change for each plane, default is 65535.
  11783. If 0, plane will remain unchanged.
  11784. @end table
  11785. @subsection Commands
  11786. This filter supports the all above options as @ref{commands}.
  11787. @section interlace
  11788. Simple interlacing filter from progressive contents. This interleaves upper (or
  11789. lower) lines from odd frames with lower (or upper) lines from even frames,
  11790. halving the frame rate and preserving image height.
  11791. @example
  11792. Original Original New Frame
  11793. Frame 'j' Frame 'j+1' (tff)
  11794. ========== =========== ==================
  11795. Line 0 --------------------> Frame 'j' Line 0
  11796. Line 1 Line 1 ----> Frame 'j+1' Line 1
  11797. Line 2 ---------------------> Frame 'j' Line 2
  11798. Line 3 Line 3 ----> Frame 'j+1' Line 3
  11799. ... ... ...
  11800. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  11801. @end example
  11802. It accepts the following optional parameters:
  11803. @table @option
  11804. @item scan
  11805. This determines whether the interlaced frame is taken from the even
  11806. (tff - default) or odd (bff) lines of the progressive frame.
  11807. @item lowpass
  11808. Vertical lowpass filter to avoid twitter interlacing and
  11809. reduce moire patterns.
  11810. @table @samp
  11811. @item 0, off
  11812. Disable vertical lowpass filter
  11813. @item 1, linear
  11814. Enable linear filter (default)
  11815. @item 2, complex
  11816. Enable complex filter. This will slightly less reduce twitter and moire
  11817. but better retain detail and subjective sharpness impression.
  11818. @end table
  11819. @end table
  11820. @section kerndeint
  11821. Deinterlace input video by applying Donald Graft's adaptive kernel
  11822. deinterling. Work on interlaced parts of a video to produce
  11823. progressive frames.
  11824. The description of the accepted parameters follows.
  11825. @table @option
  11826. @item thresh
  11827. Set the threshold which affects the filter's tolerance when
  11828. determining if a pixel line must be processed. It must be an integer
  11829. in the range [0,255] and defaults to 10. A value of 0 will result in
  11830. applying the process on every pixels.
  11831. @item map
  11832. Paint pixels exceeding the threshold value to white if set to 1.
  11833. Default is 0.
  11834. @item order
  11835. Set the fields order. Swap fields if set to 1, leave fields alone if
  11836. 0. Default is 0.
  11837. @item sharp
  11838. Enable additional sharpening if set to 1. Default is 0.
  11839. @item twoway
  11840. Enable twoway sharpening if set to 1. Default is 0.
  11841. @end table
  11842. @subsection Examples
  11843. @itemize
  11844. @item
  11845. Apply default values:
  11846. @example
  11847. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  11848. @end example
  11849. @item
  11850. Enable additional sharpening:
  11851. @example
  11852. kerndeint=sharp=1
  11853. @end example
  11854. @item
  11855. Paint processed pixels in white:
  11856. @example
  11857. kerndeint=map=1
  11858. @end example
  11859. @end itemize
  11860. @section kirsch
  11861. Apply kirsch operator to input video stream.
  11862. The filter accepts the following option:
  11863. @table @option
  11864. @item planes
  11865. Set which planes will be processed, unprocessed planes will be copied.
  11866. By default value 0xf, all planes will be processed.
  11867. @item scale
  11868. Set value which will be multiplied with filtered result.
  11869. @item delta
  11870. Set value which will be added to filtered result.
  11871. @end table
  11872. @subsection Commands
  11873. This filter supports the all above options as @ref{commands}.
  11874. @section lagfun
  11875. Slowly update darker pixels.
  11876. This filter makes short flashes of light appear longer.
  11877. This filter accepts the following options:
  11878. @table @option
  11879. @item decay
  11880. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  11881. @item planes
  11882. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  11883. @end table
  11884. @subsection Commands
  11885. This filter supports the all above options as @ref{commands}.
  11886. @section lenscorrection
  11887. Correct radial lens distortion
  11888. This filter can be used to correct for radial distortion as can result from the use
  11889. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  11890. one can use tools available for example as part of opencv or simply trial-and-error.
  11891. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  11892. and extract the k1 and k2 coefficients from the resulting matrix.
  11893. Note that effectively the same filter is available in the open-source tools Krita and
  11894. Digikam from the KDE project.
  11895. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  11896. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  11897. brightness distribution, so you may want to use both filters together in certain
  11898. cases, though you will have to take care of ordering, i.e. whether vignetting should
  11899. be applied before or after lens correction.
  11900. @subsection Options
  11901. The filter accepts the following options:
  11902. @table @option
  11903. @item cx
  11904. Relative x-coordinate of the focal point of the image, and thereby the center of the
  11905. distortion. This value has a range [0,1] and is expressed as fractions of the image
  11906. width. Default is 0.5.
  11907. @item cy
  11908. Relative y-coordinate of the focal point of the image, and thereby the center of the
  11909. distortion. This value has a range [0,1] and is expressed as fractions of the image
  11910. height. Default is 0.5.
  11911. @item k1
  11912. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  11913. no correction. Default is 0.
  11914. @item k2
  11915. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  11916. 0 means no correction. Default is 0.
  11917. @item i
  11918. Set interpolation type. Can be @code{nearest} or @code{bilinear}.
  11919. Default is @code{nearest}.
  11920. @item fc
  11921. Specify the color of the unmapped pixels. For the syntax of this option,
  11922. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11923. manual,ffmpeg-utils}. Default color is @code{black@@0}.
  11924. @end table
  11925. The formula that generates the correction is:
  11926. @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)
  11927. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  11928. distances from the focal point in the source and target images, respectively.
  11929. @subsection Commands
  11930. This filter supports the all above options as @ref{commands}.
  11931. @section lensfun
  11932. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  11933. The @code{lensfun} filter requires the camera make, camera model, and lens model
  11934. to apply the lens correction. The filter will load the lensfun database and
  11935. query it to find the corresponding camera and lens entries in the database. As
  11936. long as these entries can be found with the given options, the filter can
  11937. perform corrections on frames. Note that incomplete strings will result in the
  11938. filter choosing the best match with the given options, and the filter will
  11939. output the chosen camera and lens models (logged with level "info"). You must
  11940. provide the make, camera model, and lens model as they are required.
  11941. To obtain a list of available makes and models, leave out one or both of @code{make} and
  11942. @code{model} options. The filter will send the full list to the log with level @code{INFO}.
  11943. The first column is the make and the second column is the model.
  11944. To obtain a list of available lenses, set any values for make and model and leave out the
  11945. @code{lens_model} option. The filter will send the full list of lenses in the log with level
  11946. @code{INFO}. The ffmpeg tool will exit after the list is printed.
  11947. The filter accepts the following options:
  11948. @table @option
  11949. @item make
  11950. The make of the camera (for example, "Canon"). This option is required.
  11951. @item model
  11952. The model of the camera (for example, "Canon EOS 100D"). This option is
  11953. required.
  11954. @item lens_model
  11955. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  11956. option is required.
  11957. @item db_path
  11958. The full path to the lens database folder. If not set, the filter will attempt to
  11959. load the database from the install path when the library was built. Default is unset.
  11960. @item mode
  11961. The type of correction to apply. The following values are valid options:
  11962. @table @samp
  11963. @item vignetting
  11964. Enables fixing lens vignetting.
  11965. @item geometry
  11966. Enables fixing lens geometry. This is the default.
  11967. @item subpixel
  11968. Enables fixing chromatic aberrations.
  11969. @item vig_geo
  11970. Enables fixing lens vignetting and lens geometry.
  11971. @item vig_subpixel
  11972. Enables fixing lens vignetting and chromatic aberrations.
  11973. @item distortion
  11974. Enables fixing both lens geometry and chromatic aberrations.
  11975. @item all
  11976. Enables all possible corrections.
  11977. @end table
  11978. @item focal_length
  11979. The focal length of the image/video (zoom; expected constant for video). For
  11980. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  11981. range should be chosen when using that lens. Default 18.
  11982. @item aperture
  11983. The aperture of the image/video (expected constant for video). Note that
  11984. aperture is only used for vignetting correction. Default 3.5.
  11985. @item focus_distance
  11986. The focus distance of the image/video (expected constant for video). Note that
  11987. focus distance is only used for vignetting and only slightly affects the
  11988. vignetting correction process. If unknown, leave it at the default value (which
  11989. is 1000).
  11990. @item scale
  11991. The scale factor which is applied after transformation. After correction the
  11992. video is no longer necessarily rectangular. This parameter controls how much of
  11993. the resulting image is visible. The value 0 means that a value will be chosen
  11994. automatically such that there is little or no unmapped area in the output
  11995. image. 1.0 means that no additional scaling is done. Lower values may result
  11996. in more of the corrected image being visible, while higher values may avoid
  11997. unmapped areas in the output.
  11998. @item target_geometry
  11999. The target geometry of the output image/video. The following values are valid
  12000. options:
  12001. @table @samp
  12002. @item rectilinear (default)
  12003. @item fisheye
  12004. @item panoramic
  12005. @item equirectangular
  12006. @item fisheye_orthographic
  12007. @item fisheye_stereographic
  12008. @item fisheye_equisolid
  12009. @item fisheye_thoby
  12010. @end table
  12011. @item reverse
  12012. Apply the reverse of image correction (instead of correcting distortion, apply
  12013. it).
  12014. @item interpolation
  12015. The type of interpolation used when correcting distortion. The following values
  12016. are valid options:
  12017. @table @samp
  12018. @item nearest
  12019. @item linear (default)
  12020. @item lanczos
  12021. @end table
  12022. @end table
  12023. @subsection Examples
  12024. @itemize
  12025. @item
  12026. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  12027. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  12028. aperture of "8.0".
  12029. @example
  12030. 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
  12031. @end example
  12032. @item
  12033. Apply the same as before, but only for the first 5 seconds of video.
  12034. @example
  12035. 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
  12036. @end example
  12037. @end itemize
  12038. @section libplacebo
  12039. Flexible GPU-accelerated processing filter based on libplacebo
  12040. (@url{https://code.videolan.org/videolan/libplacebo}). Note that this filter
  12041. currently only accepts Vulkan input frames.
  12042. @subsection Options
  12043. The options for this filter are divided into the following sections:
  12044. @subsubsection Output mode
  12045. These options control the overall output mode. By default, libplacebo will try
  12046. to preserve the source colorimetry and size as best as it can, but it will
  12047. apply any embedded film grain, dolby vision metadata or anamorphic SAR present
  12048. in source frames.
  12049. @table @option
  12050. @item w
  12051. @item h
  12052. Set the output video dimension expression. Default value is the input dimension.
  12053. Allows for the same expressions as the @ref{scale} filter.
  12054. @item format
  12055. Set the output format override. If unset (the default), frames will be output
  12056. in the same format as the respective input frames. Otherwise, format conversion
  12057. will be performed.
  12058. @item force_original_aspect_ratio
  12059. @item force_divisible_by
  12060. Work the same as the identical @ref{scale} filter options.
  12061. @item normalize_sar
  12062. If enabled, output frames will always have a pixel aspect ratio of 1:1. This
  12063. will introduce padding/cropping as necessary. If disabled (the default), any
  12064. aspect ratio mismatches, including those from e.g. anamorphic video sources,
  12065. are forwarded to the output pixel aspect ratio.
  12066. @item pad_crop_ratio
  12067. Specifies a ratio (between @code{0.0} and @code{1.0}) between padding and
  12068. cropping when the input aspect ratio does not match the output aspect ratio and
  12069. @option{normalize_sar} is in effect. The default of @code{0.0} always pads the
  12070. content with black borders, while a value of @code{1.0} always crops off parts
  12071. of the content. Intermediate values are possible, leading to a mix of the two
  12072. approaches.
  12073. @item colorspace
  12074. @item color_primaries
  12075. @item color_trc
  12076. @item range
  12077. Configure the colorspace that output frames will be delivered in. The default
  12078. value of @code{auto} outputs frames in the same format as the input frames,
  12079. leading to no change. For any other value, conversion will be performed.
  12080. See the @ref{setparams} filter for a list of possible values.
  12081. @item apply_filmgrain
  12082. Apply film grain (e.g. AV1 or H.274) if present in source frames, and strip
  12083. it from the output. Enabled by default.
  12084. @item apply_dolbyvision
  12085. Apply Dolby Vision RPU metadata if present in source frames, and strip it from
  12086. the output. Enabled by default. Note that Dolby Vision will always output
  12087. BT.2020+PQ, overriding the usual input frame metadata. These will also be
  12088. picked as the values of @code{auto} for the respective frame output options.
  12089. @end table
  12090. @subsubsection Scaling
  12091. The options in this section control how libplacebo performs upscaling and (if
  12092. necessary) downscaling. Note that libplacebo will always internally operate on
  12093. 4:4:4 content, so any sub-sampled chroma formats such as @code{yuv420p} will
  12094. necessarily be upsampled and downsampled as part of the rendering process. That
  12095. means scaling might be in effect even if the source and destination resolution
  12096. are the same.
  12097. @table @option
  12098. @item upscaler
  12099. @item downscaler
  12100. Configure the filter kernel used for upscaling and downscaling. The respective
  12101. defaults are @code{spline36} and @code{mitchell}. For a full list of possible
  12102. values, pass @code{help} to these options. The most important values are:
  12103. @table @samp
  12104. @item none
  12105. Forces the use of built-in GPU texture sampling (typically bilinear). Extremely
  12106. fast but poor quality, especially when downscaling.
  12107. @item bilinear
  12108. Bilinear interpolation. Can generally be done for free on GPUs, except when
  12109. doing so would lead to aliasing. Fast and low quality.
  12110. @item nearest
  12111. Nearest-neighbour interpolation. Sharp but highly aliasing.
  12112. @item oversample
  12113. Algorithm that looks visually similar to nearest-neighbour interpolation but
  12114. tries to preserve pixel aspect ratio. Good for pixel art, since it results in
  12115. minimal distortion of the artistic appearance.
  12116. @item lanczos
  12117. Standard sinc-sinc interpolation kernel.
  12118. @item spline36
  12119. Cubic spline approximation of lanczos. No difference in performance, but has
  12120. very slightly less ringing.
  12121. @item ewa_lanczos
  12122. Elliptically weighted average version of lanczos, based on a jinc-sinc kernel.
  12123. This is also popularly referred to as just "Jinc scaling". Slow but very high
  12124. quality.
  12125. @item gaussian
  12126. Gaussian kernel. Has certain ideal mathematical properties, but subjectively
  12127. very blurry.
  12128. @item mitchell
  12129. Cubic BC spline with parameters recommended by Mitchell and Netravali. Very
  12130. little ringing.
  12131. @end table
  12132. @item lut_entries
  12133. Configures the size of scaler LUTs, ranging from @code{1} to @code{256}. The
  12134. default of @code{0} will pick libplacebo's internal default, typically
  12135. @code{64}.
  12136. @item antiringing
  12137. Enables anti-ringing (for non-EWA filters). The value (between @code{0.0} and
  12138. @code{1.0}) configures the strength of the anti-ringing algorithm. May increase
  12139. aliasing if set too high. Disabled by default.
  12140. @item sigmoid
  12141. Enable sigmoidal compression during upscaling. Reduces ringing slightly.
  12142. Enabled by default.
  12143. @end table
  12144. @subsubsection Debanding
  12145. Libplacebo comes with a built-in debanding filter that is good at counteracting
  12146. many common sources of banding and blocking. Turning this on is highly
  12147. recommended whenever quality is desired.
  12148. @table @option
  12149. @item deband
  12150. Enable (fast) debanding algorithm. Disabled by default.
  12151. @item deband_iterations
  12152. Number of deband iterations of the debanding algorithm. Each iteration is
  12153. performed with progressively increased radius (and diminished threshold).
  12154. Recommended values are in the range @code{1} to @code{4}. Defaults to @code{1}.
  12155. @item deband_threshold
  12156. Debanding filter strength. Higher numbers lead to more aggressive debanding.
  12157. Defaults to @code{4.0}.
  12158. @item deband_radius
  12159. Debanding filter radius. A higher radius is better for slow gradients, while
  12160. a lower radius is better for steep gradients. Defaults to @code{16.0}.
  12161. @item deband_grain
  12162. Amount of extra output grain to add. Helps hide imperfections. Defaults to
  12163. @code{6.0}.
  12164. @end table
  12165. @subsubsection Color adjustment
  12166. A collection of subjective color controls. Not very rigorous, so the exact
  12167. effect will vary somewhat depending on the input primaries and colorspace.
  12168. @table @option
  12169. @item brightness
  12170. Brightness boost, between @code{-1.0} and @code{1.0}. Defaults to @code{0.0}.
  12171. @item contrast
  12172. Contrast gain, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  12173. @item saturation
  12174. Saturation gain, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  12175. @item hue
  12176. Hue shift in radians, between @code{-3.14} and @code{3.14}. Defaults to
  12177. @code{0.0}. This will rotate the UV subvector, defaulting to BT.709
  12178. coefficients for RGB inputs.
  12179. @item gamma
  12180. Gamma adjustment, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  12181. @item cones
  12182. Cone model to use for color blindness simulation. Accepts any combination of
  12183. @code{l}, @code{m} and @code{s}. Here are some examples:
  12184. @table @samp
  12185. @item m
  12186. Deuteranomaly / deuteranopia (affecting 3%-4% of the population)
  12187. @item l
  12188. Protanomaly / protanopia (affecting 1%-2% of the population)
  12189. @item l+m
  12190. Monochromacy (very rare)
  12191. @item l+m+s
  12192. Achromatopsy (complete loss of daytime vision, extremely rare)
  12193. @end table
  12194. @item cone-strength
  12195. Gain factor for the cones specified by @code{cones}, between @code{0.0} and
  12196. @code{10.0}. A value of @code{1.0} results in no change to color vision. A
  12197. value of @code{0.0} (the default) simulates complete loss of those cones. Values
  12198. above @code{1.0} result in exaggerating the differences between cones, which
  12199. may help compensate for reduced color vision.
  12200. @end table
  12201. @subsubsection Peak detection
  12202. To help deal with sources that only have static HDR10 metadata (or no tagging
  12203. whatsoever), libplacebo uses its own internal frame analysis compute shader to
  12204. analyze source frames and adapt the tone mapping function in realtime. If this
  12205. is too slow, or if exactly reproducible frame-perfect results are needed, it's
  12206. recommended to turn this feature off.
  12207. @table @option
  12208. @item peak_detect
  12209. Enable HDR peak detection. Ignores static MaxCLL/MaxFALL values in favor of
  12210. dynamic detection from the input. Note that the detected values do not get
  12211. written back to the output frames, they merely guide the internal tone mapping
  12212. process. Enabled by default.
  12213. @item smoothing_period
  12214. Peak detection smoothing period, between @code{0.0} and @code{1000.0}. Higher
  12215. values result in peak detection becoming less responsive to changes in the
  12216. input. Defaults to @code{100.0}.
  12217. @item minimum_peak
  12218. Lower bound on the detected peak (relative to SDR white), between @code{0.0}
  12219. and @code{100.0}. Defaults to @code{1.0}.
  12220. @item scene_threshold_low
  12221. @item scene_threshold_high
  12222. Lower and upper thresholds for scene change detection. Expressed in a
  12223. logarithmic scale between @code{0.0} and @code{100.0}. Default to @code{5.5}
  12224. and @code{10.0}, respectively. Setting either to a negative value disables
  12225. this functionality.
  12226. @item overshoot
  12227. Peak smoothing overshoot margin, between @code{0.0} and @code{1.0}. Provides a
  12228. safety margin to prevent clipping as a result of peak smoothing. Defaults to
  12229. @code{0.05}, corresponding to a margin of 5%.
  12230. @end table
  12231. @subsubsection Tone mapping
  12232. The options in this section control how libplacebo performs tone-mapping and
  12233. gamut-mapping when dealing with mismatches between wide-gamut or HDR content.
  12234. In general, libplacebo relies on accurate source tagging and mastering display
  12235. gamut information to produce the best results.
  12236. @table @option
  12237. @item intent
  12238. Rendering intent to use when adapting between different primary color gamuts
  12239. (after tone-mapping).
  12240. @table @samp
  12241. @item perceptual
  12242. Perceptual gamut mapping. Currently equivalent to relative colorimetric.
  12243. @item relative
  12244. Relative colorimetric. This is the default.
  12245. @item absolute
  12246. Absolute colorimetric.
  12247. @item saturation
  12248. Saturation mapping. Forcibly stretches the source gamut to the target gamut.
  12249. @end table
  12250. @item gamut_mode
  12251. How to handle out-of-gamut colors that can occur as a result of colorimetric
  12252. gamut mapping.
  12253. @table @samp
  12254. @item clip
  12255. Do nothing, simply clip out-of-range colors to the RGB volume. This is the
  12256. default.
  12257. @item warn
  12258. Highlight out-of-gamut pixels (by coloring them pink).
  12259. @item darken
  12260. Linearly reduces content brightness to preserves saturated details, followed by
  12261. clipping the remaining out-of-gamut colors. As the name implies, this makes
  12262. everything darker, but provides a good balance between preserving details and
  12263. colors.
  12264. @item desaturate
  12265. Hard-desaturates out-of-gamut colors towards white, while preserving the
  12266. luminance. Has a tendency to shift colors.
  12267. @end table
  12268. @item tonemapping
  12269. Tone-mapping algorithm to use. Available values are:
  12270. @table @samp
  12271. @item auto
  12272. Automatic selection based on internal heuristics. This is the default.
  12273. @item clip
  12274. Performs no tone-mapping, just clips out-of-range colors. Retains perfect color
  12275. accuracy for in-range colors but completely destroys out-of-range information.
  12276. Does not perform any black point adaptation. Not configurable.
  12277. @item bt.2390
  12278. EETF from the ITU-R Report BT.2390, a hermite spline roll-off with linear
  12279. segment. The knee point offset is configurable. Note that this parameter
  12280. defaults to @code{1.0}, rather than the value of @code{0.5} from the ITU-R
  12281. spec.
  12282. @item bt.2446a
  12283. EETF from ITU-R Report BT.2446, method A. Designed for well-mastered HDR
  12284. sources. Can be used for both forward and inverse tone mapping. Not
  12285. configurable.
  12286. @item spline
  12287. Simple spline consisting of two polynomials, joined by a single pivot point.
  12288. The parameter gives the pivot point (in PQ space), defaulting to @code{0.30}.
  12289. Can be used for both forward and inverse tone mapping.
  12290. @item reinhard
  12291. Simple non-linear, global tone mapping algorithm. The parameter specifies the
  12292. local contrast coefficient at the display peak. Essentially, a parameter of
  12293. @code{0.5} implies that the reference white will be about half as bright as
  12294. when clipping. Defaults to @code{0.5}, which results in the simplest
  12295. formulation of this function.
  12296. @item mobius
  12297. Generalization of the reinhard tone mapping algorithm to support an additional
  12298. linear slope near black. The tone mapping parameter indicates the trade-off
  12299. between the linear section and the non-linear section. Essentially, for a given
  12300. parameter @var{x}, every color value below @var{x} will be mapped linearly,
  12301. while higher values get non-linearly tone-mapped. Values near @code{1.0} make
  12302. this curve behave like @code{clip}, while values near @code{0.0} make this
  12303. curve behave like @code{reinhard}. The default value is @code{0.3}, which
  12304. provides a good balance between colorimetric accuracy and preserving
  12305. out-of-gamut details.
  12306. @item hable
  12307. Piece-wise, filmic tone-mapping algorithm developed by John Hable for use in
  12308. Uncharted 2, inspired by a similar tone-mapping algorithm used by Kodak.
  12309. Popularized by its use in video games with HDR rendering. Preserves both dark
  12310. and bright details very well, but comes with the drawback of changing the
  12311. average brightness quite significantly. This is sort of similar to
  12312. @code{reinhard} with parameter @code{0.24}.
  12313. @item gamma
  12314. Fits a gamma (power) function to transfer between the source and target color
  12315. spaces, effectively resulting in a perceptual hard-knee joining two roughly
  12316. linear sections. This preserves details at all scales fairly accurately, but
  12317. can result in an image with a muted or dull appearance. The parameter is used
  12318. as the cutoff point, defaulting to @code{0.5}.
  12319. @item linear
  12320. Linearly stretches the input range to the output range, in PQ space. This will
  12321. preserve all details accurately, but results in a significantly different
  12322. average brightness. Can be used for inverse tone-mapping in addition to regular
  12323. tone-mapping. The parameter can be used as an additional linear gain
  12324. coefficient (defaulting to @code{1.0}).
  12325. @end table
  12326. @item tonemapping_param
  12327. For tunable tone mapping functions, this parameter can be used to fine-tune the
  12328. curve behavior. Refer to the documentation of @code{tonemapping}. The default
  12329. value of @code{0.0} is replaced by the curve's preferred default setting.
  12330. @item tonemapping_mode
  12331. This option determines how the tone mapping function specified by
  12332. @code{tonemapping} is applied to the colors in a scene. Possible values are:
  12333. @table @samp
  12334. @item auto
  12335. Automatic selection based on internal heuristics. This is the default.
  12336. @item rgb
  12337. Apply the function per-channel in the RGB colorspace.
  12338. Per-channel tone-mapping in RGB. Guarantees no clipping and heavily desaturates
  12339. the output, but distorts the colors quite significantly. Very similar to the
  12340. "Hollywood" look and feel.
  12341. @item max
  12342. Tone-mapping is performed on the brightest component found in the signal. Good
  12343. at preserving details in highlights, but has a tendency to crush blacks.
  12344. @item hybrid
  12345. Tone-map per-channel for highlights and linearly (luma-based) for
  12346. midtones/shadows, based on a fixed gamma @code{2.4} coefficient curve.
  12347. @item luma
  12348. Tone-map linearly on the luma component (CIE Y), and adjust (desaturate) the
  12349. chromaticities to compensate using a simple constant factor. This is
  12350. essentially the mode used in ITU-R BT.2446 method A.
  12351. @end table
  12352. @item inverse_tonemapping
  12353. If enabled, this filter will also attempt stretching SDR signals to fill HDR
  12354. output color volumes. Disabled by default.
  12355. @item tonemapping_crosstalk
  12356. Extra tone-mapping crosstalk factor, between @code{0.0} and @code{0.3}. This
  12357. can help reduce issues tone-mapping certain bright spectral colors. Defaults to
  12358. @code{0.04}.
  12359. @item tonemapping_lut_size
  12360. Size of the tone-mapping LUT, between @code{2} and @code{1024}. Defaults to
  12361. @code{256}. Note that this figure is squared when combined with
  12362. @code{peak_detect}.
  12363. @end table
  12364. @subsubsection Dithering
  12365. By default, libplacebo will dither whenever necessary, which includes rendering
  12366. to any integer format below 16-bit precision. It's recommended to always leave
  12367. this on, since not doing so may result in visible banding in the output, even
  12368. if the @code{debanding} filter is enabled. If maximum performance is needed,
  12369. use @code{ordered_fixed} instead of disabling dithering.
  12370. @table @option
  12371. @item dithering
  12372. Dithering method to use. Accepts the following values:
  12373. @table @samp
  12374. @item none
  12375. Disables dithering completely. May result in visible banding.
  12376. @item blue
  12377. Dither with pseudo-blue noise. This is the default.
  12378. @item ordered
  12379. Tunable ordered dither pattern.
  12380. @item ordered_fixed
  12381. Faster ordered dither with a fixed size of @code{6}. Texture-less.
  12382. @item white
  12383. Dither with white noise. Texture-less.
  12384. @end table
  12385. @item dither_lut_size
  12386. Dither LUT size, as log base2 between @code{1} and @code{8}. Defaults to
  12387. @code{6}, corresponding to a LUT size of @code{64x64}.
  12388. @item dither_temporal
  12389. Enables temporal dithering. Disabled by default.
  12390. @end table
  12391. @subsubsection Custom shaders
  12392. libplacebo supports a number of custom shaders based on the mpv .hook GLSL
  12393. syntax. A collection of such shaders can be found here:
  12394. @url{https://github.com/mpv-player/mpv/wiki/User-Scripts#user-shaders}
  12395. A full description of the mpv shader format is beyond the scope of this
  12396. section, but a summary can be found here:
  12397. @url{https://mpv.io/manual/master/#options-glsl-shader}
  12398. @table @option
  12399. @item custom_shader_path
  12400. Specifies a path to a custom shader file to load at runtime.
  12401. @item custom_shader_bin
  12402. Specifies a complete custom shader as a raw string.
  12403. @end table
  12404. @subsubsection Debugging / performance
  12405. All of the options in this section default off. They may be of assistance when
  12406. attempting to squeeze the maximum performance at the cost of quality.
  12407. @table @option
  12408. @item skip_aa
  12409. Disable anti-aliasing when downscaling.
  12410. @item polar_cutoff
  12411. Truncate polar (EWA) scaler kernels below this absolute magnitude, between
  12412. @code{0.0} and @code{1.0}.
  12413. @item disable_linear
  12414. Disable linear light scaling.
  12415. @item disable_builtin
  12416. Disable built-in GPU sampling (forces LUT).
  12417. @item force_icc_lut
  12418. Force the use of a full ICC 3DLUT for gamut mapping.
  12419. @item disable_fbos
  12420. Forcibly disable FBOs, resulting in loss of almost all functionality, but
  12421. offering the maximum possible speed.
  12422. @end table
  12423. @subsection Commands
  12424. This filter supports almost all of the above options as @ref{commands}.
  12425. @subsection Examples
  12426. @itemize
  12427. @item
  12428. Complete example for how to initialize the Vulkan device, upload frames to the
  12429. GPU, perform filter conversion to yuv420p, and download frames back to the CPU
  12430. for output. Note that in specific cases you can get around the need to perform
  12431. format conversion by specifying the correct @code{format} filter option
  12432. corresponding to the input frames.
  12433. @example
  12434. ffmpeg -i $INPUT -init_hw_device vulkan -vf hwupload,libplacebo=format=yuv420p,hwdownload,format=yuv420p $OUTPUT
  12435. @end example
  12436. @item
  12437. Tone-map input to standard gamut BT.709 output:
  12438. @example
  12439. libplacebo=colorspace=bt709:color_primaries=bt709:color_trc=bt709:range=tv
  12440. @end example
  12441. @item
  12442. Rescale input to fit into standard 1080p, with high quality scaling:
  12443. @example
  12444. libplacebo=w=1920:h=1080:force_original_aspect_ratio=decrease:normalize_sar=true:upscaler=ewa_lanczos:downscaler=ewa_lanczos
  12445. @end example
  12446. @item
  12447. Convert input to standard sRGB JPEG:
  12448. @example
  12449. libplacebo=format=yuv420p:colorspace=bt470bg:color_primaries=bt709:color_trc=iec61966-2-1:range=pc
  12450. @end example
  12451. @item
  12452. Use higher quality debanding settings:
  12453. @example
  12454. libplacebo=deband=true:deband_iterations=3:deband_radius=8:deband_threshold=6
  12455. @end example
  12456. @item
  12457. Run this filter on the CPU, on systems with Mesa installed (and with the most
  12458. expensive options disabled):
  12459. @example
  12460. ffmpeg ... -init_hw_device vulkan:llvmpipe ... -vf libplacebo=upscaler=none:downscaler=none:peak_detect=false
  12461. @end example
  12462. @item
  12463. Suppress CPU-based AV1/H.274 film grain application in the decoder, in favor of
  12464. doing it with this filter. Note that this is only a gain if the frames are
  12465. either already on the GPU, or if you're using libplacebo for other purposes,
  12466. since otherwise the VRAM roundtrip will more than offset any expected speedup.
  12467. @example
  12468. ffmpeg -export_side_data +film_grain ... -vf libplacebo=apply_filmgrain=true
  12469. @end example
  12470. @end itemize
  12471. @section libvmaf
  12472. Calulate the VMAF (Video Multi-Method Assessment Fusion) score for a
  12473. reference/distorted pair of input videos.
  12474. The first input is the distorted video, and the second input is the reference video.
  12475. The obtained VMAF score is printed through the logging system.
  12476. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  12477. After installing the library it can be enabled using:
  12478. @code{./configure --enable-libvmaf}.
  12479. The filter has following options:
  12480. @table @option
  12481. @item model
  12482. A `|` delimited list of vmaf models. Each model can be configured with a number of parameters.
  12483. Default value: @code{"version=vmaf_v0.6.1"}
  12484. @item model_path
  12485. Deprecated, use model='path=...'.
  12486. @item enable_transform
  12487. Deprecated, use model='enable_transform=true'.
  12488. @item phone_model
  12489. Deprecated, use model='enable_transform=true'.
  12490. @item enable_conf_interval
  12491. Deprecated, use model='enable_conf_interval=true'.
  12492. @item feature
  12493. A `|` delimited list of features. Each feature can be configured with a number of parameters.
  12494. @item psnr
  12495. Deprecated, use feature='name=psnr'.
  12496. @item ssim
  12497. Deprecated, use feature='name=ssim'.
  12498. @item ms_ssim
  12499. Deprecated, use feature='name=ms_ssim'.
  12500. @item log_path
  12501. Set the file path to be used to store log files.
  12502. @item log_fmt
  12503. Set the format of the log file (xml, json, csv, or sub).
  12504. @item n_threads
  12505. Set number of threads to be used when initializing libvmaf.
  12506. Default value: @code{0}, no threads.
  12507. @item n_subsample
  12508. Set frame subsampling interval to be used.
  12509. @end table
  12510. This filter also supports the @ref{framesync} options.
  12511. @subsection Examples
  12512. @itemize
  12513. @item
  12514. In the examples below, a distorted video @file{distorted.mpg} is
  12515. compared with a reference file @file{reference.mpg}.
  12516. @item
  12517. Basic usage:
  12518. @example
  12519. ffmpeg -i distorted.mpg -i reference.mpg -lavfi libvmaf=log_path=output.xml -f null -
  12520. @end example
  12521. @item
  12522. Example with multiple models:
  12523. @example
  12524. ffmpeg -i distorted.mpg -i reference.mpg -lavfi libvmaf='model=version=vmaf_v0.6.1\\:name=vmaf|version=vmaf_v0.6.1neg\\:name=vmaf_neg' -f null -
  12525. @end example
  12526. @item
  12527. Example with multiple addtional features:
  12528. @example
  12529. ffmpeg -i distorted.mpg -i reference.mpg -lavfi libvmaf='feature=name=psnr|name=ciede' -f null -
  12530. @end example
  12531. @item
  12532. Example with options and different containers:
  12533. @example
  12534. ffmpeg -i distorted.mpg -i reference.mkv -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=AVTB,setpts=PTS-STARTPTS[ref];[main][ref]libvmaf=log_fmt=json:log_path=output.json" -f null -
  12535. @end example
  12536. @end itemize
  12537. @section limitdiff
  12538. Apply limited difference filter using second and optionally third video stream.
  12539. The filter accepts the following options:
  12540. @table @option
  12541. @item threshold
  12542. Set the threshold to use when allowing certain differences between video streams.
  12543. Any absolute difference value lower or exact than this threshold will pick pixel components from
  12544. first video stream.
  12545. @item elasticity
  12546. Set the elasticity of soft thresholding when processing video streams.
  12547. This value multiplied with first one sets second threshold.
  12548. Any absolute difference value greater or exact than second threshold will pick pixel components
  12549. from second video stream. For values between those two threshold
  12550. linear interpolation between first and second video stream will be used.
  12551. @item reference
  12552. Enable the reference (third) video stream processing. By default is disabled.
  12553. If set, this video stream will be used for calculating absolute difference with first video
  12554. stream.
  12555. @item planes
  12556. Specify which planes will be processed. Defaults to all available.
  12557. @end table
  12558. @subsection Commands
  12559. This filter supports the all above options as @ref{commands} except option @samp{reference}.
  12560. @section limiter
  12561. Limits the pixel components values to the specified range [min, max].
  12562. The filter accepts the following options:
  12563. @table @option
  12564. @item min
  12565. Lower bound. Defaults to the lowest allowed value for the input.
  12566. @item max
  12567. Upper bound. Defaults to the highest allowed value for the input.
  12568. @item planes
  12569. Specify which planes will be processed. Defaults to all available.
  12570. @end table
  12571. @subsection Commands
  12572. This filter supports the all above options as @ref{commands}.
  12573. @section loop
  12574. Loop video frames.
  12575. The filter accepts the following options:
  12576. @table @option
  12577. @item loop
  12578. Set the number of loops. Setting this value to -1 will result in infinite loops.
  12579. Default is 0.
  12580. @item size
  12581. Set maximal size in number of frames. Default is 0.
  12582. @item start
  12583. Set first frame of loop. Default is 0.
  12584. @end table
  12585. @subsection Examples
  12586. @itemize
  12587. @item
  12588. Loop single first frame infinitely:
  12589. @example
  12590. loop=loop=-1:size=1:start=0
  12591. @end example
  12592. @item
  12593. Loop single first frame 10 times:
  12594. @example
  12595. loop=loop=10:size=1:start=0
  12596. @end example
  12597. @item
  12598. Loop 10 first frames 5 times:
  12599. @example
  12600. loop=loop=5:size=10:start=0
  12601. @end example
  12602. @end itemize
  12603. @section lut1d
  12604. Apply a 1D LUT to an input video.
  12605. The filter accepts the following options:
  12606. @table @option
  12607. @item file
  12608. Set the 1D LUT file name.
  12609. Currently supported formats:
  12610. @table @samp
  12611. @item cube
  12612. Iridas
  12613. @item csp
  12614. cineSpace
  12615. @end table
  12616. @item interp
  12617. Select interpolation mode.
  12618. Available values are:
  12619. @table @samp
  12620. @item nearest
  12621. Use values from the nearest defined point.
  12622. @item linear
  12623. Interpolate values using the linear interpolation.
  12624. @item cosine
  12625. Interpolate values using the cosine interpolation.
  12626. @item cubic
  12627. Interpolate values using the cubic interpolation.
  12628. @item spline
  12629. Interpolate values using the spline interpolation.
  12630. @end table
  12631. @end table
  12632. @subsection Commands
  12633. This filter supports the all above options as @ref{commands}.
  12634. @anchor{lut3d}
  12635. @section lut3d
  12636. Apply a 3D LUT to an input video.
  12637. The filter accepts the following options:
  12638. @table @option
  12639. @item file
  12640. Set the 3D LUT file name.
  12641. Currently supported formats:
  12642. @table @samp
  12643. @item 3dl
  12644. AfterEffects
  12645. @item cube
  12646. Iridas
  12647. @item dat
  12648. DaVinci
  12649. @item m3d
  12650. Pandora
  12651. @item csp
  12652. cineSpace
  12653. @end table
  12654. @item interp
  12655. Select interpolation mode.
  12656. Available values are:
  12657. @table @samp
  12658. @item nearest
  12659. Use values from the nearest defined point.
  12660. @item trilinear
  12661. Interpolate values using the 8 points defining a cube.
  12662. @item tetrahedral
  12663. Interpolate values using a tetrahedron.
  12664. @item pyramid
  12665. Interpolate values using a pyramid.
  12666. @item prism
  12667. Interpolate values using a prism.
  12668. @end table
  12669. @end table
  12670. @subsection Commands
  12671. This filter supports the @code{interp} option as @ref{commands}.
  12672. @section lumakey
  12673. Turn certain luma values into transparency.
  12674. The filter accepts the following options:
  12675. @table @option
  12676. @item threshold
  12677. Set the luma which will be used as base for transparency.
  12678. Default value is @code{0}.
  12679. @item tolerance
  12680. Set the range of luma values to be keyed out.
  12681. Default value is @code{0.01}.
  12682. @item softness
  12683. Set the range of softness. Default value is @code{0}.
  12684. Use this to control gradual transition from zero to full transparency.
  12685. @end table
  12686. @subsection Commands
  12687. This filter supports same @ref{commands} as options.
  12688. The command accepts the same syntax of the corresponding option.
  12689. If the specified expression is not valid, it is kept at its current
  12690. value.
  12691. @section lut, lutrgb, lutyuv
  12692. Compute a look-up table for binding each pixel component input value
  12693. to an output value, and apply it to the input video.
  12694. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  12695. to an RGB input video.
  12696. These filters accept the following parameters:
  12697. @table @option
  12698. @item c0
  12699. set first pixel component expression
  12700. @item c1
  12701. set second pixel component expression
  12702. @item c2
  12703. set third pixel component expression
  12704. @item c3
  12705. set fourth pixel component expression, corresponds to the alpha component
  12706. @item r
  12707. set red component expression
  12708. @item g
  12709. set green component expression
  12710. @item b
  12711. set blue component expression
  12712. @item a
  12713. alpha component expression
  12714. @item y
  12715. set Y/luminance component expression
  12716. @item u
  12717. set U/Cb component expression
  12718. @item v
  12719. set V/Cr component expression
  12720. @end table
  12721. Each of them specifies the expression to use for computing the lookup table for
  12722. the corresponding pixel component values.
  12723. The exact component associated to each of the @var{c*} options depends on the
  12724. format in input.
  12725. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  12726. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  12727. The expressions can contain the following constants and functions:
  12728. @table @option
  12729. @item w
  12730. @item h
  12731. The input width and height.
  12732. @item val
  12733. The input value for the pixel component.
  12734. @item clipval
  12735. The input value, clipped to the @var{minval}-@var{maxval} range.
  12736. @item maxval
  12737. The maximum value for the pixel component.
  12738. @item minval
  12739. The minimum value for the pixel component.
  12740. @item negval
  12741. The negated value for the pixel component value, clipped to the
  12742. @var{minval}-@var{maxval} range; it corresponds to the expression
  12743. "maxval-clipval+minval".
  12744. @item clip(val)
  12745. The computed value in @var{val}, clipped to the
  12746. @var{minval}-@var{maxval} range.
  12747. @item gammaval(gamma)
  12748. The computed gamma correction value of the pixel component value,
  12749. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  12750. expression
  12751. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  12752. @end table
  12753. All expressions default to "clipval".
  12754. @subsection Commands
  12755. This filter supports same @ref{commands} as options.
  12756. @subsection Examples
  12757. @itemize
  12758. @item
  12759. Negate input video:
  12760. @example
  12761. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  12762. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  12763. @end example
  12764. The above is the same as:
  12765. @example
  12766. lutrgb="r=negval:g=negval:b=negval"
  12767. lutyuv="y=negval:u=negval:v=negval"
  12768. @end example
  12769. @item
  12770. Negate luminance:
  12771. @example
  12772. lutyuv=y=negval
  12773. @end example
  12774. @item
  12775. Remove chroma components, turning the video into a graytone image:
  12776. @example
  12777. lutyuv="u=128:v=128"
  12778. @end example
  12779. @item
  12780. Apply a luma burning effect:
  12781. @example
  12782. lutyuv="y=2*val"
  12783. @end example
  12784. @item
  12785. Remove green and blue components:
  12786. @example
  12787. lutrgb="g=0:b=0"
  12788. @end example
  12789. @item
  12790. Set a constant alpha channel value on input:
  12791. @example
  12792. format=rgba,lutrgb=a="maxval-minval/2"
  12793. @end example
  12794. @item
  12795. Correct luminance gamma by a factor of 0.5:
  12796. @example
  12797. lutyuv=y=gammaval(0.5)
  12798. @end example
  12799. @item
  12800. Discard least significant bits of luma:
  12801. @example
  12802. lutyuv=y='bitand(val, 128+64+32)'
  12803. @end example
  12804. @item
  12805. Technicolor like effect:
  12806. @example
  12807. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  12808. @end example
  12809. @end itemize
  12810. @section lut2, tlut2
  12811. The @code{lut2} filter takes two input streams and outputs one
  12812. stream.
  12813. The @code{tlut2} (time lut2) filter takes two consecutive frames
  12814. from one single stream.
  12815. This filter accepts the following parameters:
  12816. @table @option
  12817. @item c0
  12818. set first pixel component expression
  12819. @item c1
  12820. set second pixel component expression
  12821. @item c2
  12822. set third pixel component expression
  12823. @item c3
  12824. set fourth pixel component expression, corresponds to the alpha component
  12825. @item d
  12826. set output bit depth, only available for @code{lut2} filter. By default is 0,
  12827. which means bit depth is automatically picked from first input format.
  12828. @end table
  12829. The @code{lut2} filter also supports the @ref{framesync} options.
  12830. Each of them specifies the expression to use for computing the lookup table for
  12831. the corresponding pixel component values.
  12832. The exact component associated to each of the @var{c*} options depends on the
  12833. format in inputs.
  12834. The expressions can contain the following constants:
  12835. @table @option
  12836. @item w
  12837. @item h
  12838. The input width and height.
  12839. @item x
  12840. The first input value for the pixel component.
  12841. @item y
  12842. The second input value for the pixel component.
  12843. @item bdx
  12844. The first input video bit depth.
  12845. @item bdy
  12846. The second input video bit depth.
  12847. @end table
  12848. All expressions default to "x".
  12849. @subsection Commands
  12850. This filter supports the all above options as @ref{commands} except option @code{d}.
  12851. @subsection Examples
  12852. @itemize
  12853. @item
  12854. Highlight differences between two RGB video streams:
  12855. @example
  12856. 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)'
  12857. @end example
  12858. @item
  12859. Highlight differences between two YUV video streams:
  12860. @example
  12861. 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)'
  12862. @end example
  12863. @item
  12864. Show max difference between two video streams:
  12865. @example
  12866. 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)))'
  12867. @end example
  12868. @end itemize
  12869. @section maskedclamp
  12870. Clamp the first input stream with the second input and third input stream.
  12871. Returns the value of first stream to be between second input
  12872. stream - @code{undershoot} and third input stream + @code{overshoot}.
  12873. This filter accepts the following options:
  12874. @table @option
  12875. @item undershoot
  12876. Default value is @code{0}.
  12877. @item overshoot
  12878. Default value is @code{0}.
  12879. @item planes
  12880. Set which planes will be processed as bitmap, unprocessed planes will be
  12881. copied from first stream.
  12882. By default value 0xf, all planes will be processed.
  12883. @end table
  12884. @subsection Commands
  12885. This filter supports the all above options as @ref{commands}.
  12886. @section maskedmax
  12887. Merge the second and third input stream into output stream using absolute differences
  12888. between second input stream and first input stream and absolute difference between
  12889. third input stream and first input stream. The picked value will be from second input
  12890. stream if second absolute difference is greater than first one or from third input stream
  12891. otherwise.
  12892. This filter accepts the following options:
  12893. @table @option
  12894. @item planes
  12895. Set which planes will be processed as bitmap, unprocessed planes will be
  12896. copied from first stream.
  12897. By default value 0xf, all planes will be processed.
  12898. @end table
  12899. @subsection Commands
  12900. This filter supports the all above options as @ref{commands}.
  12901. @section maskedmerge
  12902. Merge the first input stream with the second input stream using per pixel
  12903. weights in the third input stream.
  12904. A value of 0 in the third stream pixel component means that pixel component
  12905. from first stream is returned unchanged, while maximum value (eg. 255 for
  12906. 8-bit videos) means that pixel component from second stream is returned
  12907. unchanged. Intermediate values define the amount of merging between both
  12908. input stream's pixel components.
  12909. This filter accepts the following options:
  12910. @table @option
  12911. @item planes
  12912. Set which planes will be processed as bitmap, unprocessed planes will be
  12913. copied from first stream.
  12914. By default value 0xf, all planes will be processed.
  12915. @end table
  12916. @subsection Commands
  12917. This filter supports the all above options as @ref{commands}.
  12918. @section maskedmin
  12919. Merge the second and third input stream into output stream using absolute differences
  12920. between second input stream and first input stream and absolute difference between
  12921. third input stream and first input stream. The picked value will be from second input
  12922. stream if second absolute difference is less than first one or from third input stream
  12923. otherwise.
  12924. This filter accepts the following options:
  12925. @table @option
  12926. @item planes
  12927. Set which planes will be processed as bitmap, unprocessed planes will be
  12928. copied from first stream.
  12929. By default value 0xf, all planes will be processed.
  12930. @end table
  12931. @subsection Commands
  12932. This filter supports the all above options as @ref{commands}.
  12933. @section maskedthreshold
  12934. Pick pixels comparing absolute difference of two video streams with fixed
  12935. threshold.
  12936. If absolute difference between pixel component of first and second video
  12937. stream is equal or lower than user supplied threshold than pixel component
  12938. from first video stream is picked, otherwise pixel component from second
  12939. video stream is picked.
  12940. This filter accepts the following options:
  12941. @table @option
  12942. @item threshold
  12943. Set threshold used when picking pixels from absolute difference from two input
  12944. video streams.
  12945. @item planes
  12946. Set which planes will be processed as bitmap, unprocessed planes will be
  12947. copied from second stream.
  12948. By default value 0xf, all planes will be processed.
  12949. @item mode
  12950. Set mode of filter operation. Can be @code{abs} or @code{diff}.
  12951. Default is @code{abs}.
  12952. @end table
  12953. @subsection Commands
  12954. This filter supports the all above options as @ref{commands}.
  12955. @section maskfun
  12956. Create mask from input video.
  12957. For example it is useful to create motion masks after @code{tblend} filter.
  12958. This filter accepts the following options:
  12959. @table @option
  12960. @item low
  12961. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  12962. @item high
  12963. Set high threshold. Any pixel component higher than this value will be set to max value
  12964. allowed for current pixel format.
  12965. @item planes
  12966. Set planes to filter, by default all available planes are filtered.
  12967. @item fill
  12968. Fill all frame pixels with this value.
  12969. @item sum
  12970. Set max average pixel value for frame. If sum of all pixel components is higher that this
  12971. average, output frame will be completely filled with value set by @var{fill} option.
  12972. Typically useful for scene changes when used in combination with @code{tblend} filter.
  12973. @end table
  12974. @subsection Commands
  12975. This filter supports the all above options as @ref{commands}.
  12976. @section mcdeint
  12977. Apply motion-compensation deinterlacing.
  12978. It needs one field per frame as input and must thus be used together
  12979. with yadif=1/3 or equivalent.
  12980. This filter is only available in ffmpeg version 4.4 or earlier.
  12981. This filter accepts the following options:
  12982. @table @option
  12983. @item mode
  12984. Set the deinterlacing mode.
  12985. It accepts one of the following values:
  12986. @table @samp
  12987. @item fast
  12988. @item medium
  12989. @item slow
  12990. use iterative motion estimation
  12991. @item extra_slow
  12992. like @samp{slow}, but use multiple reference frames.
  12993. @end table
  12994. Default value is @samp{fast}.
  12995. @item parity
  12996. Set the picture field parity assumed for the input video. It must be
  12997. one of the following values:
  12998. @table @samp
  12999. @item 0, tff
  13000. assume top field first
  13001. @item 1, bff
  13002. assume bottom field first
  13003. @end table
  13004. Default value is @samp{bff}.
  13005. @item qp
  13006. Set per-block quantization parameter (QP) used by the internal
  13007. encoder.
  13008. Higher values should result in a smoother motion vector field but less
  13009. optimal individual vectors. Default value is 1.
  13010. @end table
  13011. @section median
  13012. Pick median pixel from certain rectangle defined by radius.
  13013. This filter accepts the following options:
  13014. @table @option
  13015. @item radius
  13016. Set horizontal radius size. Default value is @code{1}.
  13017. Allowed range is integer from 1 to 127.
  13018. @item planes
  13019. Set which planes to process. Default is @code{15}, which is all available planes.
  13020. @item radiusV
  13021. Set vertical radius size. Default value is @code{0}.
  13022. Allowed range is integer from 0 to 127.
  13023. If it is 0, value will be picked from horizontal @code{radius} option.
  13024. @item percentile
  13025. Set median percentile. Default value is @code{0.5}.
  13026. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  13027. minimum values, and @code{1} maximum values.
  13028. @end table
  13029. @subsection Commands
  13030. This filter supports same @ref{commands} as options.
  13031. The command accepts the same syntax of the corresponding option.
  13032. If the specified expression is not valid, it is kept at its current
  13033. value.
  13034. @section mergeplanes
  13035. Merge color channel components from several video streams.
  13036. The filter accepts up to 4 input streams, and merge selected input
  13037. planes to the output video.
  13038. This filter accepts the following options:
  13039. @table @option
  13040. @item mapping
  13041. Set input to output plane mapping. Default is @code{0}.
  13042. The mappings is specified as a bitmap. It should be specified as a
  13043. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  13044. mapping for the first plane of the output stream. 'A' sets the number of
  13045. the input stream to use (from 0 to 3), and 'a' the plane number of the
  13046. corresponding input to use (from 0 to 3). The rest of the mappings is
  13047. similar, 'Bb' describes the mapping for the output stream second
  13048. plane, 'Cc' describes the mapping for the output stream third plane and
  13049. 'Dd' describes the mapping for the output stream fourth plane.
  13050. @item format
  13051. Set output pixel format. Default is @code{yuva444p}.
  13052. @item map0s
  13053. @item map1s
  13054. @item map2s
  13055. @item map3s
  13056. Set input to output stream mapping for output Nth plane. Default is @code{0}.
  13057. @item map0p
  13058. @item map1p
  13059. @item map2p
  13060. @item map3p
  13061. Set input to output plane mapping for output Nth plane. Default is @code{0}.
  13062. @end table
  13063. @subsection Examples
  13064. @itemize
  13065. @item
  13066. Merge three gray video streams of same width and height into single video stream:
  13067. @example
  13068. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  13069. @end example
  13070. @item
  13071. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  13072. @example
  13073. [a0][a1]mergeplanes=0x00010210:yuva444p
  13074. @end example
  13075. @item
  13076. Swap Y and A plane in yuva444p stream:
  13077. @example
  13078. format=yuva444p,mergeplanes=0x03010200:yuva444p
  13079. @end example
  13080. @item
  13081. Swap U and V plane in yuv420p stream:
  13082. @example
  13083. format=yuv420p,mergeplanes=0x000201:yuv420p
  13084. @end example
  13085. @item
  13086. Cast a rgb24 clip to yuv444p:
  13087. @example
  13088. format=rgb24,mergeplanes=0x000102:yuv444p
  13089. @end example
  13090. @end itemize
  13091. @section mestimate
  13092. Estimate and export motion vectors using block matching algorithms.
  13093. Motion vectors are stored in frame side data to be used by other filters.
  13094. This filter accepts the following options:
  13095. @table @option
  13096. @item method
  13097. Specify the motion estimation method. Accepts one of the following values:
  13098. @table @samp
  13099. @item esa
  13100. Exhaustive search algorithm.
  13101. @item tss
  13102. Three step search algorithm.
  13103. @item tdls
  13104. Two dimensional logarithmic search algorithm.
  13105. @item ntss
  13106. New three step search algorithm.
  13107. @item fss
  13108. Four step search algorithm.
  13109. @item ds
  13110. Diamond search algorithm.
  13111. @item hexbs
  13112. Hexagon-based search algorithm.
  13113. @item epzs
  13114. Enhanced predictive zonal search algorithm.
  13115. @item umh
  13116. Uneven multi-hexagon search algorithm.
  13117. @end table
  13118. Default value is @samp{esa}.
  13119. @item mb_size
  13120. Macroblock size. Default @code{16}.
  13121. @item search_param
  13122. Search parameter. Default @code{7}.
  13123. @end table
  13124. @section midequalizer
  13125. Apply Midway Image Equalization effect using two video streams.
  13126. Midway Image Equalization adjusts a pair of images to have the same
  13127. histogram, while maintaining their dynamics as much as possible. It's
  13128. useful for e.g. matching exposures from a pair of stereo cameras.
  13129. This filter has two inputs and one output, which must be of same pixel format, but
  13130. may be of different sizes. The output of filter is first input adjusted with
  13131. midway histogram of both inputs.
  13132. This filter accepts the following option:
  13133. @table @option
  13134. @item planes
  13135. Set which planes to process. Default is @code{15}, which is all available planes.
  13136. @end table
  13137. @section minterpolate
  13138. Convert the video to specified frame rate using motion interpolation.
  13139. This filter accepts the following options:
  13140. @table @option
  13141. @item fps
  13142. 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}.
  13143. @item mi_mode
  13144. Motion interpolation mode. Following values are accepted:
  13145. @table @samp
  13146. @item dup
  13147. Duplicate previous or next frame for interpolating new ones.
  13148. @item blend
  13149. Blend source frames. Interpolated frame is mean of previous and next frames.
  13150. @item mci
  13151. Motion compensated interpolation. Following options are effective when this mode is selected:
  13152. @table @samp
  13153. @item mc_mode
  13154. Motion compensation mode. Following values are accepted:
  13155. @table @samp
  13156. @item obmc
  13157. Overlapped block motion compensation.
  13158. @item aobmc
  13159. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  13160. @end table
  13161. Default mode is @samp{obmc}.
  13162. @item me_mode
  13163. Motion estimation mode. Following values are accepted:
  13164. @table @samp
  13165. @item bidir
  13166. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  13167. @item bilat
  13168. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  13169. @end table
  13170. Default mode is @samp{bilat}.
  13171. @item me
  13172. The algorithm to be used for motion estimation. Following values are accepted:
  13173. @table @samp
  13174. @item esa
  13175. Exhaustive search algorithm.
  13176. @item tss
  13177. Three step search algorithm.
  13178. @item tdls
  13179. Two dimensional logarithmic search algorithm.
  13180. @item ntss
  13181. New three step search algorithm.
  13182. @item fss
  13183. Four step search algorithm.
  13184. @item ds
  13185. Diamond search algorithm.
  13186. @item hexbs
  13187. Hexagon-based search algorithm.
  13188. @item epzs
  13189. Enhanced predictive zonal search algorithm.
  13190. @item umh
  13191. Uneven multi-hexagon search algorithm.
  13192. @end table
  13193. Default algorithm is @samp{epzs}.
  13194. @item mb_size
  13195. Macroblock size. Default @code{16}.
  13196. @item search_param
  13197. Motion estimation search parameter. Default @code{32}.
  13198. @item vsbmc
  13199. 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).
  13200. @end table
  13201. @end table
  13202. @item scd
  13203. 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:
  13204. @table @samp
  13205. @item none
  13206. Disable scene change detection.
  13207. @item fdiff
  13208. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  13209. @end table
  13210. Default method is @samp{fdiff}.
  13211. @item scd_threshold
  13212. Scene change detection threshold. Default is @code{10.}.
  13213. @end table
  13214. @section mix
  13215. Mix several video input streams into one video stream.
  13216. A description of the accepted options follows.
  13217. @table @option
  13218. @item inputs
  13219. The number of inputs. If unspecified, it defaults to 2.
  13220. @item weights
  13221. Specify weight of each input video stream as sequence.
  13222. Each weight is separated by space. If number of weights
  13223. is smaller than number of @var{frames} last specified
  13224. weight will be used for all remaining unset weights.
  13225. @item scale
  13226. Specify scale, if it is set it will be multiplied with sum
  13227. of each weight multiplied with pixel values to give final destination
  13228. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13229. @item planes
  13230. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  13231. @item duration
  13232. Specify how end of stream is determined.
  13233. @table @samp
  13234. @item longest
  13235. The duration of the longest input. (default)
  13236. @item shortest
  13237. The duration of the shortest input.
  13238. @item first
  13239. The duration of the first input.
  13240. @end table
  13241. @end table
  13242. @subsection Commands
  13243. This filter supports the following commands:
  13244. @table @option
  13245. @item weights
  13246. @item scale
  13247. @item planes
  13248. Syntax is same as option with same name.
  13249. @end table
  13250. @section monochrome
  13251. Convert video to gray using custom color filter.
  13252. A description of the accepted options follows.
  13253. @table @option
  13254. @item cb
  13255. Set the chroma blue spot. Allowed range is from -1 to 1.
  13256. Default value is 0.
  13257. @item cr
  13258. Set the chroma red spot. Allowed range is from -1 to 1.
  13259. Default value is 0.
  13260. @item size
  13261. Set the color filter size. Allowed range is from .1 to 10.
  13262. Default value is 1.
  13263. @item high
  13264. Set the highlights strength. Allowed range is from 0 to 1.
  13265. Default value is 0.
  13266. @end table
  13267. @subsection Commands
  13268. This filter supports the all above options as @ref{commands}.
  13269. @section morpho
  13270. This filter allows to apply main morphological grayscale transforms,
  13271. erode and dilate with arbitrary structures set in second input stream.
  13272. Unlike naive implementation and much slower performance in @ref{erosion}
  13273. and @ref{dilation} filters, when speed is critical @code{morpho} filter
  13274. should be used instead.
  13275. A description of accepted options follows,
  13276. @table @option
  13277. @item mode
  13278. Set morphological transform to apply, can be:
  13279. @table @samp
  13280. @item erode
  13281. @item dilate
  13282. @item open
  13283. @item close
  13284. @item gradient
  13285. @item tophat
  13286. @item blackhat
  13287. @end table
  13288. Default is @code{erode}.
  13289. @item planes
  13290. Set planes to filter, by default all planes except alpha are filtered.
  13291. @item structure
  13292. Set which structure video frames will be processed from second input stream,
  13293. can be @var{first} or @var{all}. Default is @var{all}.
  13294. @end table
  13295. The @code{morpho} filter also supports the @ref{framesync} options.
  13296. @subsection Commands
  13297. This filter supports same @ref{commands} as options.
  13298. @section mpdecimate
  13299. Drop frames that do not differ greatly from the previous frame in
  13300. order to reduce frame rate.
  13301. The main use of this filter is for very-low-bitrate encoding
  13302. (e.g. streaming over dialup modem), but it could in theory be used for
  13303. fixing movies that were inverse-telecined incorrectly.
  13304. A description of the accepted options follows.
  13305. @table @option
  13306. @item max
  13307. Set the maximum number of consecutive frames which can be dropped (if
  13308. positive), or the minimum interval between dropped frames (if
  13309. negative). If the value is 0, the frame is dropped disregarding the
  13310. number of previous sequentially dropped frames.
  13311. Default value is 0.
  13312. @item hi
  13313. @item lo
  13314. @item frac
  13315. Set the dropping threshold values.
  13316. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  13317. represent actual pixel value differences, so a threshold of 64
  13318. corresponds to 1 unit of difference for each pixel, or the same spread
  13319. out differently over the block.
  13320. A frame is a candidate for dropping if no 8x8 blocks differ by more
  13321. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  13322. meaning the whole image) differ by more than a threshold of @option{lo}.
  13323. Default value for @option{hi} is 64*12, default value for @option{lo} is
  13324. 64*5, and default value for @option{frac} is 0.33.
  13325. @end table
  13326. @section msad
  13327. Obtain the MSAD (Mean Sum of Absolute Differences) between two input videos.
  13328. This filter takes two input videos.
  13329. Both input videos must have the same resolution and pixel format for
  13330. this filter to work correctly. Also it assumes that both inputs
  13331. have the same number of frames, which are compared one by one.
  13332. The obtained per component, average, min and max MSAD is printed through
  13333. the logging system.
  13334. The filter stores the calculated MSAD of each frame in frame metadata.
  13335. This filter also supports the @ref{framesync} options.
  13336. In the below example the input file @file{main.mpg} being processed is compared
  13337. with the reference file @file{ref.mpg}.
  13338. @example
  13339. ffmpeg -i main.mpg -i ref.mpg -lavfi msad -f null -
  13340. @end example
  13341. @section multiply
  13342. Multiply first video stream pixels values with second video stream pixels values.
  13343. The filter accepts the following options:
  13344. @table @option
  13345. @item scale
  13346. Set the scale applied to second video stream. By default is @code{1}.
  13347. Allowed range is from @code{0} to @code{9}.
  13348. @item offset
  13349. Set the offset applied to second video stream. By default is @code{0.5}.
  13350. Allowed range is from @code{-1} to @code{1}.
  13351. @item planes
  13352. Specify planes from input video stream that will be processed.
  13353. By default all planes are processed.
  13354. @end table
  13355. @subsection Commands
  13356. This filter supports same @ref{commands} as options.
  13357. @section negate
  13358. Negate (invert) the input video.
  13359. It accepts the following option:
  13360. @table @option
  13361. @item components
  13362. Set components to negate.
  13363. Available values for components are:
  13364. @table @samp
  13365. @item y
  13366. @item u
  13367. @item v
  13368. @item a
  13369. @item r
  13370. @item g
  13371. @item b
  13372. @end table
  13373. @item negate_alpha
  13374. With value 1, it negates the alpha component, if present. Default value is 0.
  13375. @end table
  13376. @subsection Commands
  13377. This filter supports same @ref{commands} as options.
  13378. @anchor{nlmeans}
  13379. @section nlmeans
  13380. Denoise frames using Non-Local Means algorithm.
  13381. Each pixel is adjusted by looking for other pixels with similar contexts. This
  13382. context similarity is defined by comparing their surrounding patches of size
  13383. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  13384. around the pixel.
  13385. Note that the research area defines centers for patches, which means some
  13386. patches will be made of pixels outside that research area.
  13387. The filter accepts the following options.
  13388. @table @option
  13389. @item s
  13390. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  13391. @item p
  13392. Set patch size. Default is 7. Must be odd number in range [0, 99].
  13393. @item pc
  13394. Same as @option{p} but for chroma planes.
  13395. The default value is @var{0} and means automatic.
  13396. @item r
  13397. Set research size. Default is 15. Must be odd number in range [0, 99].
  13398. @item rc
  13399. Same as @option{r} but for chroma planes.
  13400. The default value is @var{0} and means automatic.
  13401. @end table
  13402. @section nnedi
  13403. Deinterlace video using neural network edge directed interpolation.
  13404. This filter accepts the following options:
  13405. @table @option
  13406. @item weights
  13407. Mandatory option, without binary file filter can not work.
  13408. Currently file can be found here:
  13409. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  13410. @item deint
  13411. Set which frames to deinterlace, by default it is @code{all}.
  13412. Can be @code{all} or @code{interlaced}.
  13413. @item field
  13414. Set mode of operation.
  13415. Can be one of the following:
  13416. @table @samp
  13417. @item af
  13418. Use frame flags, both fields.
  13419. @item a
  13420. Use frame flags, single field.
  13421. @item t
  13422. Use top field only.
  13423. @item b
  13424. Use bottom field only.
  13425. @item tf
  13426. Use both fields, top first.
  13427. @item bf
  13428. Use both fields, bottom first.
  13429. @end table
  13430. @item planes
  13431. Set which planes to process, by default filter process all frames.
  13432. @item nsize
  13433. Set size of local neighborhood around each pixel, used by the predictor neural
  13434. network.
  13435. Can be one of the following:
  13436. @table @samp
  13437. @item s8x6
  13438. @item s16x6
  13439. @item s32x6
  13440. @item s48x6
  13441. @item s8x4
  13442. @item s16x4
  13443. @item s32x4
  13444. @end table
  13445. @item nns
  13446. Set the number of neurons in predictor neural network.
  13447. Can be one of the following:
  13448. @table @samp
  13449. @item n16
  13450. @item n32
  13451. @item n64
  13452. @item n128
  13453. @item n256
  13454. @end table
  13455. @item qual
  13456. Controls the number of different neural network predictions that are blended
  13457. together to compute the final output value. Can be @code{fast}, default or
  13458. @code{slow}.
  13459. @item etype
  13460. Set which set of weights to use in the predictor.
  13461. Can be one of the following:
  13462. @table @samp
  13463. @item a, abs
  13464. weights trained to minimize absolute error
  13465. @item s, mse
  13466. weights trained to minimize squared error
  13467. @end table
  13468. @item pscrn
  13469. Controls whether or not the prescreener neural network is used to decide
  13470. which pixels should be processed by the predictor neural network and which
  13471. can be handled by simple cubic interpolation.
  13472. The prescreener is trained to know whether cubic interpolation will be
  13473. sufficient for a pixel or whether it should be predicted by the predictor nn.
  13474. The computational complexity of the prescreener nn is much less than that of
  13475. the predictor nn. Since most pixels can be handled by cubic interpolation,
  13476. using the prescreener generally results in much faster processing.
  13477. The prescreener is pretty accurate, so the difference between using it and not
  13478. using it is almost always unnoticeable.
  13479. Can be one of the following:
  13480. @table @samp
  13481. @item none
  13482. @item original
  13483. @item new
  13484. @item new2
  13485. @item new3
  13486. @end table
  13487. Default is @code{new}.
  13488. @end table
  13489. @subsection Commands
  13490. This filter supports same @ref{commands} as options, excluding @var{weights} option.
  13491. @section noformat
  13492. Force libavfilter not to use any of the specified pixel formats for the
  13493. input to the next filter.
  13494. It accepts the following parameters:
  13495. @table @option
  13496. @item pix_fmts
  13497. A '|'-separated list of pixel format names, such as
  13498. pix_fmts=yuv420p|monow|rgb24".
  13499. @end table
  13500. @subsection Examples
  13501. @itemize
  13502. @item
  13503. Force libavfilter to use a format different from @var{yuv420p} for the
  13504. input to the vflip filter:
  13505. @example
  13506. noformat=pix_fmts=yuv420p,vflip
  13507. @end example
  13508. @item
  13509. Convert the input video to any of the formats not contained in the list:
  13510. @example
  13511. noformat=yuv420p|yuv444p|yuv410p
  13512. @end example
  13513. @end itemize
  13514. @section noise
  13515. Add noise on video input frame.
  13516. The filter accepts the following options:
  13517. @table @option
  13518. @item all_seed
  13519. @item c0_seed
  13520. @item c1_seed
  13521. @item c2_seed
  13522. @item c3_seed
  13523. Set noise seed for specific pixel component or all pixel components in case
  13524. of @var{all_seed}. Default value is @code{123457}.
  13525. @item all_strength, alls
  13526. @item c0_strength, c0s
  13527. @item c1_strength, c1s
  13528. @item c2_strength, c2s
  13529. @item c3_strength, c3s
  13530. Set noise strength for specific pixel component or all pixel components in case
  13531. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  13532. @item all_flags, allf
  13533. @item c0_flags, c0f
  13534. @item c1_flags, c1f
  13535. @item c2_flags, c2f
  13536. @item c3_flags, c3f
  13537. Set pixel component flags or set flags for all components if @var{all_flags}.
  13538. Available values for component flags are:
  13539. @table @samp
  13540. @item a
  13541. averaged temporal noise (smoother)
  13542. @item p
  13543. mix random noise with a (semi)regular pattern
  13544. @item t
  13545. temporal noise (noise pattern changes between frames)
  13546. @item u
  13547. uniform noise (gaussian otherwise)
  13548. @end table
  13549. @end table
  13550. @subsection Examples
  13551. Add temporal and uniform noise to input video:
  13552. @example
  13553. noise=alls=20:allf=t+u
  13554. @end example
  13555. @section normalize
  13556. Normalize RGB video (aka histogram stretching, contrast stretching).
  13557. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  13558. For each channel of each frame, the filter computes the input range and maps
  13559. it linearly to the user-specified output range. The output range defaults
  13560. to the full dynamic range from pure black to pure white.
  13561. Temporal smoothing can be used on the input range to reduce flickering (rapid
  13562. changes in brightness) caused when small dark or bright objects enter or leave
  13563. the scene. This is similar to the auto-exposure (automatic gain control) on a
  13564. video camera, and, like a video camera, it may cause a period of over- or
  13565. under-exposure of the video.
  13566. The R,G,B channels can be normalized independently, which may cause some
  13567. color shifting, or linked together as a single channel, which prevents
  13568. color shifting. Linked normalization preserves hue. Independent normalization
  13569. does not, so it can be used to remove some color casts. Independent and linked
  13570. normalization can be combined in any ratio.
  13571. The normalize filter accepts the following options:
  13572. @table @option
  13573. @item blackpt
  13574. @item whitept
  13575. Colors which define the output range. The minimum input value is mapped to
  13576. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  13577. The defaults are black and white respectively. Specifying white for
  13578. @var{blackpt} and black for @var{whitept} will give color-inverted,
  13579. normalized video. Shades of grey can be used to reduce the dynamic range
  13580. (contrast). Specifying saturated colors here can create some interesting
  13581. effects.
  13582. @item smoothing
  13583. The number of previous frames to use for temporal smoothing. The input range
  13584. of each channel is smoothed using a rolling average over the current frame
  13585. and the @var{smoothing} previous frames. The default is 0 (no temporal
  13586. smoothing).
  13587. @item independence
  13588. Controls the ratio of independent (color shifting) channel normalization to
  13589. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  13590. independent. Defaults to 1.0 (fully independent).
  13591. @item strength
  13592. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  13593. expensive no-op. Defaults to 1.0 (full strength).
  13594. @end table
  13595. @subsection Commands
  13596. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  13597. The command accepts the same syntax of the corresponding option.
  13598. If the specified expression is not valid, it is kept at its current
  13599. value.
  13600. @subsection Examples
  13601. Stretch video contrast to use the full dynamic range, with no temporal
  13602. smoothing; may flicker depending on the source content:
  13603. @example
  13604. normalize=blackpt=black:whitept=white:smoothing=0
  13605. @end example
  13606. As above, but with 50 frames of temporal smoothing; flicker should be
  13607. reduced, depending on the source content:
  13608. @example
  13609. normalize=blackpt=black:whitept=white:smoothing=50
  13610. @end example
  13611. As above, but with hue-preserving linked channel normalization:
  13612. @example
  13613. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  13614. @end example
  13615. As above, but with half strength:
  13616. @example
  13617. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  13618. @end example
  13619. Map the darkest input color to red, the brightest input color to cyan:
  13620. @example
  13621. normalize=blackpt=red:whitept=cyan
  13622. @end example
  13623. @section null
  13624. Pass the video source unchanged to the output.
  13625. @section ocr
  13626. Optical Character Recognition
  13627. This filter uses Tesseract for optical character recognition. To enable
  13628. compilation of this filter, you need to configure FFmpeg with
  13629. @code{--enable-libtesseract}.
  13630. It accepts the following options:
  13631. @table @option
  13632. @item datapath
  13633. Set datapath to tesseract data. Default is to use whatever was
  13634. set at installation.
  13635. @item language
  13636. Set language, default is "eng".
  13637. @item whitelist
  13638. Set character whitelist.
  13639. @item blacklist
  13640. Set character blacklist.
  13641. @end table
  13642. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  13643. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  13644. @section ocv
  13645. Apply a video transform using libopencv.
  13646. To enable this filter, install the libopencv library and headers and
  13647. configure FFmpeg with @code{--enable-libopencv}.
  13648. It accepts the following parameters:
  13649. @table @option
  13650. @item filter_name
  13651. The name of the libopencv filter to apply.
  13652. @item filter_params
  13653. The parameters to pass to the libopencv filter. If not specified, the default
  13654. values are assumed.
  13655. @end table
  13656. Refer to the official libopencv documentation for more precise
  13657. information:
  13658. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  13659. Several libopencv filters are supported; see the following subsections.
  13660. @anchor{dilate}
  13661. @subsection dilate
  13662. Dilate an image by using a specific structuring element.
  13663. It corresponds to the libopencv function @code{cvDilate}.
  13664. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  13665. @var{struct_el} represents a structuring element, and has the syntax:
  13666. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  13667. @var{cols} and @var{rows} represent the number of columns and rows of
  13668. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  13669. point, and @var{shape} the shape for the structuring element. @var{shape}
  13670. must be "rect", "cross", "ellipse", or "custom".
  13671. If the value for @var{shape} is "custom", it must be followed by a
  13672. string of the form "=@var{filename}". The file with name
  13673. @var{filename} is assumed to represent a binary image, with each
  13674. printable character corresponding to a bright pixel. When a custom
  13675. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  13676. or columns and rows of the read file are assumed instead.
  13677. The default value for @var{struct_el} is "3x3+0x0/rect".
  13678. @var{nb_iterations} specifies the number of times the transform is
  13679. applied to the image, and defaults to 1.
  13680. Some examples:
  13681. @example
  13682. # Use the default values
  13683. ocv=dilate
  13684. # Dilate using a structuring element with a 5x5 cross, iterating two times
  13685. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  13686. # Read the shape from the file diamond.shape, iterating two times.
  13687. # The file diamond.shape may contain a pattern of characters like this
  13688. # *
  13689. # ***
  13690. # *****
  13691. # ***
  13692. # *
  13693. # The specified columns and rows are ignored
  13694. # but the anchor point coordinates are not
  13695. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  13696. @end example
  13697. @subsection erode
  13698. Erode an image by using a specific structuring element.
  13699. It corresponds to the libopencv function @code{cvErode}.
  13700. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  13701. with the same syntax and semantics as the @ref{dilate} filter.
  13702. @subsection smooth
  13703. Smooth the input video.
  13704. The filter takes the following parameters:
  13705. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  13706. @var{type} is the type of smooth filter to apply, and must be one of
  13707. the following values: "blur", "blur_no_scale", "median", "gaussian",
  13708. or "bilateral". The default value is "gaussian".
  13709. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  13710. depends on the smooth type. @var{param1} and
  13711. @var{param2} accept integer positive values or 0. @var{param3} and
  13712. @var{param4} accept floating point values.
  13713. The default value for @var{param1} is 3. The default value for the
  13714. other parameters is 0.
  13715. These parameters correspond to the parameters assigned to the
  13716. libopencv function @code{cvSmooth}.
  13717. @section oscilloscope
  13718. 2D Video Oscilloscope.
  13719. Useful to measure spatial impulse, step responses, chroma delays, etc.
  13720. It accepts the following parameters:
  13721. @table @option
  13722. @item x
  13723. Set scope center x position.
  13724. @item y
  13725. Set scope center y position.
  13726. @item s
  13727. Set scope size, relative to frame diagonal.
  13728. @item t
  13729. Set scope tilt/rotation.
  13730. @item o
  13731. Set trace opacity.
  13732. @item tx
  13733. Set trace center x position.
  13734. @item ty
  13735. Set trace center y position.
  13736. @item tw
  13737. Set trace width, relative to width of frame.
  13738. @item th
  13739. Set trace height, relative to height of frame.
  13740. @item c
  13741. Set which components to trace. By default it traces first three components.
  13742. @item g
  13743. Draw trace grid. By default is enabled.
  13744. @item st
  13745. Draw some statistics. By default is enabled.
  13746. @item sc
  13747. Draw scope. By default is enabled.
  13748. @end table
  13749. @subsection Commands
  13750. This filter supports same @ref{commands} as options.
  13751. The command accepts the same syntax of the corresponding option.
  13752. If the specified expression is not valid, it is kept at its current
  13753. value.
  13754. @subsection Examples
  13755. @itemize
  13756. @item
  13757. Inspect full first row of video frame.
  13758. @example
  13759. oscilloscope=x=0.5:y=0:s=1
  13760. @end example
  13761. @item
  13762. Inspect full last row of video frame.
  13763. @example
  13764. oscilloscope=x=0.5:y=1:s=1
  13765. @end example
  13766. @item
  13767. Inspect full 5th line of video frame of height 1080.
  13768. @example
  13769. oscilloscope=x=0.5:y=5/1080:s=1
  13770. @end example
  13771. @item
  13772. Inspect full last column of video frame.
  13773. @example
  13774. oscilloscope=x=1:y=0.5:s=1:t=1
  13775. @end example
  13776. @end itemize
  13777. @anchor{overlay}
  13778. @section overlay
  13779. Overlay one video on top of another.
  13780. It takes two inputs and has one output. The first input is the "main"
  13781. video on which the second input is overlaid.
  13782. It accepts the following parameters:
  13783. A description of the accepted options follows.
  13784. @table @option
  13785. @item x
  13786. @item y
  13787. Set the expression for the x and y coordinates of the overlaid video
  13788. on the main video. Default value is "0" for both expressions. In case
  13789. the expression is invalid, it is set to a huge value (meaning that the
  13790. overlay will not be displayed within the output visible area).
  13791. @item eof_action
  13792. See @ref{framesync}.
  13793. @item eval
  13794. Set when the expressions for @option{x}, and @option{y} are evaluated.
  13795. It accepts the following values:
  13796. @table @samp
  13797. @item init
  13798. only evaluate expressions once during the filter initialization or
  13799. when a command is processed
  13800. @item frame
  13801. evaluate expressions for each incoming frame
  13802. @end table
  13803. Default value is @samp{frame}.
  13804. @item shortest
  13805. See @ref{framesync}.
  13806. @item format
  13807. Set the format for the output video.
  13808. It accepts the following values:
  13809. @table @samp
  13810. @item yuv420
  13811. force YUV420 output
  13812. @item yuv420p10
  13813. force YUV420p10 output
  13814. @item yuv422
  13815. force YUV422 output
  13816. @item yuv422p10
  13817. force YUV422p10 output
  13818. @item yuv444
  13819. force YUV444 output
  13820. @item rgb
  13821. force packed RGB output
  13822. @item gbrp
  13823. force planar RGB output
  13824. @item auto
  13825. automatically pick format
  13826. @end table
  13827. Default value is @samp{yuv420}.
  13828. @item repeatlast
  13829. See @ref{framesync}.
  13830. @item alpha
  13831. Set format of alpha of the overlaid video, it can be @var{straight} or
  13832. @var{premultiplied}. Default is @var{straight}.
  13833. @end table
  13834. The @option{x}, and @option{y} expressions can contain the following
  13835. parameters.
  13836. @table @option
  13837. @item main_w, W
  13838. @item main_h, H
  13839. The main input width and height.
  13840. @item overlay_w, w
  13841. @item overlay_h, h
  13842. The overlay input width and height.
  13843. @item x
  13844. @item y
  13845. The computed values for @var{x} and @var{y}. They are evaluated for
  13846. each new frame.
  13847. @item hsub
  13848. @item vsub
  13849. horizontal and vertical chroma subsample values of the output
  13850. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  13851. @var{vsub} is 1.
  13852. @item n
  13853. the number of input frame, starting from 0
  13854. @item pos
  13855. the position in the file of the input frame, NAN if unknown
  13856. @item t
  13857. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  13858. @end table
  13859. This filter also supports the @ref{framesync} options.
  13860. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  13861. when evaluation is done @emph{per frame}, and will evaluate to NAN
  13862. when @option{eval} is set to @samp{init}.
  13863. Be aware that frames are taken from each input video in timestamp
  13864. order, hence, if their initial timestamps differ, it is a good idea
  13865. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  13866. have them begin in the same zero timestamp, as the example for
  13867. the @var{movie} filter does.
  13868. You can chain together more overlays but you should test the
  13869. efficiency of such approach.
  13870. @subsection Commands
  13871. This filter supports the following commands:
  13872. @table @option
  13873. @item x
  13874. @item y
  13875. Modify the x and y of the overlay input.
  13876. The command accepts the same syntax of the corresponding option.
  13877. If the specified expression is not valid, it is kept at its current
  13878. value.
  13879. @end table
  13880. @subsection Examples
  13881. @itemize
  13882. @item
  13883. Draw the overlay at 10 pixels from the bottom right corner of the main
  13884. video:
  13885. @example
  13886. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  13887. @end example
  13888. Using named options the example above becomes:
  13889. @example
  13890. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  13891. @end example
  13892. @item
  13893. Insert a transparent PNG logo in the bottom left corner of the input,
  13894. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  13895. @example
  13896. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  13897. @end example
  13898. @item
  13899. Insert 2 different transparent PNG logos (second logo on bottom
  13900. right corner) using the @command{ffmpeg} tool:
  13901. @example
  13902. 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
  13903. @end example
  13904. @item
  13905. Add a transparent color layer on top of the main video; @code{WxH}
  13906. must specify the size of the main input to the overlay filter:
  13907. @example
  13908. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  13909. @end example
  13910. @item
  13911. Play an original video and a filtered version (here with the deshake
  13912. filter) side by side using the @command{ffplay} tool:
  13913. @example
  13914. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  13915. @end example
  13916. The above command is the same as:
  13917. @example
  13918. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  13919. @end example
  13920. @item
  13921. Make a sliding overlay appearing from the left to the right top part of the
  13922. screen starting since time 2:
  13923. @example
  13924. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  13925. @end example
  13926. @item
  13927. Compose output by putting two input videos side to side:
  13928. @example
  13929. ffmpeg -i left.avi -i right.avi -filter_complex "
  13930. nullsrc=size=200x100 [background];
  13931. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  13932. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  13933. [background][left] overlay=shortest=1 [background+left];
  13934. [background+left][right] overlay=shortest=1:x=100 [left+right]
  13935. "
  13936. @end example
  13937. @item
  13938. Mask 10-20 seconds of a video by applying the delogo filter to a section
  13939. @example
  13940. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  13941. -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]'
  13942. masked.avi
  13943. @end example
  13944. @item
  13945. Chain several overlays in cascade:
  13946. @example
  13947. nullsrc=s=200x200 [bg];
  13948. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  13949. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  13950. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  13951. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  13952. [in3] null, [mid2] overlay=100:100 [out0]
  13953. @end example
  13954. @end itemize
  13955. @anchor{overlay_cuda}
  13956. @section overlay_cuda
  13957. Overlay one video on top of another.
  13958. This is the CUDA variant of the @ref{overlay} filter.
  13959. It only accepts CUDA frames. The underlying input pixel formats have to match.
  13960. It takes two inputs and has one output. The first input is the "main"
  13961. video on which the second input is overlaid.
  13962. It accepts the following parameters:
  13963. @table @option
  13964. @item x
  13965. @item y
  13966. Set expressions for the x and y coordinates of the overlaid video
  13967. on the main video.
  13968. They can contain the following parameters:
  13969. @table @option
  13970. @item main_w, W
  13971. @item main_h, H
  13972. The main input width and height.
  13973. @item overlay_w, w
  13974. @item overlay_h, h
  13975. The overlay input width and height.
  13976. @item x
  13977. @item y
  13978. The computed values for @var{x} and @var{y}. They are evaluated for
  13979. each new frame.
  13980. @item n
  13981. The ordinal index of the main input frame, starting from 0.
  13982. @item pos
  13983. The byte offset position in the file of the main input frame, NAN if unknown.
  13984. @item t
  13985. The timestamp of the main input frame, expressed in seconds, NAN if unknown.
  13986. @end table
  13987. Default value is "0" for both expressions.
  13988. @item eval
  13989. Set when the expressions for @option{x} and @option{y} are evaluated.
  13990. It accepts the following values:
  13991. @table @option
  13992. @item init
  13993. Evaluate expressions once during filter initialization or
  13994. when a command is processed.
  13995. @item frame
  13996. Evaluate expressions for each incoming frame
  13997. @end table
  13998. Default value is @option{frame}.
  13999. @item eof_action
  14000. See @ref{framesync}.
  14001. @item shortest
  14002. See @ref{framesync}.
  14003. @item repeatlast
  14004. See @ref{framesync}.
  14005. @end table
  14006. This filter also supports the @ref{framesync} options.
  14007. @section owdenoise
  14008. Apply Overcomplete Wavelet denoiser.
  14009. The filter accepts the following options:
  14010. @table @option
  14011. @item depth
  14012. Set depth.
  14013. Larger depth values will denoise lower frequency components more, but
  14014. slow down filtering.
  14015. Must be an int in the range 8-16, default is @code{8}.
  14016. @item luma_strength, ls
  14017. Set luma strength.
  14018. Must be a double value in the range 0-1000, default is @code{1.0}.
  14019. @item chroma_strength, cs
  14020. Set chroma strength.
  14021. Must be a double value in the range 0-1000, default is @code{1.0}.
  14022. @end table
  14023. @anchor{pad}
  14024. @section pad
  14025. Add paddings to the input image, and place the original input at the
  14026. provided @var{x}, @var{y} coordinates.
  14027. It accepts the following parameters:
  14028. @table @option
  14029. @item width, w
  14030. @item height, h
  14031. Specify an expression for the size of the output image with the
  14032. paddings added. If the value for @var{width} or @var{height} is 0, the
  14033. corresponding input size is used for the output.
  14034. The @var{width} expression can reference the value set by the
  14035. @var{height} expression, and vice versa.
  14036. The default value of @var{width} and @var{height} is 0.
  14037. @item x
  14038. @item y
  14039. Specify the offsets to place the input image at within the padded area,
  14040. with respect to the top/left border of the output image.
  14041. The @var{x} expression can reference the value set by the @var{y}
  14042. expression, and vice versa.
  14043. The default value of @var{x} and @var{y} is 0.
  14044. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  14045. so the input image is centered on the padded area.
  14046. @item color
  14047. Specify the color of the padded area. For the syntax of this option,
  14048. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14049. manual,ffmpeg-utils}.
  14050. The default value of @var{color} is "black".
  14051. @item eval
  14052. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  14053. It accepts the following values:
  14054. @table @samp
  14055. @item init
  14056. Only evaluate expressions once during the filter initialization or when
  14057. a command is processed.
  14058. @item frame
  14059. Evaluate expressions for each incoming frame.
  14060. @end table
  14061. Default value is @samp{init}.
  14062. @item aspect
  14063. Pad to aspect instead to a resolution.
  14064. @end table
  14065. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  14066. options are expressions containing the following constants:
  14067. @table @option
  14068. @item in_w
  14069. @item in_h
  14070. The input video width and height.
  14071. @item iw
  14072. @item ih
  14073. These are the same as @var{in_w} and @var{in_h}.
  14074. @item out_w
  14075. @item out_h
  14076. The output width and height (the size of the padded area), as
  14077. specified by the @var{width} and @var{height} expressions.
  14078. @item ow
  14079. @item oh
  14080. These are the same as @var{out_w} and @var{out_h}.
  14081. @item x
  14082. @item y
  14083. The x and y offsets as specified by the @var{x} and @var{y}
  14084. expressions, or NAN if not yet specified.
  14085. @item a
  14086. same as @var{iw} / @var{ih}
  14087. @item sar
  14088. input sample aspect ratio
  14089. @item dar
  14090. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  14091. @item hsub
  14092. @item vsub
  14093. The horizontal and vertical chroma subsample values. For example for the
  14094. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14095. @end table
  14096. @subsection Examples
  14097. @itemize
  14098. @item
  14099. Add paddings with the color "violet" to the input video. The output video
  14100. size is 640x480, and the top-left corner of the input video is placed at
  14101. column 0, row 40
  14102. @example
  14103. pad=640:480:0:40:violet
  14104. @end example
  14105. The example above is equivalent to the following command:
  14106. @example
  14107. pad=width=640:height=480:x=0:y=40:color=violet
  14108. @end example
  14109. @item
  14110. Pad the input to get an output with dimensions increased by 3/2,
  14111. and put the input video at the center of the padded area:
  14112. @example
  14113. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  14114. @end example
  14115. @item
  14116. Pad the input to get a squared output with size equal to the maximum
  14117. value between the input width and height, and put the input video at
  14118. the center of the padded area:
  14119. @example
  14120. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  14121. @end example
  14122. @item
  14123. Pad the input to get a final w/h ratio of 16:9:
  14124. @example
  14125. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  14126. @end example
  14127. @item
  14128. In case of anamorphic video, in order to set the output display aspect
  14129. correctly, it is necessary to use @var{sar} in the expression,
  14130. according to the relation:
  14131. @example
  14132. (ih * X / ih) * sar = output_dar
  14133. X = output_dar / sar
  14134. @end example
  14135. Thus the previous example needs to be modified to:
  14136. @example
  14137. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  14138. @end example
  14139. @item
  14140. Double the output size and put the input video in the bottom-right
  14141. corner of the output padded area:
  14142. @example
  14143. pad="2*iw:2*ih:ow-iw:oh-ih"
  14144. @end example
  14145. @end itemize
  14146. @anchor{palettegen}
  14147. @section palettegen
  14148. Generate one palette for a whole video stream.
  14149. It accepts the following options:
  14150. @table @option
  14151. @item max_colors
  14152. Set the maximum number of colors to quantize in the palette.
  14153. Note: the palette will still contain 256 colors; the unused palette entries
  14154. will be black.
  14155. @item reserve_transparent
  14156. Create a palette of 255 colors maximum and reserve the last one for
  14157. transparency. Reserving the transparency color is useful for GIF optimization.
  14158. If not set, the maximum of colors in the palette will be 256. You probably want
  14159. to disable this option for a standalone image.
  14160. Set by default.
  14161. @item transparency_color
  14162. Set the color that will be used as background for transparency.
  14163. @item stats_mode
  14164. Set statistics mode.
  14165. It accepts the following values:
  14166. @table @samp
  14167. @item full
  14168. Compute full frame histograms.
  14169. @item diff
  14170. Compute histograms only for the part that differs from previous frame. This
  14171. might be relevant to give more importance to the moving part of your input if
  14172. the background is static.
  14173. @item single
  14174. Compute new histogram for each frame.
  14175. @end table
  14176. Default value is @var{full}.
  14177. @end table
  14178. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  14179. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  14180. color quantization of the palette. This information is also visible at
  14181. @var{info} logging level.
  14182. @subsection Examples
  14183. @itemize
  14184. @item
  14185. Generate a representative palette of a given video using @command{ffmpeg}:
  14186. @example
  14187. ffmpeg -i input.mkv -vf palettegen palette.png
  14188. @end example
  14189. @end itemize
  14190. @section paletteuse
  14191. Use a palette to downsample an input video stream.
  14192. The filter takes two inputs: one video stream and a palette. The palette must
  14193. be a 256 pixels image.
  14194. It accepts the following options:
  14195. @table @option
  14196. @item dither
  14197. Select dithering mode. Available algorithms are:
  14198. @table @samp
  14199. @item bayer
  14200. Ordered 8x8 bayer dithering (deterministic)
  14201. @item heckbert
  14202. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  14203. Note: this dithering is sometimes considered "wrong" and is included as a
  14204. reference.
  14205. @item floyd_steinberg
  14206. Floyd and Steingberg dithering (error diffusion)
  14207. @item sierra2
  14208. Frankie Sierra dithering v2 (error diffusion)
  14209. @item sierra2_4a
  14210. Frankie Sierra dithering v2 "Lite" (error diffusion)
  14211. @item sierra3
  14212. Frankie Sierra dithering v3 (error diffusion)
  14213. @item burkes
  14214. Burkes dithering (error diffusion)
  14215. @item atkinson
  14216. Atkinson dithering by Bill Atkinson at Apple Computer (error diffusion)
  14217. @end table
  14218. Default is @var{sierra2_4a}.
  14219. @item bayer_scale
  14220. When @var{bayer} dithering is selected, this option defines the scale of the
  14221. pattern (how much the crosshatch pattern is visible). A low value means more
  14222. visible pattern for less banding, and higher value means less visible pattern
  14223. at the cost of more banding.
  14224. The option must be an integer value in the range [0,5]. Default is @var{2}.
  14225. @item diff_mode
  14226. If set, define the zone to process
  14227. @table @samp
  14228. @item rectangle
  14229. Only the changing rectangle will be reprocessed. This is similar to GIF
  14230. cropping/offsetting compression mechanism. This option can be useful for speed
  14231. if only a part of the image is changing, and has use cases such as limiting the
  14232. scope of the error diffusal @option{dither} to the rectangle that bounds the
  14233. moving scene (it leads to more deterministic output if the scene doesn't change
  14234. much, and as a result less moving noise and better GIF compression).
  14235. @end table
  14236. Default is @var{none}.
  14237. @item new
  14238. Take new palette for each output frame.
  14239. @item alpha_threshold
  14240. Sets the alpha threshold for transparency. Alpha values above this threshold
  14241. will be treated as completely opaque, and values below this threshold will be
  14242. treated as completely transparent.
  14243. The option must be an integer value in the range [0,255]. Default is @var{128}.
  14244. @end table
  14245. @subsection Examples
  14246. @itemize
  14247. @item
  14248. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  14249. using @command{ffmpeg}:
  14250. @example
  14251. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  14252. @end example
  14253. @end itemize
  14254. @section perspective
  14255. Correct perspective of video not recorded perpendicular to the screen.
  14256. A description of the accepted parameters follows.
  14257. @table @option
  14258. @item x0
  14259. @item y0
  14260. @item x1
  14261. @item y1
  14262. @item x2
  14263. @item y2
  14264. @item x3
  14265. @item y3
  14266. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  14267. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  14268. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  14269. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  14270. then the corners of the source will be sent to the specified coordinates.
  14271. The expressions can use the following variables:
  14272. @table @option
  14273. @item W
  14274. @item H
  14275. the width and height of video frame.
  14276. @item in
  14277. Input frame count.
  14278. @item on
  14279. Output frame count.
  14280. @end table
  14281. @item interpolation
  14282. Set interpolation for perspective correction.
  14283. It accepts the following values:
  14284. @table @samp
  14285. @item linear
  14286. @item cubic
  14287. @end table
  14288. Default value is @samp{linear}.
  14289. @item sense
  14290. Set interpretation of coordinate options.
  14291. It accepts the following values:
  14292. @table @samp
  14293. @item 0, source
  14294. Send point in the source specified by the given coordinates to
  14295. the corners of the destination.
  14296. @item 1, destination
  14297. Send the corners of the source to the point in the destination specified
  14298. by the given coordinates.
  14299. Default value is @samp{source}.
  14300. @end table
  14301. @item eval
  14302. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  14303. It accepts the following values:
  14304. @table @samp
  14305. @item init
  14306. only evaluate expressions once during the filter initialization or
  14307. when a command is processed
  14308. @item frame
  14309. evaluate expressions for each incoming frame
  14310. @end table
  14311. Default value is @samp{init}.
  14312. @end table
  14313. @section phase
  14314. Delay interlaced video by one field time so that the field order changes.
  14315. The intended use is to fix PAL movies that have been captured with the
  14316. opposite field order to the film-to-video transfer.
  14317. A description of the accepted parameters follows.
  14318. @table @option
  14319. @item mode
  14320. Set phase mode.
  14321. It accepts the following values:
  14322. @table @samp
  14323. @item t
  14324. Capture field order top-first, transfer bottom-first.
  14325. Filter will delay the bottom field.
  14326. @item b
  14327. Capture field order bottom-first, transfer top-first.
  14328. Filter will delay the top field.
  14329. @item p
  14330. Capture and transfer with the same field order. This mode only exists
  14331. for the documentation of the other options to refer to, but if you
  14332. actually select it, the filter will faithfully do nothing.
  14333. @item a
  14334. Capture field order determined automatically by field flags, transfer
  14335. opposite.
  14336. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  14337. basis using field flags. If no field information is available,
  14338. then this works just like @samp{u}.
  14339. @item u
  14340. Capture unknown or varying, transfer opposite.
  14341. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  14342. analyzing the images and selecting the alternative that produces best
  14343. match between the fields.
  14344. @item T
  14345. Capture top-first, transfer unknown or varying.
  14346. Filter selects among @samp{t} and @samp{p} using image analysis.
  14347. @item B
  14348. Capture bottom-first, transfer unknown or varying.
  14349. Filter selects among @samp{b} and @samp{p} using image analysis.
  14350. @item A
  14351. Capture determined by field flags, transfer unknown or varying.
  14352. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  14353. image analysis. If no field information is available, then this works just
  14354. like @samp{U}. This is the default mode.
  14355. @item U
  14356. Both capture and transfer unknown or varying.
  14357. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  14358. @end table
  14359. @end table
  14360. @subsection Commands
  14361. This filter supports the all above options as @ref{commands}.
  14362. @section photosensitivity
  14363. Reduce various flashes in video, so to help users with epilepsy.
  14364. It accepts the following options:
  14365. @table @option
  14366. @item frames, f
  14367. Set how many frames to use when filtering. Default is 30.
  14368. @item threshold, t
  14369. Set detection threshold factor. Default is 1.
  14370. Lower is stricter.
  14371. @item skip
  14372. Set how many pixels to skip when sampling frames. Default is 1.
  14373. Allowed range is from 1 to 1024.
  14374. @item bypass
  14375. Leave frames unchanged. Default is disabled.
  14376. @end table
  14377. @section pixdesctest
  14378. Pixel format descriptor test filter, mainly useful for internal
  14379. testing. The output video should be equal to the input video.
  14380. For example:
  14381. @example
  14382. format=monow, pixdesctest
  14383. @end example
  14384. can be used to test the monowhite pixel format descriptor definition.
  14385. @section pixelize
  14386. Apply pixelization to video stream.
  14387. The filter accepts the following options:
  14388. @table @option
  14389. @item width, w
  14390. @item height, h
  14391. Set block dimensions that will be used for pixelization.
  14392. Default value is @code{16}.
  14393. @item mode, m
  14394. Set the mode of pixelization used.
  14395. Possible values are:
  14396. @table @samp
  14397. @item avg
  14398. @item min
  14399. @item max
  14400. @end table
  14401. Default value is @code{avg}.
  14402. @item planes, p
  14403. Set what planes to filter. Default is to filter all planes.
  14404. @end table
  14405. @subsection Commands
  14406. This filter supports all options as @ref{commands}.
  14407. @section pixscope
  14408. Display sample values of color channels. Mainly useful for checking color
  14409. and levels. Minimum supported resolution is 640x480.
  14410. The filters accept the following options:
  14411. @table @option
  14412. @item x
  14413. Set scope X position, relative offset on X axis.
  14414. @item y
  14415. Set scope Y position, relative offset on Y axis.
  14416. @item w
  14417. Set scope width.
  14418. @item h
  14419. Set scope height.
  14420. @item o
  14421. Set window opacity. This window also holds statistics about pixel area.
  14422. @item wx
  14423. Set window X position, relative offset on X axis.
  14424. @item wy
  14425. Set window Y position, relative offset on Y axis.
  14426. @end table
  14427. @subsection Commands
  14428. This filter supports same @ref{commands} as options.
  14429. @section pp
  14430. Enable the specified chain of postprocessing subfilters using libpostproc. This
  14431. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  14432. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  14433. Each subfilter and some options have a short and a long name that can be used
  14434. interchangeably, i.e. dr/dering are the same.
  14435. The filters accept the following options:
  14436. @table @option
  14437. @item subfilters
  14438. Set postprocessing subfilters string.
  14439. @end table
  14440. All subfilters share common options to determine their scope:
  14441. @table @option
  14442. @item a/autoq
  14443. Honor the quality commands for this subfilter.
  14444. @item c/chrom
  14445. Do chrominance filtering, too (default).
  14446. @item y/nochrom
  14447. Do luminance filtering only (no chrominance).
  14448. @item n/noluma
  14449. Do chrominance filtering only (no luminance).
  14450. @end table
  14451. These options can be appended after the subfilter name, separated by a '|'.
  14452. Available subfilters are:
  14453. @table @option
  14454. @item hb/hdeblock[|difference[|flatness]]
  14455. Horizontal deblocking filter
  14456. @table @option
  14457. @item difference
  14458. Difference factor where higher values mean more deblocking (default: @code{32}).
  14459. @item flatness
  14460. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  14461. @end table
  14462. @item vb/vdeblock[|difference[|flatness]]
  14463. Vertical deblocking filter
  14464. @table @option
  14465. @item difference
  14466. Difference factor where higher values mean more deblocking (default: @code{32}).
  14467. @item flatness
  14468. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  14469. @end table
  14470. @item ha/hadeblock[|difference[|flatness]]
  14471. Accurate horizontal deblocking filter
  14472. @table @option
  14473. @item difference
  14474. Difference factor where higher values mean more deblocking (default: @code{32}).
  14475. @item flatness
  14476. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  14477. @end table
  14478. @item va/vadeblock[|difference[|flatness]]
  14479. Accurate vertical deblocking filter
  14480. @table @option
  14481. @item difference
  14482. Difference factor where higher values mean more deblocking (default: @code{32}).
  14483. @item flatness
  14484. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  14485. @end table
  14486. @end table
  14487. The horizontal and vertical deblocking filters share the difference and
  14488. flatness values so you cannot set different horizontal and vertical
  14489. thresholds.
  14490. @table @option
  14491. @item h1/x1hdeblock
  14492. Experimental horizontal deblocking filter
  14493. @item v1/x1vdeblock
  14494. Experimental vertical deblocking filter
  14495. @item dr/dering
  14496. Deringing filter
  14497. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  14498. @table @option
  14499. @item threshold1
  14500. larger -> stronger filtering
  14501. @item threshold2
  14502. larger -> stronger filtering
  14503. @item threshold3
  14504. larger -> stronger filtering
  14505. @end table
  14506. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  14507. @table @option
  14508. @item f/fullyrange
  14509. Stretch luminance to @code{0-255}.
  14510. @end table
  14511. @item lb/linblenddeint
  14512. Linear blend deinterlacing filter that deinterlaces the given block by
  14513. filtering all lines with a @code{(1 2 1)} filter.
  14514. @item li/linipoldeint
  14515. Linear interpolating deinterlacing filter that deinterlaces the given block by
  14516. linearly interpolating every second line.
  14517. @item ci/cubicipoldeint
  14518. Cubic interpolating deinterlacing filter deinterlaces the given block by
  14519. cubically interpolating every second line.
  14520. @item md/mediandeint
  14521. Median deinterlacing filter that deinterlaces the given block by applying a
  14522. median filter to every second line.
  14523. @item fd/ffmpegdeint
  14524. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  14525. second line with a @code{(-1 4 2 4 -1)} filter.
  14526. @item l5/lowpass5
  14527. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  14528. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  14529. @item fq/forceQuant[|quantizer]
  14530. Overrides the quantizer table from the input with the constant quantizer you
  14531. specify.
  14532. @table @option
  14533. @item quantizer
  14534. Quantizer to use
  14535. @end table
  14536. @item de/default
  14537. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  14538. @item fa/fast
  14539. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  14540. @item ac
  14541. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  14542. @end table
  14543. @subsection Examples
  14544. @itemize
  14545. @item
  14546. Apply horizontal and vertical deblocking, deringing and automatic
  14547. brightness/contrast:
  14548. @example
  14549. pp=hb/vb/dr/al
  14550. @end example
  14551. @item
  14552. Apply default filters without brightness/contrast correction:
  14553. @example
  14554. pp=de/-al
  14555. @end example
  14556. @item
  14557. Apply default filters and temporal denoiser:
  14558. @example
  14559. pp=default/tmpnoise|1|2|3
  14560. @end example
  14561. @item
  14562. Apply deblocking on luminance only, and switch vertical deblocking on or off
  14563. automatically depending on available CPU time:
  14564. @example
  14565. pp=hb|y/vb|a
  14566. @end example
  14567. @end itemize
  14568. @section pp7
  14569. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  14570. similar to spp = 6 with 7 point DCT, where only the center sample is
  14571. used after IDCT.
  14572. The filter accepts the following options:
  14573. @table @option
  14574. @item qp
  14575. Force a constant quantization parameter. It accepts an integer in range
  14576. 0 to 63. If not set, the filter will use the QP from the video stream
  14577. (if available).
  14578. @item mode
  14579. Set thresholding mode. Available modes are:
  14580. @table @samp
  14581. @item hard
  14582. Set hard thresholding.
  14583. @item soft
  14584. Set soft thresholding (better de-ringing effect, but likely blurrier).
  14585. @item medium
  14586. Set medium thresholding (good results, default).
  14587. @end table
  14588. @end table
  14589. @section premultiply
  14590. Apply alpha premultiply effect to input video stream using first plane
  14591. of second stream as alpha.
  14592. Both streams must have same dimensions and same pixel format.
  14593. The filter accepts the following option:
  14594. @table @option
  14595. @item planes
  14596. Set which planes will be processed, unprocessed planes will be copied.
  14597. By default value 0xf, all planes will be processed.
  14598. @item inplace
  14599. Do not require 2nd input for processing, instead use alpha plane from input stream.
  14600. @end table
  14601. @section prewitt
  14602. Apply prewitt operator to input video stream.
  14603. The filter accepts the following option:
  14604. @table @option
  14605. @item planes
  14606. Set which planes will be processed, unprocessed planes will be copied.
  14607. By default value 0xf, all planes will be processed.
  14608. @item scale
  14609. Set value which will be multiplied with filtered result.
  14610. @item delta
  14611. Set value which will be added to filtered result.
  14612. @end table
  14613. @subsection Commands
  14614. This filter supports the all above options as @ref{commands}.
  14615. @section pseudocolor
  14616. Alter frame colors in video with pseudocolors.
  14617. This filter accepts the following options:
  14618. @table @option
  14619. @item c0
  14620. set pixel first component expression
  14621. @item c1
  14622. set pixel second component expression
  14623. @item c2
  14624. set pixel third component expression
  14625. @item c3
  14626. set pixel fourth component expression, corresponds to the alpha component
  14627. @item index, i
  14628. set component to use as base for altering colors
  14629. @item preset, p
  14630. Pick one of built-in LUTs. By default is set to none.
  14631. Available LUTs:
  14632. @table @samp
  14633. @item magma
  14634. @item inferno
  14635. @item plasma
  14636. @item viridis
  14637. @item turbo
  14638. @item cividis
  14639. @item range1
  14640. @item range2
  14641. @item shadows
  14642. @item highlights
  14643. @item solar
  14644. @item nominal
  14645. @item preferred
  14646. @item total
  14647. @item spectral
  14648. @end table
  14649. @item opacity
  14650. Set opacity of output colors. Allowed range is from 0 to 1.
  14651. Default value is set to 1.
  14652. @end table
  14653. Each of the expression options specifies the expression to use for computing
  14654. the lookup table for the corresponding pixel component values.
  14655. The expressions can contain the following constants and functions:
  14656. @table @option
  14657. @item w
  14658. @item h
  14659. The input width and height.
  14660. @item val
  14661. The input value for the pixel component.
  14662. @item ymin, umin, vmin, amin
  14663. The minimum allowed component value.
  14664. @item ymax, umax, vmax, amax
  14665. The maximum allowed component value.
  14666. @end table
  14667. All expressions default to "val".
  14668. @subsection Commands
  14669. This filter supports the all above options as @ref{commands}.
  14670. @subsection Examples
  14671. @itemize
  14672. @item
  14673. Change too high luma values to gradient:
  14674. @example
  14675. 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'"
  14676. @end example
  14677. @end itemize
  14678. @section psnr
  14679. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  14680. Ratio) between two input videos.
  14681. This filter takes in input two input videos, the first input is
  14682. considered the "main" source and is passed unchanged to the
  14683. output. The second input is used as a "reference" video for computing
  14684. the PSNR.
  14685. Both video inputs must have the same resolution and pixel format for
  14686. this filter to work correctly. Also it assumes that both inputs
  14687. have the same number of frames, which are compared one by one.
  14688. The obtained average PSNR is printed through the logging system.
  14689. The filter stores the accumulated MSE (mean squared error) of each
  14690. frame, and at the end of the processing it is averaged across all frames
  14691. equally, and the following formula is applied to obtain the PSNR:
  14692. @example
  14693. PSNR = 10*log10(MAX^2/MSE)
  14694. @end example
  14695. Where MAX is the average of the maximum values of each component of the
  14696. image.
  14697. The description of the accepted parameters follows.
  14698. @table @option
  14699. @item stats_file, f
  14700. If specified the filter will use the named file to save the PSNR of
  14701. each individual frame. When filename equals "-" the data is sent to
  14702. standard output.
  14703. @item stats_version
  14704. Specifies which version of the stats file format to use. Details of
  14705. each format are written below.
  14706. Default value is 1.
  14707. @item stats_add_max
  14708. Determines whether the max value is output to the stats log.
  14709. Default value is 0.
  14710. Requires stats_version >= 2. If this is set and stats_version < 2,
  14711. the filter will return an error.
  14712. @end table
  14713. This filter also supports the @ref{framesync} options.
  14714. The file printed if @var{stats_file} is selected, contains a sequence of
  14715. key/value pairs of the form @var{key}:@var{value} for each compared
  14716. couple of frames.
  14717. If a @var{stats_version} greater than 1 is specified, a header line precedes
  14718. the list of per-frame-pair stats, with key value pairs following the frame
  14719. format with the following parameters:
  14720. @table @option
  14721. @item psnr_log_version
  14722. The version of the log file format. Will match @var{stats_version}.
  14723. @item fields
  14724. A comma separated list of the per-frame-pair parameters included in
  14725. the log.
  14726. @end table
  14727. A description of each shown per-frame-pair parameter follows:
  14728. @table @option
  14729. @item n
  14730. sequential number of the input frame, starting from 1
  14731. @item mse_avg
  14732. Mean Square Error pixel-by-pixel average difference of the compared
  14733. frames, averaged over all the image components.
  14734. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  14735. Mean Square Error pixel-by-pixel average difference of the compared
  14736. frames for the component specified by the suffix.
  14737. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  14738. Peak Signal to Noise ratio of the compared frames for the component
  14739. specified by the suffix.
  14740. @item max_avg, max_y, max_u, max_v
  14741. Maximum allowed value for each channel, and average over all
  14742. channels.
  14743. @end table
  14744. @subsection Examples
  14745. @itemize
  14746. @item
  14747. For example:
  14748. @example
  14749. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  14750. [main][ref] psnr="stats_file=stats.log" [out]
  14751. @end example
  14752. On this example the input file being processed is compared with the
  14753. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  14754. is stored in @file{stats.log}.
  14755. @item
  14756. Another example with different containers:
  14757. @example
  14758. ffmpeg -i main.mpg -i ref.mkv -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=AVTB,setpts=PTS-STARTPTS[ref];[main][ref]psnr" -f null -
  14759. @end example
  14760. @end itemize
  14761. @anchor{pullup}
  14762. @section pullup
  14763. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  14764. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  14765. content.
  14766. The pullup filter is designed to take advantage of future context in making
  14767. its decisions. This filter is stateless in the sense that it does not lock
  14768. onto a pattern to follow, but it instead looks forward to the following
  14769. fields in order to identify matches and rebuild progressive frames.
  14770. To produce content with an even framerate, insert the fps filter after
  14771. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  14772. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  14773. The filter accepts the following options:
  14774. @table @option
  14775. @item jl
  14776. @item jr
  14777. @item jt
  14778. @item jb
  14779. These options set the amount of "junk" to ignore at the left, right, top, and
  14780. bottom of the image, respectively. Left and right are in units of 8 pixels,
  14781. while top and bottom are in units of 2 lines.
  14782. The default is 8 pixels on each side.
  14783. @item sb
  14784. Set the strict breaks. Setting this option to 1 will reduce the chances of
  14785. filter generating an occasional mismatched frame, but it may also cause an
  14786. excessive number of frames to be dropped during high motion sequences.
  14787. Conversely, setting it to -1 will make filter match fields more easily.
  14788. This may help processing of video where there is slight blurring between
  14789. the fields, but may also cause there to be interlaced frames in the output.
  14790. Default value is @code{0}.
  14791. @item mp
  14792. Set the metric plane to use. It accepts the following values:
  14793. @table @samp
  14794. @item l
  14795. Use luma plane.
  14796. @item u
  14797. Use chroma blue plane.
  14798. @item v
  14799. Use chroma red plane.
  14800. @end table
  14801. This option may be set to use chroma plane instead of the default luma plane
  14802. for doing filter's computations. This may improve accuracy on very clean
  14803. source material, but more likely will decrease accuracy, especially if there
  14804. is chroma noise (rainbow effect) or any grayscale video.
  14805. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  14806. load and make pullup usable in realtime on slow machines.
  14807. @end table
  14808. For best results (without duplicated frames in the output file) it is
  14809. necessary to change the output frame rate. For example, to inverse
  14810. telecine NTSC input:
  14811. @example
  14812. ffmpeg -i input -vf pullup -r 24000/1001 ...
  14813. @end example
  14814. @section qp
  14815. Change video quantization parameters (QP).
  14816. The filter accepts the following option:
  14817. @table @option
  14818. @item qp
  14819. Set expression for quantization parameter.
  14820. @end table
  14821. The expression is evaluated through the eval API and can contain, among others,
  14822. the following constants:
  14823. @table @var
  14824. @item known
  14825. 1 if index is not 129, 0 otherwise.
  14826. @item qp
  14827. Sequential index starting from -129 to 128.
  14828. @end table
  14829. @subsection Examples
  14830. @itemize
  14831. @item
  14832. Some equation like:
  14833. @example
  14834. qp=2+2*sin(PI*qp)
  14835. @end example
  14836. @end itemize
  14837. @section random
  14838. Flush video frames from internal cache of frames into a random order.
  14839. No frame is discarded.
  14840. Inspired by @ref{frei0r} nervous filter.
  14841. @table @option
  14842. @item frames
  14843. Set size in number of frames of internal cache, in range from @code{2} to
  14844. @code{512}. Default is @code{30}.
  14845. @item seed
  14846. Set seed for random number generator, must be an integer included between
  14847. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  14848. less than @code{0}, the filter will try to use a good random seed on a
  14849. best effort basis.
  14850. @end table
  14851. @section readeia608
  14852. Read closed captioning (EIA-608) information from the top lines of a video frame.
  14853. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  14854. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  14855. with EIA-608 data (starting from 0). A description of each metadata value follows:
  14856. @table @option
  14857. @item lavfi.readeia608.X.cc
  14858. The two bytes stored as EIA-608 data (printed in hexadecimal).
  14859. @item lavfi.readeia608.X.line
  14860. The number of the line on which the EIA-608 data was identified and read.
  14861. @end table
  14862. This filter accepts the following options:
  14863. @table @option
  14864. @item scan_min
  14865. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  14866. @item scan_max
  14867. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  14868. @item spw
  14869. Set the ratio of width reserved for sync code detection.
  14870. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  14871. @item chp
  14872. Enable checking the parity bit. In the event of a parity error, the filter will output
  14873. @code{0x00} for that character. Default is false.
  14874. @item lp
  14875. Lowpass lines prior to further processing. Default is enabled.
  14876. @end table
  14877. @subsection Commands
  14878. This filter supports the all above options as @ref{commands}.
  14879. @subsection Examples
  14880. @itemize
  14881. @item
  14882. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  14883. @example
  14884. ffprobe -f lavfi -i movie=captioned_video.mov,readeia608 -show_entries frame=pts_time:frame_tags=lavfi.readeia608.0.cc,lavfi.readeia608.1.cc -of csv
  14885. @end example
  14886. @end itemize
  14887. @section readvitc
  14888. Read vertical interval timecode (VITC) information from the top lines of a
  14889. video frame.
  14890. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  14891. timecode value, if a valid timecode has been detected. Further metadata key
  14892. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  14893. timecode data has been found or not.
  14894. This filter accepts the following options:
  14895. @table @option
  14896. @item scan_max
  14897. Set the maximum number of lines to scan for VITC data. If the value is set to
  14898. @code{-1} the full video frame is scanned. Default is @code{45}.
  14899. @item thr_b
  14900. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  14901. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  14902. @item thr_w
  14903. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  14904. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  14905. @end table
  14906. @subsection Examples
  14907. @itemize
  14908. @item
  14909. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  14910. draw @code{--:--:--:--} as a placeholder:
  14911. @example
  14912. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  14913. @end example
  14914. @end itemize
  14915. @section remap
  14916. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  14917. Destination pixel at position (X, Y) will be picked from source (x, y) position
  14918. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  14919. value for pixel will be used for destination pixel.
  14920. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  14921. will have Xmap/Ymap video stream dimensions.
  14922. Xmap and Ymap input video streams are 16bit depth, single channel.
  14923. @table @option
  14924. @item format
  14925. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  14926. Default is @code{color}.
  14927. @item fill
  14928. Specify the color of the unmapped pixels. For the syntax of this option,
  14929. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14930. manual,ffmpeg-utils}. Default color is @code{black}.
  14931. @end table
  14932. @section removegrain
  14933. The removegrain filter is a spatial denoiser for progressive video.
  14934. @table @option
  14935. @item m0
  14936. Set mode for the first plane.
  14937. @item m1
  14938. Set mode for the second plane.
  14939. @item m2
  14940. Set mode for the third plane.
  14941. @item m3
  14942. Set mode for the fourth plane.
  14943. @end table
  14944. Range of mode is from 0 to 24. Description of each mode follows:
  14945. @table @var
  14946. @item 0
  14947. Leave input plane unchanged. Default.
  14948. @item 1
  14949. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  14950. @item 2
  14951. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  14952. @item 3
  14953. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  14954. @item 4
  14955. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  14956. This is equivalent to a median filter.
  14957. @item 5
  14958. Line-sensitive clipping giving the minimal change.
  14959. @item 6
  14960. Line-sensitive clipping, intermediate.
  14961. @item 7
  14962. Line-sensitive clipping, intermediate.
  14963. @item 8
  14964. Line-sensitive clipping, intermediate.
  14965. @item 9
  14966. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  14967. @item 10
  14968. Replaces the target pixel with the closest neighbour.
  14969. @item 11
  14970. [1 2 1] horizontal and vertical kernel blur.
  14971. @item 12
  14972. Same as mode 11.
  14973. @item 13
  14974. Bob mode, interpolates top field from the line where the neighbours
  14975. pixels are the closest.
  14976. @item 14
  14977. Bob mode, interpolates bottom field from the line where the neighbours
  14978. pixels are the closest.
  14979. @item 15
  14980. Bob mode, interpolates top field. Same as 13 but with a more complicated
  14981. interpolation formula.
  14982. @item 16
  14983. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  14984. interpolation formula.
  14985. @item 17
  14986. Clips the pixel with the minimum and maximum of respectively the maximum and
  14987. minimum of each pair of opposite neighbour pixels.
  14988. @item 18
  14989. Line-sensitive clipping using opposite neighbours whose greatest distance from
  14990. the current pixel is minimal.
  14991. @item 19
  14992. Replaces the pixel with the average of its 8 neighbours.
  14993. @item 20
  14994. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  14995. @item 21
  14996. Clips pixels using the averages of opposite neighbour.
  14997. @item 22
  14998. Same as mode 21 but simpler and faster.
  14999. @item 23
  15000. Small edge and halo removal, but reputed useless.
  15001. @item 24
  15002. Similar as 23.
  15003. @end table
  15004. @section removelogo
  15005. Suppress a TV station logo, using an image file to determine which
  15006. pixels comprise the logo. It works by filling in the pixels that
  15007. comprise the logo with neighboring pixels.
  15008. The filter accepts the following options:
  15009. @table @option
  15010. @item filename, f
  15011. Set the filter bitmap file, which can be any image format supported by
  15012. libavformat. The width and height of the image file must match those of the
  15013. video stream being processed.
  15014. @end table
  15015. Pixels in the provided bitmap image with a value of zero are not
  15016. considered part of the logo, non-zero pixels are considered part of
  15017. the logo. If you use white (255) for the logo and black (0) for the
  15018. rest, you will be safe. For making the filter bitmap, it is
  15019. recommended to take a screen capture of a black frame with the logo
  15020. visible, and then using a threshold filter followed by the erode
  15021. filter once or twice.
  15022. If needed, little splotches can be fixed manually. Remember that if
  15023. logo pixels are not covered, the filter quality will be much
  15024. reduced. Marking too many pixels as part of the logo does not hurt as
  15025. much, but it will increase the amount of blurring needed to cover over
  15026. the image and will destroy more information than necessary, and extra
  15027. pixels will slow things down on a large logo.
  15028. @section repeatfields
  15029. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  15030. fields based on its value.
  15031. @section reverse
  15032. Reverse a video clip.
  15033. Warning: This filter requires memory to buffer the entire clip, so trimming
  15034. is suggested.
  15035. @subsection Examples
  15036. @itemize
  15037. @item
  15038. Take the first 5 seconds of a clip, and reverse it.
  15039. @example
  15040. trim=end=5,reverse
  15041. @end example
  15042. @end itemize
  15043. @section rgbashift
  15044. Shift R/G/B/A pixels horizontally and/or vertically.
  15045. The filter accepts the following options:
  15046. @table @option
  15047. @item rh
  15048. Set amount to shift red horizontally.
  15049. @item rv
  15050. Set amount to shift red vertically.
  15051. @item gh
  15052. Set amount to shift green horizontally.
  15053. @item gv
  15054. Set amount to shift green vertically.
  15055. @item bh
  15056. Set amount to shift blue horizontally.
  15057. @item bv
  15058. Set amount to shift blue vertically.
  15059. @item ah
  15060. Set amount to shift alpha horizontally.
  15061. @item av
  15062. Set amount to shift alpha vertically.
  15063. @item edge
  15064. Set edge mode, can be @var{smear}, default, or @var{warp}.
  15065. @end table
  15066. @subsection Commands
  15067. This filter supports the all above options as @ref{commands}.
  15068. @section roberts
  15069. Apply roberts cross operator to input video stream.
  15070. The filter accepts the following option:
  15071. @table @option
  15072. @item planes
  15073. Set which planes will be processed, unprocessed planes will be copied.
  15074. By default value 0xf, all planes will be processed.
  15075. @item scale
  15076. Set value which will be multiplied with filtered result.
  15077. @item delta
  15078. Set value which will be added to filtered result.
  15079. @end table
  15080. @subsection Commands
  15081. This filter supports the all above options as @ref{commands}.
  15082. @section rotate
  15083. Rotate video by an arbitrary angle expressed in radians.
  15084. The filter accepts the following options:
  15085. A description of the optional parameters follows.
  15086. @table @option
  15087. @item angle, a
  15088. Set an expression for the angle by which to rotate the input video
  15089. clockwise, expressed as a number of radians. A negative value will
  15090. result in a counter-clockwise rotation. By default it is set to "0".
  15091. This expression is evaluated for each frame.
  15092. @item out_w, ow
  15093. Set the output width expression, default value is "iw".
  15094. This expression is evaluated just once during configuration.
  15095. @item out_h, oh
  15096. Set the output height expression, default value is "ih".
  15097. This expression is evaluated just once during configuration.
  15098. @item bilinear
  15099. Enable bilinear interpolation if set to 1, a value of 0 disables
  15100. it. Default value is 1.
  15101. @item fillcolor, c
  15102. Set the color used to fill the output area not covered by the rotated
  15103. image. For the general syntax of this option, check the
  15104. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15105. If the special value "none" is selected then no
  15106. background is printed (useful for example if the background is never shown).
  15107. Default value is "black".
  15108. @end table
  15109. The expressions for the angle and the output size can contain the
  15110. following constants and functions:
  15111. @table @option
  15112. @item n
  15113. sequential number of the input frame, starting from 0. It is always NAN
  15114. before the first frame is filtered.
  15115. @item t
  15116. time in seconds of the input frame, it is set to 0 when the filter is
  15117. configured. It is always NAN before the first frame is filtered.
  15118. @item hsub
  15119. @item vsub
  15120. horizontal and vertical chroma subsample values. For example for the
  15121. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15122. @item in_w, iw
  15123. @item in_h, ih
  15124. the input video width and height
  15125. @item out_w, ow
  15126. @item out_h, oh
  15127. the output width and height, that is the size of the padded area as
  15128. specified by the @var{width} and @var{height} expressions
  15129. @item rotw(a)
  15130. @item roth(a)
  15131. the minimal width/height required for completely containing the input
  15132. video rotated by @var{a} radians.
  15133. These are only available when computing the @option{out_w} and
  15134. @option{out_h} expressions.
  15135. @end table
  15136. @subsection Examples
  15137. @itemize
  15138. @item
  15139. Rotate the input by PI/6 radians clockwise:
  15140. @example
  15141. rotate=PI/6
  15142. @end example
  15143. @item
  15144. Rotate the input by PI/6 radians counter-clockwise:
  15145. @example
  15146. rotate=-PI/6
  15147. @end example
  15148. @item
  15149. Rotate the input by 45 degrees clockwise:
  15150. @example
  15151. rotate=45*PI/180
  15152. @end example
  15153. @item
  15154. Apply a constant rotation with period T, starting from an angle of PI/3:
  15155. @example
  15156. rotate=PI/3+2*PI*t/T
  15157. @end example
  15158. @item
  15159. Make the input video rotation oscillating with a period of T
  15160. seconds and an amplitude of A radians:
  15161. @example
  15162. rotate=A*sin(2*PI/T*t)
  15163. @end example
  15164. @item
  15165. Rotate the video, output size is chosen so that the whole rotating
  15166. input video is always completely contained in the output:
  15167. @example
  15168. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  15169. @end example
  15170. @item
  15171. Rotate the video, reduce the output size so that no background is ever
  15172. shown:
  15173. @example
  15174. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  15175. @end example
  15176. @end itemize
  15177. @subsection Commands
  15178. The filter supports the following commands:
  15179. @table @option
  15180. @item a, angle
  15181. Set the angle expression.
  15182. The command accepts the same syntax of the corresponding option.
  15183. If the specified expression is not valid, it is kept at its current
  15184. value.
  15185. @end table
  15186. @section sab
  15187. Apply Shape Adaptive Blur.
  15188. The filter accepts the following options:
  15189. @table @option
  15190. @item luma_radius, lr
  15191. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  15192. value is 1.0. A greater value will result in a more blurred image, and
  15193. in slower processing.
  15194. @item luma_pre_filter_radius, lpfr
  15195. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  15196. value is 1.0.
  15197. @item luma_strength, ls
  15198. Set luma maximum difference between pixels to still be considered, must
  15199. be a value in the 0.1-100.0 range, default value is 1.0.
  15200. @item chroma_radius, cr
  15201. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  15202. greater value will result in a more blurred image, and in slower
  15203. processing.
  15204. @item chroma_pre_filter_radius, cpfr
  15205. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  15206. @item chroma_strength, cs
  15207. Set chroma maximum difference between pixels to still be considered,
  15208. must be a value in the -0.9-100.0 range.
  15209. @end table
  15210. Each chroma option value, if not explicitly specified, is set to the
  15211. corresponding luma option value.
  15212. @anchor{scale}
  15213. @section scale
  15214. Scale (resize) the input video, using the libswscale library.
  15215. The scale filter forces the output display aspect ratio to be the same
  15216. of the input, by changing the output sample aspect ratio.
  15217. If the input image format is different from the format requested by
  15218. the next filter, the scale filter will convert the input to the
  15219. requested format.
  15220. @subsection Options
  15221. The filter accepts the following options, or any of the options
  15222. supported by the libswscale scaler.
  15223. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  15224. the complete list of scaler options.
  15225. @table @option
  15226. @item width, w
  15227. @item height, h
  15228. Set the output video dimension expression. Default value is the input
  15229. dimension.
  15230. If the @var{width} or @var{w} value is 0, the input width is used for
  15231. the output. If the @var{height} or @var{h} value is 0, the input height
  15232. is used for the output.
  15233. If one and only one of the values is -n with n >= 1, the scale filter
  15234. will use a value that maintains the aspect ratio of the input image,
  15235. calculated from the other specified dimension. After that it will,
  15236. however, make sure that the calculated dimension is divisible by n and
  15237. adjust the value if necessary.
  15238. If both values are -n with n >= 1, the behavior will be identical to
  15239. both values being set to 0 as previously detailed.
  15240. See below for the list of accepted constants for use in the dimension
  15241. expression.
  15242. @item eval
  15243. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  15244. @table @samp
  15245. @item init
  15246. Only evaluate expressions once during the filter initialization or when a command is processed.
  15247. @item frame
  15248. Evaluate expressions for each incoming frame.
  15249. @end table
  15250. Default value is @samp{init}.
  15251. @item interl
  15252. Set the interlacing mode. It accepts the following values:
  15253. @table @samp
  15254. @item 1
  15255. Force interlaced aware scaling.
  15256. @item 0
  15257. Do not apply interlaced scaling.
  15258. @item -1
  15259. Select interlaced aware scaling depending on whether the source frames
  15260. are flagged as interlaced or not.
  15261. @end table
  15262. Default value is @samp{0}.
  15263. @item flags
  15264. Set libswscale scaling flags. See
  15265. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  15266. complete list of values. If not explicitly specified the filter applies
  15267. the default flags.
  15268. @item param0, param1
  15269. Set libswscale input parameters for scaling algorithms that need them. See
  15270. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  15271. complete documentation. If not explicitly specified the filter applies
  15272. empty parameters.
  15273. @item size, s
  15274. Set the video size. For the syntax of this option, check the
  15275. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15276. @item in_color_matrix
  15277. @item out_color_matrix
  15278. Set in/output YCbCr color space type.
  15279. This allows the autodetected value to be overridden as well as allows forcing
  15280. a specific value used for the output and encoder.
  15281. If not specified, the color space type depends on the pixel format.
  15282. Possible values:
  15283. @table @samp
  15284. @item auto
  15285. Choose automatically.
  15286. @item bt709
  15287. Format conforming to International Telecommunication Union (ITU)
  15288. Recommendation BT.709.
  15289. @item fcc
  15290. Set color space conforming to the United States Federal Communications
  15291. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  15292. @item bt601
  15293. @item bt470
  15294. @item smpte170m
  15295. Set color space conforming to:
  15296. @itemize
  15297. @item
  15298. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  15299. @item
  15300. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  15301. @item
  15302. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  15303. @end itemize
  15304. @item smpte240m
  15305. Set color space conforming to SMPTE ST 240:1999.
  15306. @item bt2020
  15307. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  15308. @end table
  15309. @item in_range
  15310. @item out_range
  15311. Set in/output YCbCr sample range.
  15312. This allows the autodetected value to be overridden as well as allows forcing
  15313. a specific value used for the output and encoder. If not specified, the
  15314. range depends on the pixel format. Possible values:
  15315. @table @samp
  15316. @item auto/unknown
  15317. Choose automatically.
  15318. @item jpeg/full/pc
  15319. Set full range (0-255 in case of 8-bit luma).
  15320. @item mpeg/limited/tv
  15321. Set "MPEG" range (16-235 in case of 8-bit luma).
  15322. @end table
  15323. @item force_original_aspect_ratio
  15324. Enable decreasing or increasing output video width or height if necessary to
  15325. keep the original aspect ratio. Possible values:
  15326. @table @samp
  15327. @item disable
  15328. Scale the video as specified and disable this feature.
  15329. @item decrease
  15330. The output video dimensions will automatically be decreased if needed.
  15331. @item increase
  15332. The output video dimensions will automatically be increased if needed.
  15333. @end table
  15334. One useful instance of this option is that when you know a specific device's
  15335. maximum allowed resolution, you can use this to limit the output video to
  15336. that, while retaining the aspect ratio. For example, device A allows
  15337. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  15338. decrease) and specifying 1280x720 to the command line makes the output
  15339. 1280x533.
  15340. Please note that this is a different thing than specifying -1 for @option{w}
  15341. or @option{h}, you still need to specify the output resolution for this option
  15342. to work.
  15343. @item force_divisible_by
  15344. Ensures that both the output dimensions, width and height, are divisible by the
  15345. given integer when used together with @option{force_original_aspect_ratio}. This
  15346. works similar to using @code{-n} in the @option{w} and @option{h} options.
  15347. This option respects the value set for @option{force_original_aspect_ratio},
  15348. increasing or decreasing the resolution accordingly. The video's aspect ratio
  15349. may be slightly modified.
  15350. This option can be handy if you need to have a video fit within or exceed
  15351. a defined resolution using @option{force_original_aspect_ratio} but also have
  15352. encoder restrictions on width or height divisibility.
  15353. @end table
  15354. The values of the @option{w} and @option{h} options are expressions
  15355. containing the following constants:
  15356. @table @var
  15357. @item in_w
  15358. @item in_h
  15359. The input width and height
  15360. @item iw
  15361. @item ih
  15362. These are the same as @var{in_w} and @var{in_h}.
  15363. @item out_w
  15364. @item out_h
  15365. The output (scaled) width and height
  15366. @item ow
  15367. @item oh
  15368. These are the same as @var{out_w} and @var{out_h}
  15369. @item a
  15370. The same as @var{iw} / @var{ih}
  15371. @item sar
  15372. input sample aspect ratio
  15373. @item dar
  15374. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  15375. @item hsub
  15376. @item vsub
  15377. horizontal and vertical input chroma subsample values. For example for the
  15378. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15379. @item ohsub
  15380. @item ovsub
  15381. horizontal and vertical output chroma subsample values. For example for the
  15382. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15383. @item n
  15384. The (sequential) number of the input frame, starting from 0.
  15385. Only available with @code{eval=frame}.
  15386. @item t
  15387. The presentation timestamp of the input frame, expressed as a number of
  15388. seconds. Only available with @code{eval=frame}.
  15389. @item pos
  15390. The position (byte offset) of the frame in the input stream, or NaN if
  15391. this information is unavailable and/or meaningless (for example in case of synthetic video).
  15392. Only available with @code{eval=frame}.
  15393. @end table
  15394. @subsection Examples
  15395. @itemize
  15396. @item
  15397. Scale the input video to a size of 200x100
  15398. @example
  15399. scale=w=200:h=100
  15400. @end example
  15401. This is equivalent to:
  15402. @example
  15403. scale=200:100
  15404. @end example
  15405. or:
  15406. @example
  15407. scale=200x100
  15408. @end example
  15409. @item
  15410. Specify a size abbreviation for the output size:
  15411. @example
  15412. scale=qcif
  15413. @end example
  15414. which can also be written as:
  15415. @example
  15416. scale=size=qcif
  15417. @end example
  15418. @item
  15419. Scale the input to 2x:
  15420. @example
  15421. scale=w=2*iw:h=2*ih
  15422. @end example
  15423. @item
  15424. The above is the same as:
  15425. @example
  15426. scale=2*in_w:2*in_h
  15427. @end example
  15428. @item
  15429. Scale the input to 2x with forced interlaced scaling:
  15430. @example
  15431. scale=2*iw:2*ih:interl=1
  15432. @end example
  15433. @item
  15434. Scale the input to half size:
  15435. @example
  15436. scale=w=iw/2:h=ih/2
  15437. @end example
  15438. @item
  15439. Increase the width, and set the height to the same size:
  15440. @example
  15441. scale=3/2*iw:ow
  15442. @end example
  15443. @item
  15444. Seek Greek harmony:
  15445. @example
  15446. scale=iw:1/PHI*iw
  15447. scale=ih*PHI:ih
  15448. @end example
  15449. @item
  15450. Increase the height, and set the width to 3/2 of the height:
  15451. @example
  15452. scale=w=3/2*oh:h=3/5*ih
  15453. @end example
  15454. @item
  15455. Increase the size, making the size a multiple of the chroma
  15456. subsample values:
  15457. @example
  15458. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  15459. @end example
  15460. @item
  15461. Increase the width to a maximum of 500 pixels,
  15462. keeping the same aspect ratio as the input:
  15463. @example
  15464. scale=w='min(500\, iw*3/2):h=-1'
  15465. @end example
  15466. @item
  15467. Make pixels square by combining scale and setsar:
  15468. @example
  15469. scale='trunc(ih*dar):ih',setsar=1/1
  15470. @end example
  15471. @item
  15472. Make pixels square by combining scale and setsar,
  15473. making sure the resulting resolution is even (required by some codecs):
  15474. @example
  15475. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  15476. @end example
  15477. @end itemize
  15478. @subsection Commands
  15479. This filter supports the following commands:
  15480. @table @option
  15481. @item width, w
  15482. @item height, h
  15483. Set the output video dimension expression.
  15484. The command accepts the same syntax of the corresponding option.
  15485. If the specified expression is not valid, it is kept at its current
  15486. value.
  15487. @end table
  15488. @section scale_cuda
  15489. Scale (resize) and convert (pixel format) the input video, using accelerated CUDA kernels.
  15490. Setting the output width and height works in the same way as for the @ref{scale} filter.
  15491. The filter accepts the following options:
  15492. @table @option
  15493. @item w
  15494. @item h
  15495. Set the output video dimension expression. Default value is the input dimension.
  15496. Allows for the same expressions as the @ref{scale} filter.
  15497. @item interp_algo
  15498. Sets the algorithm used for scaling:
  15499. @table @var
  15500. @item nearest
  15501. Nearest neighbour
  15502. Used by default if input parameters match the desired output.
  15503. @item bilinear
  15504. Bilinear
  15505. @item bicubic
  15506. Bicubic
  15507. This is the default.
  15508. @item lanczos
  15509. Lanczos
  15510. @end table
  15511. @item format
  15512. Controls the output pixel format. By default, or if none is specified, the input
  15513. pixel format is used.
  15514. The filter does not support converting between YUV and RGB pixel formats.
  15515. @item passthrough
  15516. If set to 0, every frame is processed, even if no conversion is neccesary.
  15517. This mode can be useful to use the filter as a buffer for a downstream
  15518. frame-consumer that exhausts the limited decoder frame pool.
  15519. If set to 1, frames are passed through as-is if they match the desired output
  15520. parameters. This is the default behaviour.
  15521. @item param
  15522. Algorithm-Specific parameter.
  15523. Affects the curves of the bicubic algorithm.
  15524. @item force_original_aspect_ratio
  15525. @item force_divisible_by
  15526. Work the same as the identical @ref{scale} filter options.
  15527. @end table
  15528. @subsection Examples
  15529. @itemize
  15530. @item
  15531. Scale input to 720p, keeping aspect ratio and ensuring the output is yuv420p.
  15532. @example
  15533. scale_cuda=-2:720:format=yuv420p
  15534. @end example
  15535. @item
  15536. Upscale to 4K using nearest neighbour algorithm.
  15537. @example
  15538. scale_cuda=4096:2160:interp_algo=nearest
  15539. @end example
  15540. @item
  15541. Don't do any conversion or scaling, but copy all input frames into newly allocated ones.
  15542. This can be useful to deal with a filter and encode chain that otherwise exhausts the
  15543. decoders frame pool.
  15544. @example
  15545. scale_cuda=passthrough=0
  15546. @end example
  15547. @end itemize
  15548. @anchor{scale_npp}
  15549. @section scale_npp
  15550. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  15551. format conversion on CUDA video frames. Setting the output width and height
  15552. works in the same way as for the @var{scale} filter.
  15553. The following additional options are accepted:
  15554. @table @option
  15555. @item format
  15556. The pixel format of the output CUDA frames. If set to the string "same" (the
  15557. default), the input format will be kept. Note that automatic format negotiation
  15558. and conversion is not yet supported for hardware frames
  15559. @item interp_algo
  15560. The interpolation algorithm used for resizing. One of the following:
  15561. @table @option
  15562. @item nn
  15563. Nearest neighbour.
  15564. @item linear
  15565. @item cubic
  15566. @item cubic2p_bspline
  15567. 2-parameter cubic (B=1, C=0)
  15568. @item cubic2p_catmullrom
  15569. 2-parameter cubic (B=0, C=1/2)
  15570. @item cubic2p_b05c03
  15571. 2-parameter cubic (B=1/2, C=3/10)
  15572. @item super
  15573. Supersampling
  15574. @item lanczos
  15575. @end table
  15576. @item force_original_aspect_ratio
  15577. Enable decreasing or increasing output video width or height if necessary to
  15578. keep the original aspect ratio. Possible values:
  15579. @table @samp
  15580. @item disable
  15581. Scale the video as specified and disable this feature.
  15582. @item decrease
  15583. The output video dimensions will automatically be decreased if needed.
  15584. @item increase
  15585. The output video dimensions will automatically be increased if needed.
  15586. @end table
  15587. One useful instance of this option is that when you know a specific device's
  15588. maximum allowed resolution, you can use this to limit the output video to
  15589. that, while retaining the aspect ratio. For example, device A allows
  15590. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  15591. decrease) and specifying 1280x720 to the command line makes the output
  15592. 1280x533.
  15593. Please note that this is a different thing than specifying -1 for @option{w}
  15594. or @option{h}, you still need to specify the output resolution for this option
  15595. to work.
  15596. @item force_divisible_by
  15597. Ensures that both the output dimensions, width and height, are divisible by the
  15598. given integer when used together with @option{force_original_aspect_ratio}. This
  15599. works similar to using @code{-n} in the @option{w} and @option{h} options.
  15600. This option respects the value set for @option{force_original_aspect_ratio},
  15601. increasing or decreasing the resolution accordingly. The video's aspect ratio
  15602. may be slightly modified.
  15603. This option can be handy if you need to have a video fit within or exceed
  15604. a defined resolution using @option{force_original_aspect_ratio} but also have
  15605. encoder restrictions on width or height divisibility.
  15606. @item eval
  15607. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  15608. @table @samp
  15609. @item init
  15610. Only evaluate expressions once during the filter initialization or when a command is processed.
  15611. @item frame
  15612. Evaluate expressions for each incoming frame.
  15613. @end table
  15614. @end table
  15615. The values of the @option{w} and @option{h} options are expressions
  15616. containing the following constants:
  15617. @table @var
  15618. @item in_w
  15619. @item in_h
  15620. The input width and height
  15621. @item iw
  15622. @item ih
  15623. These are the same as @var{in_w} and @var{in_h}.
  15624. @item out_w
  15625. @item out_h
  15626. The output (scaled) width and height
  15627. @item ow
  15628. @item oh
  15629. These are the same as @var{out_w} and @var{out_h}
  15630. @item a
  15631. The same as @var{iw} / @var{ih}
  15632. @item sar
  15633. input sample aspect ratio
  15634. @item dar
  15635. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  15636. @item n
  15637. The (sequential) number of the input frame, starting from 0.
  15638. Only available with @code{eval=frame}.
  15639. @item t
  15640. The presentation timestamp of the input frame, expressed as a number of
  15641. seconds. Only available with @code{eval=frame}.
  15642. @item pos
  15643. The position (byte offset) of the frame in the input stream, or NaN if
  15644. this information is unavailable and/or meaningless (for example in case of synthetic video).
  15645. Only available with @code{eval=frame}.
  15646. @end table
  15647. @section scale2ref
  15648. Scale (resize) the input video, based on a reference video.
  15649. See the scale filter for available options, scale2ref supports the same but
  15650. uses the reference video instead of the main input as basis. scale2ref also
  15651. supports the following additional constants for the @option{w} and
  15652. @option{h} options:
  15653. @table @var
  15654. @item main_w
  15655. @item main_h
  15656. The main input video's width and height
  15657. @item main_a
  15658. The same as @var{main_w} / @var{main_h}
  15659. @item main_sar
  15660. The main input video's sample aspect ratio
  15661. @item main_dar, mdar
  15662. The main input video's display aspect ratio. Calculated from
  15663. @code{(main_w / main_h) * main_sar}.
  15664. @item main_hsub
  15665. @item main_vsub
  15666. The main input video's horizontal and vertical chroma subsample values.
  15667. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  15668. is 1.
  15669. @item main_n
  15670. The (sequential) number of the main input frame, starting from 0.
  15671. Only available with @code{eval=frame}.
  15672. @item main_t
  15673. The presentation timestamp of the main input frame, expressed as a number of
  15674. seconds. Only available with @code{eval=frame}.
  15675. @item main_pos
  15676. The position (byte offset) of the frame in the main input stream, or NaN if
  15677. this information is unavailable and/or meaningless (for example in case of synthetic video).
  15678. Only available with @code{eval=frame}.
  15679. @end table
  15680. @subsection Examples
  15681. @itemize
  15682. @item
  15683. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  15684. @example
  15685. 'scale2ref[b][a];[a][b]overlay'
  15686. @end example
  15687. @item
  15688. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  15689. @example
  15690. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  15691. @end example
  15692. @end itemize
  15693. @subsection Commands
  15694. This filter supports the following commands:
  15695. @table @option
  15696. @item width, w
  15697. @item height, h
  15698. Set the output video dimension expression.
  15699. The command accepts the same syntax of the corresponding option.
  15700. If the specified expression is not valid, it is kept at its current
  15701. value.
  15702. @end table
  15703. @section scale2ref_npp
  15704. Use the NVIDIA Performance Primitives (libnpp) to scale (resize) the input
  15705. video, based on a reference video.
  15706. See the @ref{scale_npp} filter for available options, scale2ref_npp supports the same
  15707. but uses the reference video instead of the main input as basis. scale2ref_npp
  15708. also supports the following additional constants for the @option{w} and
  15709. @option{h} options:
  15710. @table @var
  15711. @item main_w
  15712. @item main_h
  15713. The main input video's width and height
  15714. @item main_a
  15715. The same as @var{main_w} / @var{main_h}
  15716. @item main_sar
  15717. The main input video's sample aspect ratio
  15718. @item main_dar, mdar
  15719. The main input video's display aspect ratio. Calculated from
  15720. @code{(main_w / main_h) * main_sar}.
  15721. @item main_n
  15722. The (sequential) number of the main input frame, starting from 0.
  15723. Only available with @code{eval=frame}.
  15724. @item main_t
  15725. The presentation timestamp of the main input frame, expressed as a number of
  15726. seconds. Only available with @code{eval=frame}.
  15727. @item main_pos
  15728. The position (byte offset) of the frame in the main input stream, or NaN if
  15729. this information is unavailable and/or meaningless (for example in case of synthetic video).
  15730. Only available with @code{eval=frame}.
  15731. @end table
  15732. @subsection Examples
  15733. @itemize
  15734. @item
  15735. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  15736. @example
  15737. 'scale2ref_npp[b][a];[a][b]overlay_cuda'
  15738. @end example
  15739. @item
  15740. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  15741. @example
  15742. [logo-in][video-in]scale2ref_npp=w=oh*mdar:h=ih/10[logo-out][video-out]
  15743. @end example
  15744. @end itemize
  15745. @section scharr
  15746. Apply scharr operator to input video stream.
  15747. The filter accepts the following option:
  15748. @table @option
  15749. @item planes
  15750. Set which planes will be processed, unprocessed planes will be copied.
  15751. By default value 0xf, all planes will be processed.
  15752. @item scale
  15753. Set value which will be multiplied with filtered result.
  15754. @item delta
  15755. Set value which will be added to filtered result.
  15756. @end table
  15757. @subsection Commands
  15758. This filter supports the all above options as @ref{commands}.
  15759. @section scroll
  15760. Scroll input video horizontally and/or vertically by constant speed.
  15761. The filter accepts the following options:
  15762. @table @option
  15763. @item horizontal, h
  15764. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  15765. Negative values changes scrolling direction.
  15766. @item vertical, v
  15767. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  15768. Negative values changes scrolling direction.
  15769. @item hpos
  15770. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  15771. @item vpos
  15772. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  15773. @end table
  15774. @subsection Commands
  15775. This filter supports the following @ref{commands}:
  15776. @table @option
  15777. @item horizontal, h
  15778. Set the horizontal scrolling speed.
  15779. @item vertical, v
  15780. Set the vertical scrolling speed.
  15781. @end table
  15782. @anchor{scdet}
  15783. @section scdet
  15784. Detect video scene change.
  15785. This filter sets frame metadata with mafd between frame, the scene score, and
  15786. forward the frame to the next filter, so they can use these metadata to detect
  15787. scene change or others.
  15788. In addition, this filter logs a message and sets frame metadata when it detects
  15789. a scene change by @option{threshold}.
  15790. @code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
  15791. @code{lavfi.scd.score} metadata keys are set with scene change score for every frame
  15792. to detect scene change.
  15793. @code{lavfi.scd.time} metadata keys are set with current filtered frame time which
  15794. detect scene change with @option{threshold}.
  15795. The filter accepts the following options:
  15796. @table @option
  15797. @item threshold, t
  15798. Set the scene change detection threshold as a percentage of maximum change. Good
  15799. values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} is
  15800. @code{[0., 100.]}.
  15801. Default value is @code{10.}.
  15802. @item sc_pass, s
  15803. Set the flag to pass scene change frames to the next filter. Default value is @code{0}
  15804. You can enable it if you want to get snapshot of scene change frames only.
  15805. @end table
  15806. @anchor{selectivecolor}
  15807. @section selectivecolor
  15808. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  15809. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  15810. by the "purity" of the color (that is, how saturated it already is).
  15811. This filter is similar to the Adobe Photoshop Selective Color tool.
  15812. The filter accepts the following options:
  15813. @table @option
  15814. @item correction_method
  15815. Select color correction method.
  15816. Available values are:
  15817. @table @samp
  15818. @item absolute
  15819. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  15820. component value).
  15821. @item relative
  15822. Specified adjustments are relative to the original component value.
  15823. @end table
  15824. Default is @code{absolute}.
  15825. @item reds
  15826. Adjustments for red pixels (pixels where the red component is the maximum)
  15827. @item yellows
  15828. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  15829. @item greens
  15830. Adjustments for green pixels (pixels where the green component is the maximum)
  15831. @item cyans
  15832. Adjustments for cyan pixels (pixels where the red component is the minimum)
  15833. @item blues
  15834. Adjustments for blue pixels (pixels where the blue component is the maximum)
  15835. @item magentas
  15836. Adjustments for magenta pixels (pixels where the green component is the minimum)
  15837. @item whites
  15838. Adjustments for white pixels (pixels where all components are greater than 128)
  15839. @item neutrals
  15840. Adjustments for all pixels except pure black and pure white
  15841. @item blacks
  15842. Adjustments for black pixels (pixels where all components are lesser than 128)
  15843. @item psfile
  15844. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  15845. @end table
  15846. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  15847. 4 space separated floating point adjustment values in the [-1,1] range,
  15848. respectively to adjust the amount of cyan, magenta, yellow and black for the
  15849. pixels of its range.
  15850. @subsection Examples
  15851. @itemize
  15852. @item
  15853. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  15854. increase magenta by 27% in blue areas:
  15855. @example
  15856. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  15857. @end example
  15858. @item
  15859. Use a Photoshop selective color preset:
  15860. @example
  15861. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  15862. @end example
  15863. @end itemize
  15864. @anchor{separatefields}
  15865. @section separatefields
  15866. The @code{separatefields} takes a frame-based video input and splits
  15867. each frame into its components fields, producing a new half height clip
  15868. with twice the frame rate and twice the frame count.
  15869. This filter use field-dominance information in frame to decide which
  15870. of each pair of fields to place first in the output.
  15871. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  15872. @section setdar, setsar
  15873. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  15874. output video.
  15875. This is done by changing the specified Sample (aka Pixel) Aspect
  15876. Ratio, according to the following equation:
  15877. @example
  15878. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  15879. @end example
  15880. Keep in mind that the @code{setdar} filter does not modify the pixel
  15881. dimensions of the video frame. Also, the display aspect ratio set by
  15882. this filter may be changed by later filters in the filterchain,
  15883. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  15884. applied.
  15885. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  15886. the filter output video.
  15887. Note that as a consequence of the application of this filter, the
  15888. output display aspect ratio will change according to the equation
  15889. above.
  15890. Keep in mind that the sample aspect ratio set by the @code{setsar}
  15891. filter may be changed by later filters in the filterchain, e.g. if
  15892. another "setsar" or a "setdar" filter is applied.
  15893. It accepts the following parameters:
  15894. @table @option
  15895. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  15896. Set the aspect ratio used by the filter.
  15897. The parameter can be a floating point number string, an expression, or
  15898. a string of the form @var{num}:@var{den}, where @var{num} and
  15899. @var{den} are the numerator and denominator of the aspect ratio. If
  15900. the parameter is not specified, it is assumed the value "0".
  15901. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  15902. should be escaped.
  15903. @item max
  15904. Set the maximum integer value to use for expressing numerator and
  15905. denominator when reducing the expressed aspect ratio to a rational.
  15906. Default value is @code{100}.
  15907. @end table
  15908. The parameter @var{sar} is an expression containing
  15909. the following constants:
  15910. @table @option
  15911. @item E, PI, PHI
  15912. These are approximated values for the mathematical constants e
  15913. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  15914. @item w, h
  15915. The input width and height.
  15916. @item a
  15917. These are the same as @var{w} / @var{h}.
  15918. @item sar
  15919. The input sample aspect ratio.
  15920. @item dar
  15921. The input display aspect ratio. It is the same as
  15922. (@var{w} / @var{h}) * @var{sar}.
  15923. @item hsub, vsub
  15924. Horizontal and vertical chroma subsample values. For example, for the
  15925. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15926. @end table
  15927. @subsection Examples
  15928. @itemize
  15929. @item
  15930. To change the display aspect ratio to 16:9, specify one of the following:
  15931. @example
  15932. setdar=dar=1.77777
  15933. setdar=dar=16/9
  15934. @end example
  15935. @item
  15936. To change the sample aspect ratio to 10:11, specify:
  15937. @example
  15938. setsar=sar=10/11
  15939. @end example
  15940. @item
  15941. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  15942. 1000 in the aspect ratio reduction, use the command:
  15943. @example
  15944. setdar=ratio=16/9:max=1000
  15945. @end example
  15946. @end itemize
  15947. @anchor{setfield}
  15948. @section setfield
  15949. Force field for the output video frame.
  15950. The @code{setfield} filter marks the interlace type field for the
  15951. output frames. It does not change the input frame, but only sets the
  15952. corresponding property, which affects how the frame is treated by
  15953. following filters (e.g. @code{fieldorder} or @code{yadif}).
  15954. The filter accepts the following options:
  15955. @table @option
  15956. @item mode
  15957. Available values are:
  15958. @table @samp
  15959. @item auto
  15960. Keep the same field property.
  15961. @item bff
  15962. Mark the frame as bottom-field-first.
  15963. @item tff
  15964. Mark the frame as top-field-first.
  15965. @item prog
  15966. Mark the frame as progressive.
  15967. @end table
  15968. @end table
  15969. @anchor{setparams}
  15970. @section setparams
  15971. Force frame parameter for the output video frame.
  15972. The @code{setparams} filter marks interlace and color range for the
  15973. output frames. It does not change the input frame, but only sets the
  15974. corresponding property, which affects how the frame is treated by
  15975. filters/encoders.
  15976. @table @option
  15977. @item field_mode
  15978. Available values are:
  15979. @table @samp
  15980. @item auto
  15981. Keep the same field property (default).
  15982. @item bff
  15983. Mark the frame as bottom-field-first.
  15984. @item tff
  15985. Mark the frame as top-field-first.
  15986. @item prog
  15987. Mark the frame as progressive.
  15988. @end table
  15989. @item range
  15990. Available values are:
  15991. @table @samp
  15992. @item auto
  15993. Keep the same color range property (default).
  15994. @item unspecified, unknown
  15995. Mark the frame as unspecified color range.
  15996. @item limited, tv, mpeg
  15997. Mark the frame as limited range.
  15998. @item full, pc, jpeg
  15999. Mark the frame as full range.
  16000. @end table
  16001. @item color_primaries
  16002. Set the color primaries.
  16003. Available values are:
  16004. @table @samp
  16005. @item auto
  16006. Keep the same color primaries property (default).
  16007. @item bt709
  16008. @item unknown
  16009. @item bt470m
  16010. @item bt470bg
  16011. @item smpte170m
  16012. @item smpte240m
  16013. @item film
  16014. @item bt2020
  16015. @item smpte428
  16016. @item smpte431
  16017. @item smpte432
  16018. @item jedec-p22
  16019. @end table
  16020. @item color_trc
  16021. Set the color transfer.
  16022. Available values are:
  16023. @table @samp
  16024. @item auto
  16025. Keep the same color trc property (default).
  16026. @item bt709
  16027. @item unknown
  16028. @item bt470m
  16029. @item bt470bg
  16030. @item smpte170m
  16031. @item smpte240m
  16032. @item linear
  16033. @item log100
  16034. @item log316
  16035. @item iec61966-2-4
  16036. @item bt1361e
  16037. @item iec61966-2-1
  16038. @item bt2020-10
  16039. @item bt2020-12
  16040. @item smpte2084
  16041. @item smpte428
  16042. @item arib-std-b67
  16043. @end table
  16044. @item colorspace
  16045. Set the colorspace.
  16046. Available values are:
  16047. @table @samp
  16048. @item auto
  16049. Keep the same colorspace property (default).
  16050. @item gbr
  16051. @item bt709
  16052. @item unknown
  16053. @item fcc
  16054. @item bt470bg
  16055. @item smpte170m
  16056. @item smpte240m
  16057. @item ycgco
  16058. @item bt2020nc
  16059. @item bt2020c
  16060. @item smpte2085
  16061. @item chroma-derived-nc
  16062. @item chroma-derived-c
  16063. @item ictcp
  16064. @end table
  16065. @end table
  16066. @section sharpen_npp
  16067. Use the NVIDIA Performance Primitives (libnpp) to perform image sharpening with
  16068. border control.
  16069. The following additional options are accepted:
  16070. @table @option
  16071. @item border_type
  16072. Type of sampling to be used ad frame borders. One of the following:
  16073. @table @option
  16074. @item replicate
  16075. Replicate pixel values.
  16076. @end table
  16077. @end table
  16078. @section shear
  16079. Apply shear transform to input video.
  16080. This filter supports the following options:
  16081. @table @option
  16082. @item shx
  16083. Shear factor in X-direction. Default value is 0.
  16084. Allowed range is from -2 to 2.
  16085. @item shy
  16086. Shear factor in Y-direction. Default value is 0.
  16087. Allowed range is from -2 to 2.
  16088. @item fillcolor, c
  16089. Set the color used to fill the output area not covered by the transformed
  16090. video. For the general syntax of this option, check the
  16091. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16092. If the special value "none" is selected then no
  16093. background is printed (useful for example if the background is never shown).
  16094. Default value is "black".
  16095. @item interp
  16096. Set interpolation type. Can be @code{bilinear} or @code{nearest}. Default is @code{bilinear}.
  16097. @end table
  16098. @subsection Commands
  16099. This filter supports the all above options as @ref{commands}.
  16100. @section showinfo
  16101. Show a line containing various information for each input video frame.
  16102. The input video is not modified.
  16103. This filter supports the following options:
  16104. @table @option
  16105. @item checksum
  16106. Calculate checksums of each plane. By default enabled.
  16107. @end table
  16108. The shown line contains a sequence of key/value pairs of the form
  16109. @var{key}:@var{value}.
  16110. The following values are shown in the output:
  16111. @table @option
  16112. @item n
  16113. The (sequential) number of the input frame, starting from 0.
  16114. @item pts
  16115. The Presentation TimeStamp of the input frame, expressed as a number of
  16116. time base units. The time base unit depends on the filter input pad.
  16117. @item pts_time
  16118. The Presentation TimeStamp of the input frame, expressed as a number of
  16119. seconds.
  16120. @item pos
  16121. The position of the frame in the input stream, or -1 if this information is
  16122. unavailable and/or meaningless (for example in case of synthetic video).
  16123. @item fmt
  16124. The pixel format name.
  16125. @item sar
  16126. The sample aspect ratio of the input frame, expressed in the form
  16127. @var{num}/@var{den}.
  16128. @item s
  16129. The size of the input frame. For the syntax of this option, check the
  16130. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16131. @item i
  16132. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  16133. for bottom field first).
  16134. @item iskey
  16135. This is 1 if the frame is a key frame, 0 otherwise.
  16136. @item type
  16137. The picture type of the input frame ("I" for an I-frame, "P" for a
  16138. P-frame, "B" for a B-frame, or "?" for an unknown type).
  16139. Also refer to the documentation of the @code{AVPictureType} enum and of
  16140. the @code{av_get_picture_type_char} function defined in
  16141. @file{libavutil/avutil.h}.
  16142. @item checksum
  16143. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  16144. @item plane_checksum
  16145. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  16146. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  16147. @item mean
  16148. The mean value of pixels in each plane of the input frame, expressed in the form
  16149. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  16150. @item stdev
  16151. The standard deviation of pixel values in each plane of the input frame, expressed
  16152. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  16153. @end table
  16154. @section showpalette
  16155. Displays the 256 colors palette of each frame. This filter is only relevant for
  16156. @var{pal8} pixel format frames.
  16157. It accepts the following option:
  16158. @table @option
  16159. @item s
  16160. Set the size of the box used to represent one palette color entry. Default is
  16161. @code{30} (for a @code{30x30} pixel box).
  16162. @end table
  16163. @section shuffleframes
  16164. Reorder and/or duplicate and/or drop video frames.
  16165. It accepts the following parameters:
  16166. @table @option
  16167. @item mapping
  16168. Set the destination indexes of input frames.
  16169. This is space or '|' separated list of indexes that maps input frames to output
  16170. frames. Number of indexes also sets maximal value that each index may have.
  16171. '-1' index have special meaning and that is to drop frame.
  16172. @end table
  16173. The first frame has the index 0. The default is to keep the input unchanged.
  16174. @subsection Examples
  16175. @itemize
  16176. @item
  16177. Swap second and third frame of every three frames of the input:
  16178. @example
  16179. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  16180. @end example
  16181. @item
  16182. Swap 10th and 1st frame of every ten frames of the input:
  16183. @example
  16184. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  16185. @end example
  16186. @end itemize
  16187. @section shufflepixels
  16188. Reorder pixels in video frames.
  16189. This filter accepts the following options:
  16190. @table @option
  16191. @item direction, d
  16192. Set shuffle direction. Can be forward or inverse direction.
  16193. Default direction is forward.
  16194. @item mode, m
  16195. Set shuffle mode. Can be horizontal, vertical or block mode.
  16196. @item width, w
  16197. @item height, h
  16198. Set shuffle block_size. In case of horizontal shuffle mode only width
  16199. part of size is used, and in case of vertical shuffle mode only height
  16200. part of size is used.
  16201. @item seed, s
  16202. Set random seed used with shuffling pixels. Mainly useful to set to be able
  16203. to reverse filtering process to get original input.
  16204. For example, to reverse forward shuffle you need to use same parameters
  16205. and exact same seed and to set direction to inverse.
  16206. @end table
  16207. @section shuffleplanes
  16208. Reorder and/or duplicate video planes.
  16209. It accepts the following parameters:
  16210. @table @option
  16211. @item map0
  16212. The index of the input plane to be used as the first output plane.
  16213. @item map1
  16214. The index of the input plane to be used as the second output plane.
  16215. @item map2
  16216. The index of the input plane to be used as the third output plane.
  16217. @item map3
  16218. The index of the input plane to be used as the fourth output plane.
  16219. @end table
  16220. The first plane has the index 0. The default is to keep the input unchanged.
  16221. @subsection Examples
  16222. @itemize
  16223. @item
  16224. Swap the second and third planes of the input:
  16225. @example
  16226. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  16227. @end example
  16228. @end itemize
  16229. @anchor{signalstats}
  16230. @section signalstats
  16231. Evaluate various visual metrics that assist in determining issues associated
  16232. with the digitization of analog video media.
  16233. By default the filter will log these metadata values:
  16234. @table @option
  16235. @item YMIN
  16236. Display the minimal Y value contained within the input frame. Expressed in
  16237. range of [0-255].
  16238. @item YLOW
  16239. Display the Y value at the 10% percentile within the input frame. Expressed in
  16240. range of [0-255].
  16241. @item YAVG
  16242. Display the average Y value within the input frame. Expressed in range of
  16243. [0-255].
  16244. @item YHIGH
  16245. Display the Y value at the 90% percentile within the input frame. Expressed in
  16246. range of [0-255].
  16247. @item YMAX
  16248. Display the maximum Y value contained within the input frame. Expressed in
  16249. range of [0-255].
  16250. @item UMIN
  16251. Display the minimal U value contained within the input frame. Expressed in
  16252. range of [0-255].
  16253. @item ULOW
  16254. Display the U value at the 10% percentile within the input frame. Expressed in
  16255. range of [0-255].
  16256. @item UAVG
  16257. Display the average U value within the input frame. Expressed in range of
  16258. [0-255].
  16259. @item UHIGH
  16260. Display the U value at the 90% percentile within the input frame. Expressed in
  16261. range of [0-255].
  16262. @item UMAX
  16263. Display the maximum U value contained within the input frame. Expressed in
  16264. range of [0-255].
  16265. @item VMIN
  16266. Display the minimal V value contained within the input frame. Expressed in
  16267. range of [0-255].
  16268. @item VLOW
  16269. Display the V value at the 10% percentile within the input frame. Expressed in
  16270. range of [0-255].
  16271. @item VAVG
  16272. Display the average V value within the input frame. Expressed in range of
  16273. [0-255].
  16274. @item VHIGH
  16275. Display the V value at the 90% percentile within the input frame. Expressed in
  16276. range of [0-255].
  16277. @item VMAX
  16278. Display the maximum V value contained within the input frame. Expressed in
  16279. range of [0-255].
  16280. @item SATMIN
  16281. Display the minimal saturation value contained within the input frame.
  16282. Expressed in range of [0-~181.02].
  16283. @item SATLOW
  16284. Display the saturation value at the 10% percentile within the input frame.
  16285. Expressed in range of [0-~181.02].
  16286. @item SATAVG
  16287. Display the average saturation value within the input frame. Expressed in range
  16288. of [0-~181.02].
  16289. @item SATHIGH
  16290. Display the saturation value at the 90% percentile within the input frame.
  16291. Expressed in range of [0-~181.02].
  16292. @item SATMAX
  16293. Display the maximum saturation value contained within the input frame.
  16294. Expressed in range of [0-~181.02].
  16295. @item HUEMED
  16296. Display the median value for hue within the input frame. Expressed in range of
  16297. [0-360].
  16298. @item HUEAVG
  16299. Display the average value for hue within the input frame. Expressed in range of
  16300. [0-360].
  16301. @item YDIF
  16302. Display the average of sample value difference between all values of the Y
  16303. plane in the current frame and corresponding values of the previous input frame.
  16304. Expressed in range of [0-255].
  16305. @item UDIF
  16306. Display the average of sample value difference between all values of the U
  16307. plane in the current frame and corresponding values of the previous input frame.
  16308. Expressed in range of [0-255].
  16309. @item VDIF
  16310. Display the average of sample value difference between all values of the V
  16311. plane in the current frame and corresponding values of the previous input frame.
  16312. Expressed in range of [0-255].
  16313. @item YBITDEPTH
  16314. Display bit depth of Y plane in current frame.
  16315. Expressed in range of [0-16].
  16316. @item UBITDEPTH
  16317. Display bit depth of U plane in current frame.
  16318. Expressed in range of [0-16].
  16319. @item VBITDEPTH
  16320. Display bit depth of V plane in current frame.
  16321. Expressed in range of [0-16].
  16322. @end table
  16323. The filter accepts the following options:
  16324. @table @option
  16325. @item stat
  16326. @item out
  16327. @option{stat} specify an additional form of image analysis.
  16328. @option{out} output video with the specified type of pixel highlighted.
  16329. Both options accept the following values:
  16330. @table @samp
  16331. @item tout
  16332. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  16333. unlike the neighboring pixels of the same field. Examples of temporal outliers
  16334. include the results of video dropouts, head clogs, or tape tracking issues.
  16335. @item vrep
  16336. Identify @var{vertical line repetition}. Vertical line repetition includes
  16337. similar rows of pixels within a frame. In born-digital video vertical line
  16338. repetition is common, but this pattern is uncommon in video digitized from an
  16339. analog source. When it occurs in video that results from the digitization of an
  16340. analog source it can indicate concealment from a dropout compensator.
  16341. @item brng
  16342. Identify pixels that fall outside of legal broadcast range.
  16343. @end table
  16344. @item color, c
  16345. Set the highlight color for the @option{out} option. The default color is
  16346. yellow.
  16347. @end table
  16348. @subsection Examples
  16349. @itemize
  16350. @item
  16351. Output data of various video metrics:
  16352. @example
  16353. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  16354. @end example
  16355. @item
  16356. Output specific data about the minimum and maximum values of the Y plane per frame:
  16357. @example
  16358. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  16359. @end example
  16360. @item
  16361. Playback video while highlighting pixels that are outside of broadcast range in red.
  16362. @example
  16363. ffplay example.mov -vf signalstats="out=brng:color=red"
  16364. @end example
  16365. @item
  16366. Playback video with signalstats metadata drawn over the frame.
  16367. @example
  16368. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  16369. @end example
  16370. The contents of signalstat_drawtext.txt used in the command are:
  16371. @example
  16372. time %@{pts:hms@}
  16373. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  16374. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  16375. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  16376. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  16377. @end example
  16378. @end itemize
  16379. @anchor{signature}
  16380. @section signature
  16381. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  16382. input. In this case the matching between the inputs can be calculated additionally.
  16383. The filter always passes through the first input. The signature of each stream can
  16384. be written into a file.
  16385. It accepts the following options:
  16386. @table @option
  16387. @item detectmode
  16388. Enable or disable the matching process.
  16389. Available values are:
  16390. @table @samp
  16391. @item off
  16392. Disable the calculation of a matching (default).
  16393. @item full
  16394. Calculate the matching for the whole video and output whether the whole video
  16395. matches or only parts.
  16396. @item fast
  16397. Calculate only until a matching is found or the video ends. Should be faster in
  16398. some cases.
  16399. @end table
  16400. @item nb_inputs
  16401. Set the number of inputs. The option value must be a non negative integer.
  16402. Default value is 1.
  16403. @item filename
  16404. Set the path to which the output is written. If there is more than one input,
  16405. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  16406. integer), that will be replaced with the input number. If no filename is
  16407. specified, no output will be written. This is the default.
  16408. @item format
  16409. Choose the output format.
  16410. Available values are:
  16411. @table @samp
  16412. @item binary
  16413. Use the specified binary representation (default).
  16414. @item xml
  16415. Use the specified xml representation.
  16416. @end table
  16417. @item th_d
  16418. Set threshold to detect one word as similar. The option value must be an integer
  16419. greater than zero. The default value is 9000.
  16420. @item th_dc
  16421. Set threshold to detect all words as similar. The option value must be an integer
  16422. greater than zero. The default value is 60000.
  16423. @item th_xh
  16424. Set threshold to detect frames as similar. The option value must be an integer
  16425. greater than zero. The default value is 116.
  16426. @item th_di
  16427. Set the minimum length of a sequence in frames to recognize it as matching
  16428. sequence. The option value must be a non negative integer value.
  16429. The default value is 0.
  16430. @item th_it
  16431. Set the minimum relation, that matching frames to all frames must have.
  16432. The option value must be a double value between 0 and 1. The default value is 0.5.
  16433. @end table
  16434. @subsection Examples
  16435. @itemize
  16436. @item
  16437. To calculate the signature of an input video and store it in signature.bin:
  16438. @example
  16439. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  16440. @end example
  16441. @item
  16442. To detect whether two videos match and store the signatures in XML format in
  16443. signature0.xml and signature1.xml:
  16444. @example
  16445. 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 -
  16446. @end example
  16447. @end itemize
  16448. @anchor{siti}
  16449. @section siti
  16450. Calculate Spatial Info (SI) and Temporal Info (TI) scores for a video, as defined
  16451. in ITU-T P.910: Subjective video quality assessment methods for multimedia
  16452. applications. Available PDF at @url{https://www.itu.int/rec/T-REC-P.910-199909-S/en }.
  16453. It accepts the following option:
  16454. @table @option
  16455. @item print_summary
  16456. If set to 1, Summary statistics will be printed to the console. Default 0.
  16457. @end table
  16458. @subsection Examples
  16459. @itemize
  16460. @item
  16461. To calculate SI/TI metrics and print summary:
  16462. @example
  16463. ffmpeg -i input.mp4 -vf siti=print_summary=1 -f null -
  16464. @end example
  16465. @end itemize
  16466. @anchor{smartblur}
  16467. @section smartblur
  16468. Blur the input video without impacting the outlines.
  16469. It accepts the following options:
  16470. @table @option
  16471. @item luma_radius, lr
  16472. Set the luma radius. The option value must be a float number in
  16473. the range [0.1,5.0] that specifies the variance of the gaussian filter
  16474. used to blur the image (slower if larger). Default value is 1.0.
  16475. @item luma_strength, ls
  16476. Set the luma strength. The option value must be a float number
  16477. in the range [-1.0,1.0] that configures the blurring. A value included
  16478. in [0.0,1.0] will blur the image whereas a value included in
  16479. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  16480. @item luma_threshold, lt
  16481. Set the luma threshold used as a coefficient to determine
  16482. whether a pixel should be blurred or not. The option value must be an
  16483. integer in the range [-30,30]. A value of 0 will filter all the image,
  16484. a value included in [0,30] will filter flat areas and a value included
  16485. in [-30,0] will filter edges. Default value is 0.
  16486. @item chroma_radius, cr
  16487. Set the chroma radius. The option value must be a float number in
  16488. the range [0.1,5.0] that specifies the variance of the gaussian filter
  16489. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  16490. @item chroma_strength, cs
  16491. Set the chroma strength. The option value must be a float number
  16492. in the range [-1.0,1.0] that configures the blurring. A value included
  16493. in [0.0,1.0] will blur the image whereas a value included in
  16494. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  16495. @item chroma_threshold, ct
  16496. Set the chroma threshold used as a coefficient to determine
  16497. whether a pixel should be blurred or not. The option value must be an
  16498. integer in the range [-30,30]. A value of 0 will filter all the image,
  16499. a value included in [0,30] will filter flat areas and a value included
  16500. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  16501. @end table
  16502. If a chroma option is not explicitly set, the corresponding luma value
  16503. is set.
  16504. @section sobel
  16505. Apply sobel operator to input video stream.
  16506. The filter accepts the following option:
  16507. @table @option
  16508. @item planes
  16509. Set which planes will be processed, unprocessed planes will be copied.
  16510. By default value 0xf, all planes will be processed.
  16511. @item scale
  16512. Set value which will be multiplied with filtered result.
  16513. @item delta
  16514. Set value which will be added to filtered result.
  16515. @end table
  16516. @subsection Commands
  16517. This filter supports the all above options as @ref{commands}.
  16518. @anchor{spp}
  16519. @section spp
  16520. Apply a simple postprocessing filter that compresses and decompresses the image
  16521. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  16522. and average the results.
  16523. The filter accepts the following options:
  16524. @table @option
  16525. @item quality
  16526. Set quality. This option defines the number of levels for averaging. It accepts
  16527. an integer in the range 0-6. If set to @code{0}, the filter will have no
  16528. effect. A value of @code{6} means the higher quality. For each increment of
  16529. that value the speed drops by a factor of approximately 2. Default value is
  16530. @code{3}.
  16531. @item qp
  16532. Force a constant quantization parameter. If not set, the filter will use the QP
  16533. from the video stream (if available).
  16534. @item mode
  16535. Set thresholding mode. Available modes are:
  16536. @table @samp
  16537. @item hard
  16538. Set hard thresholding (default).
  16539. @item soft
  16540. Set soft thresholding (better de-ringing effect, but likely blurrier).
  16541. @end table
  16542. @item use_bframe_qp
  16543. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  16544. option may cause flicker since the B-Frames have often larger QP. Default is
  16545. @code{0} (not enabled).
  16546. @end table
  16547. @subsection Commands
  16548. This filter supports the following commands:
  16549. @table @option
  16550. @item quality, level
  16551. Set quality level. The value @code{max} can be used to set the maximum level,
  16552. currently @code{6}.
  16553. @end table
  16554. @anchor{sr}
  16555. @section sr
  16556. Scale the input by applying one of the super-resolution methods based on
  16557. convolutional neural networks. Supported models:
  16558. @itemize
  16559. @item
  16560. Super-Resolution Convolutional Neural Network model (SRCNN).
  16561. See @url{https://arxiv.org/abs/1501.00092}.
  16562. @item
  16563. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  16564. See @url{https://arxiv.org/abs/1609.05158}.
  16565. @end itemize
  16566. Training scripts as well as scripts for model file (.pb) saving can be found at
  16567. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  16568. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  16569. Native model files (.model) can be generated from TensorFlow model
  16570. files (.pb) by using tools/python/convert.py
  16571. The filter accepts the following options:
  16572. @table @option
  16573. @item dnn_backend
  16574. Specify which DNN backend to use for model loading and execution. This option accepts
  16575. the following values:
  16576. @table @samp
  16577. @item native
  16578. Native implementation of DNN loading and execution.
  16579. @item tensorflow
  16580. TensorFlow backend. To enable this backend you
  16581. need to install the TensorFlow for C library (see
  16582. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  16583. @code{--enable-libtensorflow}
  16584. @end table
  16585. Default value is @samp{native}.
  16586. @item model
  16587. Set path to model file specifying network architecture and its parameters.
  16588. Note that different backends use different file formats. TensorFlow backend
  16589. can load files for both formats, while native backend can load files for only
  16590. its format.
  16591. @item scale_factor
  16592. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  16593. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  16594. input upscaled using bicubic upscaling with proper scale factor.
  16595. @end table
  16596. To get full functionality (such as async execution), please use the @ref{dnn_processing} filter.
  16597. @section ssim
  16598. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  16599. This filter takes in input two input videos, the first input is
  16600. considered the "main" source and is passed unchanged to the
  16601. output. The second input is used as a "reference" video for computing
  16602. the SSIM.
  16603. Both video inputs must have the same resolution and pixel format for
  16604. this filter to work correctly. Also it assumes that both inputs
  16605. have the same number of frames, which are compared one by one.
  16606. The filter stores the calculated SSIM of each frame.
  16607. The description of the accepted parameters follows.
  16608. @table @option
  16609. @item stats_file, f
  16610. If specified the filter will use the named file to save the SSIM of
  16611. each individual frame. When filename equals "-" the data is sent to
  16612. standard output.
  16613. @end table
  16614. The file printed if @var{stats_file} is selected, contains a sequence of
  16615. key/value pairs of the form @var{key}:@var{value} for each compared
  16616. couple of frames.
  16617. A description of each shown parameter follows:
  16618. @table @option
  16619. @item n
  16620. sequential number of the input frame, starting from 1
  16621. @item Y, U, V, R, G, B
  16622. SSIM of the compared frames for the component specified by the suffix.
  16623. @item All
  16624. SSIM of the compared frames for the whole frame.
  16625. @item dB
  16626. Same as above but in dB representation.
  16627. @end table
  16628. This filter also supports the @ref{framesync} options.
  16629. @subsection Examples
  16630. @itemize
  16631. @item
  16632. For example:
  16633. @example
  16634. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  16635. [main][ref] ssim="stats_file=stats.log" [out]
  16636. @end example
  16637. On this example the input file being processed is compared with the
  16638. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  16639. is stored in @file{stats.log}.
  16640. @item
  16641. Another example with both psnr and ssim at same time:
  16642. @example
  16643. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  16644. @end example
  16645. @item
  16646. Another example with different containers:
  16647. @example
  16648. ffmpeg -i main.mpg -i ref.mkv -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=AVTB,setpts=PTS-STARTPTS[ref];[main][ref]ssim" -f null -
  16649. @end example
  16650. @end itemize
  16651. @section stereo3d
  16652. Convert between different stereoscopic image formats.
  16653. The filters accept the following options:
  16654. @table @option
  16655. @item in
  16656. Set stereoscopic image format of input.
  16657. Available values for input image formats are:
  16658. @table @samp
  16659. @item sbsl
  16660. side by side parallel (left eye left, right eye right)
  16661. @item sbsr
  16662. side by side crosseye (right eye left, left eye right)
  16663. @item sbs2l
  16664. side by side parallel with half width resolution
  16665. (left eye left, right eye right)
  16666. @item sbs2r
  16667. side by side crosseye with half width resolution
  16668. (right eye left, left eye right)
  16669. @item abl
  16670. @item tbl
  16671. above-below (left eye above, right eye below)
  16672. @item abr
  16673. @item tbr
  16674. above-below (right eye above, left eye below)
  16675. @item ab2l
  16676. @item tb2l
  16677. above-below with half height resolution
  16678. (left eye above, right eye below)
  16679. @item ab2r
  16680. @item tb2r
  16681. above-below with half height resolution
  16682. (right eye above, left eye below)
  16683. @item al
  16684. alternating frames (left eye first, right eye second)
  16685. @item ar
  16686. alternating frames (right eye first, left eye second)
  16687. @item irl
  16688. interleaved rows (left eye has top row, right eye starts on next row)
  16689. @item irr
  16690. interleaved rows (right eye has top row, left eye starts on next row)
  16691. @item icl
  16692. interleaved columns, left eye first
  16693. @item icr
  16694. interleaved columns, right eye first
  16695. Default value is @samp{sbsl}.
  16696. @end table
  16697. @item out
  16698. Set stereoscopic image format of output.
  16699. @table @samp
  16700. @item sbsl
  16701. side by side parallel (left eye left, right eye right)
  16702. @item sbsr
  16703. side by side crosseye (right eye left, left eye right)
  16704. @item sbs2l
  16705. side by side parallel with half width resolution
  16706. (left eye left, right eye right)
  16707. @item sbs2r
  16708. side by side crosseye with half width resolution
  16709. (right eye left, left eye right)
  16710. @item abl
  16711. @item tbl
  16712. above-below (left eye above, right eye below)
  16713. @item abr
  16714. @item tbr
  16715. above-below (right eye above, left eye below)
  16716. @item ab2l
  16717. @item tb2l
  16718. above-below with half height resolution
  16719. (left eye above, right eye below)
  16720. @item ab2r
  16721. @item tb2r
  16722. above-below with half height resolution
  16723. (right eye above, left eye below)
  16724. @item al
  16725. alternating frames (left eye first, right eye second)
  16726. @item ar
  16727. alternating frames (right eye first, left eye second)
  16728. @item irl
  16729. interleaved rows (left eye has top row, right eye starts on next row)
  16730. @item irr
  16731. interleaved rows (right eye has top row, left eye starts on next row)
  16732. @item arbg
  16733. anaglyph red/blue gray
  16734. (red filter on left eye, blue filter on right eye)
  16735. @item argg
  16736. anaglyph red/green gray
  16737. (red filter on left eye, green filter on right eye)
  16738. @item arcg
  16739. anaglyph red/cyan gray
  16740. (red filter on left eye, cyan filter on right eye)
  16741. @item arch
  16742. anaglyph red/cyan half colored
  16743. (red filter on left eye, cyan filter on right eye)
  16744. @item arcc
  16745. anaglyph red/cyan color
  16746. (red filter on left eye, cyan filter on right eye)
  16747. @item arcd
  16748. anaglyph red/cyan color optimized with the least squares projection of dubois
  16749. (red filter on left eye, cyan filter on right eye)
  16750. @item agmg
  16751. anaglyph green/magenta gray
  16752. (green filter on left eye, magenta filter on right eye)
  16753. @item agmh
  16754. anaglyph green/magenta half colored
  16755. (green filter on left eye, magenta filter on right eye)
  16756. @item agmc
  16757. anaglyph green/magenta colored
  16758. (green filter on left eye, magenta filter on right eye)
  16759. @item agmd
  16760. anaglyph green/magenta color optimized with the least squares projection of dubois
  16761. (green filter on left eye, magenta filter on right eye)
  16762. @item aybg
  16763. anaglyph yellow/blue gray
  16764. (yellow filter on left eye, blue filter on right eye)
  16765. @item aybh
  16766. anaglyph yellow/blue half colored
  16767. (yellow filter on left eye, blue filter on right eye)
  16768. @item aybc
  16769. anaglyph yellow/blue colored
  16770. (yellow filter on left eye, blue filter on right eye)
  16771. @item aybd
  16772. anaglyph yellow/blue color optimized with the least squares projection of dubois
  16773. (yellow filter on left eye, blue filter on right eye)
  16774. @item ml
  16775. mono output (left eye only)
  16776. @item mr
  16777. mono output (right eye only)
  16778. @item chl
  16779. checkerboard, left eye first
  16780. @item chr
  16781. checkerboard, right eye first
  16782. @item icl
  16783. interleaved columns, left eye first
  16784. @item icr
  16785. interleaved columns, right eye first
  16786. @item hdmi
  16787. HDMI frame pack
  16788. @end table
  16789. Default value is @samp{arcd}.
  16790. @end table
  16791. @subsection Examples
  16792. @itemize
  16793. @item
  16794. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  16795. @example
  16796. stereo3d=sbsl:aybd
  16797. @end example
  16798. @item
  16799. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  16800. @example
  16801. stereo3d=abl:sbsr
  16802. @end example
  16803. @end itemize
  16804. @section streamselect, astreamselect
  16805. Select video or audio streams.
  16806. The filter accepts the following options:
  16807. @table @option
  16808. @item inputs
  16809. Set number of inputs. Default is 2.
  16810. @item map
  16811. Set input indexes to remap to outputs.
  16812. @end table
  16813. @subsection Commands
  16814. The @code{streamselect} and @code{astreamselect} filter supports the following
  16815. commands:
  16816. @table @option
  16817. @item map
  16818. Set input indexes to remap to outputs.
  16819. @end table
  16820. @subsection Examples
  16821. @itemize
  16822. @item
  16823. Select first 5 seconds 1st stream and rest of time 2nd stream:
  16824. @example
  16825. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  16826. @end example
  16827. @item
  16828. Same as above, but for audio:
  16829. @example
  16830. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  16831. @end example
  16832. @end itemize
  16833. @anchor{subtitles}
  16834. @section subtitles
  16835. Draw subtitles on top of input video using the libass library.
  16836. To enable compilation of this filter you need to configure FFmpeg with
  16837. @code{--enable-libass}. This filter also requires a build with libavcodec and
  16838. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  16839. Alpha) subtitles format.
  16840. The filter accepts the following options:
  16841. @table @option
  16842. @item filename, f
  16843. Set the filename of the subtitle file to read. It must be specified.
  16844. @item original_size
  16845. Specify the size of the original video, the video for which the ASS file
  16846. was composed. For the syntax of this option, check the
  16847. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16848. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  16849. correctly scale the fonts if the aspect ratio has been changed.
  16850. @item fontsdir
  16851. Set a directory path containing fonts that can be used by the filter.
  16852. These fonts will be used in addition to whatever the font provider uses.
  16853. @item alpha
  16854. Process alpha channel, by default alpha channel is untouched.
  16855. @item charenc
  16856. Set subtitles input character encoding. @code{subtitles} filter only. Only
  16857. useful if not UTF-8.
  16858. @item stream_index, si
  16859. Set subtitles stream index. @code{subtitles} filter only.
  16860. @item force_style
  16861. Override default style or script info parameters of the subtitles. It accepts a
  16862. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  16863. @end table
  16864. If the first key is not specified, it is assumed that the first value
  16865. specifies the @option{filename}.
  16866. For example, to render the file @file{sub.srt} on top of the input
  16867. video, use the command:
  16868. @example
  16869. subtitles=sub.srt
  16870. @end example
  16871. which is equivalent to:
  16872. @example
  16873. subtitles=filename=sub.srt
  16874. @end example
  16875. To render the default subtitles stream from file @file{video.mkv}, use:
  16876. @example
  16877. subtitles=video.mkv
  16878. @end example
  16879. To render the second subtitles stream from that file, use:
  16880. @example
  16881. subtitles=video.mkv:si=1
  16882. @end example
  16883. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  16884. @code{DejaVu Serif}, use:
  16885. @example
  16886. subtitles=sub.srt:force_style='Fontname=DejaVu Serif,PrimaryColour=&HCCFF0000'
  16887. @end example
  16888. @section super2xsai
  16889. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  16890. Interpolate) pixel art scaling algorithm.
  16891. Useful for enlarging pixel art images without reducing sharpness.
  16892. @section swaprect
  16893. Swap two rectangular objects in video.
  16894. This filter accepts the following options:
  16895. @table @option
  16896. @item w
  16897. Set object width.
  16898. @item h
  16899. Set object height.
  16900. @item x1
  16901. Set 1st rect x coordinate.
  16902. @item y1
  16903. Set 1st rect y coordinate.
  16904. @item x2
  16905. Set 2nd rect x coordinate.
  16906. @item y2
  16907. Set 2nd rect y coordinate.
  16908. All expressions are evaluated once for each frame.
  16909. @end table
  16910. The all options are expressions containing the following constants:
  16911. @table @option
  16912. @item w
  16913. @item h
  16914. The input width and height.
  16915. @item a
  16916. same as @var{w} / @var{h}
  16917. @item sar
  16918. input sample aspect ratio
  16919. @item dar
  16920. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  16921. @item n
  16922. The number of the input frame, starting from 0.
  16923. @item t
  16924. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  16925. @item pos
  16926. the position in the file of the input frame, NAN if unknown
  16927. @end table
  16928. @subsection Commands
  16929. This filter supports the all above options as @ref{commands}.
  16930. @section swapuv
  16931. Swap U & V plane.
  16932. @section tblend
  16933. Blend successive video frames.
  16934. See @ref{blend}
  16935. @section telecine
  16936. Apply telecine process to the video.
  16937. This filter accepts the following options:
  16938. @table @option
  16939. @item first_field
  16940. @table @samp
  16941. @item top, t
  16942. top field first
  16943. @item bottom, b
  16944. bottom field first
  16945. The default value is @code{top}.
  16946. @end table
  16947. @item pattern
  16948. A string of numbers representing the pulldown pattern you wish to apply.
  16949. The default value is @code{23}.
  16950. @end table
  16951. @example
  16952. Some typical patterns:
  16953. NTSC output (30i):
  16954. 27.5p: 32222
  16955. 24p: 23 (classic)
  16956. 24p: 2332 (preferred)
  16957. 20p: 33
  16958. 18p: 334
  16959. 16p: 3444
  16960. PAL output (25i):
  16961. 27.5p: 12222
  16962. 24p: 222222222223 ("Euro pulldown")
  16963. 16.67p: 33
  16964. 16p: 33333334
  16965. @end example
  16966. @section thistogram
  16967. Compute and draw a color distribution histogram for the input video across time.
  16968. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  16969. at certain time, this filter shows also past histograms of number of frames defined
  16970. by @code{width} option.
  16971. The computed histogram is a representation of the color component
  16972. distribution in an image.
  16973. The filter accepts the following options:
  16974. @table @option
  16975. @item width, w
  16976. Set width of single color component output. Default value is @code{0}.
  16977. Value of @code{0} means width will be picked from input video.
  16978. This also set number of passed histograms to keep.
  16979. Allowed range is [0, 8192].
  16980. @item display_mode, d
  16981. Set display mode.
  16982. It accepts the following values:
  16983. @table @samp
  16984. @item stack
  16985. Per color component graphs are placed below each other.
  16986. @item parade
  16987. Per color component graphs are placed side by side.
  16988. @item overlay
  16989. Presents information identical to that in the @code{parade}, except
  16990. that the graphs representing color components are superimposed directly
  16991. over one another.
  16992. @end table
  16993. Default is @code{stack}.
  16994. @item levels_mode, m
  16995. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  16996. Default is @code{linear}.
  16997. @item components, c
  16998. Set what color components to display.
  16999. Default is @code{7}.
  17000. @item bgopacity, b
  17001. Set background opacity. Default is @code{0.9}.
  17002. @item envelope, e
  17003. Show envelope. Default is disabled.
  17004. @item ecolor, ec
  17005. Set envelope color. Default is @code{gold}.
  17006. @item slide
  17007. Set slide mode.
  17008. Available values for slide is:
  17009. @table @samp
  17010. @item frame
  17011. Draw new frame when right border is reached.
  17012. @item replace
  17013. Replace old columns with new ones.
  17014. @item scroll
  17015. Scroll from right to left.
  17016. @item rscroll
  17017. Scroll from left to right.
  17018. @item picture
  17019. Draw single picture.
  17020. @end table
  17021. Default is @code{replace}.
  17022. @end table
  17023. @section threshold
  17024. Apply threshold effect to video stream.
  17025. This filter needs four video streams to perform thresholding.
  17026. First stream is stream we are filtering.
  17027. Second stream is holding threshold values, third stream is holding min values,
  17028. and last, fourth stream is holding max values.
  17029. The filter accepts the following option:
  17030. @table @option
  17031. @item planes
  17032. Set which planes will be processed, unprocessed planes will be copied.
  17033. By default value 0xf, all planes will be processed.
  17034. @end table
  17035. For example if first stream pixel's component value is less then threshold value
  17036. of pixel component from 2nd threshold stream, third stream value will picked,
  17037. otherwise fourth stream pixel component value will be picked.
  17038. Using color source filter one can perform various types of thresholding:
  17039. @subsection Commands
  17040. This filter supports the all options as @ref{commands}.
  17041. @subsection Examples
  17042. @itemize
  17043. @item
  17044. Binary threshold, using gray color as threshold:
  17045. @example
  17046. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  17047. @end example
  17048. @item
  17049. Inverted binary threshold, using gray color as threshold:
  17050. @example
  17051. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  17052. @end example
  17053. @item
  17054. Truncate binary threshold, using gray color as threshold:
  17055. @example
  17056. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  17057. @end example
  17058. @item
  17059. Threshold to zero, using gray color as threshold:
  17060. @example
  17061. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  17062. @end example
  17063. @item
  17064. Inverted threshold to zero, using gray color as threshold:
  17065. @example
  17066. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  17067. @end example
  17068. @end itemize
  17069. @section thumbnail
  17070. Select the most representative frame in a given sequence of consecutive frames.
  17071. The filter accepts the following options:
  17072. @table @option
  17073. @item n
  17074. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  17075. will pick one of them, and then handle the next batch of @var{n} frames until
  17076. the end. Default is @code{100}.
  17077. @item log
  17078. Set the log level to display picked frame stats.
  17079. Default is @code{info}.
  17080. @end table
  17081. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  17082. value will result in a higher memory usage, so a high value is not recommended.
  17083. @subsection Examples
  17084. @itemize
  17085. @item
  17086. Extract one picture each 50 frames:
  17087. @example
  17088. thumbnail=50
  17089. @end example
  17090. @item
  17091. Complete example of a thumbnail creation with @command{ffmpeg}:
  17092. @example
  17093. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  17094. @end example
  17095. @end itemize
  17096. @anchor{tile}
  17097. @section tile
  17098. Tile several successive frames together.
  17099. The @ref{untile} filter can do the reverse.
  17100. The filter accepts the following options:
  17101. @table @option
  17102. @item layout
  17103. Set the grid size in the form @code{COLUMNSxROWS}. Range is upto UINT_MAX cells.
  17104. Default is @code{6x5}.
  17105. @item nb_frames
  17106. Set the maximum number of frames to render in the given area. It must be less
  17107. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  17108. the area will be used.
  17109. @item margin
  17110. Set the outer border margin in pixels. Range is 0 to 1024. Default is @code{0}.
  17111. @item padding
  17112. Set the inner border thickness (i.e. the number of pixels between frames). For
  17113. more advanced padding options (such as having different values for the edges),
  17114. refer to the pad video filter. Range is 0 to 1024. Default is @code{0}.
  17115. @item color
  17116. Specify the color of the unused area. For the syntax of this option, check the
  17117. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17118. The default value of @var{color} is "black".
  17119. @item overlap
  17120. Set the number of frames to overlap when tiling several successive frames together.
  17121. The value must be between @code{0} and @var{nb_frames - 1}. Default is @code{0}.
  17122. @item init_padding
  17123. Set the number of frames to initially be empty before displaying first output frame.
  17124. This controls how soon will one get first output frame.
  17125. The value must be between @code{0} and @var{nb_frames - 1}. Default is @code{0}.
  17126. @end table
  17127. @subsection Examples
  17128. @itemize
  17129. @item
  17130. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  17131. @example
  17132. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  17133. @end example
  17134. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  17135. duplicating each output frame to accommodate the originally detected frame
  17136. rate.
  17137. @item
  17138. Display @code{5} pictures in an area of @code{3x2} frames,
  17139. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  17140. mixed flat and named options:
  17141. @example
  17142. tile=3x2:nb_frames=5:padding=7:margin=2
  17143. @end example
  17144. @end itemize
  17145. @section tinterlace
  17146. Perform various types of temporal field interlacing.
  17147. Frames are counted starting from 1, so the first input frame is
  17148. considered odd.
  17149. The filter accepts the following options:
  17150. @table @option
  17151. @item mode
  17152. Specify the mode of the interlacing. This option can also be specified
  17153. as a value alone. See below for a list of values for this option.
  17154. Available values are:
  17155. @table @samp
  17156. @item merge, 0
  17157. Move odd frames into the upper field, even into the lower field,
  17158. generating a double height frame at half frame rate.
  17159. @example
  17160. ------> time
  17161. Input:
  17162. Frame 1 Frame 2 Frame 3 Frame 4
  17163. 11111 22222 33333 44444
  17164. 11111 22222 33333 44444
  17165. 11111 22222 33333 44444
  17166. 11111 22222 33333 44444
  17167. Output:
  17168. 11111 33333
  17169. 22222 44444
  17170. 11111 33333
  17171. 22222 44444
  17172. 11111 33333
  17173. 22222 44444
  17174. 11111 33333
  17175. 22222 44444
  17176. @end example
  17177. @item drop_even, 1
  17178. Only output odd frames, even frames are dropped, generating a frame with
  17179. unchanged height at half frame rate.
  17180. @example
  17181. ------> time
  17182. Input:
  17183. Frame 1 Frame 2 Frame 3 Frame 4
  17184. 11111 22222 33333 44444
  17185. 11111 22222 33333 44444
  17186. 11111 22222 33333 44444
  17187. 11111 22222 33333 44444
  17188. Output:
  17189. 11111 33333
  17190. 11111 33333
  17191. 11111 33333
  17192. 11111 33333
  17193. @end example
  17194. @item drop_odd, 2
  17195. Only output even frames, odd frames are dropped, generating a frame with
  17196. unchanged height at half frame rate.
  17197. @example
  17198. ------> time
  17199. Input:
  17200. Frame 1 Frame 2 Frame 3 Frame 4
  17201. 11111 22222 33333 44444
  17202. 11111 22222 33333 44444
  17203. 11111 22222 33333 44444
  17204. 11111 22222 33333 44444
  17205. Output:
  17206. 22222 44444
  17207. 22222 44444
  17208. 22222 44444
  17209. 22222 44444
  17210. @end example
  17211. @item pad, 3
  17212. Expand each frame to full height, but pad alternate lines with black,
  17213. generating a frame with double height at the same input frame rate.
  17214. @example
  17215. ------> time
  17216. Input:
  17217. Frame 1 Frame 2 Frame 3 Frame 4
  17218. 11111 22222 33333 44444
  17219. 11111 22222 33333 44444
  17220. 11111 22222 33333 44444
  17221. 11111 22222 33333 44444
  17222. Output:
  17223. 11111 ..... 33333 .....
  17224. ..... 22222 ..... 44444
  17225. 11111 ..... 33333 .....
  17226. ..... 22222 ..... 44444
  17227. 11111 ..... 33333 .....
  17228. ..... 22222 ..... 44444
  17229. 11111 ..... 33333 .....
  17230. ..... 22222 ..... 44444
  17231. @end example
  17232. @item interleave_top, 4
  17233. Interleave the upper field from odd frames with the lower field from
  17234. even frames, generating a frame with unchanged height at half frame rate.
  17235. @example
  17236. ------> time
  17237. Input:
  17238. Frame 1 Frame 2 Frame 3 Frame 4
  17239. 11111<- 22222 33333<- 44444
  17240. 11111 22222<- 33333 44444<-
  17241. 11111<- 22222 33333<- 44444
  17242. 11111 22222<- 33333 44444<-
  17243. Output:
  17244. 11111 33333
  17245. 22222 44444
  17246. 11111 33333
  17247. 22222 44444
  17248. @end example
  17249. @item interleave_bottom, 5
  17250. Interleave the lower field from odd frames with the upper field from
  17251. even frames, generating a frame with unchanged height at half frame rate.
  17252. @example
  17253. ------> time
  17254. Input:
  17255. Frame 1 Frame 2 Frame 3 Frame 4
  17256. 11111 22222<- 33333 44444<-
  17257. 11111<- 22222 33333<- 44444
  17258. 11111 22222<- 33333 44444<-
  17259. 11111<- 22222 33333<- 44444
  17260. Output:
  17261. 22222 44444
  17262. 11111 33333
  17263. 22222 44444
  17264. 11111 33333
  17265. @end example
  17266. @item interlacex2, 6
  17267. Double frame rate with unchanged height. Frames are inserted each
  17268. containing the second temporal field from the previous input frame and
  17269. the first temporal field from the next input frame. This mode relies on
  17270. the top_field_first flag. Useful for interlaced video displays with no
  17271. field synchronisation.
  17272. @example
  17273. ------> time
  17274. Input:
  17275. Frame 1 Frame 2 Frame 3 Frame 4
  17276. 11111 22222 33333 44444
  17277. 11111 22222 33333 44444
  17278. 11111 22222 33333 44444
  17279. 11111 22222 33333 44444
  17280. Output:
  17281. 11111 22222 22222 33333 33333 44444 44444
  17282. 11111 11111 22222 22222 33333 33333 44444
  17283. 11111 22222 22222 33333 33333 44444 44444
  17284. 11111 11111 22222 22222 33333 33333 44444
  17285. @end example
  17286. @item mergex2, 7
  17287. Move odd frames into the upper field, even into the lower field,
  17288. generating a double height frame at same frame rate.
  17289. @example
  17290. ------> time
  17291. Input:
  17292. Frame 1 Frame 2 Frame 3 Frame 4
  17293. 11111 22222 33333 44444
  17294. 11111 22222 33333 44444
  17295. 11111 22222 33333 44444
  17296. 11111 22222 33333 44444
  17297. Output:
  17298. 11111 33333 33333 55555
  17299. 22222 22222 44444 44444
  17300. 11111 33333 33333 55555
  17301. 22222 22222 44444 44444
  17302. 11111 33333 33333 55555
  17303. 22222 22222 44444 44444
  17304. 11111 33333 33333 55555
  17305. 22222 22222 44444 44444
  17306. @end example
  17307. @end table
  17308. Numeric values are deprecated but are accepted for backward
  17309. compatibility reasons.
  17310. Default mode is @code{merge}.
  17311. @item flags
  17312. Specify flags influencing the filter process.
  17313. Available value for @var{flags} is:
  17314. @table @option
  17315. @item low_pass_filter, vlpf
  17316. Enable linear vertical low-pass filtering in the filter.
  17317. Vertical low-pass filtering is required when creating an interlaced
  17318. destination from a progressive source which contains high-frequency
  17319. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  17320. patterning.
  17321. @item complex_filter, cvlpf
  17322. Enable complex vertical low-pass filtering.
  17323. This will slightly less reduce interlace 'twitter' and Moire
  17324. patterning but better retain detail and subjective sharpness impression.
  17325. @item bypass_il
  17326. Bypass already interlaced frames, only adjust the frame rate.
  17327. @end table
  17328. Vertical low-pass filtering and bypassing already interlaced frames can only be
  17329. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  17330. @end table
  17331. @section tmedian
  17332. Pick median pixels from several successive input video frames.
  17333. The filter accepts the following options:
  17334. @table @option
  17335. @item radius
  17336. Set radius of median filter.
  17337. Default is 1. Allowed range is from 1 to 127.
  17338. @item planes
  17339. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  17340. @item percentile
  17341. Set median percentile. Default value is @code{0.5}.
  17342. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  17343. minimum values, and @code{1} maximum values.
  17344. @end table
  17345. @subsection Commands
  17346. This filter supports all above options as @ref{commands}, excluding option @code{radius}.
  17347. @section tmidequalizer
  17348. Apply Temporal Midway Video Equalization effect.
  17349. Midway Video Equalization adjusts a sequence of video frames to have the same
  17350. histograms, while maintaining their dynamics as much as possible. It's
  17351. useful for e.g. matching exposures from a video frames sequence.
  17352. This filter accepts the following option:
  17353. @table @option
  17354. @item radius
  17355. Set filtering radius. Default is @code{5}. Allowed range is from 1 to 127.
  17356. @item sigma
  17357. Set filtering sigma. Default is @code{0.5}. This controls strength of filtering.
  17358. Setting this option to 0 effectively does nothing.
  17359. @item planes
  17360. Set which planes to process. Default is @code{15}, which is all available planes.
  17361. @end table
  17362. @section tmix
  17363. Mix successive video frames.
  17364. A description of the accepted options follows.
  17365. @table @option
  17366. @item frames
  17367. The number of successive frames to mix. If unspecified, it defaults to 3.
  17368. @item weights
  17369. Specify weight of each input video frame.
  17370. Each weight is separated by space. If number of weights is smaller than
  17371. number of @var{frames} last specified weight will be used for all remaining
  17372. unset weights.
  17373. @item scale
  17374. Specify scale, if it is set it will be multiplied with sum
  17375. of each weight multiplied with pixel values to give final destination
  17376. pixel value. By default @var{scale} is auto scaled to sum of weights.
  17377. @item planes
  17378. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  17379. @end table
  17380. @subsection Examples
  17381. @itemize
  17382. @item
  17383. Average 7 successive frames:
  17384. @example
  17385. tmix=frames=7:weights="1 1 1 1 1 1 1"
  17386. @end example
  17387. @item
  17388. Apply simple temporal convolution:
  17389. @example
  17390. tmix=frames=3:weights="-1 3 -1"
  17391. @end example
  17392. @item
  17393. Similar as above but only showing temporal differences:
  17394. @example
  17395. tmix=frames=3:weights="-1 2 -1":scale=1
  17396. @end example
  17397. @end itemize
  17398. @subsection Commands
  17399. This filter supports the following commands:
  17400. @table @option
  17401. @item weights
  17402. @item scale
  17403. @item planes
  17404. Syntax is same as option with same name.
  17405. @end table
  17406. @anchor{tonemap}
  17407. @section tonemap
  17408. Tone map colors from different dynamic ranges.
  17409. This filter expects data in single precision floating point, as it needs to
  17410. operate on (and can output) out-of-range values. Another filter, such as
  17411. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  17412. The tonemapping algorithms implemented only work on linear light, so input
  17413. data should be linearized beforehand (and possibly correctly tagged).
  17414. @example
  17415. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  17416. @end example
  17417. @subsection Options
  17418. The filter accepts the following options.
  17419. @table @option
  17420. @item tonemap
  17421. Set the tone map algorithm to use.
  17422. Possible values are:
  17423. @table @var
  17424. @item none
  17425. Do not apply any tone map, only desaturate overbright pixels.
  17426. @item clip
  17427. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  17428. in-range values, while distorting out-of-range values.
  17429. @item linear
  17430. Stretch the entire reference gamut to a linear multiple of the display.
  17431. @item gamma
  17432. Fit a logarithmic transfer between the tone curves.
  17433. @item reinhard
  17434. Preserve overall image brightness with a simple curve, using nonlinear
  17435. contrast, which results in flattening details and degrading color accuracy.
  17436. @item hable
  17437. Preserve both dark and bright details better than @var{reinhard}, at the cost
  17438. of slightly darkening everything. Use it when detail preservation is more
  17439. important than color and brightness accuracy.
  17440. @item mobius
  17441. Smoothly map out-of-range values, while retaining contrast and colors for
  17442. in-range material as much as possible. Use it when color accuracy is more
  17443. important than detail preservation.
  17444. @end table
  17445. Default is none.
  17446. @item param
  17447. Tune the tone mapping algorithm.
  17448. This affects the following algorithms:
  17449. @table @var
  17450. @item none
  17451. Ignored.
  17452. @item linear
  17453. Specifies the scale factor to use while stretching.
  17454. Default to 1.0.
  17455. @item gamma
  17456. Specifies the exponent of the function.
  17457. Default to 1.8.
  17458. @item clip
  17459. Specify an extra linear coefficient to multiply into the signal before clipping.
  17460. Default to 1.0.
  17461. @item reinhard
  17462. Specify the local contrast coefficient at the display peak.
  17463. Default to 0.5, which means that in-gamut values will be about half as bright
  17464. as when clipping.
  17465. @item hable
  17466. Ignored.
  17467. @item mobius
  17468. Specify the transition point from linear to mobius transform. Every value
  17469. below this point is guaranteed to be mapped 1:1. The higher the value, the
  17470. more accurate the result will be, at the cost of losing bright details.
  17471. Default to 0.3, which due to the steep initial slope still preserves in-range
  17472. colors fairly accurately.
  17473. @end table
  17474. @item desat
  17475. Apply desaturation for highlights that exceed this level of brightness. The
  17476. higher the parameter, the more color information will be preserved. This
  17477. setting helps prevent unnaturally blown-out colors for super-highlights, by
  17478. (smoothly) turning into white instead. This makes images feel more natural,
  17479. at the cost of reducing information about out-of-range colors.
  17480. The default of 2.0 is somewhat conservative and will mostly just apply to
  17481. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  17482. This option works only if the input frame has a supported color tag.
  17483. @item peak
  17484. Override signal/nominal/reference peak with this value. Useful when the
  17485. embedded peak information in display metadata is not reliable or when tone
  17486. mapping from a lower range to a higher range.
  17487. @end table
  17488. @section tpad
  17489. Temporarily pad video frames.
  17490. The filter accepts the following options:
  17491. @table @option
  17492. @item start
  17493. Specify number of delay frames before input video stream. Default is 0.
  17494. @item stop
  17495. Specify number of padding frames after input video stream.
  17496. Set to -1 to pad indefinitely. Default is 0.
  17497. @item start_mode
  17498. Set kind of frames added to beginning of stream.
  17499. Can be either @var{add} or @var{clone}.
  17500. With @var{add} frames of solid-color are added.
  17501. With @var{clone} frames are clones of first frame.
  17502. Default is @var{add}.
  17503. @item stop_mode
  17504. Set kind of frames added to end of stream.
  17505. Can be either @var{add} or @var{clone}.
  17506. With @var{add} frames of solid-color are added.
  17507. With @var{clone} frames are clones of last frame.
  17508. Default is @var{add}.
  17509. @item start_duration, stop_duration
  17510. Specify the duration of the start/stop delay. See
  17511. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17512. for the accepted syntax.
  17513. These options override @var{start} and @var{stop}. Default is 0.
  17514. @item color
  17515. Specify the color of the padded area. For the syntax of this option,
  17516. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  17517. manual,ffmpeg-utils}.
  17518. The default value of @var{color} is "black".
  17519. @end table
  17520. @anchor{transpose}
  17521. @section transpose
  17522. Transpose rows with columns in the input video and optionally flip it.
  17523. It accepts the following parameters:
  17524. @table @option
  17525. @item dir
  17526. Specify the transposition direction.
  17527. Can assume the following values:
  17528. @table @samp
  17529. @item 0, 4, cclock_flip
  17530. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  17531. @example
  17532. L.R L.l
  17533. . . -> . .
  17534. l.r R.r
  17535. @end example
  17536. @item 1, 5, clock
  17537. Rotate by 90 degrees clockwise, that is:
  17538. @example
  17539. L.R l.L
  17540. . . -> . .
  17541. l.r r.R
  17542. @end example
  17543. @item 2, 6, cclock
  17544. Rotate by 90 degrees counterclockwise, that is:
  17545. @example
  17546. L.R R.r
  17547. . . -> . .
  17548. l.r L.l
  17549. @end example
  17550. @item 3, 7, clock_flip
  17551. Rotate by 90 degrees clockwise and vertically flip, that is:
  17552. @example
  17553. L.R r.R
  17554. . . -> . .
  17555. l.r l.L
  17556. @end example
  17557. @end table
  17558. For values between 4-7, the transposition is only done if the input
  17559. video geometry is portrait and not landscape. These values are
  17560. deprecated, the @code{passthrough} option should be used instead.
  17561. Numerical values are deprecated, and should be dropped in favor of
  17562. symbolic constants.
  17563. @item passthrough
  17564. Do not apply the transposition if the input geometry matches the one
  17565. specified by the specified value. It accepts the following values:
  17566. @table @samp
  17567. @item none
  17568. Always apply transposition.
  17569. @item portrait
  17570. Preserve portrait geometry (when @var{height} >= @var{width}).
  17571. @item landscape
  17572. Preserve landscape geometry (when @var{width} >= @var{height}).
  17573. @end table
  17574. Default value is @code{none}.
  17575. @end table
  17576. For example to rotate by 90 degrees clockwise and preserve portrait
  17577. layout:
  17578. @example
  17579. transpose=dir=1:passthrough=portrait
  17580. @end example
  17581. The command above can also be specified as:
  17582. @example
  17583. transpose=1:portrait
  17584. @end example
  17585. @section transpose_npp
  17586. Transpose rows with columns in the input video and optionally flip it.
  17587. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  17588. It accepts the following parameters:
  17589. @table @option
  17590. @item dir
  17591. Specify the transposition direction.
  17592. Can assume the following values:
  17593. @table @samp
  17594. @item cclock_flip
  17595. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  17596. @item clock
  17597. Rotate by 90 degrees clockwise.
  17598. @item cclock
  17599. Rotate by 90 degrees counterclockwise.
  17600. @item clock_flip
  17601. Rotate by 90 degrees clockwise and vertically flip.
  17602. @end table
  17603. @item passthrough
  17604. Do not apply the transposition if the input geometry matches the one
  17605. specified by the specified value. It accepts the following values:
  17606. @table @samp
  17607. @item none
  17608. Always apply transposition. (default)
  17609. @item portrait
  17610. Preserve portrait geometry (when @var{height} >= @var{width}).
  17611. @item landscape
  17612. Preserve landscape geometry (when @var{width} >= @var{height}).
  17613. @end table
  17614. @end table
  17615. @section trim
  17616. Trim the input so that the output contains one continuous subpart of the input.
  17617. It accepts the following parameters:
  17618. @table @option
  17619. @item start
  17620. Specify the time of the start of the kept section, i.e. the frame with the
  17621. timestamp @var{start} will be the first frame in the output.
  17622. @item end
  17623. Specify the time of the first frame that will be dropped, i.e. the frame
  17624. immediately preceding the one with the timestamp @var{end} will be the last
  17625. frame in the output.
  17626. @item start_pts
  17627. This is the same as @var{start}, except this option sets the start timestamp
  17628. in timebase units instead of seconds.
  17629. @item end_pts
  17630. This is the same as @var{end}, except this option sets the end timestamp
  17631. in timebase units instead of seconds.
  17632. @item duration
  17633. The maximum duration of the output in seconds.
  17634. @item start_frame
  17635. The number of the first frame that should be passed to the output.
  17636. @item end_frame
  17637. The number of the first frame that should be dropped.
  17638. @end table
  17639. @option{start}, @option{end}, and @option{duration} are expressed as time
  17640. duration specifications; see
  17641. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17642. for the accepted syntax.
  17643. Note that the first two sets of the start/end options and the @option{duration}
  17644. option look at the frame timestamp, while the _frame variants simply count the
  17645. frames that pass through the filter. Also note that this filter does not modify
  17646. the timestamps. If you wish for the output timestamps to start at zero, insert a
  17647. setpts filter after the trim filter.
  17648. If multiple start or end options are set, this filter tries to be greedy and
  17649. keep all the frames that match at least one of the specified constraints. To keep
  17650. only the part that matches all the constraints at once, chain multiple trim
  17651. filters.
  17652. The defaults are such that all the input is kept. So it is possible to set e.g.
  17653. just the end values to keep everything before the specified time.
  17654. Examples:
  17655. @itemize
  17656. @item
  17657. Drop everything except the second minute of input:
  17658. @example
  17659. ffmpeg -i INPUT -vf trim=60:120
  17660. @end example
  17661. @item
  17662. Keep only the first second:
  17663. @example
  17664. ffmpeg -i INPUT -vf trim=duration=1
  17665. @end example
  17666. @end itemize
  17667. @section unpremultiply
  17668. Apply alpha unpremultiply effect to input video stream using first plane
  17669. of second stream as alpha.
  17670. Both streams must have same dimensions and same pixel format.
  17671. The filter accepts the following option:
  17672. @table @option
  17673. @item planes
  17674. Set which planes will be processed, unprocessed planes will be copied.
  17675. By default value 0xf, all planes will be processed.
  17676. If the format has 1 or 2 components, then luma is bit 0.
  17677. If the format has 3 or 4 components:
  17678. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  17679. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  17680. If present, the alpha channel is always the last bit.
  17681. @item inplace
  17682. Do not require 2nd input for processing, instead use alpha plane from input stream.
  17683. @end table
  17684. @anchor{unsharp}
  17685. @section unsharp
  17686. Sharpen or blur the input video.
  17687. It accepts the following parameters:
  17688. @table @option
  17689. @item luma_msize_x, lx
  17690. Set the luma matrix horizontal size. It must be an odd integer between
  17691. 3 and 23. The default value is 5.
  17692. @item luma_msize_y, ly
  17693. Set the luma matrix vertical size. It must be an odd integer between 3
  17694. and 23. The default value is 5.
  17695. @item luma_amount, la
  17696. Set the luma effect strength. It must be a floating point number, reasonable
  17697. values lay between -1.5 and 1.5.
  17698. Negative values will blur the input video, while positive values will
  17699. sharpen it, a value of zero will disable the effect.
  17700. Default value is 1.0.
  17701. @item chroma_msize_x, cx
  17702. Set the chroma matrix horizontal size. It must be an odd integer
  17703. between 3 and 23. The default value is 5.
  17704. @item chroma_msize_y, cy
  17705. Set the chroma matrix vertical size. It must be an odd integer
  17706. between 3 and 23. The default value is 5.
  17707. @item chroma_amount, ca
  17708. Set the chroma effect strength. It must be a floating point number, reasonable
  17709. values lay between -1.5 and 1.5.
  17710. Negative values will blur the input video, while positive values will
  17711. sharpen it, a value of zero will disable the effect.
  17712. Default value is 0.0.
  17713. @item alpha_msize_x, ax
  17714. Set the alpha matrix horizontal size. It must be an odd integer
  17715. between 3 and 23. The default value is 5.
  17716. @item alpha_msize_y, ay
  17717. Set the alpha matrix vertical size. It must be an odd integer
  17718. between 3 and 23. The default value is 5.
  17719. @item alpha_amount, aa
  17720. Set the alpha effect strength. It must be a floating point number, reasonable
  17721. values lay between -1.5 and 1.5.
  17722. Negative values will blur the input video, while positive values will
  17723. sharpen it, a value of zero will disable the effect.
  17724. Default value is 0.0.
  17725. @end table
  17726. All parameters are optional and default to the equivalent of the
  17727. string '5:5:1.0:5:5:0.0'.
  17728. @subsection Examples
  17729. @itemize
  17730. @item
  17731. Apply strong luma sharpen effect:
  17732. @example
  17733. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  17734. @end example
  17735. @item
  17736. Apply a strong blur of both luma and chroma parameters:
  17737. @example
  17738. unsharp=7:7:-2:7:7:-2
  17739. @end example
  17740. @end itemize
  17741. @anchor{untile}
  17742. @section untile
  17743. Decompose a video made of tiled images into the individual images.
  17744. The frame rate of the output video is the frame rate of the input video
  17745. multiplied by the number of tiles.
  17746. This filter does the reverse of @ref{tile}.
  17747. The filter accepts the following options:
  17748. @table @option
  17749. @item layout
  17750. Set the grid size (i.e. the number of lines and columns). For the syntax of
  17751. this option, check the
  17752. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17753. @end table
  17754. @subsection Examples
  17755. @itemize
  17756. @item
  17757. Produce a 1-second video from a still image file made of 25 frames stacked
  17758. vertically, like an analogic film reel:
  17759. @example
  17760. ffmpeg -r 1 -i image.jpg -vf untile=1x25 movie.mkv
  17761. @end example
  17762. @end itemize
  17763. @section uspp
  17764. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  17765. the image at several (or - in the case of @option{quality} level @code{8} - all)
  17766. shifts and average the results.
  17767. The way this differs from the behavior of spp is that uspp actually encodes &
  17768. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  17769. DCT similar to MJPEG.
  17770. This filter is only available in ffmpeg version 4.4 or earlier.
  17771. The filter accepts the following options:
  17772. @table @option
  17773. @item quality
  17774. Set quality. This option defines the number of levels for averaging. It accepts
  17775. an integer in the range 0-8. If set to @code{0}, the filter will have no
  17776. effect. A value of @code{8} means the higher quality. For each increment of
  17777. that value the speed drops by a factor of approximately 2. Default value is
  17778. @code{3}.
  17779. @item qp
  17780. Force a constant quantization parameter. If not set, the filter will use the QP
  17781. from the video stream (if available).
  17782. @end table
  17783. @section v360
  17784. Convert 360 videos between various formats.
  17785. The filter accepts the following options:
  17786. @table @option
  17787. @item input
  17788. @item output
  17789. Set format of the input/output video.
  17790. Available formats:
  17791. @table @samp
  17792. @item e
  17793. @item equirect
  17794. Equirectangular projection.
  17795. @item c3x2
  17796. @item c6x1
  17797. @item c1x6
  17798. Cubemap with 3x2/6x1/1x6 layout.
  17799. Format specific options:
  17800. @table @option
  17801. @item in_pad
  17802. @item out_pad
  17803. Set padding proportion for the input/output cubemap. Values in decimals.
  17804. Example values:
  17805. @table @samp
  17806. @item 0
  17807. No padding.
  17808. @item 0.01
  17809. 1% of face is padding. For example, with 1920x1280 resolution face size would be 640x640 and padding would be 3 pixels from each side. (640 * 0.01 = 6 pixels)
  17810. @end table
  17811. Default value is @b{@samp{0}}.
  17812. Maximum value is @b{@samp{0.1}}.
  17813. @item fin_pad
  17814. @item fout_pad
  17815. Set fixed padding for the input/output cubemap. Values in pixels.
  17816. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  17817. @item in_forder
  17818. @item out_forder
  17819. Set order of faces for the input/output cubemap. Choose one direction for each position.
  17820. Designation of directions:
  17821. @table @samp
  17822. @item r
  17823. right
  17824. @item l
  17825. left
  17826. @item u
  17827. up
  17828. @item d
  17829. down
  17830. @item f
  17831. forward
  17832. @item b
  17833. back
  17834. @end table
  17835. Default value is @b{@samp{rludfb}}.
  17836. @item in_frot
  17837. @item out_frot
  17838. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  17839. Designation of angles:
  17840. @table @samp
  17841. @item 0
  17842. 0 degrees clockwise
  17843. @item 1
  17844. 90 degrees clockwise
  17845. @item 2
  17846. 180 degrees clockwise
  17847. @item 3
  17848. 270 degrees clockwise
  17849. @end table
  17850. Default value is @b{@samp{000000}}.
  17851. @end table
  17852. @item eac
  17853. Equi-Angular Cubemap.
  17854. @item flat
  17855. @item gnomonic
  17856. @item rectilinear
  17857. Regular video.
  17858. Format specific options:
  17859. @table @option
  17860. @item h_fov
  17861. @item v_fov
  17862. @item d_fov
  17863. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17864. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17865. @item ih_fov
  17866. @item iv_fov
  17867. @item id_fov
  17868. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17869. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17870. @end table
  17871. @item dfisheye
  17872. Dual fisheye.
  17873. Format specific options:
  17874. @table @option
  17875. @item h_fov
  17876. @item v_fov
  17877. @item d_fov
  17878. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17879. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17880. @item ih_fov
  17881. @item iv_fov
  17882. @item id_fov
  17883. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17884. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17885. @end table
  17886. @item barrel
  17887. @item fb
  17888. @item barrelsplit
  17889. Facebook's 360 formats.
  17890. @item sg
  17891. Stereographic format.
  17892. Format specific options:
  17893. @table @option
  17894. @item h_fov
  17895. @item v_fov
  17896. @item d_fov
  17897. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17898. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17899. @item ih_fov
  17900. @item iv_fov
  17901. @item id_fov
  17902. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17903. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17904. @end table
  17905. @item mercator
  17906. Mercator format.
  17907. @item ball
  17908. Ball format, gives significant distortion toward the back.
  17909. @item hammer
  17910. Hammer-Aitoff map projection format.
  17911. @item sinusoidal
  17912. Sinusoidal map projection format.
  17913. @item fisheye
  17914. Fisheye projection.
  17915. Format specific options:
  17916. @table @option
  17917. @item h_fov
  17918. @item v_fov
  17919. @item d_fov
  17920. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17921. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17922. @item ih_fov
  17923. @item iv_fov
  17924. @item id_fov
  17925. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17926. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17927. @end table
  17928. @item pannini
  17929. Pannini projection.
  17930. Format specific options:
  17931. @table @option
  17932. @item h_fov
  17933. Set output pannini parameter.
  17934. @item ih_fov
  17935. Set input pannini parameter.
  17936. @end table
  17937. @item cylindrical
  17938. Cylindrical projection.
  17939. Format specific options:
  17940. @table @option
  17941. @item h_fov
  17942. @item v_fov
  17943. @item d_fov
  17944. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17945. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17946. @item ih_fov
  17947. @item iv_fov
  17948. @item id_fov
  17949. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17950. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17951. @end table
  17952. @item perspective
  17953. Perspective projection. @i{(output only)}
  17954. Format specific options:
  17955. @table @option
  17956. @item v_fov
  17957. Set perspective parameter.
  17958. @end table
  17959. @item tetrahedron
  17960. Tetrahedron projection.
  17961. @item tsp
  17962. Truncated square pyramid projection.
  17963. @item he
  17964. @item hequirect
  17965. Half equirectangular projection.
  17966. @item equisolid
  17967. Equisolid format.
  17968. Format specific options:
  17969. @table @option
  17970. @item h_fov
  17971. @item v_fov
  17972. @item d_fov
  17973. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17974. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17975. @item ih_fov
  17976. @item iv_fov
  17977. @item id_fov
  17978. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17979. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17980. @end table
  17981. @item og
  17982. Orthographic format.
  17983. Format specific options:
  17984. @table @option
  17985. @item h_fov
  17986. @item v_fov
  17987. @item d_fov
  17988. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17989. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17990. @item ih_fov
  17991. @item iv_fov
  17992. @item id_fov
  17993. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17994. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17995. @end table
  17996. @item octahedron
  17997. Octahedron projection.
  17998. @item cylindricalea
  17999. Cylindrical Equal Area projection.
  18000. @end table
  18001. @item interp
  18002. Set interpolation method.@*
  18003. @i{Note: more complex interpolation methods require much more memory to run.}
  18004. Available methods:
  18005. @table @samp
  18006. @item near
  18007. @item nearest
  18008. Nearest neighbour.
  18009. @item line
  18010. @item linear
  18011. Bilinear interpolation.
  18012. @item lagrange9
  18013. Lagrange9 interpolation.
  18014. @item cube
  18015. @item cubic
  18016. Bicubic interpolation.
  18017. @item lanc
  18018. @item lanczos
  18019. Lanczos interpolation.
  18020. @item sp16
  18021. @item spline16
  18022. Spline16 interpolation.
  18023. @item gauss
  18024. @item gaussian
  18025. Gaussian interpolation.
  18026. @item mitchell
  18027. Mitchell interpolation.
  18028. @end table
  18029. Default value is @b{@samp{line}}.
  18030. @item w
  18031. @item h
  18032. Set the output video resolution.
  18033. Default resolution depends on formats.
  18034. @item in_stereo
  18035. @item out_stereo
  18036. Set the input/output stereo format.
  18037. @table @samp
  18038. @item 2d
  18039. 2D mono
  18040. @item sbs
  18041. Side by side
  18042. @item tb
  18043. Top bottom
  18044. @end table
  18045. Default value is @b{@samp{2d}} for input and output format.
  18046. @item yaw
  18047. @item pitch
  18048. @item roll
  18049. Set rotation for the output video. Values in degrees.
  18050. @item rorder
  18051. Set rotation order for the output video. Choose one item for each position.
  18052. @table @samp
  18053. @item y, Y
  18054. yaw
  18055. @item p, P
  18056. pitch
  18057. @item r, R
  18058. roll
  18059. @end table
  18060. Default value is @b{@samp{ypr}}.
  18061. @item h_flip
  18062. @item v_flip
  18063. @item d_flip
  18064. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  18065. @item ih_flip
  18066. @item iv_flip
  18067. Set if input video is flipped horizontally/vertically. Boolean values.
  18068. @item in_trans
  18069. Set if input video is transposed. Boolean value, by default disabled.
  18070. @item out_trans
  18071. Set if output video needs to be transposed. Boolean value, by default disabled.
  18072. @item h_offset
  18073. @item v_offset
  18074. Set output horizontal/vertical off-axis offset. Default is set to 0.
  18075. Allowed range is from -1 to 1.
  18076. @item alpha_mask
  18077. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  18078. @item reset_rot
  18079. Reset rotation of output video. Boolean value, by default disabled.
  18080. @end table
  18081. @subsection Examples
  18082. @itemize
  18083. @item
  18084. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  18085. @example
  18086. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  18087. @end example
  18088. @item
  18089. Extract back view of Equi-Angular Cubemap:
  18090. @example
  18091. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  18092. @end example
  18093. @item
  18094. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  18095. @example
  18096. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  18097. @end example
  18098. @end itemize
  18099. @subsection Commands
  18100. This filter supports subset of above options as @ref{commands}.
  18101. @section vaguedenoiser
  18102. Apply a wavelet based denoiser.
  18103. It transforms each frame from the video input into the wavelet domain,
  18104. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  18105. the obtained coefficients. It does an inverse wavelet transform after.
  18106. Due to wavelet properties, it should give a nice smoothed result, and
  18107. reduced noise, without blurring picture features.
  18108. This filter accepts the following options:
  18109. @table @option
  18110. @item threshold
  18111. The filtering strength. The higher, the more filtered the video will be.
  18112. Hard thresholding can use a higher threshold than soft thresholding
  18113. before the video looks overfiltered. Default value is 2.
  18114. @item method
  18115. The filtering method the filter will use.
  18116. It accepts the following values:
  18117. @table @samp
  18118. @item hard
  18119. All values under the threshold will be zeroed.
  18120. @item soft
  18121. All values under the threshold will be zeroed. All values above will be
  18122. reduced by the threshold.
  18123. @item garrote
  18124. Scales or nullifies coefficients - intermediary between (more) soft and
  18125. (less) hard thresholding.
  18126. @end table
  18127. Default is garrote.
  18128. @item nsteps
  18129. Number of times, the wavelet will decompose the picture. Picture can't
  18130. be decomposed beyond a particular point (typically, 8 for a 640x480
  18131. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  18132. @item percent
  18133. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  18134. @item planes
  18135. A list of the planes to process. By default all planes are processed.
  18136. @item type
  18137. The threshold type the filter will use.
  18138. It accepts the following values:
  18139. @table @samp
  18140. @item universal
  18141. Threshold used is same for all decompositions.
  18142. @item bayes
  18143. Threshold used depends also on each decomposition coefficients.
  18144. @end table
  18145. Default is universal.
  18146. @end table
  18147. @section varblur
  18148. Apply variable blur filter by using 2nd video stream to set blur radius.
  18149. The 2nd stream must have the same dimensions.
  18150. This filter accepts the following options:
  18151. @table @option
  18152. @item min_r
  18153. Set min allowed radius. Allowed range is from 0 to 254. Default is 0.
  18154. @item max_r
  18155. Set max allowed radius. Allowed range is from 1 to 255. Default is 8.
  18156. @item planes
  18157. Set which planes to process. By default, all are used.
  18158. @end table
  18159. The @code{varblur} filter also supports the @ref{framesync} options.
  18160. @subsection Commands
  18161. This filter supports all the above options as @ref{commands}.
  18162. @section vectorscope
  18163. Display 2 color component values in the two dimensional graph (which is called
  18164. a vectorscope).
  18165. This filter accepts the following options:
  18166. @table @option
  18167. @item mode, m
  18168. Set vectorscope mode.
  18169. It accepts the following values:
  18170. @table @samp
  18171. @item gray
  18172. @item tint
  18173. Gray values are displayed on graph, higher brightness means more pixels have
  18174. same component color value on location in graph. This is the default mode.
  18175. @item color
  18176. Gray values are displayed on graph. Surrounding pixels values which are not
  18177. present in video frame are drawn in gradient of 2 color components which are
  18178. set by option @code{x} and @code{y}. The 3rd color component is static.
  18179. @item color2
  18180. Actual color components values present in video frame are displayed on graph.
  18181. @item color3
  18182. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  18183. on graph increases value of another color component, which is luminance by
  18184. default values of @code{x} and @code{y}.
  18185. @item color4
  18186. Actual colors present in video frame are displayed on graph. If two different
  18187. colors map to same position on graph then color with higher value of component
  18188. not present in graph is picked.
  18189. @item color5
  18190. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  18191. component picked from radial gradient.
  18192. @end table
  18193. @item x
  18194. Set which color component will be represented on X-axis. Default is @code{1}.
  18195. @item y
  18196. Set which color component will be represented on Y-axis. Default is @code{2}.
  18197. @item intensity, i
  18198. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  18199. of color component which represents frequency of (X, Y) location in graph.
  18200. @item envelope, e
  18201. @table @samp
  18202. @item none
  18203. No envelope, this is default.
  18204. @item instant
  18205. Instant envelope, even darkest single pixel will be clearly highlighted.
  18206. @item peak
  18207. Hold maximum and minimum values presented in graph over time. This way you
  18208. can still spot out of range values without constantly looking at vectorscope.
  18209. @item peak+instant
  18210. Peak and instant envelope combined together.
  18211. @end table
  18212. @item graticule, g
  18213. Set what kind of graticule to draw.
  18214. @table @samp
  18215. @item none
  18216. @item green
  18217. @item color
  18218. @item invert
  18219. @end table
  18220. @item opacity, o
  18221. Set graticule opacity.
  18222. @item flags, f
  18223. Set graticule flags.
  18224. @table @samp
  18225. @item white
  18226. Draw graticule for white point.
  18227. @item black
  18228. Draw graticule for black point.
  18229. @item name
  18230. Draw color points short names.
  18231. @end table
  18232. @item bgopacity, b
  18233. Set background opacity.
  18234. @item lthreshold, l
  18235. Set low threshold for color component not represented on X or Y axis.
  18236. Values lower than this value will be ignored. Default is 0.
  18237. Note this value is multiplied with actual max possible value one pixel component
  18238. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  18239. is 0.1 * 255 = 25.
  18240. @item hthreshold, h
  18241. Set high threshold for color component not represented on X or Y axis.
  18242. Values higher than this value will be ignored. Default is 1.
  18243. Note this value is multiplied with actual max possible value one pixel component
  18244. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  18245. is 0.9 * 255 = 230.
  18246. @item colorspace, c
  18247. Set what kind of colorspace to use when drawing graticule.
  18248. @table @samp
  18249. @item auto
  18250. @item 601
  18251. @item 709
  18252. @end table
  18253. Default is auto.
  18254. @item tint0, t0
  18255. @item tint1, t1
  18256. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  18257. This means no tint, and output will remain gray.
  18258. @end table
  18259. @anchor{vidstabdetect}
  18260. @section vidstabdetect
  18261. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  18262. @ref{vidstabtransform} for pass 2.
  18263. This filter generates a file with relative translation and rotation
  18264. transform information about subsequent frames, which is then used by
  18265. the @ref{vidstabtransform} filter.
  18266. To enable compilation of this filter you need to configure FFmpeg with
  18267. @code{--enable-libvidstab}.
  18268. This filter accepts the following options:
  18269. @table @option
  18270. @item result
  18271. Set the path to the file used to write the transforms information.
  18272. Default value is @file{transforms.trf}.
  18273. @item shakiness
  18274. Set how shaky the video is and how quick the camera is. It accepts an
  18275. integer in the range 1-10, a value of 1 means little shakiness, a
  18276. value of 10 means strong shakiness. Default value is 5.
  18277. @item accuracy
  18278. Set the accuracy of the detection process. It must be a value in the
  18279. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  18280. accuracy. Default value is 15.
  18281. @item stepsize
  18282. Set stepsize of the search process. The region around minimum is
  18283. scanned with 1 pixel resolution. Default value is 6.
  18284. @item mincontrast
  18285. Set minimum contrast. Below this value a local measurement field is
  18286. discarded. Must be a floating point value in the range 0-1. Default
  18287. value is 0.3.
  18288. @item tripod
  18289. Set reference frame number for tripod mode.
  18290. If enabled, the motion of the frames is compared to a reference frame
  18291. in the filtered stream, identified by the specified number. The idea
  18292. is to compensate all movements in a more-or-less static scene and keep
  18293. the camera view absolutely still.
  18294. If set to 0, it is disabled. The frames are counted starting from 1.
  18295. @item show
  18296. Show fields and transforms in the resulting frames. It accepts an
  18297. integer in the range 0-2. Default value is 0, which disables any
  18298. visualization.
  18299. @end table
  18300. @subsection Examples
  18301. @itemize
  18302. @item
  18303. Use default values:
  18304. @example
  18305. vidstabdetect
  18306. @end example
  18307. @item
  18308. Analyze strongly shaky movie and put the results in file
  18309. @file{mytransforms.trf}:
  18310. @example
  18311. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  18312. @end example
  18313. @item
  18314. Visualize the result of internal transformations in the resulting
  18315. video:
  18316. @example
  18317. vidstabdetect=show=1
  18318. @end example
  18319. @item
  18320. Analyze a video with medium shakiness using @command{ffmpeg}:
  18321. @example
  18322. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  18323. @end example
  18324. @end itemize
  18325. @anchor{vidstabtransform}
  18326. @section vidstabtransform
  18327. Video stabilization/deshaking: pass 2 of 2,
  18328. see @ref{vidstabdetect} for pass 1.
  18329. Read a file with transform information for each frame and
  18330. apply/compensate them. Together with the @ref{vidstabdetect}
  18331. filter this can be used to deshake videos. See also
  18332. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  18333. the @ref{unsharp} filter, see below.
  18334. To enable compilation of this filter you need to configure FFmpeg with
  18335. @code{--enable-libvidstab}.
  18336. @subsection Options
  18337. @table @option
  18338. @item input
  18339. Set path to the file used to read the transforms. Default value is
  18340. @file{transforms.trf}.
  18341. @item smoothing
  18342. Set the number of frames (value*2 + 1) used for lowpass filtering the
  18343. camera movements. Default value is 10.
  18344. For example a number of 10 means that 21 frames are used (10 in the
  18345. past and 10 in the future) to smoothen the motion in the video. A
  18346. larger value leads to a smoother video, but limits the acceleration of
  18347. the camera (pan/tilt movements). 0 is a special case where a static
  18348. camera is simulated.
  18349. @item optalgo
  18350. Set the camera path optimization algorithm.
  18351. Accepted values are:
  18352. @table @samp
  18353. @item gauss
  18354. gaussian kernel low-pass filter on camera motion (default)
  18355. @item avg
  18356. averaging on transformations
  18357. @end table
  18358. @item maxshift
  18359. Set maximal number of pixels to translate frames. Default value is -1,
  18360. meaning no limit.
  18361. @item maxangle
  18362. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  18363. value is -1, meaning no limit.
  18364. @item crop
  18365. Specify how to deal with borders that may be visible due to movement
  18366. compensation.
  18367. Available values are:
  18368. @table @samp
  18369. @item keep
  18370. keep image information from previous frame (default)
  18371. @item black
  18372. fill the border black
  18373. @end table
  18374. @item invert
  18375. Invert transforms if set to 1. Default value is 0.
  18376. @item relative
  18377. Consider transforms as relative to previous frame if set to 1,
  18378. absolute if set to 0. Default value is 0.
  18379. @item zoom
  18380. Set percentage to zoom. A positive value will result in a zoom-in
  18381. effect, a negative value in a zoom-out effect. Default value is 0 (no
  18382. zoom).
  18383. @item optzoom
  18384. Set optimal zooming to avoid borders.
  18385. Accepted values are:
  18386. @table @samp
  18387. @item 0
  18388. disabled
  18389. @item 1
  18390. optimal static zoom value is determined (only very strong movements
  18391. will lead to visible borders) (default)
  18392. @item 2
  18393. optimal adaptive zoom value is determined (no borders will be
  18394. visible), see @option{zoomspeed}
  18395. @end table
  18396. Note that the value given at zoom is added to the one calculated here.
  18397. @item zoomspeed
  18398. Set percent to zoom maximally each frame (enabled when
  18399. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  18400. 0.25.
  18401. @item interpol
  18402. Specify type of interpolation.
  18403. Available values are:
  18404. @table @samp
  18405. @item no
  18406. no interpolation
  18407. @item linear
  18408. linear only horizontal
  18409. @item bilinear
  18410. linear in both directions (default)
  18411. @item bicubic
  18412. cubic in both directions (slow)
  18413. @end table
  18414. @item tripod
  18415. Enable virtual tripod mode if set to 1, which is equivalent to
  18416. @code{relative=0:smoothing=0}. Default value is 0.
  18417. Use also @code{tripod} option of @ref{vidstabdetect}.
  18418. @item debug
  18419. Increase log verbosity if set to 1. Also the detected global motions
  18420. are written to the temporary file @file{global_motions.trf}. Default
  18421. value is 0.
  18422. @end table
  18423. @subsection Examples
  18424. @itemize
  18425. @item
  18426. Use @command{ffmpeg} for a typical stabilization with default values:
  18427. @example
  18428. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  18429. @end example
  18430. Note the use of the @ref{unsharp} filter which is always recommended.
  18431. @item
  18432. Zoom in a bit more and load transform data from a given file:
  18433. @example
  18434. vidstabtransform=zoom=5:input="mytransforms.trf"
  18435. @end example
  18436. @item
  18437. Smoothen the video even more:
  18438. @example
  18439. vidstabtransform=smoothing=30
  18440. @end example
  18441. @end itemize
  18442. @section vflip
  18443. Flip the input video vertically.
  18444. For example, to vertically flip a video with @command{ffmpeg}:
  18445. @example
  18446. ffmpeg -i in.avi -vf "vflip" out.avi
  18447. @end example
  18448. @section vfrdet
  18449. Detect variable frame rate video.
  18450. This filter tries to detect if the input is variable or constant frame rate.
  18451. At end it will output number of frames detected as having variable delta pts,
  18452. and ones with constant delta pts.
  18453. If there was frames with variable delta, than it will also show min, max and
  18454. average delta encountered.
  18455. @section vibrance
  18456. Boost or alter saturation.
  18457. The filter accepts the following options:
  18458. @table @option
  18459. @item intensity
  18460. Set strength of boost if positive value or strength of alter if negative value.
  18461. Default is 0. Allowed range is from -2 to 2.
  18462. @item rbal
  18463. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  18464. @item gbal
  18465. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  18466. @item bbal
  18467. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  18468. @item rlum
  18469. Set the red luma coefficient.
  18470. @item glum
  18471. Set the green luma coefficient.
  18472. @item blum
  18473. Set the blue luma coefficient.
  18474. @item alternate
  18475. If @code{intensity} is negative and this is set to 1, colors will change,
  18476. otherwise colors will be less saturated, more towards gray.
  18477. @end table
  18478. @subsection Commands
  18479. This filter supports the all above options as @ref{commands}.
  18480. @section vif
  18481. Obtain the average VIF (Visual Information Fidelity) between two input videos.
  18482. This filter takes two input videos.
  18483. Both input videos must have the same resolution and pixel format for
  18484. this filter to work correctly. Also it assumes that both inputs
  18485. have the same number of frames, which are compared one by one.
  18486. The obtained average VIF score is printed through the logging system.
  18487. The filter stores the calculated VIF score of each frame.
  18488. This filter also supports the @ref{framesync} options.
  18489. In the below example the input file @file{main.mpg} being processed is compared
  18490. with the reference file @file{ref.mpg}.
  18491. @example
  18492. ffmpeg -i main.mpg -i ref.mpg -lavfi vif -f null -
  18493. @end example
  18494. @anchor{vignette}
  18495. @section vignette
  18496. Make or reverse a natural vignetting effect.
  18497. The filter accepts the following options:
  18498. @table @option
  18499. @item angle, a
  18500. Set lens angle expression as a number of radians.
  18501. The value is clipped in the @code{[0,PI/2]} range.
  18502. Default value: @code{"PI/5"}
  18503. @item x0
  18504. @item y0
  18505. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  18506. by default.
  18507. @item mode
  18508. Set forward/backward mode.
  18509. Available modes are:
  18510. @table @samp
  18511. @item forward
  18512. The larger the distance from the central point, the darker the image becomes.
  18513. @item backward
  18514. The larger the distance from the central point, the brighter the image becomes.
  18515. This can be used to reverse a vignette effect, though there is no automatic
  18516. detection to extract the lens @option{angle} and other settings (yet). It can
  18517. also be used to create a burning effect.
  18518. @end table
  18519. Default value is @samp{forward}.
  18520. @item eval
  18521. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  18522. It accepts the following values:
  18523. @table @samp
  18524. @item init
  18525. Evaluate expressions only once during the filter initialization.
  18526. @item frame
  18527. Evaluate expressions for each incoming frame. This is way slower than the
  18528. @samp{init} mode since it requires all the scalers to be re-computed, but it
  18529. allows advanced dynamic expressions.
  18530. @end table
  18531. Default value is @samp{init}.
  18532. @item dither
  18533. Set dithering to reduce the circular banding effects. Default is @code{1}
  18534. (enabled).
  18535. @item aspect
  18536. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  18537. Setting this value to the SAR of the input will make a rectangular vignetting
  18538. following the dimensions of the video.
  18539. Default is @code{1/1}.
  18540. @end table
  18541. @subsection Expressions
  18542. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  18543. following parameters.
  18544. @table @option
  18545. @item w
  18546. @item h
  18547. input width and height
  18548. @item n
  18549. the number of input frame, starting from 0
  18550. @item pts
  18551. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  18552. @var{TB} units, NAN if undefined
  18553. @item r
  18554. frame rate of the input video, NAN if the input frame rate is unknown
  18555. @item t
  18556. the PTS (Presentation TimeStamp) of the filtered video frame,
  18557. expressed in seconds, NAN if undefined
  18558. @item tb
  18559. time base of the input video
  18560. @end table
  18561. @subsection Examples
  18562. @itemize
  18563. @item
  18564. Apply simple strong vignetting effect:
  18565. @example
  18566. vignette=PI/4
  18567. @end example
  18568. @item
  18569. Make a flickering vignetting:
  18570. @example
  18571. vignette='PI/4+random(1)*PI/50':eval=frame
  18572. @end example
  18573. @end itemize
  18574. @section vmafmotion
  18575. Obtain the average VMAF motion score of a video.
  18576. It is one of the component metrics of VMAF.
  18577. The obtained average motion score is printed through the logging system.
  18578. The filter accepts the following options:
  18579. @table @option
  18580. @item stats_file
  18581. If specified, the filter will use the named file to save the motion score of
  18582. each frame with respect to the previous frame.
  18583. When filename equals "-" the data is sent to standard output.
  18584. @end table
  18585. Example:
  18586. @example
  18587. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  18588. @end example
  18589. @anchor{vstack}
  18590. @section vstack
  18591. Stack input videos vertically.
  18592. All streams must be of same pixel format and of same width.
  18593. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  18594. to create same output.
  18595. The filter accepts the following options:
  18596. @table @option
  18597. @item inputs
  18598. Set number of input streams. Default is 2.
  18599. @item shortest
  18600. If set to 1, force the output to terminate when the shortest input
  18601. terminates. Default value is 0.
  18602. @end table
  18603. @section w3fdif
  18604. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  18605. Deinterlacing Filter").
  18606. Based on the process described by Martin Weston for BBC R&D, and
  18607. implemented based on the de-interlace algorithm written by Jim
  18608. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  18609. uses filter coefficients calculated by BBC R&D.
  18610. This filter uses field-dominance information in frame to decide which
  18611. of each pair of fields to place first in the output.
  18612. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  18613. There are two sets of filter coefficients, so called "simple"
  18614. and "complex". Which set of filter coefficients is used can
  18615. be set by passing an optional parameter:
  18616. @table @option
  18617. @item filter
  18618. Set the interlacing filter coefficients. Accepts one of the following values:
  18619. @table @samp
  18620. @item simple
  18621. Simple filter coefficient set.
  18622. @item complex
  18623. More-complex filter coefficient set.
  18624. @end table
  18625. Default value is @samp{complex}.
  18626. @item mode
  18627. The interlacing mode to adopt. It accepts one of the following values:
  18628. @table @option
  18629. @item frame
  18630. Output one frame for each frame.
  18631. @item field
  18632. Output one frame for each field.
  18633. @end table
  18634. The default value is @code{field}.
  18635. @item parity
  18636. The picture field parity assumed for the input interlaced video. It accepts one
  18637. of the following values:
  18638. @table @option
  18639. @item tff
  18640. Assume the top field is first.
  18641. @item bff
  18642. Assume the bottom field is first.
  18643. @item auto
  18644. Enable automatic detection of field parity.
  18645. @end table
  18646. The default value is @code{auto}.
  18647. If the interlacing is unknown or the decoder does not export this information,
  18648. top field first will be assumed.
  18649. @item deint
  18650. Specify which frames to deinterlace. Accepts one of the following values:
  18651. @table @samp
  18652. @item all
  18653. Deinterlace all frames,
  18654. @item interlaced
  18655. Only deinterlace frames marked as interlaced.
  18656. @end table
  18657. Default value is @samp{all}.
  18658. @end table
  18659. @subsection Commands
  18660. This filter supports same @ref{commands} as options.
  18661. @section waveform
  18662. Video waveform monitor.
  18663. The waveform monitor plots color component intensity. By default luminance
  18664. only. Each column of the waveform corresponds to a column of pixels in the
  18665. source video.
  18666. It accepts the following options:
  18667. @table @option
  18668. @item mode, m
  18669. Can be either @code{row}, or @code{column}. Default is @code{column}.
  18670. In row mode, the graph on the left side represents color component value 0 and
  18671. the right side represents value = 255. In column mode, the top side represents
  18672. color component value = 0 and bottom side represents value = 255.
  18673. @item intensity, i
  18674. Set intensity. Smaller values are useful to find out how many values of the same
  18675. luminance are distributed across input rows/columns.
  18676. Default value is @code{0.04}. Allowed range is [0, 1].
  18677. @item mirror, r
  18678. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  18679. In mirrored mode, higher values will be represented on the left
  18680. side for @code{row} mode and at the top for @code{column} mode. Default is
  18681. @code{1} (mirrored).
  18682. @item display, d
  18683. Set display mode.
  18684. It accepts the following values:
  18685. @table @samp
  18686. @item overlay
  18687. Presents information identical to that in the @code{parade}, except
  18688. that the graphs representing color components are superimposed directly
  18689. over one another.
  18690. This display mode makes it easier to spot relative differences or similarities
  18691. in overlapping areas of the color components that are supposed to be identical,
  18692. such as neutral whites, grays, or blacks.
  18693. @item stack
  18694. Display separate graph for the color components side by side in
  18695. @code{row} mode or one below the other in @code{column} mode.
  18696. @item parade
  18697. Display separate graph for the color components side by side in
  18698. @code{column} mode or one below the other in @code{row} mode.
  18699. Using this display mode makes it easy to spot color casts in the highlights
  18700. and shadows of an image, by comparing the contours of the top and the bottom
  18701. graphs of each waveform. Since whites, grays, and blacks are characterized
  18702. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  18703. should display three waveforms of roughly equal width/height. If not, the
  18704. correction is easy to perform by making level adjustments the three waveforms.
  18705. @end table
  18706. Default is @code{stack}.
  18707. @item components, c
  18708. Set which color components to display. Default is 1, which means only luminance
  18709. or red color component if input is in RGB colorspace. If is set for example to
  18710. 7 it will display all 3 (if) available color components.
  18711. @item envelope, e
  18712. @table @samp
  18713. @item none
  18714. No envelope, this is default.
  18715. @item instant
  18716. Instant envelope, minimum and maximum values presented in graph will be easily
  18717. visible even with small @code{step} value.
  18718. @item peak
  18719. Hold minimum and maximum values presented in graph across time. This way you
  18720. can still spot out of range values without constantly looking at waveforms.
  18721. @item peak+instant
  18722. Peak and instant envelope combined together.
  18723. @end table
  18724. @item filter, f
  18725. @table @samp
  18726. @item lowpass
  18727. No filtering, this is default.
  18728. @item flat
  18729. Luma and chroma combined together.
  18730. @item aflat
  18731. Similar as above, but shows difference between blue and red chroma.
  18732. @item xflat
  18733. Similar as above, but use different colors.
  18734. @item yflat
  18735. Similar as above, but again with different colors.
  18736. @item chroma
  18737. Displays only chroma.
  18738. @item color
  18739. Displays actual color value on waveform.
  18740. @item acolor
  18741. Similar as above, but with luma showing frequency of chroma values.
  18742. @end table
  18743. @item graticule, g
  18744. Set which graticule to display.
  18745. @table @samp
  18746. @item none
  18747. Do not display graticule.
  18748. @item green
  18749. Display green graticule showing legal broadcast ranges.
  18750. @item orange
  18751. Display orange graticule showing legal broadcast ranges.
  18752. @item invert
  18753. Display invert graticule showing legal broadcast ranges.
  18754. @end table
  18755. @item opacity, o
  18756. Set graticule opacity.
  18757. @item flags, fl
  18758. Set graticule flags.
  18759. @table @samp
  18760. @item numbers
  18761. Draw numbers above lines. By default enabled.
  18762. @item dots
  18763. Draw dots instead of lines.
  18764. @end table
  18765. @item scale, s
  18766. Set scale used for displaying graticule.
  18767. @table @samp
  18768. @item digital
  18769. @item millivolts
  18770. @item ire
  18771. @end table
  18772. Default is digital.
  18773. @item bgopacity, b
  18774. Set background opacity.
  18775. @item tint0, t0
  18776. @item tint1, t1
  18777. Set tint for output.
  18778. Only used with lowpass filter and when display is not overlay and input
  18779. pixel formats are not RGB.
  18780. @item fitmode, fm
  18781. Set sample aspect ratio of video output frames.
  18782. Can be used to configure waveform so it is not
  18783. streched too much in one of directions.
  18784. @table @samp
  18785. @item none
  18786. Set sample aspect ration to 1/1.
  18787. @item size
  18788. Set sample aspect ratio to match input size of video
  18789. @end table
  18790. Default is @samp{none}.
  18791. @end table
  18792. @section weave, doubleweave
  18793. The @code{weave} takes a field-based video input and join
  18794. each two sequential fields into single frame, producing a new double
  18795. height clip with half the frame rate and half the frame count.
  18796. The @code{doubleweave} works same as @code{weave} but without
  18797. halving frame rate and frame count.
  18798. It accepts the following option:
  18799. @table @option
  18800. @item first_field
  18801. Set first field. Available values are:
  18802. @table @samp
  18803. @item top, t
  18804. Set the frame as top-field-first.
  18805. @item bottom, b
  18806. Set the frame as bottom-field-first.
  18807. @end table
  18808. @end table
  18809. @subsection Examples
  18810. @itemize
  18811. @item
  18812. Interlace video using @ref{select} and @ref{separatefields} filter:
  18813. @example
  18814. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  18815. @end example
  18816. @end itemize
  18817. @section xbr
  18818. Apply the xBR high-quality magnification filter which is designed for pixel
  18819. art. It follows a set of edge-detection rules, see
  18820. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  18821. It accepts the following option:
  18822. @table @option
  18823. @item n
  18824. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  18825. @code{3xBR} and @code{4} for @code{4xBR}.
  18826. Default is @code{3}.
  18827. @end table
  18828. @section xcorrelate
  18829. Apply normalized cross-correlation between first and second input video stream.
  18830. Second input video stream dimensions must be lower than first input video stream.
  18831. The filter accepts the following options:
  18832. @table @option
  18833. @item planes
  18834. Set which planes to process.
  18835. @item secondary
  18836. Set which secondary video frames will be processed from second input video stream,
  18837. can be @var{first} or @var{all}. Default is @var{all}.
  18838. @end table
  18839. The @code{xcorrelate} filter also supports the @ref{framesync} options.
  18840. @section xfade
  18841. Apply cross fade from one input video stream to another input video stream.
  18842. The cross fade is applied for specified duration.
  18843. Both inputs must be constant frame-rate and have the same resolution, pixel format,
  18844. frame rate and timebase.
  18845. The filter accepts the following options:
  18846. @table @option
  18847. @item transition
  18848. Set one of available transition effects:
  18849. @table @samp
  18850. @item custom
  18851. @item fade
  18852. @item wipeleft
  18853. @item wiperight
  18854. @item wipeup
  18855. @item wipedown
  18856. @item slideleft
  18857. @item slideright
  18858. @item slideup
  18859. @item slidedown
  18860. @item circlecrop
  18861. @item rectcrop
  18862. @item distance
  18863. @item fadeblack
  18864. @item fadewhite
  18865. @item radial
  18866. @item smoothleft
  18867. @item smoothright
  18868. @item smoothup
  18869. @item smoothdown
  18870. @item circleopen
  18871. @item circleclose
  18872. @item vertopen
  18873. @item vertclose
  18874. @item horzopen
  18875. @item horzclose
  18876. @item dissolve
  18877. @item pixelize
  18878. @item diagtl
  18879. @item diagtr
  18880. @item diagbl
  18881. @item diagbr
  18882. @item hlslice
  18883. @item hrslice
  18884. @item vuslice
  18885. @item vdslice
  18886. @item hblur
  18887. @item fadegrays
  18888. @item wipetl
  18889. @item wipetr
  18890. @item wipebl
  18891. @item wipebr
  18892. @item squeezeh
  18893. @item squeezev
  18894. @item zoomin
  18895. @item fadefast
  18896. @item fadeslow
  18897. @end table
  18898. Default transition effect is fade.
  18899. @item duration
  18900. Set cross fade duration in seconds.
  18901. Range is 0 to 60 seconds.
  18902. Default duration is 1 second.
  18903. @item offset
  18904. Set cross fade start relative to first input stream in seconds.
  18905. Default offset is 0.
  18906. @item expr
  18907. Set expression for custom transition effect.
  18908. The expressions can use the following variables and functions:
  18909. @table @option
  18910. @item X
  18911. @item Y
  18912. The coordinates of the current sample.
  18913. @item W
  18914. @item H
  18915. The width and height of the image.
  18916. @item P
  18917. Progress of transition effect.
  18918. @item PLANE
  18919. Currently processed plane.
  18920. @item A
  18921. Return value of first input at current location and plane.
  18922. @item B
  18923. Return value of second input at current location and plane.
  18924. @item a0(x, y)
  18925. @item a1(x, y)
  18926. @item a2(x, y)
  18927. @item a3(x, y)
  18928. Return the value of the pixel at location (@var{x},@var{y}) of the
  18929. first/second/third/fourth component of first input.
  18930. @item b0(x, y)
  18931. @item b1(x, y)
  18932. @item b2(x, y)
  18933. @item b3(x, y)
  18934. Return the value of the pixel at location (@var{x},@var{y}) of the
  18935. first/second/third/fourth component of second input.
  18936. @end table
  18937. @end table
  18938. @subsection Examples
  18939. @itemize
  18940. @item
  18941. Cross fade from one input video to another input video, with fade transition and duration of transition
  18942. of 2 seconds starting at offset of 5 seconds:
  18943. @example
  18944. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  18945. @end example
  18946. @end itemize
  18947. @section xmedian
  18948. Pick median pixels from several input videos.
  18949. The filter accepts the following options:
  18950. @table @option
  18951. @item inputs
  18952. Set number of inputs.
  18953. Default is 3. Allowed range is from 3 to 255.
  18954. If number of inputs is even number, than result will be mean value between two median values.
  18955. @item planes
  18956. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  18957. @item percentile
  18958. Set median percentile. Default value is @code{0.5}.
  18959. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  18960. minimum values, and @code{1} maximum values.
  18961. @end table
  18962. @subsection Commands
  18963. This filter supports all above options as @ref{commands}, excluding option @code{inputs}.
  18964. @anchor{xstack}
  18965. @section xstack
  18966. Stack video inputs into custom layout.
  18967. All streams must be of same pixel format.
  18968. The filter accepts the following options:
  18969. @table @option
  18970. @item inputs
  18971. Set number of input streams. Default is 2.
  18972. @item layout
  18973. Specify layout of inputs.
  18974. This option requires the desired layout configuration to be explicitly set by the user.
  18975. This sets position of each video input in output. Each input
  18976. is separated by '|'.
  18977. The first number represents the column, and the second number represents the row.
  18978. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  18979. where X is video input from which to take width or height.
  18980. Multiple values can be used when separated by '+'. In such
  18981. case values are summed together.
  18982. Note that if inputs are of different sizes gaps may appear, as not all of
  18983. the output video frame will be filled. Similarly, videos can overlap each
  18984. other if their position doesn't leave enough space for the full frame of
  18985. adjoining videos.
  18986. For 2 inputs, a default layout of @code{0_0|w0_0} (equivalent to
  18987. @code{grid=2x1}) is set. In all other cases, a layout or a grid must be set by
  18988. the user. Either @code{grid} or @code{layout} can be specified at a time.
  18989. Specifying both will result in an error.
  18990. @item grid
  18991. Specify a fixed size grid of inputs.
  18992. This option is used to create a fixed size grid of the input streams. Set the
  18993. grid size in the form @code{COLUMNSxROWS}. There must be @code{ROWS * COLUMNS}
  18994. input streams and they will be arranged as a grid with @code{ROWS} rows and
  18995. @code{COLUMNS} columns. When using this option, each input stream within a row
  18996. must have the same height and all the rows must have the same width.
  18997. If @code{grid} is set, then @code{inputs} option is ignored and is implicitly
  18998. set to @code{ROWS * COLUMNS}.
  18999. For 2 inputs, a default grid of @code{2x1} (equivalent to
  19000. @code{layout=0_0|w0_0}) is set. In all other cases, a layout or a grid must be
  19001. set by the user. Either @code{grid} or @code{layout} can be specified at a time.
  19002. Specifying both will result in an error.
  19003. @item shortest
  19004. If set to 1, force the output to terminate when the shortest input
  19005. terminates. Default value is 0.
  19006. @item fill
  19007. If set to valid color, all unused pixels will be filled with that color.
  19008. By default fill is set to none, so it is disabled.
  19009. @end table
  19010. @subsection Examples
  19011. @itemize
  19012. @item
  19013. Display 4 inputs into 2x2 grid.
  19014. Layout:
  19015. @example
  19016. input1(0, 0) | input3(w0, 0)
  19017. input2(0, h0) | input4(w0, h0)
  19018. @end example
  19019. @example
  19020. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  19021. @end example
  19022. Note that if inputs are of different sizes, gaps or overlaps may occur.
  19023. @item
  19024. Display 4 inputs into 1x4 grid.
  19025. Layout:
  19026. @example
  19027. input1(0, 0)
  19028. input2(0, h0)
  19029. input3(0, h0+h1)
  19030. input4(0, h0+h1+h2)
  19031. @end example
  19032. @example
  19033. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  19034. @end example
  19035. Note that if inputs are of different widths, unused space will appear.
  19036. @item
  19037. Display 9 inputs into 3x3 grid.
  19038. Layout:
  19039. @example
  19040. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  19041. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  19042. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  19043. @end example
  19044. @example
  19045. xstack=inputs=9:layout=0_0|0_h0|0_h0+h1|w0_0|w0_h0|w0_h0+h1|w0+w3_0|w0+w3_h0|w0+w3_h0+h1
  19046. @end example
  19047. Note that if inputs are of different sizes, gaps or overlaps may occur.
  19048. @item
  19049. Display 16 inputs into 4x4 grid.
  19050. Layout:
  19051. @example
  19052. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  19053. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  19054. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  19055. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  19056. @end example
  19057. @example
  19058. xstack=inputs=16:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2|w0_0|w0_h0|w0_h0+h1|w0_h0+h1+h2|w0+w4_0|
  19059. w0+w4_h0|w0+w4_h0+h1|w0+w4_h0+h1+h2|w0+w4+w8_0|w0+w4+w8_h0|w0+w4+w8_h0+h1|w0+w4+w8_h0+h1+h2
  19060. @end example
  19061. Note that if inputs are of different sizes, gaps or overlaps may occur.
  19062. @end itemize
  19063. @anchor{yadif}
  19064. @section yadif
  19065. Deinterlace the input video ("yadif" means "yet another deinterlacing
  19066. filter").
  19067. It accepts the following parameters:
  19068. @table @option
  19069. @item mode
  19070. The interlacing mode to adopt. It accepts one of the following values:
  19071. @table @option
  19072. @item 0, send_frame
  19073. Output one frame for each frame.
  19074. @item 1, send_field
  19075. Output one frame for each field.
  19076. @item 2, send_frame_nospatial
  19077. Like @code{send_frame}, but it skips the spatial interlacing check.
  19078. @item 3, send_field_nospatial
  19079. Like @code{send_field}, but it skips the spatial interlacing check.
  19080. @end table
  19081. The default value is @code{send_frame}.
  19082. @item parity
  19083. The picture field parity assumed for the input interlaced video. It accepts one
  19084. of the following values:
  19085. @table @option
  19086. @item 0, tff
  19087. Assume the top field is first.
  19088. @item 1, bff
  19089. Assume the bottom field is first.
  19090. @item -1, auto
  19091. Enable automatic detection of field parity.
  19092. @end table
  19093. The default value is @code{auto}.
  19094. If the interlacing is unknown or the decoder does not export this information,
  19095. top field first will be assumed.
  19096. @item deint
  19097. Specify which frames to deinterlace. Accepts one of the following
  19098. values:
  19099. @table @option
  19100. @item 0, all
  19101. Deinterlace all frames.
  19102. @item 1, interlaced
  19103. Only deinterlace frames marked as interlaced.
  19104. @end table
  19105. The default value is @code{all}.
  19106. @end table
  19107. @section yadif_cuda
  19108. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  19109. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  19110. and/or nvenc.
  19111. It accepts the following parameters:
  19112. @table @option
  19113. @item mode
  19114. The interlacing mode to adopt. It accepts one of the following values:
  19115. @table @option
  19116. @item 0, send_frame
  19117. Output one frame for each frame.
  19118. @item 1, send_field
  19119. Output one frame for each field.
  19120. @item 2, send_frame_nospatial
  19121. Like @code{send_frame}, but it skips the spatial interlacing check.
  19122. @item 3, send_field_nospatial
  19123. Like @code{send_field}, but it skips the spatial interlacing check.
  19124. @end table
  19125. The default value is @code{send_frame}.
  19126. @item parity
  19127. The picture field parity assumed for the input interlaced video. It accepts one
  19128. of the following values:
  19129. @table @option
  19130. @item 0, tff
  19131. Assume the top field is first.
  19132. @item 1, bff
  19133. Assume the bottom field is first.
  19134. @item -1, auto
  19135. Enable automatic detection of field parity.
  19136. @end table
  19137. The default value is @code{auto}.
  19138. If the interlacing is unknown or the decoder does not export this information,
  19139. top field first will be assumed.
  19140. @item deint
  19141. Specify which frames to deinterlace. Accepts one of the following
  19142. values:
  19143. @table @option
  19144. @item 0, all
  19145. Deinterlace all frames.
  19146. @item 1, interlaced
  19147. Only deinterlace frames marked as interlaced.
  19148. @end table
  19149. The default value is @code{all}.
  19150. @end table
  19151. @section yaepblur
  19152. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  19153. The algorithm is described in
  19154. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  19155. It accepts the following parameters:
  19156. @table @option
  19157. @item radius, r
  19158. Set the window radius. Default value is 3.
  19159. @item planes, p
  19160. Set which planes to filter. Default is only the first plane.
  19161. @item sigma, s
  19162. Set blur strength. Default value is 128.
  19163. @end table
  19164. @subsection Commands
  19165. This filter supports same @ref{commands} as options.
  19166. @section zoompan
  19167. Apply Zoom & Pan effect.
  19168. This filter accepts the following options:
  19169. @table @option
  19170. @item zoom, z
  19171. Set the zoom expression. Range is 1-10. Default is 1.
  19172. @item x
  19173. @item y
  19174. Set the x and y expression. Default is 0.
  19175. @item d
  19176. Set the duration expression in number of frames.
  19177. This sets for how many number of frames effect will last for
  19178. single input image. Default is 90.
  19179. @item s
  19180. Set the output image size, default is 'hd720'.
  19181. @item fps
  19182. Set the output frame rate, default is '25'.
  19183. @end table
  19184. Each expression can contain the following constants:
  19185. @table @option
  19186. @item in_w, iw
  19187. Input width.
  19188. @item in_h, ih
  19189. Input height.
  19190. @item out_w, ow
  19191. Output width.
  19192. @item out_h, oh
  19193. Output height.
  19194. @item in
  19195. Input frame count.
  19196. @item on
  19197. Output frame count.
  19198. @item in_time, it
  19199. The input timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  19200. @item out_time, time, ot
  19201. The output timestamp expressed in seconds.
  19202. @item x
  19203. @item y
  19204. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  19205. for current input frame.
  19206. @item px
  19207. @item py
  19208. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  19209. not yet such frame (first input frame).
  19210. @item zoom
  19211. Last calculated zoom from 'z' expression for current input frame.
  19212. @item pzoom
  19213. Last calculated zoom of last output frame of previous input frame.
  19214. @item duration
  19215. Number of output frames for current input frame. Calculated from 'd' expression
  19216. for each input frame.
  19217. @item pduration
  19218. number of output frames created for previous input frame
  19219. @item a
  19220. Rational number: input width / input height
  19221. @item sar
  19222. sample aspect ratio
  19223. @item dar
  19224. display aspect ratio
  19225. @end table
  19226. @subsection Examples
  19227. @itemize
  19228. @item
  19229. Zoom in up to 1.5x and pan at same time to some spot near center of picture:
  19230. @example
  19231. 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
  19232. @end example
  19233. @item
  19234. Zoom in up to 1.5x and pan always at center of picture:
  19235. @example
  19236. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  19237. @end example
  19238. @item
  19239. Same as above but without pausing:
  19240. @example
  19241. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  19242. @end example
  19243. @item
  19244. Zoom in 2x into center of picture only for the first second of the input video:
  19245. @example
  19246. zoompan=z='if(between(in_time,0,1),2,1)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  19247. @end example
  19248. @end itemize
  19249. @anchor{zscale}
  19250. @section zscale
  19251. Scale (resize) the input video, using the z.lib library:
  19252. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  19253. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  19254. The zscale filter forces the output display aspect ratio to be the same
  19255. as the input, by changing the output sample aspect ratio.
  19256. If the input image format is different from the format requested by
  19257. the next filter, the zscale filter will convert the input to the
  19258. requested format.
  19259. @subsection Options
  19260. The filter accepts the following options.
  19261. @table @option
  19262. @item width, w
  19263. @item height, h
  19264. Set the output video dimension expression. Default value is the input
  19265. dimension.
  19266. If the @var{width} or @var{w} value is 0, the input width is used for
  19267. the output. If the @var{height} or @var{h} value is 0, the input height
  19268. is used for the output.
  19269. If one and only one of the values is -n with n >= 1, the zscale filter
  19270. will use a value that maintains the aspect ratio of the input image,
  19271. calculated from the other specified dimension. After that it will,
  19272. however, make sure that the calculated dimension is divisible by n and
  19273. adjust the value if necessary.
  19274. If both values are -n with n >= 1, the behavior will be identical to
  19275. both values being set to 0 as previously detailed.
  19276. See below for the list of accepted constants for use in the dimension
  19277. expression.
  19278. @item size, s
  19279. Set the video size. For the syntax of this option, check the
  19280. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19281. @item dither, d
  19282. Set the dither type.
  19283. Possible values are:
  19284. @table @var
  19285. @item none
  19286. @item ordered
  19287. @item random
  19288. @item error_diffusion
  19289. @end table
  19290. Default is none.
  19291. @item filter, f
  19292. Set the resize filter type.
  19293. Possible values are:
  19294. @table @var
  19295. @item point
  19296. @item bilinear
  19297. @item bicubic
  19298. @item spline16
  19299. @item spline36
  19300. @item lanczos
  19301. @end table
  19302. Default is bilinear.
  19303. @item range, r
  19304. Set the color range.
  19305. Possible values are:
  19306. @table @var
  19307. @item input
  19308. @item limited
  19309. @item full
  19310. @end table
  19311. Default is same as input.
  19312. @item primaries, p
  19313. Set the color primaries.
  19314. Possible values are:
  19315. @table @var
  19316. @item input
  19317. @item 709
  19318. @item unspecified
  19319. @item 170m
  19320. @item 240m
  19321. @item 2020
  19322. @end table
  19323. Default is same as input.
  19324. @item transfer, t
  19325. Set the transfer characteristics.
  19326. Possible values are:
  19327. @table @var
  19328. @item input
  19329. @item 709
  19330. @item unspecified
  19331. @item 601
  19332. @item linear
  19333. @item 2020_10
  19334. @item 2020_12
  19335. @item smpte2084
  19336. @item iec61966-2-1
  19337. @item arib-std-b67
  19338. @end table
  19339. Default is same as input.
  19340. @item matrix, m
  19341. Set the colorspace matrix.
  19342. Possible value are:
  19343. @table @var
  19344. @item input
  19345. @item 709
  19346. @item unspecified
  19347. @item 470bg
  19348. @item 170m
  19349. @item 2020_ncl
  19350. @item 2020_cl
  19351. @end table
  19352. Default is same as input.
  19353. @item rangein, rin
  19354. Set the input color range.
  19355. Possible values are:
  19356. @table @var
  19357. @item input
  19358. @item limited
  19359. @item full
  19360. @end table
  19361. Default is same as input.
  19362. @item primariesin, pin
  19363. Set the input color primaries.
  19364. Possible values are:
  19365. @table @var
  19366. @item input
  19367. @item 709
  19368. @item unspecified
  19369. @item 170m
  19370. @item 240m
  19371. @item 2020
  19372. @end table
  19373. Default is same as input.
  19374. @item transferin, tin
  19375. Set the input transfer characteristics.
  19376. Possible values are:
  19377. @table @var
  19378. @item input
  19379. @item 709
  19380. @item unspecified
  19381. @item 601
  19382. @item linear
  19383. @item 2020_10
  19384. @item 2020_12
  19385. @end table
  19386. Default is same as input.
  19387. @item matrixin, min
  19388. Set the input colorspace matrix.
  19389. Possible value are:
  19390. @table @var
  19391. @item input
  19392. @item 709
  19393. @item unspecified
  19394. @item 470bg
  19395. @item 170m
  19396. @item 2020_ncl
  19397. @item 2020_cl
  19398. @end table
  19399. @item chromal, c
  19400. Set the output chroma location.
  19401. Possible values are:
  19402. @table @var
  19403. @item input
  19404. @item left
  19405. @item center
  19406. @item topleft
  19407. @item top
  19408. @item bottomleft
  19409. @item bottom
  19410. @end table
  19411. @item chromalin, cin
  19412. Set the input chroma location.
  19413. Possible values are:
  19414. @table @var
  19415. @item input
  19416. @item left
  19417. @item center
  19418. @item topleft
  19419. @item top
  19420. @item bottomleft
  19421. @item bottom
  19422. @end table
  19423. @item npl
  19424. Set the nominal peak luminance.
  19425. @item param_a
  19426. Parameter A for scaling filters. Parameter "b" for bicubic, and the number of
  19427. filter taps for lanczos.
  19428. @item param_b
  19429. Parameter B for scaling filters. Parameter "c" for bicubic.
  19430. @end table
  19431. The values of the @option{w} and @option{h} options are expressions
  19432. containing the following constants:
  19433. @table @var
  19434. @item in_w
  19435. @item in_h
  19436. The input width and height
  19437. @item iw
  19438. @item ih
  19439. These are the same as @var{in_w} and @var{in_h}.
  19440. @item out_w
  19441. @item out_h
  19442. The output (scaled) width and height
  19443. @item ow
  19444. @item oh
  19445. These are the same as @var{out_w} and @var{out_h}
  19446. @item a
  19447. The same as @var{iw} / @var{ih}
  19448. @item sar
  19449. input sample aspect ratio
  19450. @item dar
  19451. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  19452. @item hsub
  19453. @item vsub
  19454. horizontal and vertical input chroma subsample values. For example for the
  19455. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  19456. @item ohsub
  19457. @item ovsub
  19458. horizontal and vertical output chroma subsample values. For example for the
  19459. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  19460. @end table
  19461. @subsection Commands
  19462. This filter supports the following commands:
  19463. @table @option
  19464. @item width, w
  19465. @item height, h
  19466. Set the output video dimension expression.
  19467. The command accepts the same syntax of the corresponding option.
  19468. If the specified expression is not valid, it is kept at its current
  19469. value.
  19470. @end table
  19471. @c man end VIDEO FILTERS
  19472. @chapter OpenCL Video Filters
  19473. @c man begin OPENCL VIDEO FILTERS
  19474. Below is a description of the currently available OpenCL video filters.
  19475. To enable compilation of these filters you need to configure FFmpeg with
  19476. @code{--enable-opencl}.
  19477. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  19478. @table @option
  19479. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  19480. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  19481. given device parameters.
  19482. @item -filter_hw_device @var{name}
  19483. Pass the hardware device called @var{name} to all filters in any filter graph.
  19484. @end table
  19485. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  19486. @itemize
  19487. @item
  19488. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  19489. @example
  19490. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  19491. @end example
  19492. @end itemize
  19493. 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.
  19494. @section avgblur_opencl
  19495. Apply average blur filter.
  19496. The filter accepts the following options:
  19497. @table @option
  19498. @item sizeX
  19499. Set horizontal radius size.
  19500. Range is @code{[1, 1024]} and default value is @code{1}.
  19501. @item planes
  19502. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  19503. @item sizeY
  19504. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  19505. @end table
  19506. @subsection Example
  19507. @itemize
  19508. @item
  19509. 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.
  19510. @example
  19511. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  19512. @end example
  19513. @end itemize
  19514. @section boxblur_opencl
  19515. Apply a boxblur algorithm to the input video.
  19516. It accepts the following parameters:
  19517. @table @option
  19518. @item luma_radius, lr
  19519. @item luma_power, lp
  19520. @item chroma_radius, cr
  19521. @item chroma_power, cp
  19522. @item alpha_radius, ar
  19523. @item alpha_power, ap
  19524. @end table
  19525. A description of the accepted options follows.
  19526. @table @option
  19527. @item luma_radius, lr
  19528. @item chroma_radius, cr
  19529. @item alpha_radius, ar
  19530. Set an expression for the box radius in pixels used for blurring the
  19531. corresponding input plane.
  19532. The radius value must be a non-negative number, and must not be
  19533. greater than the value of the expression @code{min(w,h)/2} for the
  19534. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  19535. planes.
  19536. Default value for @option{luma_radius} is "2". If not specified,
  19537. @option{chroma_radius} and @option{alpha_radius} default to the
  19538. corresponding value set for @option{luma_radius}.
  19539. The expressions can contain the following constants:
  19540. @table @option
  19541. @item w
  19542. @item h
  19543. The input width and height in pixels.
  19544. @item cw
  19545. @item ch
  19546. The input chroma image width and height in pixels.
  19547. @item hsub
  19548. @item vsub
  19549. The horizontal and vertical chroma subsample values. For example, for the
  19550. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  19551. @end table
  19552. @item luma_power, lp
  19553. @item chroma_power, cp
  19554. @item alpha_power, ap
  19555. Specify how many times the boxblur filter is applied to the
  19556. corresponding plane.
  19557. Default value for @option{luma_power} is 2. If not specified,
  19558. @option{chroma_power} and @option{alpha_power} default to the
  19559. corresponding value set for @option{luma_power}.
  19560. A value of 0 will disable the effect.
  19561. @end table
  19562. @subsection Examples
  19563. 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.
  19564. @itemize
  19565. @item
  19566. Apply a boxblur filter with the luma, chroma, and alpha radius
  19567. 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.
  19568. @example
  19569. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  19570. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  19571. @end example
  19572. @item
  19573. 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.
  19574. For the luma plane, a 2x2 box radius will be run once.
  19575. For the chroma plane, a 4x4 box radius will be run 5 times.
  19576. For the alpha plane, a 3x3 box radius will be run 7 times.
  19577. @example
  19578. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  19579. @end example
  19580. @end itemize
  19581. @section colorkey_opencl
  19582. RGB colorspace color keying.
  19583. The filter accepts the following options:
  19584. @table @option
  19585. @item color
  19586. The color which will be replaced with transparency.
  19587. @item similarity
  19588. Similarity percentage with the key color.
  19589. 0.01 matches only the exact key color, while 1.0 matches everything.
  19590. @item blend
  19591. Blend percentage.
  19592. 0.0 makes pixels either fully transparent, or not transparent at all.
  19593. Higher values result in semi-transparent pixels, with a higher transparency
  19594. the more similar the pixels color is to the key color.
  19595. @end table
  19596. @subsection Examples
  19597. @itemize
  19598. @item
  19599. Make every semi-green pixel in the input transparent with some slight blending:
  19600. @example
  19601. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  19602. @end example
  19603. @end itemize
  19604. @section convolution_opencl
  19605. Apply convolution of 3x3, 5x5, 7x7 matrix.
  19606. The filter accepts the following options:
  19607. @table @option
  19608. @item 0m
  19609. @item 1m
  19610. @item 2m
  19611. @item 3m
  19612. Set matrix for each plane.
  19613. Matrix is sequence of 9, 25 or 49 signed numbers.
  19614. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  19615. @item 0rdiv
  19616. @item 1rdiv
  19617. @item 2rdiv
  19618. @item 3rdiv
  19619. Set multiplier for calculated value for each plane.
  19620. If unset or 0, it will be sum of all matrix elements.
  19621. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  19622. @item 0bias
  19623. @item 1bias
  19624. @item 2bias
  19625. @item 3bias
  19626. Set bias for each plane. This value is added to the result of the multiplication.
  19627. Useful for making the overall image brighter or darker.
  19628. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  19629. @end table
  19630. @subsection Examples
  19631. @itemize
  19632. @item
  19633. Apply sharpen:
  19634. @example
  19635. -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
  19636. @end example
  19637. @item
  19638. Apply blur:
  19639. @example
  19640. -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
  19641. @end example
  19642. @item
  19643. Apply edge enhance:
  19644. @example
  19645. -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
  19646. @end example
  19647. @item
  19648. Apply edge detect:
  19649. @example
  19650. -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
  19651. @end example
  19652. @item
  19653. Apply laplacian edge detector which includes diagonals:
  19654. @example
  19655. -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
  19656. @end example
  19657. @item
  19658. Apply emboss:
  19659. @example
  19660. -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
  19661. @end example
  19662. @end itemize
  19663. @section erosion_opencl
  19664. Apply erosion effect to the video.
  19665. This filter replaces the pixel by the local(3x3) minimum.
  19666. It accepts the following options:
  19667. @table @option
  19668. @item threshold0
  19669. @item threshold1
  19670. @item threshold2
  19671. @item threshold3
  19672. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  19673. If @code{0}, plane will remain unchanged.
  19674. @item coordinates
  19675. Flag which specifies the pixel to refer to.
  19676. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  19677. Flags to local 3x3 coordinates region centered on @code{x}:
  19678. 1 2 3
  19679. 4 x 5
  19680. 6 7 8
  19681. @end table
  19682. @subsection Example
  19683. @itemize
  19684. @item
  19685. 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.
  19686. @example
  19687. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  19688. @end example
  19689. @end itemize
  19690. @section deshake_opencl
  19691. Feature-point based video stabilization filter.
  19692. The filter accepts the following options:
  19693. @table @option
  19694. @item tripod
  19695. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  19696. @item debug
  19697. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  19698. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  19699. Viewing point matches in the output video is only supported for RGB input.
  19700. Defaults to @code{0}.
  19701. @item adaptive_crop
  19702. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  19703. Defaults to @code{1}.
  19704. @item refine_features
  19705. Whether or not feature points should be refined at a sub-pixel level.
  19706. This can be turned off for a slight performance gain at the cost of precision.
  19707. Defaults to @code{1}.
  19708. @item smooth_strength
  19709. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  19710. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  19711. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  19712. Defaults to @code{0.0}.
  19713. @item smooth_window_multiplier
  19714. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  19715. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  19716. Acceptable values range from @code{0.1} to @code{10.0}.
  19717. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  19718. potentially improving smoothness, but also increase latency and memory usage.
  19719. Defaults to @code{2.0}.
  19720. @end table
  19721. @subsection Examples
  19722. @itemize
  19723. @item
  19724. Stabilize a video with a fixed, medium smoothing strength:
  19725. @example
  19726. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  19727. @end example
  19728. @item
  19729. Stabilize a video with debugging (both in console and in rendered video):
  19730. @example
  19731. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  19732. @end example
  19733. @end itemize
  19734. @section dilation_opencl
  19735. Apply dilation effect to the video.
  19736. This filter replaces the pixel by the local(3x3) maximum.
  19737. It accepts the following options:
  19738. @table @option
  19739. @item threshold0
  19740. @item threshold1
  19741. @item threshold2
  19742. @item threshold3
  19743. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  19744. If @code{0}, plane will remain unchanged.
  19745. @item coordinates
  19746. Flag which specifies the pixel to refer to.
  19747. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  19748. Flags to local 3x3 coordinates region centered on @code{x}:
  19749. 1 2 3
  19750. 4 x 5
  19751. 6 7 8
  19752. @end table
  19753. @subsection Example
  19754. @itemize
  19755. @item
  19756. 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.
  19757. @example
  19758. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  19759. @end example
  19760. @end itemize
  19761. @section nlmeans_opencl
  19762. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  19763. @section overlay_opencl
  19764. Overlay one video on top of another.
  19765. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  19766. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  19767. The filter accepts the following options:
  19768. @table @option
  19769. @item x
  19770. Set the x coordinate of the overlaid video on the main video.
  19771. Default value is @code{0}.
  19772. @item y
  19773. Set the y coordinate of the overlaid video on the main video.
  19774. Default value is @code{0}.
  19775. @end table
  19776. @subsection Examples
  19777. @itemize
  19778. @item
  19779. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  19780. @example
  19781. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  19782. @end example
  19783. @item
  19784. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  19785. @example
  19786. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  19787. @end example
  19788. @end itemize
  19789. @section pad_opencl
  19790. Add paddings to the input image, and place the original input at the
  19791. provided @var{x}, @var{y} coordinates.
  19792. It accepts the following options:
  19793. @table @option
  19794. @item width, w
  19795. @item height, h
  19796. Specify an expression for the size of the output image with the
  19797. paddings added. If the value for @var{width} or @var{height} is 0, the
  19798. corresponding input size is used for the output.
  19799. The @var{width} expression can reference the value set by the
  19800. @var{height} expression, and vice versa.
  19801. The default value of @var{width} and @var{height} is 0.
  19802. @item x
  19803. @item y
  19804. Specify the offsets to place the input image at within the padded area,
  19805. with respect to the top/left border of the output image.
  19806. The @var{x} expression can reference the value set by the @var{y}
  19807. expression, and vice versa.
  19808. The default value of @var{x} and @var{y} is 0.
  19809. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  19810. so the input image is centered on the padded area.
  19811. @item color
  19812. Specify the color of the padded area. For the syntax of this option,
  19813. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  19814. manual,ffmpeg-utils}.
  19815. @item aspect
  19816. Pad to an aspect instead to a resolution.
  19817. @end table
  19818. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  19819. options are expressions containing the following constants:
  19820. @table @option
  19821. @item in_w
  19822. @item in_h
  19823. The input video width and height.
  19824. @item iw
  19825. @item ih
  19826. These are the same as @var{in_w} and @var{in_h}.
  19827. @item out_w
  19828. @item out_h
  19829. The output width and height (the size of the padded area), as
  19830. specified by the @var{width} and @var{height} expressions.
  19831. @item ow
  19832. @item oh
  19833. These are the same as @var{out_w} and @var{out_h}.
  19834. @item x
  19835. @item y
  19836. The x and y offsets as specified by the @var{x} and @var{y}
  19837. expressions, or NAN if not yet specified.
  19838. @item a
  19839. same as @var{iw} / @var{ih}
  19840. @item sar
  19841. input sample aspect ratio
  19842. @item dar
  19843. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  19844. @end table
  19845. @section prewitt_opencl
  19846. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  19847. The filter accepts the following option:
  19848. @table @option
  19849. @item planes
  19850. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  19851. @item scale
  19852. Set value which will be multiplied with filtered result.
  19853. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  19854. @item delta
  19855. Set value which will be added to filtered result.
  19856. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  19857. @end table
  19858. @subsection Example
  19859. @itemize
  19860. @item
  19861. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  19862. @example
  19863. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  19864. @end example
  19865. @end itemize
  19866. @anchor{program_opencl}
  19867. @section program_opencl
  19868. Filter video using an OpenCL program.
  19869. @table @option
  19870. @item source
  19871. OpenCL program source file.
  19872. @item kernel
  19873. Kernel name in program.
  19874. @item inputs
  19875. Number of inputs to the filter. Defaults to 1.
  19876. @item size, s
  19877. Size of output frames. Defaults to the same as the first input.
  19878. @end table
  19879. The @code{program_opencl} filter also supports the @ref{framesync} options.
  19880. The program source file must contain a kernel function with the given name,
  19881. which will be run once for each plane of the output. Each run on a plane
  19882. gets enqueued as a separate 2D global NDRange with one work-item for each
  19883. pixel to be generated. The global ID offset for each work-item is therefore
  19884. the coordinates of a pixel in the destination image.
  19885. The kernel function needs to take the following arguments:
  19886. @itemize
  19887. @item
  19888. Destination image, @var{__write_only image2d_t}.
  19889. This image will become the output; the kernel should write all of it.
  19890. @item
  19891. Frame index, @var{unsigned int}.
  19892. This is a counter starting from zero and increasing by one for each frame.
  19893. @item
  19894. Source images, @var{__read_only image2d_t}.
  19895. These are the most recent images on each input. The kernel may read from
  19896. them to generate the output, but they can't be written to.
  19897. @end itemize
  19898. Example programs:
  19899. @itemize
  19900. @item
  19901. Copy the input to the output (output must be the same size as the input).
  19902. @verbatim
  19903. __kernel void copy(__write_only image2d_t destination,
  19904. unsigned int index,
  19905. __read_only image2d_t source)
  19906. {
  19907. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  19908. int2 location = (int2)(get_global_id(0), get_global_id(1));
  19909. float4 value = read_imagef(source, sampler, location);
  19910. write_imagef(destination, location, value);
  19911. }
  19912. @end verbatim
  19913. @item
  19914. Apply a simple transformation, rotating the input by an amount increasing
  19915. with the index counter. Pixel values are linearly interpolated by the
  19916. sampler, and the output need not have the same dimensions as the input.
  19917. @verbatim
  19918. __kernel void rotate_image(__write_only image2d_t dst,
  19919. unsigned int index,
  19920. __read_only image2d_t src)
  19921. {
  19922. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  19923. CLK_FILTER_LINEAR);
  19924. float angle = (float)index / 100.0f;
  19925. float2 dst_dim = convert_float2(get_image_dim(dst));
  19926. float2 src_dim = convert_float2(get_image_dim(src));
  19927. float2 dst_cen = dst_dim / 2.0f;
  19928. float2 src_cen = src_dim / 2.0f;
  19929. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  19930. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  19931. float2 src_pos = {
  19932. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  19933. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  19934. };
  19935. src_pos = src_pos * src_dim / dst_dim;
  19936. float2 src_loc = src_pos + src_cen;
  19937. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  19938. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  19939. write_imagef(dst, dst_loc, 0.5f);
  19940. else
  19941. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  19942. }
  19943. @end verbatim
  19944. @item
  19945. Blend two inputs together, with the amount of each input used varying
  19946. with the index counter.
  19947. @verbatim
  19948. __kernel void blend_images(__write_only image2d_t dst,
  19949. unsigned int index,
  19950. __read_only image2d_t src1,
  19951. __read_only image2d_t src2)
  19952. {
  19953. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  19954. CLK_FILTER_LINEAR);
  19955. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  19956. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  19957. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  19958. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  19959. float4 val1 = read_imagef(src1, sampler, src1_loc);
  19960. float4 val2 = read_imagef(src2, sampler, src2_loc);
  19961. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  19962. }
  19963. @end verbatim
  19964. @end itemize
  19965. @section remap_opencl
  19966. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  19967. Destination pixel at position (X, Y) will be picked from source (x, y) position
  19968. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  19969. value for pixel will be used for destination pixel.
  19970. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  19971. will have Xmap/Ymap video stream dimensions.
  19972. Xmap and Ymap input video streams are 32bit float pixel format, single channel.
  19973. @table @option
  19974. @item interp
  19975. Specify interpolation used for remapping of pixels.
  19976. Allowed values are @code{near} and @code{linear}.
  19977. Default value is @code{linear}.
  19978. @item fill
  19979. Specify the color of the unmapped pixels. For the syntax of this option,
  19980. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  19981. manual,ffmpeg-utils}. Default color is @code{black}.
  19982. @end table
  19983. @section roberts_opencl
  19984. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  19985. The filter accepts the following option:
  19986. @table @option
  19987. @item planes
  19988. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  19989. @item scale
  19990. Set value which will be multiplied with filtered result.
  19991. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  19992. @item delta
  19993. Set value which will be added to filtered result.
  19994. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  19995. @end table
  19996. @subsection Example
  19997. @itemize
  19998. @item
  19999. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  20000. @example
  20001. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  20002. @end example
  20003. @end itemize
  20004. @section sobel_opencl
  20005. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  20006. The filter accepts the following option:
  20007. @table @option
  20008. @item planes
  20009. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  20010. @item scale
  20011. Set value which will be multiplied with filtered result.
  20012. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  20013. @item delta
  20014. Set value which will be added to filtered result.
  20015. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  20016. @end table
  20017. @subsection Example
  20018. @itemize
  20019. @item
  20020. Apply sobel operator with scale set to 2 and delta set to 10
  20021. @example
  20022. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  20023. @end example
  20024. @end itemize
  20025. @section tonemap_opencl
  20026. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  20027. It accepts the following parameters:
  20028. @table @option
  20029. @item tonemap
  20030. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  20031. @item param
  20032. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  20033. @item desat
  20034. Apply desaturation for highlights that exceed this level of brightness. The
  20035. higher the parameter, the more color information will be preserved. This
  20036. setting helps prevent unnaturally blown-out colors for super-highlights, by
  20037. (smoothly) turning into white instead. This makes images feel more natural,
  20038. at the cost of reducing information about out-of-range colors.
  20039. The default value is 0.5, and the algorithm here is a little different from
  20040. the cpu version tonemap currently. A setting of 0.0 disables this option.
  20041. @item threshold
  20042. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  20043. is used to detect whether the scene has changed or not. If the distance between
  20044. the current frame average brightness and the current running average exceeds
  20045. a threshold value, we would re-calculate scene average and peak brightness.
  20046. The default value is 0.2.
  20047. @item format
  20048. Specify the output pixel format.
  20049. Currently supported formats are:
  20050. @table @var
  20051. @item p010
  20052. @item nv12
  20053. @end table
  20054. @item range, r
  20055. Set the output color range.
  20056. Possible values are:
  20057. @table @var
  20058. @item tv/mpeg
  20059. @item pc/jpeg
  20060. @end table
  20061. Default is same as input.
  20062. @item primaries, p
  20063. Set the output color primaries.
  20064. Possible values are:
  20065. @table @var
  20066. @item bt709
  20067. @item bt2020
  20068. @end table
  20069. Default is same as input.
  20070. @item transfer, t
  20071. Set the output transfer characteristics.
  20072. Possible values are:
  20073. @table @var
  20074. @item bt709
  20075. @item bt2020
  20076. @end table
  20077. Default is bt709.
  20078. @item matrix, m
  20079. Set the output colorspace matrix.
  20080. Possible value are:
  20081. @table @var
  20082. @item bt709
  20083. @item bt2020
  20084. @end table
  20085. Default is same as input.
  20086. @end table
  20087. @subsection Example
  20088. @itemize
  20089. @item
  20090. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  20091. @example
  20092. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  20093. @end example
  20094. @end itemize
  20095. @section unsharp_opencl
  20096. Sharpen or blur the input video.
  20097. It accepts the following parameters:
  20098. @table @option
  20099. @item luma_msize_x, lx
  20100. Set the luma matrix horizontal size.
  20101. Range is @code{[1, 23]} and default value is @code{5}.
  20102. @item luma_msize_y, ly
  20103. Set the luma matrix vertical size.
  20104. Range is @code{[1, 23]} and default value is @code{5}.
  20105. @item luma_amount, la
  20106. Set the luma effect strength.
  20107. Range is @code{[-10, 10]} and default value is @code{1.0}.
  20108. Negative values will blur the input video, while positive values will
  20109. sharpen it, a value of zero will disable the effect.
  20110. @item chroma_msize_x, cx
  20111. Set the chroma matrix horizontal size.
  20112. Range is @code{[1, 23]} and default value is @code{5}.
  20113. @item chroma_msize_y, cy
  20114. Set the chroma matrix vertical size.
  20115. Range is @code{[1, 23]} and default value is @code{5}.
  20116. @item chroma_amount, ca
  20117. Set the chroma effect strength.
  20118. Range is @code{[-10, 10]} and default value is @code{0.0}.
  20119. Negative values will blur the input video, while positive values will
  20120. sharpen it, a value of zero will disable the effect.
  20121. @end table
  20122. All parameters are optional and default to the equivalent of the
  20123. string '5:5:1.0:5:5:0.0'.
  20124. @subsection Examples
  20125. @itemize
  20126. @item
  20127. Apply strong luma sharpen effect:
  20128. @example
  20129. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  20130. @end example
  20131. @item
  20132. Apply a strong blur of both luma and chroma parameters:
  20133. @example
  20134. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  20135. @end example
  20136. @end itemize
  20137. @section xfade_opencl
  20138. Cross fade two videos with custom transition effect by using OpenCL.
  20139. It accepts the following options:
  20140. @table @option
  20141. @item transition
  20142. Set one of possible transition effects.
  20143. @table @option
  20144. @item custom
  20145. Select custom transition effect, the actual transition description
  20146. will be picked from source and kernel options.
  20147. @item fade
  20148. @item wipeleft
  20149. @item wiperight
  20150. @item wipeup
  20151. @item wipedown
  20152. @item slideleft
  20153. @item slideright
  20154. @item slideup
  20155. @item slidedown
  20156. Default transition is fade.
  20157. @end table
  20158. @item source
  20159. OpenCL program source file for custom transition.
  20160. @item kernel
  20161. Set name of kernel to use for custom transition from program source file.
  20162. @item duration
  20163. Set duration of video transition.
  20164. @item offset
  20165. Set time of start of transition relative to first video.
  20166. @end table
  20167. The program source file must contain a kernel function with the given name,
  20168. which will be run once for each plane of the output. Each run on a plane
  20169. gets enqueued as a separate 2D global NDRange with one work-item for each
  20170. pixel to be generated. The global ID offset for each work-item is therefore
  20171. the coordinates of a pixel in the destination image.
  20172. The kernel function needs to take the following arguments:
  20173. @itemize
  20174. @item
  20175. Destination image, @var{__write_only image2d_t}.
  20176. This image will become the output; the kernel should write all of it.
  20177. @item
  20178. First Source image, @var{__read_only image2d_t}.
  20179. Second Source image, @var{__read_only image2d_t}.
  20180. These are the most recent images on each input. The kernel may read from
  20181. them to generate the output, but they can't be written to.
  20182. @item
  20183. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  20184. @end itemize
  20185. Example programs:
  20186. @itemize
  20187. @item
  20188. Apply dots curtain transition effect:
  20189. @verbatim
  20190. __kernel void blend_images(__write_only image2d_t dst,
  20191. __read_only image2d_t src1,
  20192. __read_only image2d_t src2,
  20193. float progress)
  20194. {
  20195. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  20196. CLK_FILTER_LINEAR);
  20197. int2 p = (int2)(get_global_id(0), get_global_id(1));
  20198. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  20199. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  20200. rp = rp / dim;
  20201. float2 dots = (float2)(20.0, 20.0);
  20202. float2 center = (float2)(0,0);
  20203. float2 unused;
  20204. float4 val1 = read_imagef(src1, sampler, p);
  20205. float4 val2 = read_imagef(src2, sampler, p);
  20206. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  20207. write_imagef(dst, p, next ? val1 : val2);
  20208. }
  20209. @end verbatim
  20210. @end itemize
  20211. @c man end OPENCL VIDEO FILTERS
  20212. @chapter VAAPI Video Filters
  20213. @c man begin VAAPI VIDEO FILTERS
  20214. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  20215. To enable compilation of these filters you need to configure FFmpeg with
  20216. @code{--enable-vaapi}.
  20217. To use vaapi filters, you need to setup the vaapi device correctly. For more information, please read @url{https://trac.ffmpeg.org/wiki/Hardware/VAAPI}
  20218. @section overlay_vaapi
  20219. Overlay one video on the top of another.
  20220. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  20221. The filter accepts the following options:
  20222. @table @option
  20223. @item x
  20224. @item y
  20225. Set expressions for the x and y coordinates of the overlaid video
  20226. on the main video.
  20227. Default value is "0" for both expressions.
  20228. @item w
  20229. @item h
  20230. Set expressions for the width and height the overlaid video
  20231. on the main video.
  20232. Default values are 'overlay_iw' for 'w' and 'overlay_ih*w/overlay_iw' for 'h'.
  20233. The expressions can contain the following parameters:
  20234. @table @option
  20235. @item main_w, W
  20236. @item main_h, H
  20237. The main input width and height.
  20238. @item overlay_iw
  20239. @item overlay_ih
  20240. The overlay input width and height.
  20241. @item overlay_w, w
  20242. @item overlay_h, h
  20243. The overlay output width and height.
  20244. @item overlay_x, x
  20245. @item overlay_y, y
  20246. Position of the overlay layer inside of main
  20247. @end table
  20248. @item alpha
  20249. Set transparency of overlaid video. Allowed range is 0.0 to 1.0.
  20250. Higher value means lower transparency.
  20251. Default value is @code{1.0}.
  20252. @item eof_action
  20253. See @ref{framesync}.
  20254. @item shortest
  20255. See @ref{framesync}.
  20256. @item repeatlast
  20257. See @ref{framesync}.
  20258. @end table
  20259. This filter also supports the @ref{framesync} options.
  20260. @subsection Examples
  20261. @itemize
  20262. @item
  20263. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs for this filter are yuv420p format.
  20264. @example
  20265. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_vaapi" OUTPUT
  20266. @end example
  20267. @item
  20268. Overlay an image LOGO at the offset (200, 100) from the top-left corner of the INPUT video.
  20269. The inputs have same memory layout for color channels, the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  20270. @example
  20271. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_vaapi=x=200:y=100:w=400:h=300:alpha=1.0, hwdownload, format=nv12" OUTPUT
  20272. @end example
  20273. @end itemize
  20274. @section tonemap_vaapi
  20275. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  20276. It maps the dynamic range of HDR10 content to the SDR content.
  20277. It currently only accepts HDR10 as input.
  20278. It accepts the following parameters:
  20279. @table @option
  20280. @item format
  20281. Specify the output pixel format.
  20282. Currently supported formats are:
  20283. @table @var
  20284. @item p010
  20285. @item nv12
  20286. @end table
  20287. Default is nv12.
  20288. @item primaries, p
  20289. Set the output color primaries.
  20290. Default is same as input.
  20291. @item transfer, t
  20292. Set the output transfer characteristics.
  20293. Default is bt709.
  20294. @item matrix, m
  20295. Set the output colorspace matrix.
  20296. Default is same as input.
  20297. @end table
  20298. @subsection Example
  20299. @itemize
  20300. @item
  20301. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  20302. @example
  20303. tonemap_vaapi=format=p010:t=bt2020-10
  20304. @end example
  20305. @end itemize
  20306. @section hstack_vaapi
  20307. Stack input videos horizontally.
  20308. This is the VA-API variant of the @ref{hstack} filter, each input stream may
  20309. have different height, this filter will scale down/up each input stream while
  20310. keeping the orignal aspect.
  20311. It accepts the following options:
  20312. @table @option
  20313. @item inputs
  20314. See @ref{hstack}.
  20315. @item shortest
  20316. See @ref{hstack}.
  20317. @item height
  20318. Set height of output. If set to 0, this filter will set height of output to
  20319. height of the first input stream. Default value is 0.
  20320. @end table
  20321. @section vstack_vaapi
  20322. Stack input videos vertically.
  20323. This is the VA-API variant of the @ref{vstack} filter, each input stream may
  20324. have different width, this filter will scale down/up each input stream while
  20325. keeping the orignal aspect.
  20326. It accepts the following options:
  20327. @table @option
  20328. @item inputs
  20329. See @ref{vstack}.
  20330. @item shortest
  20331. See @ref{vstack}.
  20332. @item width
  20333. Set width of output. If set to 0, this filter will set width of output to
  20334. width of the first input stream. Default value is 0.
  20335. @end table
  20336. @section xstack_vaapi
  20337. Stack video inputs into custom layout.
  20338. This is the VA-API variant of the @ref{xstack} filter, each input stream may
  20339. have different size, this filter will scale down/up each input stream to the
  20340. given output size, or the size of the first input stream.
  20341. It accepts the following options:
  20342. @table @option
  20343. @item inputs
  20344. See @ref{xstack}.
  20345. @item shortest
  20346. See @ref{xstack}.
  20347. @item layout
  20348. See @ref{xstack}.
  20349. Moreover, this permits the user to supply output size for each input stream.
  20350. @example
  20351. xstack_vaapi=inputs=4:layout=0_0_1920x1080|0_h0_1920x1080|w0_0_1920x1080|w0_h0_1920x1080
  20352. @end example
  20353. @item grid
  20354. See @ref{xstack}.
  20355. @item grid_tile_size
  20356. Set output size for each input stream when @option{grid} is set. If this option
  20357. is not set, this filter will set output size by default to the size of the
  20358. first input stream. For the syntax of this option, check the
  20359. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20360. @item fill
  20361. See @ref{xstack}.
  20362. @end table
  20363. @c man end VAAPI VIDEO FILTERS
  20364. @chapter Video Sources
  20365. @c man begin VIDEO SOURCES
  20366. Below is a description of the currently available video sources.
  20367. @section buffer
  20368. Buffer video frames, and make them available to the filter chain.
  20369. This source is mainly intended for a programmatic use, in particular
  20370. through the interface defined in @file{libavfilter/buffersrc.h}.
  20371. It accepts the following parameters:
  20372. @table @option
  20373. @item video_size
  20374. Specify the size (width and height) of the buffered video frames. For the
  20375. syntax of this option, check the
  20376. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20377. @item width
  20378. The input video width.
  20379. @item height
  20380. The input video height.
  20381. @item pix_fmt
  20382. A string representing the pixel format of the buffered video frames.
  20383. It may be a number corresponding to a pixel format, or a pixel format
  20384. name.
  20385. @item time_base
  20386. Specify the timebase assumed by the timestamps of the buffered frames.
  20387. @item frame_rate
  20388. Specify the frame rate expected for the video stream.
  20389. @item pixel_aspect, sar
  20390. The sample (pixel) aspect ratio of the input video.
  20391. @item sws_param
  20392. This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};}
  20393. to the filtergraph description to specify swscale flags for automatically
  20394. inserted scalers. See @ref{Filtergraph syntax}.
  20395. @item hw_frames_ctx
  20396. When using a hardware pixel format, this should be a reference to an
  20397. AVHWFramesContext describing input frames.
  20398. @end table
  20399. For example:
  20400. @example
  20401. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  20402. @end example
  20403. will instruct the source to accept video frames with size 320x240 and
  20404. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  20405. square pixels (1:1 sample aspect ratio).
  20406. Since the pixel format with name "yuv410p" corresponds to the number 6
  20407. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  20408. this example corresponds to:
  20409. @example
  20410. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  20411. @end example
  20412. Alternatively, the options can be specified as a flat string, but this
  20413. syntax is deprecated:
  20414. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  20415. @section cellauto
  20416. Create a pattern generated by an elementary cellular automaton.
  20417. The initial state of the cellular automaton can be defined through the
  20418. @option{filename} and @option{pattern} options. If such options are
  20419. not specified an initial state is created randomly.
  20420. At each new frame a new row in the video is filled with the result of
  20421. the cellular automaton next generation. The behavior when the whole
  20422. frame is filled is defined by the @option{scroll} option.
  20423. This source accepts the following options:
  20424. @table @option
  20425. @item filename, f
  20426. Read the initial cellular automaton state, i.e. the starting row, from
  20427. the specified file.
  20428. In the file, each non-whitespace character is considered an alive
  20429. cell, a newline will terminate the row, and further characters in the
  20430. file will be ignored.
  20431. @item pattern, p
  20432. Read the initial cellular automaton state, i.e. the starting row, from
  20433. the specified string.
  20434. Each non-whitespace character in the string is considered an alive
  20435. cell, a newline will terminate the row, and further characters in the
  20436. string will be ignored.
  20437. @item rate, r
  20438. Set the video rate, that is the number of frames generated per second.
  20439. Default is 25.
  20440. @item random_fill_ratio, ratio
  20441. Set the random fill ratio for the initial cellular automaton row. It
  20442. is a floating point number value ranging from 0 to 1, defaults to
  20443. 1/PHI.
  20444. This option is ignored when a file or a pattern is specified.
  20445. @item random_seed, seed
  20446. Set the seed for filling randomly the initial row, must be an integer
  20447. included between 0 and UINT32_MAX. If not specified, or if explicitly
  20448. set to -1, the filter will try to use a good random seed on a best
  20449. effort basis.
  20450. @item rule
  20451. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  20452. Default value is 110.
  20453. @item size, s
  20454. Set the size of the output video. For the syntax of this option, check the
  20455. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20456. If @option{filename} or @option{pattern} is specified, the size is set
  20457. by default to the width of the specified initial state row, and the
  20458. height is set to @var{width} * PHI.
  20459. If @option{size} is set, it must contain the width of the specified
  20460. pattern string, and the specified pattern will be centered in the
  20461. larger row.
  20462. If a filename or a pattern string is not specified, the size value
  20463. defaults to "320x518" (used for a randomly generated initial state).
  20464. @item scroll
  20465. If set to 1, scroll the output upward when all the rows in the output
  20466. have been already filled. If set to 0, the new generated row will be
  20467. written over the top row just after the bottom row is filled.
  20468. Defaults to 1.
  20469. @item start_full, full
  20470. If set to 1, completely fill the output with generated rows before
  20471. outputting the first frame.
  20472. This is the default behavior, for disabling set the value to 0.
  20473. @item stitch
  20474. If set to 1, stitch the left and right row edges together.
  20475. This is the default behavior, for disabling set the value to 0.
  20476. @end table
  20477. @subsection Examples
  20478. @itemize
  20479. @item
  20480. Read the initial state from @file{pattern}, and specify an output of
  20481. size 200x400.
  20482. @example
  20483. cellauto=f=pattern:s=200x400
  20484. @end example
  20485. @item
  20486. Generate a random initial row with a width of 200 cells, with a fill
  20487. ratio of 2/3:
  20488. @example
  20489. cellauto=ratio=2/3:s=200x200
  20490. @end example
  20491. @item
  20492. Create a pattern generated by rule 18 starting by a single alive cell
  20493. centered on an initial row with width 100:
  20494. @example
  20495. cellauto=p=@@:s=100x400:full=0:rule=18
  20496. @end example
  20497. @item
  20498. Specify a more elaborated initial pattern:
  20499. @example
  20500. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  20501. @end example
  20502. @end itemize
  20503. @anchor{coreimagesrc}
  20504. @section coreimagesrc
  20505. Video source generated on GPU using Apple's CoreImage API on OSX.
  20506. This video source is a specialized version of the @ref{coreimage} video filter.
  20507. Use a core image generator at the beginning of the applied filterchain to
  20508. generate the content.
  20509. The coreimagesrc video source accepts the following options:
  20510. @table @option
  20511. @item list_generators
  20512. List all available generators along with all their respective options as well as
  20513. possible minimum and maximum values along with the default values.
  20514. @example
  20515. list_generators=true
  20516. @end example
  20517. @item size, s
  20518. Specify the size of the sourced video. For the syntax of this option, check the
  20519. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20520. The default value is @code{320x240}.
  20521. @item rate, r
  20522. Specify the frame rate of the sourced video, as the number of frames
  20523. generated per second. It has to be a string in the format
  20524. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  20525. number or a valid video frame rate abbreviation. The default value is
  20526. "25".
  20527. @item sar
  20528. Set the sample aspect ratio of the sourced video.
  20529. @item duration, d
  20530. Set the duration of the sourced video. See
  20531. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  20532. for the accepted syntax.
  20533. If not specified, or the expressed duration is negative, the video is
  20534. supposed to be generated forever.
  20535. @end table
  20536. Additionally, all options of the @ref{coreimage} video filter are accepted.
  20537. A complete filterchain can be used for further processing of the
  20538. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  20539. and examples for details.
  20540. @subsection Examples
  20541. @itemize
  20542. @item
  20543. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  20544. given as complete and escaped command-line for Apple's standard bash shell:
  20545. @example
  20546. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  20547. @end example
  20548. This example is equivalent to the QRCode example of @ref{coreimage} without the
  20549. need for a nullsrc video source.
  20550. @end itemize
  20551. @section ddagrab
  20552. Captures the Windows Desktop via Desktop Duplication API.
  20553. The filter exclusively returns D3D11 Hardware Frames, for on-gpu encoding
  20554. or processing. So an explicit @ref{hwdownload} is needed for any kind of
  20555. software processing.
  20556. It accepts the following options:
  20557. @table @option
  20558. @item output_idx
  20559. DXGI Output Index to capture.
  20560. Usually corresponds to the index Windows has given the screen minus one,
  20561. so it's starting at 0.
  20562. Defaults to output 0.
  20563. @item draw_mouse
  20564. Whether to draw the mouse cursor.
  20565. Defaults to true.
  20566. Only affects hardware cursors. If a game or application renders its own cursor,
  20567. it'll always be captured.
  20568. @item framerate
  20569. Framerate at which the desktop will be captured.
  20570. Defaults to 30 FPS.
  20571. @item video_size
  20572. Specify the size of the captured video.
  20573. Defaults to the full size of the screen.
  20574. Cropped from the bottom/right if smaller than screen size.
  20575. @item offset_x
  20576. Horizontal offset of the captured video.
  20577. @item offset_y
  20578. Vertical offset of the captured video.
  20579. @item output_fmt
  20580. Desired filter output format.
  20581. Defaults to 8 Bit BGRA.
  20582. It accepts the following values:
  20583. @table @samp
  20584. @item auto
  20585. Passes all supported output formats to DDA and returns what DDA decides to use.
  20586. @item 8bit
  20587. @item bgra
  20588. 8 Bit formats always work, and DDA will convert to them if neccesary.
  20589. @item 10bit
  20590. @item x2bgr10
  20591. Filter initialization will fail if 10 bit format is requested but unavailable.
  20592. @end table
  20593. @end table
  20594. @subsection Examples
  20595. Capture primary screen and encode using nvenc:
  20596. @example
  20597. ffmpeg -f lavfi -i ddagrab -c:v h264_nvenc -cq 18 output.mp4
  20598. @end example
  20599. You can also skip the lavfi device and directly use the filter.
  20600. Also demonstrates downloading the frame and encoding with libx264.
  20601. Explicit output format specification is required in this case:
  20602. @example
  20603. ffmpeg -filter_complex ddagrab=output_idx=1:framerate=60,hwdownload,format=bgra -c:v libx264 -crf 18 output.mp4
  20604. @end example
  20605. If you want to capture only a subsection of the desktop, this can be achieved
  20606. by specifying a smaller size and its offsets into the screen:
  20607. @example
  20608. ddagrab=video_size=800x600:offset_x=100:offset_y=100
  20609. @end example
  20610. @section gradients
  20611. Generate several gradients.
  20612. @table @option
  20613. @item size, s
  20614. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  20615. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  20616. @item rate, r
  20617. Set frame rate, expressed as number of frames per second. Default
  20618. value is "25".
  20619. @item c0, c1, c2, c3, c4, c5, c6, c7
  20620. Set 8 colors. Default values for colors is to pick random one.
  20621. @item x0, y0, y0, y1
  20622. Set gradient line source and destination points. If negative or out of range, random ones
  20623. are picked.
  20624. @item nb_colors, n
  20625. Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.
  20626. @item seed
  20627. Set seed for picking gradient line points.
  20628. @item duration, d
  20629. Set the duration of the sourced video. See
  20630. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  20631. for the accepted syntax.
  20632. If not specified, or the expressed duration is negative, the video is
  20633. supposed to be generated forever.
  20634. @item speed
  20635. Set speed of gradients rotation.
  20636. @item type, t
  20637. Set type of gradients, can be @code{linear} or @code{radial} or @code{circular} or @code{spiral}.
  20638. @end table
  20639. @section mandelbrot
  20640. Generate a Mandelbrot set fractal, and progressively zoom towards the
  20641. point specified with @var{start_x} and @var{start_y}.
  20642. This source accepts the following options:
  20643. @table @option
  20644. @item end_pts
  20645. Set the terminal pts value. Default value is 400.
  20646. @item end_scale
  20647. Set the terminal scale value.
  20648. Must be a floating point value. Default value is 0.3.
  20649. @item inner
  20650. Set the inner coloring mode, that is the algorithm used to draw the
  20651. Mandelbrot fractal internal region.
  20652. It shall assume one of the following values:
  20653. @table @option
  20654. @item black
  20655. Set black mode.
  20656. @item convergence
  20657. Show time until convergence.
  20658. @item mincol
  20659. Set color based on point closest to the origin of the iterations.
  20660. @item period
  20661. Set period mode.
  20662. @end table
  20663. Default value is @var{mincol}.
  20664. @item bailout
  20665. Set the bailout value. Default value is 10.0.
  20666. @item maxiter
  20667. Set the maximum of iterations performed by the rendering
  20668. algorithm. Default value is 7189.
  20669. @item outer
  20670. Set outer coloring mode.
  20671. It shall assume one of following values:
  20672. @table @option
  20673. @item iteration_count
  20674. Set iteration count mode.
  20675. @item normalized_iteration_count
  20676. set normalized iteration count mode.
  20677. @end table
  20678. Default value is @var{normalized_iteration_count}.
  20679. @item rate, r
  20680. Set frame rate, expressed as number of frames per second. Default
  20681. value is "25".
  20682. @item size, s
  20683. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  20684. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  20685. @item start_scale
  20686. Set the initial scale value. Default value is 3.0.
  20687. @item start_x
  20688. Set the initial x position. Must be a floating point value between
  20689. -100 and 100. Default value is -0.743643887037158704752191506114774.
  20690. @item start_y
  20691. Set the initial y position. Must be a floating point value between
  20692. -100 and 100. Default value is -0.131825904205311970493132056385139.
  20693. @end table
  20694. @section mptestsrc
  20695. Generate various test patterns, as generated by the MPlayer test filter.
  20696. The size of the generated video is fixed, and is 256x256.
  20697. This source is useful in particular for testing encoding features.
  20698. This source accepts the following options:
  20699. @table @option
  20700. @item rate, r
  20701. Specify the frame rate of the sourced video, as the number of frames
  20702. generated per second. It has to be a string in the format
  20703. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  20704. number or a valid video frame rate abbreviation. The default value is
  20705. "25".
  20706. @item duration, d
  20707. Set the duration of the sourced video. See
  20708. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  20709. for the accepted syntax.
  20710. If not specified, or the expressed duration is negative, the video is
  20711. supposed to be generated forever.
  20712. @item test, t
  20713. Set the number or the name of the test to perform. Supported tests are:
  20714. @table @option
  20715. @item dc_luma
  20716. @item dc_chroma
  20717. @item freq_luma
  20718. @item freq_chroma
  20719. @item amp_luma
  20720. @item amp_chroma
  20721. @item cbp
  20722. @item mv
  20723. @item ring1
  20724. @item ring2
  20725. @item all
  20726. @item max_frames, m
  20727. Set the maximum number of frames generated for each test, default value is 30.
  20728. @end table
  20729. Default value is "all", which will cycle through the list of all tests.
  20730. @end table
  20731. Some examples:
  20732. @example
  20733. mptestsrc=t=dc_luma
  20734. @end example
  20735. will generate a "dc_luma" test pattern.
  20736. @section frei0r_src
  20737. Provide a frei0r source.
  20738. To enable compilation of this filter you need to install the frei0r
  20739. header and configure FFmpeg with @code{--enable-frei0r}.
  20740. This source accepts the following parameters:
  20741. @table @option
  20742. @item size
  20743. The size of the video to generate. For the syntax of this option, check the
  20744. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20745. @item framerate
  20746. The framerate of the generated video. It may be a string of the form
  20747. @var{num}/@var{den} or a frame rate abbreviation.
  20748. @item filter_name
  20749. The name to the frei0r source to load. For more information regarding frei0r and
  20750. how to set the parameters, read the @ref{frei0r} section in the video filters
  20751. documentation.
  20752. @item filter_params
  20753. A '|'-separated list of parameters to pass to the frei0r source.
  20754. @end table
  20755. For example, to generate a frei0r partik0l source with size 200x200
  20756. and frame rate 10 which is overlaid on the overlay filter main input:
  20757. @example
  20758. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  20759. @end example
  20760. @section life
  20761. Generate a life pattern.
  20762. This source is based on a generalization of John Conway's life game.
  20763. The sourced input represents a life grid, each pixel represents a cell
  20764. which can be in one of two possible states, alive or dead. Every cell
  20765. interacts with its eight neighbours, which are the cells that are
  20766. horizontally, vertically, or diagonally adjacent.
  20767. At each interaction the grid evolves according to the adopted rule,
  20768. which specifies the number of neighbor alive cells which will make a
  20769. cell stay alive or born. The @option{rule} option allows one to specify
  20770. the rule to adopt.
  20771. This source accepts the following options:
  20772. @table @option
  20773. @item filename, f
  20774. Set the file from which to read the initial grid state. In the file,
  20775. each non-whitespace character is considered an alive cell, and newline
  20776. is used to delimit the end of each row.
  20777. If this option is not specified, the initial grid is generated
  20778. randomly.
  20779. @item rate, r
  20780. Set the video rate, that is the number of frames generated per second.
  20781. Default is 25.
  20782. @item random_fill_ratio, ratio
  20783. Set the random fill ratio for the initial random grid. It is a
  20784. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  20785. It is ignored when a file is specified.
  20786. @item random_seed, seed
  20787. Set the seed for filling the initial random grid, must be an integer
  20788. included between 0 and UINT32_MAX. If not specified, or if explicitly
  20789. set to -1, the filter will try to use a good random seed on a best
  20790. effort basis.
  20791. @item rule
  20792. Set the life rule.
  20793. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  20794. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  20795. @var{NS} specifies the number of alive neighbor cells which make a
  20796. live cell stay alive, and @var{NB} the number of alive neighbor cells
  20797. which make a dead cell to become alive (i.e. to "born").
  20798. "s" and "b" can be used in place of "S" and "B", respectively.
  20799. Alternatively a rule can be specified by an 18-bits integer. The 9
  20800. high order bits are used to encode the next cell state if it is alive
  20801. for each number of neighbor alive cells, the low order bits specify
  20802. the rule for "borning" new cells. Higher order bits encode for an
  20803. higher number of neighbor cells.
  20804. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  20805. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  20806. Default value is "S23/B3", which is the original Conway's game of life
  20807. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  20808. cells, and will born a new cell if there are three alive cells around
  20809. a dead cell.
  20810. @item size, s
  20811. Set the size of the output video. For the syntax of this option, check the
  20812. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20813. If @option{filename} is specified, the size is set by default to the
  20814. same size of the input file. If @option{size} is set, it must contain
  20815. the size specified in the input file, and the initial grid defined in
  20816. that file is centered in the larger resulting area.
  20817. If a filename is not specified, the size value defaults to "320x240"
  20818. (used for a randomly generated initial grid).
  20819. @item stitch
  20820. If set to 1, stitch the left and right grid edges together, and the
  20821. top and bottom edges also. Defaults to 1.
  20822. @item mold
  20823. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  20824. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  20825. value from 0 to 255.
  20826. @item life_color
  20827. Set the color of living (or new born) cells.
  20828. @item death_color
  20829. Set the color of dead cells. If @option{mold} is set, this is the first color
  20830. used to represent a dead cell.
  20831. @item mold_color
  20832. Set mold color, for definitely dead and moldy cells.
  20833. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  20834. ffmpeg-utils manual,ffmpeg-utils}.
  20835. @end table
  20836. @subsection Examples
  20837. @itemize
  20838. @item
  20839. Read a grid from @file{pattern}, and center it on a grid of size
  20840. 300x300 pixels:
  20841. @example
  20842. life=f=pattern:s=300x300
  20843. @end example
  20844. @item
  20845. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  20846. @example
  20847. life=ratio=2/3:s=200x200
  20848. @end example
  20849. @item
  20850. Specify a custom rule for evolving a randomly generated grid:
  20851. @example
  20852. life=rule=S14/B34
  20853. @end example
  20854. @item
  20855. Full example with slow death effect (mold) using @command{ffplay}:
  20856. @example
  20857. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  20858. @end example
  20859. @end itemize
  20860. @anchor{allrgb}
  20861. @anchor{allyuv}
  20862. @anchor{color}
  20863. @anchor{colorchart}
  20864. @anchor{colorspectrum}
  20865. @anchor{haldclutsrc}
  20866. @anchor{nullsrc}
  20867. @anchor{pal75bars}
  20868. @anchor{pal100bars}
  20869. @anchor{rgbtestsrc}
  20870. @anchor{smptebars}
  20871. @anchor{smptehdbars}
  20872. @anchor{testsrc}
  20873. @anchor{testsrc2}
  20874. @anchor{yuvtestsrc}
  20875. @section allrgb, allyuv, color, colorchart, colorspectrum, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  20876. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  20877. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  20878. The @code{color} source provides an uniformly colored input.
  20879. The @code{colorchart} source provides a colors checker chart.
  20880. The @code{colorspectrum} source provides a color spectrum input.
  20881. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  20882. @ref{haldclut} filter.
  20883. The @code{nullsrc} source returns unprocessed video frames. It is
  20884. mainly useful to be employed in analysis / debugging tools, or as the
  20885. source for filters which ignore the input data.
  20886. The @code{pal75bars} source generates a color bars pattern, based on
  20887. EBU PAL recommendations with 75% color levels.
  20888. The @code{pal100bars} source generates a color bars pattern, based on
  20889. EBU PAL recommendations with 100% color levels.
  20890. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  20891. detecting RGB vs BGR issues. You should see a red, green and blue
  20892. stripe from top to bottom.
  20893. The @code{smptebars} source generates a color bars pattern, based on
  20894. the SMPTE Engineering Guideline EG 1-1990.
  20895. The @code{smptehdbars} source generates a color bars pattern, based on
  20896. the SMPTE RP 219-2002.
  20897. The @code{testsrc} source generates a test video pattern, showing a
  20898. color pattern, a scrolling gradient and a timestamp. This is mainly
  20899. intended for testing purposes.
  20900. The @code{testsrc2} source is similar to testsrc, but supports more
  20901. pixel formats instead of just @code{rgb24}. This allows using it as an
  20902. input for other tests without requiring a format conversion.
  20903. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  20904. see a y, cb and cr stripe from top to bottom.
  20905. The sources accept the following parameters:
  20906. @table @option
  20907. @item level
  20908. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  20909. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  20910. pixels to be used as identity matrix for 3D lookup tables. Each component is
  20911. coded on a @code{1/(N*N)} scale.
  20912. @item color, c
  20913. Specify the color of the source, only available in the @code{color}
  20914. source. For the syntax of this option, check the
  20915. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20916. @item size, s
  20917. Specify the size of the sourced video. For the syntax of this option, check the
  20918. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20919. The default value is @code{320x240}.
  20920. This option is not available with the @code{allrgb}, @code{allyuv}, and
  20921. @code{haldclutsrc} filters.
  20922. @item rate, r
  20923. Specify the frame rate of the sourced video, as the number of frames
  20924. generated per second. It has to be a string in the format
  20925. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  20926. number or a valid video frame rate abbreviation. The default value is
  20927. "25".
  20928. @item duration, d
  20929. Set the duration of the sourced video. See
  20930. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  20931. for the accepted syntax.
  20932. If not specified, or the expressed duration is negative, the video is
  20933. supposed to be generated forever.
  20934. Since the frame rate is used as time base, all frames including the last one
  20935. will have their full duration. If the specified duration is not a multiple
  20936. of the frame duration, it will be rounded up.
  20937. @item sar
  20938. Set the sample aspect ratio of the sourced video.
  20939. @item alpha
  20940. Specify the alpha (opacity) of the background, only available in the
  20941. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  20942. 255 (fully opaque, the default).
  20943. @item decimals, n
  20944. Set the number of decimals to show in the timestamp, only available in the
  20945. @code{testsrc} source.
  20946. The displayed timestamp value will correspond to the original
  20947. timestamp value multiplied by the power of 10 of the specified
  20948. value. Default value is 0.
  20949. @item type
  20950. Set the type of the color spectrum, only available in the
  20951. @code{colorspectrum} source. Can be one of the following:
  20952. @table @samp
  20953. @item black
  20954. @item white
  20955. @item all
  20956. @end table
  20957. @item patch_size
  20958. Set patch size of single color patch, only available in the
  20959. @code{colorchart} source. Default is @code{64x64}.
  20960. @item preset
  20961. Set colorchecker colors preset, only available in the
  20962. @code{colorchart} source.
  20963. Available values are:
  20964. @table @samp
  20965. @item reference
  20966. @item skintones
  20967. @end table
  20968. Default value is @code{reference}.
  20969. @end table
  20970. @subsection Examples
  20971. @itemize
  20972. @item
  20973. Generate a video with a duration of 5.3 seconds, with size
  20974. 176x144 and a frame rate of 10 frames per second:
  20975. @example
  20976. testsrc=duration=5.3:size=qcif:rate=10
  20977. @end example
  20978. @item
  20979. The following graph description will generate a red source
  20980. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  20981. frames per second:
  20982. @example
  20983. color=c=red@@0.2:s=qcif:r=10
  20984. @end example
  20985. @item
  20986. If the input content is to be ignored, @code{nullsrc} can be used. The
  20987. following command generates noise in the luminance plane by employing
  20988. the @code{geq} filter:
  20989. @example
  20990. nullsrc=s=256x256, geq=random(1)*255:128:128
  20991. @end example
  20992. @end itemize
  20993. @subsection Commands
  20994. The @code{color} source supports the following commands:
  20995. @table @option
  20996. @item c, color
  20997. Set the color of the created image. Accepts the same syntax of the
  20998. corresponding @option{color} option.
  20999. @end table
  21000. @section openclsrc
  21001. Generate video using an OpenCL program.
  21002. @table @option
  21003. @item source
  21004. OpenCL program source file.
  21005. @item kernel
  21006. Kernel name in program.
  21007. @item size, s
  21008. Size of frames to generate. This must be set.
  21009. @item format
  21010. Pixel format to use for the generated frames. This must be set.
  21011. @item rate, r
  21012. Number of frames generated every second. Default value is '25'.
  21013. @end table
  21014. For details of how the program loading works, see the @ref{program_opencl}
  21015. filter.
  21016. Example programs:
  21017. @itemize
  21018. @item
  21019. Generate a colour ramp by setting pixel values from the position of the pixel
  21020. in the output image. (Note that this will work with all pixel formats, but
  21021. the generated output will not be the same.)
  21022. @verbatim
  21023. __kernel void ramp(__write_only image2d_t dst,
  21024. unsigned int index)
  21025. {
  21026. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  21027. float4 val;
  21028. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  21029. write_imagef(dst, loc, val);
  21030. }
  21031. @end verbatim
  21032. @item
  21033. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  21034. @verbatim
  21035. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  21036. unsigned int index)
  21037. {
  21038. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  21039. float4 value = 0.0f;
  21040. int x = loc.x + index;
  21041. int y = loc.y + index;
  21042. while (x > 0 || y > 0) {
  21043. if (x % 3 == 1 && y % 3 == 1) {
  21044. value = 1.0f;
  21045. break;
  21046. }
  21047. x /= 3;
  21048. y /= 3;
  21049. }
  21050. write_imagef(dst, loc, value);
  21051. }
  21052. @end verbatim
  21053. @end itemize
  21054. @section sierpinski
  21055. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  21056. This source accepts the following options:
  21057. @table @option
  21058. @item size, s
  21059. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  21060. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  21061. @item rate, r
  21062. Set frame rate, expressed as number of frames per second. Default
  21063. value is "25".
  21064. @item seed
  21065. Set seed which is used for random panning.
  21066. @item jump
  21067. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  21068. @item type
  21069. Set fractal type, can be default @code{carpet} or @code{triangle}.
  21070. @end table
  21071. @c man end VIDEO SOURCES
  21072. @chapter Video Sinks
  21073. @c man begin VIDEO SINKS
  21074. Below is a description of the currently available video sinks.
  21075. @section buffersink
  21076. Buffer video frames, and make them available to the end of the filter
  21077. graph.
  21078. This sink is mainly intended for programmatic use, in particular
  21079. through the interface defined in @file{libavfilter/buffersink.h}
  21080. or the options system.
  21081. It accepts a pointer to an AVBufferSinkContext structure, which
  21082. defines the incoming buffers' formats, to be passed as the opaque
  21083. parameter to @code{avfilter_init_filter} for initialization.
  21084. @section nullsink
  21085. Null video sink: do absolutely nothing with the input video. It is
  21086. mainly useful as a template and for use in analysis / debugging
  21087. tools.
  21088. @c man end VIDEO SINKS
  21089. @chapter Multimedia Filters
  21090. @c man begin MULTIMEDIA FILTERS
  21091. Below is a description of the currently available multimedia filters.
  21092. @section a3dscope
  21093. Convert input audio to 3d scope video output.
  21094. The filter accepts the following options:
  21095. @table @option
  21096. @item rate, r
  21097. Set frame rate, expressed as number of frames per second. Default
  21098. value is "25".
  21099. @item size, s
  21100. Specify the video size for the output. For the syntax of this option, check the
  21101. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21102. Default value is @code{hd720}.
  21103. @item fov
  21104. Set the camera field of view. Default is 90 degrees.
  21105. Allowed range is from 40 to 150.
  21106. @item roll
  21107. Set the camera roll.
  21108. @item pitch
  21109. Set the camera pitch.
  21110. @item yaw
  21111. Set the camera yaw.
  21112. @item xzoom
  21113. Set the camera zoom on X-axis.
  21114. @item yzoom
  21115. Set the camera zoom on Y-axis.
  21116. @item zzoom
  21117. Set the camera zoom on Z-axis.
  21118. @item xpos
  21119. Set the camera position on X-axis.
  21120. @item ypos
  21121. Set the camera position on Y-axis.
  21122. @item zpos
  21123. Set the camera position on Z-axis.
  21124. @item length
  21125. Set the length of displayed audio waves in number of frames.
  21126. @end table
  21127. @subsection Commands
  21128. Filter supports the some above options as @ref{commands}.
  21129. @section abitscope
  21130. Convert input audio to a video output, displaying the audio bit scope.
  21131. The filter accepts the following options:
  21132. @table @option
  21133. @item rate, r
  21134. Set frame rate, expressed as number of frames per second. Default
  21135. value is "25".
  21136. @item size, s
  21137. Specify the video size for the output. For the syntax of this option, check the
  21138. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21139. Default value is @code{1024x256}.
  21140. @item colors
  21141. Specify list of colors separated by space or by '|' which will be used to
  21142. draw channels. Unrecognized or missing colors will be replaced
  21143. by white color.
  21144. @item mode, m
  21145. Set output mode. Can be @code{bars} or @code{trace}. Default is @code{bars}.
  21146. @end table
  21147. @section adrawgraph
  21148. Draw a graph using input audio metadata.
  21149. See @ref{drawgraph}
  21150. @section agraphmonitor
  21151. See @ref{graphmonitor}.
  21152. @section ahistogram
  21153. Convert input audio to a video output, displaying the volume histogram.
  21154. The filter accepts the following options:
  21155. @table @option
  21156. @item dmode
  21157. Specify how histogram is calculated.
  21158. It accepts the following values:
  21159. @table @samp
  21160. @item single
  21161. Use single histogram for all channels.
  21162. @item separate
  21163. Use separate histogram for each channel.
  21164. @end table
  21165. Default is @code{single}.
  21166. @item rate, r
  21167. Set frame rate, expressed as number of frames per second. Default
  21168. value is "25".
  21169. @item size, s
  21170. Specify the video size for the output. For the syntax of this option, check the
  21171. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21172. Default value is @code{hd720}.
  21173. @item scale
  21174. Set display scale.
  21175. It accepts the following values:
  21176. @table @samp
  21177. @item log
  21178. logarithmic
  21179. @item sqrt
  21180. square root
  21181. @item cbrt
  21182. cubic root
  21183. @item lin
  21184. linear
  21185. @item rlog
  21186. reverse logarithmic
  21187. @end table
  21188. Default is @code{log}.
  21189. @item ascale
  21190. Set amplitude scale.
  21191. It accepts the following values:
  21192. @table @samp
  21193. @item log
  21194. logarithmic
  21195. @item lin
  21196. linear
  21197. @end table
  21198. Default is @code{log}.
  21199. @item acount
  21200. Set how much frames to accumulate in histogram.
  21201. Default is 1. Setting this to -1 accumulates all frames.
  21202. @item rheight
  21203. Set histogram ratio of window height.
  21204. @item slide
  21205. Set sonogram sliding.
  21206. It accepts the following values:
  21207. @table @samp
  21208. @item replace
  21209. replace old rows with new ones.
  21210. @item scroll
  21211. scroll from top to bottom.
  21212. @end table
  21213. Default is @code{replace}.
  21214. @item hmode
  21215. Set histogram mode.
  21216. It accepts the following values:
  21217. @table @samp
  21218. @item abs
  21219. Use absolute values of samples.
  21220. @item sign
  21221. Use untouched values of samples.
  21222. @end table
  21223. Default is @code{abs}.
  21224. @end table
  21225. @section aphasemeter
  21226. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  21227. representing mean phase of current audio frame. A video output can also be produced and is
  21228. enabled by default. The audio is passed through as first output.
  21229. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  21230. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  21231. and @code{1} means channels are in phase.
  21232. The filter accepts the following options, all related to its video output:
  21233. @table @option
  21234. @item rate, r
  21235. Set the output frame rate. Default value is @code{25}.
  21236. @item size, s
  21237. Set the video size for the output. For the syntax of this option, check the
  21238. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21239. Default value is @code{800x400}.
  21240. @item rc
  21241. @item gc
  21242. @item bc
  21243. Specify the red, green, blue contrast. Default values are @code{2},
  21244. @code{7} and @code{1}.
  21245. Allowed range is @code{[0, 255]}.
  21246. @item mpc
  21247. Set color which will be used for drawing median phase. If color is
  21248. @code{none} which is default, no median phase value will be drawn.
  21249. @item video
  21250. Enable video output. Default is enabled.
  21251. @end table
  21252. @subsection phasing detection
  21253. The filter also detects out of phase and mono sequences in stereo streams.
  21254. It logs the sequence start, end and duration when it lasts longer or as long as the minimum set.
  21255. The filter accepts the following options for this detection:
  21256. @table @option
  21257. @item phasing
  21258. Enable mono and out of phase detection. Default is disabled.
  21259. @item tolerance, t
  21260. Set phase tolerance for mono detection, in amplitude ratio. Default is @code{0}.
  21261. Allowed range is @code{[0, 1]}.
  21262. @item angle, a
  21263. Set angle threshold for out of phase detection, in degree. Default is @code{170}.
  21264. Allowed range is @code{[90, 180]}.
  21265. @item duration, d
  21266. Set mono or out of phase duration until notification, expressed in seconds. Default is @code{2}.
  21267. @end table
  21268. @subsection Examples
  21269. @itemize
  21270. @item
  21271. Complete example with @command{ffmpeg} to detect 1 second of mono with 0.001 phase tolerance:
  21272. @example
  21273. ffmpeg -i stereo.wav -af aphasemeter=video=0:phasing=1:duration=1:tolerance=0.001 -f null -
  21274. @end example
  21275. @end itemize
  21276. @section avectorscope
  21277. Convert input audio to a video output, representing the audio vector
  21278. scope.
  21279. The filter is used to measure the difference between channels of stereo
  21280. audio stream. A monaural signal, consisting of identical left and right
  21281. signal, results in straight vertical line. Any stereo separation is visible
  21282. as a deviation from this line, creating a Lissajous figure.
  21283. If the straight (or deviation from it) but horizontal line appears this
  21284. indicates that the left and right channels are out of phase.
  21285. The filter accepts the following options:
  21286. @table @option
  21287. @item mode, m
  21288. Set the vectorscope mode.
  21289. Available values are:
  21290. @table @samp
  21291. @item lissajous
  21292. Lissajous rotated by 45 degrees.
  21293. @item lissajous_xy
  21294. Same as above but not rotated.
  21295. @item polar
  21296. Shape resembling half of circle.
  21297. @end table
  21298. Default value is @samp{lissajous}.
  21299. @item size, s
  21300. Set the video size for the output. For the syntax of this option, check the
  21301. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21302. Default value is @code{400x400}.
  21303. @item rate, r
  21304. Set the output frame rate. Default value is @code{25}.
  21305. @item rc
  21306. @item gc
  21307. @item bc
  21308. @item ac
  21309. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  21310. @code{160}, @code{80} and @code{255}.
  21311. Allowed range is @code{[0, 255]}.
  21312. @item rf
  21313. @item gf
  21314. @item bf
  21315. @item af
  21316. Specify the red, green, blue and alpha fade. Default values are @code{15},
  21317. @code{10}, @code{5} and @code{5}.
  21318. Allowed range is @code{[0, 255]}.
  21319. @item zoom
  21320. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  21321. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  21322. @item draw
  21323. Set the vectorscope drawing mode.
  21324. Available values are:
  21325. @table @samp
  21326. @item dot
  21327. Draw dot for each sample.
  21328. @item line
  21329. Draw line between previous and current sample.
  21330. @item aaline
  21331. Draw anti-aliased line between previous and current sample.
  21332. @end table
  21333. Default value is @samp{dot}.
  21334. @item scale
  21335. Specify amplitude scale of audio samples.
  21336. Available values are:
  21337. @table @samp
  21338. @item lin
  21339. Linear.
  21340. @item sqrt
  21341. Square root.
  21342. @item cbrt
  21343. Cubic root.
  21344. @item log
  21345. Logarithmic.
  21346. @end table
  21347. @item swap
  21348. Swap left channel axis with right channel axis.
  21349. @item mirror
  21350. Mirror axis.
  21351. @table @samp
  21352. @item none
  21353. No mirror.
  21354. @item x
  21355. Mirror only x axis.
  21356. @item y
  21357. Mirror only y axis.
  21358. @item xy
  21359. Mirror both axis.
  21360. @end table
  21361. @end table
  21362. @subsection Examples
  21363. @itemize
  21364. @item
  21365. Complete example using @command{ffplay}:
  21366. @example
  21367. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  21368. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  21369. @end example
  21370. @end itemize
  21371. @subsection Commands
  21372. This filter supports the all above options as commands except options @code{size} and @code{rate}.
  21373. @section bench, abench
  21374. Benchmark part of a filtergraph.
  21375. The filter accepts the following options:
  21376. @table @option
  21377. @item action
  21378. Start or stop a timer.
  21379. Available values are:
  21380. @table @samp
  21381. @item start
  21382. Get the current time, set it as frame metadata (using the key
  21383. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  21384. @item stop
  21385. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  21386. the input frame metadata to get the time difference. Time difference, average,
  21387. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  21388. @code{min}) are then printed. The timestamps are expressed in seconds.
  21389. @end table
  21390. @end table
  21391. @subsection Examples
  21392. @itemize
  21393. @item
  21394. Benchmark @ref{selectivecolor} filter:
  21395. @example
  21396. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  21397. @end example
  21398. @end itemize
  21399. @section concat
  21400. Concatenate audio and video streams, joining them together one after the
  21401. other.
  21402. The filter works on segments of synchronized video and audio streams. All
  21403. segments must have the same number of streams of each type, and that will
  21404. also be the number of streams at output.
  21405. The filter accepts the following options:
  21406. @table @option
  21407. @item n
  21408. Set the number of segments. Default is 2.
  21409. @item v
  21410. Set the number of output video streams, that is also the number of video
  21411. streams in each segment. Default is 1.
  21412. @item a
  21413. Set the number of output audio streams, that is also the number of audio
  21414. streams in each segment. Default is 0.
  21415. @item unsafe
  21416. Activate unsafe mode: do not fail if segments have a different format.
  21417. @end table
  21418. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  21419. @var{a} audio outputs.
  21420. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  21421. segment, in the same order as the outputs, then the inputs for the second
  21422. segment, etc.
  21423. Related streams do not always have exactly the same duration, for various
  21424. reasons including codec frame size or sloppy authoring. For that reason,
  21425. related synchronized streams (e.g. a video and its audio track) should be
  21426. concatenated at once. The concat filter will use the duration of the longest
  21427. stream in each segment (except the last one), and if necessary pad shorter
  21428. audio streams with silence.
  21429. For this filter to work correctly, all segments must start at timestamp 0.
  21430. All corresponding streams must have the same parameters in all segments; the
  21431. filtering system will automatically select a common pixel format for video
  21432. streams, and a common sample format, sample rate and channel layout for
  21433. audio streams, but other settings, such as resolution, must be converted
  21434. explicitly by the user.
  21435. Different frame rates are acceptable but will result in variable frame rate
  21436. at output; be sure to configure the output file to handle it.
  21437. @subsection Examples
  21438. @itemize
  21439. @item
  21440. Concatenate an opening, an episode and an ending, all in bilingual version
  21441. (video in stream 0, audio in streams 1 and 2):
  21442. @example
  21443. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  21444. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  21445. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  21446. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  21447. @end example
  21448. @item
  21449. Concatenate two parts, handling audio and video separately, using the
  21450. (a)movie sources, and adjusting the resolution:
  21451. @example
  21452. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  21453. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  21454. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  21455. @end example
  21456. Note that a desync will happen at the stitch if the audio and video streams
  21457. do not have exactly the same duration in the first file.
  21458. @end itemize
  21459. @subsection Commands
  21460. This filter supports the following commands:
  21461. @table @option
  21462. @item next
  21463. Close the current segment and step to the next one
  21464. @end table
  21465. @anchor{ebur128}
  21466. @section ebur128
  21467. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  21468. level. By default, it logs a message at a frequency of 10Hz with the
  21469. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  21470. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  21471. The filter can only analyze streams which have
  21472. sample format is double-precision floating point. The input stream will be converted to
  21473. this specification, if needed. Users may need to insert aformat and/or aresample filters
  21474. after this filter to obtain the original parameters.
  21475. The filter also has a video output (see the @var{video} option) with a real
  21476. time graph to observe the loudness evolution. The graphic contains the logged
  21477. message mentioned above, so it is not printed anymore when this option is set,
  21478. unless the verbose logging is set. The main graphing area contains the
  21479. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  21480. the momentary loudness (400 milliseconds), but can optionally be configured
  21481. to instead display short-term loudness (see @var{gauge}).
  21482. The green area marks a +/- 1LU target range around the target loudness
  21483. (-23LUFS by default, unless modified through @var{target}).
  21484. More information about the Loudness Recommendation EBU R128 on
  21485. @url{http://tech.ebu.ch/loudness}.
  21486. The filter accepts the following options:
  21487. @table @option
  21488. @item video
  21489. Activate the video output. The audio stream is passed unchanged whether this
  21490. option is set or no. The video stream will be the first output stream if
  21491. activated. Default is @code{0}.
  21492. @item size
  21493. Set the video size. This option is for video only. For the syntax of this
  21494. option, check the
  21495. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21496. Default and minimum resolution is @code{640x480}.
  21497. @item meter
  21498. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  21499. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  21500. other integer value between this range is allowed.
  21501. @item metadata
  21502. Set metadata injection. If set to @code{1}, the audio input will be segmented
  21503. into 100ms output frames, each of them containing various loudness information
  21504. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  21505. Default is @code{0}.
  21506. @item framelog
  21507. Force the frame logging level.
  21508. Available values are:
  21509. @table @samp
  21510. @item quiet
  21511. logging disabled
  21512. @item info
  21513. information logging level
  21514. @item verbose
  21515. verbose logging level
  21516. @end table
  21517. By default, the logging level is set to @var{info}. If the @option{video} or
  21518. the @option{metadata} options are set, it switches to @var{verbose}.
  21519. @item peak
  21520. Set peak mode(s).
  21521. Available modes can be cumulated (the option is a @code{flag} type). Possible
  21522. values are:
  21523. @table @samp
  21524. @item none
  21525. Disable any peak mode (default).
  21526. @item sample
  21527. Enable sample-peak mode.
  21528. Simple peak mode looking for the higher sample value. It logs a message
  21529. for sample-peak (identified by @code{SPK}).
  21530. @item true
  21531. Enable true-peak mode.
  21532. If enabled, the peak lookup is done on an over-sampled version of the input
  21533. stream for better peak accuracy. It logs a message for true-peak.
  21534. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  21535. This mode requires a build with @code{libswresample}.
  21536. @end table
  21537. @item dualmono
  21538. Treat mono input files as "dual mono". If a mono file is intended for playback
  21539. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  21540. If set to @code{true}, this option will compensate for this effect.
  21541. Multi-channel input files are not affected by this option.
  21542. @item panlaw
  21543. Set a specific pan law to be used for the measurement of dual mono files.
  21544. This parameter is optional, and has a default value of -3.01dB.
  21545. @item target
  21546. Set a specific target level (in LUFS) used as relative zero in the visualization.
  21547. This parameter is optional and has a default value of -23LUFS as specified
  21548. by EBU R128. However, material published online may prefer a level of -16LUFS
  21549. (e.g. for use with podcasts or video platforms).
  21550. @item gauge
  21551. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  21552. @code{shortterm}. By default the momentary value will be used, but in certain
  21553. scenarios it may be more useful to observe the short term value instead (e.g.
  21554. live mixing).
  21555. @item scale
  21556. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  21557. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  21558. video output, not the summary or continuous log output.
  21559. @end table
  21560. @subsection Examples
  21561. @itemize
  21562. @item
  21563. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  21564. @example
  21565. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  21566. @end example
  21567. @item
  21568. Run an analysis with @command{ffmpeg}:
  21569. @example
  21570. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  21571. @end example
  21572. @end itemize
  21573. @section interleave, ainterleave
  21574. Temporally interleave frames from several inputs.
  21575. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  21576. These filters read frames from several inputs and send the oldest
  21577. queued frame to the output.
  21578. Input streams must have well defined, monotonically increasing frame
  21579. timestamp values.
  21580. In order to submit one frame to output, these filters need to enqueue
  21581. at least one frame for each input, so they cannot work in case one
  21582. input is not yet terminated and will not receive incoming frames.
  21583. For example consider the case when one input is a @code{select} filter
  21584. which always drops input frames. The @code{interleave} filter will keep
  21585. reading from that input, but it will never be able to send new frames
  21586. to output until the input sends an end-of-stream signal.
  21587. Also, depending on inputs synchronization, the filters will drop
  21588. frames in case one input receives more frames than the other ones, and
  21589. the queue is already filled.
  21590. These filters accept the following options:
  21591. @table @option
  21592. @item nb_inputs, n
  21593. Set the number of different inputs, it is 2 by default.
  21594. @item duration
  21595. How to determine the end-of-stream.
  21596. @table @option
  21597. @item longest
  21598. The duration of the longest input. (default)
  21599. @item shortest
  21600. The duration of the shortest input.
  21601. @item first
  21602. The duration of the first input.
  21603. @end table
  21604. @end table
  21605. @subsection Examples
  21606. @itemize
  21607. @item
  21608. Interleave frames belonging to different streams using @command{ffmpeg}:
  21609. @example
  21610. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  21611. @end example
  21612. @item
  21613. Add flickering blur effect:
  21614. @example
  21615. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  21616. @end example
  21617. @end itemize
  21618. @section latency, alatency
  21619. Measure filtering latency.
  21620. Report previous filter filtering latency, delay in number of audio samples for audio filters
  21621. or number of video frames for video filters.
  21622. On end of input stream, filter will report min and max measured latency for previous running filter
  21623. in filtergraph.
  21624. @section metadata, ametadata
  21625. Manipulate frame metadata.
  21626. This filter accepts the following options:
  21627. @table @option
  21628. @item mode
  21629. Set mode of operation of the filter.
  21630. Can be one of the following:
  21631. @table @samp
  21632. @item select
  21633. If both @code{value} and @code{key} is set, select frames
  21634. which have such metadata. If only @code{key} is set, select
  21635. every frame that has such key in metadata.
  21636. @item add
  21637. Add new metadata @code{key} and @code{value}. If key is already available
  21638. do nothing.
  21639. @item modify
  21640. Modify value of already present key.
  21641. @item delete
  21642. If @code{value} is set, delete only keys that have such value.
  21643. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  21644. the frame.
  21645. @item print
  21646. Print key and its value if metadata was found. If @code{key} is not set print all
  21647. metadata values available in frame.
  21648. @end table
  21649. @item key
  21650. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  21651. @item value
  21652. Set metadata value which will be used. This option is mandatory for
  21653. @code{modify} and @code{add} mode.
  21654. @item function
  21655. Which function to use when comparing metadata value and @code{value}.
  21656. Can be one of following:
  21657. @table @samp
  21658. @item same_str
  21659. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  21660. @item starts_with
  21661. Values are interpreted as strings, returns true if metadata value starts with
  21662. the @code{value} option string.
  21663. @item less
  21664. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  21665. @item equal
  21666. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  21667. @item greater
  21668. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  21669. @item expr
  21670. Values are interpreted as floats, returns true if expression from option @code{expr}
  21671. evaluates to true.
  21672. @item ends_with
  21673. Values are interpreted as strings, returns true if metadata value ends with
  21674. the @code{value} option string.
  21675. @end table
  21676. @item expr
  21677. Set expression which is used when @code{function} is set to @code{expr}.
  21678. The expression is evaluated through the eval API and can contain the following
  21679. constants:
  21680. @table @option
  21681. @item VALUE1, FRAMEVAL
  21682. Float representation of @code{value} from metadata key.
  21683. @item VALUE2, USERVAL
  21684. Float representation of @code{value} as supplied by user in @code{value} option.
  21685. @end table
  21686. @item file
  21687. If specified in @code{print} mode, output is written to the named file. Instead of
  21688. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  21689. for standard output. If @code{file} option is not set, output is written to the log
  21690. with AV_LOG_INFO loglevel.
  21691. @item direct
  21692. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  21693. @end table
  21694. @subsection Examples
  21695. @itemize
  21696. @item
  21697. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  21698. between 0 and 1.
  21699. @example
  21700. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  21701. @end example
  21702. @item
  21703. Print silencedetect output to file @file{metadata.txt}.
  21704. @example
  21705. silencedetect,ametadata=mode=print:file=metadata.txt
  21706. @end example
  21707. @item
  21708. Direct all metadata to a pipe with file descriptor 4.
  21709. @example
  21710. metadata=mode=print:file='pipe\:4'
  21711. @end example
  21712. @end itemize
  21713. @section perms, aperms
  21714. Set read/write permissions for the output frames.
  21715. These filters are mainly aimed at developers to test direct path in the
  21716. following filter in the filtergraph.
  21717. The filters accept the following options:
  21718. @table @option
  21719. @item mode
  21720. Select the permissions mode.
  21721. It accepts the following values:
  21722. @table @samp
  21723. @item none
  21724. Do nothing. This is the default.
  21725. @item ro
  21726. Set all the output frames read-only.
  21727. @item rw
  21728. Set all the output frames directly writable.
  21729. @item toggle
  21730. Make the frame read-only if writable, and writable if read-only.
  21731. @item random
  21732. Set each output frame read-only or writable randomly.
  21733. @end table
  21734. @item seed
  21735. Set the seed for the @var{random} mode, must be an integer included between
  21736. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  21737. @code{-1}, the filter will try to use a good random seed on a best effort
  21738. basis.
  21739. @end table
  21740. Note: in case of auto-inserted filter between the permission filter and the
  21741. following one, the permission might not be received as expected in that
  21742. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  21743. perms/aperms filter can avoid this problem.
  21744. @section realtime, arealtime
  21745. Slow down filtering to match real time approximately.
  21746. These filters will pause the filtering for a variable amount of time to
  21747. match the output rate with the input timestamps.
  21748. They are similar to the @option{re} option to @code{ffmpeg}.
  21749. They accept the following options:
  21750. @table @option
  21751. @item limit
  21752. Time limit for the pauses. Any pause longer than that will be considered
  21753. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  21754. @item speed
  21755. Speed factor for processing. The value must be a float larger than zero.
  21756. Values larger than 1.0 will result in faster than realtime processing,
  21757. smaller will slow processing down. The @var{limit} is automatically adapted
  21758. accordingly. Default is 1.0.
  21759. A processing speed faster than what is possible without these filters cannot
  21760. be achieved.
  21761. @end table
  21762. @subsection Commands
  21763. Both filters supports the all above options as @ref{commands}.
  21764. @section segment, asegment
  21765. Split single input stream into multiple streams.
  21766. This filter does opposite of concat filters.
  21767. @code{segment} works on video frames, @code{asegment} on audio samples.
  21768. This filter accepts the following options:
  21769. @table @option
  21770. @item timestamps
  21771. Timestamps of output segments separated by '|'. The first segment will run
  21772. from the beginning of the input stream. The last segment will run until
  21773. the end of the input stream
  21774. @item frames, samples
  21775. Exact frame/sample count to split the segments.
  21776. @end table
  21777. In all cases, prefixing an each segment with '+' will make it relative to the
  21778. previous segment.
  21779. @subsection Examples
  21780. @itemize
  21781. @item
  21782. Split input audio stream into three output audio streams, starting at start of input audio stream
  21783. and storing that in 1st output audio stream, then following at 60th second and storing than in 2nd
  21784. output audio stream, and last after 150th second of input audio stream store in 3rd output audio stream:
  21785. @example
  21786. asegment=timestamps="60|150"
  21787. @end example
  21788. @end itemize
  21789. @anchor{select}
  21790. @section select, aselect
  21791. Select frames to pass in output.
  21792. This filter accepts the following options:
  21793. @table @option
  21794. @item expr, e
  21795. Set expression, which is evaluated for each input frame.
  21796. If the expression is evaluated to zero, the frame is discarded.
  21797. If the evaluation result is negative or NaN, the frame is sent to the
  21798. first output; otherwise it is sent to the output with index
  21799. @code{ceil(val)-1}, assuming that the input index starts from 0.
  21800. For example a value of @code{1.2} corresponds to the output with index
  21801. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  21802. @item outputs, n
  21803. Set the number of outputs. The output to which to send the selected
  21804. frame is based on the result of the evaluation. Default value is 1.
  21805. @end table
  21806. The expression can contain the following constants:
  21807. @table @option
  21808. @item n
  21809. The (sequential) number of the filtered frame, starting from 0.
  21810. @item selected_n
  21811. The (sequential) number of the selected frame, starting from 0.
  21812. @item prev_selected_n
  21813. The sequential number of the last selected frame. It's NAN if undefined.
  21814. @item TB
  21815. The timebase of the input timestamps.
  21816. @item pts
  21817. The PTS (Presentation TimeStamp) of the filtered frame,
  21818. expressed in @var{TB} units. It's NAN if undefined.
  21819. @item t
  21820. The PTS of the filtered frame,
  21821. expressed in seconds. It's NAN if undefined.
  21822. @item prev_pts
  21823. The PTS of the previously filtered frame. It's NAN if undefined.
  21824. @item prev_selected_pts
  21825. The PTS of the last previously filtered frame. It's NAN if undefined.
  21826. @item prev_selected_t
  21827. The PTS of the last previously selected frame, expressed in seconds. It's NAN if undefined.
  21828. @item start_pts
  21829. The first PTS in the stream which is not NAN. It remains NAN if not found.
  21830. @item start_t
  21831. The first PTS, in seconds, in the stream which is not NAN. It remains NAN if not found.
  21832. @item pict_type @emph{(video only)}
  21833. The type of the filtered frame. It can assume one of the following
  21834. values:
  21835. @table @option
  21836. @item I
  21837. @item P
  21838. @item B
  21839. @item S
  21840. @item SI
  21841. @item SP
  21842. @item BI
  21843. @end table
  21844. @item interlace_type @emph{(video only)}
  21845. The frame interlace type. It can assume one of the following values:
  21846. @table @option
  21847. @item PROGRESSIVE
  21848. The frame is progressive (not interlaced).
  21849. @item TOPFIRST
  21850. The frame is top-field-first.
  21851. @item BOTTOMFIRST
  21852. The frame is bottom-field-first.
  21853. @end table
  21854. @item consumed_sample_n @emph{(audio only)}
  21855. the number of selected samples before the current frame
  21856. @item samples_n @emph{(audio only)}
  21857. the number of samples in the current frame
  21858. @item sample_rate @emph{(audio only)}
  21859. the input sample rate
  21860. @item key
  21861. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  21862. @item pos
  21863. the position in the file of the filtered frame, -1 if the information
  21864. is not available (e.g. for synthetic video)
  21865. @item scene @emph{(video only)}
  21866. value between 0 and 1 to indicate a new scene; a low value reflects a low
  21867. probability for the current frame to introduce a new scene, while a higher
  21868. value means the current frame is more likely to be one (see the example below)
  21869. @item concatdec_select
  21870. The concat demuxer can select only part of a concat input file by setting an
  21871. inpoint and an outpoint, but the output packets may not be entirely contained
  21872. in the selected interval. By using this variable, it is possible to skip frames
  21873. generated by the concat demuxer which are not exactly contained in the selected
  21874. interval.
  21875. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  21876. and the @var{lavf.concat.duration} packet metadata values which are also
  21877. present in the decoded frames.
  21878. The @var{concatdec_select} variable is -1 if the frame pts is at least
  21879. start_time and either the duration metadata is missing or the frame pts is less
  21880. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  21881. missing.
  21882. That basically means that an input frame is selected if its pts is within the
  21883. interval set by the concat demuxer.
  21884. @end table
  21885. The default value of the select expression is "1".
  21886. @subsection Examples
  21887. @itemize
  21888. @item
  21889. Select all frames in input:
  21890. @example
  21891. select
  21892. @end example
  21893. The example above is the same as:
  21894. @example
  21895. select=1
  21896. @end example
  21897. @item
  21898. Skip all frames:
  21899. @example
  21900. select=0
  21901. @end example
  21902. @item
  21903. Select only I-frames:
  21904. @example
  21905. select='eq(pict_type\,I)'
  21906. @end example
  21907. @item
  21908. Select one frame every 100:
  21909. @example
  21910. select='not(mod(n\,100))'
  21911. @end example
  21912. @item
  21913. Select only frames contained in the 10-20 time interval:
  21914. @example
  21915. select=between(t\,10\,20)
  21916. @end example
  21917. @item
  21918. Select only I-frames contained in the 10-20 time interval:
  21919. @example
  21920. select=between(t\,10\,20)*eq(pict_type\,I)
  21921. @end example
  21922. @item
  21923. Select frames with a minimum distance of 10 seconds:
  21924. @example
  21925. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  21926. @end example
  21927. @item
  21928. Use aselect to select only audio frames with samples number > 100:
  21929. @example
  21930. aselect='gt(samples_n\,100)'
  21931. @end example
  21932. @item
  21933. Create a mosaic of the first scenes:
  21934. @example
  21935. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  21936. @end example
  21937. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  21938. choice.
  21939. @item
  21940. Send even and odd frames to separate outputs, and compose them:
  21941. @example
  21942. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  21943. @end example
  21944. @item
  21945. Select useful frames from an ffconcat file which is using inpoints and
  21946. outpoints but where the source files are not intra frame only.
  21947. @example
  21948. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  21949. @end example
  21950. @end itemize
  21951. @section sendcmd, asendcmd
  21952. Send commands to filters in the filtergraph.
  21953. These filters read commands to be sent to other filters in the
  21954. filtergraph.
  21955. @code{sendcmd} must be inserted between two video filters,
  21956. @code{asendcmd} must be inserted between two audio filters, but apart
  21957. from that they act the same way.
  21958. The specification of commands can be provided in the filter arguments
  21959. with the @var{commands} option, or in a file specified by the
  21960. @var{filename} option.
  21961. These filters accept the following options:
  21962. @table @option
  21963. @item commands, c
  21964. Set the commands to be read and sent to the other filters.
  21965. @item filename, f
  21966. Set the filename of the commands to be read and sent to the other
  21967. filters.
  21968. @end table
  21969. @subsection Commands syntax
  21970. A commands description consists of a sequence of interval
  21971. specifications, comprising a list of commands to be executed when a
  21972. particular event related to that interval occurs. The occurring event
  21973. is typically the current frame time entering or leaving a given time
  21974. interval.
  21975. An interval is specified by the following syntax:
  21976. @example
  21977. @var{START}[-@var{END}] @var{COMMANDS};
  21978. @end example
  21979. The time interval is specified by the @var{START} and @var{END} times.
  21980. @var{END} is optional and defaults to the maximum time.
  21981. The current frame time is considered within the specified interval if
  21982. it is included in the interval [@var{START}, @var{END}), that is when
  21983. the time is greater or equal to @var{START} and is lesser than
  21984. @var{END}.
  21985. @var{COMMANDS} consists of a sequence of one or more command
  21986. specifications, separated by ",", relating to that interval. The
  21987. syntax of a command specification is given by:
  21988. @example
  21989. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  21990. @end example
  21991. @var{FLAGS} is optional and specifies the type of events relating to
  21992. the time interval which enable sending the specified command, and must
  21993. be a non-null sequence of identifier flags separated by "+" or "|" and
  21994. enclosed between "[" and "]".
  21995. The following flags are recognized:
  21996. @table @option
  21997. @item enter
  21998. The command is sent when the current frame timestamp enters the
  21999. specified interval. In other words, the command is sent when the
  22000. previous frame timestamp was not in the given interval, and the
  22001. current is.
  22002. @item leave
  22003. The command is sent when the current frame timestamp leaves the
  22004. specified interval. In other words, the command is sent when the
  22005. previous frame timestamp was in the given interval, and the
  22006. current is not.
  22007. @item expr
  22008. The command @var{ARG} is interpreted as expression and result of
  22009. expression is passed as @var{ARG}.
  22010. The expression is evaluated through the eval API and can contain the following
  22011. constants:
  22012. @table @option
  22013. @item POS
  22014. Original position in the file of the frame, or undefined if undefined
  22015. for the current frame.
  22016. @item PTS
  22017. The presentation timestamp in input.
  22018. @item N
  22019. The count of the input frame for video or audio, starting from 0.
  22020. @item T
  22021. The time in seconds of the current frame.
  22022. @item TS
  22023. The start time in seconds of the current command interval.
  22024. @item TE
  22025. The end time in seconds of the current command interval.
  22026. @item TI
  22027. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  22028. @item W
  22029. The video frame width.
  22030. @item H
  22031. The video frame height.
  22032. @end table
  22033. @end table
  22034. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  22035. assumed.
  22036. @var{TARGET} specifies the target of the command, usually the name of
  22037. the filter class or a specific filter instance name.
  22038. @var{COMMAND} specifies the name of the command for the target filter.
  22039. @var{ARG} is optional and specifies the optional list of argument for
  22040. the given @var{COMMAND}.
  22041. Between one interval specification and another, whitespaces, or
  22042. sequences of characters starting with @code{#} until the end of line,
  22043. are ignored and can be used to annotate comments.
  22044. A simplified BNF description of the commands specification syntax
  22045. follows:
  22046. @example
  22047. @var{COMMAND_FLAG} ::= "enter" | "leave"
  22048. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  22049. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  22050. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  22051. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  22052. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  22053. @end example
  22054. @subsection Examples
  22055. @itemize
  22056. @item
  22057. Specify audio tempo change at second 4:
  22058. @example
  22059. asendcmd=c='4.0 atempo tempo 1.5',atempo
  22060. @end example
  22061. @item
  22062. Target a specific filter instance:
  22063. @example
  22064. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  22065. @end example
  22066. @item
  22067. Specify a list of drawtext and hue commands in a file.
  22068. @example
  22069. # show text in the interval 5-10
  22070. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  22071. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  22072. # desaturate the image in the interval 15-20
  22073. 15.0-20.0 [enter] hue s 0,
  22074. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  22075. [leave] hue s 1,
  22076. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  22077. # apply an exponential saturation fade-out effect, starting from time 25
  22078. 25 [enter] hue s exp(25-t)
  22079. @end example
  22080. A filtergraph allowing to read and process the above command list
  22081. stored in a file @file{test.cmd}, can be specified with:
  22082. @example
  22083. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  22084. @end example
  22085. @end itemize
  22086. @anchor{setpts}
  22087. @section setpts, asetpts
  22088. Change the PTS (presentation timestamp) of the input frames.
  22089. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  22090. This filter accepts the following options:
  22091. @table @option
  22092. @item expr
  22093. The expression which is evaluated for each frame to construct its timestamp.
  22094. @end table
  22095. The expression is evaluated through the eval API and can contain the following
  22096. constants:
  22097. @table @option
  22098. @item FRAME_RATE, FR
  22099. frame rate, only defined for constant frame-rate video
  22100. @item PTS
  22101. The presentation timestamp in input
  22102. @item N
  22103. The count of the input frame for video or the number of consumed samples,
  22104. not including the current frame for audio, starting from 0.
  22105. @item NB_CONSUMED_SAMPLES
  22106. The number of consumed samples, not including the current frame (only
  22107. audio)
  22108. @item NB_SAMPLES, S
  22109. The number of samples in the current frame (only audio)
  22110. @item SAMPLE_RATE, SR
  22111. The audio sample rate.
  22112. @item STARTPTS
  22113. The PTS of the first frame.
  22114. @item STARTT
  22115. the time in seconds of the first frame
  22116. @item INTERLACED
  22117. State whether the current frame is interlaced.
  22118. @item T
  22119. the time in seconds of the current frame
  22120. @item POS
  22121. original position in the file of the frame, or undefined if undefined
  22122. for the current frame
  22123. @item PREV_INPTS
  22124. The previous input PTS.
  22125. @item PREV_INT
  22126. previous input time in seconds
  22127. @item PREV_OUTPTS
  22128. The previous output PTS.
  22129. @item PREV_OUTT
  22130. previous output time in seconds
  22131. @item RTCTIME
  22132. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  22133. instead.
  22134. @item RTCSTART
  22135. The wallclock (RTC) time at the start of the movie in microseconds.
  22136. @item TB
  22137. The timebase of the input timestamps.
  22138. @end table
  22139. @subsection Examples
  22140. @itemize
  22141. @item
  22142. Start counting PTS from zero
  22143. @example
  22144. setpts=PTS-STARTPTS
  22145. @end example
  22146. @item
  22147. Apply fast motion effect:
  22148. @example
  22149. setpts=0.5*PTS
  22150. @end example
  22151. @item
  22152. Apply slow motion effect:
  22153. @example
  22154. setpts=2.0*PTS
  22155. @end example
  22156. @item
  22157. Set fixed rate of 25 frames per second:
  22158. @example
  22159. setpts=N/(25*TB)
  22160. @end example
  22161. @item
  22162. Set fixed rate 25 fps with some jitter:
  22163. @example
  22164. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  22165. @end example
  22166. @item
  22167. Apply an offset of 10 seconds to the input PTS:
  22168. @example
  22169. setpts=PTS+10/TB
  22170. @end example
  22171. @item
  22172. Generate timestamps from a "live source" and rebase onto the current timebase:
  22173. @example
  22174. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  22175. @end example
  22176. @item
  22177. Generate timestamps by counting samples:
  22178. @example
  22179. asetpts=N/SR/TB
  22180. @end example
  22181. @end itemize
  22182. @section setrange
  22183. Force color range for the output video frame.
  22184. The @code{setrange} filter marks the color range property for the
  22185. output frames. It does not change the input frame, but only sets the
  22186. corresponding property, which affects how the frame is treated by
  22187. following filters.
  22188. The filter accepts the following options:
  22189. @table @option
  22190. @item range
  22191. Available values are:
  22192. @table @samp
  22193. @item auto
  22194. Keep the same color range property.
  22195. @item unspecified, unknown
  22196. Set the color range as unspecified.
  22197. @item limited, tv, mpeg
  22198. Set the color range as limited.
  22199. @item full, pc, jpeg
  22200. Set the color range as full.
  22201. @end table
  22202. @end table
  22203. @section settb, asettb
  22204. Set the timebase to use for the output frames timestamps.
  22205. It is mainly useful for testing timebase configuration.
  22206. It accepts the following parameters:
  22207. @table @option
  22208. @item expr, tb
  22209. The expression which is evaluated into the output timebase.
  22210. @end table
  22211. The value for @option{tb} is an arithmetic expression representing a
  22212. rational. The expression can contain the constants "AVTB" (the default
  22213. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  22214. audio only). Default value is "intb".
  22215. @subsection Examples
  22216. @itemize
  22217. @item
  22218. Set the timebase to 1/25:
  22219. @example
  22220. settb=expr=1/25
  22221. @end example
  22222. @item
  22223. Set the timebase to 1/10:
  22224. @example
  22225. settb=expr=0.1
  22226. @end example
  22227. @item
  22228. Set the timebase to 1001/1000:
  22229. @example
  22230. settb=1+0.001
  22231. @end example
  22232. @item
  22233. Set the timebase to 2*intb:
  22234. @example
  22235. settb=2*intb
  22236. @end example
  22237. @item
  22238. Set the default timebase value:
  22239. @example
  22240. settb=AVTB
  22241. @end example
  22242. @end itemize
  22243. @section showcqt
  22244. Convert input audio to a video output representing frequency spectrum
  22245. logarithmically using Brown-Puckette constant Q transform algorithm with
  22246. direct frequency domain coefficient calculation (but the transform itself
  22247. is not really constant Q, instead the Q factor is actually variable/clamped),
  22248. with musical tone scale, from E0 to D#10.
  22249. The filter accepts the following options:
  22250. @table @option
  22251. @item size, s
  22252. Specify the video size for the output. It must be even. For the syntax of this option,
  22253. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22254. Default value is @code{1920x1080}.
  22255. @item fps, rate, r
  22256. Set the output frame rate. Default value is @code{25}.
  22257. @item bar_h
  22258. Set the bargraph height. It must be even. Default value is @code{-1} which
  22259. computes the bargraph height automatically.
  22260. @item axis_h
  22261. Set the axis height. It must be even. Default value is @code{-1} which computes
  22262. the axis height automatically.
  22263. @item sono_h
  22264. Set the sonogram height. It must be even. Default value is @code{-1} which
  22265. computes the sonogram height automatically.
  22266. @item fullhd
  22267. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  22268. instead. Default value is @code{1}.
  22269. @item sono_v, volume
  22270. Specify the sonogram volume expression. It can contain variables:
  22271. @table @option
  22272. @item bar_v
  22273. the @var{bar_v} evaluated expression
  22274. @item frequency, freq, f
  22275. the frequency where it is evaluated
  22276. @item timeclamp, tc
  22277. the value of @var{timeclamp} option
  22278. @end table
  22279. and functions:
  22280. @table @option
  22281. @item a_weighting(f)
  22282. A-weighting of equal loudness
  22283. @item b_weighting(f)
  22284. B-weighting of equal loudness
  22285. @item c_weighting(f)
  22286. C-weighting of equal loudness.
  22287. @end table
  22288. Default value is @code{16}.
  22289. @item bar_v, volume2
  22290. Specify the bargraph volume expression. It can contain variables:
  22291. @table @option
  22292. @item sono_v
  22293. the @var{sono_v} evaluated expression
  22294. @item frequency, freq, f
  22295. the frequency where it is evaluated
  22296. @item timeclamp, tc
  22297. the value of @var{timeclamp} option
  22298. @end table
  22299. and functions:
  22300. @table @option
  22301. @item a_weighting(f)
  22302. A-weighting of equal loudness
  22303. @item b_weighting(f)
  22304. B-weighting of equal loudness
  22305. @item c_weighting(f)
  22306. C-weighting of equal loudness.
  22307. @end table
  22308. Default value is @code{sono_v}.
  22309. @item sono_g, gamma
  22310. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  22311. higher gamma makes the spectrum having more range. Default value is @code{3}.
  22312. Acceptable range is @code{[1, 7]}.
  22313. @item bar_g, gamma2
  22314. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  22315. @code{[1, 7]}.
  22316. @item bar_t
  22317. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  22318. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  22319. @item timeclamp, tc
  22320. Specify the transform timeclamp. At low frequency, there is trade-off between
  22321. accuracy in time domain and frequency domain. If timeclamp is lower,
  22322. event in time domain is represented more accurately (such as fast bass drum),
  22323. otherwise event in frequency domain is represented more accurately
  22324. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  22325. @item attack
  22326. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  22327. limits future samples by applying asymmetric windowing in time domain, useful
  22328. when low latency is required. Accepted range is @code{[0, 1]}.
  22329. @item basefreq
  22330. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  22331. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  22332. @item endfreq
  22333. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  22334. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  22335. @item coeffclamp
  22336. This option is deprecated and ignored.
  22337. @item tlength
  22338. Specify the transform length in time domain. Use this option to control accuracy
  22339. trade-off between time domain and frequency domain at every frequency sample.
  22340. It can contain variables:
  22341. @table @option
  22342. @item frequency, freq, f
  22343. the frequency where it is evaluated
  22344. @item timeclamp, tc
  22345. the value of @var{timeclamp} option.
  22346. @end table
  22347. Default value is @code{384*tc/(384+tc*f)}.
  22348. @item count
  22349. Specify the transform count for every video frame. Default value is @code{6}.
  22350. Acceptable range is @code{[1, 30]}.
  22351. @item fcount
  22352. Specify the transform count for every single pixel. Default value is @code{0},
  22353. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  22354. @item fontfile
  22355. Specify font file for use with freetype to draw the axis. If not specified,
  22356. use embedded font. Note that drawing with font file or embedded font is not
  22357. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  22358. option instead.
  22359. @item font
  22360. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  22361. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  22362. escaping.
  22363. @item fontcolor
  22364. Specify font color expression. This is arithmetic expression that should return
  22365. integer value 0xRRGGBB. It can contain variables:
  22366. @table @option
  22367. @item frequency, freq, f
  22368. the frequency where it is evaluated
  22369. @item timeclamp, tc
  22370. the value of @var{timeclamp} option
  22371. @end table
  22372. and functions:
  22373. @table @option
  22374. @item midi(f)
  22375. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  22376. @item r(x), g(x), b(x)
  22377. red, green, and blue value of intensity x.
  22378. @end table
  22379. Default value is @code{st(0, (midi(f)-59.5)/12);
  22380. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  22381. r(1-ld(1)) + b(ld(1))}.
  22382. @item axisfile
  22383. Specify image file to draw the axis. This option override @var{fontfile} and
  22384. @var{fontcolor} option.
  22385. @item axis, text
  22386. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  22387. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  22388. Default value is @code{1}.
  22389. @item csp
  22390. Set colorspace. The accepted values are:
  22391. @table @samp
  22392. @item unspecified
  22393. Unspecified (default)
  22394. @item bt709
  22395. BT.709
  22396. @item fcc
  22397. FCC
  22398. @item bt470bg
  22399. BT.470BG or BT.601-6 625
  22400. @item smpte170m
  22401. SMPTE-170M or BT.601-6 525
  22402. @item smpte240m
  22403. SMPTE-240M
  22404. @item bt2020ncl
  22405. BT.2020 with non-constant luminance
  22406. @end table
  22407. @item cscheme
  22408. Set spectrogram color scheme. This is list of floating point values with format
  22409. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  22410. The default is @code{1|0.5|0|0|0.5|1}.
  22411. @end table
  22412. @subsection Examples
  22413. @itemize
  22414. @item
  22415. Playing audio while showing the spectrum:
  22416. @example
  22417. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  22418. @end example
  22419. @item
  22420. Same as above, but with frame rate 30 fps:
  22421. @example
  22422. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  22423. @end example
  22424. @item
  22425. Playing at 1280x720:
  22426. @example
  22427. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  22428. @end example
  22429. @item
  22430. Disable sonogram display:
  22431. @example
  22432. sono_h=0
  22433. @end example
  22434. @item
  22435. A1 and its harmonics: A1, A2, (near)E3, A3:
  22436. @example
  22437. 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),
  22438. asplit[a][out1]; [a] showcqt [out0]'
  22439. @end example
  22440. @item
  22441. Same as above, but with more accuracy in frequency domain:
  22442. @example
  22443. 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),
  22444. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  22445. @end example
  22446. @item
  22447. Custom volume:
  22448. @example
  22449. bar_v=10:sono_v=bar_v*a_weighting(f)
  22450. @end example
  22451. @item
  22452. Custom gamma, now spectrum is linear to the amplitude.
  22453. @example
  22454. bar_g=2:sono_g=2
  22455. @end example
  22456. @item
  22457. Custom tlength equation:
  22458. @example
  22459. 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)))'
  22460. @end example
  22461. @item
  22462. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  22463. @example
  22464. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  22465. @end example
  22466. @item
  22467. Custom font using fontconfig:
  22468. @example
  22469. font='Courier New,Monospace,mono|bold'
  22470. @end example
  22471. @item
  22472. Custom frequency range with custom axis using image file:
  22473. @example
  22474. axisfile=myaxis.png:basefreq=40:endfreq=10000
  22475. @end example
  22476. @end itemize
  22477. @section showcwt
  22478. Convert input audio to video output representing frequency spectrum
  22479. using Continuous Wavelet Transform and Morlet wavelet.
  22480. The filter accepts the following options:
  22481. @table @option
  22482. @item size, s
  22483. Specify the video size for the output. For the syntax of this option,
  22484. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22485. Default value is @code{640x512}.
  22486. @item rate, r
  22487. Set the output frame rate. Default value is @code{25}.
  22488. @item scale
  22489. Set the frequency scale used. Allowed values are:
  22490. @table @option
  22491. @item linear
  22492. @item log2
  22493. @item bark
  22494. @item mel
  22495. @item erbs
  22496. @end table
  22497. Default value is @code{linear}.
  22498. @item min
  22499. Set the minimum frequency that will be used in output.
  22500. Default is @code{20} Hz.
  22501. @item max
  22502. Set the maximum frequency that will be used in output.
  22503. Default is @code{20000} Hz. The real frequency upper limit
  22504. depends on input audio's sample rate and such will be enforced
  22505. on this value when it is set to value greater than Nyquist frequency.
  22506. @item logb
  22507. Set the logarithmic basis for brightness strength when
  22508. mapping calculated magnitude values to pixel values.
  22509. Allowed range is from @code{0} to @code{1}.
  22510. Default value is @code{0.0001}.
  22511. @item deviation
  22512. Set the frequency deviation.
  22513. Lower values than @code{1} are more frequency oriented,
  22514. while higher values than @code{1} are more time oriented.
  22515. Allowed range is from @code{0} to @code{10}.
  22516. Default value is @code{1}.
  22517. @item pps
  22518. Set the number of pixel output per each second in one row.
  22519. Allowed range is from @code{1} to @code{1024}.
  22520. Default value is @code{64}.
  22521. @item mode
  22522. Set the output visual mode. Allowed values are:
  22523. @table @option
  22524. @item magnitude
  22525. Show magnitude.
  22526. @item phase
  22527. Show only phase.
  22528. @item magphase
  22529. Show combination of magnitude and phase.
  22530. Magnitude is mapped to brightness and phase to color.
  22531. @item channel
  22532. Show unique color per channel magnitude.
  22533. @item stereo
  22534. Show unique color per stereo difference.
  22535. @end table
  22536. Default value is @code{magnitude}.
  22537. @item slide
  22538. Set the output slide method. Allowed values are:
  22539. @table @option
  22540. @item replace
  22541. @item scroll
  22542. @item frame
  22543. @end table
  22544. @item direction
  22545. Set the direction method for output slide method. Allowed values are:
  22546. @table @option
  22547. @item lr
  22548. Direction from left to right.
  22549. @item rl
  22550. Direction from right to left.
  22551. @item ud
  22552. Direction from up to down.
  22553. @item du
  22554. Direction from down to up.
  22555. @end table
  22556. @end table
  22557. @section showfreqs
  22558. Convert input audio to video output representing the audio power spectrum.
  22559. Audio amplitude is on Y-axis while frequency is on X-axis.
  22560. The filter accepts the following options:
  22561. @table @option
  22562. @item size, s
  22563. Specify size of video. For the syntax of this option, check the
  22564. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22565. Default is @code{1024x512}.
  22566. @item rate, r
  22567. Set video rate. Default is @code{25}.
  22568. @item mode
  22569. Set display mode.
  22570. This set how each frequency bin will be represented.
  22571. It accepts the following values:
  22572. @table @samp
  22573. @item line
  22574. @item bar
  22575. @item dot
  22576. @end table
  22577. Default is @code{bar}.
  22578. @item ascale
  22579. Set amplitude scale.
  22580. It accepts the following values:
  22581. @table @samp
  22582. @item lin
  22583. Linear scale.
  22584. @item sqrt
  22585. Square root scale.
  22586. @item cbrt
  22587. Cubic root scale.
  22588. @item log
  22589. Logarithmic scale.
  22590. @end table
  22591. Default is @code{log}.
  22592. @item fscale
  22593. Set frequency scale.
  22594. It accepts the following values:
  22595. @table @samp
  22596. @item lin
  22597. Linear scale.
  22598. @item log
  22599. Logarithmic scale.
  22600. @item rlog
  22601. Reverse logarithmic scale.
  22602. @end table
  22603. Default is @code{lin}.
  22604. @item win_size
  22605. Set window size. Allowed range is from 16 to 65536.
  22606. Default is @code{2048}
  22607. @item win_func
  22608. Set windowing function.
  22609. It accepts the following values:
  22610. @table @samp
  22611. @item rect
  22612. @item bartlett
  22613. @item hanning
  22614. @item hamming
  22615. @item blackman
  22616. @item welch
  22617. @item flattop
  22618. @item bharris
  22619. @item bnuttall
  22620. @item bhann
  22621. @item sine
  22622. @item nuttall
  22623. @item lanczos
  22624. @item gauss
  22625. @item tukey
  22626. @item dolph
  22627. @item cauchy
  22628. @item parzen
  22629. @item poisson
  22630. @item bohman
  22631. @item kaiser
  22632. @end table
  22633. Default is @code{hanning}.
  22634. @item overlap
  22635. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  22636. which means optimal overlap for selected window function will be picked.
  22637. @item averaging
  22638. Set time averaging. Setting this to 0 will display current maximal peaks.
  22639. Default is @code{1}, which means time averaging is disabled.
  22640. @item colors
  22641. Specify list of colors separated by space or by '|' which will be used to
  22642. draw channel frequencies. Unrecognized or missing colors will be replaced
  22643. by white color.
  22644. @item cmode
  22645. Set channel display mode.
  22646. It accepts the following values:
  22647. @table @samp
  22648. @item combined
  22649. @item separate
  22650. @end table
  22651. Default is @code{combined}.
  22652. @item minamp
  22653. Set minimum amplitude used in @code{log} amplitude scaler.
  22654. @item data
  22655. Set data display mode.
  22656. It accepts the following values:
  22657. @table @samp
  22658. @item magnitude
  22659. @item phase
  22660. @item delay
  22661. @end table
  22662. Default is @code{magnitude}.
  22663. @item channels
  22664. Set channels to use when processing audio. By default all are processed.
  22665. @end table
  22666. @section showspatial
  22667. Convert stereo input audio to a video output, representing the spatial relationship
  22668. between two channels.
  22669. The filter accepts the following options:
  22670. @table @option
  22671. @item size, s
  22672. Specify the video size for the output. For the syntax of this option, check the
  22673. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22674. Default value is @code{512x512}.
  22675. @item win_size
  22676. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  22677. @item win_func
  22678. Set window function.
  22679. It accepts the following values:
  22680. @table @samp
  22681. @item rect
  22682. @item bartlett
  22683. @item hann
  22684. @item hanning
  22685. @item hamming
  22686. @item blackman
  22687. @item welch
  22688. @item flattop
  22689. @item bharris
  22690. @item bnuttall
  22691. @item bhann
  22692. @item sine
  22693. @item nuttall
  22694. @item lanczos
  22695. @item gauss
  22696. @item tukey
  22697. @item dolph
  22698. @item cauchy
  22699. @item parzen
  22700. @item poisson
  22701. @item bohman
  22702. @item kaiser
  22703. @end table
  22704. Default value is @code{hann}.
  22705. @item rate, r
  22706. Set output framerate.
  22707. @end table
  22708. @anchor{showspectrum}
  22709. @section showspectrum
  22710. Convert input audio to a video output, representing the audio frequency
  22711. spectrum.
  22712. The filter accepts the following options:
  22713. @table @option
  22714. @item size, s
  22715. Specify the video size for the output. For the syntax of this option, check the
  22716. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22717. Default value is @code{640x512}.
  22718. @item slide
  22719. Specify how the spectrum should slide along the window.
  22720. It accepts the following values:
  22721. @table @samp
  22722. @item replace
  22723. the samples start again on the left when they reach the right
  22724. @item scroll
  22725. the samples scroll from right to left
  22726. @item fullframe
  22727. frames are only produced when the samples reach the right
  22728. @item rscroll
  22729. the samples scroll from left to right
  22730. @item lreplace
  22731. the samples start again on the right when they reach the left
  22732. @end table
  22733. Default value is @code{replace}.
  22734. @item mode
  22735. Specify display mode.
  22736. It accepts the following values:
  22737. @table @samp
  22738. @item combined
  22739. all channels are displayed in the same row
  22740. @item separate
  22741. all channels are displayed in separate rows
  22742. @end table
  22743. Default value is @samp{combined}.
  22744. @item color
  22745. Specify display color mode.
  22746. It accepts the following values:
  22747. @table @samp
  22748. @item channel
  22749. each channel is displayed in a separate color
  22750. @item intensity
  22751. each channel is displayed using the same color scheme
  22752. @item rainbow
  22753. each channel is displayed using the rainbow color scheme
  22754. @item moreland
  22755. each channel is displayed using the moreland color scheme
  22756. @item nebulae
  22757. each channel is displayed using the nebulae color scheme
  22758. @item fire
  22759. each channel is displayed using the fire color scheme
  22760. @item fiery
  22761. each channel is displayed using the fiery color scheme
  22762. @item fruit
  22763. each channel is displayed using the fruit color scheme
  22764. @item cool
  22765. each channel is displayed using the cool color scheme
  22766. @item magma
  22767. each channel is displayed using the magma color scheme
  22768. @item green
  22769. each channel is displayed using the green color scheme
  22770. @item viridis
  22771. each channel is displayed using the viridis color scheme
  22772. @item plasma
  22773. each channel is displayed using the plasma color scheme
  22774. @item cividis
  22775. each channel is displayed using the cividis color scheme
  22776. @item terrain
  22777. each channel is displayed using the terrain color scheme
  22778. @end table
  22779. Default value is @samp{channel}.
  22780. @item scale
  22781. Specify scale used for calculating intensity color values.
  22782. It accepts the following values:
  22783. @table @samp
  22784. @item lin
  22785. linear
  22786. @item sqrt
  22787. square root, default
  22788. @item cbrt
  22789. cubic root
  22790. @item log
  22791. logarithmic
  22792. @item 4thrt
  22793. 4th root
  22794. @item 5thrt
  22795. 5th root
  22796. @end table
  22797. Default value is @samp{sqrt}.
  22798. @item fscale
  22799. Specify frequency scale.
  22800. It accepts the following values:
  22801. @table @samp
  22802. @item lin
  22803. linear
  22804. @item log
  22805. logarithmic
  22806. @end table
  22807. Default value is @samp{lin}.
  22808. @item saturation
  22809. Set saturation modifier for displayed colors. Negative values provide
  22810. alternative color scheme. @code{0} is no saturation at all.
  22811. Saturation must be in [-10.0, 10.0] range.
  22812. Default value is @code{1}.
  22813. @item win_func
  22814. Set window function.
  22815. It accepts the following values:
  22816. @table @samp
  22817. @item rect
  22818. @item bartlett
  22819. @item hann
  22820. @item hanning
  22821. @item hamming
  22822. @item blackman
  22823. @item welch
  22824. @item flattop
  22825. @item bharris
  22826. @item bnuttall
  22827. @item bhann
  22828. @item sine
  22829. @item nuttall
  22830. @item lanczos
  22831. @item gauss
  22832. @item tukey
  22833. @item dolph
  22834. @item cauchy
  22835. @item parzen
  22836. @item poisson
  22837. @item bohman
  22838. @item kaiser
  22839. @end table
  22840. Default value is @code{hann}.
  22841. @item orientation
  22842. Set orientation of time vs frequency axis. Can be @code{vertical} or
  22843. @code{horizontal}. Default is @code{vertical}.
  22844. @item overlap
  22845. Set ratio of overlap window. Default value is @code{0}.
  22846. When value is @code{1} overlap is set to recommended size for specific
  22847. window function currently used.
  22848. @item gain
  22849. Set scale gain for calculating intensity color values.
  22850. Default value is @code{1}.
  22851. @item data
  22852. Set which data to display. Can be @code{magnitude}, default or @code{phase},
  22853. or unwrapped phase: @code{uphase}.
  22854. @item rotation
  22855. Set color rotation, must be in [-1.0, 1.0] range.
  22856. Default value is @code{0}.
  22857. @item start
  22858. Set start frequency from which to display spectrogram. Default is @code{0}.
  22859. @item stop
  22860. Set stop frequency to which to display spectrogram. Default is @code{0}.
  22861. @item fps
  22862. Set upper frame rate limit. Default is @code{auto}, unlimited.
  22863. @item legend
  22864. Draw time and frequency axes and legends. Default is disabled.
  22865. @item drange
  22866. Set dynamic range used to calculate intensity color values. Default is 120 dBFS.
  22867. Allowed range is from 10 to 200.
  22868. @item limit
  22869. Set upper limit of input audio samples volume in dBFS. Default is 0 dBFS.
  22870. Allowed range is from -100 to 100.
  22871. @item opacity
  22872. Set opacity strength when using pixel format output with alpha component.
  22873. @end table
  22874. The usage is very similar to the showwaves filter; see the examples in that
  22875. section.
  22876. @subsection Examples
  22877. @itemize
  22878. @item
  22879. Large window with logarithmic color scaling:
  22880. @example
  22881. showspectrum=s=1280x480:scale=log
  22882. @end example
  22883. @item
  22884. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  22885. @example
  22886. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  22887. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  22888. @end example
  22889. @end itemize
  22890. @section showspectrumpic
  22891. Convert input audio to a single video frame, representing the audio frequency
  22892. spectrum.
  22893. The filter accepts the following options:
  22894. @table @option
  22895. @item size, s
  22896. Specify the video size for the output. For the syntax of this option, check the
  22897. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22898. Default value is @code{4096x2048}.
  22899. @item mode
  22900. Specify display mode.
  22901. It accepts the following values:
  22902. @table @samp
  22903. @item combined
  22904. all channels are displayed in the same row
  22905. @item separate
  22906. all channels are displayed in separate rows
  22907. @end table
  22908. Default value is @samp{combined}.
  22909. @item color
  22910. Specify display color mode.
  22911. It accepts the following values:
  22912. @table @samp
  22913. @item channel
  22914. each channel is displayed in a separate color
  22915. @item intensity
  22916. each channel is displayed using the same color scheme
  22917. @item rainbow
  22918. each channel is displayed using the rainbow color scheme
  22919. @item moreland
  22920. each channel is displayed using the moreland color scheme
  22921. @item nebulae
  22922. each channel is displayed using the nebulae color scheme
  22923. @item fire
  22924. each channel is displayed using the fire color scheme
  22925. @item fiery
  22926. each channel is displayed using the fiery color scheme
  22927. @item fruit
  22928. each channel is displayed using the fruit color scheme
  22929. @item cool
  22930. each channel is displayed using the cool color scheme
  22931. @item magma
  22932. each channel is displayed using the magma color scheme
  22933. @item green
  22934. each channel is displayed using the green color scheme
  22935. @item viridis
  22936. each channel is displayed using the viridis color scheme
  22937. @item plasma
  22938. each channel is displayed using the plasma color scheme
  22939. @item cividis
  22940. each channel is displayed using the cividis color scheme
  22941. @item terrain
  22942. each channel is displayed using the terrain color scheme
  22943. @end table
  22944. Default value is @samp{intensity}.
  22945. @item scale
  22946. Specify scale used for calculating intensity color values.
  22947. It accepts the following values:
  22948. @table @samp
  22949. @item lin
  22950. linear
  22951. @item sqrt
  22952. square root, default
  22953. @item cbrt
  22954. cubic root
  22955. @item log
  22956. logarithmic
  22957. @item 4thrt
  22958. 4th root
  22959. @item 5thrt
  22960. 5th root
  22961. @end table
  22962. Default value is @samp{log}.
  22963. @item fscale
  22964. Specify frequency scale.
  22965. It accepts the following values:
  22966. @table @samp
  22967. @item lin
  22968. linear
  22969. @item log
  22970. logarithmic
  22971. @end table
  22972. Default value is @samp{lin}.
  22973. @item saturation
  22974. Set saturation modifier for displayed colors. Negative values provide
  22975. alternative color scheme. @code{0} is no saturation at all.
  22976. Saturation must be in [-10.0, 10.0] range.
  22977. Default value is @code{1}.
  22978. @item win_func
  22979. Set window function.
  22980. It accepts the following values:
  22981. @table @samp
  22982. @item rect
  22983. @item bartlett
  22984. @item hann
  22985. @item hanning
  22986. @item hamming
  22987. @item blackman
  22988. @item welch
  22989. @item flattop
  22990. @item bharris
  22991. @item bnuttall
  22992. @item bhann
  22993. @item sine
  22994. @item nuttall
  22995. @item lanczos
  22996. @item gauss
  22997. @item tukey
  22998. @item dolph
  22999. @item cauchy
  23000. @item parzen
  23001. @item poisson
  23002. @item bohman
  23003. @item kaiser
  23004. @end table
  23005. Default value is @code{hann}.
  23006. @item orientation
  23007. Set orientation of time vs frequency axis. Can be @code{vertical} or
  23008. @code{horizontal}. Default is @code{vertical}.
  23009. @item gain
  23010. Set scale gain for calculating intensity color values.
  23011. Default value is @code{1}.
  23012. @item legend
  23013. Draw time and frequency axes and legends. Default is enabled.
  23014. @item rotation
  23015. Set color rotation, must be in [-1.0, 1.0] range.
  23016. Default value is @code{0}.
  23017. @item start
  23018. Set start frequency from which to display spectrogram. Default is @code{0}.
  23019. @item stop
  23020. Set stop frequency to which to display spectrogram. Default is @code{0}.
  23021. @item drange
  23022. Set dynamic range used to calculate intensity color values. Default is 120 dBFS.
  23023. Allowed range is from 10 to 200.
  23024. @item limit
  23025. Set upper limit of input audio samples volume in dBFS. Default is 0 dBFS.
  23026. Allowed range is from -100 to 100.
  23027. @item opacity
  23028. Set opacity strength when using pixel format output with alpha component.
  23029. @end table
  23030. @subsection Examples
  23031. @itemize
  23032. @item
  23033. Extract an audio spectrogram of a whole audio track
  23034. in a 1024x1024 picture using @command{ffmpeg}:
  23035. @example
  23036. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  23037. @end example
  23038. @end itemize
  23039. @section showvolume
  23040. Convert input audio volume to a video output.
  23041. The filter accepts the following options:
  23042. @table @option
  23043. @item rate, r
  23044. Set video rate.
  23045. @item b
  23046. Set border width, allowed range is [0, 5]. Default is 1.
  23047. @item w
  23048. Set channel width, allowed range is [80, 8192]. Default is 400.
  23049. @item h
  23050. Set channel height, allowed range is [1, 900]. Default is 20.
  23051. @item f
  23052. Set fade, allowed range is [0, 1]. Default is 0.95.
  23053. @item c
  23054. Set volume color expression.
  23055. The expression can use the following variables:
  23056. @table @option
  23057. @item VOLUME
  23058. Current max volume of channel in dB.
  23059. @item PEAK
  23060. Current peak.
  23061. @item CHANNEL
  23062. Current channel number, starting from 0.
  23063. @end table
  23064. @item t
  23065. If set, displays channel names. Default is enabled.
  23066. @item v
  23067. If set, displays volume values. Default is enabled.
  23068. @item o
  23069. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  23070. default is @code{h}.
  23071. @item s
  23072. Set step size, allowed range is [0, 5]. Default is 0, which means
  23073. step is disabled.
  23074. @item p
  23075. Set background opacity, allowed range is [0, 1]. Default is 0.
  23076. @item m
  23077. Set metering mode, can be peak: @code{p} or rms: @code{r},
  23078. default is @code{p}.
  23079. @item ds
  23080. Set display scale, can be linear: @code{lin} or log: @code{log},
  23081. default is @code{lin}.
  23082. @item dm
  23083. In second.
  23084. If set to > 0., display a line for the max level
  23085. in the previous seconds.
  23086. default is disabled: @code{0.}
  23087. @item dmc
  23088. The color of the max line. Use when @code{dm} option is set to > 0.
  23089. default is: @code{orange}
  23090. @end table
  23091. @section showwaves
  23092. Convert input audio to a video output, representing the samples waves.
  23093. The filter accepts the following options:
  23094. @table @option
  23095. @item size, s
  23096. Specify the video size for the output. For the syntax of this option, check the
  23097. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23098. Default value is @code{600x240}.
  23099. @item mode
  23100. Set display mode.
  23101. Available values are:
  23102. @table @samp
  23103. @item point
  23104. Draw a point for each sample.
  23105. @item line
  23106. Draw a vertical line for each sample.
  23107. @item p2p
  23108. Draw a point for each sample and a line between them.
  23109. @item cline
  23110. Draw a centered vertical line for each sample.
  23111. @end table
  23112. Default value is @code{point}.
  23113. @item n
  23114. Set the number of samples which are printed on the same column. A
  23115. larger value will decrease the frame rate. Must be a positive
  23116. integer. This option can be set only if the value for @var{rate}
  23117. is not explicitly specified.
  23118. @item rate, r
  23119. Set the (approximate) output frame rate. This is done by setting the
  23120. option @var{n}. Default value is "25".
  23121. @item split_channels
  23122. Set if channels should be drawn separately or overlap. Default value is 0.
  23123. @item colors
  23124. Set colors separated by '|' which are going to be used for drawing of each channel.
  23125. @item scale
  23126. Set amplitude scale.
  23127. Available values are:
  23128. @table @samp
  23129. @item lin
  23130. Linear.
  23131. @item log
  23132. Logarithmic.
  23133. @item sqrt
  23134. Square root.
  23135. @item cbrt
  23136. Cubic root.
  23137. @end table
  23138. Default is linear.
  23139. @item draw
  23140. Set the draw mode. This is mostly useful to set for high @var{n}.
  23141. Available values are:
  23142. @table @samp
  23143. @item scale
  23144. Scale pixel values for each drawn sample.
  23145. @item full
  23146. Draw every sample directly.
  23147. @end table
  23148. Default value is @code{scale}.
  23149. @end table
  23150. @subsection Examples
  23151. @itemize
  23152. @item
  23153. Output the input file audio and the corresponding video representation
  23154. at the same time:
  23155. @example
  23156. amovie=a.mp3,asplit[out0],showwaves[out1]
  23157. @end example
  23158. @item
  23159. Create a synthetic signal and show it with showwaves, forcing a
  23160. frame rate of 30 frames per second:
  23161. @example
  23162. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  23163. @end example
  23164. @end itemize
  23165. @section showwavespic
  23166. Convert input audio to a single video frame, representing the samples waves.
  23167. The filter accepts the following options:
  23168. @table @option
  23169. @item size, s
  23170. Specify the video size for the output. For the syntax of this option, check the
  23171. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23172. Default value is @code{600x240}.
  23173. @item split_channels
  23174. Set if channels should be drawn separately or overlap. Default value is 0.
  23175. @item colors
  23176. Set colors separated by '|' which are going to be used for drawing of each channel.
  23177. @item scale
  23178. Set amplitude scale.
  23179. Available values are:
  23180. @table @samp
  23181. @item lin
  23182. Linear.
  23183. @item log
  23184. Logarithmic.
  23185. @item sqrt
  23186. Square root.
  23187. @item cbrt
  23188. Cubic root.
  23189. @end table
  23190. Default is linear.
  23191. @item draw
  23192. Set the draw mode.
  23193. Available values are:
  23194. @table @samp
  23195. @item scale
  23196. Scale pixel values for each drawn sample.
  23197. @item full
  23198. Draw every sample directly.
  23199. @end table
  23200. Default value is @code{scale}.
  23201. @item filter
  23202. Set the filter mode.
  23203. Available values are:
  23204. @table @samp
  23205. @item average
  23206. Use average samples values for each drawn sample.
  23207. @item peak
  23208. Use peak samples values for each drawn sample.
  23209. @end table
  23210. Default value is @code{average}.
  23211. @end table
  23212. @subsection Examples
  23213. @itemize
  23214. @item
  23215. Extract a channel split representation of the wave form of a whole audio track
  23216. in a 1024x800 picture using @command{ffmpeg}:
  23217. @example
  23218. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  23219. @end example
  23220. @end itemize
  23221. @section sidedata, asidedata
  23222. Delete frame side data, or select frames based on it.
  23223. This filter accepts the following options:
  23224. @table @option
  23225. @item mode
  23226. Set mode of operation of the filter.
  23227. Can be one of the following:
  23228. @table @samp
  23229. @item select
  23230. Select every frame with side data of @code{type}.
  23231. @item delete
  23232. Delete side data of @code{type}. If @code{type} is not set, delete all side
  23233. data in the frame.
  23234. @end table
  23235. @item type
  23236. Set side data type used with all modes. Must be set for @code{select} mode. For
  23237. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  23238. in @file{libavutil/frame.h}. For example, to choose
  23239. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  23240. @end table
  23241. @section spectrumsynth
  23242. Synthesize audio from 2 input video spectrums, first input stream represents
  23243. magnitude across time and second represents phase across time.
  23244. The filter will transform from frequency domain as displayed in videos back
  23245. to time domain as presented in audio output.
  23246. This filter is primarily created for reversing processed @ref{showspectrum}
  23247. filter outputs, but can synthesize sound from other spectrograms too.
  23248. But in such case results are going to be poor if the phase data is not
  23249. available, because in such cases phase data need to be recreated, usually
  23250. it's just recreated from random noise.
  23251. For best results use gray only output (@code{channel} color mode in
  23252. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  23253. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  23254. @code{data} option. Inputs videos should generally use @code{fullframe}
  23255. slide mode as that saves resources needed for decoding video.
  23256. The filter accepts the following options:
  23257. @table @option
  23258. @item sample_rate
  23259. Specify sample rate of output audio, the sample rate of audio from which
  23260. spectrum was generated may differ.
  23261. @item channels
  23262. Set number of channels represented in input video spectrums.
  23263. @item scale
  23264. Set scale which was used when generating magnitude input spectrum.
  23265. Can be @code{lin} or @code{log}. Default is @code{log}.
  23266. @item slide
  23267. Set slide which was used when generating inputs spectrums.
  23268. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  23269. Default is @code{fullframe}.
  23270. @item win_func
  23271. Set window function used for resynthesis.
  23272. @item overlap
  23273. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  23274. which means optimal overlap for selected window function will be picked.
  23275. @item orientation
  23276. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  23277. Default is @code{vertical}.
  23278. @end table
  23279. @subsection Examples
  23280. @itemize
  23281. @item
  23282. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  23283. then resynthesize videos back to audio with spectrumsynth:
  23284. @example
  23285. 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
  23286. 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
  23287. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  23288. @end example
  23289. @end itemize
  23290. @section split, asplit
  23291. Split input into several identical outputs.
  23292. @code{asplit} works with audio input, @code{split} with video.
  23293. The filter accepts a single parameter which specifies the number of outputs. If
  23294. unspecified, it defaults to 2.
  23295. @subsection Examples
  23296. @itemize
  23297. @item
  23298. Create two separate outputs from the same input:
  23299. @example
  23300. [in] split [out0][out1]
  23301. @end example
  23302. @item
  23303. To create 3 or more outputs, you need to specify the number of
  23304. outputs, like in:
  23305. @example
  23306. [in] asplit=3 [out0][out1][out2]
  23307. @end example
  23308. @item
  23309. Create two separate outputs from the same input, one cropped and
  23310. one padded:
  23311. @example
  23312. [in] split [splitout1][splitout2];
  23313. [splitout1] crop=100:100:0:0 [cropout];
  23314. [splitout2] pad=200:200:100:100 [padout];
  23315. @end example
  23316. @item
  23317. Create 5 copies of the input audio with @command{ffmpeg}:
  23318. @example
  23319. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  23320. @end example
  23321. @end itemize
  23322. @section zmq, azmq
  23323. Receive commands sent through a libzmq client, and forward them to
  23324. filters in the filtergraph.
  23325. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  23326. must be inserted between two video filters, @code{azmq} between two
  23327. audio filters. Both are capable to send messages to any filter type.
  23328. To enable these filters you need to install the libzmq library and
  23329. headers and configure FFmpeg with @code{--enable-libzmq}.
  23330. For more information about libzmq see:
  23331. @url{http://www.zeromq.org/}
  23332. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  23333. receives messages sent through a network interface defined by the
  23334. @option{bind_address} (or the abbreviation "@option{b}") option.
  23335. Default value of this option is @file{tcp://localhost:5555}. You may
  23336. want to alter this value to your needs, but do not forget to escape any
  23337. ':' signs (see @ref{filtergraph escaping}).
  23338. The received message must be in the form:
  23339. @example
  23340. @var{TARGET} @var{COMMAND} [@var{ARG}]
  23341. @end example
  23342. @var{TARGET} specifies the target of the command, usually the name of
  23343. the filter class or a specific filter instance name. The default
  23344. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  23345. but you can override this by using the @samp{filter_name@@id} syntax
  23346. (see @ref{Filtergraph syntax}).
  23347. @var{COMMAND} specifies the name of the command for the target filter.
  23348. @var{ARG} is optional and specifies the optional argument list for the
  23349. given @var{COMMAND}.
  23350. Upon reception, the message is processed and the corresponding command
  23351. is injected into the filtergraph. Depending on the result, the filter
  23352. will send a reply to the client, adopting the format:
  23353. @example
  23354. @var{ERROR_CODE} @var{ERROR_REASON}
  23355. @var{MESSAGE}
  23356. @end example
  23357. @var{MESSAGE} is optional.
  23358. @subsection Examples
  23359. Look at @file{tools/zmqsend} for an example of a zmq client which can
  23360. be used to send commands processed by these filters.
  23361. Consider the following filtergraph generated by @command{ffplay}.
  23362. In this example the last overlay filter has an instance name. All other
  23363. filters will have default instance names.
  23364. @example
  23365. ffplay -dumpgraph 1 -f lavfi "
  23366. color=s=100x100:c=red [l];
  23367. color=s=100x100:c=blue [r];
  23368. nullsrc=s=200x100, zmq [bg];
  23369. [bg][l] overlay [bg+l];
  23370. [bg+l][r] overlay@@my=x=100 "
  23371. @end example
  23372. To change the color of the left side of the video, the following
  23373. command can be used:
  23374. @example
  23375. echo Parsed_color_0 c yellow | tools/zmqsend
  23376. @end example
  23377. To change the right side:
  23378. @example
  23379. echo Parsed_color_1 c pink | tools/zmqsend
  23380. @end example
  23381. To change the position of the right side:
  23382. @example
  23383. echo overlay@@my x 150 | tools/zmqsend
  23384. @end example
  23385. @c man end MULTIMEDIA FILTERS
  23386. @chapter Multimedia Sources
  23387. @c man begin MULTIMEDIA SOURCES
  23388. Below is a description of the currently available multimedia sources.
  23389. @section amovie
  23390. This is the same as @ref{movie} source, except it selects an audio
  23391. stream by default.
  23392. @section avsynctest
  23393. Generate an Audio/Video Sync Test.
  23394. Generated stream periodically shows flash video frame and emits beep in audio.
  23395. Useful to inspect A/V sync issues.
  23396. It accepts the following options:
  23397. @table @option
  23398. @item size, s
  23399. Set output video size. Default value is @code{hd720}.
  23400. @item framerate, fr
  23401. Set output video frame rate. Default value is @code{30}.
  23402. @item samplerate, sr
  23403. Set output audio sample rate. Default value is @code{44100}.
  23404. @item amplitude, a
  23405. Set output audio beep amplitude. Default value is @code{0.7}.
  23406. @item period, p
  23407. Set output audio beep period in seconds. Default value is @code{3}.
  23408. @item delay, dl
  23409. Set output video flash delay in number of frames. Default value is @code{0}.
  23410. @item cycle, c
  23411. Enable cycling of video delays, by default is disabled.
  23412. @item duration, d
  23413. Set stream output duration. By default duration is unlimited.
  23414. @item fg, bg, ag
  23415. Set foreground/background/additional color.
  23416. @end table
  23417. @anchor{movie}
  23418. @section movie
  23419. Read audio and/or video stream(s) from a movie container.
  23420. It accepts the following parameters:
  23421. @table @option
  23422. @item filename
  23423. The name of the resource to read (not necessarily a file; it can also be a
  23424. device or a stream accessed through some protocol).
  23425. @item format_name, f
  23426. Specifies the format assumed for the movie to read, and can be either
  23427. the name of a container or an input device. If not specified, the
  23428. format is guessed from @var{movie_name} or by probing.
  23429. @item seek_point, sp
  23430. Specifies the seek point in seconds. The frames will be output
  23431. starting from this seek point. The parameter is evaluated with
  23432. @code{av_strtod}, so the numerical value may be suffixed by an IS
  23433. postfix. The default value is "0".
  23434. @item streams, s
  23435. Specifies the streams to read. Several streams can be specified,
  23436. separated by "+". The source will then have as many outputs, in the
  23437. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  23438. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  23439. respectively the default (best suited) video and audio stream. Default
  23440. is "dv", or "da" if the filter is called as "amovie".
  23441. @item stream_index, si
  23442. Specifies the index of the video stream to read. If the value is -1,
  23443. the most suitable video stream will be automatically selected. The default
  23444. value is "-1". Deprecated. If the filter is called "amovie", it will select
  23445. audio instead of video.
  23446. @item loop
  23447. Specifies how many times to read the stream in sequence.
  23448. If the value is 0, the stream will be looped infinitely.
  23449. Default value is "1".
  23450. Note that when the movie is looped the source timestamps are not
  23451. changed, so it will generate non monotonically increasing timestamps.
  23452. @item discontinuity
  23453. Specifies the time difference between frames above which the point is
  23454. considered a timestamp discontinuity which is removed by adjusting the later
  23455. timestamps.
  23456. @item dec_threads
  23457. Specifies the number of threads for decoding
  23458. @item format_opts
  23459. Specify format options for the opened file. Format options can be specified
  23460. as a list of @var{key}=@var{value} pairs separated by ':'. The following example
  23461. shows how to add protocol_whitelist and protocol_blacklist options:
  23462. @example
  23463. ffplay -f lavfi
  23464. "movie=filename='1.sdp':format_opts='protocol_whitelist=file,rtp,udp\:protocol_blacklist=http'"
  23465. @end example
  23466. @end table
  23467. It allows overlaying a second video on top of the main input of
  23468. a filtergraph, as shown in this graph:
  23469. @example
  23470. input -----------> deltapts0 --> overlay --> output
  23471. ^
  23472. |
  23473. movie --> scale--> deltapts1 -------+
  23474. @end example
  23475. @subsection Examples
  23476. @itemize
  23477. @item
  23478. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  23479. on top of the input labelled "in":
  23480. @example
  23481. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  23482. [in] setpts=PTS-STARTPTS [main];
  23483. [main][over] overlay=16:16 [out]
  23484. @end example
  23485. @item
  23486. Read from a video4linux2 device, and overlay it on top of the input
  23487. labelled "in":
  23488. @example
  23489. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  23490. [in] setpts=PTS-STARTPTS [main];
  23491. [main][over] overlay=16:16 [out]
  23492. @end example
  23493. @item
  23494. Read the first video stream and the audio stream with id 0x81 from
  23495. dvd.vob; the video is connected to the pad named "video" and the audio is
  23496. connected to the pad named "audio":
  23497. @example
  23498. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  23499. @end example
  23500. @end itemize
  23501. @subsection Commands
  23502. Both movie and amovie support the following commands:
  23503. @table @option
  23504. @item seek
  23505. Perform seek using "av_seek_frame".
  23506. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  23507. @itemize
  23508. @item
  23509. @var{stream_index}: If stream_index is -1, a default
  23510. stream is selected, and @var{timestamp} is automatically converted
  23511. from AV_TIME_BASE units to the stream specific time_base.
  23512. @item
  23513. @var{timestamp}: Timestamp in AVStream.time_base units
  23514. or, if no stream is specified, in AV_TIME_BASE units.
  23515. @item
  23516. @var{flags}: Flags which select direction and seeking mode.
  23517. @end itemize
  23518. @item get_duration
  23519. Get movie duration in AV_TIME_BASE units.
  23520. @end table
  23521. @c man end MULTIMEDIA SOURCES