filters.texi 792 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676
  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. @end table
  283. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  284. @chapter Audio Filters
  285. @c man begin AUDIO FILTERS
  286. When you configure your FFmpeg build, you can disable any of the
  287. existing filters using @code{--disable-filters}.
  288. The configure output will show the audio filters included in your
  289. build.
  290. Below is a description of the currently available audio filters.
  291. @section acompressor
  292. A compressor is mainly used to reduce the dynamic range of a signal.
  293. Especially modern music is mostly compressed at a high ratio to
  294. improve the overall loudness. It's done to get the highest attention
  295. of a listener, "fatten" the sound and bring more "power" to the track.
  296. If a signal is compressed too much it may sound dull or "dead"
  297. afterwards or it may start to "pump" (which could be a powerful effect
  298. but can also destroy a track completely).
  299. The right compression is the key to reach a professional sound and is
  300. the high art of mixing and mastering. Because of its complex settings
  301. it may take a long time to get the right feeling for this kind of effect.
  302. Compression is done by detecting the volume above a chosen level
  303. @code{threshold} and dividing it by the factor set with @code{ratio}.
  304. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  305. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  306. the signal would cause distortion of the waveform the reduction can be
  307. levelled over the time. This is done by setting "Attack" and "Release".
  308. @code{attack} determines how long the signal has to rise above the threshold
  309. before any reduction will occur and @code{release} sets the time the signal
  310. has to fall below the threshold to reduce the reduction again. Shorter signals
  311. than the chosen attack time will be left untouched.
  312. The overall reduction of the signal can be made up afterwards with the
  313. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  314. raising the makeup to this level results in a signal twice as loud than the
  315. source. To gain a softer entry in the compression the @code{knee} flattens the
  316. hard edge at the threshold in the range of the chosen decibels.
  317. The filter accepts the following options:
  318. @table @option
  319. @item level_in
  320. Set input gain. Default is 1. Range is between 0.015625 and 64.
  321. @item mode
  322. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  323. Default is @code{downward}.
  324. @item threshold
  325. If a signal of stream rises above this level it will affect the gain
  326. reduction.
  327. By default it is 0.125. Range is between 0.00097563 and 1.
  328. @item ratio
  329. Set a ratio by which the signal is reduced. 1:2 means that if the level
  330. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  331. Default is 2. Range is between 1 and 20.
  332. @item attack
  333. Amount of milliseconds the signal has to rise above the threshold before gain
  334. reduction starts. Default is 20. Range is between 0.01 and 2000.
  335. @item release
  336. Amount of milliseconds the signal has to fall below the threshold before
  337. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  338. @item makeup
  339. Set the amount by how much signal will be amplified after processing.
  340. Default is 1. Range is from 1 to 64.
  341. @item knee
  342. Curve the sharp knee around the threshold to enter gain reduction more softly.
  343. Default is 2.82843. Range is between 1 and 8.
  344. @item link
  345. Choose if the @code{average} level between all channels of input stream
  346. or the louder(@code{maximum}) channel of input stream affects the
  347. reduction. Default is @code{average}.
  348. @item detection
  349. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  350. of @code{rms}. Default is @code{rms} which is mostly smoother.
  351. @item mix
  352. How much to use compressed signal in output. Default is 1.
  353. Range is between 0 and 1.
  354. @end table
  355. @subsection Commands
  356. This filter supports the all above options as @ref{commands}.
  357. @section acontrast
  358. Simple audio dynamic range compression/expansion filter.
  359. The filter accepts the following options:
  360. @table @option
  361. @item contrast
  362. Set contrast. Default is 33. Allowed range is between 0 and 100.
  363. @end table
  364. @section acopy
  365. Copy the input audio source unchanged to the output. This is mainly useful for
  366. testing purposes.
  367. @section acrossfade
  368. Apply cross fade from one input audio stream to another input audio stream.
  369. The cross fade is applied for specified duration near the end of first stream.
  370. The filter accepts the following options:
  371. @table @option
  372. @item nb_samples, ns
  373. Specify the number of samples for which the cross fade effect has to last.
  374. At the end of the cross fade effect the first input audio will be completely
  375. silent. Default is 44100.
  376. @item duration, d
  377. Specify the duration of the cross fade effect. See
  378. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  379. for the accepted syntax.
  380. By default the duration is determined by @var{nb_samples}.
  381. If set this option is used instead of @var{nb_samples}.
  382. @item overlap, o
  383. Should first stream end overlap with second stream start. Default is enabled.
  384. @item curve1
  385. Set curve for cross fade transition for first stream.
  386. @item curve2
  387. Set curve for cross fade transition for second stream.
  388. For description of available curve types see @ref{afade} filter description.
  389. @end table
  390. @subsection Examples
  391. @itemize
  392. @item
  393. Cross fade from one input to another:
  394. @example
  395. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  396. @end example
  397. @item
  398. Cross fade from one input to another but without overlapping:
  399. @example
  400. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  401. @end example
  402. @end itemize
  403. @section acrossover
  404. Split audio stream into several bands.
  405. This filter splits audio stream into two or more frequency ranges.
  406. Summing all streams back will give flat output.
  407. The filter accepts the following options:
  408. @table @option
  409. @item split
  410. Set split frequencies. Those must be positive and increasing.
  411. @item order
  412. Set filter order for each band split. This controls filter roll-off or steepness
  413. of filter transfer function.
  414. Available values are:
  415. @table @samp
  416. @item 2nd
  417. 12 dB per octave.
  418. @item 4th
  419. 24 dB per octave.
  420. @item 6th
  421. 36 dB per octave.
  422. @item 8th
  423. 48 dB per octave.
  424. @item 10th
  425. 60 dB per octave.
  426. @item 12th
  427. 72 dB per octave.
  428. @item 14th
  429. 84 dB per octave.
  430. @item 16th
  431. 96 dB per octave.
  432. @item 18th
  433. 108 dB per octave.
  434. @item 20th
  435. 120 dB per octave.
  436. @end table
  437. Default is @var{4th}.
  438. @item level
  439. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  440. @item gains
  441. Set output gain for each band. Default value is 1 for all bands.
  442. @end table
  443. @subsection Examples
  444. @itemize
  445. @item
  446. Split input audio stream into two bands (low and high) with split frequency of 1500 Hz,
  447. each band will be in separate stream:
  448. @example
  449. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  450. @end example
  451. @item
  452. Same as above, but with higher filter order:
  453. @example
  454. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500:order=8th[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  455. @end example
  456. @item
  457. Same as above, but also with additional middle band (frequencies between 1500 and 8000):
  458. @example
  459. 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
  460. @end example
  461. @end itemize
  462. @section acrusher
  463. Reduce audio bit resolution.
  464. This filter is bit crusher with enhanced functionality. A bit crusher
  465. is used to audibly reduce number of bits an audio signal is sampled
  466. with. This doesn't change the bit depth at all, it just produces the
  467. effect. Material reduced in bit depth sounds more harsh and "digital".
  468. This filter is able to even round to continuous values instead of discrete
  469. bit depths.
  470. Additionally it has a D/C offset which results in different crushing of
  471. the lower and the upper half of the signal.
  472. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  473. Another feature of this filter is the logarithmic mode.
  474. This setting switches from linear distances between bits to logarithmic ones.
  475. The result is a much more "natural" sounding crusher which doesn't gate low
  476. signals for example. The human ear has a logarithmic perception,
  477. so this kind of crushing is much more pleasant.
  478. Logarithmic crushing is also able to get anti-aliased.
  479. The filter accepts the following options:
  480. @table @option
  481. @item level_in
  482. Set level in.
  483. @item level_out
  484. Set level out.
  485. @item bits
  486. Set bit reduction.
  487. @item mix
  488. Set mixing amount.
  489. @item mode
  490. Can be linear: @code{lin} or logarithmic: @code{log}.
  491. @item dc
  492. Set DC.
  493. @item aa
  494. Set anti-aliasing.
  495. @item samples
  496. Set sample reduction.
  497. @item lfo
  498. Enable LFO. By default disabled.
  499. @item lforange
  500. Set LFO range.
  501. @item lforate
  502. Set LFO rate.
  503. @end table
  504. @subsection Commands
  505. This filter supports the all above options as @ref{commands}.
  506. @section acue
  507. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  508. filter.
  509. @section adeclick
  510. Remove impulsive noise from input audio.
  511. Samples detected as impulsive noise are replaced by interpolated samples using
  512. autoregressive modelling.
  513. @table @option
  514. @item window, w
  515. Set window size, in milliseconds. Allowed range is from @code{10} to
  516. @code{100}. Default value is @code{55} milliseconds.
  517. This sets size of window which will be processed at once.
  518. @item overlap, o
  519. Set window overlap, in percentage of window size. Allowed range is from
  520. @code{50} to @code{95}. Default value is @code{75} percent.
  521. Setting this to a very high value increases impulsive noise removal but makes
  522. whole process much slower.
  523. @item arorder, a
  524. Set autoregression order, in percentage of window size. Allowed range is from
  525. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  526. controls quality of interpolated samples using neighbour good samples.
  527. @item threshold, t
  528. Set threshold value. Allowed range is from @code{1} to @code{100}.
  529. Default value is @code{2}.
  530. This controls the strength of impulsive noise which is going to be removed.
  531. The lower value, the more samples will be detected as impulsive noise.
  532. @item burst, b
  533. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  534. @code{10}. Default value is @code{2}.
  535. If any two samples detected as noise are spaced less than this value then any
  536. sample between those two samples will be also detected as noise.
  537. @item method, m
  538. Set overlap method.
  539. It accepts the following values:
  540. @table @option
  541. @item add, a
  542. Select overlap-add method. Even not interpolated samples are slightly
  543. changed with this method.
  544. @item save, s
  545. Select overlap-save method. Not interpolated samples remain unchanged.
  546. @end table
  547. Default value is @code{a}.
  548. @end table
  549. @section adeclip
  550. Remove clipped samples from input audio.
  551. Samples detected as clipped are replaced by interpolated samples using
  552. autoregressive modelling.
  553. @table @option
  554. @item window, w
  555. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  556. Default value is @code{55} milliseconds.
  557. This sets size of window which will be processed at once.
  558. @item overlap, o
  559. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  560. to @code{95}. Default value is @code{75} percent.
  561. @item arorder, a
  562. Set autoregression order, in percentage of window size. Allowed range is from
  563. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  564. quality of interpolated samples using neighbour good samples.
  565. @item threshold, t
  566. Set threshold value. Allowed range is from @code{1} to @code{100}.
  567. Default value is @code{10}. Higher values make clip detection less aggressive.
  568. @item hsize, n
  569. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  570. Default value is @code{1000}. Higher values make clip detection less aggressive.
  571. @item method, m
  572. Set overlap method.
  573. It accepts the following values:
  574. @table @option
  575. @item add, a
  576. Select overlap-add method. Even not interpolated samples are slightly changed
  577. with this method.
  578. @item save, s
  579. Select overlap-save method. Not interpolated samples remain unchanged.
  580. @end table
  581. Default value is @code{a}.
  582. @end table
  583. @section adecorrelate
  584. Apply decorrelation to input audio stream.
  585. The filter accepts the following options:
  586. @table @option
  587. @item stages
  588. Set decorrelation stages of filtering. Allowed
  589. range is from 1 to 16. Default value is 6.
  590. @item seed
  591. Set random seed used for setting delay in samples across channels.
  592. @end table
  593. @section adelay
  594. Delay one or more audio channels.
  595. Samples in delayed channel are filled with silence.
  596. The filter accepts the following option:
  597. @table @option
  598. @item delays
  599. Set list of delays in milliseconds for each channel separated by '|'.
  600. Unused delays will be silently ignored. If number of given delays is
  601. smaller than number of channels all remaining channels will not be delayed.
  602. If you want to delay exact number of samples, append 'S' to number.
  603. If you want instead to delay in seconds, append 's' to number.
  604. @item all
  605. Use last set delay for all remaining channels. By default is disabled.
  606. This option if enabled changes how option @code{delays} is interpreted.
  607. @end table
  608. @subsection Examples
  609. @itemize
  610. @item
  611. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  612. the second channel (and any other channels that may be present) unchanged.
  613. @example
  614. adelay=1500|0|500
  615. @end example
  616. @item
  617. Delay second channel by 500 samples, the third channel by 700 samples and leave
  618. the first channel (and any other channels that may be present) unchanged.
  619. @example
  620. adelay=0|500S|700S
  621. @end example
  622. @item
  623. Delay all channels by same number of samples:
  624. @example
  625. adelay=delays=64S:all=1
  626. @end example
  627. @end itemize
  628. @section adenorm
  629. Remedy denormals in audio by adding extremely low-level noise.
  630. This filter shall be placed before any filter that can produce denormals.
  631. A description of the accepted parameters follows.
  632. @table @option
  633. @item level
  634. Set level of added noise in dB. Default is @code{-351}.
  635. Allowed range is from -451 to -90.
  636. @item type
  637. Set type of added noise.
  638. @table @option
  639. @item dc
  640. Add DC signal.
  641. @item ac
  642. Add AC signal.
  643. @item square
  644. Add square signal.
  645. @item pulse
  646. Add pulse signal.
  647. @end table
  648. Default is @code{dc}.
  649. @end table
  650. @subsection Commands
  651. This filter supports the all above options as @ref{commands}.
  652. @section aderivative, aintegral
  653. Compute derivative/integral of audio stream.
  654. Applying both filters one after another produces original audio.
  655. @section adynamicequalizer
  656. Apply dynamic equalization to input audio stream.
  657. A description of the accepted options follows.
  658. @table @option
  659. @item threshold
  660. Set the detection threshold used to trigger equalization.
  661. Threshold detection is using bandpass filter.
  662. Default value is 0. Allowed range is from 0 to 100.
  663. @item dfrequency
  664. Set the detection frequency in Hz used for bandpass filter used to trigger equalization.
  665. Default value is 1000 Hz. Allowed range is between 2 and 1000000 Hz.
  666. @item dqfactor
  667. Set the detection resonance factor for bandpass filter used to trigger equalization.
  668. Default value is 1. Allowed range is from 0.001 to 1000.
  669. @item tfrequency
  670. Set the target frequency of equalization filter.
  671. Default value is 1000 Hz. Allowed range is between 2 and 1000000 Hz.
  672. @item tqfactor
  673. Set the target resonance factor for target equalization filter.
  674. Default value is 1. Allowed range is from 0.001 to 1000.
  675. @item attack
  676. Set the amount of milliseconds the signal from detection has to rise above
  677. the detection threshold before equalization starts.
  678. Default is 20. Allowed range is between 1 and 2000.
  679. @item release
  680. Set the amount of milliseconds the signal from detection has to fall below the
  681. detection threshold before equalization ends.
  682. Default is 200. Allowed range is between 1 and 2000.
  683. @item knee
  684. Curve the sharp knee around the detection threshold to calculate
  685. equalization gain more softly.
  686. Default is 1. Allowed range is between 0 and 8.
  687. @item ratio
  688. Set the ratio by which the equalization gain is raised.
  689. Default is 1. Allowed range is between 1 and 20.
  690. @item makeup
  691. Set the makeup offset in dB by which the equalization gain is raised.
  692. Default is 0. Allowed range is between 0 and 30.
  693. @item range
  694. Set the max allowed cut/boost amount in dB. Default is 0.
  695. Allowed range is from 0 to 200.
  696. @item slew
  697. Set the slew factor. Default is 1. Allowed range is from 1 to 200.
  698. @item mode
  699. Set the mode of filter operation, can be one of the following:
  700. @table @samp
  701. @item listen
  702. Output only isolated bandpass signal.
  703. @item cut
  704. Cut frequencies above detection threshold.
  705. @item boost
  706. Boost frequencies bellow detection threshold.
  707. @end table
  708. Default mode is @samp{cut}.
  709. @end table
  710. @subsection Commands
  711. This filter supports the all above options as @ref{commands}.
  712. @section adynamicsmooth
  713. Apply dynamic smoothing to input audio stream.
  714. A description of the accepted options follows.
  715. @table @option
  716. @item sensitivity
  717. Set an amount of sensitivity to frequency fluctations. Default is 2.
  718. Allowed range is from 0 to 1e+06.
  719. @item basefreq
  720. Set a base frequency for smoothing. Default value is 22050.
  721. Allowed range is from 2 to 1e+06.
  722. @end table
  723. @subsection Commands
  724. This filter supports the all above options as @ref{commands}.
  725. @section aecho
  726. Apply echoing to the input audio.
  727. Echoes are reflected sound and can occur naturally amongst mountains
  728. (and sometimes large buildings) when talking or shouting; digital echo
  729. effects emulate this behaviour and are often used to help fill out the
  730. sound of a single instrument or vocal. The time difference between the
  731. original signal and the reflection is the @code{delay}, and the
  732. loudness of the reflected signal is the @code{decay}.
  733. Multiple echoes can have different delays and decays.
  734. A description of the accepted parameters follows.
  735. @table @option
  736. @item in_gain
  737. Set input gain of reflected signal. Default is @code{0.6}.
  738. @item out_gain
  739. Set output gain of reflected signal. Default is @code{0.3}.
  740. @item delays
  741. Set list of time intervals in milliseconds between original signal and reflections
  742. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  743. Default is @code{1000}.
  744. @item decays
  745. Set list of loudness of reflected signals separated by '|'.
  746. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  747. Default is @code{0.5}.
  748. @end table
  749. @subsection Examples
  750. @itemize
  751. @item
  752. Make it sound as if there are twice as many instruments as are actually playing:
  753. @example
  754. aecho=0.8:0.88:60:0.4
  755. @end example
  756. @item
  757. If delay is very short, then it sounds like a (metallic) robot playing music:
  758. @example
  759. aecho=0.8:0.88:6:0.4
  760. @end example
  761. @item
  762. A longer delay will sound like an open air concert in the mountains:
  763. @example
  764. aecho=0.8:0.9:1000:0.3
  765. @end example
  766. @item
  767. Same as above but with one more mountain:
  768. @example
  769. aecho=0.8:0.9:1000|1800:0.3|0.25
  770. @end example
  771. @end itemize
  772. @section aemphasis
  773. Audio emphasis filter creates or restores material directly taken from LPs or
  774. emphased CDs with different filter curves. E.g. to store music on vinyl the
  775. signal has to be altered by a filter first to even out the disadvantages of
  776. this recording medium.
  777. Once the material is played back the inverse filter has to be applied to
  778. restore the distortion of the frequency response.
  779. The filter accepts the following options:
  780. @table @option
  781. @item level_in
  782. Set input gain.
  783. @item level_out
  784. Set output gain.
  785. @item mode
  786. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  787. use @code{production} mode. Default is @code{reproduction} mode.
  788. @item type
  789. Set filter type. Selects medium. Can be one of the following:
  790. @table @option
  791. @item col
  792. select Columbia.
  793. @item emi
  794. select EMI.
  795. @item bsi
  796. select BSI (78RPM).
  797. @item riaa
  798. select RIAA.
  799. @item cd
  800. select Compact Disc (CD).
  801. @item 50fm
  802. select 50µs (FM).
  803. @item 75fm
  804. select 75µs (FM).
  805. @item 50kf
  806. select 50µs (FM-KF).
  807. @item 75kf
  808. select 75µs (FM-KF).
  809. @end table
  810. @end table
  811. @subsection Commands
  812. This filter supports the all above options as @ref{commands}.
  813. @section aeval
  814. Modify an audio signal according to the specified expressions.
  815. This filter accepts one or more expressions (one for each channel),
  816. which are evaluated and used to modify a corresponding audio signal.
  817. It accepts the following parameters:
  818. @table @option
  819. @item exprs
  820. Set the '|'-separated expressions list for each separate channel. If
  821. the number of input channels is greater than the number of
  822. expressions, the last specified expression is used for the remaining
  823. output channels.
  824. @item channel_layout, c
  825. Set output channel layout. If not specified, the channel layout is
  826. specified by the number of expressions. If set to @samp{same}, it will
  827. use by default the same input channel layout.
  828. @end table
  829. Each expression in @var{exprs} can contain the following constants and functions:
  830. @table @option
  831. @item ch
  832. channel number of the current expression
  833. @item n
  834. number of the evaluated sample, starting from 0
  835. @item s
  836. sample rate
  837. @item t
  838. time of the evaluated sample expressed in seconds
  839. @item nb_in_channels
  840. @item nb_out_channels
  841. input and output number of channels
  842. @item val(CH)
  843. the value of input channel with number @var{CH}
  844. @end table
  845. Note: this filter is slow. For faster processing you should use a
  846. dedicated filter.
  847. @subsection Examples
  848. @itemize
  849. @item
  850. Half volume:
  851. @example
  852. aeval=val(ch)/2:c=same
  853. @end example
  854. @item
  855. Invert phase of the second channel:
  856. @example
  857. aeval=val(0)|-val(1)
  858. @end example
  859. @end itemize
  860. @section aexciter
  861. An exciter is used to produce high sound that is not present in the
  862. original signal. This is done by creating harmonic distortions of the
  863. signal which are restricted in range and added to the original signal.
  864. An Exciter raises the upper end of an audio signal without simply raising
  865. the higher frequencies like an equalizer would do to create a more
  866. "crisp" or "brilliant" sound.
  867. The filter accepts the following options:
  868. @table @option
  869. @item level_in
  870. Set input level prior processing of signal.
  871. Allowed range is from 0 to 64.
  872. Default value is 1.
  873. @item level_out
  874. Set output level after processing of signal.
  875. Allowed range is from 0 to 64.
  876. Default value is 1.
  877. @item amount
  878. Set the amount of harmonics added to original signal.
  879. Allowed range is from 0 to 64.
  880. Default value is 1.
  881. @item drive
  882. Set the amount of newly created harmonics.
  883. Allowed range is from 0.1 to 10.
  884. Default value is 8.5.
  885. @item blend
  886. Set the octave of newly created harmonics.
  887. Allowed range is from -10 to 10.
  888. Default value is 0.
  889. @item freq
  890. Set the lower frequency limit of producing harmonics in Hz.
  891. Allowed range is from 2000 to 12000 Hz.
  892. Default is 7500 Hz.
  893. @item ceil
  894. Set the upper frequency limit of producing harmonics.
  895. Allowed range is from 9999 to 20000 Hz.
  896. If value is lower than 10000 Hz no limit is applied.
  897. @item listen
  898. Mute the original signal and output only added harmonics.
  899. By default is disabled.
  900. @end table
  901. @subsection Commands
  902. This filter supports the all above options as @ref{commands}.
  903. @anchor{afade}
  904. @section afade
  905. Apply fade-in/out effect to input audio.
  906. A description of the accepted parameters follows.
  907. @table @option
  908. @item type, t
  909. Specify the effect type, can be either @code{in} for fade-in, or
  910. @code{out} for a fade-out effect. Default is @code{in}.
  911. @item start_sample, ss
  912. Specify the number of the start sample for starting to apply the fade
  913. effect. Default is 0.
  914. @item nb_samples, ns
  915. Specify the number of samples for which the fade effect has to last. At
  916. the end of the fade-in effect the output audio will have the same
  917. volume as the input audio, at the end of the fade-out transition
  918. the output audio will be silence. Default is 44100.
  919. @item start_time, st
  920. Specify the start time of the fade effect. Default is 0.
  921. The value must be specified as a time duration; see
  922. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  923. for the accepted syntax.
  924. If set this option is used instead of @var{start_sample}.
  925. @item duration, d
  926. Specify the duration of the fade effect. See
  927. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  928. for the accepted syntax.
  929. At the end of the fade-in effect the output audio will have the same
  930. volume as the input audio, at the end of the fade-out transition
  931. the output audio will be silence.
  932. By default the duration is determined by @var{nb_samples}.
  933. If set this option is used instead of @var{nb_samples}.
  934. @item curve
  935. Set curve for fade transition.
  936. It accepts the following values:
  937. @table @option
  938. @item tri
  939. select triangular, linear slope (default)
  940. @item qsin
  941. select quarter of sine wave
  942. @item hsin
  943. select half of sine wave
  944. @item esin
  945. select exponential sine wave
  946. @item log
  947. select logarithmic
  948. @item ipar
  949. select inverted parabola
  950. @item qua
  951. select quadratic
  952. @item cub
  953. select cubic
  954. @item squ
  955. select square root
  956. @item cbr
  957. select cubic root
  958. @item par
  959. select parabola
  960. @item exp
  961. select exponential
  962. @item iqsin
  963. select inverted quarter of sine wave
  964. @item ihsin
  965. select inverted half of sine wave
  966. @item dese
  967. select double-exponential seat
  968. @item desi
  969. select double-exponential sigmoid
  970. @item losi
  971. select logistic sigmoid
  972. @item sinc
  973. select sine cardinal function
  974. @item isinc
  975. select inverted sine cardinal function
  976. @item nofade
  977. no fade applied
  978. @end table
  979. @end table
  980. @subsection Commands
  981. This filter supports the all above options as @ref{commands}.
  982. @subsection Examples
  983. @itemize
  984. @item
  985. Fade in first 15 seconds of audio:
  986. @example
  987. afade=t=in:ss=0:d=15
  988. @end example
  989. @item
  990. Fade out last 25 seconds of a 900 seconds audio:
  991. @example
  992. afade=t=out:st=875:d=25
  993. @end example
  994. @end itemize
  995. @section afftdn
  996. Denoise audio samples with FFT.
  997. A description of the accepted parameters follows.
  998. @table @option
  999. @item noise_reduction, nr
  1000. Set the noise reduction in dB, allowed range is 0.01 to 97.
  1001. Default value is 12 dB.
  1002. @item noise_floor, nf
  1003. Set the noise floor in dB, allowed range is -80 to -20.
  1004. Default value is -50 dB.
  1005. @item noise_type, nt
  1006. Set the noise type.
  1007. It accepts the following values:
  1008. @table @option
  1009. @item white, w
  1010. Select white noise.
  1011. @item vinyl, v
  1012. Select vinyl noise.
  1013. @item shellac, s
  1014. Select shellac noise.
  1015. @item custom, c
  1016. Select custom noise, defined in @code{bn} option.
  1017. Default value is white noise.
  1018. @end table
  1019. @item band_noise, bn
  1020. Set custom band noise profile for every one of 15 bands.
  1021. Bands are separated by ' ' or '|'.
  1022. @item residual_floor, rf
  1023. Set the residual floor in dB, allowed range is -80 to -20.
  1024. Default value is -38 dB.
  1025. @item track_noise, tn
  1026. Enable noise floor tracking. By default is disabled.
  1027. With this enabled, noise floor is automatically adjusted.
  1028. @item track_residual, tr
  1029. Enable residual tracking. By default is disabled.
  1030. @item output_mode, om
  1031. Set the output mode.
  1032. It accepts the following values:
  1033. @table @option
  1034. @item input, i
  1035. Pass input unchanged.
  1036. @item output, o
  1037. Pass noise filtered out.
  1038. @item noise, n
  1039. Pass only noise.
  1040. Default value is @var{output}.
  1041. @end table
  1042. @item adaptivity, ad
  1043. Set the adaptivity factor, used how fast to adapt gains adjustments per
  1044. each frequency bin. Value @var{0} enables instant adaptation, while higher values
  1045. react much slower.
  1046. Allowed range is from @var{0} to @var{1}. Default value is @var{0.5}.
  1047. @item floor_offset, fo
  1048. Set the noise floor offset factor. This option is used to adjust offset applied to measured
  1049. noise floor. It is only effective when noise floor tracking is enabled.
  1050. Allowed range is from @var{-2.0} to @var{2.0}. Default value is @var{1.0}.
  1051. @item noise_link, nl
  1052. Set the noise link used for multichannel audio.
  1053. It accepts the following values:
  1054. @table @option
  1055. @item none
  1056. Use unchanged channel's noise floor.
  1057. @item min
  1058. Use measured min noise floor of all channels.
  1059. @item max
  1060. Use measured max noise floor of all channels.
  1061. @item average
  1062. Use measured average noise floor of all channels.
  1063. Default value is @var{min}.
  1064. @end table
  1065. @item band_multiplier, bm
  1066. Set the band multiplier factor, used how much to spread bands across frequency bins.
  1067. Allowed range is from @var{0.2} to @var{5}. Default value is @var{1.25}.
  1068. @item sample_noise, sn
  1069. Toggle capturing and measurement of noise profile from input audio.
  1070. It accepts the following values:
  1071. @table @option
  1072. @item start, begin
  1073. Start sample noise capture.
  1074. @item stop, end
  1075. Stop sample noise capture and measure new noise band profile.
  1076. Default value is @code{none}.
  1077. @end table
  1078. @item gain_smooth, gs
  1079. Set gain smooth spatial radius, used to smooth gains applied to each frequency bin.
  1080. Useful to reduce random music noise artefacts.
  1081. Higher values increases smoothing of gains.
  1082. Allowed range is from @code{0} to @code{50}.
  1083. Default value is @code{0}.
  1084. @end table
  1085. @subsection Commands
  1086. This filter supports the some above mentioned options as @ref{commands}.
  1087. @subsection Examples
  1088. @itemize
  1089. @item
  1090. Reduce white noise by 10dB, and use previously measured noise floor of -40dB:
  1091. @example
  1092. afftdn=nr=10:nf=-40
  1093. @end example
  1094. @item
  1095. Reduce white noise by 10dB, also set initial noise floor to -80dB and enable automatic
  1096. tracking of noise floor so noise floor will gradually change during processing:
  1097. @example
  1098. afftdn=nr=10:nf=-80:tn=1
  1099. @end example
  1100. @item
  1101. Reduce noise by 20dB, using noise floor of -40dB and using commands to take noise profile
  1102. of first 0.4 seconds of input audio:
  1103. @example
  1104. asendcmd=0.0 afftdn sn start,asendcmd=0.4 afftdn sn stop,afftdn=nr=20:nf=-40
  1105. @end example
  1106. @end itemize
  1107. @section afftfilt
  1108. Apply arbitrary expressions to samples in frequency domain.
  1109. @table @option
  1110. @item real
  1111. Set frequency domain real expression for each separate channel separated
  1112. by '|'. Default is "re".
  1113. If the number of input channels is greater than the number of
  1114. expressions, the last specified expression is used for the remaining
  1115. output channels.
  1116. @item imag
  1117. Set frequency domain imaginary expression for each separate channel
  1118. separated by '|'. Default is "im".
  1119. Each expression in @var{real} and @var{imag} can contain the following
  1120. constants and functions:
  1121. @table @option
  1122. @item sr
  1123. sample rate
  1124. @item b
  1125. current frequency bin number
  1126. @item nb
  1127. number of available bins
  1128. @item ch
  1129. channel number of the current expression
  1130. @item chs
  1131. number of channels
  1132. @item pts
  1133. current frame pts
  1134. @item re
  1135. current real part of frequency bin of current channel
  1136. @item im
  1137. current imaginary part of frequency bin of current channel
  1138. @item real(b, ch)
  1139. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  1140. @item imag(b, ch)
  1141. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  1142. @end table
  1143. @item win_size
  1144. Set window size. Allowed range is from 16 to 131072.
  1145. Default is @code{4096}
  1146. @item win_func
  1147. Set window function.
  1148. It accepts the following values:
  1149. @table @samp
  1150. @item rect
  1151. @item bartlett
  1152. @item hann, hanning
  1153. @item hamming
  1154. @item blackman
  1155. @item welch
  1156. @item flattop
  1157. @item bharris
  1158. @item bnuttall
  1159. @item bhann
  1160. @item sine
  1161. @item nuttall
  1162. @item lanczos
  1163. @item gauss
  1164. @item tukey
  1165. @item dolph
  1166. @item cauchy
  1167. @item parzen
  1168. @item poisson
  1169. @item bohman
  1170. @end table
  1171. Default is @code{hann}.
  1172. @item overlap
  1173. Set window overlap. If set to 1, the recommended overlap for selected
  1174. window function will be picked. Default is @code{0.75}.
  1175. @end table
  1176. @subsection Examples
  1177. @itemize
  1178. @item
  1179. Leave almost only low frequencies in audio:
  1180. @example
  1181. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  1182. @end example
  1183. @item
  1184. Apply robotize effect:
  1185. @example
  1186. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  1187. @end example
  1188. @item
  1189. Apply whisper effect:
  1190. @example
  1191. 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"
  1192. @end example
  1193. @end itemize
  1194. @anchor{afir}
  1195. @section afir
  1196. Apply an arbitrary Finite Impulse Response filter.
  1197. This filter is designed for applying long FIR filters,
  1198. up to 60 seconds long.
  1199. It can be used as component for digital crossover filters,
  1200. room equalization, cross talk cancellation, wavefield synthesis,
  1201. auralization, ambiophonics, ambisonics and spatialization.
  1202. This filter uses the streams higher than first one as FIR coefficients.
  1203. If the non-first stream holds a single channel, it will be used
  1204. for all input channels in the first stream, otherwise
  1205. the number of channels in the non-first stream must be same as
  1206. the number of channels in the first stream.
  1207. It accepts the following parameters:
  1208. @table @option
  1209. @item dry
  1210. Set dry gain. This sets input gain.
  1211. @item wet
  1212. Set wet gain. This sets final output gain.
  1213. @item length
  1214. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  1215. @item gtype
  1216. Enable applying gain measured from power of IR.
  1217. Set which approach to use for auto gain measurement.
  1218. @table @option
  1219. @item none
  1220. Do not apply any gain.
  1221. @item peak
  1222. select peak gain, very conservative approach. This is default value.
  1223. @item dc
  1224. select DC gain, limited application.
  1225. @item gn
  1226. select gain to noise approach, this is most popular one.
  1227. @end table
  1228. @item irgain
  1229. Set gain to be applied to IR coefficients before filtering.
  1230. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  1231. @item irfmt
  1232. Set format of IR stream. Can be @code{mono} or @code{input}.
  1233. Default is @code{input}.
  1234. @item maxir
  1235. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  1236. Allowed range is 0.1 to 60 seconds.
  1237. @item response
  1238. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1239. By default it is disabled.
  1240. @item channel
  1241. Set for which IR channel to display frequency response. By default is first channel
  1242. displayed. This option is used only when @var{response} is enabled.
  1243. @item size
  1244. Set video stream size. This option is used only when @var{response} is enabled.
  1245. @item rate
  1246. Set video stream frame rate. This option is used only when @var{response} is enabled.
  1247. @item minp
  1248. Set minimal partition size used for convolution. Default is @var{8192}.
  1249. Allowed range is from @var{1} to @var{32768}.
  1250. Lower values decreases latency at cost of higher CPU usage.
  1251. @item maxp
  1252. Set maximal partition size used for convolution. Default is @var{8192}.
  1253. Allowed range is from @var{8} to @var{32768}.
  1254. Lower values may increase CPU usage.
  1255. @item nbirs
  1256. Set number of input impulse responses streams which will be switchable at runtime.
  1257. Allowed range is from @var{1} to @var{32}. Default is @var{1}.
  1258. @item ir
  1259. Set IR stream which will be used for convolution, starting from @var{0}, should always be
  1260. lower than supplied value by @code{nbirs} option. Default is @var{0}.
  1261. This option can be changed at runtime via @ref{commands}.
  1262. @end table
  1263. @subsection Examples
  1264. @itemize
  1265. @item
  1266. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  1267. @example
  1268. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  1269. @end example
  1270. @end itemize
  1271. @anchor{aformat}
  1272. @section aformat
  1273. Set output format constraints for the input audio. The framework will
  1274. negotiate the most appropriate format to minimize conversions.
  1275. It accepts the following parameters:
  1276. @table @option
  1277. @item sample_fmts, f
  1278. A '|'-separated list of requested sample formats.
  1279. @item sample_rates, r
  1280. A '|'-separated list of requested sample rates.
  1281. @item channel_layouts, cl
  1282. A '|'-separated list of requested channel layouts.
  1283. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1284. for the required syntax.
  1285. @end table
  1286. If a parameter is omitted, all values are allowed.
  1287. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1288. @example
  1289. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1290. @end example
  1291. @section afreqshift
  1292. Apply frequency shift to input audio samples.
  1293. The filter accepts the following options:
  1294. @table @option
  1295. @item shift
  1296. Specify frequency shift. Allowed range is -INT_MAX to INT_MAX.
  1297. Default value is 0.0.
  1298. @item level
  1299. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  1300. Default value is 1.0.
  1301. @item order
  1302. Set filter order used for filtering. Allowed range is from 1 to 16.
  1303. Default value is 8.
  1304. @end table
  1305. @subsection Commands
  1306. This filter supports the all above options as @ref{commands}.
  1307. @section afwtdn
  1308. Reduce broadband noise from input samples using Wavelets.
  1309. A description of the accepted options follows.
  1310. @table @option
  1311. @item sigma
  1312. Set the noise sigma, allowed range is from 0 to 1.
  1313. Default value is 0.
  1314. This option controls strength of denoising applied to input samples.
  1315. Most useful way to set this option is via decibels, eg. -45dB.
  1316. @item levels
  1317. Set the number of wavelet levels of decomposition.
  1318. Allowed range is from 1 to 12.
  1319. Default value is 10.
  1320. Setting this too low make denoising performance very poor.
  1321. @item wavet
  1322. Set wavelet type for decomposition of input frame.
  1323. They are sorted by number of coefficients, from lowest to highest.
  1324. More coefficients means worse filtering speed, but overall better quality.
  1325. Available wavelets are:
  1326. @table @samp
  1327. @item sym2
  1328. @item sym4
  1329. @item rbior68
  1330. @item deb10
  1331. @item sym10
  1332. @item coif5
  1333. @item bl3
  1334. @end table
  1335. @item percent
  1336. Set percent of full denoising. Allowed range is from 0 to 100 percent.
  1337. Default value is 85 percent or partial denoising.
  1338. @item profile
  1339. If enabled, first input frame will be used as noise profile.
  1340. If first frame samples contain non-noise performance will be very poor.
  1341. @item adaptive
  1342. If enabled, input frames are analyzed for presence of noise.
  1343. If noise is detected with high possibility then input frame profile will be
  1344. used for processing following frames, until new noise frame is detected.
  1345. @item samples
  1346. Set size of single frame in number of samples. Allowed range is from 512 to
  1347. 65536. Default frame size is 8192 samples.
  1348. @item softness
  1349. Set softness applied inside thresholding function. Allowed range is from 0 to
  1350. 10. Default softness is 1.
  1351. @end table
  1352. @subsection Commands
  1353. This filter supports the all above options as @ref{commands}.
  1354. @section agate
  1355. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1356. processing reduces disturbing noise between useful signals.
  1357. Gating is done by detecting the volume below a chosen level @var{threshold}
  1358. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1359. floor is set via @var{range}. Because an exact manipulation of the signal
  1360. would cause distortion of the waveform the reduction can be levelled over
  1361. time. This is done by setting @var{attack} and @var{release}.
  1362. @var{attack} determines how long the signal has to fall below the threshold
  1363. before any reduction will occur and @var{release} sets the time the signal
  1364. has to rise above the threshold to reduce the reduction again.
  1365. Shorter signals than the chosen attack time will be left untouched.
  1366. @table @option
  1367. @item level_in
  1368. Set input level before filtering.
  1369. Default is 1. Allowed range is from 0.015625 to 64.
  1370. @item mode
  1371. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1372. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1373. will be amplified, expanding dynamic range in upward direction.
  1374. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1375. @item range
  1376. Set the level of gain reduction when the signal is below the threshold.
  1377. Default is 0.06125. Allowed range is from 0 to 1.
  1378. Setting this to 0 disables reduction and then filter behaves like expander.
  1379. @item threshold
  1380. If a signal rises above this level the gain reduction is released.
  1381. Default is 0.125. Allowed range is from 0 to 1.
  1382. @item ratio
  1383. Set a ratio by which the signal is reduced.
  1384. Default is 2. Allowed range is from 1 to 9000.
  1385. @item attack
  1386. Amount of milliseconds the signal has to rise above the threshold before gain
  1387. reduction stops.
  1388. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1389. @item release
  1390. Amount of milliseconds the signal has to fall below the threshold before the
  1391. reduction is increased again. Default is 250 milliseconds.
  1392. Allowed range is from 0.01 to 9000.
  1393. @item makeup
  1394. Set amount of amplification of signal after processing.
  1395. Default is 1. Allowed range is from 1 to 64.
  1396. @item knee
  1397. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1398. Default is 2.828427125. Allowed range is from 1 to 8.
  1399. @item detection
  1400. Choose if exact signal should be taken for detection or an RMS like one.
  1401. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1402. @item link
  1403. Choose if the average level between all channels or the louder channel affects
  1404. the reduction.
  1405. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1406. @end table
  1407. @subsection Commands
  1408. This filter supports the all above options as @ref{commands}.
  1409. @section aiir
  1410. Apply an arbitrary Infinite Impulse Response filter.
  1411. It accepts the following parameters:
  1412. @table @option
  1413. @item zeros, z
  1414. Set B/numerator/zeros/reflection coefficients.
  1415. @item poles, p
  1416. Set A/denominator/poles/ladder coefficients.
  1417. @item gains, k
  1418. Set channels gains.
  1419. @item dry_gain
  1420. Set input gain.
  1421. @item wet_gain
  1422. Set output gain.
  1423. @item format, f
  1424. Set coefficients format.
  1425. @table @samp
  1426. @item ll
  1427. lattice-ladder function
  1428. @item sf
  1429. analog transfer function
  1430. @item tf
  1431. digital transfer function
  1432. @item zp
  1433. Z-plane zeros/poles, cartesian (default)
  1434. @item pr
  1435. Z-plane zeros/poles, polar radians
  1436. @item pd
  1437. Z-plane zeros/poles, polar degrees
  1438. @item sp
  1439. S-plane zeros/poles
  1440. @end table
  1441. @item process, r
  1442. Set type of processing.
  1443. @table @samp
  1444. @item d
  1445. direct processing
  1446. @item s
  1447. serial processing
  1448. @item p
  1449. parallel processing
  1450. @end table
  1451. @item precision, e
  1452. Set filtering precision.
  1453. @table @samp
  1454. @item dbl
  1455. double-precision floating-point (default)
  1456. @item flt
  1457. single-precision floating-point
  1458. @item i32
  1459. 32-bit integers
  1460. @item i16
  1461. 16-bit integers
  1462. @end table
  1463. @item normalize, n
  1464. Normalize filter coefficients, by default is enabled.
  1465. Enabling it will normalize magnitude response at DC to 0dB.
  1466. @item mix
  1467. How much to use filtered signal in output. Default is 1.
  1468. Range is between 0 and 1.
  1469. @item response
  1470. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1471. By default it is disabled.
  1472. @item channel
  1473. Set for which IR channel to display frequency response. By default is first channel
  1474. displayed. This option is used only when @var{response} is enabled.
  1475. @item size
  1476. Set video stream size. This option is used only when @var{response} is enabled.
  1477. @end table
  1478. Coefficients in @code{tf} and @code{sf} format are separated by spaces and are in ascending
  1479. order.
  1480. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1481. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1482. imaginary unit.
  1483. Different coefficients and gains can be provided for every channel, in such case
  1484. use '|' to separate coefficients or gains. Last provided coefficients will be
  1485. used for all remaining channels.
  1486. @subsection Examples
  1487. @itemize
  1488. @item
  1489. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1490. @example
  1491. 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
  1492. @end example
  1493. @item
  1494. Same as above but in @code{zp} format:
  1495. @example
  1496. 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
  1497. @end example
  1498. @item
  1499. Apply 3-rd order analog normalized Butterworth low-pass filter, using analog transfer function format:
  1500. @example
  1501. aiir=z=1.3057 0 0 0:p=1.3057 2.3892 2.1860 1:f=sf:r=d
  1502. @end example
  1503. @end itemize
  1504. @section alimiter
  1505. The limiter prevents an input signal from rising over a desired threshold.
  1506. This limiter uses lookahead technology to prevent your signal from distorting.
  1507. It means that there is a small delay after the signal is processed. Keep in mind
  1508. that the delay it produces is the attack time you set.
  1509. The filter accepts the following options:
  1510. @table @option
  1511. @item level_in
  1512. Set input gain. Default is 1.
  1513. @item level_out
  1514. Set output gain. Default is 1.
  1515. @item limit
  1516. Don't let signals above this level pass the limiter. Default is 1.
  1517. @item attack
  1518. The limiter will reach its attenuation level in this amount of time in
  1519. milliseconds. Default is 5 milliseconds.
  1520. @item release
  1521. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1522. Default is 50 milliseconds.
  1523. @item asc
  1524. When gain reduction is always needed ASC takes care of releasing to an
  1525. average reduction level rather than reaching a reduction of 0 in the release
  1526. time.
  1527. @item asc_level
  1528. Select how much the release time is affected by ASC, 0 means nearly no changes
  1529. in release time while 1 produces higher release times.
  1530. @item level
  1531. Auto level output signal. Default is enabled.
  1532. This normalizes audio back to 0dB if enabled.
  1533. @end table
  1534. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1535. with @ref{aresample} before applying this filter.
  1536. @section allpass
  1537. Apply a two-pole all-pass filter with central frequency (in Hz)
  1538. @var{frequency}, and filter-width @var{width}.
  1539. An all-pass filter changes the audio's frequency to phase relationship
  1540. without changing its frequency to amplitude relationship.
  1541. The filter accepts the following options:
  1542. @table @option
  1543. @item frequency, f
  1544. Set frequency in Hz.
  1545. @item width_type, t
  1546. Set method to specify band-width of filter.
  1547. @table @option
  1548. @item h
  1549. Hz
  1550. @item q
  1551. Q-Factor
  1552. @item o
  1553. octave
  1554. @item s
  1555. slope
  1556. @item k
  1557. kHz
  1558. @end table
  1559. @item width, w
  1560. Specify the band-width of a filter in width_type units.
  1561. @item mix, m
  1562. How much to use filtered signal in output. Default is 1.
  1563. Range is between 0 and 1.
  1564. @item channels, c
  1565. Specify which channels to filter, by default all available are filtered.
  1566. @item normalize, n
  1567. Normalize biquad coefficients, by default is disabled.
  1568. Enabling it will normalize magnitude response at DC to 0dB.
  1569. @item order, o
  1570. Set the filter order, can be 1 or 2. Default is 2.
  1571. @item transform, a
  1572. Set transform type of IIR filter.
  1573. @table @option
  1574. @item di
  1575. @item dii
  1576. @item tdii
  1577. @item latt
  1578. @item svf
  1579. @end table
  1580. @item precision, r
  1581. Set precison of filtering.
  1582. @table @option
  1583. @item auto
  1584. Pick automatic sample format depending on surround filters.
  1585. @item s16
  1586. Always use signed 16-bit.
  1587. @item s32
  1588. Always use signed 32-bit.
  1589. @item f32
  1590. Always use float 32-bit.
  1591. @item f64
  1592. Always use float 64-bit.
  1593. @end table
  1594. @end table
  1595. @subsection Commands
  1596. This filter supports the following commands:
  1597. @table @option
  1598. @item frequency, f
  1599. Change allpass frequency.
  1600. Syntax for the command is : "@var{frequency}"
  1601. @item width_type, t
  1602. Change allpass width_type.
  1603. Syntax for the command is : "@var{width_type}"
  1604. @item width, w
  1605. Change allpass width.
  1606. Syntax for the command is : "@var{width}"
  1607. @item mix, m
  1608. Change allpass mix.
  1609. Syntax for the command is : "@var{mix}"
  1610. @end table
  1611. @section aloop
  1612. Loop audio samples.
  1613. The filter accepts the following options:
  1614. @table @option
  1615. @item loop
  1616. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1617. Default is 0.
  1618. @item size
  1619. Set maximal number of samples. Default is 0.
  1620. @item start
  1621. Set first sample of loop. Default is 0.
  1622. @end table
  1623. @anchor{amerge}
  1624. @section amerge
  1625. Merge two or more audio streams into a single multi-channel stream.
  1626. The filter accepts the following options:
  1627. @table @option
  1628. @item inputs
  1629. Set the number of inputs. Default is 2.
  1630. @end table
  1631. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1632. the channel layout of the output will be set accordingly and the channels
  1633. will be reordered as necessary. If the channel layouts of the inputs are not
  1634. disjoint, the output will have all the channels of the first input then all
  1635. the channels of the second input, in that order, and the channel layout of
  1636. the output will be the default value corresponding to the total number of
  1637. channels.
  1638. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1639. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1640. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1641. first input, b1 is the first channel of the second input).
  1642. On the other hand, if both input are in stereo, the output channels will be
  1643. in the default order: a1, a2, b1, b2, and the channel layout will be
  1644. arbitrarily set to 4.0, which may or may not be the expected value.
  1645. All inputs must have the same sample rate, and format.
  1646. If inputs do not have the same duration, the output will stop with the
  1647. shortest.
  1648. @subsection Examples
  1649. @itemize
  1650. @item
  1651. Merge two mono files into a stereo stream:
  1652. @example
  1653. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1654. @end example
  1655. @item
  1656. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1657. @example
  1658. 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
  1659. @end example
  1660. @end itemize
  1661. @section amix
  1662. Mixes multiple audio inputs into a single output.
  1663. Note that this filter only supports float samples (the @var{amerge}
  1664. and @var{pan} audio filters support many formats). If the @var{amix}
  1665. input has integer samples then @ref{aresample} will be automatically
  1666. inserted to perform the conversion to float samples.
  1667. For example
  1668. @example
  1669. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1670. @end example
  1671. will mix 3 input audio streams to a single output with the same duration as the
  1672. first input and a dropout transition time of 3 seconds.
  1673. It accepts the following parameters:
  1674. @table @option
  1675. @item inputs
  1676. The number of inputs. If unspecified, it defaults to 2.
  1677. @item duration
  1678. How to determine the end-of-stream.
  1679. @table @option
  1680. @item longest
  1681. The duration of the longest input. (default)
  1682. @item shortest
  1683. The duration of the shortest input.
  1684. @item first
  1685. The duration of the first input.
  1686. @end table
  1687. @item dropout_transition
  1688. The transition time, in seconds, for volume renormalization when an input
  1689. stream ends. The default value is 2 seconds.
  1690. @item weights
  1691. Specify weight of each input audio stream as sequence.
  1692. Each weight is separated by space. By default all inputs have same weight.
  1693. @item normalize
  1694. Always scale inputs instead of only doing summation of samples.
  1695. Beware of heavy clipping if inputs are not normalized prior or after filtering
  1696. by this filter if this option is disabled. By default is enabled.
  1697. @end table
  1698. @subsection Commands
  1699. This filter supports the following commands:
  1700. @table @option
  1701. @item weights
  1702. @item normalize
  1703. Syntax is same as option with same name.
  1704. @end table
  1705. @section amultiply
  1706. Multiply first audio stream with second audio stream and store result
  1707. in output audio stream. Multiplication is done by multiplying each
  1708. sample from first stream with sample at same position from second stream.
  1709. With this element-wise multiplication one can create amplitude fades and
  1710. amplitude modulations.
  1711. @section anequalizer
  1712. High-order parametric multiband equalizer for each channel.
  1713. It accepts the following parameters:
  1714. @table @option
  1715. @item params
  1716. This option string is in format:
  1717. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1718. Each equalizer band is separated by '|'.
  1719. @table @option
  1720. @item chn
  1721. Set channel number to which equalization will be applied.
  1722. If input doesn't have that channel the entry is ignored.
  1723. @item f
  1724. Set central frequency for band.
  1725. If input doesn't have that frequency the entry is ignored.
  1726. @item w
  1727. Set band width in Hertz.
  1728. @item g
  1729. Set band gain in dB.
  1730. @item t
  1731. Set filter type for band, optional, can be:
  1732. @table @samp
  1733. @item 0
  1734. Butterworth, this is default.
  1735. @item 1
  1736. Chebyshev type 1.
  1737. @item 2
  1738. Chebyshev type 2.
  1739. @end table
  1740. @end table
  1741. @item curves
  1742. With this option activated frequency response of anequalizer is displayed
  1743. in video stream.
  1744. @item size
  1745. Set video stream size. Only useful if curves option is activated.
  1746. @item mgain
  1747. Set max gain that will be displayed. Only useful if curves option is activated.
  1748. Setting this to a reasonable value makes it possible to display gain which is derived from
  1749. neighbour bands which are too close to each other and thus produce higher gain
  1750. when both are activated.
  1751. @item fscale
  1752. Set frequency scale used to draw frequency response in video output.
  1753. Can be linear or logarithmic. Default is logarithmic.
  1754. @item colors
  1755. Set color for each channel curve which is going to be displayed in video stream.
  1756. This is list of color names separated by space or by '|'.
  1757. Unrecognised or missing colors will be replaced by white color.
  1758. @end table
  1759. @subsection Examples
  1760. @itemize
  1761. @item
  1762. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1763. for first 2 channels using Chebyshev type 1 filter:
  1764. @example
  1765. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1766. @end example
  1767. @end itemize
  1768. @subsection Commands
  1769. This filter supports the following commands:
  1770. @table @option
  1771. @item change
  1772. Alter existing filter parameters.
  1773. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1774. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1775. error is returned.
  1776. @var{freq} set new frequency parameter.
  1777. @var{width} set new width parameter in Hertz.
  1778. @var{gain} set new gain parameter in dB.
  1779. Full filter invocation with asendcmd may look like this:
  1780. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1781. @end table
  1782. @section anlmdn
  1783. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1784. Each sample is adjusted by looking for other samples with similar contexts. This
  1785. context similarity is defined by comparing their surrounding patches of size
  1786. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1787. The filter accepts the following options:
  1788. @table @option
  1789. @item strength, s
  1790. Set denoising strength. Allowed range is from 0.00001 to 10000. Default value is 0.00001.
  1791. @item patch, p
  1792. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1793. Default value is 2 milliseconds.
  1794. @item research, r
  1795. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1796. Default value is 6 milliseconds.
  1797. @item output, o
  1798. Set the output mode.
  1799. It accepts the following values:
  1800. @table @option
  1801. @item i
  1802. Pass input unchanged.
  1803. @item o
  1804. Pass noise filtered out.
  1805. @item n
  1806. Pass only noise.
  1807. Default value is @var{o}.
  1808. @end table
  1809. @item smooth, m
  1810. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{1000}.
  1811. @end table
  1812. @subsection Commands
  1813. This filter supports the all above options as @ref{commands}.
  1814. @section anlmf, anlms
  1815. Apply Normalized Least-Mean-(Squares|Fourth) algorithm to the first audio stream using the second audio stream.
  1816. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1817. relate to producing the least mean square of the error signal (difference between the desired,
  1818. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1819. A description of the accepted options follows.
  1820. @table @option
  1821. @item order
  1822. Set filter order.
  1823. @item mu
  1824. Set filter mu.
  1825. @item eps
  1826. Set the filter eps.
  1827. @item leakage
  1828. Set the filter leakage.
  1829. @item out_mode
  1830. It accepts the following values:
  1831. @table @option
  1832. @item i
  1833. Pass the 1st input.
  1834. @item d
  1835. Pass the 2nd input.
  1836. @item o
  1837. Pass filtered samples.
  1838. @item n
  1839. Pass difference between desired and filtered samples.
  1840. Default value is @var{o}.
  1841. @end table
  1842. @end table
  1843. @subsection Examples
  1844. @itemize
  1845. @item
  1846. One of many usages of this filter is noise reduction, input audio is filtered
  1847. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  1848. @example
  1849. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1850. @end example
  1851. @end itemize
  1852. @subsection Commands
  1853. This filter supports the same commands as options, excluding option @code{order}.
  1854. @section anull
  1855. Pass the audio source unchanged to the output.
  1856. @section apad
  1857. Pad the end of an audio stream with silence.
  1858. This can be used together with @command{ffmpeg} @option{-shortest} to
  1859. extend audio streams to the same length as the video stream.
  1860. A description of the accepted options follows.
  1861. @table @option
  1862. @item packet_size
  1863. Set silence packet size. Default value is 4096.
  1864. @item pad_len
  1865. Set the number of samples of silence to add to the end. After the
  1866. value is reached, the stream is terminated. This option is mutually
  1867. exclusive with @option{whole_len}.
  1868. @item whole_len
  1869. Set the minimum total number of samples in the output audio stream. If
  1870. the value is longer than the input audio length, silence is added to
  1871. the end, until the value is reached. This option is mutually exclusive
  1872. with @option{pad_len}.
  1873. @item pad_dur
  1874. Specify the duration of samples of silence to add. See
  1875. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1876. for the accepted syntax. Used only if set to non-negative value.
  1877. @item whole_dur
  1878. Specify the minimum total duration in the output audio stream. See
  1879. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1880. for the accepted syntax. Used only if set to non-negative value. If the value is longer than
  1881. the input audio length, silence is added to the end, until the value is reached.
  1882. This option is mutually exclusive with @option{pad_dur}
  1883. @end table
  1884. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1885. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1886. the input stream indefinitely.
  1887. Note that for ffmpeg 4.4 and earlier a zero @option{pad_dur} or
  1888. @option{whole_dur} also caused the filter to add silence indefinitely.
  1889. @subsection Examples
  1890. @itemize
  1891. @item
  1892. Add 1024 samples of silence to the end of the input:
  1893. @example
  1894. apad=pad_len=1024
  1895. @end example
  1896. @item
  1897. Make sure the audio output will contain at least 10000 samples, pad
  1898. the input with silence if required:
  1899. @example
  1900. apad=whole_len=10000
  1901. @end example
  1902. @item
  1903. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1904. video stream will always result the shortest and will be converted
  1905. until the end in the output file when using the @option{shortest}
  1906. option:
  1907. @example
  1908. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1909. @end example
  1910. @end itemize
  1911. @section aphaser
  1912. Add a phasing effect to the input audio.
  1913. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1914. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1915. A description of the accepted parameters follows.
  1916. @table @option
  1917. @item in_gain
  1918. Set input gain. Default is 0.4.
  1919. @item out_gain
  1920. Set output gain. Default is 0.74
  1921. @item delay
  1922. Set delay in milliseconds. Default is 3.0.
  1923. @item decay
  1924. Set decay. Default is 0.4.
  1925. @item speed
  1926. Set modulation speed in Hz. Default is 0.5.
  1927. @item type
  1928. Set modulation type. Default is triangular.
  1929. It accepts the following values:
  1930. @table @samp
  1931. @item triangular, t
  1932. @item sinusoidal, s
  1933. @end table
  1934. @end table
  1935. @section aphaseshift
  1936. Apply phase shift to input audio samples.
  1937. The filter accepts the following options:
  1938. @table @option
  1939. @item shift
  1940. Specify phase shift. Allowed range is from -1.0 to 1.0.
  1941. Default value is 0.0.
  1942. @item level
  1943. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  1944. Default value is 1.0.
  1945. @item order
  1946. Set filter order used for filtering. Allowed range is from 1 to 16.
  1947. Default value is 8.
  1948. @end table
  1949. @subsection Commands
  1950. This filter supports the all above options as @ref{commands}.
  1951. @section apsyclip
  1952. Apply Psychoacoustic clipper to input audio stream.
  1953. The filter accepts the following options:
  1954. @table @option
  1955. @item level_in
  1956. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1957. @item level_out
  1958. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1959. @item clip
  1960. Set the clipping start value. Default value is 0dBFS or 1.
  1961. @item diff
  1962. Output only difference samples, useful to hear introduced distortions.
  1963. By default is disabled.
  1964. @item adaptive
  1965. Set strength of adaptive distortion applied. Default value is 0.5.
  1966. Allowed range is from 0 to 1.
  1967. @item iterations
  1968. Set number of iterations of psychoacoustic clipper.
  1969. Allowed range is from 1 to 20. Default value is 10.
  1970. @item level
  1971. Auto level output signal. Default is disabled.
  1972. This normalizes audio back to 0dBFS if enabled.
  1973. @end table
  1974. @subsection Commands
  1975. This filter supports the all above options as @ref{commands}.
  1976. @section apulsator
  1977. Audio pulsator is something between an autopanner and a tremolo.
  1978. But it can produce funny stereo effects as well. Pulsator changes the volume
  1979. of the left and right channel based on a LFO (low frequency oscillator) with
  1980. different waveforms and shifted phases.
  1981. This filter have the ability to define an offset between left and right
  1982. channel. An offset of 0 means that both LFO shapes match each other.
  1983. The left and right channel are altered equally - a conventional tremolo.
  1984. An offset of 50% means that the shape of the right channel is exactly shifted
  1985. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1986. an autopanner. At 1 both curves match again. Every setting in between moves the
  1987. phase shift gapless between all stages and produces some "bypassing" sounds with
  1988. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1989. the 0.5) the faster the signal passes from the left to the right speaker.
  1990. The filter accepts the following options:
  1991. @table @option
  1992. @item level_in
  1993. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1994. @item level_out
  1995. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1996. @item mode
  1997. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1998. sawup or sawdown. Default is sine.
  1999. @item amount
  2000. Set modulation. Define how much of original signal is affected by the LFO.
  2001. @item offset_l
  2002. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  2003. @item offset_r
  2004. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  2005. @item width
  2006. Set pulse width. Default is 1. Allowed range is [0 - 2].
  2007. @item timing
  2008. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  2009. @item bpm
  2010. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  2011. is set to bpm.
  2012. @item ms
  2013. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  2014. is set to ms.
  2015. @item hz
  2016. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  2017. if timing is set to hz.
  2018. @end table
  2019. @anchor{aresample}
  2020. @section aresample
  2021. Resample the input audio to the specified parameters, using the
  2022. libswresample library. If none are specified then the filter will
  2023. automatically convert between its input and output.
  2024. This filter is also able to stretch/squeeze the audio data to make it match
  2025. the timestamps or to inject silence / cut out audio to make it match the
  2026. timestamps, do a combination of both or do neither.
  2027. The filter accepts the syntax
  2028. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  2029. expresses a sample rate and @var{resampler_options} is a list of
  2030. @var{key}=@var{value} pairs, separated by ":". See the
  2031. @ref{Resampler Options,,"Resampler Options" section in the
  2032. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  2033. for the complete list of supported options.
  2034. @subsection Examples
  2035. @itemize
  2036. @item
  2037. Resample the input audio to 44100Hz:
  2038. @example
  2039. aresample=44100
  2040. @end example
  2041. @item
  2042. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  2043. samples per second compensation:
  2044. @example
  2045. aresample=async=1000
  2046. @end example
  2047. @end itemize
  2048. @section areverse
  2049. Reverse an audio clip.
  2050. Warning: This filter requires memory to buffer the entire clip, so trimming
  2051. is suggested.
  2052. @subsection Examples
  2053. @itemize
  2054. @item
  2055. Take the first 5 seconds of a clip, and reverse it.
  2056. @example
  2057. atrim=end=5,areverse
  2058. @end example
  2059. @end itemize
  2060. @section arnndn
  2061. Reduce noise from speech using Recurrent Neural Networks.
  2062. This filter accepts the following options:
  2063. @table @option
  2064. @item model, m
  2065. Set train model file to load. This option is always required.
  2066. @item mix
  2067. Set how much to mix filtered samples into final output.
  2068. Allowed range is from -1 to 1. Default value is 1.
  2069. Negative values are special, they set how much to keep filtered noise
  2070. in the final filter output. Set this option to -1 to hear actual
  2071. noise removed from input signal.
  2072. @end table
  2073. @subsection Commands
  2074. This filter supports the all above options as @ref{commands}.
  2075. @section asdr
  2076. Measure Audio Signal-to-Distortion Ratio.
  2077. This filter takes two audio streams for input, and outputs first
  2078. audio stream.
  2079. Results are in dB per channel at end of either input.
  2080. @section asetnsamples
  2081. Set the number of samples per each output audio frame.
  2082. The last output packet may contain a different number of samples, as
  2083. the filter will flush all the remaining samples when the input audio
  2084. signals its end.
  2085. The filter accepts the following options:
  2086. @table @option
  2087. @item nb_out_samples, n
  2088. Set the number of frames per each output audio frame. The number is
  2089. intended as the number of samples @emph{per each channel}.
  2090. Default value is 1024.
  2091. @item pad, p
  2092. If set to 1, the filter will pad the last audio frame with zeroes, so
  2093. that the last frame will contain the same number of samples as the
  2094. previous ones. Default value is 1.
  2095. @end table
  2096. For example, to set the number of per-frame samples to 1234 and
  2097. disable padding for the last frame, use:
  2098. @example
  2099. asetnsamples=n=1234:p=0
  2100. @end example
  2101. @section asetrate
  2102. Set the sample rate without altering the PCM data.
  2103. This will result in a change of speed and pitch.
  2104. The filter accepts the following options:
  2105. @table @option
  2106. @item sample_rate, r
  2107. Set the output sample rate. Default is 44100 Hz.
  2108. @end table
  2109. @section ashowinfo
  2110. Show a line containing various information for each input audio frame.
  2111. The input audio is not modified.
  2112. The shown line contains a sequence of key/value pairs of the form
  2113. @var{key}:@var{value}.
  2114. The following values are shown in the output:
  2115. @table @option
  2116. @item n
  2117. The (sequential) number of the input frame, starting from 0.
  2118. @item pts
  2119. The presentation timestamp of the input frame, in time base units; the time base
  2120. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  2121. @item pts_time
  2122. The presentation timestamp of the input frame in seconds.
  2123. @item pos
  2124. position of the frame in the input stream, -1 if this information in
  2125. unavailable and/or meaningless (for example in case of synthetic audio)
  2126. @item fmt
  2127. The sample format.
  2128. @item chlayout
  2129. The channel layout.
  2130. @item rate
  2131. The sample rate for the audio frame.
  2132. @item nb_samples
  2133. The number of samples (per channel) in the frame.
  2134. @item checksum
  2135. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  2136. audio, the data is treated as if all the planes were concatenated.
  2137. @item plane_checksums
  2138. A list of Adler-32 checksums for each data plane.
  2139. @end table
  2140. @section asoftclip
  2141. Apply audio soft clipping.
  2142. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  2143. along a smooth curve, rather than the abrupt shape of hard-clipping.
  2144. This filter accepts the following options:
  2145. @table @option
  2146. @item type
  2147. Set type of soft-clipping.
  2148. It accepts the following values:
  2149. @table @option
  2150. @item hard
  2151. @item tanh
  2152. @item atan
  2153. @item cubic
  2154. @item exp
  2155. @item alg
  2156. @item quintic
  2157. @item sin
  2158. @item erf
  2159. @end table
  2160. @item threshold
  2161. Set threshold from where to start clipping. Default value is 0dB or 1.
  2162. @item output
  2163. Set gain applied to output. Default value is 0dB or 1.
  2164. @item param
  2165. Set additional parameter which controls sigmoid function.
  2166. @item oversample
  2167. Set oversampling factor.
  2168. @end table
  2169. @subsection Commands
  2170. This filter supports the all above options as @ref{commands}.
  2171. @section aspectralstats
  2172. Display frequency domain statistical information about the audio channels.
  2173. Statistics are calculated and stored as metadata for each audio channel and for each audio frame.
  2174. It accepts the following option:
  2175. @table @option
  2176. @item win_size
  2177. Set the window length in samples. Default value is 2048.
  2178. Allowed range is from 32 to 65536.
  2179. @item win_func
  2180. Set window function.
  2181. It accepts the following values:
  2182. @table @samp
  2183. @item rect
  2184. @item bartlett
  2185. @item hann, hanning
  2186. @item hamming
  2187. @item blackman
  2188. @item welch
  2189. @item flattop
  2190. @item bharris
  2191. @item bnuttall
  2192. @item bhann
  2193. @item sine
  2194. @item nuttall
  2195. @item lanczos
  2196. @item gauss
  2197. @item tukey
  2198. @item dolph
  2199. @item cauchy
  2200. @item parzen
  2201. @item poisson
  2202. @item bohman
  2203. @end table
  2204. Default is @code{hann}.
  2205. @item overlap
  2206. Set window overlap. Allowed range is from @code{0}
  2207. to @code{1}. Default value is @code{0.5}.
  2208. @end table
  2209. A list of each metadata key follows:
  2210. @table @option
  2211. @item mean
  2212. @item variance
  2213. @item centroid
  2214. @item spread
  2215. @item skewness
  2216. @item kurtosis
  2217. @item entropy
  2218. @item flatness
  2219. @item crest
  2220. @item flux
  2221. @item slope
  2222. @item decrease
  2223. @item rolloff
  2224. @end table
  2225. @section asr
  2226. Automatic Speech Recognition
  2227. This filter uses PocketSphinx for speech recognition. To enable
  2228. compilation of this filter, you need to configure FFmpeg with
  2229. @code{--enable-pocketsphinx}.
  2230. It accepts the following options:
  2231. @table @option
  2232. @item rate
  2233. Set sampling rate of input audio. Defaults is @code{16000}.
  2234. This need to match speech models, otherwise one will get poor results.
  2235. @item hmm
  2236. Set dictionary containing acoustic model files.
  2237. @item dict
  2238. Set pronunciation dictionary.
  2239. @item lm
  2240. Set language model file.
  2241. @item lmctl
  2242. Set language model set.
  2243. @item lmname
  2244. Set which language model to use.
  2245. @item logfn
  2246. Set output for log messages.
  2247. @end table
  2248. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  2249. @anchor{astats}
  2250. @section astats
  2251. Display time domain statistical information about the audio channels.
  2252. Statistics are calculated and displayed for each audio channel and,
  2253. where applicable, an overall figure is also given.
  2254. It accepts the following option:
  2255. @table @option
  2256. @item length
  2257. Short window length in seconds, used for peak and trough RMS measurement.
  2258. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0 - 10]}.
  2259. @item metadata
  2260. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  2261. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  2262. disabled.
  2263. Available keys for each channel are:
  2264. DC_offset
  2265. Min_level
  2266. Max_level
  2267. Min_difference
  2268. Max_difference
  2269. Mean_difference
  2270. RMS_difference
  2271. Peak_level
  2272. RMS_peak
  2273. RMS_trough
  2274. Crest_factor
  2275. Flat_factor
  2276. Peak_count
  2277. Noise_floor
  2278. Noise_floor_count
  2279. Entropy
  2280. Bit_depth
  2281. Dynamic_range
  2282. Zero_crossings
  2283. Zero_crossings_rate
  2284. Number_of_NaNs
  2285. Number_of_Infs
  2286. Number_of_denormals
  2287. and for Overall:
  2288. DC_offset
  2289. Min_level
  2290. Max_level
  2291. Min_difference
  2292. Max_difference
  2293. Mean_difference
  2294. RMS_difference
  2295. Peak_level
  2296. RMS_level
  2297. RMS_peak
  2298. RMS_trough
  2299. Flat_factor
  2300. Peak_count
  2301. Noise_floor
  2302. Noise_floor_count
  2303. Entropy
  2304. Bit_depth
  2305. Number_of_samples
  2306. Number_of_NaNs
  2307. Number_of_Infs
  2308. Number_of_denormals
  2309. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  2310. this @code{lavfi.astats.Overall.Peak_count}.
  2311. For description what each key means read below.
  2312. @item reset
  2313. Set the number of frames over which cumulative stats are calculated before
  2314. being reset
  2315. Default is disabled.
  2316. @item measure_perchannel
  2317. Select the parameters which are measured per channel. The metadata keys can
  2318. be used as flags, default is @option{all} which measures everything.
  2319. @option{none} disables all per channel measurement.
  2320. @item measure_overall
  2321. Select the parameters which are measured overall. The metadata keys can
  2322. be used as flags, default is @option{all} which measures everything.
  2323. @option{none} disables all overall measurement.
  2324. @end table
  2325. A description of each shown parameter follows:
  2326. @table @option
  2327. @item DC offset
  2328. Mean amplitude displacement from zero.
  2329. @item Min level
  2330. Minimal sample level.
  2331. @item Max level
  2332. Maximal sample level.
  2333. @item Min difference
  2334. Minimal difference between two consecutive samples.
  2335. @item Max difference
  2336. Maximal difference between two consecutive samples.
  2337. @item Mean difference
  2338. Mean difference between two consecutive samples.
  2339. The average of each difference between two consecutive samples.
  2340. @item RMS difference
  2341. Root Mean Square difference between two consecutive samples.
  2342. @item Peak level dB
  2343. @item RMS level dB
  2344. Standard peak and RMS level measured in dBFS.
  2345. @item RMS peak dB
  2346. @item RMS trough dB
  2347. Peak and trough values for RMS level measured over a short window.
  2348. @item Crest factor
  2349. Standard ratio of peak to RMS level (note: not in dB).
  2350. @item Flat factor
  2351. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  2352. (i.e. either @var{Min level} or @var{Max level}).
  2353. @item Peak count
  2354. Number of occasions (not the number of samples) that the signal attained either
  2355. @var{Min level} or @var{Max level}.
  2356. @item Noise floor dB
  2357. Minimum local peak measured in dBFS over a short window.
  2358. @item Noise floor count
  2359. Number of occasions (not the number of samples) that the signal attained
  2360. @var{Noise floor}.
  2361. @item Entropy
  2362. Entropy measured across whole audio. Entropy of value near 1.0 is typically measured for white noise.
  2363. @item Bit depth
  2364. Overall bit depth of audio. Number of bits used for each sample.
  2365. @item Dynamic range
  2366. Measured dynamic range of audio in dB.
  2367. @item Zero crossings
  2368. Number of points where the waveform crosses the zero level axis.
  2369. @item Zero crossings rate
  2370. Rate of Zero crossings and number of audio samples.
  2371. @end table
  2372. @section asubboost
  2373. Boost subwoofer frequencies.
  2374. The filter accepts the following options:
  2375. @table @option
  2376. @item dry
  2377. Set dry gain, how much of original signal is kept. Allowed range is from 0 to 1.
  2378. Default value is 0.7.
  2379. @item wet
  2380. Set wet gain, how much of filtered signal is kept. Allowed range is from 0 to 1.
  2381. Default value is 0.7.
  2382. @item decay
  2383. Set delay line decay gain value. Allowed range is from 0 to 1.
  2384. Default value is 0.7.
  2385. @item feedback
  2386. Set delay line feedback gain value. Allowed range is from 0 to 1.
  2387. Default value is 0.9.
  2388. @item cutoff
  2389. Set cutoff frequency in Hertz. Allowed range is 50 to 900.
  2390. Default value is 100.
  2391. @item slope
  2392. Set slope amount for cutoff frequency. Allowed range is 0.0001 to 1.
  2393. Default value is 0.5.
  2394. @item delay
  2395. Set delay. Allowed range is from 1 to 100.
  2396. Default value is 20.
  2397. @end table
  2398. @subsection Commands
  2399. This filter supports the all above options as @ref{commands}.
  2400. @section asubcut
  2401. Cut subwoofer frequencies.
  2402. This filter allows to set custom, steeper
  2403. roll off than highpass filter, and thus is able to more attenuate
  2404. frequency content in stop-band.
  2405. The filter accepts the following options:
  2406. @table @option
  2407. @item cutoff
  2408. Set cutoff frequency in Hertz. Allowed range is 2 to 200.
  2409. Default value is 20.
  2410. @item order
  2411. Set filter order. Available values are from 3 to 20.
  2412. Default value is 10.
  2413. @item level
  2414. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2415. @end table
  2416. @subsection Commands
  2417. This filter supports the all above options as @ref{commands}.
  2418. @section asupercut
  2419. Cut super frequencies.
  2420. The filter accepts the following options:
  2421. @table @option
  2422. @item cutoff
  2423. Set cutoff frequency in Hertz. Allowed range is 20000 to 192000.
  2424. Default value is 20000.
  2425. @item order
  2426. Set filter order. Available values are from 3 to 20.
  2427. Default value is 10.
  2428. @item level
  2429. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2430. @end table
  2431. @subsection Commands
  2432. This filter supports the all above options as @ref{commands}.
  2433. @section asuperpass
  2434. Apply high order Butterworth band-pass filter.
  2435. The filter accepts the following options:
  2436. @table @option
  2437. @item centerf
  2438. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2439. Default value is 1000.
  2440. @item order
  2441. Set filter order. Available values are from 4 to 20.
  2442. Default value is 4.
  2443. @item qfactor
  2444. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2445. @item level
  2446. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2447. @end table
  2448. @subsection Commands
  2449. This filter supports the all above options as @ref{commands}.
  2450. @section asuperstop
  2451. Apply high order Butterworth band-stop filter.
  2452. The filter accepts the following options:
  2453. @table @option
  2454. @item centerf
  2455. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2456. Default value is 1000.
  2457. @item order
  2458. Set filter order. Available values are from 4 to 20.
  2459. Default value is 4.
  2460. @item qfactor
  2461. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2462. @item level
  2463. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2464. @end table
  2465. @subsection Commands
  2466. This filter supports the all above options as @ref{commands}.
  2467. @section atempo
  2468. Adjust audio tempo.
  2469. The filter accepts exactly one parameter, the audio tempo. If not
  2470. specified then the filter will assume nominal 1.0 tempo. Tempo must
  2471. be in the [0.5, 100.0] range.
  2472. Note that tempo greater than 2 will skip some samples rather than
  2473. blend them in. If for any reason this is a concern it is always
  2474. possible to daisy-chain several instances of atempo to achieve the
  2475. desired product tempo.
  2476. @subsection Examples
  2477. @itemize
  2478. @item
  2479. Slow down audio to 80% tempo:
  2480. @example
  2481. atempo=0.8
  2482. @end example
  2483. @item
  2484. To speed up audio to 300% tempo:
  2485. @example
  2486. atempo=3
  2487. @end example
  2488. @item
  2489. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  2490. @example
  2491. atempo=sqrt(3),atempo=sqrt(3)
  2492. @end example
  2493. @end itemize
  2494. @subsection Commands
  2495. This filter supports the following commands:
  2496. @table @option
  2497. @item tempo
  2498. Change filter tempo scale factor.
  2499. Syntax for the command is : "@var{tempo}"
  2500. @end table
  2501. @section atilt
  2502. Apply spectral tilt filter to audio stream.
  2503. This filter apply any spectral roll-off slope over any specified frequency band.
  2504. The filter accepts the following options:
  2505. @table @option
  2506. @item freq
  2507. Set central frequency of tilt in Hz. Default is 10000 Hz.
  2508. @item slope
  2509. Set slope direction of tilt. Default is 0. Allowed range is from -1 to 1.
  2510. @item width
  2511. Set width of tilt. Default is 1000. Allowed range is from 100 to 10000.
  2512. @item order
  2513. Set order of tilt filter.
  2514. @item level
  2515. Set input volume level. Allowed range is from 0 to 4.
  2516. Defalt is 1.
  2517. @end table
  2518. @subsection Commands
  2519. This filter supports the all above options as @ref{commands}.
  2520. @section atrim
  2521. Trim the input so that the output contains one continuous subpart of the input.
  2522. It accepts the following parameters:
  2523. @table @option
  2524. @item start
  2525. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  2526. sample with the timestamp @var{start} will be the first sample in the output.
  2527. @item end
  2528. Specify time of the first audio sample that will be dropped, i.e. the
  2529. audio sample immediately preceding the one with the timestamp @var{end} will be
  2530. the last sample in the output.
  2531. @item start_pts
  2532. Same as @var{start}, except this option sets the start timestamp in samples
  2533. instead of seconds.
  2534. @item end_pts
  2535. Same as @var{end}, except this option sets the end timestamp in samples instead
  2536. of seconds.
  2537. @item duration
  2538. The maximum duration of the output in seconds.
  2539. @item start_sample
  2540. The number of the first sample that should be output.
  2541. @item end_sample
  2542. The number of the first sample that should be dropped.
  2543. @end table
  2544. @option{start}, @option{end}, and @option{duration} are expressed as time
  2545. duration specifications; see
  2546. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  2547. Note that the first two sets of the start/end options and the @option{duration}
  2548. option look at the frame timestamp, while the _sample options simply count the
  2549. samples that pass through the filter. So start/end_pts and start/end_sample will
  2550. give different results when the timestamps are wrong, inexact or do not start at
  2551. zero. Also note that this filter does not modify the timestamps. If you wish
  2552. to have the output timestamps start at zero, insert the asetpts filter after the
  2553. atrim filter.
  2554. If multiple start or end options are set, this filter tries to be greedy and
  2555. keep all samples that match at least one of the specified constraints. To keep
  2556. only the part that matches all the constraints at once, chain multiple atrim
  2557. filters.
  2558. The defaults are such that all the input is kept. So it is possible to set e.g.
  2559. just the end values to keep everything before the specified time.
  2560. Examples:
  2561. @itemize
  2562. @item
  2563. Drop everything except the second minute of input:
  2564. @example
  2565. ffmpeg -i INPUT -af atrim=60:120
  2566. @end example
  2567. @item
  2568. Keep only the first 1000 samples:
  2569. @example
  2570. ffmpeg -i INPUT -af atrim=end_sample=1000
  2571. @end example
  2572. @end itemize
  2573. @section axcorrelate
  2574. Calculate normalized windowed cross-correlation between two input audio streams.
  2575. Resulted samples are always between -1 and 1 inclusive.
  2576. If result is 1 it means two input samples are highly correlated in that selected segment.
  2577. Result 0 means they are not correlated at all.
  2578. If result is -1 it means two input samples are out of phase, which means they cancel each
  2579. other.
  2580. The filter accepts the following options:
  2581. @table @option
  2582. @item size
  2583. Set size of segment over which cross-correlation is calculated.
  2584. Default is 256. Allowed range is from 2 to 131072.
  2585. @item algo
  2586. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast}.
  2587. Default is @code{slow}. Fast algorithm assumes mean values over any given segment
  2588. are always zero and thus need much less calculations to make.
  2589. This is generally not true, but is valid for typical audio streams.
  2590. @end table
  2591. @subsection Examples
  2592. @itemize
  2593. @item
  2594. Calculate correlation between channels in stereo audio stream:
  2595. @example
  2596. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  2597. @end example
  2598. @end itemize
  2599. @section bandpass
  2600. Apply a two-pole Butterworth band-pass filter with central
  2601. frequency @var{frequency}, and (3dB-point) band-width width.
  2602. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  2603. instead of the default: constant 0dB peak gain.
  2604. The filter roll off at 6dB per octave (20dB per decade).
  2605. The filter accepts the following options:
  2606. @table @option
  2607. @item frequency, f
  2608. Set the filter's central frequency. Default is @code{3000}.
  2609. @item csg
  2610. Constant skirt gain if set to 1. Defaults to 0.
  2611. @item width_type, t
  2612. Set method to specify band-width of filter.
  2613. @table @option
  2614. @item h
  2615. Hz
  2616. @item q
  2617. Q-Factor
  2618. @item o
  2619. octave
  2620. @item s
  2621. slope
  2622. @item k
  2623. kHz
  2624. @end table
  2625. @item width, w
  2626. Specify the band-width of a filter in width_type units.
  2627. @item mix, m
  2628. How much to use filtered signal in output. Default is 1.
  2629. Range is between 0 and 1.
  2630. @item channels, c
  2631. Specify which channels to filter, by default all available are filtered.
  2632. @item normalize, n
  2633. Normalize biquad coefficients, by default is disabled.
  2634. Enabling it will normalize magnitude response at DC to 0dB.
  2635. @item transform, a
  2636. Set transform type of IIR filter.
  2637. @table @option
  2638. @item di
  2639. @item dii
  2640. @item tdii
  2641. @item latt
  2642. @item svf
  2643. @end table
  2644. @item precision, r
  2645. Set precison of filtering.
  2646. @table @option
  2647. @item auto
  2648. Pick automatic sample format depending on surround filters.
  2649. @item s16
  2650. Always use signed 16-bit.
  2651. @item s32
  2652. Always use signed 32-bit.
  2653. @item f32
  2654. Always use float 32-bit.
  2655. @item f64
  2656. Always use float 64-bit.
  2657. @end table
  2658. @end table
  2659. @subsection Commands
  2660. This filter supports the following commands:
  2661. @table @option
  2662. @item frequency, f
  2663. Change bandpass frequency.
  2664. Syntax for the command is : "@var{frequency}"
  2665. @item width_type, t
  2666. Change bandpass width_type.
  2667. Syntax for the command is : "@var{width_type}"
  2668. @item width, w
  2669. Change bandpass width.
  2670. Syntax for the command is : "@var{width}"
  2671. @item mix, m
  2672. Change bandpass mix.
  2673. Syntax for the command is : "@var{mix}"
  2674. @end table
  2675. @section bandreject
  2676. Apply a two-pole Butterworth band-reject filter with central
  2677. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2678. The filter roll off at 6dB per octave (20dB per decade).
  2679. The filter accepts the following options:
  2680. @table @option
  2681. @item frequency, f
  2682. Set the filter's central frequency. Default is @code{3000}.
  2683. @item width_type, t
  2684. Set method to specify band-width of filter.
  2685. @table @option
  2686. @item h
  2687. Hz
  2688. @item q
  2689. Q-Factor
  2690. @item o
  2691. octave
  2692. @item s
  2693. slope
  2694. @item k
  2695. kHz
  2696. @end table
  2697. @item width, w
  2698. Specify the band-width of a filter in width_type units.
  2699. @item mix, m
  2700. How much to use filtered signal in output. Default is 1.
  2701. Range is between 0 and 1.
  2702. @item channels, c
  2703. Specify which channels to filter, by default all available are filtered.
  2704. @item normalize, n
  2705. Normalize biquad coefficients, by default is disabled.
  2706. Enabling it will normalize magnitude response at DC to 0dB.
  2707. @item transform, a
  2708. Set transform type of IIR filter.
  2709. @table @option
  2710. @item di
  2711. @item dii
  2712. @item tdii
  2713. @item latt
  2714. @item svf
  2715. @end table
  2716. @item precision, r
  2717. Set precison of filtering.
  2718. @table @option
  2719. @item auto
  2720. Pick automatic sample format depending on surround filters.
  2721. @item s16
  2722. Always use signed 16-bit.
  2723. @item s32
  2724. Always use signed 32-bit.
  2725. @item f32
  2726. Always use float 32-bit.
  2727. @item f64
  2728. Always use float 64-bit.
  2729. @end table
  2730. @end table
  2731. @subsection Commands
  2732. This filter supports the following commands:
  2733. @table @option
  2734. @item frequency, f
  2735. Change bandreject frequency.
  2736. Syntax for the command is : "@var{frequency}"
  2737. @item width_type, t
  2738. Change bandreject width_type.
  2739. Syntax for the command is : "@var{width_type}"
  2740. @item width, w
  2741. Change bandreject width.
  2742. Syntax for the command is : "@var{width}"
  2743. @item mix, m
  2744. Change bandreject mix.
  2745. Syntax for the command is : "@var{mix}"
  2746. @end table
  2747. @section bass, lowshelf
  2748. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2749. shelving filter with a response similar to that of a standard
  2750. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2751. The filter accepts the following options:
  2752. @table @option
  2753. @item gain, g
  2754. Give the gain at 0 Hz. Its useful range is about -20
  2755. (for a large cut) to +20 (for a large boost).
  2756. Beware of clipping when using a positive gain.
  2757. @item frequency, f
  2758. Set the filter's central frequency and so can be used
  2759. to extend or reduce the frequency range to be boosted or cut.
  2760. The default value is @code{100} Hz.
  2761. @item width_type, t
  2762. Set method to specify band-width of filter.
  2763. @table @option
  2764. @item h
  2765. Hz
  2766. @item q
  2767. Q-Factor
  2768. @item o
  2769. octave
  2770. @item s
  2771. slope
  2772. @item k
  2773. kHz
  2774. @end table
  2775. @item width, w
  2776. Determine how steep is the filter's shelf transition.
  2777. @item poles, p
  2778. Set number of poles. Default is 2.
  2779. @item mix, m
  2780. How much to use filtered signal in output. Default is 1.
  2781. Range is between 0 and 1.
  2782. @item channels, c
  2783. Specify which channels to filter, by default all available are filtered.
  2784. @item normalize, n
  2785. Normalize biquad coefficients, by default is disabled.
  2786. Enabling it will normalize magnitude response at DC to 0dB.
  2787. @item transform, a
  2788. Set transform type of IIR filter.
  2789. @table @option
  2790. @item di
  2791. @item dii
  2792. @item tdii
  2793. @item latt
  2794. @item svf
  2795. @end table
  2796. @item precision, r
  2797. Set precison of filtering.
  2798. @table @option
  2799. @item auto
  2800. Pick automatic sample format depending on surround filters.
  2801. @item s16
  2802. Always use signed 16-bit.
  2803. @item s32
  2804. Always use signed 32-bit.
  2805. @item f32
  2806. Always use float 32-bit.
  2807. @item f64
  2808. Always use float 64-bit.
  2809. @end table
  2810. @end table
  2811. @subsection Commands
  2812. This filter supports the following commands:
  2813. @table @option
  2814. @item frequency, f
  2815. Change bass frequency.
  2816. Syntax for the command is : "@var{frequency}"
  2817. @item width_type, t
  2818. Change bass width_type.
  2819. Syntax for the command is : "@var{width_type}"
  2820. @item width, w
  2821. Change bass width.
  2822. Syntax for the command is : "@var{width}"
  2823. @item gain, g
  2824. Change bass gain.
  2825. Syntax for the command is : "@var{gain}"
  2826. @item mix, m
  2827. Change bass mix.
  2828. Syntax for the command is : "@var{mix}"
  2829. @end table
  2830. @section biquad
  2831. Apply a biquad IIR filter with the given coefficients.
  2832. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2833. are the numerator and denominator coefficients respectively.
  2834. and @var{channels}, @var{c} specify which channels to filter, by default all
  2835. available are filtered.
  2836. @subsection Commands
  2837. This filter supports the following commands:
  2838. @table @option
  2839. @item a0
  2840. @item a1
  2841. @item a2
  2842. @item b0
  2843. @item b1
  2844. @item b2
  2845. Change biquad parameter.
  2846. Syntax for the command is : "@var{value}"
  2847. @item mix, m
  2848. How much to use filtered signal in output. Default is 1.
  2849. Range is between 0 and 1.
  2850. @item channels, c
  2851. Specify which channels to filter, by default all available are filtered.
  2852. @item normalize, n
  2853. Normalize biquad coefficients, by default is disabled.
  2854. Enabling it will normalize magnitude response at DC to 0dB.
  2855. @item transform, a
  2856. Set transform type of IIR filter.
  2857. @table @option
  2858. @item di
  2859. @item dii
  2860. @item tdii
  2861. @item latt
  2862. @item svf
  2863. @end table
  2864. @item precision, r
  2865. Set precison of filtering.
  2866. @table @option
  2867. @item auto
  2868. Pick automatic sample format depending on surround filters.
  2869. @item s16
  2870. Always use signed 16-bit.
  2871. @item s32
  2872. Always use signed 32-bit.
  2873. @item f32
  2874. Always use float 32-bit.
  2875. @item f64
  2876. Always use float 64-bit.
  2877. @end table
  2878. @end table
  2879. @section bs2b
  2880. Bauer stereo to binaural transformation, which improves headphone listening of
  2881. stereo audio records.
  2882. To enable compilation of this filter you need to configure FFmpeg with
  2883. @code{--enable-libbs2b}.
  2884. It accepts the following parameters:
  2885. @table @option
  2886. @item profile
  2887. Pre-defined crossfeed level.
  2888. @table @option
  2889. @item default
  2890. Default level (fcut=700, feed=50).
  2891. @item cmoy
  2892. Chu Moy circuit (fcut=700, feed=60).
  2893. @item jmeier
  2894. Jan Meier circuit (fcut=650, feed=95).
  2895. @end table
  2896. @item fcut
  2897. Cut frequency (in Hz).
  2898. @item feed
  2899. Feed level (in Hz).
  2900. @end table
  2901. @section channelmap
  2902. Remap input channels to new locations.
  2903. It accepts the following parameters:
  2904. @table @option
  2905. @item map
  2906. Map channels from input to output. The argument is a '|'-separated list of
  2907. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2908. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2909. channel (e.g. FL for front left) or its index in the input channel layout.
  2910. @var{out_channel} is the name of the output channel or its index in the output
  2911. channel layout. If @var{out_channel} is not given then it is implicitly an
  2912. index, starting with zero and increasing by one for each mapping.
  2913. @item channel_layout
  2914. The channel layout of the output stream.
  2915. @end table
  2916. If no mapping is present, the filter will implicitly map input channels to
  2917. output channels, preserving indices.
  2918. @subsection Examples
  2919. @itemize
  2920. @item
  2921. For example, assuming a 5.1+downmix input MOV file,
  2922. @example
  2923. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2924. @end example
  2925. will create an output WAV file tagged as stereo from the downmix channels of
  2926. the input.
  2927. @item
  2928. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2929. @example
  2930. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2931. @end example
  2932. @end itemize
  2933. @section channelsplit
  2934. Split each channel from an input audio stream into a separate output stream.
  2935. It accepts the following parameters:
  2936. @table @option
  2937. @item channel_layout
  2938. The channel layout of the input stream. The default is "stereo".
  2939. @item channels
  2940. A channel layout describing the channels to be extracted as separate output streams
  2941. or "all" to extract each input channel as a separate stream. The default is "all".
  2942. Choosing channels not present in channel layout in the input will result in an error.
  2943. @end table
  2944. @subsection Examples
  2945. @itemize
  2946. @item
  2947. For example, assuming a stereo input MP3 file,
  2948. @example
  2949. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2950. @end example
  2951. will create an output Matroska file with two audio streams, one containing only
  2952. the left channel and the other the right channel.
  2953. @item
  2954. Split a 5.1 WAV file into per-channel files:
  2955. @example
  2956. ffmpeg -i in.wav -filter_complex
  2957. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2958. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2959. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2960. side_right.wav
  2961. @end example
  2962. @item
  2963. Extract only LFE from a 5.1 WAV file:
  2964. @example
  2965. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2966. -map '[LFE]' lfe.wav
  2967. @end example
  2968. @end itemize
  2969. @section chorus
  2970. Add a chorus effect to the audio.
  2971. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2972. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2973. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2974. The modulation depth defines the range the modulated delay is played before or after
  2975. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2976. sound tuned around the original one, like in a chorus where some vocals are slightly
  2977. off key.
  2978. It accepts the following parameters:
  2979. @table @option
  2980. @item in_gain
  2981. Set input gain. Default is 0.4.
  2982. @item out_gain
  2983. Set output gain. Default is 0.4.
  2984. @item delays
  2985. Set delays. A typical delay is around 40ms to 60ms.
  2986. @item decays
  2987. Set decays.
  2988. @item speeds
  2989. Set speeds.
  2990. @item depths
  2991. Set depths.
  2992. @end table
  2993. @subsection Examples
  2994. @itemize
  2995. @item
  2996. A single delay:
  2997. @example
  2998. chorus=0.7:0.9:55:0.4:0.25:2
  2999. @end example
  3000. @item
  3001. Two delays:
  3002. @example
  3003. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  3004. @end example
  3005. @item
  3006. Fuller sounding chorus with three delays:
  3007. @example
  3008. 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
  3009. @end example
  3010. @end itemize
  3011. @section compand
  3012. Compress or expand the audio's dynamic range.
  3013. It accepts the following parameters:
  3014. @table @option
  3015. @item attacks
  3016. @item decays
  3017. A list of times in seconds for each channel over which the instantaneous level
  3018. of the input signal is averaged to determine its volume. @var{attacks} refers to
  3019. increase of volume and @var{decays} refers to decrease of volume. For most
  3020. situations, the attack time (response to the audio getting louder) should be
  3021. shorter than the decay time, because the human ear is more sensitive to sudden
  3022. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  3023. a typical value for decay is 0.8 seconds.
  3024. If specified number of attacks & decays is lower than number of channels, the last
  3025. set attack/decay will be used for all remaining channels.
  3026. @item points
  3027. A list of points for the transfer function, specified in dB relative to the
  3028. maximum possible signal amplitude. Each key points list must be defined using
  3029. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  3030. @code{x0/y0 x1/y1 x2/y2 ....}
  3031. The input values must be in strictly increasing order but the transfer function
  3032. does not have to be monotonically rising. The point @code{0/0} is assumed but
  3033. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  3034. function are @code{-70/-70|-60/-20|1/0}.
  3035. @item soft-knee
  3036. Set the curve radius in dB for all joints. It defaults to 0.01.
  3037. @item gain
  3038. Set the additional gain in dB to be applied at all points on the transfer
  3039. function. This allows for easy adjustment of the overall gain.
  3040. It defaults to 0.
  3041. @item volume
  3042. Set an initial volume, in dB, to be assumed for each channel when filtering
  3043. starts. This permits the user to supply a nominal level initially, so that, for
  3044. example, a very large gain is not applied to initial signal levels before the
  3045. companding has begun to operate. A typical value for audio which is initially
  3046. quiet is -90 dB. It defaults to 0.
  3047. @item delay
  3048. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  3049. delayed before being fed to the volume adjuster. Specifying a delay
  3050. approximately equal to the attack/decay times allows the filter to effectively
  3051. operate in predictive rather than reactive mode. It defaults to 0.
  3052. @end table
  3053. @subsection Examples
  3054. @itemize
  3055. @item
  3056. Make music with both quiet and loud passages suitable for listening to in a
  3057. noisy environment:
  3058. @example
  3059. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  3060. @end example
  3061. Another example for audio with whisper and explosion parts:
  3062. @example
  3063. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  3064. @end example
  3065. @item
  3066. A noise gate for when the noise is at a lower level than the signal:
  3067. @example
  3068. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  3069. @end example
  3070. @item
  3071. Here is another noise gate, this time for when the noise is at a higher level
  3072. than the signal (making it, in some ways, similar to squelch):
  3073. @example
  3074. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  3075. @end example
  3076. @item
  3077. 2:1 compression starting at -6dB:
  3078. @example
  3079. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  3080. @end example
  3081. @item
  3082. 2:1 compression starting at -9dB:
  3083. @example
  3084. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  3085. @end example
  3086. @item
  3087. 2:1 compression starting at -12dB:
  3088. @example
  3089. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  3090. @end example
  3091. @item
  3092. 2:1 compression starting at -18dB:
  3093. @example
  3094. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  3095. @end example
  3096. @item
  3097. 3:1 compression starting at -15dB:
  3098. @example
  3099. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  3100. @end example
  3101. @item
  3102. Compressor/Gate:
  3103. @example
  3104. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  3105. @end example
  3106. @item
  3107. Expander:
  3108. @example
  3109. 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
  3110. @end example
  3111. @item
  3112. Hard limiter at -6dB:
  3113. @example
  3114. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  3115. @end example
  3116. @item
  3117. Hard limiter at -12dB:
  3118. @example
  3119. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  3120. @end example
  3121. @item
  3122. Hard noise gate at -35 dB:
  3123. @example
  3124. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  3125. @end example
  3126. @item
  3127. Soft limiter:
  3128. @example
  3129. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  3130. @end example
  3131. @end itemize
  3132. @section compensationdelay
  3133. Compensation Delay Line is a metric based delay to compensate differing
  3134. positions of microphones or speakers.
  3135. For example, you have recorded guitar with two microphones placed in
  3136. different locations. Because the front of sound wave has fixed speed in
  3137. normal conditions, the phasing of microphones can vary and depends on
  3138. their location and interposition. The best sound mix can be achieved when
  3139. these microphones are in phase (synchronized). Note that a distance of
  3140. ~30 cm between microphones makes one microphone capture the signal in
  3141. antiphase to the other microphone. That makes the final mix sound moody.
  3142. This filter helps to solve phasing problems by adding different delays
  3143. to each microphone track and make them synchronized.
  3144. The best result can be reached when you take one track as base and
  3145. synchronize other tracks one by one with it.
  3146. Remember that synchronization/delay tolerance depends on sample rate, too.
  3147. Higher sample rates will give more tolerance.
  3148. The filter accepts the following parameters:
  3149. @table @option
  3150. @item mm
  3151. Set millimeters distance. This is compensation distance for fine tuning.
  3152. Default is 0.
  3153. @item cm
  3154. Set cm distance. This is compensation distance for tightening distance setup.
  3155. Default is 0.
  3156. @item m
  3157. Set meters distance. This is compensation distance for hard distance setup.
  3158. Default is 0.
  3159. @item dry
  3160. Set dry amount. Amount of unprocessed (dry) signal.
  3161. Default is 0.
  3162. @item wet
  3163. Set wet amount. Amount of processed (wet) signal.
  3164. Default is 1.
  3165. @item temp
  3166. Set temperature in degrees Celsius. This is the temperature of the environment.
  3167. Default is 20.
  3168. @end table
  3169. @subsection Commands
  3170. This filter supports the all above options as @ref{commands}.
  3171. @section crossfeed
  3172. Apply headphone crossfeed filter.
  3173. Crossfeed is the process of blending the left and right channels of stereo
  3174. audio recording.
  3175. It is mainly used to reduce extreme stereo separation of low frequencies.
  3176. The intent is to produce more speaker like sound to the listener.
  3177. The filter accepts the following options:
  3178. @table @option
  3179. @item strength
  3180. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  3181. This sets gain of low shelf filter for side part of stereo image.
  3182. Default is -6dB. Max allowed is -30db when strength is set to 1.
  3183. @item range
  3184. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  3185. This sets cut off frequency of low shelf filter. Default is cut off near
  3186. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  3187. @item slope
  3188. Set curve slope of low shelf filter. Default is 0.5.
  3189. Allowed range is from 0.01 to 1.
  3190. @item level_in
  3191. Set input gain. Default is 0.9.
  3192. @item level_out
  3193. Set output gain. Default is 1.
  3194. @end table
  3195. @subsection Commands
  3196. This filter supports the all above options as @ref{commands}.
  3197. @section crystalizer
  3198. Simple algorithm for audio noise sharpening.
  3199. This filter linearly increases differences betweeen each audio sample.
  3200. The filter accepts the following options:
  3201. @table @option
  3202. @item i
  3203. Sets the intensity of effect (default: 2.0). Must be in range between -10.0 to 0
  3204. (unchanged sound) to 10.0 (maximum effect).
  3205. To inverse filtering use negative value.
  3206. @item c
  3207. Enable clipping. By default is enabled.
  3208. @end table
  3209. @subsection Commands
  3210. This filter supports the all above options as @ref{commands}.
  3211. @section dcshift
  3212. Apply a DC shift to the audio.
  3213. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  3214. in the recording chain) from the audio. The effect of a DC offset is reduced
  3215. headroom and hence volume. The @ref{astats} filter can be used to determine if
  3216. a signal has a DC offset.
  3217. @table @option
  3218. @item shift
  3219. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  3220. the audio.
  3221. @item limitergain
  3222. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  3223. used to prevent clipping.
  3224. @end table
  3225. @section deesser
  3226. Apply de-essing to the audio samples.
  3227. @table @option
  3228. @item i
  3229. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  3230. Default is 0.
  3231. @item m
  3232. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  3233. Default is 0.5.
  3234. @item f
  3235. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  3236. Default is 0.5.
  3237. @item s
  3238. Set the output mode.
  3239. It accepts the following values:
  3240. @table @option
  3241. @item i
  3242. Pass input unchanged.
  3243. @item o
  3244. Pass ess filtered out.
  3245. @item e
  3246. Pass only ess.
  3247. Default value is @var{o}.
  3248. @end table
  3249. @end table
  3250. @section dialoguenhance
  3251. Enhance dialogue in stereo audio.
  3252. This filter accepts stereo input and produce surround (3.0) channels output.
  3253. The newly produced front center channel have enhanced speech dialogue originally
  3254. available in both stereo channels.
  3255. This filter outputs front left and front right channels same as available in stereo input.
  3256. The filter accepts the following options:
  3257. @table @option
  3258. @item original
  3259. Set the original center factor to keep in front center channel output.
  3260. Allowed range is from 0 to 1. Default value is 1.
  3261. @item enhance
  3262. Set the dialogue enhance factor to put in front center channel output.
  3263. Allowed range is from 0 to 3. Default value is 1.
  3264. @item voice
  3265. Set the voice detection factor.
  3266. Allowed range is from 2 to 32. Default value is 2.
  3267. @end table
  3268. @subsection Commands
  3269. This filter supports the all above options as @ref{commands}.
  3270. @section drmeter
  3271. Measure audio dynamic range.
  3272. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  3273. is found in transition material. And anything less that 8 have very poor dynamics
  3274. and is very compressed.
  3275. The filter accepts the following options:
  3276. @table @option
  3277. @item length
  3278. Set window length in seconds used to split audio into segments of equal length.
  3279. Default is 3 seconds.
  3280. @end table
  3281. @section dynaudnorm
  3282. Dynamic Audio Normalizer.
  3283. This filter applies a certain amount of gain to the input audio in order
  3284. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  3285. contrast to more "simple" normalization algorithms, the Dynamic Audio
  3286. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  3287. This allows for applying extra gain to the "quiet" sections of the audio
  3288. while avoiding distortions or clipping the "loud" sections. In other words:
  3289. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  3290. sections, in the sense that the volume of each section is brought to the
  3291. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  3292. this goal *without* applying "dynamic range compressing". It will retain 100%
  3293. of the dynamic range *within* each section of the audio file.
  3294. @table @option
  3295. @item framelen, f
  3296. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  3297. Default is 500 milliseconds.
  3298. The Dynamic Audio Normalizer processes the input audio in small chunks,
  3299. referred to as frames. This is required, because a peak magnitude has no
  3300. meaning for just a single sample value. Instead, we need to determine the
  3301. peak magnitude for a contiguous sequence of sample values. While a "standard"
  3302. normalizer would simply use the peak magnitude of the complete file, the
  3303. Dynamic Audio Normalizer determines the peak magnitude individually for each
  3304. frame. The length of a frame is specified in milliseconds. By default, the
  3305. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  3306. been found to give good results with most files.
  3307. Note that the exact frame length, in number of samples, will be determined
  3308. automatically, based on the sampling rate of the individual input audio file.
  3309. @item gausssize, g
  3310. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  3311. number. Default is 31.
  3312. Probably the most important parameter of the Dynamic Audio Normalizer is the
  3313. @code{window size} of the Gaussian smoothing filter. The filter's window size
  3314. is specified in frames, centered around the current frame. For the sake of
  3315. simplicity, this must be an odd number. Consequently, the default value of 31
  3316. takes into account the current frame, as well as the 15 preceding frames and
  3317. the 15 subsequent frames. Using a larger window results in a stronger
  3318. smoothing effect and thus in less gain variation, i.e. slower gain
  3319. adaptation. Conversely, using a smaller window results in a weaker smoothing
  3320. effect and thus in more gain variation, i.e. faster gain adaptation.
  3321. In other words, the more you increase this value, the more the Dynamic Audio
  3322. Normalizer will behave like a "traditional" normalization filter. On the
  3323. contrary, the more you decrease this value, the more the Dynamic Audio
  3324. Normalizer will behave like a dynamic range compressor.
  3325. @item peak, p
  3326. Set the target peak value. This specifies the highest permissible magnitude
  3327. level for the normalized audio input. This filter will try to approach the
  3328. target peak magnitude as closely as possible, but at the same time it also
  3329. makes sure that the normalized signal will never exceed the peak magnitude.
  3330. A frame's maximum local gain factor is imposed directly by the target peak
  3331. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  3332. It is not recommended to go above this value.
  3333. @item maxgain, m
  3334. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  3335. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  3336. factor for each input frame, i.e. the maximum gain factor that does not
  3337. result in clipping or distortion. The maximum gain factor is determined by
  3338. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  3339. additionally bounds the frame's maximum gain factor by a predetermined
  3340. (global) maximum gain factor. This is done in order to avoid excessive gain
  3341. factors in "silent" or almost silent frames. By default, the maximum gain
  3342. factor is 10.0, For most inputs the default value should be sufficient and
  3343. it usually is not recommended to increase this value. Though, for input
  3344. with an extremely low overall volume level, it may be necessary to allow even
  3345. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  3346. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  3347. Instead, a "sigmoid" threshold function will be applied. This way, the
  3348. gain factors will smoothly approach the threshold value, but never exceed that
  3349. value.
  3350. @item targetrms, r
  3351. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  3352. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  3353. This means that the maximum local gain factor for each frame is defined
  3354. (only) by the frame's highest magnitude sample. This way, the samples can
  3355. be amplified as much as possible without exceeding the maximum signal
  3356. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  3357. Normalizer can also take into account the frame's root mean square,
  3358. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  3359. determine the power of a time-varying signal. It is therefore considered
  3360. that the RMS is a better approximation of the "perceived loudness" than
  3361. just looking at the signal's peak magnitude. Consequently, by adjusting all
  3362. frames to a constant RMS value, a uniform "perceived loudness" can be
  3363. established. If a target RMS value has been specified, a frame's local gain
  3364. factor is defined as the factor that would result in exactly that RMS value.
  3365. Note, however, that the maximum local gain factor is still restricted by the
  3366. frame's highest magnitude sample, in order to prevent clipping.
  3367. @item coupling, n
  3368. Enable channels coupling. By default is enabled.
  3369. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  3370. amount. This means the same gain factor will be applied to all channels, i.e.
  3371. the maximum possible gain factor is determined by the "loudest" channel.
  3372. However, in some recordings, it may happen that the volume of the different
  3373. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  3374. In this case, this option can be used to disable the channel coupling. This way,
  3375. the gain factor will be determined independently for each channel, depending
  3376. only on the individual channel's highest magnitude sample. This allows for
  3377. harmonizing the volume of the different channels.
  3378. @item correctdc, c
  3379. Enable DC bias correction. By default is disabled.
  3380. An audio signal (in the time domain) is a sequence of sample values.
  3381. In the Dynamic Audio Normalizer these sample values are represented in the
  3382. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  3383. audio signal, or "waveform", should be centered around the zero point.
  3384. That means if we calculate the mean value of all samples in a file, or in a
  3385. single frame, then the result should be 0.0 or at least very close to that
  3386. value. If, however, there is a significant deviation of the mean value from
  3387. 0.0, in either positive or negative direction, this is referred to as a
  3388. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  3389. Audio Normalizer provides optional DC bias correction.
  3390. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  3391. the mean value, or "DC correction" offset, of each input frame and subtract
  3392. that value from all of the frame's sample values which ensures those samples
  3393. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  3394. boundaries, the DC correction offset values will be interpolated smoothly
  3395. between neighbouring frames.
  3396. @item altboundary, b
  3397. Enable alternative boundary mode. By default is disabled.
  3398. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  3399. around each frame. This includes the preceding frames as well as the
  3400. subsequent frames. However, for the "boundary" frames, located at the very
  3401. beginning and at the very end of the audio file, not all neighbouring
  3402. frames are available. In particular, for the first few frames in the audio
  3403. file, the preceding frames are not known. And, similarly, for the last few
  3404. frames in the audio file, the subsequent frames are not known. Thus, the
  3405. question arises which gain factors should be assumed for the missing frames
  3406. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  3407. to deal with this situation. The default boundary mode assumes a gain factor
  3408. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  3409. "fade out" at the beginning and at the end of the input, respectively.
  3410. @item compress, s
  3411. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  3412. By default, the Dynamic Audio Normalizer does not apply "traditional"
  3413. compression. This means that signal peaks will not be pruned and thus the
  3414. full dynamic range will be retained within each local neighbourhood. However,
  3415. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  3416. normalization algorithm with a more "traditional" compression.
  3417. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  3418. (thresholding) function. If (and only if) the compression feature is enabled,
  3419. all input frames will be processed by a soft knee thresholding function prior
  3420. to the actual normalization process. Put simply, the thresholding function is
  3421. going to prune all samples whose magnitude exceeds a certain threshold value.
  3422. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  3423. value. Instead, the threshold value will be adjusted for each individual
  3424. frame.
  3425. In general, smaller parameters result in stronger compression, and vice versa.
  3426. Values below 3.0 are not recommended, because audible distortion may appear.
  3427. @item threshold, t
  3428. Set the target threshold value. This specifies the lowest permissible
  3429. magnitude level for the audio input which will be normalized.
  3430. If input frame volume is above this value frame will be normalized.
  3431. Otherwise frame may not be normalized at all. The default value is set
  3432. to 0, which means all input frames will be normalized.
  3433. This option is mostly useful if digital noise is not wanted to be amplified.
  3434. @item channels, h
  3435. Specify which channels to filter, by default all available channels are filtered.
  3436. @item overlap, o
  3437. Specify overlap for frames. If set to 0 (default) no frame overlapping is done.
  3438. Using >0 and <1 values will make less conservative gain adjustments, like
  3439. when framelen option is set to smaller value, if framelen option value is
  3440. compensated for non-zero overlap then gain adjustments will be smoother across time
  3441. compared to zero overlap case.
  3442. @end table
  3443. @subsection Commands
  3444. This filter supports the all above options as @ref{commands}.
  3445. @section earwax
  3446. Make audio easier to listen to on headphones.
  3447. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  3448. so that when listened to on headphones the stereo image is moved from
  3449. inside your head (standard for headphones) to outside and in front of
  3450. the listener (standard for speakers).
  3451. Ported from SoX.
  3452. @section equalizer
  3453. Apply a two-pole peaking equalisation (EQ) filter. With this
  3454. filter, the signal-level at and around a selected frequency can
  3455. be increased or decreased, whilst (unlike bandpass and bandreject
  3456. filters) that at all other frequencies is unchanged.
  3457. In order to produce complex equalisation curves, this filter can
  3458. be given several times, each with a different central frequency.
  3459. The filter accepts the following options:
  3460. @table @option
  3461. @item frequency, f
  3462. Set the filter's central frequency in Hz.
  3463. @item width_type, t
  3464. Set method to specify band-width of filter.
  3465. @table @option
  3466. @item h
  3467. Hz
  3468. @item q
  3469. Q-Factor
  3470. @item o
  3471. octave
  3472. @item s
  3473. slope
  3474. @item k
  3475. kHz
  3476. @end table
  3477. @item width, w
  3478. Specify the band-width of a filter in width_type units.
  3479. @item gain, g
  3480. Set the required gain or attenuation in dB.
  3481. Beware of clipping when using a positive gain.
  3482. @item mix, m
  3483. How much to use filtered signal in output. Default is 1.
  3484. Range is between 0 and 1.
  3485. @item channels, c
  3486. Specify which channels to filter, by default all available are filtered.
  3487. @item normalize, n
  3488. Normalize biquad coefficients, by default is disabled.
  3489. Enabling it will normalize magnitude response at DC to 0dB.
  3490. @item transform, a
  3491. Set transform type of IIR filter.
  3492. @table @option
  3493. @item di
  3494. @item dii
  3495. @item tdii
  3496. @item latt
  3497. @item svf
  3498. @end table
  3499. @item precision, r
  3500. Set precison of filtering.
  3501. @table @option
  3502. @item auto
  3503. Pick automatic sample format depending on surround filters.
  3504. @item s16
  3505. Always use signed 16-bit.
  3506. @item s32
  3507. Always use signed 32-bit.
  3508. @item f32
  3509. Always use float 32-bit.
  3510. @item f64
  3511. Always use float 64-bit.
  3512. @end table
  3513. @end table
  3514. @subsection Examples
  3515. @itemize
  3516. @item
  3517. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  3518. @example
  3519. equalizer=f=1000:t=h:width=200:g=-10
  3520. @end example
  3521. @item
  3522. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  3523. @example
  3524. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  3525. @end example
  3526. @end itemize
  3527. @subsection Commands
  3528. This filter supports the following commands:
  3529. @table @option
  3530. @item frequency, f
  3531. Change equalizer frequency.
  3532. Syntax for the command is : "@var{frequency}"
  3533. @item width_type, t
  3534. Change equalizer width_type.
  3535. Syntax for the command is : "@var{width_type}"
  3536. @item width, w
  3537. Change equalizer width.
  3538. Syntax for the command is : "@var{width}"
  3539. @item gain, g
  3540. Change equalizer gain.
  3541. Syntax for the command is : "@var{gain}"
  3542. @item mix, m
  3543. Change equalizer mix.
  3544. Syntax for the command is : "@var{mix}"
  3545. @end table
  3546. @section extrastereo
  3547. Linearly increases the difference between left and right channels which
  3548. adds some sort of "live" effect to playback.
  3549. The filter accepts the following options:
  3550. @table @option
  3551. @item m
  3552. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  3553. (average of both channels), with 1.0 sound will be unchanged, with
  3554. -1.0 left and right channels will be swapped.
  3555. @item c
  3556. Enable clipping. By default is enabled.
  3557. @end table
  3558. @subsection Commands
  3559. This filter supports the all above options as @ref{commands}.
  3560. @section firequalizer
  3561. Apply FIR Equalization using arbitrary frequency response.
  3562. The filter accepts the following option:
  3563. @table @option
  3564. @item gain
  3565. Set gain curve equation (in dB). The expression can contain variables:
  3566. @table @option
  3567. @item f
  3568. the evaluated frequency
  3569. @item sr
  3570. sample rate
  3571. @item ch
  3572. channel number, set to 0 when multichannels evaluation is disabled
  3573. @item chid
  3574. channel id, see libavutil/channel_layout.h, set to the first channel id when
  3575. multichannels evaluation is disabled
  3576. @item chs
  3577. number of channels
  3578. @item chlayout
  3579. channel_layout, see libavutil/channel_layout.h
  3580. @end table
  3581. and functions:
  3582. @table @option
  3583. @item gain_interpolate(f)
  3584. interpolate gain on frequency f based on gain_entry
  3585. @item cubic_interpolate(f)
  3586. same as gain_interpolate, but smoother
  3587. @end table
  3588. This option is also available as command. Default is @code{gain_interpolate(f)}.
  3589. @item gain_entry
  3590. Set gain entry for gain_interpolate function. The expression can
  3591. contain functions:
  3592. @table @option
  3593. @item entry(f, g)
  3594. store gain entry at frequency f with value g
  3595. @end table
  3596. This option is also available as command.
  3597. @item delay
  3598. Set filter delay in seconds. Higher value means more accurate.
  3599. Default is @code{0.01}.
  3600. @item accuracy
  3601. Set filter accuracy in Hz. Lower value means more accurate.
  3602. Default is @code{5}.
  3603. @item wfunc
  3604. Set window function. Acceptable values are:
  3605. @table @option
  3606. @item rectangular
  3607. rectangular window, useful when gain curve is already smooth
  3608. @item hann
  3609. hann window (default)
  3610. @item hamming
  3611. hamming window
  3612. @item blackman
  3613. blackman window
  3614. @item nuttall3
  3615. 3-terms continuous 1st derivative nuttall window
  3616. @item mnuttall3
  3617. minimum 3-terms discontinuous nuttall window
  3618. @item nuttall
  3619. 4-terms continuous 1st derivative nuttall window
  3620. @item bnuttall
  3621. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  3622. @item bharris
  3623. blackman-harris window
  3624. @item tukey
  3625. tukey window
  3626. @end table
  3627. @item fixed
  3628. If enabled, use fixed number of audio samples. This improves speed when
  3629. filtering with large delay. Default is disabled.
  3630. @item multi
  3631. Enable multichannels evaluation on gain. Default is disabled.
  3632. @item zero_phase
  3633. Enable zero phase mode by subtracting timestamp to compensate delay.
  3634. Default is disabled.
  3635. @item scale
  3636. Set scale used by gain. Acceptable values are:
  3637. @table @option
  3638. @item linlin
  3639. linear frequency, linear gain
  3640. @item linlog
  3641. linear frequency, logarithmic (in dB) gain (default)
  3642. @item loglin
  3643. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  3644. @item loglog
  3645. logarithmic frequency, logarithmic gain
  3646. @end table
  3647. @item dumpfile
  3648. Set file for dumping, suitable for gnuplot.
  3649. @item dumpscale
  3650. Set scale for dumpfile. Acceptable values are same with scale option.
  3651. Default is linlog.
  3652. @item fft2
  3653. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  3654. Default is disabled.
  3655. @item min_phase
  3656. Enable minimum phase impulse response. Default is disabled.
  3657. @end table
  3658. @subsection Examples
  3659. @itemize
  3660. @item
  3661. lowpass at 1000 Hz:
  3662. @example
  3663. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  3664. @end example
  3665. @item
  3666. lowpass at 1000 Hz with gain_entry:
  3667. @example
  3668. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  3669. @end example
  3670. @item
  3671. custom equalization:
  3672. @example
  3673. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  3674. @end example
  3675. @item
  3676. higher delay with zero phase to compensate delay:
  3677. @example
  3678. firequalizer=delay=0.1:fixed=on:zero_phase=on
  3679. @end example
  3680. @item
  3681. lowpass on left channel, highpass on right channel:
  3682. @example
  3683. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  3684. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  3685. @end example
  3686. @end itemize
  3687. @section flanger
  3688. Apply a flanging effect to the audio.
  3689. The filter accepts the following options:
  3690. @table @option
  3691. @item delay
  3692. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  3693. @item depth
  3694. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  3695. @item regen
  3696. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  3697. Default value is 0.
  3698. @item width
  3699. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  3700. Default value is 71.
  3701. @item speed
  3702. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  3703. @item shape
  3704. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  3705. Default value is @var{sinusoidal}.
  3706. @item phase
  3707. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  3708. Default value is 25.
  3709. @item interp
  3710. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  3711. Default is @var{linear}.
  3712. @end table
  3713. @section haas
  3714. Apply Haas effect to audio.
  3715. Note that this makes most sense to apply on mono signals.
  3716. With this filter applied to mono signals it give some directionality and
  3717. stretches its stereo image.
  3718. The filter accepts the following options:
  3719. @table @option
  3720. @item level_in
  3721. Set input level. By default is @var{1}, or 0dB
  3722. @item level_out
  3723. Set output level. By default is @var{1}, or 0dB.
  3724. @item side_gain
  3725. Set gain applied to side part of signal. By default is @var{1}.
  3726. @item middle_source
  3727. Set kind of middle source. Can be one of the following:
  3728. @table @samp
  3729. @item left
  3730. Pick left channel.
  3731. @item right
  3732. Pick right channel.
  3733. @item mid
  3734. Pick middle part signal of stereo image.
  3735. @item side
  3736. Pick side part signal of stereo image.
  3737. @end table
  3738. @item middle_phase
  3739. Change middle phase. By default is disabled.
  3740. @item left_delay
  3741. Set left channel delay. By default is @var{2.05} milliseconds.
  3742. @item left_balance
  3743. Set left channel balance. By default is @var{-1}.
  3744. @item left_gain
  3745. Set left channel gain. By default is @var{1}.
  3746. @item left_phase
  3747. Change left phase. By default is disabled.
  3748. @item right_delay
  3749. Set right channel delay. By defaults is @var{2.12} milliseconds.
  3750. @item right_balance
  3751. Set right channel balance. By default is @var{1}.
  3752. @item right_gain
  3753. Set right channel gain. By default is @var{1}.
  3754. @item right_phase
  3755. Change right phase. By default is enabled.
  3756. @end table
  3757. @section hdcd
  3758. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  3759. embedded HDCD codes is expanded into a 20-bit PCM stream.
  3760. The filter supports the Peak Extend and Low-level Gain Adjustment features
  3761. of HDCD, and detects the Transient Filter flag.
  3762. @example
  3763. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  3764. @end example
  3765. When using the filter with wav, note the default encoding for wav is 16-bit,
  3766. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  3767. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  3768. @example
  3769. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  3770. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  3771. @end example
  3772. The filter accepts the following options:
  3773. @table @option
  3774. @item disable_autoconvert
  3775. Disable any automatic format conversion or resampling in the filter graph.
  3776. @item process_stereo
  3777. Process the stereo channels together. If target_gain does not match between
  3778. channels, consider it invalid and use the last valid target_gain.
  3779. @item cdt_ms
  3780. Set the code detect timer period in ms.
  3781. @item force_pe
  3782. Always extend peaks above -3dBFS even if PE isn't signaled.
  3783. @item analyze_mode
  3784. Replace audio with a solid tone and adjust the amplitude to signal some
  3785. specific aspect of the decoding process. The output file can be loaded in
  3786. an audio editor alongside the original to aid analysis.
  3787. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  3788. Modes are:
  3789. @table @samp
  3790. @item 0, off
  3791. Disabled
  3792. @item 1, lle
  3793. Gain adjustment level at each sample
  3794. @item 2, pe
  3795. Samples where peak extend occurs
  3796. @item 3, cdt
  3797. Samples where the code detect timer is active
  3798. @item 4, tgm
  3799. Samples where the target gain does not match between channels
  3800. @end table
  3801. @end table
  3802. @section headphone
  3803. Apply head-related transfer functions (HRTFs) to create virtual
  3804. loudspeakers around the user for binaural listening via headphones.
  3805. The HRIRs are provided via additional streams, for each channel
  3806. one stereo input stream is needed.
  3807. The filter accepts the following options:
  3808. @table @option
  3809. @item map
  3810. Set mapping of input streams for convolution.
  3811. The argument is a '|'-separated list of channel names in order as they
  3812. are given as additional stream inputs for filter.
  3813. This also specify number of input streams. Number of input streams
  3814. must be not less than number of channels in first stream plus one.
  3815. @item gain
  3816. Set gain applied to audio. Value is in dB. Default is 0.
  3817. @item type
  3818. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3819. processing audio in time domain which is slow.
  3820. @var{freq} is processing audio in frequency domain which is fast.
  3821. Default is @var{freq}.
  3822. @item lfe
  3823. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3824. @item size
  3825. Set size of frame in number of samples which will be processed at once.
  3826. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  3827. @item hrir
  3828. Set format of hrir stream.
  3829. Default value is @var{stereo}. Alternative value is @var{multich}.
  3830. If value is set to @var{stereo}, number of additional streams should
  3831. be greater or equal to number of input channels in first input stream.
  3832. Also each additional stream should have stereo number of channels.
  3833. If value is set to @var{multich}, number of additional streams should
  3834. be exactly one. Also number of input channels of additional stream
  3835. should be equal or greater than twice number of channels of first input
  3836. stream.
  3837. @end table
  3838. @subsection Examples
  3839. @itemize
  3840. @item
  3841. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3842. each amovie filter use stereo file with IR coefficients as input.
  3843. The files give coefficients for each position of virtual loudspeaker:
  3844. @example
  3845. ffmpeg -i input.wav
  3846. -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"
  3847. output.wav
  3848. @end example
  3849. @item
  3850. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3851. but now in @var{multich} @var{hrir} format.
  3852. @example
  3853. 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"
  3854. output.wav
  3855. @end example
  3856. @end itemize
  3857. @section highpass
  3858. Apply a high-pass filter with 3dB point frequency.
  3859. The filter can be either single-pole, or double-pole (the default).
  3860. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3861. The filter accepts the following options:
  3862. @table @option
  3863. @item frequency, f
  3864. Set frequency in Hz. Default is 3000.
  3865. @item poles, p
  3866. Set number of poles. Default is 2.
  3867. @item width_type, t
  3868. Set method to specify band-width of filter.
  3869. @table @option
  3870. @item h
  3871. Hz
  3872. @item q
  3873. Q-Factor
  3874. @item o
  3875. octave
  3876. @item s
  3877. slope
  3878. @item k
  3879. kHz
  3880. @end table
  3881. @item width, w
  3882. Specify the band-width of a filter in width_type units.
  3883. Applies only to double-pole filter.
  3884. The default is 0.707q and gives a Butterworth response.
  3885. @item mix, m
  3886. How much to use filtered signal in output. Default is 1.
  3887. Range is between 0 and 1.
  3888. @item channels, c
  3889. Specify which channels to filter, by default all available are filtered.
  3890. @item normalize, n
  3891. Normalize biquad coefficients, by default is disabled.
  3892. Enabling it will normalize magnitude response at DC to 0dB.
  3893. @item transform, a
  3894. Set transform type of IIR filter.
  3895. @table @option
  3896. @item di
  3897. @item dii
  3898. @item tdii
  3899. @item latt
  3900. @item svf
  3901. @end table
  3902. @item precision, r
  3903. Set precison of filtering.
  3904. @table @option
  3905. @item auto
  3906. Pick automatic sample format depending on surround filters.
  3907. @item s16
  3908. Always use signed 16-bit.
  3909. @item s32
  3910. Always use signed 32-bit.
  3911. @item f32
  3912. Always use float 32-bit.
  3913. @item f64
  3914. Always use float 64-bit.
  3915. @end table
  3916. @end table
  3917. @subsection Commands
  3918. This filter supports the following commands:
  3919. @table @option
  3920. @item frequency, f
  3921. Change highpass frequency.
  3922. Syntax for the command is : "@var{frequency}"
  3923. @item width_type, t
  3924. Change highpass width_type.
  3925. Syntax for the command is : "@var{width_type}"
  3926. @item width, w
  3927. Change highpass width.
  3928. Syntax for the command is : "@var{width}"
  3929. @item mix, m
  3930. Change highpass mix.
  3931. Syntax for the command is : "@var{mix}"
  3932. @end table
  3933. @section join
  3934. Join multiple input streams into one multi-channel stream.
  3935. It accepts the following parameters:
  3936. @table @option
  3937. @item inputs
  3938. The number of input streams. It defaults to 2.
  3939. @item channel_layout
  3940. The desired output channel layout. It defaults to stereo.
  3941. @item map
  3942. Map channels from inputs to output. The argument is a '|'-separated list of
  3943. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3944. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3945. can be either the name of the input channel (e.g. FL for front left) or its
  3946. index in the specified input stream. @var{out_channel} is the name of the output
  3947. channel.
  3948. @end table
  3949. The filter will attempt to guess the mappings when they are not specified
  3950. explicitly. It does so by first trying to find an unused matching input channel
  3951. and if that fails it picks the first unused input channel.
  3952. Join 3 inputs (with properly set channel layouts):
  3953. @example
  3954. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3955. @end example
  3956. Build a 5.1 output from 6 single-channel streams:
  3957. @example
  3958. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3959. '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'
  3960. out
  3961. @end example
  3962. @section ladspa
  3963. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3964. To enable compilation of this filter you need to configure FFmpeg with
  3965. @code{--enable-ladspa}.
  3966. @table @option
  3967. @item file, f
  3968. Specifies the name of LADSPA plugin library to load. If the environment
  3969. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3970. each one of the directories specified by the colon separated list in
  3971. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3972. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3973. @file{/usr/lib/ladspa/}.
  3974. @item plugin, p
  3975. Specifies the plugin within the library. Some libraries contain only
  3976. one plugin, but others contain many of them. If this is not set filter
  3977. will list all available plugins within the specified library.
  3978. @item controls, c
  3979. Set the '|' separated list of controls which are zero or more floating point
  3980. values that determine the behavior of the loaded plugin (for example delay,
  3981. threshold or gain).
  3982. Controls need to be defined using the following syntax:
  3983. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3984. @var{valuei} is the value set on the @var{i}-th control.
  3985. Alternatively they can be also defined using the following syntax:
  3986. @var{value0}|@var{value1}|@var{value2}|..., where
  3987. @var{valuei} is the value set on the @var{i}-th control.
  3988. If @option{controls} is set to @code{help}, all available controls and
  3989. their valid ranges are printed.
  3990. @item sample_rate, s
  3991. Specify the sample rate, default to 44100. Only used if plugin have
  3992. zero inputs.
  3993. @item nb_samples, n
  3994. Set the number of samples per channel per each output frame, default
  3995. is 1024. Only used if plugin have zero inputs.
  3996. @item duration, d
  3997. Set the minimum duration of the sourced audio. See
  3998. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3999. for the accepted syntax.
  4000. Note that the resulting duration may be greater than the specified duration,
  4001. as the generated audio is always cut at the end of a complete frame.
  4002. If not specified, or the expressed duration is negative, the audio is
  4003. supposed to be generated forever.
  4004. Only used if plugin have zero inputs.
  4005. @item latency, l
  4006. Enable latency compensation, by default is disabled.
  4007. Only used if plugin have inputs.
  4008. @end table
  4009. @subsection Examples
  4010. @itemize
  4011. @item
  4012. List all available plugins within amp (LADSPA example plugin) library:
  4013. @example
  4014. ladspa=file=amp
  4015. @end example
  4016. @item
  4017. List all available controls and their valid ranges for @code{vcf_notch}
  4018. plugin from @code{VCF} library:
  4019. @example
  4020. ladspa=f=vcf:p=vcf_notch:c=help
  4021. @end example
  4022. @item
  4023. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  4024. plugin library:
  4025. @example
  4026. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  4027. @end example
  4028. @item
  4029. Add reverberation to the audio using TAP-plugins
  4030. (Tom's Audio Processing plugins):
  4031. @example
  4032. ladspa=file=tap_reverb:tap_reverb
  4033. @end example
  4034. @item
  4035. Generate white noise, with 0.2 amplitude:
  4036. @example
  4037. ladspa=file=cmt:noise_source_white:c=c0=.2
  4038. @end example
  4039. @item
  4040. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  4041. @code{C* Audio Plugin Suite} (CAPS) library:
  4042. @example
  4043. ladspa=file=caps:Click:c=c1=20'
  4044. @end example
  4045. @item
  4046. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  4047. @example
  4048. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  4049. @end example
  4050. @item
  4051. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  4052. @code{SWH Plugins} collection:
  4053. @example
  4054. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  4055. @end example
  4056. @item
  4057. Attenuate low frequencies using Multiband EQ from Steve Harris
  4058. @code{SWH Plugins} collection:
  4059. @example
  4060. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  4061. @end example
  4062. @item
  4063. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  4064. (CAPS) library:
  4065. @example
  4066. ladspa=caps:Narrower
  4067. @end example
  4068. @item
  4069. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  4070. @example
  4071. ladspa=caps:White:.2
  4072. @end example
  4073. @item
  4074. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  4075. @example
  4076. ladspa=caps:Fractal:c=c1=1
  4077. @end example
  4078. @item
  4079. Dynamic volume normalization using @code{VLevel} plugin:
  4080. @example
  4081. ladspa=vlevel-ladspa:vlevel_mono
  4082. @end example
  4083. @end itemize
  4084. @subsection Commands
  4085. This filter supports the following commands:
  4086. @table @option
  4087. @item cN
  4088. Modify the @var{N}-th control value.
  4089. If the specified value is not valid, it is ignored and prior one is kept.
  4090. @end table
  4091. @section loudnorm
  4092. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  4093. Support for both single pass (livestreams, files) and double pass (files) modes.
  4094. This algorithm can target IL, LRA, and maximum true peak. In dynamic mode, to accurately
  4095. detect true peaks, the audio stream will be upsampled to 192 kHz.
  4096. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  4097. The filter accepts the following options:
  4098. @table @option
  4099. @item I, i
  4100. Set integrated loudness target.
  4101. Range is -70.0 - -5.0. Default value is -24.0.
  4102. @item LRA, lra
  4103. Set loudness range target.
  4104. Range is 1.0 - 50.0. Default value is 7.0.
  4105. @item TP, tp
  4106. Set maximum true peak.
  4107. Range is -9.0 - +0.0. Default value is -2.0.
  4108. @item measured_I, measured_i
  4109. Measured IL of input file.
  4110. Range is -99.0 - +0.0.
  4111. @item measured_LRA, measured_lra
  4112. Measured LRA of input file.
  4113. Range is 0.0 - 99.0.
  4114. @item measured_TP, measured_tp
  4115. Measured true peak of input file.
  4116. Range is -99.0 - +99.0.
  4117. @item measured_thresh
  4118. Measured threshold of input file.
  4119. Range is -99.0 - +0.0.
  4120. @item offset
  4121. Set offset gain. Gain is applied before the true-peak limiter.
  4122. Range is -99.0 - +99.0. Default is +0.0.
  4123. @item linear
  4124. Normalize by linearly scaling the source audio.
  4125. @code{measured_I}, @code{measured_LRA}, @code{measured_TP},
  4126. and @code{measured_thresh} must all be specified. Target LRA shouldn't
  4127. be lower than source LRA and the change in integrated loudness shouldn't
  4128. result in a true peak which exceeds the target TP. If any of these
  4129. conditions aren't met, normalization mode will revert to @var{dynamic}.
  4130. Options are @code{true} or @code{false}. Default is @code{true}.
  4131. @item dual_mono
  4132. Treat mono input files as "dual-mono". If a mono file is intended for playback
  4133. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  4134. If set to @code{true}, this option will compensate for this effect.
  4135. Multi-channel input files are not affected by this option.
  4136. Options are true or false. Default is false.
  4137. @item print_format
  4138. Set print format for stats. Options are summary, json, or none.
  4139. Default value is none.
  4140. @end table
  4141. @section lowpass
  4142. Apply a low-pass filter with 3dB point frequency.
  4143. The filter can be either single-pole or double-pole (the default).
  4144. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  4145. The filter accepts the following options:
  4146. @table @option
  4147. @item frequency, f
  4148. Set frequency in Hz. Default is 500.
  4149. @item poles, p
  4150. Set number of poles. Default is 2.
  4151. @item width_type, t
  4152. Set method to specify band-width of filter.
  4153. @table @option
  4154. @item h
  4155. Hz
  4156. @item q
  4157. Q-Factor
  4158. @item o
  4159. octave
  4160. @item s
  4161. slope
  4162. @item k
  4163. kHz
  4164. @end table
  4165. @item width, w
  4166. Specify the band-width of a filter in width_type units.
  4167. Applies only to double-pole filter.
  4168. The default is 0.707q and gives a Butterworth response.
  4169. @item mix, m
  4170. How much to use filtered signal in output. Default is 1.
  4171. Range is between 0 and 1.
  4172. @item channels, c
  4173. Specify which channels to filter, by default all available are filtered.
  4174. @item normalize, n
  4175. Normalize biquad coefficients, by default is disabled.
  4176. Enabling it will normalize magnitude response at DC to 0dB.
  4177. @item transform, a
  4178. Set transform type of IIR filter.
  4179. @table @option
  4180. @item di
  4181. @item dii
  4182. @item tdii
  4183. @item latt
  4184. @item svf
  4185. @end table
  4186. @item precision, r
  4187. Set precison of filtering.
  4188. @table @option
  4189. @item auto
  4190. Pick automatic sample format depending on surround filters.
  4191. @item s16
  4192. Always use signed 16-bit.
  4193. @item s32
  4194. Always use signed 32-bit.
  4195. @item f32
  4196. Always use float 32-bit.
  4197. @item f64
  4198. Always use float 64-bit.
  4199. @end table
  4200. @end table
  4201. @subsection Examples
  4202. @itemize
  4203. @item
  4204. Lowpass only LFE channel, it LFE is not present it does nothing:
  4205. @example
  4206. lowpass=c=LFE
  4207. @end example
  4208. @end itemize
  4209. @subsection Commands
  4210. This filter supports the following commands:
  4211. @table @option
  4212. @item frequency, f
  4213. Change lowpass frequency.
  4214. Syntax for the command is : "@var{frequency}"
  4215. @item width_type, t
  4216. Change lowpass width_type.
  4217. Syntax for the command is : "@var{width_type}"
  4218. @item width, w
  4219. Change lowpass width.
  4220. Syntax for the command is : "@var{width}"
  4221. @item mix, m
  4222. Change lowpass mix.
  4223. Syntax for the command is : "@var{mix}"
  4224. @end table
  4225. @section lv2
  4226. Load a LV2 (LADSPA Version 2) plugin.
  4227. To enable compilation of this filter you need to configure FFmpeg with
  4228. @code{--enable-lv2}.
  4229. @table @option
  4230. @item plugin, p
  4231. Specifies the plugin URI. You may need to escape ':'.
  4232. @item controls, c
  4233. Set the '|' separated list of controls which are zero or more floating point
  4234. values that determine the behavior of the loaded plugin (for example delay,
  4235. threshold or gain).
  4236. If @option{controls} is set to @code{help}, all available controls and
  4237. their valid ranges are printed.
  4238. @item sample_rate, s
  4239. Specify the sample rate, default to 44100. Only used if plugin have
  4240. zero inputs.
  4241. @item nb_samples, n
  4242. Set the number of samples per channel per each output frame, default
  4243. is 1024. Only used if plugin have zero inputs.
  4244. @item duration, d
  4245. Set the minimum duration of the sourced audio. See
  4246. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4247. for the accepted syntax.
  4248. Note that the resulting duration may be greater than the specified duration,
  4249. as the generated audio is always cut at the end of a complete frame.
  4250. If not specified, or the expressed duration is negative, the audio is
  4251. supposed to be generated forever.
  4252. Only used if plugin have zero inputs.
  4253. @end table
  4254. @subsection Examples
  4255. @itemize
  4256. @item
  4257. Apply bass enhancer plugin from Calf:
  4258. @example
  4259. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  4260. @end example
  4261. @item
  4262. Apply vinyl plugin from Calf:
  4263. @example
  4264. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  4265. @end example
  4266. @item
  4267. Apply bit crusher plugin from ArtyFX:
  4268. @example
  4269. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  4270. @end example
  4271. @end itemize
  4272. @subsection Commands
  4273. This filter supports all options that are exported by plugin as commands.
  4274. @section mcompand
  4275. Multiband Compress or expand the audio's dynamic range.
  4276. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  4277. This is akin to the crossover of a loudspeaker, and results in flat frequency
  4278. response when absent compander action.
  4279. It accepts the following parameters:
  4280. @table @option
  4281. @item args
  4282. This option syntax is:
  4283. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  4284. For explanation of each item refer to compand filter documentation.
  4285. @end table
  4286. @anchor{pan}
  4287. @section pan
  4288. Mix channels with specific gain levels. The filter accepts the output
  4289. channel layout followed by a set of channels definitions.
  4290. This filter is also designed to efficiently remap the channels of an audio
  4291. stream.
  4292. The filter accepts parameters of the form:
  4293. "@var{l}|@var{outdef}|@var{outdef}|..."
  4294. @table @option
  4295. @item l
  4296. output channel layout or number of channels
  4297. @item outdef
  4298. output channel specification, of the form:
  4299. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  4300. @item out_name
  4301. output channel to define, either a channel name (FL, FR, etc.) or a channel
  4302. number (c0, c1, etc.)
  4303. @item gain
  4304. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  4305. @item in_name
  4306. input channel to use, see out_name for details; it is not possible to mix
  4307. named and numbered input channels
  4308. @end table
  4309. If the `=' in a channel specification is replaced by `<', then the gains for
  4310. that specification will be renormalized so that the total is 1, thus
  4311. avoiding clipping noise.
  4312. @subsection Mixing examples
  4313. For example, if you want to down-mix from stereo to mono, but with a bigger
  4314. factor for the left channel:
  4315. @example
  4316. pan=1c|c0=0.9*c0+0.1*c1
  4317. @end example
  4318. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  4319. 7-channels surround:
  4320. @example
  4321. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  4322. @end example
  4323. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  4324. that should be preferred (see "-ac" option) unless you have very specific
  4325. needs.
  4326. @subsection Remapping examples
  4327. The channel remapping will be effective if, and only if:
  4328. @itemize
  4329. @item gain coefficients are zeroes or ones,
  4330. @item only one input per channel output,
  4331. @end itemize
  4332. If all these conditions are satisfied, the filter will notify the user ("Pure
  4333. channel mapping detected"), and use an optimized and lossless method to do the
  4334. remapping.
  4335. For example, if you have a 5.1 source and want a stereo audio stream by
  4336. dropping the extra channels:
  4337. @example
  4338. pan="stereo| c0=FL | c1=FR"
  4339. @end example
  4340. Given the same source, you can also switch front left and front right channels
  4341. and keep the input channel layout:
  4342. @example
  4343. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  4344. @end example
  4345. If the input is a stereo audio stream, you can mute the front left channel (and
  4346. still keep the stereo channel layout) with:
  4347. @example
  4348. pan="stereo|c1=c1"
  4349. @end example
  4350. Still with a stereo audio stream input, you can copy the right channel in both
  4351. front left and right:
  4352. @example
  4353. pan="stereo| c0=FR | c1=FR"
  4354. @end example
  4355. @section replaygain
  4356. ReplayGain scanner filter. This filter takes an audio stream as an input and
  4357. outputs it unchanged.
  4358. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  4359. @section resample
  4360. Convert the audio sample format, sample rate and channel layout. It is
  4361. not meant to be used directly.
  4362. @section rubberband
  4363. Apply time-stretching and pitch-shifting with librubberband.
  4364. To enable compilation of this filter, you need to configure FFmpeg with
  4365. @code{--enable-librubberband}.
  4366. The filter accepts the following options:
  4367. @table @option
  4368. @item tempo
  4369. Set tempo scale factor.
  4370. @item pitch
  4371. Set pitch scale factor.
  4372. @item transients
  4373. Set transients detector.
  4374. Possible values are:
  4375. @table @var
  4376. @item crisp
  4377. @item mixed
  4378. @item smooth
  4379. @end table
  4380. @item detector
  4381. Set detector.
  4382. Possible values are:
  4383. @table @var
  4384. @item compound
  4385. @item percussive
  4386. @item soft
  4387. @end table
  4388. @item phase
  4389. Set phase.
  4390. Possible values are:
  4391. @table @var
  4392. @item laminar
  4393. @item independent
  4394. @end table
  4395. @item window
  4396. Set processing window size.
  4397. Possible values are:
  4398. @table @var
  4399. @item standard
  4400. @item short
  4401. @item long
  4402. @end table
  4403. @item smoothing
  4404. Set smoothing.
  4405. Possible values are:
  4406. @table @var
  4407. @item off
  4408. @item on
  4409. @end table
  4410. @item formant
  4411. Enable formant preservation when shift pitching.
  4412. Possible values are:
  4413. @table @var
  4414. @item shifted
  4415. @item preserved
  4416. @end table
  4417. @item pitchq
  4418. Set pitch quality.
  4419. Possible values are:
  4420. @table @var
  4421. @item quality
  4422. @item speed
  4423. @item consistency
  4424. @end table
  4425. @item channels
  4426. Set channels.
  4427. Possible values are:
  4428. @table @var
  4429. @item apart
  4430. @item together
  4431. @end table
  4432. @end table
  4433. @subsection Commands
  4434. This filter supports the following commands:
  4435. @table @option
  4436. @item tempo
  4437. Change filter tempo scale factor.
  4438. Syntax for the command is : "@var{tempo}"
  4439. @item pitch
  4440. Change filter pitch scale factor.
  4441. Syntax for the command is : "@var{pitch}"
  4442. @end table
  4443. @section sidechaincompress
  4444. This filter acts like normal compressor but has the ability to compress
  4445. detected signal using second input signal.
  4446. It needs two input streams and returns one output stream.
  4447. First input stream will be processed depending on second stream signal.
  4448. The filtered signal then can be filtered with other filters in later stages of
  4449. processing. See @ref{pan} and @ref{amerge} filter.
  4450. The filter accepts the following options:
  4451. @table @option
  4452. @item level_in
  4453. Set input gain. Default is 1. Range is between 0.015625 and 64.
  4454. @item mode
  4455. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  4456. Default is @code{downward}.
  4457. @item threshold
  4458. If a signal of second stream raises above this level it will affect the gain
  4459. reduction of first stream.
  4460. By default is 0.125. Range is between 0.00097563 and 1.
  4461. @item ratio
  4462. Set a ratio about which the signal is reduced. 1:2 means that if the level
  4463. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  4464. Default is 2. Range is between 1 and 20.
  4465. @item attack
  4466. Amount of milliseconds the signal has to rise above the threshold before gain
  4467. reduction starts. Default is 20. Range is between 0.01 and 2000.
  4468. @item release
  4469. Amount of milliseconds the signal has to fall below the threshold before
  4470. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  4471. @item makeup
  4472. Set the amount by how much signal will be amplified after processing.
  4473. Default is 1. Range is from 1 to 64.
  4474. @item knee
  4475. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4476. Default is 2.82843. Range is between 1 and 8.
  4477. @item link
  4478. Choose if the @code{average} level between all channels of side-chain stream
  4479. or the louder(@code{maximum}) channel of side-chain stream affects the
  4480. reduction. Default is @code{average}.
  4481. @item detection
  4482. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  4483. of @code{rms}. Default is @code{rms} which is mainly smoother.
  4484. @item level_sc
  4485. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  4486. @item mix
  4487. How much to use compressed signal in output. Default is 1.
  4488. Range is between 0 and 1.
  4489. @end table
  4490. @subsection Commands
  4491. This filter supports the all above options as @ref{commands}.
  4492. @subsection Examples
  4493. @itemize
  4494. @item
  4495. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  4496. depending on the signal of 2nd input and later compressed signal to be
  4497. merged with 2nd input:
  4498. @example
  4499. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  4500. @end example
  4501. @end itemize
  4502. @section sidechaingate
  4503. A sidechain gate acts like a normal (wideband) gate but has the ability to
  4504. filter the detected signal before sending it to the gain reduction stage.
  4505. Normally a gate uses the full range signal to detect a level above the
  4506. threshold.
  4507. For example: If you cut all lower frequencies from your sidechain signal
  4508. the gate will decrease the volume of your track only if not enough highs
  4509. appear. With this technique you are able to reduce the resonation of a
  4510. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  4511. guitar.
  4512. It needs two input streams and returns one output stream.
  4513. First input stream will be processed depending on second stream signal.
  4514. The filter accepts the following options:
  4515. @table @option
  4516. @item level_in
  4517. Set input level before filtering.
  4518. Default is 1. Allowed range is from 0.015625 to 64.
  4519. @item mode
  4520. Set the mode of operation. Can be @code{upward} or @code{downward}.
  4521. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  4522. will be amplified, expanding dynamic range in upward direction.
  4523. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  4524. @item range
  4525. Set the level of gain reduction when the signal is below the threshold.
  4526. Default is 0.06125. Allowed range is from 0 to 1.
  4527. Setting this to 0 disables reduction and then filter behaves like expander.
  4528. @item threshold
  4529. If a signal rises above this level the gain reduction is released.
  4530. Default is 0.125. Allowed range is from 0 to 1.
  4531. @item ratio
  4532. Set a ratio about which the signal is reduced.
  4533. Default is 2. Allowed range is from 1 to 9000.
  4534. @item attack
  4535. Amount of milliseconds the signal has to rise above the threshold before gain
  4536. reduction stops.
  4537. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  4538. @item release
  4539. Amount of milliseconds the signal has to fall below the threshold before the
  4540. reduction is increased again. Default is 250 milliseconds.
  4541. Allowed range is from 0.01 to 9000.
  4542. @item makeup
  4543. Set amount of amplification of signal after processing.
  4544. Default is 1. Allowed range is from 1 to 64.
  4545. @item knee
  4546. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4547. Default is 2.828427125. Allowed range is from 1 to 8.
  4548. @item detection
  4549. Choose if exact signal should be taken for detection or an RMS like one.
  4550. Default is rms. Can be peak or rms.
  4551. @item link
  4552. Choose if the average level between all channels or the louder channel affects
  4553. the reduction.
  4554. Default is average. Can be average or maximum.
  4555. @item level_sc
  4556. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  4557. @end table
  4558. @subsection Commands
  4559. This filter supports the all above options as @ref{commands}.
  4560. @section silencedetect
  4561. Detect silence in an audio stream.
  4562. This filter logs a message when it detects that the input audio volume is less
  4563. or equal to a noise tolerance value for a duration greater or equal to the
  4564. minimum detected noise duration.
  4565. The printed times and duration are expressed in seconds. The
  4566. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  4567. is set on the first frame whose timestamp equals or exceeds the detection
  4568. duration and it contains the timestamp of the first frame of the silence.
  4569. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  4570. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  4571. keys are set on the first frame after the silence. If @option{mono} is
  4572. enabled, and each channel is evaluated separately, the @code{.X}
  4573. suffixed keys are used, and @code{X} corresponds to the channel number.
  4574. The filter accepts the following options:
  4575. @table @option
  4576. @item noise, n
  4577. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  4578. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  4579. @item duration, d
  4580. Set silence duration until notification (default is 2 seconds). See
  4581. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4582. for the accepted syntax.
  4583. @item mono, m
  4584. Process each channel separately, instead of combined. By default is disabled.
  4585. @end table
  4586. @subsection Examples
  4587. @itemize
  4588. @item
  4589. Detect 5 seconds of silence with -50dB noise tolerance:
  4590. @example
  4591. silencedetect=n=-50dB:d=5
  4592. @end example
  4593. @item
  4594. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  4595. tolerance in @file{silence.mp3}:
  4596. @example
  4597. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  4598. @end example
  4599. @end itemize
  4600. @section silenceremove
  4601. Remove silence from the beginning, middle or end of the audio.
  4602. The filter accepts the following options:
  4603. @table @option
  4604. @item start_periods
  4605. This value is used to indicate if audio should be trimmed at beginning of
  4606. the audio. A value of zero indicates no silence should be trimmed from the
  4607. beginning. When specifying a non-zero value, it trims audio up until it
  4608. finds non-silence. Normally, when trimming silence from beginning of audio
  4609. the @var{start_periods} will be @code{1} but it can be increased to higher
  4610. values to trim all audio up to specific count of non-silence periods.
  4611. Default value is @code{0}.
  4612. @item start_duration
  4613. Specify the amount of time that non-silence must be detected before it stops
  4614. trimming audio. By increasing the duration, bursts of noises can be treated
  4615. as silence and trimmed off. Default value is @code{0}.
  4616. @item start_threshold
  4617. This indicates what sample value should be treated as silence. For digital
  4618. audio, a value of @code{0} may be fine but for audio recorded from analog,
  4619. you may wish to increase the value to account for background noise.
  4620. Can be specified in dB (in case "dB" is appended to the specified value)
  4621. or amplitude ratio. Default value is @code{0}.
  4622. @item start_silence
  4623. Specify max duration of silence at beginning that will be kept after
  4624. trimming. Default is 0, which is equal to trimming all samples detected
  4625. as silence.
  4626. @item start_mode
  4627. Specify mode of detection of silence end in start of multi-channel audio.
  4628. Can be @var{any} or @var{all}. Default is @var{any}.
  4629. With @var{any}, any sample that is detected as non-silence will cause
  4630. stopped trimming of silence.
  4631. With @var{all}, only if all channels are detected as non-silence will cause
  4632. stopped trimming of silence.
  4633. @item stop_periods
  4634. Set the count for trimming silence from the end of audio.
  4635. To remove silence from the middle of a file, specify a @var{stop_periods}
  4636. that is negative. This value is then treated as a positive value and is
  4637. used to indicate the effect should restart processing as specified by
  4638. @var{start_periods}, making it suitable for removing periods of silence
  4639. in the middle of the audio.
  4640. Default value is @code{0}.
  4641. @item stop_duration
  4642. Specify a duration of silence that must exist before audio is not copied any
  4643. more. By specifying a higher duration, silence that is wanted can be left in
  4644. the audio.
  4645. Default value is @code{0}.
  4646. @item stop_threshold
  4647. This is the same as @option{start_threshold} but for trimming silence from
  4648. the end of audio.
  4649. Can be specified in dB (in case "dB" is appended to the specified value)
  4650. or amplitude ratio. Default value is @code{0}.
  4651. @item stop_silence
  4652. Specify max duration of silence at end that will be kept after
  4653. trimming. Default is 0, which is equal to trimming all samples detected
  4654. as silence.
  4655. @item stop_mode
  4656. Specify mode of detection of silence start in end of multi-channel audio.
  4657. Can be @var{any} or @var{all}. Default is @var{any}.
  4658. With @var{any}, any sample that is detected as non-silence will cause
  4659. stopped trimming of silence.
  4660. With @var{all}, only if all channels are detected as non-silence will cause
  4661. stopped trimming of silence.
  4662. @item detection
  4663. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  4664. and works better with digital silence which is exactly 0.
  4665. Default value is @code{rms}.
  4666. @item window
  4667. Set duration in number of seconds used to calculate size of window in number
  4668. of samples for detecting silence.
  4669. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  4670. @end table
  4671. @subsection Examples
  4672. @itemize
  4673. @item
  4674. The following example shows how this filter can be used to start a recording
  4675. that does not contain the delay at the start which usually occurs between
  4676. pressing the record button and the start of the performance:
  4677. @example
  4678. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  4679. @end example
  4680. @item
  4681. Trim all silence encountered from beginning to end where there is more than 1
  4682. second of silence in audio:
  4683. @example
  4684. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  4685. @end example
  4686. @item
  4687. Trim all digital silence samples, using peak detection, from beginning to end
  4688. where there is more than 0 samples of digital silence in audio and digital
  4689. silence is detected in all channels at same positions in stream:
  4690. @example
  4691. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  4692. @end example
  4693. @end itemize
  4694. @section sofalizer
  4695. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  4696. loudspeakers around the user for binaural listening via headphones (audio
  4697. formats up to 9 channels supported).
  4698. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  4699. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  4700. Austrian Academy of Sciences.
  4701. To enable compilation of this filter you need to configure FFmpeg with
  4702. @code{--enable-libmysofa}.
  4703. The filter accepts the following options:
  4704. @table @option
  4705. @item sofa
  4706. Set the SOFA file used for rendering.
  4707. @item gain
  4708. Set gain applied to audio. Value is in dB. Default is 0.
  4709. @item rotation
  4710. Set rotation of virtual loudspeakers in deg. Default is 0.
  4711. @item elevation
  4712. Set elevation of virtual speakers in deg. Default is 0.
  4713. @item radius
  4714. Set distance in meters between loudspeakers and the listener with near-field
  4715. HRTFs. Default is 1.
  4716. @item type
  4717. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  4718. processing audio in time domain which is slow.
  4719. @var{freq} is processing audio in frequency domain which is fast.
  4720. Default is @var{freq}.
  4721. @item speakers
  4722. Set custom positions of virtual loudspeakers. Syntax for this option is:
  4723. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  4724. Each virtual loudspeaker is described with short channel name following with
  4725. azimuth and elevation in degrees.
  4726. Each virtual loudspeaker description is separated by '|'.
  4727. For example to override front left and front right channel positions use:
  4728. 'speakers=FL 45 15|FR 345 15'.
  4729. Descriptions with unrecognised channel names are ignored.
  4730. @item lfegain
  4731. Set custom gain for LFE channels. Value is in dB. Default is 0.
  4732. @item framesize
  4733. Set custom frame size in number of samples. Default is 1024.
  4734. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  4735. is set to @var{freq}.
  4736. @item normalize
  4737. Should all IRs be normalized upon importing SOFA file.
  4738. By default is enabled.
  4739. @item interpolate
  4740. Should nearest IRs be interpolated with neighbor IRs if exact position
  4741. does not match. By default is disabled.
  4742. @item minphase
  4743. Minphase all IRs upon loading of SOFA file. By default is disabled.
  4744. @item anglestep
  4745. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  4746. @item radstep
  4747. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  4748. @end table
  4749. @subsection Examples
  4750. @itemize
  4751. @item
  4752. Using ClubFritz6 sofa file:
  4753. @example
  4754. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  4755. @end example
  4756. @item
  4757. Using ClubFritz12 sofa file and bigger radius with small rotation:
  4758. @example
  4759. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  4760. @end example
  4761. @item
  4762. Similar as above but with custom speaker positions for front left, front right, back left and back right
  4763. and also with custom gain:
  4764. @example
  4765. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  4766. @end example
  4767. @end itemize
  4768. @section speechnorm
  4769. Speech Normalizer.
  4770. This filter expands or compresses each half-cycle of audio samples
  4771. (local set of samples all above or all below zero and between two nearest zero crossings) depending
  4772. on threshold value, so audio reaches target peak value under conditions controlled by below options.
  4773. The filter accepts the following options:
  4774. @table @option
  4775. @item peak, p
  4776. Set the expansion target peak value. This specifies the highest allowed absolute amplitude
  4777. level for the normalized audio input. Default value is 0.95. Allowed range is from 0.0 to 1.0.
  4778. @item expansion, e
  4779. Set the maximum expansion factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  4780. This option controls maximum local half-cycle of samples expansion. The maximum expansion
  4781. would be such that local peak value reaches target peak value but never to surpass it and that
  4782. ratio between new and previous peak value does not surpass this option value.
  4783. @item compression, c
  4784. Set the maximum compression factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  4785. This option controls maximum local half-cycle of samples compression. This option is used
  4786. only if @option{threshold} option is set to value greater than 0.0, then in such cases
  4787. when local peak is lower or same as value set by @option{threshold} all samples belonging to
  4788. that peak's half-cycle will be compressed by current compression factor.
  4789. @item threshold, t
  4790. Set the threshold value. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  4791. This option specifies which half-cycles of samples will be compressed and which will be expanded.
  4792. Any half-cycle samples with their local peak value below or same as this option value will be
  4793. compressed by current compression factor, otherwise, if greater than threshold value they will be
  4794. expanded with expansion factor so that it could reach peak target value but never surpass it.
  4795. @item raise, r
  4796. Set the expansion raising amount per each half-cycle of samples. Default value is 0.001.
  4797. Allowed range is from 0.0 to 1.0. This controls how fast expansion factor is raised per
  4798. each new half-cycle until it reaches @option{expansion} value.
  4799. Setting this options too high may lead to distortions.
  4800. @item fall, f
  4801. Set the compression raising amount per each half-cycle of samples. Default value is 0.001.
  4802. Allowed range is from 0.0 to 1.0. This controls how fast compression factor is raised per
  4803. each new half-cycle until it reaches @option{compression} value.
  4804. @item channels, h
  4805. Specify which channels to filter, by default all available channels are filtered.
  4806. @item invert, i
  4807. Enable inverted filtering, by default is disabled. This inverts interpretation of @option{threshold}
  4808. option. When enabled any half-cycle of samples with their local peak value below or same as
  4809. @option{threshold} option will be expanded otherwise it will be compressed.
  4810. @item link, l
  4811. Link channels when calculating gain applied to each filtered channel sample, by default is disabled.
  4812. When disabled each filtered channel gain calculation is independent, otherwise when this option
  4813. is enabled the minimum of all possible gains for each filtered channel is used.
  4814. @end table
  4815. @subsection Commands
  4816. This filter supports the all above options as @ref{commands}.
  4817. @section stereotools
  4818. This filter has some handy utilities to manage stereo signals, for converting
  4819. M/S stereo recordings to L/R signal while having control over the parameters
  4820. or spreading the stereo image of master track.
  4821. The filter accepts the following options:
  4822. @table @option
  4823. @item level_in
  4824. Set input level before filtering for both channels. Defaults is 1.
  4825. Allowed range is from 0.015625 to 64.
  4826. @item level_out
  4827. Set output level after filtering for both channels. Defaults is 1.
  4828. Allowed range is from 0.015625 to 64.
  4829. @item balance_in
  4830. Set input balance between both channels. Default is 0.
  4831. Allowed range is from -1 to 1.
  4832. @item balance_out
  4833. Set output balance between both channels. Default is 0.
  4834. Allowed range is from -1 to 1.
  4835. @item softclip
  4836. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  4837. clipping. Disabled by default.
  4838. @item mutel
  4839. Mute the left channel. Disabled by default.
  4840. @item muter
  4841. Mute the right channel. Disabled by default.
  4842. @item phasel
  4843. Change the phase of the left channel. Disabled by default.
  4844. @item phaser
  4845. Change the phase of the right channel. Disabled by default.
  4846. @item mode
  4847. Set stereo mode. Available values are:
  4848. @table @samp
  4849. @item lr>lr
  4850. Left/Right to Left/Right, this is default.
  4851. @item lr>ms
  4852. Left/Right to Mid/Side.
  4853. @item ms>lr
  4854. Mid/Side to Left/Right.
  4855. @item lr>ll
  4856. Left/Right to Left/Left.
  4857. @item lr>rr
  4858. Left/Right to Right/Right.
  4859. @item lr>l+r
  4860. Left/Right to Left + Right.
  4861. @item lr>rl
  4862. Left/Right to Right/Left.
  4863. @item ms>ll
  4864. Mid/Side to Left/Left.
  4865. @item ms>rr
  4866. Mid/Side to Right/Right.
  4867. @item ms>rl
  4868. Mid/Side to Right/Left.
  4869. @item lr>l-r
  4870. Left/Right to Left - Right.
  4871. @end table
  4872. @item slev
  4873. Set level of side signal. Default is 1.
  4874. Allowed range is from 0.015625 to 64.
  4875. @item sbal
  4876. Set balance of side signal. Default is 0.
  4877. Allowed range is from -1 to 1.
  4878. @item mlev
  4879. Set level of the middle signal. Default is 1.
  4880. Allowed range is from 0.015625 to 64.
  4881. @item mpan
  4882. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  4883. @item base
  4884. Set stereo base between mono and inversed channels. Default is 0.
  4885. Allowed range is from -1 to 1.
  4886. @item delay
  4887. Set delay in milliseconds how much to delay left from right channel and
  4888. vice versa. Default is 0. Allowed range is from -20 to 20.
  4889. @item sclevel
  4890. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  4891. @item phase
  4892. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  4893. @item bmode_in, bmode_out
  4894. Set balance mode for balance_in/balance_out option.
  4895. Can be one of the following:
  4896. @table @samp
  4897. @item balance
  4898. Classic balance mode. Attenuate one channel at time.
  4899. Gain is raised up to 1.
  4900. @item amplitude
  4901. Similar as classic mode above but gain is raised up to 2.
  4902. @item power
  4903. Equal power distribution, from -6dB to +6dB range.
  4904. @end table
  4905. @end table
  4906. @subsection Commands
  4907. This filter supports the all above options as @ref{commands}.
  4908. @subsection Examples
  4909. @itemize
  4910. @item
  4911. Apply karaoke like effect:
  4912. @example
  4913. stereotools=mlev=0.015625
  4914. @end example
  4915. @item
  4916. Convert M/S signal to L/R:
  4917. @example
  4918. "stereotools=mode=ms>lr"
  4919. @end example
  4920. @end itemize
  4921. @section stereowiden
  4922. This filter enhance the stereo effect by suppressing signal common to both
  4923. channels and by delaying the signal of left into right and vice versa,
  4924. thereby widening the stereo effect.
  4925. The filter accepts the following options:
  4926. @table @option
  4927. @item delay
  4928. Time in milliseconds of the delay of left signal into right and vice versa.
  4929. Default is 20 milliseconds.
  4930. @item feedback
  4931. Amount of gain in delayed signal into right and vice versa. Gives a delay
  4932. effect of left signal in right output and vice versa which gives widening
  4933. effect. Default is 0.3.
  4934. @item crossfeed
  4935. Cross feed of left into right with inverted phase. This helps in suppressing
  4936. the mono. If the value is 1 it will cancel all the signal common to both
  4937. channels. Default is 0.3.
  4938. @item drymix
  4939. Set level of input signal of original channel. Default is 0.8.
  4940. @end table
  4941. @subsection Commands
  4942. This filter supports the all above options except @code{delay} as @ref{commands}.
  4943. @section superequalizer
  4944. Apply 18 band equalizer.
  4945. The filter accepts the following options:
  4946. @table @option
  4947. @item 1b
  4948. Set 65Hz band gain.
  4949. @item 2b
  4950. Set 92Hz band gain.
  4951. @item 3b
  4952. Set 131Hz band gain.
  4953. @item 4b
  4954. Set 185Hz band gain.
  4955. @item 5b
  4956. Set 262Hz band gain.
  4957. @item 6b
  4958. Set 370Hz band gain.
  4959. @item 7b
  4960. Set 523Hz band gain.
  4961. @item 8b
  4962. Set 740Hz band gain.
  4963. @item 9b
  4964. Set 1047Hz band gain.
  4965. @item 10b
  4966. Set 1480Hz band gain.
  4967. @item 11b
  4968. Set 2093Hz band gain.
  4969. @item 12b
  4970. Set 2960Hz band gain.
  4971. @item 13b
  4972. Set 4186Hz band gain.
  4973. @item 14b
  4974. Set 5920Hz band gain.
  4975. @item 15b
  4976. Set 8372Hz band gain.
  4977. @item 16b
  4978. Set 11840Hz band gain.
  4979. @item 17b
  4980. Set 16744Hz band gain.
  4981. @item 18b
  4982. Set 20000Hz band gain.
  4983. @end table
  4984. @section surround
  4985. Apply audio surround upmix filter.
  4986. This filter allows to produce multichannel output from audio stream.
  4987. The filter accepts the following options:
  4988. @table @option
  4989. @item chl_out
  4990. Set output channel layout. By default, this is @var{5.1}.
  4991. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4992. for the required syntax.
  4993. @item chl_in
  4994. Set input channel layout. By default, this is @var{stereo}.
  4995. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4996. for the required syntax.
  4997. @item level_in
  4998. Set input volume level. By default, this is @var{1}.
  4999. @item level_out
  5000. Set output volume level. By default, this is @var{1}.
  5001. @item lfe
  5002. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  5003. @item lfe_low
  5004. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  5005. @item lfe_high
  5006. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  5007. @item lfe_mode
  5008. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  5009. In @var{add} mode, LFE channel is created from input audio and added to output.
  5010. In @var{sub} mode, LFE channel is created from input audio and added to output but
  5011. also all non-LFE output channels are subtracted with output LFE channel.
  5012. @item angle
  5013. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  5014. Default is @var{90}.
  5015. @item fc_in
  5016. Set front center input volume. By default, this is @var{1}.
  5017. @item fc_out
  5018. Set front center output volume. By default, this is @var{1}.
  5019. @item fl_in
  5020. Set front left input volume. By default, this is @var{1}.
  5021. @item fl_out
  5022. Set front left output volume. By default, this is @var{1}.
  5023. @item fr_in
  5024. Set front right input volume. By default, this is @var{1}.
  5025. @item fr_out
  5026. Set front right output volume. By default, this is @var{1}.
  5027. @item sl_in
  5028. Set side left input volume. By default, this is @var{1}.
  5029. @item sl_out
  5030. Set side left output volume. By default, this is @var{1}.
  5031. @item sr_in
  5032. Set side right input volume. By default, this is @var{1}.
  5033. @item sr_out
  5034. Set side right output volume. By default, this is @var{1}.
  5035. @item bl_in
  5036. Set back left input volume. By default, this is @var{1}.
  5037. @item bl_out
  5038. Set back left output volume. By default, this is @var{1}.
  5039. @item br_in
  5040. Set back right input volume. By default, this is @var{1}.
  5041. @item br_out
  5042. Set back right output volume. By default, this is @var{1}.
  5043. @item bc_in
  5044. Set back center input volume. By default, this is @var{1}.
  5045. @item bc_out
  5046. Set back center output volume. By default, this is @var{1}.
  5047. @item lfe_in
  5048. Set LFE input volume. By default, this is @var{1}.
  5049. @item lfe_out
  5050. Set LFE output volume. By default, this is @var{1}.
  5051. @item allx
  5052. Set spread usage of stereo image across X axis for all channels.
  5053. Allowed range is from @var{-1} to @var{15}.
  5054. By default this value is negative @var{-1}, and thus unused.
  5055. @item ally
  5056. Set spread usage of stereo image across Y axis for all channels.
  5057. Allowed range is from @var{-1} to @var{15}.
  5058. By default this value is negative @var{-1}, and thus unused.
  5059. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  5060. Set spread usage of stereo image across X axis for each channel.
  5061. Allowed range is from @var{0.06} to @var{15}.
  5062. By default this value is @var{0.5}.
  5063. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  5064. Set spread usage of stereo image across Y axis for each channel.
  5065. Allowed range is from @var{0.06} to @var{15}.
  5066. By default this value is @var{0.5}.
  5067. @item win_size
  5068. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  5069. @item win_func
  5070. Set window function.
  5071. It accepts the following values:
  5072. @table @samp
  5073. @item rect
  5074. @item bartlett
  5075. @item hann, hanning
  5076. @item hamming
  5077. @item blackman
  5078. @item welch
  5079. @item flattop
  5080. @item bharris
  5081. @item bnuttall
  5082. @item bhann
  5083. @item sine
  5084. @item nuttall
  5085. @item lanczos
  5086. @item gauss
  5087. @item tukey
  5088. @item dolph
  5089. @item cauchy
  5090. @item parzen
  5091. @item poisson
  5092. @item bohman
  5093. @end table
  5094. Default is @code{hann}.
  5095. @item overlap
  5096. Set window overlap. If set to 1, the recommended overlap for selected
  5097. window function will be picked. Default is @code{0.5}.
  5098. @end table
  5099. @section treble, highshelf
  5100. Boost or cut treble (upper) frequencies of the audio using a two-pole
  5101. shelving filter with a response similar to that of a standard
  5102. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  5103. The filter accepts the following options:
  5104. @table @option
  5105. @item gain, g
  5106. Give the gain at whichever is the lower of ~22 kHz and the
  5107. Nyquist frequency. Its useful range is about -20 (for a large cut)
  5108. to +20 (for a large boost). Beware of clipping when using a positive gain.
  5109. @item frequency, f
  5110. Set the filter's central frequency and so can be used
  5111. to extend or reduce the frequency range to be boosted or cut.
  5112. The default value is @code{3000} Hz.
  5113. @item width_type, t
  5114. Set method to specify band-width of filter.
  5115. @table @option
  5116. @item h
  5117. Hz
  5118. @item q
  5119. Q-Factor
  5120. @item o
  5121. octave
  5122. @item s
  5123. slope
  5124. @item k
  5125. kHz
  5126. @end table
  5127. @item width, w
  5128. Determine how steep is the filter's shelf transition.
  5129. @item poles, p
  5130. Set number of poles. Default is 2.
  5131. @item mix, m
  5132. How much to use filtered signal in output. Default is 1.
  5133. Range is between 0 and 1.
  5134. @item channels, c
  5135. Specify which channels to filter, by default all available are filtered.
  5136. @item normalize, n
  5137. Normalize biquad coefficients, by default is disabled.
  5138. Enabling it will normalize magnitude response at DC to 0dB.
  5139. @item transform, a
  5140. Set transform type of IIR filter.
  5141. @table @option
  5142. @item di
  5143. @item dii
  5144. @item tdii
  5145. @item latt
  5146. @item svf
  5147. @end table
  5148. @item precision, r
  5149. Set precison of filtering.
  5150. @table @option
  5151. @item auto
  5152. Pick automatic sample format depending on surround filters.
  5153. @item s16
  5154. Always use signed 16-bit.
  5155. @item s32
  5156. Always use signed 32-bit.
  5157. @item f32
  5158. Always use float 32-bit.
  5159. @item f64
  5160. Always use float 64-bit.
  5161. @end table
  5162. @end table
  5163. @subsection Commands
  5164. This filter supports the following commands:
  5165. @table @option
  5166. @item frequency, f
  5167. Change treble frequency.
  5168. Syntax for the command is : "@var{frequency}"
  5169. @item width_type, t
  5170. Change treble width_type.
  5171. Syntax for the command is : "@var{width_type}"
  5172. @item width, w
  5173. Change treble width.
  5174. Syntax for the command is : "@var{width}"
  5175. @item gain, g
  5176. Change treble gain.
  5177. Syntax for the command is : "@var{gain}"
  5178. @item mix, m
  5179. Change treble mix.
  5180. Syntax for the command is : "@var{mix}"
  5181. @end table
  5182. @section tremolo
  5183. Sinusoidal amplitude modulation.
  5184. The filter accepts the following options:
  5185. @table @option
  5186. @item f
  5187. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  5188. (20 Hz or lower) will result in a tremolo effect.
  5189. This filter may also be used as a ring modulator by specifying
  5190. a modulation frequency higher than 20 Hz.
  5191. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  5192. @item d
  5193. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  5194. Default value is 0.5.
  5195. @end table
  5196. @section vibrato
  5197. Sinusoidal phase modulation.
  5198. The filter accepts the following options:
  5199. @table @option
  5200. @item f
  5201. Modulation frequency in Hertz.
  5202. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  5203. @item d
  5204. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  5205. Default value is 0.5.
  5206. @end table
  5207. @section volume
  5208. Adjust the input audio volume.
  5209. It accepts the following parameters:
  5210. @table @option
  5211. @item volume
  5212. Set audio volume expression.
  5213. Output values are clipped to the maximum value.
  5214. The output audio volume is given by the relation:
  5215. @example
  5216. @var{output_volume} = @var{volume} * @var{input_volume}
  5217. @end example
  5218. The default value for @var{volume} is "1.0".
  5219. @item precision
  5220. This parameter represents the mathematical precision.
  5221. It determines which input sample formats will be allowed, which affects the
  5222. precision of the volume scaling.
  5223. @table @option
  5224. @item fixed
  5225. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  5226. @item float
  5227. 32-bit floating-point; this limits input sample format to FLT. (default)
  5228. @item double
  5229. 64-bit floating-point; this limits input sample format to DBL.
  5230. @end table
  5231. @item replaygain
  5232. Choose the behaviour on encountering ReplayGain side data in input frames.
  5233. @table @option
  5234. @item drop
  5235. Remove ReplayGain side data, ignoring its contents (the default).
  5236. @item ignore
  5237. Ignore ReplayGain side data, but leave it in the frame.
  5238. @item track
  5239. Prefer the track gain, if present.
  5240. @item album
  5241. Prefer the album gain, if present.
  5242. @end table
  5243. @item replaygain_preamp
  5244. Pre-amplification gain in dB to apply to the selected replaygain gain.
  5245. Default value for @var{replaygain_preamp} is 0.0.
  5246. @item replaygain_noclip
  5247. Prevent clipping by limiting the gain applied.
  5248. Default value for @var{replaygain_noclip} is 1.
  5249. @item eval
  5250. Set when the volume expression is evaluated.
  5251. It accepts the following values:
  5252. @table @samp
  5253. @item once
  5254. only evaluate expression once during the filter initialization, or
  5255. when the @samp{volume} command is sent
  5256. @item frame
  5257. evaluate expression for each incoming frame
  5258. @end table
  5259. Default value is @samp{once}.
  5260. @end table
  5261. The volume expression can contain the following parameters.
  5262. @table @option
  5263. @item n
  5264. frame number (starting at zero)
  5265. @item nb_channels
  5266. number of channels
  5267. @item nb_consumed_samples
  5268. number of samples consumed by the filter
  5269. @item nb_samples
  5270. number of samples in the current frame
  5271. @item pos
  5272. original frame position in the file
  5273. @item pts
  5274. frame PTS
  5275. @item sample_rate
  5276. sample rate
  5277. @item startpts
  5278. PTS at start of stream
  5279. @item startt
  5280. time at start of stream
  5281. @item t
  5282. frame time
  5283. @item tb
  5284. timestamp timebase
  5285. @item volume
  5286. last set volume value
  5287. @end table
  5288. Note that when @option{eval} is set to @samp{once} only the
  5289. @var{sample_rate} and @var{tb} variables are available, all other
  5290. variables will evaluate to NAN.
  5291. @subsection Commands
  5292. This filter supports the following commands:
  5293. @table @option
  5294. @item volume
  5295. Modify the volume expression.
  5296. The command accepts the same syntax of the corresponding option.
  5297. If the specified expression is not valid, it is kept at its current
  5298. value.
  5299. @end table
  5300. @subsection Examples
  5301. @itemize
  5302. @item
  5303. Halve the input audio volume:
  5304. @example
  5305. volume=volume=0.5
  5306. volume=volume=1/2
  5307. volume=volume=-6.0206dB
  5308. @end example
  5309. In all the above example the named key for @option{volume} can be
  5310. omitted, for example like in:
  5311. @example
  5312. volume=0.5
  5313. @end example
  5314. @item
  5315. Increase input audio power by 6 decibels using fixed-point precision:
  5316. @example
  5317. volume=volume=6dB:precision=fixed
  5318. @end example
  5319. @item
  5320. Fade volume after time 10 with an annihilation period of 5 seconds:
  5321. @example
  5322. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  5323. @end example
  5324. @end itemize
  5325. @section volumedetect
  5326. Detect the volume of the input video.
  5327. The filter has no parameters. It supports only 16-bit signed integer samples,
  5328. so the input will be converted when needed. Statistics about the volume will
  5329. be printed in the log when the input stream end is reached.
  5330. In particular it will show the mean volume (root mean square), maximum
  5331. volume (on a per-sample basis), and the beginning of a histogram of the
  5332. registered volume values (from the maximum value to a cumulated 1/1000 of
  5333. the samples).
  5334. All volumes are in decibels relative to the maximum PCM value.
  5335. @subsection Examples
  5336. Here is an excerpt of the output:
  5337. @example
  5338. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  5339. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  5340. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  5341. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  5342. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  5343. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  5344. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  5345. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  5346. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  5347. @end example
  5348. It means that:
  5349. @itemize
  5350. @item
  5351. The mean square energy is approximately -27 dB, or 10^-2.7.
  5352. @item
  5353. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  5354. @item
  5355. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  5356. @end itemize
  5357. In other words, raising the volume by +4 dB does not cause any clipping,
  5358. raising it by +5 dB causes clipping for 6 samples, etc.
  5359. @c man end AUDIO FILTERS
  5360. @chapter Audio Sources
  5361. @c man begin AUDIO SOURCES
  5362. Below is a description of the currently available audio sources.
  5363. @section abuffer
  5364. Buffer audio frames, and make them available to the filter chain.
  5365. This source is mainly intended for a programmatic use, in particular
  5366. through the interface defined in @file{libavfilter/buffersrc.h}.
  5367. It accepts the following parameters:
  5368. @table @option
  5369. @item time_base
  5370. The timebase which will be used for timestamps of submitted frames. It must be
  5371. either a floating-point number or in @var{numerator}/@var{denominator} form.
  5372. @item sample_rate
  5373. The sample rate of the incoming audio buffers.
  5374. @item sample_fmt
  5375. The sample format of the incoming audio buffers.
  5376. Either a sample format name or its corresponding integer representation from
  5377. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  5378. @item channel_layout
  5379. The channel layout of the incoming audio buffers.
  5380. Either a channel layout name from channel_layout_map in
  5381. @file{libavutil/channel_layout.c} or its corresponding integer representation
  5382. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  5383. @item channels
  5384. The number of channels of the incoming audio buffers.
  5385. If both @var{channels} and @var{channel_layout} are specified, then they
  5386. must be consistent.
  5387. @end table
  5388. @subsection Examples
  5389. @example
  5390. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  5391. @end example
  5392. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  5393. Since the sample format with name "s16p" corresponds to the number
  5394. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  5395. equivalent to:
  5396. @example
  5397. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  5398. @end example
  5399. @section aevalsrc
  5400. Generate an audio signal specified by an expression.
  5401. This source accepts in input one or more expressions (one for each
  5402. channel), which are evaluated and used to generate a corresponding
  5403. audio signal.
  5404. This source accepts the following options:
  5405. @table @option
  5406. @item exprs
  5407. Set the '|'-separated expressions list for each separate channel. In case the
  5408. @option{channel_layout} option is not specified, the selected channel layout
  5409. depends on the number of provided expressions. Otherwise the last
  5410. specified expression is applied to the remaining output channels.
  5411. @item channel_layout, c
  5412. Set the channel layout. The number of channels in the specified layout
  5413. must be equal to the number of specified expressions.
  5414. @item duration, d
  5415. Set the minimum duration of the sourced audio. See
  5416. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5417. for the accepted syntax.
  5418. Note that the resulting duration may be greater than the specified
  5419. duration, as the generated audio is always cut at the end of a
  5420. complete frame.
  5421. If not specified, or the expressed duration is negative, the audio is
  5422. supposed to be generated forever.
  5423. @item nb_samples, n
  5424. Set the number of samples per channel per each output frame,
  5425. default to 1024.
  5426. @item sample_rate, s
  5427. Specify the sample rate, default to 44100.
  5428. @end table
  5429. Each expression in @var{exprs} can contain the following constants:
  5430. @table @option
  5431. @item n
  5432. number of the evaluated sample, starting from 0
  5433. @item t
  5434. time of the evaluated sample expressed in seconds, starting from 0
  5435. @item s
  5436. sample rate
  5437. @end table
  5438. @subsection Examples
  5439. @itemize
  5440. @item
  5441. Generate silence:
  5442. @example
  5443. aevalsrc=0
  5444. @end example
  5445. @item
  5446. Generate a sin signal with frequency of 440 Hz, set sample rate to
  5447. 8000 Hz:
  5448. @example
  5449. aevalsrc="sin(440*2*PI*t):s=8000"
  5450. @end example
  5451. @item
  5452. Generate a two channels signal, specify the channel layout (Front
  5453. Center + Back Center) explicitly:
  5454. @example
  5455. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  5456. @end example
  5457. @item
  5458. Generate white noise:
  5459. @example
  5460. aevalsrc="-2+random(0)"
  5461. @end example
  5462. @item
  5463. Generate an amplitude modulated signal:
  5464. @example
  5465. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  5466. @end example
  5467. @item
  5468. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  5469. @example
  5470. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  5471. @end example
  5472. @end itemize
  5473. @section afirsrc
  5474. Generate a FIR coefficients using frequency sampling method.
  5475. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  5476. The filter accepts the following options:
  5477. @table @option
  5478. @item taps, t
  5479. Set number of filter coefficents in output audio stream.
  5480. Default value is 1025.
  5481. @item frequency, f
  5482. Set frequency points from where magnitude and phase are set.
  5483. This must be in non decreasing order, and first element must be 0, while last element
  5484. must be 1. Elements are separated by white spaces.
  5485. @item magnitude, m
  5486. Set magnitude value for every frequency point set by @option{frequency}.
  5487. Number of values must be same as number of frequency points.
  5488. Values are separated by white spaces.
  5489. @item phase, p
  5490. Set phase value for every frequency point set by @option{frequency}.
  5491. Number of values must be same as number of frequency points.
  5492. Values are separated by white spaces.
  5493. @item sample_rate, r
  5494. Set sample rate, default is 44100.
  5495. @item nb_samples, n
  5496. Set number of samples per each frame. Default is 1024.
  5497. @item win_func, w
  5498. Set window function. Default is blackman.
  5499. @end table
  5500. @section anullsrc
  5501. The null audio source, return unprocessed audio frames. It is mainly useful
  5502. as a template and to be employed in analysis / debugging tools, or as
  5503. the source for filters which ignore the input data (for example the sox
  5504. synth filter).
  5505. This source accepts the following options:
  5506. @table @option
  5507. @item channel_layout, cl
  5508. Specifies the channel layout, and can be either an integer or a string
  5509. representing a channel layout. The default value of @var{channel_layout}
  5510. is "stereo".
  5511. Check the channel_layout_map definition in
  5512. @file{libavutil/channel_layout.c} for the mapping between strings and
  5513. channel layout values.
  5514. @item sample_rate, r
  5515. Specifies the sample rate, and defaults to 44100.
  5516. @item nb_samples, n
  5517. Set the number of samples per requested frames.
  5518. @item duration, d
  5519. Set the duration of the sourced audio. See
  5520. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5521. for the accepted syntax.
  5522. If not specified, or the expressed duration is negative, the audio is
  5523. supposed to be generated forever.
  5524. @end table
  5525. @subsection Examples
  5526. @itemize
  5527. @item
  5528. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  5529. @example
  5530. anullsrc=r=48000:cl=4
  5531. @end example
  5532. @item
  5533. Do the same operation with a more obvious syntax:
  5534. @example
  5535. anullsrc=r=48000:cl=mono
  5536. @end example
  5537. @end itemize
  5538. All the parameters need to be explicitly defined.
  5539. @section flite
  5540. Synthesize a voice utterance using the libflite library.
  5541. To enable compilation of this filter you need to configure FFmpeg with
  5542. @code{--enable-libflite}.
  5543. Note that versions of the flite library prior to 2.0 are not thread-safe.
  5544. The filter accepts the following options:
  5545. @table @option
  5546. @item list_voices
  5547. If set to 1, list the names of the available voices and exit
  5548. immediately. Default value is 0.
  5549. @item nb_samples, n
  5550. Set the maximum number of samples per frame. Default value is 512.
  5551. @item textfile
  5552. Set the filename containing the text to speak.
  5553. @item text
  5554. Set the text to speak.
  5555. @item voice, v
  5556. Set the voice to use for the speech synthesis. Default value is
  5557. @code{kal}. See also the @var{list_voices} option.
  5558. @end table
  5559. @subsection Examples
  5560. @itemize
  5561. @item
  5562. Read from file @file{speech.txt}, and synthesize the text using the
  5563. standard flite voice:
  5564. @example
  5565. flite=textfile=speech.txt
  5566. @end example
  5567. @item
  5568. Read the specified text selecting the @code{slt} voice:
  5569. @example
  5570. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  5571. @end example
  5572. @item
  5573. Input text to ffmpeg:
  5574. @example
  5575. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  5576. @end example
  5577. @item
  5578. Make @file{ffplay} speak the specified text, using @code{flite} and
  5579. the @code{lavfi} device:
  5580. @example
  5581. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  5582. @end example
  5583. @end itemize
  5584. For more information about libflite, check:
  5585. @url{http://www.festvox.org/flite/}
  5586. @section anoisesrc
  5587. Generate a noise audio signal.
  5588. The filter accepts the following options:
  5589. @table @option
  5590. @item sample_rate, r
  5591. Specify the sample rate. Default value is 48000 Hz.
  5592. @item amplitude, a
  5593. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  5594. is 1.0.
  5595. @item duration, d
  5596. Specify the duration of the generated audio stream. Not specifying this option
  5597. results in noise with an infinite length.
  5598. @item color, colour, c
  5599. Specify the color of noise. Available noise colors are white, pink, brown,
  5600. blue, violet and velvet. Default color is white.
  5601. @item seed, s
  5602. Specify a value used to seed the PRNG.
  5603. @item nb_samples, n
  5604. Set the number of samples per each output frame, default is 1024.
  5605. @end table
  5606. @subsection Examples
  5607. @itemize
  5608. @item
  5609. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  5610. @example
  5611. anoisesrc=d=60:c=pink:r=44100:a=0.5
  5612. @end example
  5613. @end itemize
  5614. @section hilbert
  5615. Generate odd-tap Hilbert transform FIR coefficients.
  5616. The resulting stream can be used with @ref{afir} filter for phase-shifting
  5617. the signal by 90 degrees.
  5618. This is used in many matrix coding schemes and for analytic signal generation.
  5619. The process is often written as a multiplication by i (or j), the imaginary unit.
  5620. The filter accepts the following options:
  5621. @table @option
  5622. @item sample_rate, s
  5623. Set sample rate, default is 44100.
  5624. @item taps, t
  5625. Set length of FIR filter, default is 22051.
  5626. @item nb_samples, n
  5627. Set number of samples per each frame.
  5628. @item win_func, w
  5629. Set window function to be used when generating FIR coefficients.
  5630. @end table
  5631. @section sinc
  5632. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  5633. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  5634. The filter accepts the following options:
  5635. @table @option
  5636. @item sample_rate, r
  5637. Set sample rate, default is 44100.
  5638. @item nb_samples, n
  5639. Set number of samples per each frame. Default is 1024.
  5640. @item hp
  5641. Set high-pass frequency. Default is 0.
  5642. @item lp
  5643. Set low-pass frequency. Default is 0.
  5644. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  5645. is higher than 0 then filter will create band-pass filter coefficients,
  5646. otherwise band-reject filter coefficients.
  5647. @item phase
  5648. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  5649. @item beta
  5650. Set Kaiser window beta.
  5651. @item att
  5652. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  5653. @item round
  5654. Enable rounding, by default is disabled.
  5655. @item hptaps
  5656. Set number of taps for high-pass filter.
  5657. @item lptaps
  5658. Set number of taps for low-pass filter.
  5659. @end table
  5660. @section sine
  5661. Generate an audio signal made of a sine wave with amplitude 1/8.
  5662. The audio signal is bit-exact.
  5663. The filter accepts the following options:
  5664. @table @option
  5665. @item frequency, f
  5666. Set the carrier frequency. Default is 440 Hz.
  5667. @item beep_factor, b
  5668. Enable a periodic beep every second with frequency @var{beep_factor} times
  5669. the carrier frequency. Default is 0, meaning the beep is disabled.
  5670. @item sample_rate, r
  5671. Specify the sample rate, default is 44100.
  5672. @item duration, d
  5673. Specify the duration of the generated audio stream.
  5674. @item samples_per_frame
  5675. Set the number of samples per output frame.
  5676. The expression can contain the following constants:
  5677. @table @option
  5678. @item n
  5679. The (sequential) number of the output audio frame, starting from 0.
  5680. @item pts
  5681. The PTS (Presentation TimeStamp) of the output audio frame,
  5682. expressed in @var{TB} units.
  5683. @item t
  5684. The PTS of the output audio frame, expressed in seconds.
  5685. @item TB
  5686. The timebase of the output audio frames.
  5687. @end table
  5688. Default is @code{1024}.
  5689. @end table
  5690. @subsection Examples
  5691. @itemize
  5692. @item
  5693. Generate a simple 440 Hz sine wave:
  5694. @example
  5695. sine
  5696. @end example
  5697. @item
  5698. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  5699. @example
  5700. sine=220:4:d=5
  5701. sine=f=220:b=4:d=5
  5702. sine=frequency=220:beep_factor=4:duration=5
  5703. @end example
  5704. @item
  5705. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  5706. pattern:
  5707. @example
  5708. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  5709. @end example
  5710. @end itemize
  5711. @c man end AUDIO SOURCES
  5712. @chapter Audio Sinks
  5713. @c man begin AUDIO SINKS
  5714. Below is a description of the currently available audio sinks.
  5715. @section abuffersink
  5716. Buffer audio frames, and make them available to the end of filter chain.
  5717. This sink is mainly intended for programmatic use, in particular
  5718. through the interface defined in @file{libavfilter/buffersink.h}
  5719. or the options system.
  5720. It accepts a pointer to an AVABufferSinkContext structure, which
  5721. defines the incoming buffers' formats, to be passed as the opaque
  5722. parameter to @code{avfilter_init_filter} for initialization.
  5723. @section anullsink
  5724. Null audio sink; do absolutely nothing with the input audio. It is
  5725. mainly useful as a template and for use in analysis / debugging
  5726. tools.
  5727. @c man end AUDIO SINKS
  5728. @chapter Video Filters
  5729. @c man begin VIDEO FILTERS
  5730. When you configure your FFmpeg build, you can disable any of the
  5731. existing filters using @code{--disable-filters}.
  5732. The configure output will show the video filters included in your
  5733. build.
  5734. Below is a description of the currently available video filters.
  5735. @section addroi
  5736. Mark a region of interest in a video frame.
  5737. The frame data is passed through unchanged, but metadata is attached
  5738. to the frame indicating regions of interest which can affect the
  5739. behaviour of later encoding. Multiple regions can be marked by
  5740. applying the filter multiple times.
  5741. @table @option
  5742. @item x
  5743. Region distance in pixels from the left edge of the frame.
  5744. @item y
  5745. Region distance in pixels from the top edge of the frame.
  5746. @item w
  5747. Region width in pixels.
  5748. @item h
  5749. Region height in pixels.
  5750. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  5751. and may contain the following variables:
  5752. @table @option
  5753. @item iw
  5754. Width of the input frame.
  5755. @item ih
  5756. Height of the input frame.
  5757. @end table
  5758. @item qoffset
  5759. Quantisation offset to apply within the region.
  5760. This must be a real value in the range -1 to +1. A value of zero
  5761. indicates no quality change. A negative value asks for better quality
  5762. (less quantisation), while a positive value asks for worse quality
  5763. (greater quantisation).
  5764. The range is calibrated so that the extreme values indicate the
  5765. largest possible offset - if the rest of the frame is encoded with the
  5766. worst possible quality, an offset of -1 indicates that this region
  5767. should be encoded with the best possible quality anyway. Intermediate
  5768. values are then interpolated in some codec-dependent way.
  5769. For example, in 10-bit H.264 the quantisation parameter varies between
  5770. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  5771. this region should be encoded with a QP around one-tenth of the full
  5772. range better than the rest of the frame. So, if most of the frame
  5773. were to be encoded with a QP of around 30, this region would get a QP
  5774. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  5775. An extreme value of -1 would indicate that this region should be
  5776. encoded with the best possible quality regardless of the treatment of
  5777. the rest of the frame - that is, should be encoded at a QP of -12.
  5778. @item clear
  5779. If set to true, remove any existing regions of interest marked on the
  5780. frame before adding the new one.
  5781. @end table
  5782. @subsection Examples
  5783. @itemize
  5784. @item
  5785. Mark the centre quarter of the frame as interesting.
  5786. @example
  5787. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  5788. @end example
  5789. @item
  5790. Mark the 100-pixel-wide region on the left edge of the frame as very
  5791. uninteresting (to be encoded at much lower quality than the rest of
  5792. the frame).
  5793. @example
  5794. addroi=0:0:100:ih:+1/5
  5795. @end example
  5796. @end itemize
  5797. @section alphaextract
  5798. Extract the alpha component from the input as a grayscale video. This
  5799. is especially useful with the @var{alphamerge} filter.
  5800. @section alphamerge
  5801. Add or replace the alpha component of the primary input with the
  5802. grayscale value of a second input. This is intended for use with
  5803. @var{alphaextract} to allow the transmission or storage of frame
  5804. sequences that have alpha in a format that doesn't support an alpha
  5805. channel.
  5806. For example, to reconstruct full frames from a normal YUV-encoded video
  5807. and a separate video created with @var{alphaextract}, you might use:
  5808. @example
  5809. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  5810. @end example
  5811. @section amplify
  5812. Amplify differences between current pixel and pixels of adjacent frames in
  5813. same pixel location.
  5814. This filter accepts the following options:
  5815. @table @option
  5816. @item radius
  5817. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  5818. For example radius of 3 will instruct filter to calculate average of 7 frames.
  5819. @item factor
  5820. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  5821. @item threshold
  5822. Set threshold for difference amplification. Any difference greater or equal to
  5823. this value will not alter source pixel. Default is 10.
  5824. Allowed range is from 0 to 65535.
  5825. @item tolerance
  5826. Set tolerance for difference amplification. Any difference lower to
  5827. this value will not alter source pixel. Default is 0.
  5828. Allowed range is from 0 to 65535.
  5829. @item low
  5830. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5831. This option controls maximum possible value that will decrease source pixel value.
  5832. @item high
  5833. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5834. This option controls maximum possible value that will increase source pixel value.
  5835. @item planes
  5836. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  5837. @end table
  5838. @subsection Commands
  5839. This filter supports the following @ref{commands} that corresponds to option of same name:
  5840. @table @option
  5841. @item factor
  5842. @item threshold
  5843. @item tolerance
  5844. @item low
  5845. @item high
  5846. @item planes
  5847. @end table
  5848. @section ass
  5849. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  5850. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  5851. Substation Alpha) subtitles files.
  5852. This filter accepts the following option in addition to the common options from
  5853. the @ref{subtitles} filter:
  5854. @table @option
  5855. @item shaping
  5856. Set the shaping engine
  5857. Available values are:
  5858. @table @samp
  5859. @item auto
  5860. The default libass shaping engine, which is the best available.
  5861. @item simple
  5862. Fast, font-agnostic shaper that can do only substitutions
  5863. @item complex
  5864. Slower shaper using OpenType for substitutions and positioning
  5865. @end table
  5866. The default is @code{auto}.
  5867. @end table
  5868. @section atadenoise
  5869. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  5870. The filter accepts the following options:
  5871. @table @option
  5872. @item 0a
  5873. Set threshold A for 1st plane. Default is 0.02.
  5874. Valid range is 0 to 0.3.
  5875. @item 0b
  5876. Set threshold B for 1st plane. Default is 0.04.
  5877. Valid range is 0 to 5.
  5878. @item 1a
  5879. Set threshold A for 2nd plane. Default is 0.02.
  5880. Valid range is 0 to 0.3.
  5881. @item 1b
  5882. Set threshold B for 2nd plane. Default is 0.04.
  5883. Valid range is 0 to 5.
  5884. @item 2a
  5885. Set threshold A for 3rd plane. Default is 0.02.
  5886. Valid range is 0 to 0.3.
  5887. @item 2b
  5888. Set threshold B for 3rd plane. Default is 0.04.
  5889. Valid range is 0 to 5.
  5890. Threshold A is designed to react on abrupt changes in the input signal and
  5891. threshold B is designed to react on continuous changes in the input signal.
  5892. @item s
  5893. Set number of frames filter will use for averaging. Default is 9. Must be odd
  5894. number in range [5, 129].
  5895. @item p
  5896. Set what planes of frame filter will use for averaging. Default is all.
  5897. @item a
  5898. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  5899. Alternatively can be set to @code{s} serial.
  5900. Parallel can be faster then serial, while other way around is never true.
  5901. Parallel will abort early on first change being greater then thresholds, while serial
  5902. will continue processing other side of frames if they are equal or below thresholds.
  5903. @item 0s
  5904. @item 1s
  5905. @item 2s
  5906. Set sigma for 1st plane, 2nd plane or 3rd plane. Default is 32767.
  5907. Valid range is from 0 to 32767.
  5908. This options controls weight for each pixel in radius defined by size.
  5909. Default value means every pixel have same weight.
  5910. Setting this option to 0 effectively disables filtering.
  5911. @end table
  5912. @subsection Commands
  5913. This filter supports same @ref{commands} as options except option @code{s}.
  5914. The command accepts the same syntax of the corresponding option.
  5915. @section avgblur
  5916. Apply average blur filter.
  5917. The filter accepts the following options:
  5918. @table @option
  5919. @item sizeX
  5920. Set horizontal radius size.
  5921. @item planes
  5922. Set which planes to filter. By default all planes are filtered.
  5923. @item sizeY
  5924. Set vertical radius size, if zero it will be same as @code{sizeX}.
  5925. Default is @code{0}.
  5926. @end table
  5927. @subsection Commands
  5928. This filter supports same commands as options.
  5929. The command accepts the same syntax of the corresponding option.
  5930. If the specified expression is not valid, it is kept at its current
  5931. value.
  5932. @section bbox
  5933. Compute the bounding box for the non-black pixels in the input frame
  5934. luminance plane.
  5935. This filter computes the bounding box containing all the pixels with a
  5936. luminance value greater than the minimum allowed value.
  5937. The parameters describing the bounding box are printed on the filter
  5938. log.
  5939. The filter accepts the following option:
  5940. @table @option
  5941. @item min_val
  5942. Set the minimal luminance value. Default is @code{16}.
  5943. @end table
  5944. @subsection Commands
  5945. This filter supports the all above options as @ref{commands}.
  5946. @section bilateral
  5947. Apply bilateral filter, spatial smoothing while preserving edges.
  5948. The filter accepts the following options:
  5949. @table @option
  5950. @item sigmaS
  5951. Set sigma of gaussian function to calculate spatial weight.
  5952. Allowed range is 0 to 512. Default is 0.1.
  5953. @item sigmaR
  5954. Set sigma of gaussian function to calculate range weight.
  5955. Allowed range is 0 to 1. Default is 0.1.
  5956. @item planes
  5957. Set planes to filter. Default is first only.
  5958. @end table
  5959. @subsection Commands
  5960. This filter supports the all above options as @ref{commands}.
  5961. @section bitplanenoise
  5962. Show and measure bit plane noise.
  5963. The filter accepts the following options:
  5964. @table @option
  5965. @item bitplane
  5966. Set which plane to analyze. Default is @code{1}.
  5967. @item filter
  5968. Filter out noisy pixels from @code{bitplane} set above.
  5969. Default is disabled.
  5970. @end table
  5971. @section blackdetect
  5972. Detect video intervals that are (almost) completely black. Can be
  5973. useful to detect chapter transitions, commercials, or invalid
  5974. recordings.
  5975. The filter outputs its detection analysis to both the log as well as
  5976. frame metadata. If a black segment of at least the specified minimum
  5977. duration is found, a line with the start and end timestamps as well
  5978. as duration is printed to the log with level @code{info}. In addition,
  5979. a log line with level @code{debug} is printed per frame showing the
  5980. black amount detected for that frame.
  5981. The filter also attaches metadata to the first frame of a black
  5982. segment with key @code{lavfi.black_start} and to the first frame
  5983. after the black segment ends with key @code{lavfi.black_end}. The
  5984. value is the frame's timestamp. This metadata is added regardless
  5985. of the minimum duration specified.
  5986. The filter accepts the following options:
  5987. @table @option
  5988. @item black_min_duration, d
  5989. Set the minimum detected black duration expressed in seconds. It must
  5990. be a non-negative floating point number.
  5991. Default value is 2.0.
  5992. @item picture_black_ratio_th, pic_th
  5993. Set the threshold for considering a picture "black".
  5994. Express the minimum value for the ratio:
  5995. @example
  5996. @var{nb_black_pixels} / @var{nb_pixels}
  5997. @end example
  5998. for which a picture is considered black.
  5999. Default value is 0.98.
  6000. @item pixel_black_th, pix_th
  6001. Set the threshold for considering a pixel "black".
  6002. The threshold expresses the maximum pixel luminance value for which a
  6003. pixel is considered "black". The provided value is scaled according to
  6004. the following equation:
  6005. @example
  6006. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  6007. @end example
  6008. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  6009. the input video format, the range is [0-255] for YUV full-range
  6010. formats and [16-235] for YUV non full-range formats.
  6011. Default value is 0.10.
  6012. @end table
  6013. The following example sets the maximum pixel threshold to the minimum
  6014. value, and detects only black intervals of 2 or more seconds:
  6015. @example
  6016. blackdetect=d=2:pix_th=0.00
  6017. @end example
  6018. @section blackframe
  6019. Detect frames that are (almost) completely black. Can be useful to
  6020. detect chapter transitions or commercials. Output lines consist of
  6021. the frame number of the detected frame, the percentage of blackness,
  6022. the position in the file if known or -1 and the timestamp in seconds.
  6023. In order to display the output lines, you need to set the loglevel at
  6024. least to the AV_LOG_INFO value.
  6025. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  6026. The value represents the percentage of pixels in the picture that
  6027. are below the threshold value.
  6028. It accepts the following parameters:
  6029. @table @option
  6030. @item amount
  6031. The percentage of the pixels that have to be below the threshold; it defaults to
  6032. @code{98}.
  6033. @item threshold, thresh
  6034. The threshold below which a pixel value is considered black; it defaults to
  6035. @code{32}.
  6036. @end table
  6037. @anchor{blend}
  6038. @section blend
  6039. Blend two video frames into each other.
  6040. The @code{blend} filter takes two input streams and outputs one
  6041. stream, the first input is the "top" layer and second input is
  6042. "bottom" layer. By default, the output terminates when the longest input terminates.
  6043. The @code{tblend} (time blend) filter takes two consecutive frames
  6044. from one single stream, and outputs the result obtained by blending
  6045. the new frame on top of the old frame.
  6046. A description of the accepted options follows.
  6047. @table @option
  6048. @item c0_mode
  6049. @item c1_mode
  6050. @item c2_mode
  6051. @item c3_mode
  6052. @item all_mode
  6053. Set blend mode for specific pixel component or all pixel components in case
  6054. of @var{all_mode}. Default value is @code{normal}.
  6055. Available values for component modes are:
  6056. @table @samp
  6057. @item addition
  6058. @item and
  6059. @item average
  6060. @item bleach
  6061. @item burn
  6062. @item darken
  6063. @item difference
  6064. @item divide
  6065. @item dodge
  6066. @item exclusion
  6067. @item extremity
  6068. @item freeze
  6069. @item geometric
  6070. @item glow
  6071. @item grainextract
  6072. @item grainmerge
  6073. @item hardlight
  6074. @item hardmix
  6075. @item hardoverlay
  6076. @item harmonic
  6077. @item heat
  6078. @item interpolate
  6079. @item lighten
  6080. @item linearlight
  6081. @item multiply
  6082. @item multiply128
  6083. @item negation
  6084. @item normal
  6085. @item or
  6086. @item overlay
  6087. @item phoenix
  6088. @item pinlight
  6089. @item reflect
  6090. @item screen
  6091. @item softdifference
  6092. @item softlight
  6093. @item stain
  6094. @item subtract
  6095. @item vividlight
  6096. @item xor
  6097. @end table
  6098. @item c0_opacity
  6099. @item c1_opacity
  6100. @item c2_opacity
  6101. @item c3_opacity
  6102. @item all_opacity
  6103. Set blend opacity for specific pixel component or all pixel components in case
  6104. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  6105. @item c0_expr
  6106. @item c1_expr
  6107. @item c2_expr
  6108. @item c3_expr
  6109. @item all_expr
  6110. Set blend expression for specific pixel component or all pixel components in case
  6111. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  6112. The expressions can use the following variables:
  6113. @table @option
  6114. @item N
  6115. The sequential number of the filtered frame, starting from @code{0}.
  6116. @item X
  6117. @item Y
  6118. the coordinates of the current sample
  6119. @item W
  6120. @item H
  6121. the width and height of currently filtered plane
  6122. @item SW
  6123. @item SH
  6124. Width and height scale for the plane being filtered. It is the
  6125. ratio between the dimensions of the current plane to the luma plane,
  6126. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  6127. the luma plane and @code{0.5,0.5} for the chroma planes.
  6128. @item T
  6129. Time of the current frame, expressed in seconds.
  6130. @item TOP, A
  6131. Value of pixel component at current location for first video frame (top layer).
  6132. @item BOTTOM, B
  6133. Value of pixel component at current location for second video frame (bottom layer).
  6134. @end table
  6135. @end table
  6136. The @code{blend} filter also supports the @ref{framesync} options.
  6137. @subsection Examples
  6138. @itemize
  6139. @item
  6140. Apply transition from bottom layer to top layer in first 10 seconds:
  6141. @example
  6142. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  6143. @end example
  6144. @item
  6145. Apply linear horizontal transition from top layer to bottom layer:
  6146. @example
  6147. blend=all_expr='A*(X/W)+B*(1-X/W)'
  6148. @end example
  6149. @item
  6150. Apply 1x1 checkerboard effect:
  6151. @example
  6152. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  6153. @end example
  6154. @item
  6155. Apply uncover left effect:
  6156. @example
  6157. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  6158. @end example
  6159. @item
  6160. Apply uncover down effect:
  6161. @example
  6162. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  6163. @end example
  6164. @item
  6165. Apply uncover up-left effect:
  6166. @example
  6167. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  6168. @end example
  6169. @item
  6170. Split diagonally video and shows top and bottom layer on each side:
  6171. @example
  6172. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  6173. @end example
  6174. @item
  6175. Display differences between the current and the previous frame:
  6176. @example
  6177. tblend=all_mode=grainextract
  6178. @end example
  6179. @end itemize
  6180. @subsection Commands
  6181. This filter supports same @ref{commands} as options.
  6182. @anchor{blurdetect}
  6183. @section blurdetect
  6184. Determines blurriness of frames without altering the input frames.
  6185. Based on Marziliano, Pina, et al. "A no-reference perceptual blur metric."
  6186. Allows for a block-based abbreviation.
  6187. The filter accepts the following options:
  6188. @table @option
  6189. @item low
  6190. @item high
  6191. Set low and high threshold values used by the Canny thresholding
  6192. algorithm.
  6193. The high threshold selects the "strong" edge pixels, which are then
  6194. connected through 8-connectivity with the "weak" edge pixels selected
  6195. by the low threshold.
  6196. @var{low} and @var{high} threshold values must be chosen in the range
  6197. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6198. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6199. is @code{50/255}.
  6200. @item radius
  6201. Define the radius to search around an edge pixel for local maxima.
  6202. @item block_pct
  6203. Determine blurriness only for the most significant blocks, given in percentage.
  6204. @item block_width
  6205. 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}.
  6206. @item block_height
  6207. 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}.
  6208. @item planes
  6209. Set planes to filter. Default is first only.
  6210. @end table
  6211. @subsection Examples
  6212. @itemize
  6213. @item
  6214. Determine blur for 80% of most significant 32x32 blocks:
  6215. @example
  6216. blurdetect=block_width=32:block_height=32:block_pct=80
  6217. @end example
  6218. @end itemize
  6219. @section bm3d
  6220. Denoise frames using Block-Matching 3D algorithm.
  6221. The filter accepts the following options.
  6222. @table @option
  6223. @item sigma
  6224. Set denoising strength. Default value is 1.
  6225. Allowed range is from 0 to 999.9.
  6226. The denoising algorithm is very sensitive to sigma, so adjust it
  6227. according to the source.
  6228. @item block
  6229. Set local patch size. This sets dimensions in 2D.
  6230. @item bstep
  6231. Set sliding step for processing blocks. Default value is 4.
  6232. Allowed range is from 1 to 64.
  6233. Smaller values allows processing more reference blocks and is slower.
  6234. @item group
  6235. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  6236. When set to 1, no block matching is done. Larger values allows more blocks
  6237. in single group.
  6238. Allowed range is from 1 to 256.
  6239. @item range
  6240. Set radius for search block matching. Default is 9.
  6241. Allowed range is from 1 to INT32_MAX.
  6242. @item mstep
  6243. Set step between two search locations for block matching. Default is 1.
  6244. Allowed range is from 1 to 64. Smaller is slower.
  6245. @item thmse
  6246. Set threshold of mean square error for block matching. Valid range is 0 to
  6247. INT32_MAX.
  6248. @item hdthr
  6249. Set thresholding parameter for hard thresholding in 3D transformed domain.
  6250. Larger values results in stronger hard-thresholding filtering in frequency
  6251. domain.
  6252. @item estim
  6253. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  6254. Default is @code{basic}.
  6255. @item ref
  6256. If enabled, filter will use 2nd stream for block matching.
  6257. Default is disabled for @code{basic} value of @var{estim} option,
  6258. and always enabled if value of @var{estim} is @code{final}.
  6259. @item planes
  6260. Set planes to filter. Default is all available except alpha.
  6261. @end table
  6262. @subsection Examples
  6263. @itemize
  6264. @item
  6265. Basic filtering with bm3d:
  6266. @example
  6267. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  6268. @end example
  6269. @item
  6270. Same as above, but filtering only luma:
  6271. @example
  6272. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  6273. @end example
  6274. @item
  6275. Same as above, but with both estimation modes:
  6276. @example
  6277. 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
  6278. @end example
  6279. @item
  6280. Same as above, but prefilter with @ref{nlmeans} filter instead:
  6281. @example
  6282. 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
  6283. @end example
  6284. @end itemize
  6285. @section boxblur
  6286. Apply a boxblur algorithm to the input video.
  6287. It accepts the following parameters:
  6288. @table @option
  6289. @item luma_radius, lr
  6290. @item luma_power, lp
  6291. @item chroma_radius, cr
  6292. @item chroma_power, cp
  6293. @item alpha_radius, ar
  6294. @item alpha_power, ap
  6295. @end table
  6296. A description of the accepted options follows.
  6297. @table @option
  6298. @item luma_radius, lr
  6299. @item chroma_radius, cr
  6300. @item alpha_radius, ar
  6301. Set an expression for the box radius in pixels used for blurring the
  6302. corresponding input plane.
  6303. The radius value must be a non-negative number, and must not be
  6304. greater than the value of the expression @code{min(w,h)/2} for the
  6305. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  6306. planes.
  6307. Default value for @option{luma_radius} is "2". If not specified,
  6308. @option{chroma_radius} and @option{alpha_radius} default to the
  6309. corresponding value set for @option{luma_radius}.
  6310. The expressions can contain the following constants:
  6311. @table @option
  6312. @item w
  6313. @item h
  6314. The input width and height in pixels.
  6315. @item cw
  6316. @item ch
  6317. The input chroma image width and height in pixels.
  6318. @item hsub
  6319. @item vsub
  6320. The horizontal and vertical chroma subsample values. For example, for the
  6321. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  6322. @end table
  6323. @item luma_power, lp
  6324. @item chroma_power, cp
  6325. @item alpha_power, ap
  6326. Specify how many times the boxblur filter is applied to the
  6327. corresponding plane.
  6328. Default value for @option{luma_power} is 2. If not specified,
  6329. @option{chroma_power} and @option{alpha_power} default to the
  6330. corresponding value set for @option{luma_power}.
  6331. A value of 0 will disable the effect.
  6332. @end table
  6333. @subsection Examples
  6334. @itemize
  6335. @item
  6336. Apply a boxblur filter with the luma, chroma, and alpha radii
  6337. set to 2:
  6338. @example
  6339. boxblur=luma_radius=2:luma_power=1
  6340. boxblur=2:1
  6341. @end example
  6342. @item
  6343. Set the luma radius to 2, and alpha and chroma radius to 0:
  6344. @example
  6345. boxblur=2:1:cr=0:ar=0
  6346. @end example
  6347. @item
  6348. Set the luma and chroma radii to a fraction of the video dimension:
  6349. @example
  6350. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  6351. @end example
  6352. @end itemize
  6353. @section bwdif
  6354. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  6355. Deinterlacing Filter").
  6356. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  6357. interpolation algorithms.
  6358. It accepts the following parameters:
  6359. @table @option
  6360. @item mode
  6361. The interlacing mode to adopt. It accepts one of the following values:
  6362. @table @option
  6363. @item 0, send_frame
  6364. Output one frame for each frame.
  6365. @item 1, send_field
  6366. Output one frame for each field.
  6367. @end table
  6368. The default value is @code{send_field}.
  6369. @item parity
  6370. The picture field parity assumed for the input interlaced video. It accepts one
  6371. of the following values:
  6372. @table @option
  6373. @item 0, tff
  6374. Assume the top field is first.
  6375. @item 1, bff
  6376. Assume the bottom field is first.
  6377. @item -1, auto
  6378. Enable automatic detection of field parity.
  6379. @end table
  6380. The default value is @code{auto}.
  6381. If the interlacing is unknown or the decoder does not export this information,
  6382. top field first will be assumed.
  6383. @item deint
  6384. Specify which frames to deinterlace. Accepts one of the following
  6385. values:
  6386. @table @option
  6387. @item 0, all
  6388. Deinterlace all frames.
  6389. @item 1, interlaced
  6390. Only deinterlace frames marked as interlaced.
  6391. @end table
  6392. The default value is @code{all}.
  6393. @end table
  6394. @section cas
  6395. Apply Contrast Adaptive Sharpen filter to video stream.
  6396. The filter accepts the following options:
  6397. @table @option
  6398. @item strength
  6399. Set the sharpening strength. Default value is 0.
  6400. @item planes
  6401. Set planes to filter. Default value is to filter all
  6402. planes except alpha plane.
  6403. @end table
  6404. @subsection Commands
  6405. This filter supports same @ref{commands} as options.
  6406. @section chromahold
  6407. Remove all color information for all colors except for certain one.
  6408. The filter accepts the following options:
  6409. @table @option
  6410. @item color
  6411. The color which will not be replaced with neutral chroma.
  6412. @item similarity
  6413. Similarity percentage with the above color.
  6414. 0.01 matches only the exact key color, while 1.0 matches everything.
  6415. @item blend
  6416. Blend percentage.
  6417. 0.0 makes pixels either fully gray, or not gray at all.
  6418. Higher values result in more preserved color.
  6419. @item yuv
  6420. Signals that the color passed is already in YUV instead of RGB.
  6421. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  6422. This can be used to pass exact YUV values as hexadecimal numbers.
  6423. @end table
  6424. @subsection Commands
  6425. This filter supports same @ref{commands} as options.
  6426. The command accepts the same syntax of the corresponding option.
  6427. If the specified expression is not valid, it is kept at its current
  6428. value.
  6429. @section chromakey
  6430. YUV colorspace color/chroma keying.
  6431. The filter accepts the following options:
  6432. @table @option
  6433. @item color
  6434. The color which will be replaced with transparency.
  6435. @item similarity
  6436. Similarity percentage with the key color.
  6437. 0.01 matches only the exact key color, while 1.0 matches everything.
  6438. @item blend
  6439. Blend percentage.
  6440. 0.0 makes pixels either fully transparent, or not transparent at all.
  6441. Higher values result in semi-transparent pixels, with a higher transparency
  6442. the more similar the pixels color is to the key color.
  6443. @item yuv
  6444. Signals that the color passed is already in YUV instead of RGB.
  6445. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  6446. This can be used to pass exact YUV values as hexadecimal numbers.
  6447. @end table
  6448. @subsection Commands
  6449. This filter supports same @ref{commands} as options.
  6450. The command accepts the same syntax of the corresponding option.
  6451. If the specified expression is not valid, it is kept at its current
  6452. value.
  6453. @subsection Examples
  6454. @itemize
  6455. @item
  6456. Make every green pixel in the input image transparent:
  6457. @example
  6458. ffmpeg -i input.png -vf chromakey=green out.png
  6459. @end example
  6460. @item
  6461. Overlay a greenscreen-video on top of a static black background.
  6462. @example
  6463. 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
  6464. @end example
  6465. @end itemize
  6466. @section chromanr
  6467. Reduce chrominance noise.
  6468. The filter accepts the following options:
  6469. @table @option
  6470. @item thres
  6471. Set threshold for averaging chrominance values.
  6472. Sum of absolute difference of Y, U and V pixel components of current
  6473. pixel and neighbour pixels lower than this threshold will be used in
  6474. averaging. Luma component is left unchanged and is copied to output.
  6475. Default value is 30. Allowed range is from 1 to 200.
  6476. @item sizew
  6477. Set horizontal radius of rectangle used for averaging.
  6478. Allowed range is from 1 to 100. Default value is 5.
  6479. @item sizeh
  6480. Set vertical radius of rectangle used for averaging.
  6481. Allowed range is from 1 to 100. Default value is 5.
  6482. @item stepw
  6483. Set horizontal step when averaging. Default value is 1.
  6484. Allowed range is from 1 to 50.
  6485. Mostly useful to speed-up filtering.
  6486. @item steph
  6487. Set vertical step when averaging. Default value is 1.
  6488. Allowed range is from 1 to 50.
  6489. Mostly useful to speed-up filtering.
  6490. @item threy
  6491. Set Y threshold for averaging chrominance values.
  6492. Set finer control for max allowed difference between Y components
  6493. of current pixel and neigbour pixels.
  6494. Default value is 200. Allowed range is from 1 to 200.
  6495. @item threu
  6496. Set U threshold for averaging chrominance values.
  6497. Set finer control for max allowed difference between U components
  6498. of current pixel and neigbour pixels.
  6499. Default value is 200. Allowed range is from 1 to 200.
  6500. @item threv
  6501. Set V threshold for averaging chrominance values.
  6502. Set finer control for max allowed difference between V components
  6503. of current pixel and neigbour pixels.
  6504. Default value is 200. Allowed range is from 1 to 200.
  6505. @item distance
  6506. Set distance type used in calculations.
  6507. @table @samp
  6508. @item manhattan
  6509. Absolute difference.
  6510. @item euclidean
  6511. Difference squared.
  6512. @end table
  6513. Default distance type is manhattan.
  6514. @end table
  6515. @subsection Commands
  6516. This filter supports same @ref{commands} as options.
  6517. The command accepts the same syntax of the corresponding option.
  6518. @section chromashift
  6519. Shift chroma pixels horizontally and/or vertically.
  6520. The filter accepts the following options:
  6521. @table @option
  6522. @item cbh
  6523. Set amount to shift chroma-blue horizontally.
  6524. @item cbv
  6525. Set amount to shift chroma-blue vertically.
  6526. @item crh
  6527. Set amount to shift chroma-red horizontally.
  6528. @item crv
  6529. Set amount to shift chroma-red vertically.
  6530. @item edge
  6531. Set edge mode, can be @var{smear}, default, or @var{warp}.
  6532. @end table
  6533. @subsection Commands
  6534. This filter supports the all above options as @ref{commands}.
  6535. @section ciescope
  6536. Display CIE color diagram with pixels overlaid onto it.
  6537. The filter accepts the following options:
  6538. @table @option
  6539. @item system
  6540. Set color system.
  6541. @table @samp
  6542. @item ntsc, 470m
  6543. @item ebu, 470bg
  6544. @item smpte
  6545. @item 240m
  6546. @item apple
  6547. @item widergb
  6548. @item cie1931
  6549. @item rec709, hdtv
  6550. @item uhdtv, rec2020
  6551. @item dcip3
  6552. @end table
  6553. @item cie
  6554. Set CIE system.
  6555. @table @samp
  6556. @item xyy
  6557. @item ucs
  6558. @item luv
  6559. @end table
  6560. @item gamuts
  6561. Set what gamuts to draw.
  6562. See @code{system} option for available values.
  6563. @item size, s
  6564. Set ciescope size, by default set to 512.
  6565. @item intensity, i
  6566. Set intensity used to map input pixel values to CIE diagram.
  6567. @item contrast
  6568. Set contrast used to draw tongue colors that are out of active color system gamut.
  6569. @item corrgamma
  6570. Correct gamma displayed on scope, by default enabled.
  6571. @item showwhite
  6572. Show white point on CIE diagram, by default disabled.
  6573. @item gamma
  6574. Set input gamma. Used only with XYZ input color space.
  6575. @item fill
  6576. Fill with CIE colors. By default is enabled.
  6577. @end table
  6578. @section codecview
  6579. Visualize information exported by some codecs.
  6580. Some codecs can export information through frames using side-data or other
  6581. means. For example, some MPEG based codecs export motion vectors through the
  6582. @var{export_mvs} flag in the codec @option{flags2} option.
  6583. The filter accepts the following option:
  6584. @table @option
  6585. @item block
  6586. Display block partition structure using the luma plane.
  6587. @item mv
  6588. Set motion vectors to visualize.
  6589. Available flags for @var{mv} are:
  6590. @table @samp
  6591. @item pf
  6592. forward predicted MVs of P-frames
  6593. @item bf
  6594. forward predicted MVs of B-frames
  6595. @item bb
  6596. backward predicted MVs of B-frames
  6597. @end table
  6598. @item qp
  6599. Display quantization parameters using the chroma planes.
  6600. @item mv_type, mvt
  6601. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  6602. Available flags for @var{mv_type} are:
  6603. @table @samp
  6604. @item fp
  6605. forward predicted MVs
  6606. @item bp
  6607. backward predicted MVs
  6608. @end table
  6609. @item frame_type, ft
  6610. Set frame type to visualize motion vectors of.
  6611. Available flags for @var{frame_type} are:
  6612. @table @samp
  6613. @item if
  6614. intra-coded frames (I-frames)
  6615. @item pf
  6616. predicted frames (P-frames)
  6617. @item bf
  6618. bi-directionally predicted frames (B-frames)
  6619. @end table
  6620. @end table
  6621. @subsection Examples
  6622. @itemize
  6623. @item
  6624. Visualize forward predicted MVs of all frames using @command{ffplay}:
  6625. @example
  6626. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  6627. @end example
  6628. @item
  6629. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  6630. @example
  6631. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  6632. @end example
  6633. @end itemize
  6634. @section colorbalance
  6635. Modify intensity of primary colors (red, green and blue) of input frames.
  6636. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  6637. regions for the red-cyan, green-magenta or blue-yellow balance.
  6638. A positive adjustment value shifts the balance towards the primary color, a negative
  6639. value towards the complementary color.
  6640. The filter accepts the following options:
  6641. @table @option
  6642. @item rs
  6643. @item gs
  6644. @item bs
  6645. Adjust red, green and blue shadows (darkest pixels).
  6646. @item rm
  6647. @item gm
  6648. @item bm
  6649. Adjust red, green and blue midtones (medium pixels).
  6650. @item rh
  6651. @item gh
  6652. @item bh
  6653. Adjust red, green and blue highlights (brightest pixels).
  6654. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  6655. @item pl
  6656. Preserve lightness when changing color balance. Default is disabled.
  6657. @end table
  6658. @subsection Examples
  6659. @itemize
  6660. @item
  6661. Add red color cast to shadows:
  6662. @example
  6663. colorbalance=rs=.3
  6664. @end example
  6665. @end itemize
  6666. @subsection Commands
  6667. This filter supports the all above options as @ref{commands}.
  6668. @section colorcontrast
  6669. Adjust color contrast between RGB components.
  6670. The filter accepts the following options:
  6671. @table @option
  6672. @item rc
  6673. Set the red-cyan contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  6674. @item gm
  6675. Set the green-magenta contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  6676. @item by
  6677. Set the blue-yellow contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  6678. @item rcw
  6679. @item gmw
  6680. @item byw
  6681. Set the weight of each @code{rc}, @code{gm}, @code{by} option value. Default value is 0.0.
  6682. Allowed range is from 0.0 to 1.0. If all weights are 0.0 filtering is disabled.
  6683. @item pl
  6684. Set the amount of preserving lightness. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  6685. @end table
  6686. @subsection Commands
  6687. This filter supports the all above options as @ref{commands}.
  6688. @section colorcorrect
  6689. Adjust color white balance selectively for blacks and whites.
  6690. This filter operates in YUV colorspace.
  6691. The filter accepts the following options:
  6692. @table @option
  6693. @item rl
  6694. Set the red shadow spot. Allowed range is from -1.0 to 1.0.
  6695. Default value is 0.
  6696. @item bl
  6697. Set the blue shadow spot. Allowed range is from -1.0 to 1.0.
  6698. Default value is 0.
  6699. @item rh
  6700. Set the red highlight spot. Allowed range is from -1.0 to 1.0.
  6701. Default value is 0.
  6702. @item bh
  6703. Set the red highlight spot. Allowed range is from -1.0 to 1.0.
  6704. Default value is 0.
  6705. @item saturation
  6706. Set the amount of saturation. Allowed range is from -3.0 to 3.0.
  6707. Default value is 1.
  6708. @item analyze
  6709. If set to anything other than @code{manual} it will analyze every frame and use derived
  6710. parameters for filtering output frame.
  6711. Possible values are:
  6712. @table @samp
  6713. @item manual
  6714. @item average
  6715. @item minmax
  6716. @item median
  6717. @end table
  6718. Default value is @code{manual}.
  6719. @end table
  6720. @subsection Commands
  6721. This filter supports the all above options as @ref{commands}.
  6722. @section colorchannelmixer
  6723. Adjust video input frames by re-mixing color channels.
  6724. This filter modifies a color channel by adding the values associated to
  6725. the other channels of the same pixels. For example if the value to
  6726. modify is red, the output value will be:
  6727. @example
  6728. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  6729. @end example
  6730. The filter accepts the following options:
  6731. @table @option
  6732. @item rr
  6733. @item rg
  6734. @item rb
  6735. @item ra
  6736. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  6737. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  6738. @item gr
  6739. @item gg
  6740. @item gb
  6741. @item ga
  6742. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  6743. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  6744. @item br
  6745. @item bg
  6746. @item bb
  6747. @item ba
  6748. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  6749. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  6750. @item ar
  6751. @item ag
  6752. @item ab
  6753. @item aa
  6754. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  6755. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  6756. Allowed ranges for options are @code{[-2.0, 2.0]}.
  6757. @item pc
  6758. Set preserve color mode. The accepted values are:
  6759. @table @samp
  6760. @item none
  6761. Disable color preserving, this is default.
  6762. @item lum
  6763. Preserve luminance.
  6764. @item max
  6765. Preserve max value of RGB triplet.
  6766. @item avg
  6767. Preserve average value of RGB triplet.
  6768. @item sum
  6769. Preserve sum value of RGB triplet.
  6770. @item nrm
  6771. Preserve normalized value of RGB triplet.
  6772. @item pwr
  6773. Preserve power value of RGB triplet.
  6774. @end table
  6775. @item pa
  6776. Set the preserve color amount when changing colors. Allowed range is from @code{[0.0, 1.0]}.
  6777. Default is @code{0.0}, thus disabled.
  6778. @end table
  6779. @subsection Examples
  6780. @itemize
  6781. @item
  6782. Convert source to grayscale:
  6783. @example
  6784. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  6785. @end example
  6786. @item
  6787. Simulate sepia tones:
  6788. @example
  6789. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  6790. @end example
  6791. @end itemize
  6792. @subsection Commands
  6793. This filter supports the all above options as @ref{commands}.
  6794. @section colorize
  6795. Overlay a solid color on the video stream.
  6796. The filter accepts the following options:
  6797. @table @option
  6798. @item hue
  6799. Set the color hue. Allowed range is from 0 to 360.
  6800. Default value is 0.
  6801. @item saturation
  6802. Set the color saturation. Allowed range is from 0 to 1.
  6803. Default value is 0.5.
  6804. @item lightness
  6805. Set the color lightness. Allowed range is from 0 to 1.
  6806. Default value is 0.5.
  6807. @item mix
  6808. Set the mix of source lightness. By default is set to 1.0.
  6809. Allowed range is from 0.0 to 1.0.
  6810. @end table
  6811. @subsection Commands
  6812. This filter supports the all above options as @ref{commands}.
  6813. @section colorkey
  6814. RGB colorspace color keying.
  6815. This filter operates on 8-bit RGB format frames by setting the alpha component of each pixel
  6816. which falls within the similarity radius of the key color to 0. The alpha value for pixels outside
  6817. the similarity radius depends on the value of the blend option.
  6818. The filter accepts the following options:
  6819. @table @option
  6820. @item color
  6821. Set the color for which alpha will be set to 0 (full transparency).
  6822. See @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6823. Default is @code{black}.
  6824. @item similarity
  6825. Set the radius from the key color within which other colors also have full transparency.
  6826. The computed distance is related to the unit fractional distance in 3D space between the RGB values
  6827. of the key color and the pixel's color. Range is 0.01 to 1.0. 0.01 matches within a very small radius
  6828. around the exact key color, while 1.0 matches everything.
  6829. Default is @code{0.01}.
  6830. @item blend
  6831. Set how the alpha value for pixels that fall outside the similarity radius is computed.
  6832. 0.0 makes pixels either fully transparent or fully opaque.
  6833. Higher values result in semi-transparent pixels, with greater transparency
  6834. the more similar the pixel color is to the key color.
  6835. Range is 0.0 to 1.0. Default is @code{0.0}.
  6836. @end table
  6837. @subsection Examples
  6838. @itemize
  6839. @item
  6840. Make every green pixel in the input image transparent:
  6841. @example
  6842. ffmpeg -i input.png -vf colorkey=green out.png
  6843. @end example
  6844. @item
  6845. Overlay a greenscreen-video on top of a static background image.
  6846. @example
  6847. 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
  6848. @end example
  6849. @end itemize
  6850. @subsection Commands
  6851. This filter supports same @ref{commands} as options.
  6852. The command accepts the same syntax of the corresponding option.
  6853. If the specified expression is not valid, it is kept at its current
  6854. value.
  6855. @section colorhold
  6856. Remove all color information for all RGB colors except for certain one.
  6857. The filter accepts the following options:
  6858. @table @option
  6859. @item color
  6860. The color which will not be replaced with neutral gray.
  6861. @item similarity
  6862. Similarity percentage with the above color.
  6863. 0.01 matches only the exact key color, while 1.0 matches everything.
  6864. @item blend
  6865. Blend percentage. 0.0 makes pixels fully gray.
  6866. Higher values result in more preserved color.
  6867. @end table
  6868. @subsection Commands
  6869. This filter supports same @ref{commands} as options.
  6870. The command accepts the same syntax of the corresponding option.
  6871. If the specified expression is not valid, it is kept at its current
  6872. value.
  6873. @section colorlevels
  6874. Adjust video input frames using levels.
  6875. The filter accepts the following options:
  6876. @table @option
  6877. @item rimin
  6878. @item gimin
  6879. @item bimin
  6880. @item aimin
  6881. Adjust red, green, blue and alpha input black point.
  6882. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  6883. @item rimax
  6884. @item gimax
  6885. @item bimax
  6886. @item aimax
  6887. Adjust red, green, blue and alpha input white point.
  6888. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  6889. Input levels are used to lighten highlights (bright tones), darken shadows
  6890. (dark tones), change the balance of bright and dark tones.
  6891. @item romin
  6892. @item gomin
  6893. @item bomin
  6894. @item aomin
  6895. Adjust red, green, blue and alpha output black point.
  6896. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  6897. @item romax
  6898. @item gomax
  6899. @item bomax
  6900. @item aomax
  6901. Adjust red, green, blue and alpha output white point.
  6902. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  6903. Output levels allows manual selection of a constrained output level range.
  6904. @item preserve
  6905. Set preserve color mode. The accepted values are:
  6906. @table @samp
  6907. @item none
  6908. Disable color preserving, this is default.
  6909. @item lum
  6910. Preserve luminance.
  6911. @item max
  6912. Preserve max value of RGB triplet.
  6913. @item avg
  6914. Preserve average value of RGB triplet.
  6915. @item sum
  6916. Preserve sum value of RGB triplet.
  6917. @item nrm
  6918. Preserve normalized value of RGB triplet.
  6919. @item pwr
  6920. Preserve power value of RGB triplet.
  6921. @end table
  6922. @end table
  6923. @subsection Examples
  6924. @itemize
  6925. @item
  6926. Make video output darker:
  6927. @example
  6928. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  6929. @end example
  6930. @item
  6931. Increase contrast:
  6932. @example
  6933. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  6934. @end example
  6935. @item
  6936. Make video output lighter:
  6937. @example
  6938. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  6939. @end example
  6940. @item
  6941. Increase brightness:
  6942. @example
  6943. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  6944. @end example
  6945. @end itemize
  6946. @subsection Commands
  6947. This filter supports the all above options as @ref{commands}.
  6948. @section colormap
  6949. Apply custom color maps to video stream.
  6950. This filter needs three input video streams.
  6951. First stream is video stream that is going to be filtered out.
  6952. Second and third video stream specify color patches for source
  6953. color to target color mapping.
  6954. The filter accepts the following options:
  6955. @table @option
  6956. @item patch_size
  6957. Set the source and target video stream patch size in pixels.
  6958. @item nb_patches
  6959. Set the max number of used patches from source and target video stream.
  6960. @item type
  6961. Set the adjustments used for target colors. Can be @code{relative} or @code{absolute}.
  6962. Defaults is @code{absolute}.
  6963. @item kernel
  6964. Set the kernel used to measure color differences between mapped colors.
  6965. The accepted values are:
  6966. @table @samp
  6967. @item euclidean
  6968. @item weuclidean
  6969. @end table
  6970. Default is @code{euclidean}.
  6971. @end table
  6972. @section colormatrix
  6973. Convert color matrix.
  6974. The filter accepts the following options:
  6975. @table @option
  6976. @item src
  6977. @item dst
  6978. Specify the source and destination color matrix. Both values must be
  6979. specified.
  6980. The accepted values are:
  6981. @table @samp
  6982. @item bt709
  6983. BT.709
  6984. @item fcc
  6985. FCC
  6986. @item bt601
  6987. BT.601
  6988. @item bt470
  6989. BT.470
  6990. @item bt470bg
  6991. BT.470BG
  6992. @item smpte170m
  6993. SMPTE-170M
  6994. @item smpte240m
  6995. SMPTE-240M
  6996. @item bt2020
  6997. BT.2020
  6998. @end table
  6999. @end table
  7000. For example to convert from BT.601 to SMPTE-240M, use the command:
  7001. @example
  7002. colormatrix=bt601:smpte240m
  7003. @end example
  7004. @section colorspace
  7005. Convert colorspace, transfer characteristics or color primaries.
  7006. Input video needs to have an even size.
  7007. The filter accepts the following options:
  7008. @table @option
  7009. @anchor{all}
  7010. @item all
  7011. Specify all color properties at once.
  7012. The accepted values are:
  7013. @table @samp
  7014. @item bt470m
  7015. BT.470M
  7016. @item bt470bg
  7017. BT.470BG
  7018. @item bt601-6-525
  7019. BT.601-6 525
  7020. @item bt601-6-625
  7021. BT.601-6 625
  7022. @item bt709
  7023. BT.709
  7024. @item smpte170m
  7025. SMPTE-170M
  7026. @item smpte240m
  7027. SMPTE-240M
  7028. @item bt2020
  7029. BT.2020
  7030. @end table
  7031. @anchor{space}
  7032. @item space
  7033. Specify output colorspace.
  7034. The accepted values are:
  7035. @table @samp
  7036. @item bt709
  7037. BT.709
  7038. @item fcc
  7039. FCC
  7040. @item bt470bg
  7041. BT.470BG or BT.601-6 625
  7042. @item smpte170m
  7043. SMPTE-170M or BT.601-6 525
  7044. @item smpte240m
  7045. SMPTE-240M
  7046. @item ycgco
  7047. YCgCo
  7048. @item bt2020ncl
  7049. BT.2020 with non-constant luminance
  7050. @end table
  7051. @anchor{trc}
  7052. @item trc
  7053. Specify output transfer characteristics.
  7054. The accepted values are:
  7055. @table @samp
  7056. @item bt709
  7057. BT.709
  7058. @item bt470m
  7059. BT.470M
  7060. @item bt470bg
  7061. BT.470BG
  7062. @item gamma22
  7063. Constant gamma of 2.2
  7064. @item gamma28
  7065. Constant gamma of 2.8
  7066. @item smpte170m
  7067. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  7068. @item smpte240m
  7069. SMPTE-240M
  7070. @item srgb
  7071. SRGB
  7072. @item iec61966-2-1
  7073. iec61966-2-1
  7074. @item iec61966-2-4
  7075. iec61966-2-4
  7076. @item xvycc
  7077. xvycc
  7078. @item bt2020-10
  7079. BT.2020 for 10-bits content
  7080. @item bt2020-12
  7081. BT.2020 for 12-bits content
  7082. @end table
  7083. @anchor{primaries}
  7084. @item primaries
  7085. Specify output color primaries.
  7086. The accepted values are:
  7087. @table @samp
  7088. @item bt709
  7089. BT.709
  7090. @item bt470m
  7091. BT.470M
  7092. @item bt470bg
  7093. BT.470BG or BT.601-6 625
  7094. @item smpte170m
  7095. SMPTE-170M or BT.601-6 525
  7096. @item smpte240m
  7097. SMPTE-240M
  7098. @item film
  7099. film
  7100. @item smpte431
  7101. SMPTE-431
  7102. @item smpte432
  7103. SMPTE-432
  7104. @item bt2020
  7105. BT.2020
  7106. @item jedec-p22
  7107. JEDEC P22 phosphors
  7108. @end table
  7109. @anchor{range}
  7110. @item range
  7111. Specify output color range.
  7112. The accepted values are:
  7113. @table @samp
  7114. @item tv
  7115. TV (restricted) range
  7116. @item mpeg
  7117. MPEG (restricted) range
  7118. @item pc
  7119. PC (full) range
  7120. @item jpeg
  7121. JPEG (full) range
  7122. @end table
  7123. @item format
  7124. Specify output color format.
  7125. The accepted values are:
  7126. @table @samp
  7127. @item yuv420p
  7128. YUV 4:2:0 planar 8-bits
  7129. @item yuv420p10
  7130. YUV 4:2:0 planar 10-bits
  7131. @item yuv420p12
  7132. YUV 4:2:0 planar 12-bits
  7133. @item yuv422p
  7134. YUV 4:2:2 planar 8-bits
  7135. @item yuv422p10
  7136. YUV 4:2:2 planar 10-bits
  7137. @item yuv422p12
  7138. YUV 4:2:2 planar 12-bits
  7139. @item yuv444p
  7140. YUV 4:4:4 planar 8-bits
  7141. @item yuv444p10
  7142. YUV 4:4:4 planar 10-bits
  7143. @item yuv444p12
  7144. YUV 4:4:4 planar 12-bits
  7145. @end table
  7146. @item fast
  7147. Do a fast conversion, which skips gamma/primary correction. This will take
  7148. significantly less CPU, but will be mathematically incorrect. To get output
  7149. compatible with that produced by the colormatrix filter, use fast=1.
  7150. @item dither
  7151. Specify dithering mode.
  7152. The accepted values are:
  7153. @table @samp
  7154. @item none
  7155. No dithering
  7156. @item fsb
  7157. Floyd-Steinberg dithering
  7158. @end table
  7159. @item wpadapt
  7160. Whitepoint adaptation mode.
  7161. The accepted values are:
  7162. @table @samp
  7163. @item bradford
  7164. Bradford whitepoint adaptation
  7165. @item vonkries
  7166. von Kries whitepoint adaptation
  7167. @item identity
  7168. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  7169. @end table
  7170. @item iall
  7171. Override all input properties at once. Same accepted values as @ref{all}.
  7172. @item ispace
  7173. Override input colorspace. Same accepted values as @ref{space}.
  7174. @item iprimaries
  7175. Override input color primaries. Same accepted values as @ref{primaries}.
  7176. @item itrc
  7177. Override input transfer characteristics. Same accepted values as @ref{trc}.
  7178. @item irange
  7179. Override input color range. Same accepted values as @ref{range}.
  7180. @end table
  7181. The filter converts the transfer characteristics, color space and color
  7182. primaries to the specified user values. The output value, if not specified,
  7183. is set to a default value based on the "all" property. If that property is
  7184. also not specified, the filter will log an error. The output color range and
  7185. format default to the same value as the input color range and format. The
  7186. input transfer characteristics, color space, color primaries and color range
  7187. should be set on the input data. If any of these are missing, the filter will
  7188. log an error and no conversion will take place.
  7189. For example to convert the input to SMPTE-240M, use the command:
  7190. @example
  7191. colorspace=smpte240m
  7192. @end example
  7193. @section colortemperature
  7194. Adjust color temperature in video to simulate variations in ambient color temperature.
  7195. The filter accepts the following options:
  7196. @table @option
  7197. @item temperature
  7198. Set the temperature in Kelvin. Allowed range is from 1000 to 40000.
  7199. Default value is 6500 K.
  7200. @item mix
  7201. Set mixing with filtered output. Allowed range is from 0 to 1.
  7202. Default value is 1.
  7203. @item pl
  7204. Set the amount of preserving lightness. Allowed range is from 0 to 1.
  7205. Default value is 0.
  7206. @end table
  7207. @subsection Commands
  7208. This filter supports same @ref{commands} as options.
  7209. @section convolution
  7210. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  7211. The filter accepts the following options:
  7212. @table @option
  7213. @item 0m
  7214. @item 1m
  7215. @item 2m
  7216. @item 3m
  7217. Set matrix for each plane.
  7218. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  7219. and from 1 to 49 odd number of signed integers in @var{row} mode.
  7220. @item 0rdiv
  7221. @item 1rdiv
  7222. @item 2rdiv
  7223. @item 3rdiv
  7224. Set multiplier for calculated value for each plane.
  7225. If unset or 0, it will be sum of all matrix elements.
  7226. @item 0bias
  7227. @item 1bias
  7228. @item 2bias
  7229. @item 3bias
  7230. Set bias for each plane. This value is added to the result of the multiplication.
  7231. Useful for making the overall image brighter or darker. Default is 0.0.
  7232. @item 0mode
  7233. @item 1mode
  7234. @item 2mode
  7235. @item 3mode
  7236. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  7237. Default is @var{square}.
  7238. @end table
  7239. @subsection Commands
  7240. This filter supports the all above options as @ref{commands}.
  7241. @subsection Examples
  7242. @itemize
  7243. @item
  7244. Apply sharpen:
  7245. @example
  7246. 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"
  7247. @end example
  7248. @item
  7249. Apply blur:
  7250. @example
  7251. 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"
  7252. @end example
  7253. @item
  7254. Apply edge enhance:
  7255. @example
  7256. 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"
  7257. @end example
  7258. @item
  7259. Apply edge detect:
  7260. @example
  7261. 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"
  7262. @end example
  7263. @item
  7264. Apply laplacian edge detector which includes diagonals:
  7265. @example
  7266. 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"
  7267. @end example
  7268. @item
  7269. Apply emboss:
  7270. @example
  7271. 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"
  7272. @end example
  7273. @end itemize
  7274. @section convolve
  7275. Apply 2D convolution of video stream in frequency domain using second stream
  7276. as impulse.
  7277. The filter accepts the following options:
  7278. @table @option
  7279. @item planes
  7280. Set which planes to process.
  7281. @item impulse
  7282. Set which impulse video frames will be processed, can be @var{first}
  7283. or @var{all}. Default is @var{all}.
  7284. @end table
  7285. The @code{convolve} filter also supports the @ref{framesync} options.
  7286. @section copy
  7287. Copy the input video source unchanged to the output. This is mainly useful for
  7288. testing purposes.
  7289. @anchor{coreimage}
  7290. @section coreimage
  7291. Video filtering on GPU using Apple's CoreImage API on OSX.
  7292. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  7293. processed by video hardware. However, software-based OpenGL implementations
  7294. exist which means there is no guarantee for hardware processing. It depends on
  7295. the respective OSX.
  7296. There are many filters and image generators provided by Apple that come with a
  7297. large variety of options. The filter has to be referenced by its name along
  7298. with its options.
  7299. The coreimage filter accepts the following options:
  7300. @table @option
  7301. @item list_filters
  7302. List all available filters and generators along with all their respective
  7303. options as well as possible minimum and maximum values along with the default
  7304. values.
  7305. @example
  7306. list_filters=true
  7307. @end example
  7308. @item filter
  7309. Specify all filters by their respective name and options.
  7310. Use @var{list_filters} to determine all valid filter names and options.
  7311. Numerical options are specified by a float value and are automatically clamped
  7312. to their respective value range. Vector and color options have to be specified
  7313. by a list of space separated float values. Character escaping has to be done.
  7314. A special option name @code{default} is available to use default options for a
  7315. filter.
  7316. It is required to specify either @code{default} or at least one of the filter options.
  7317. All omitted options are used with their default values.
  7318. The syntax of the filter string is as follows:
  7319. @example
  7320. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  7321. @end example
  7322. @item output_rect
  7323. Specify a rectangle where the output of the filter chain is copied into the
  7324. input image. It is given by a list of space separated float values:
  7325. @example
  7326. output_rect=x\ y\ width\ height
  7327. @end example
  7328. If not given, the output rectangle equals the dimensions of the input image.
  7329. The output rectangle is automatically cropped at the borders of the input
  7330. image. Negative values are valid for each component.
  7331. @example
  7332. output_rect=25\ 25\ 100\ 100
  7333. @end example
  7334. @end table
  7335. Several filters can be chained for successive processing without GPU-HOST
  7336. transfers allowing for fast processing of complex filter chains.
  7337. Currently, only filters with zero (generators) or exactly one (filters) input
  7338. image and one output image are supported. Also, transition filters are not yet
  7339. usable as intended.
  7340. Some filters generate output images with additional padding depending on the
  7341. respective filter kernel. The padding is automatically removed to ensure the
  7342. filter output has the same size as the input image.
  7343. For image generators, the size of the output image is determined by the
  7344. previous output image of the filter chain or the input image of the whole
  7345. filterchain, respectively. The generators do not use the pixel information of
  7346. this image to generate their output. However, the generated output is
  7347. blended onto this image, resulting in partial or complete coverage of the
  7348. output image.
  7349. The @ref{coreimagesrc} video source can be used for generating input images
  7350. which are directly fed into the filter chain. By using it, providing input
  7351. images by another video source or an input video is not required.
  7352. @subsection Examples
  7353. @itemize
  7354. @item
  7355. List all filters available:
  7356. @example
  7357. coreimage=list_filters=true
  7358. @end example
  7359. @item
  7360. Use the CIBoxBlur filter with default options to blur an image:
  7361. @example
  7362. coreimage=filter=CIBoxBlur@@default
  7363. @end example
  7364. @item
  7365. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  7366. its center at 100x100 and a radius of 50 pixels:
  7367. @example
  7368. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  7369. @end example
  7370. @item
  7371. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  7372. given as complete and escaped command-line for Apple's standard bash shell:
  7373. @example
  7374. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  7375. @end example
  7376. @end itemize
  7377. @section cover_rect
  7378. Cover a rectangular object
  7379. It accepts the following options:
  7380. @table @option
  7381. @item cover
  7382. Filepath of the optional cover image, needs to be in yuv420.
  7383. @item mode
  7384. Set covering mode.
  7385. It accepts the following values:
  7386. @table @samp
  7387. @item cover
  7388. cover it by the supplied image
  7389. @item blur
  7390. cover it by interpolating the surrounding pixels
  7391. @end table
  7392. Default value is @var{blur}.
  7393. @end table
  7394. @subsection Examples
  7395. @itemize
  7396. @item
  7397. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  7398. @example
  7399. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7400. @end example
  7401. @end itemize
  7402. @section crop
  7403. Crop the input video to given dimensions.
  7404. It accepts the following parameters:
  7405. @table @option
  7406. @item w, out_w
  7407. The width of the output video. It defaults to @code{iw}.
  7408. This expression is evaluated only once during the filter
  7409. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  7410. @item h, out_h
  7411. The height of the output video. It defaults to @code{ih}.
  7412. This expression is evaluated only once during the filter
  7413. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  7414. @item x
  7415. The horizontal position, in the input video, of the left edge of the output
  7416. video. It defaults to @code{(in_w-out_w)/2}.
  7417. This expression is evaluated per-frame.
  7418. @item y
  7419. The vertical position, in the input video, of the top edge of the output video.
  7420. It defaults to @code{(in_h-out_h)/2}.
  7421. This expression is evaluated per-frame.
  7422. @item keep_aspect
  7423. If set to 1 will force the output display aspect ratio
  7424. to be the same of the input, by changing the output sample aspect
  7425. ratio. It defaults to 0.
  7426. @item exact
  7427. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  7428. width/height/x/y as specified and will not be rounded to nearest smaller value.
  7429. It defaults to 0.
  7430. @end table
  7431. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  7432. expressions containing the following constants:
  7433. @table @option
  7434. @item x
  7435. @item y
  7436. The computed values for @var{x} and @var{y}. They are evaluated for
  7437. each new frame.
  7438. @item in_w
  7439. @item in_h
  7440. The input width and height.
  7441. @item iw
  7442. @item ih
  7443. These are the same as @var{in_w} and @var{in_h}.
  7444. @item out_w
  7445. @item out_h
  7446. The output (cropped) width and height.
  7447. @item ow
  7448. @item oh
  7449. These are the same as @var{out_w} and @var{out_h}.
  7450. @item a
  7451. same as @var{iw} / @var{ih}
  7452. @item sar
  7453. input sample aspect ratio
  7454. @item dar
  7455. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  7456. @item hsub
  7457. @item vsub
  7458. horizontal and vertical chroma subsample values. For example for the
  7459. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7460. @item n
  7461. The number of the input frame, starting from 0.
  7462. @item pos
  7463. the position in the file of the input frame, NAN if unknown
  7464. @item t
  7465. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  7466. @end table
  7467. The expression for @var{out_w} may depend on the value of @var{out_h},
  7468. and the expression for @var{out_h} may depend on @var{out_w}, but they
  7469. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  7470. evaluated after @var{out_w} and @var{out_h}.
  7471. The @var{x} and @var{y} parameters specify the expressions for the
  7472. position of the top-left corner of the output (non-cropped) area. They
  7473. are evaluated for each frame. If the evaluated value is not valid, it
  7474. is approximated to the nearest valid value.
  7475. The expression for @var{x} may depend on @var{y}, and the expression
  7476. for @var{y} may depend on @var{x}.
  7477. @subsection Examples
  7478. @itemize
  7479. @item
  7480. Crop area with size 100x100 at position (12,34).
  7481. @example
  7482. crop=100:100:12:34
  7483. @end example
  7484. Using named options, the example above becomes:
  7485. @example
  7486. crop=w=100:h=100:x=12:y=34
  7487. @end example
  7488. @item
  7489. Crop the central input area with size 100x100:
  7490. @example
  7491. crop=100:100
  7492. @end example
  7493. @item
  7494. Crop the central input area with size 2/3 of the input video:
  7495. @example
  7496. crop=2/3*in_w:2/3*in_h
  7497. @end example
  7498. @item
  7499. Crop the input video central square:
  7500. @example
  7501. crop=out_w=in_h
  7502. crop=in_h
  7503. @end example
  7504. @item
  7505. Delimit the rectangle with the top-left corner placed at position
  7506. 100:100 and the right-bottom corner corresponding to the right-bottom
  7507. corner of the input image.
  7508. @example
  7509. crop=in_w-100:in_h-100:100:100
  7510. @end example
  7511. @item
  7512. Crop 10 pixels from the left and right borders, and 20 pixels from
  7513. the top and bottom borders
  7514. @example
  7515. crop=in_w-2*10:in_h-2*20
  7516. @end example
  7517. @item
  7518. Keep only the bottom right quarter of the input image:
  7519. @example
  7520. crop=in_w/2:in_h/2:in_w/2:in_h/2
  7521. @end example
  7522. @item
  7523. Crop height for getting Greek harmony:
  7524. @example
  7525. crop=in_w:1/PHI*in_w
  7526. @end example
  7527. @item
  7528. Apply trembling effect:
  7529. @example
  7530. 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)
  7531. @end example
  7532. @item
  7533. Apply erratic camera effect depending on timestamp:
  7534. @example
  7535. 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)"
  7536. @end example
  7537. @item
  7538. Set x depending on the value of y:
  7539. @example
  7540. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  7541. @end example
  7542. @end itemize
  7543. @subsection Commands
  7544. This filter supports the following commands:
  7545. @table @option
  7546. @item w, out_w
  7547. @item h, out_h
  7548. @item x
  7549. @item y
  7550. Set width/height of the output video and the horizontal/vertical position
  7551. in the input video.
  7552. The command accepts the same syntax of the corresponding option.
  7553. If the specified expression is not valid, it is kept at its current
  7554. value.
  7555. @end table
  7556. @section cropdetect
  7557. Auto-detect the crop size.
  7558. It calculates the necessary cropping parameters and prints the
  7559. recommended parameters via the logging system. The detected dimensions
  7560. correspond to the non-black area of the input video.
  7561. It accepts the following parameters:
  7562. @table @option
  7563. @item limit
  7564. Set higher black value threshold, which can be optionally specified
  7565. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  7566. value greater to the set value is considered non-black. It defaults to 24.
  7567. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  7568. on the bitdepth of the pixel format.
  7569. @item round
  7570. The value which the width/height should be divisible by. It defaults to
  7571. 16. The offset is automatically adjusted to center the video. Use 2 to
  7572. get only even dimensions (needed for 4:2:2 video). 16 is best when
  7573. encoding to most video codecs.
  7574. @item skip
  7575. Set the number of initial frames for which evaluation is skipped.
  7576. Default is 2. Range is 0 to INT_MAX.
  7577. @item reset_count, reset
  7578. Set the counter that determines after how many frames cropdetect will
  7579. reset the previously detected largest video area and start over to
  7580. detect the current optimal crop area. Default value is 0.
  7581. This can be useful when channel logos distort the video area. 0
  7582. indicates 'never reset', and returns the largest area encountered during
  7583. playback.
  7584. @end table
  7585. @anchor{cue}
  7586. @section cue
  7587. Delay video filtering until a given wallclock timestamp. The filter first
  7588. passes on @option{preroll} amount of frames, then it buffers at most
  7589. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  7590. it forwards the buffered frames and also any subsequent frames coming in its
  7591. input.
  7592. The filter can be used synchronize the output of multiple ffmpeg processes for
  7593. realtime output devices like decklink. By putting the delay in the filtering
  7594. chain and pre-buffering frames the process can pass on data to output almost
  7595. immediately after the target wallclock timestamp is reached.
  7596. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  7597. some use cases.
  7598. @table @option
  7599. @item cue
  7600. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  7601. @item preroll
  7602. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  7603. @item buffer
  7604. The maximum duration of content to buffer before waiting for the cue expressed
  7605. in seconds. Default is 0.
  7606. @end table
  7607. @anchor{curves}
  7608. @section curves
  7609. Apply color adjustments using curves.
  7610. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  7611. component (red, green and blue) has its values defined by @var{N} key points
  7612. tied from each other using a smooth curve. The x-axis represents the pixel
  7613. values from the input frame, and the y-axis the new pixel values to be set for
  7614. the output frame.
  7615. By default, a component curve is defined by the two points @var{(0;0)} and
  7616. @var{(1;1)}. This creates a straight line where each original pixel value is
  7617. "adjusted" to its own value, which means no change to the image.
  7618. The filter allows you to redefine these two points and add some more. A new
  7619. curve (using a natural cubic spline interpolation) will be define to pass
  7620. smoothly through all these new coordinates. The new defined points needs to be
  7621. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  7622. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  7623. the vector spaces, the values will be clipped accordingly.
  7624. The filter accepts the following options:
  7625. @table @option
  7626. @item preset
  7627. Select one of the available color presets. This option can be used in addition
  7628. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  7629. options takes priority on the preset values.
  7630. Available presets are:
  7631. @table @samp
  7632. @item none
  7633. @item color_negative
  7634. @item cross_process
  7635. @item darker
  7636. @item increase_contrast
  7637. @item lighter
  7638. @item linear_contrast
  7639. @item medium_contrast
  7640. @item negative
  7641. @item strong_contrast
  7642. @item vintage
  7643. @end table
  7644. Default is @code{none}.
  7645. @item master, m
  7646. Set the master key points. These points will define a second pass mapping. It
  7647. is sometimes called a "luminance" or "value" mapping. It can be used with
  7648. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  7649. post-processing LUT.
  7650. @item red, r
  7651. Set the key points for the red component.
  7652. @item green, g
  7653. Set the key points for the green component.
  7654. @item blue, b
  7655. Set the key points for the blue component.
  7656. @item all
  7657. Set the key points for all components (not including master).
  7658. Can be used in addition to the other key points component
  7659. options. In this case, the unset component(s) will fallback on this
  7660. @option{all} setting.
  7661. @item psfile
  7662. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  7663. @item plot
  7664. Save Gnuplot script of the curves in specified file.
  7665. @end table
  7666. To avoid some filtergraph syntax conflicts, each key points list need to be
  7667. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  7668. @subsection Commands
  7669. This filter supports same @ref{commands} as options.
  7670. @subsection Examples
  7671. @itemize
  7672. @item
  7673. Increase slightly the middle level of blue:
  7674. @example
  7675. curves=blue='0/0 0.5/0.58 1/1'
  7676. @end example
  7677. @item
  7678. Vintage effect:
  7679. @example
  7680. 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'
  7681. @end example
  7682. Here we obtain the following coordinates for each components:
  7683. @table @var
  7684. @item red
  7685. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  7686. @item green
  7687. @code{(0;0) (0.50;0.48) (1;1)}
  7688. @item blue
  7689. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  7690. @end table
  7691. @item
  7692. The previous example can also be achieved with the associated built-in preset:
  7693. @example
  7694. curves=preset=vintage
  7695. @end example
  7696. @item
  7697. Or simply:
  7698. @example
  7699. curves=vintage
  7700. @end example
  7701. @item
  7702. Use a Photoshop preset and redefine the points of the green component:
  7703. @example
  7704. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  7705. @end example
  7706. @item
  7707. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  7708. and @command{gnuplot}:
  7709. @example
  7710. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  7711. gnuplot -p /tmp/curves.plt
  7712. @end example
  7713. @end itemize
  7714. @section datascope
  7715. Video data analysis filter.
  7716. This filter shows hexadecimal pixel values of part of video.
  7717. The filter accepts the following options:
  7718. @table @option
  7719. @item size, s
  7720. Set output video size.
  7721. @item x
  7722. Set x offset from where to pick pixels.
  7723. @item y
  7724. Set y offset from where to pick pixels.
  7725. @item mode
  7726. Set scope mode, can be one of the following:
  7727. @table @samp
  7728. @item mono
  7729. Draw hexadecimal pixel values with white color on black background.
  7730. @item color
  7731. Draw hexadecimal pixel values with input video pixel color on black
  7732. background.
  7733. @item color2
  7734. Draw hexadecimal pixel values on color background picked from input video,
  7735. the text color is picked in such way so its always visible.
  7736. @end table
  7737. @item axis
  7738. Draw rows and columns numbers on left and top of video.
  7739. @item opacity
  7740. Set background opacity.
  7741. @item format
  7742. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  7743. @item components
  7744. Set pixel components to display. By default all pixel components are displayed.
  7745. @end table
  7746. @subsection Commands
  7747. This filter supports same @ref{commands} as options excluding @code{size} option.
  7748. @section dblur
  7749. Apply Directional blur filter.
  7750. The filter accepts the following options:
  7751. @table @option
  7752. @item angle
  7753. Set angle of directional blur. Default is @code{45}.
  7754. @item radius
  7755. Set radius of directional blur. Default is @code{5}.
  7756. @item planes
  7757. Set which planes to filter. By default all planes are filtered.
  7758. @end table
  7759. @subsection Commands
  7760. This filter supports same @ref{commands} as options.
  7761. The command accepts the same syntax of the corresponding option.
  7762. If the specified expression is not valid, it is kept at its current
  7763. value.
  7764. @section dctdnoiz
  7765. Denoise frames using 2D DCT (frequency domain filtering).
  7766. This filter is not designed for real time.
  7767. The filter accepts the following options:
  7768. @table @option
  7769. @item sigma, s
  7770. Set the noise sigma constant.
  7771. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  7772. coefficient (absolute value) below this threshold with be dropped.
  7773. If you need a more advanced filtering, see @option{expr}.
  7774. Default is @code{0}.
  7775. @item overlap
  7776. Set number overlapping pixels for each block. Since the filter can be slow, you
  7777. may want to reduce this value, at the cost of a less effective filter and the
  7778. risk of various artefacts.
  7779. If the overlapping value doesn't permit processing the whole input width or
  7780. height, a warning will be displayed and according borders won't be denoised.
  7781. Default value is @var{blocksize}-1, which is the best possible setting.
  7782. @item expr, e
  7783. Set the coefficient factor expression.
  7784. For each coefficient of a DCT block, this expression will be evaluated as a
  7785. multiplier value for the coefficient.
  7786. If this is option is set, the @option{sigma} option will be ignored.
  7787. The absolute value of the coefficient can be accessed through the @var{c}
  7788. variable.
  7789. @item n
  7790. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  7791. @var{blocksize}, which is the width and height of the processed blocks.
  7792. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  7793. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  7794. on the speed processing. Also, a larger block size does not necessarily means a
  7795. better de-noising.
  7796. @end table
  7797. @subsection Examples
  7798. Apply a denoise with a @option{sigma} of @code{4.5}:
  7799. @example
  7800. dctdnoiz=4.5
  7801. @end example
  7802. The same operation can be achieved using the expression system:
  7803. @example
  7804. dctdnoiz=e='gte(c, 4.5*3)'
  7805. @end example
  7806. Violent denoise using a block size of @code{16x16}:
  7807. @example
  7808. dctdnoiz=15:n=4
  7809. @end example
  7810. @section deband
  7811. Remove banding artifacts from input video.
  7812. It works by replacing banded pixels with average value of referenced pixels.
  7813. The filter accepts the following options:
  7814. @table @option
  7815. @item 1thr
  7816. @item 2thr
  7817. @item 3thr
  7818. @item 4thr
  7819. Set banding detection threshold for each plane. Default is 0.02.
  7820. Valid range is 0.00003 to 0.5.
  7821. If difference between current pixel and reference pixel is less than threshold,
  7822. it will be considered as banded.
  7823. @item range, r
  7824. Banding detection range in pixels. Default is 16. If positive, random number
  7825. in range 0 to set value will be used. If negative, exact absolute value
  7826. will be used.
  7827. The range defines square of four pixels around current pixel.
  7828. @item direction, d
  7829. Set direction in radians from which four pixel will be compared. If positive,
  7830. random direction from 0 to set direction will be picked. If negative, exact of
  7831. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  7832. will pick only pixels on same row and -PI/2 will pick only pixels on same
  7833. column.
  7834. @item blur, b
  7835. If enabled, current pixel is compared with average value of all four
  7836. surrounding pixels. The default is enabled. If disabled current pixel is
  7837. compared with all four surrounding pixels. The pixel is considered banded
  7838. if only all four differences with surrounding pixels are less than threshold.
  7839. @item coupling, c
  7840. If enabled, current pixel is changed if and only if all pixel components are banded,
  7841. e.g. banding detection threshold is triggered for all color components.
  7842. The default is disabled.
  7843. @end table
  7844. @subsection Commands
  7845. This filter supports the all above options as @ref{commands}.
  7846. @section deblock
  7847. Remove blocking artifacts from input video.
  7848. The filter accepts the following options:
  7849. @table @option
  7850. @item filter
  7851. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  7852. This controls what kind of deblocking is applied.
  7853. @item block
  7854. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  7855. @item alpha
  7856. @item beta
  7857. @item gamma
  7858. @item delta
  7859. Set blocking detection thresholds. Allowed range is 0 to 1.
  7860. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  7861. Using higher threshold gives more deblocking strength.
  7862. Setting @var{alpha} controls threshold detection at exact edge of block.
  7863. Remaining options controls threshold detection near the edge. Each one for
  7864. below/above or left/right. Setting any of those to @var{0} disables
  7865. deblocking.
  7866. @item planes
  7867. Set planes to filter. Default is to filter all available planes.
  7868. @end table
  7869. @subsection Examples
  7870. @itemize
  7871. @item
  7872. Deblock using weak filter and block size of 4 pixels.
  7873. @example
  7874. deblock=filter=weak:block=4
  7875. @end example
  7876. @item
  7877. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  7878. deblocking more edges.
  7879. @example
  7880. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  7881. @end example
  7882. @item
  7883. Similar as above, but filter only first plane.
  7884. @example
  7885. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  7886. @end example
  7887. @item
  7888. Similar as above, but filter only second and third plane.
  7889. @example
  7890. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  7891. @end example
  7892. @end itemize
  7893. @subsection Commands
  7894. This filter supports the all above options as @ref{commands}.
  7895. @anchor{decimate}
  7896. @section decimate
  7897. Drop duplicated frames at regular intervals.
  7898. The filter accepts the following options:
  7899. @table @option
  7900. @item cycle
  7901. Set the number of frames from which one will be dropped. Setting this to
  7902. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  7903. Default is @code{5}.
  7904. @item dupthresh
  7905. Set the threshold for duplicate detection. If the difference metric for a frame
  7906. is less than or equal to this value, then it is declared as duplicate. Default
  7907. is @code{1.1}
  7908. @item scthresh
  7909. Set scene change threshold. Default is @code{15}.
  7910. @item blockx
  7911. @item blocky
  7912. Set the size of the x and y-axis blocks used during metric calculations.
  7913. Larger blocks give better noise suppression, but also give worse detection of
  7914. small movements. Must be a power of two. Default is @code{32}.
  7915. @item ppsrc
  7916. Mark main input as a pre-processed input and activate clean source input
  7917. stream. This allows the input to be pre-processed with various filters to help
  7918. the metrics calculation while keeping the frame selection lossless. When set to
  7919. @code{1}, the first stream is for the pre-processed input, and the second
  7920. stream is the clean source from where the kept frames are chosen. Default is
  7921. @code{0}.
  7922. @item chroma
  7923. Set whether or not chroma is considered in the metric calculations. Default is
  7924. @code{1}.
  7925. @end table
  7926. @section deconvolve
  7927. Apply 2D deconvolution of video stream in frequency domain using second stream
  7928. as impulse.
  7929. The filter accepts the following options:
  7930. @table @option
  7931. @item planes
  7932. Set which planes to process.
  7933. @item impulse
  7934. Set which impulse video frames will be processed, can be @var{first}
  7935. or @var{all}. Default is @var{all}.
  7936. @item noise
  7937. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  7938. and height are not same and not power of 2 or if stream prior to convolving
  7939. had noise.
  7940. @end table
  7941. The @code{deconvolve} filter also supports the @ref{framesync} options.
  7942. @section dedot
  7943. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  7944. It accepts the following options:
  7945. @table @option
  7946. @item m
  7947. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  7948. @var{rainbows} for cross-color reduction.
  7949. @item lt
  7950. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  7951. @item tl
  7952. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  7953. @item tc
  7954. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  7955. @item ct
  7956. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  7957. @end table
  7958. @section deflate
  7959. Apply deflate effect to the video.
  7960. This filter replaces the pixel by the local(3x3) average by taking into account
  7961. only values lower than the pixel.
  7962. It accepts the following options:
  7963. @table @option
  7964. @item threshold0
  7965. @item threshold1
  7966. @item threshold2
  7967. @item threshold3
  7968. Limit the maximum change for each plane, default is 65535.
  7969. If 0, plane will remain unchanged.
  7970. @end table
  7971. @subsection Commands
  7972. This filter supports the all above options as @ref{commands}.
  7973. @section deflicker
  7974. Remove temporal frame luminance variations.
  7975. It accepts the following options:
  7976. @table @option
  7977. @item size, s
  7978. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  7979. @item mode, m
  7980. Set averaging mode to smooth temporal luminance variations.
  7981. Available values are:
  7982. @table @samp
  7983. @item am
  7984. Arithmetic mean
  7985. @item gm
  7986. Geometric mean
  7987. @item hm
  7988. Harmonic mean
  7989. @item qm
  7990. Quadratic mean
  7991. @item cm
  7992. Cubic mean
  7993. @item pm
  7994. Power mean
  7995. @item median
  7996. Median
  7997. @end table
  7998. @item bypass
  7999. Do not actually modify frame. Useful when one only wants metadata.
  8000. @end table
  8001. @section dejudder
  8002. Remove judder produced by partially interlaced telecined content.
  8003. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  8004. source was partially telecined content then the output of @code{pullup,dejudder}
  8005. will have a variable frame rate. May change the recorded frame rate of the
  8006. container. Aside from that change, this filter will not affect constant frame
  8007. rate video.
  8008. The option available in this filter is:
  8009. @table @option
  8010. @item cycle
  8011. Specify the length of the window over which the judder repeats.
  8012. Accepts any integer greater than 1. Useful values are:
  8013. @table @samp
  8014. @item 4
  8015. If the original was telecined from 24 to 30 fps (Film to NTSC).
  8016. @item 5
  8017. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  8018. @item 20
  8019. If a mixture of the two.
  8020. @end table
  8021. The default is @samp{4}.
  8022. @end table
  8023. @section delogo
  8024. Suppress a TV station logo by a simple interpolation of the surrounding
  8025. pixels. Just set a rectangle covering the logo and watch it disappear
  8026. (and sometimes something even uglier appear - your mileage may vary).
  8027. It accepts the following parameters:
  8028. @table @option
  8029. @item x
  8030. @item y
  8031. Specify the top left corner coordinates of the logo. They must be
  8032. specified.
  8033. @item w
  8034. @item h
  8035. Specify the width and height of the logo to clear. They must be
  8036. specified.
  8037. @item show
  8038. When set to 1, a green rectangle is drawn on the screen to simplify
  8039. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  8040. The default value is 0.
  8041. The rectangle is drawn on the outermost pixels which will be (partly)
  8042. replaced with interpolated values. The values of the next pixels
  8043. immediately outside this rectangle in each direction will be used to
  8044. compute the interpolated pixel values inside the rectangle.
  8045. @end table
  8046. @subsection Examples
  8047. @itemize
  8048. @item
  8049. Set a rectangle covering the area with top left corner coordinates 0,0
  8050. and size 100x77:
  8051. @example
  8052. delogo=x=0:y=0:w=100:h=77
  8053. @end example
  8054. @end itemize
  8055. @anchor{derain}
  8056. @section derain
  8057. Remove the rain in the input image/video by applying the derain methods based on
  8058. convolutional neural networks. Supported models:
  8059. @itemize
  8060. @item
  8061. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  8062. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  8063. @end itemize
  8064. Training as well as model generation scripts are provided in
  8065. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  8066. Native model files (.model) can be generated from TensorFlow model
  8067. files (.pb) by using tools/python/convert.py
  8068. The filter accepts the following options:
  8069. @table @option
  8070. @item filter_type
  8071. Specify which filter to use. This option accepts the following values:
  8072. @table @samp
  8073. @item derain
  8074. Derain filter. To conduct derain filter, you need to use a derain model.
  8075. @item dehaze
  8076. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  8077. @end table
  8078. Default value is @samp{derain}.
  8079. @item dnn_backend
  8080. Specify which DNN backend to use for model loading and execution. This option accepts
  8081. the following values:
  8082. @table @samp
  8083. @item native
  8084. Native implementation of DNN loading and execution.
  8085. @item tensorflow
  8086. TensorFlow backend. To enable this backend you
  8087. need to install the TensorFlow for C library (see
  8088. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  8089. @code{--enable-libtensorflow}
  8090. @end table
  8091. Default value is @samp{native}.
  8092. @item model
  8093. Set path to model file specifying network architecture and its parameters.
  8094. Note that different backends use different file formats. TensorFlow and native
  8095. backend can load files for only its format.
  8096. @end table
  8097. To get full functionality (such as async execution), please use the @ref{dnn_processing} filter.
  8098. @section deshake
  8099. Attempt to fix small changes in horizontal and/or vertical shift. This
  8100. filter helps remove camera shake from hand-holding a camera, bumping a
  8101. tripod, moving on a vehicle, etc.
  8102. The filter accepts the following options:
  8103. @table @option
  8104. @item x
  8105. @item y
  8106. @item w
  8107. @item h
  8108. Specify a rectangular area where to limit the search for motion
  8109. vectors.
  8110. If desired the search for motion vectors can be limited to a
  8111. rectangular area of the frame defined by its top left corner, width
  8112. and height. These parameters have the same meaning as the drawbox
  8113. filter which can be used to visualise the position of the bounding
  8114. box.
  8115. This is useful when simultaneous movement of subjects within the frame
  8116. might be confused for camera motion by the motion vector search.
  8117. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  8118. then the full frame is used. This allows later options to be set
  8119. without specifying the bounding box for the motion vector search.
  8120. Default - search the whole frame.
  8121. @item rx
  8122. @item ry
  8123. Specify the maximum extent of movement in x and y directions in the
  8124. range 0-64 pixels. Default 16.
  8125. @item edge
  8126. Specify how to generate pixels to fill blanks at the edge of the
  8127. frame. Available values are:
  8128. @table @samp
  8129. @item blank, 0
  8130. Fill zeroes at blank locations
  8131. @item original, 1
  8132. Original image at blank locations
  8133. @item clamp, 2
  8134. Extruded edge value at blank locations
  8135. @item mirror, 3
  8136. Mirrored edge at blank locations
  8137. @end table
  8138. Default value is @samp{mirror}.
  8139. @item blocksize
  8140. Specify the blocksize to use for motion search. Range 4-128 pixels,
  8141. default 8.
  8142. @item contrast
  8143. Specify the contrast threshold for blocks. Only blocks with more than
  8144. the specified contrast (difference between darkest and lightest
  8145. pixels) will be considered. Range 1-255, default 125.
  8146. @item search
  8147. Specify the search strategy. Available values are:
  8148. @table @samp
  8149. @item exhaustive, 0
  8150. Set exhaustive search
  8151. @item less, 1
  8152. Set less exhaustive search.
  8153. @end table
  8154. Default value is @samp{exhaustive}.
  8155. @item filename
  8156. If set then a detailed log of the motion search is written to the
  8157. specified file.
  8158. @end table
  8159. @section despill
  8160. Remove unwanted contamination of foreground colors, caused by reflected color of
  8161. greenscreen or bluescreen.
  8162. This filter accepts the following options:
  8163. @table @option
  8164. @item type
  8165. Set what type of despill to use.
  8166. @item mix
  8167. Set how spillmap will be generated.
  8168. @item expand
  8169. Set how much to get rid of still remaining spill.
  8170. @item red
  8171. Controls amount of red in spill area.
  8172. @item green
  8173. Controls amount of green in spill area.
  8174. Should be -1 for greenscreen.
  8175. @item blue
  8176. Controls amount of blue in spill area.
  8177. Should be -1 for bluescreen.
  8178. @item brightness
  8179. Controls brightness of spill area, preserving colors.
  8180. @item alpha
  8181. Modify alpha from generated spillmap.
  8182. @end table
  8183. @subsection Commands
  8184. This filter supports the all above options as @ref{commands}.
  8185. @section detelecine
  8186. Apply an exact inverse of the telecine operation. It requires a predefined
  8187. pattern specified using the pattern option which must be the same as that passed
  8188. to the telecine filter.
  8189. This filter accepts the following options:
  8190. @table @option
  8191. @item first_field
  8192. @table @samp
  8193. @item top, t
  8194. top field first
  8195. @item bottom, b
  8196. bottom field first
  8197. The default value is @code{top}.
  8198. @end table
  8199. @item pattern
  8200. A string of numbers representing the pulldown pattern you wish to apply.
  8201. The default value is @code{23}.
  8202. @item start_frame
  8203. A number representing position of the first frame with respect to the telecine
  8204. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  8205. @end table
  8206. @anchor{dilation}
  8207. @section dilation
  8208. Apply dilation effect to the video.
  8209. This filter replaces the pixel by the local(3x3) maximum.
  8210. It accepts the following options:
  8211. @table @option
  8212. @item threshold0
  8213. @item threshold1
  8214. @item threshold2
  8215. @item threshold3
  8216. Limit the maximum change for each plane, default is 65535.
  8217. If 0, plane will remain unchanged.
  8218. @item coordinates
  8219. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  8220. pixels are used.
  8221. Flags to local 3x3 coordinates maps like this:
  8222. 1 2 3
  8223. 4 5
  8224. 6 7 8
  8225. @end table
  8226. @subsection Commands
  8227. This filter supports the all above options as @ref{commands}.
  8228. @section displace
  8229. Displace pixels as indicated by second and third input stream.
  8230. It takes three input streams and outputs one stream, the first input is the
  8231. source, and second and third input are displacement maps.
  8232. The second input specifies how much to displace pixels along the
  8233. x-axis, while the third input specifies how much to displace pixels
  8234. along the y-axis.
  8235. If one of displacement map streams terminates, last frame from that
  8236. displacement map will be used.
  8237. Note that once generated, displacements maps can be reused over and over again.
  8238. A description of the accepted options follows.
  8239. @table @option
  8240. @item edge
  8241. Set displace behavior for pixels that are out of range.
  8242. Available values are:
  8243. @table @samp
  8244. @item blank
  8245. Missing pixels are replaced by black pixels.
  8246. @item smear
  8247. Adjacent pixels will spread out to replace missing pixels.
  8248. @item wrap
  8249. Out of range pixels are wrapped so they point to pixels of other side.
  8250. @item mirror
  8251. Out of range pixels will be replaced with mirrored pixels.
  8252. @end table
  8253. Default is @samp{smear}.
  8254. @end table
  8255. @subsection Examples
  8256. @itemize
  8257. @item
  8258. Add ripple effect to rgb input of video size hd720:
  8259. @example
  8260. 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
  8261. @end example
  8262. @item
  8263. Add wave effect to rgb input of video size hd720:
  8264. @example
  8265. 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
  8266. @end example
  8267. @end itemize
  8268. @section dnn_classify
  8269. Do classification with deep neural networks based on bounding boxes.
  8270. The filter accepts the following options:
  8271. @table @option
  8272. @item dnn_backend
  8273. Specify which DNN backend to use for model loading and execution. This option accepts
  8274. only openvino now, tensorflow backends will be added.
  8275. @item model
  8276. Set path to model file specifying network architecture and its parameters.
  8277. Note that different backends use different file formats.
  8278. @item input
  8279. Set the input name of the dnn network.
  8280. @item output
  8281. Set the output name of the dnn network.
  8282. @item confidence
  8283. Set the confidence threshold (default: 0.5).
  8284. @item labels
  8285. Set path to label file specifying the mapping between label id and name.
  8286. Each label name is written in one line, tailing spaces and empty lines are skipped.
  8287. The first line is the name of label id 0,
  8288. and the second line is the name of label id 1, etc.
  8289. The label id is considered as name if the label file is not provided.
  8290. @item backend_configs
  8291. Set the configs to be passed into backend
  8292. For tensorflow backend, you can set its configs with @option{sess_config} options,
  8293. please use tools/python/tf_sess_config.py to get the configs for your system.
  8294. @end table
  8295. @section dnn_detect
  8296. Do object detection with deep neural networks.
  8297. The filter accepts the following options:
  8298. @table @option
  8299. @item dnn_backend
  8300. Specify which DNN backend to use for model loading and execution. This option accepts
  8301. only openvino now, tensorflow backends will be added.
  8302. @item model
  8303. Set path to model file specifying network architecture and its parameters.
  8304. Note that different backends use different file formats.
  8305. @item input
  8306. Set the input name of the dnn network.
  8307. @item output
  8308. Set the output name of the dnn network.
  8309. @item confidence
  8310. Set the confidence threshold (default: 0.5).
  8311. @item labels
  8312. Set path to label file specifying the mapping between label id and name.
  8313. Each label name is written in one line, tailing spaces and empty lines are skipped.
  8314. The first line is the name of label id 0 (usually it is 'background'),
  8315. and the second line is the name of label id 1, etc.
  8316. The label id is considered as name if the label file is not provided.
  8317. @item backend_configs
  8318. Set the configs to be passed into backend. To use async execution, set async (default: set).
  8319. Roll back to sync execution if the backend does not support async.
  8320. @end table
  8321. @anchor{dnn_processing}
  8322. @section dnn_processing
  8323. Do image processing with deep neural networks. It works together with another filter
  8324. which converts the pixel format of the Frame to what the dnn network requires.
  8325. The filter accepts the following options:
  8326. @table @option
  8327. @item dnn_backend
  8328. Specify which DNN backend to use for model loading and execution. This option accepts
  8329. the following values:
  8330. @table @samp
  8331. @item native
  8332. Native implementation of DNN loading and execution.
  8333. @item tensorflow
  8334. TensorFlow backend. To enable this backend you
  8335. need to install the TensorFlow for C library (see
  8336. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  8337. @code{--enable-libtensorflow}
  8338. @item openvino
  8339. OpenVINO backend. To enable this backend you
  8340. need to build and install the OpenVINO for C library (see
  8341. @url{https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md}) and configure FFmpeg with
  8342. @code{--enable-libopenvino} (--extra-cflags=-I... --extra-ldflags=-L... might
  8343. be needed if the header files and libraries are not installed into system path)
  8344. @end table
  8345. Default value is @samp{native}.
  8346. @item model
  8347. Set path to model file specifying network architecture and its parameters.
  8348. Note that different backends use different file formats. TensorFlow, OpenVINO and native
  8349. backend can load files for only its format.
  8350. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  8351. @item input
  8352. Set the input name of the dnn network.
  8353. @item output
  8354. Set the output name of the dnn network.
  8355. @item backend_configs
  8356. Set the configs to be passed into backend. To use async execution, set async (default: set).
  8357. Roll back to sync execution if the backend does not support async.
  8358. For tensorflow backend, you can set its configs with @option{sess_config} options,
  8359. please use tools/python/tf_sess_config.py to get the configs of TensorFlow backend for your system.
  8360. @end table
  8361. @subsection Examples
  8362. @itemize
  8363. @item
  8364. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  8365. @example
  8366. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  8367. @end example
  8368. @item
  8369. Halve the pixel value of the frame with format gray32f:
  8370. @example
  8371. 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
  8372. @end example
  8373. @item
  8374. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  8375. @example
  8376. ./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
  8377. @end example
  8378. @item
  8379. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported),
  8380. please use tools/python/tf_sess_config.py to get the configs of TensorFlow backend for your system.
  8381. @example
  8382. ./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
  8383. @end example
  8384. @end itemize
  8385. @section drawbox
  8386. Draw a colored box on the input image.
  8387. It accepts the following parameters:
  8388. @table @option
  8389. @item x
  8390. @item y
  8391. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  8392. @item width, w
  8393. @item height, h
  8394. The expressions which specify the width and height of the box; if 0 they are interpreted as
  8395. the input width and height. It defaults to 0.
  8396. @item color, c
  8397. Specify the color of the box to write. For the general syntax of this option,
  8398. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  8399. value @code{invert} is used, the box edge color is the same as the
  8400. video with inverted luma.
  8401. @item thickness, t
  8402. The expression which sets the thickness of the box edge.
  8403. A value of @code{fill} will create a filled box. Default value is @code{3}.
  8404. See below for the list of accepted constants.
  8405. @item replace
  8406. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  8407. will overwrite the video's color and alpha pixels.
  8408. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  8409. @end table
  8410. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  8411. following constants:
  8412. @table @option
  8413. @item dar
  8414. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  8415. @item hsub
  8416. @item vsub
  8417. horizontal and vertical chroma subsample values. For example for the
  8418. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8419. @item in_h, ih
  8420. @item in_w, iw
  8421. The input width and height.
  8422. @item sar
  8423. The input sample aspect ratio.
  8424. @item x
  8425. @item y
  8426. The x and y offset coordinates where the box is drawn.
  8427. @item w
  8428. @item h
  8429. The width and height of the drawn box.
  8430. @item box_source
  8431. Box source can be set as side_data_detection_bboxes if you want to use box data in
  8432. detection bboxes of side data.
  8433. If @var{box_source} is set, the @var{x}, @var{y}, @var{width} and @var{height} will be ignored and
  8434. still use box data in detection bboxes of side data. So please do not use this parameter if you were
  8435. not sure about the box source.
  8436. @item t
  8437. The thickness of the drawn box.
  8438. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  8439. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  8440. @end table
  8441. @subsection Examples
  8442. @itemize
  8443. @item
  8444. Draw a black box around the edge of the input image:
  8445. @example
  8446. drawbox
  8447. @end example
  8448. @item
  8449. Draw a box with color red and an opacity of 50%:
  8450. @example
  8451. drawbox=10:20:200:60:red@@0.5
  8452. @end example
  8453. The previous example can be specified as:
  8454. @example
  8455. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  8456. @end example
  8457. @item
  8458. Fill the box with pink color:
  8459. @example
  8460. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  8461. @end example
  8462. @item
  8463. Draw a 2-pixel red 2.40:1 mask:
  8464. @example
  8465. 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
  8466. @end example
  8467. @end itemize
  8468. @subsection Commands
  8469. This filter supports same commands as options.
  8470. The command accepts the same syntax of the corresponding option.
  8471. If the specified expression is not valid, it is kept at its current
  8472. value.
  8473. @anchor{drawgraph}
  8474. @section drawgraph
  8475. Draw a graph using input video metadata.
  8476. It accepts the following parameters:
  8477. @table @option
  8478. @item m1
  8479. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  8480. @item fg1
  8481. Set 1st foreground color expression.
  8482. @item m2
  8483. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  8484. @item fg2
  8485. Set 2nd foreground color expression.
  8486. @item m3
  8487. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  8488. @item fg3
  8489. Set 3rd foreground color expression.
  8490. @item m4
  8491. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  8492. @item fg4
  8493. Set 4th foreground color expression.
  8494. @item min
  8495. Set minimal value of metadata value.
  8496. @item max
  8497. Set maximal value of metadata value.
  8498. @item bg
  8499. Set graph background color. Default is white.
  8500. @item mode
  8501. Set graph mode.
  8502. Available values for mode is:
  8503. @table @samp
  8504. @item bar
  8505. @item dot
  8506. @item line
  8507. @end table
  8508. Default is @code{line}.
  8509. @item slide
  8510. Set slide mode.
  8511. Available values for slide is:
  8512. @table @samp
  8513. @item frame
  8514. Draw new frame when right border is reached.
  8515. @item replace
  8516. Replace old columns with new ones.
  8517. @item scroll
  8518. Scroll from right to left.
  8519. @item rscroll
  8520. Scroll from left to right.
  8521. @item picture
  8522. Draw single picture.
  8523. @end table
  8524. Default is @code{frame}.
  8525. @item size
  8526. Set size of graph video. For the syntax of this option, check the
  8527. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8528. The default value is @code{900x256}.
  8529. @item rate, r
  8530. Set the output frame rate. Default value is @code{25}.
  8531. The foreground color expressions can use the following variables:
  8532. @table @option
  8533. @item MIN
  8534. Minimal value of metadata value.
  8535. @item MAX
  8536. Maximal value of metadata value.
  8537. @item VAL
  8538. Current metadata key value.
  8539. @end table
  8540. The color is defined as 0xAABBGGRR.
  8541. @end table
  8542. Example using metadata from @ref{signalstats} filter:
  8543. @example
  8544. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  8545. @end example
  8546. Example using metadata from @ref{ebur128} filter:
  8547. @example
  8548. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  8549. @end example
  8550. @section drawgrid
  8551. Draw a grid on the input image.
  8552. It accepts the following parameters:
  8553. @table @option
  8554. @item x
  8555. @item y
  8556. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  8557. @item width, w
  8558. @item height, h
  8559. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  8560. input width and height, respectively, minus @code{thickness}, so image gets
  8561. framed. Default to 0.
  8562. @item color, c
  8563. Specify the color of the grid. For the general syntax of this option,
  8564. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  8565. value @code{invert} is used, the grid color is the same as the
  8566. video with inverted luma.
  8567. @item thickness, t
  8568. The expression which sets the thickness of the grid line. Default value is @code{1}.
  8569. See below for the list of accepted constants.
  8570. @item replace
  8571. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  8572. will overwrite the video's color and alpha pixels.
  8573. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  8574. @end table
  8575. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  8576. following constants:
  8577. @table @option
  8578. @item dar
  8579. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  8580. @item hsub
  8581. @item vsub
  8582. horizontal and vertical chroma subsample values. For example for the
  8583. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8584. @item in_h, ih
  8585. @item in_w, iw
  8586. The input grid cell width and height.
  8587. @item sar
  8588. The input sample aspect ratio.
  8589. @item x
  8590. @item y
  8591. The x and y coordinates of some point of grid intersection (meant to configure offset).
  8592. @item w
  8593. @item h
  8594. The width and height of the drawn cell.
  8595. @item t
  8596. The thickness of the drawn cell.
  8597. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  8598. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  8599. @end table
  8600. @subsection Examples
  8601. @itemize
  8602. @item
  8603. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  8604. @example
  8605. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  8606. @end example
  8607. @item
  8608. Draw a white 3x3 grid with an opacity of 50%:
  8609. @example
  8610. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  8611. @end example
  8612. @end itemize
  8613. @subsection Commands
  8614. This filter supports same commands as options.
  8615. The command accepts the same syntax of the corresponding option.
  8616. If the specified expression is not valid, it is kept at its current
  8617. value.
  8618. @anchor{drawtext}
  8619. @section drawtext
  8620. Draw a text string or text from a specified file on top of a video, using the
  8621. libfreetype library.
  8622. To enable compilation of this filter, you need to configure FFmpeg with
  8623. @code{--enable-libfreetype}.
  8624. To enable default font fallback and the @var{font} option you need to
  8625. configure FFmpeg with @code{--enable-libfontconfig}.
  8626. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  8627. @code{--enable-libfribidi}.
  8628. @subsection Syntax
  8629. It accepts the following parameters:
  8630. @table @option
  8631. @item box
  8632. Used to draw a box around text using the background color.
  8633. The value must be either 1 (enable) or 0 (disable).
  8634. The default value of @var{box} is 0.
  8635. @item boxborderw
  8636. Set the width of the border to be drawn around the box using @var{boxcolor}.
  8637. The default value of @var{boxborderw} is 0.
  8638. @item boxcolor
  8639. The color to be used for drawing box around text. For the syntax of this
  8640. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8641. The default value of @var{boxcolor} is "white".
  8642. @item line_spacing
  8643. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  8644. The default value of @var{line_spacing} is 0.
  8645. @item borderw
  8646. Set the width of the border to be drawn around the text using @var{bordercolor}.
  8647. The default value of @var{borderw} is 0.
  8648. @item bordercolor
  8649. Set the color to be used for drawing border around text. For the syntax of this
  8650. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8651. The default value of @var{bordercolor} is "black".
  8652. @item expansion
  8653. Select how the @var{text} is expanded. Can be either @code{none},
  8654. @code{strftime} (deprecated) or
  8655. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  8656. below for details.
  8657. @item basetime
  8658. Set a start time for the count. Value is in microseconds. Only applied
  8659. in the deprecated strftime expansion mode. To emulate in normal expansion
  8660. mode use the @code{pts} function, supplying the start time (in seconds)
  8661. as the second argument.
  8662. @item fix_bounds
  8663. If true, check and fix text coords to avoid clipping.
  8664. @item fontcolor
  8665. The color to be used for drawing fonts. For the syntax of this option, check
  8666. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8667. The default value of @var{fontcolor} is "black".
  8668. @item fontcolor_expr
  8669. String which is expanded the same way as @var{text} to obtain dynamic
  8670. @var{fontcolor} value. By default this option has empty value and is not
  8671. processed. When this option is set, it overrides @var{fontcolor} option.
  8672. @item font
  8673. The font family to be used for drawing text. By default Sans.
  8674. @item fontfile
  8675. The font file to be used for drawing text. The path must be included.
  8676. This parameter is mandatory if the fontconfig support is disabled.
  8677. @item alpha
  8678. Draw the text applying alpha blending. The value can
  8679. be a number between 0.0 and 1.0.
  8680. The expression accepts the same variables @var{x, y} as well.
  8681. The default value is 1.
  8682. Please see @var{fontcolor_expr}.
  8683. @item fontsize
  8684. The font size to be used for drawing text.
  8685. The default value of @var{fontsize} is 16.
  8686. @item text_shaping
  8687. If set to 1, attempt to shape the text (for example, reverse the order of
  8688. right-to-left text and join Arabic characters) before drawing it.
  8689. Otherwise, just draw the text exactly as given.
  8690. By default 1 (if supported).
  8691. @item ft_load_flags
  8692. The flags to be used for loading the fonts.
  8693. The flags map the corresponding flags supported by libfreetype, and are
  8694. a combination of the following values:
  8695. @table @var
  8696. @item default
  8697. @item no_scale
  8698. @item no_hinting
  8699. @item render
  8700. @item no_bitmap
  8701. @item vertical_layout
  8702. @item force_autohint
  8703. @item crop_bitmap
  8704. @item pedantic
  8705. @item ignore_global_advance_width
  8706. @item no_recurse
  8707. @item ignore_transform
  8708. @item monochrome
  8709. @item linear_design
  8710. @item no_autohint
  8711. @end table
  8712. Default value is "default".
  8713. For more information consult the documentation for the FT_LOAD_*
  8714. libfreetype flags.
  8715. @item shadowcolor
  8716. The color to be used for drawing a shadow behind the drawn text. For the
  8717. syntax of this option, check the @ref{color syntax,,"Color" section in the
  8718. ffmpeg-utils manual,ffmpeg-utils}.
  8719. The default value of @var{shadowcolor} is "black".
  8720. @item shadowx
  8721. @item shadowy
  8722. The x and y offsets for the text shadow position with respect to the
  8723. position of the text. They can be either positive or negative
  8724. values. The default value for both is "0".
  8725. @item start_number
  8726. The starting frame number for the n/frame_num variable. The default value
  8727. is "0".
  8728. @item tabsize
  8729. The size in number of spaces to use for rendering the tab.
  8730. Default value is 4.
  8731. @item timecode
  8732. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  8733. format. It can be used with or without text parameter. @var{timecode_rate}
  8734. option must be specified.
  8735. @item timecode_rate, rate, r
  8736. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  8737. integer. Minimum value is "1".
  8738. Drop-frame timecode is supported for frame rates 30 & 60.
  8739. @item tc24hmax
  8740. If set to 1, the output of the timecode option will wrap around at 24 hours.
  8741. Default is 0 (disabled).
  8742. @item text
  8743. The text string to be drawn. The text must be a sequence of UTF-8
  8744. encoded characters.
  8745. This parameter is mandatory if no file is specified with the parameter
  8746. @var{textfile}.
  8747. @item textfile
  8748. A text file containing text to be drawn. The text must be a sequence
  8749. of UTF-8 encoded characters.
  8750. This parameter is mandatory if no text string is specified with the
  8751. parameter @var{text}.
  8752. If both @var{text} and @var{textfile} are specified, an error is thrown.
  8753. @item text_source
  8754. Text source should be set as side_data_detection_bboxes if you want to use text data in
  8755. detection bboxes of side data.
  8756. If text source is set, @var{text} and @var{textfile} will be ignored and still use
  8757. text data in detection bboxes of side data. So please do not use this parameter
  8758. if you are not sure about the text source.
  8759. @item reload
  8760. The @var{textfile} will be reloaded at specified frame interval.
  8761. Be sure to update @var{textfile} atomically, or it may be read partially,
  8762. or even fail.
  8763. Range is 0 to INT_MAX. Default is 0.
  8764. @item x
  8765. @item y
  8766. The expressions which specify the offsets where text will be drawn
  8767. within the video frame. They are relative to the top/left border of the
  8768. output image.
  8769. The default value of @var{x} and @var{y} is "0".
  8770. See below for the list of accepted constants and functions.
  8771. @end table
  8772. The parameters for @var{x} and @var{y} are expressions containing the
  8773. following constants and functions:
  8774. @table @option
  8775. @item dar
  8776. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  8777. @item hsub
  8778. @item vsub
  8779. horizontal and vertical chroma subsample values. For example for the
  8780. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8781. @item line_h, lh
  8782. the height of each text line
  8783. @item main_h, h, H
  8784. the input height
  8785. @item main_w, w, W
  8786. the input width
  8787. @item max_glyph_a, ascent
  8788. the maximum distance from the baseline to the highest/upper grid
  8789. coordinate used to place a glyph outline point, for all the rendered
  8790. glyphs.
  8791. It is a positive value, due to the grid's orientation with the Y axis
  8792. upwards.
  8793. @item max_glyph_d, descent
  8794. the maximum distance from the baseline to the lowest grid coordinate
  8795. used to place a glyph outline point, for all the rendered glyphs.
  8796. This is a negative value, due to the grid's orientation, with the Y axis
  8797. upwards.
  8798. @item max_glyph_h
  8799. maximum glyph height, that is the maximum height for all the glyphs
  8800. contained in the rendered text, it is equivalent to @var{ascent} -
  8801. @var{descent}.
  8802. @item max_glyph_w
  8803. maximum glyph width, that is the maximum width for all the glyphs
  8804. contained in the rendered text
  8805. @item n
  8806. the number of input frame, starting from 0
  8807. @item rand(min, max)
  8808. return a random number included between @var{min} and @var{max}
  8809. @item sar
  8810. The input sample aspect ratio.
  8811. @item t
  8812. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8813. @item text_h, th
  8814. the height of the rendered text
  8815. @item text_w, tw
  8816. the width of the rendered text
  8817. @item x
  8818. @item y
  8819. the x and y offset coordinates where the text is drawn.
  8820. These parameters allow the @var{x} and @var{y} expressions to refer
  8821. to each other, so you can for example specify @code{y=x/dar}.
  8822. @item pict_type
  8823. A one character description of the current frame's picture type.
  8824. @item pkt_pos
  8825. The current packet's position in the input file or stream
  8826. (in bytes, from the start of the input). A value of -1 indicates
  8827. this info is not available.
  8828. @item pkt_duration
  8829. The current packet's duration, in seconds.
  8830. @item pkt_size
  8831. The current packet's size (in bytes).
  8832. @end table
  8833. @anchor{drawtext_expansion}
  8834. @subsection Text expansion
  8835. If @option{expansion} is set to @code{strftime},
  8836. the filter recognizes strftime() sequences in the provided text and
  8837. expands them accordingly. Check the documentation of strftime(). This
  8838. feature is deprecated.
  8839. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  8840. If @option{expansion} is set to @code{normal} (which is the default),
  8841. the following expansion mechanism is used.
  8842. The backslash character @samp{\}, followed by any character, always expands to
  8843. the second character.
  8844. Sequences of the form @code{%@{...@}} are expanded. The text between the
  8845. braces is a function name, possibly followed by arguments separated by ':'.
  8846. If the arguments contain special characters or delimiters (':' or '@}'),
  8847. they should be escaped.
  8848. Note that they probably must also be escaped as the value for the
  8849. @option{text} option in the filter argument string and as the filter
  8850. argument in the filtergraph description, and possibly also for the shell,
  8851. that makes up to four levels of escaping; using a text file avoids these
  8852. problems.
  8853. The following functions are available:
  8854. @table @command
  8855. @item expr, e
  8856. The expression evaluation result.
  8857. It must take one argument specifying the expression to be evaluated,
  8858. which accepts the same constants and functions as the @var{x} and
  8859. @var{y} values. Note that not all constants should be used, for
  8860. example the text size is not known when evaluating the expression, so
  8861. the constants @var{text_w} and @var{text_h} will have an undefined
  8862. value.
  8863. @item expr_int_format, eif
  8864. Evaluate the expression's value and output as formatted integer.
  8865. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  8866. The second argument specifies the output format. Allowed values are @samp{x},
  8867. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  8868. @code{printf} function.
  8869. The third parameter is optional and sets the number of positions taken by the output.
  8870. It can be used to add padding with zeros from the left.
  8871. @item gmtime
  8872. The time at which the filter is running, expressed in UTC.
  8873. It can accept an argument: a strftime() format string.
  8874. The format string is extended to support the variable @var{%[1-6]N}
  8875. which prints fractions of the second with optionally specified number of digits.
  8876. @item localtime
  8877. The time at which the filter is running, expressed in the local time zone.
  8878. It can accept an argument: a strftime() format string.
  8879. The format string is extended to support the variable @var{%[1-6]N}
  8880. which prints fractions of the second with optionally specified number of digits.
  8881. @item metadata
  8882. Frame metadata. Takes one or two arguments.
  8883. The first argument is mandatory and specifies the metadata key.
  8884. The second argument is optional and specifies a default value, used when the
  8885. metadata key is not found or empty.
  8886. Available metadata can be identified by inspecting entries
  8887. starting with TAG included within each frame section
  8888. printed by running @code{ffprobe -show_frames}.
  8889. String metadata generated in filters leading to
  8890. the drawtext filter are also available.
  8891. @item n, frame_num
  8892. The frame number, starting from 0.
  8893. @item pict_type
  8894. A one character description of the current picture type.
  8895. @item pts
  8896. The timestamp of the current frame.
  8897. It can take up to three arguments.
  8898. The first argument is the format of the timestamp; it defaults to @code{flt}
  8899. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  8900. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  8901. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  8902. @code{localtime} stands for the timestamp of the frame formatted as
  8903. local time zone time.
  8904. The second argument is an offset added to the timestamp.
  8905. If the format is set to @code{hms}, a third argument @code{24HH} may be
  8906. supplied to present the hour part of the formatted timestamp in 24h format
  8907. (00-23).
  8908. If the format is set to @code{localtime} or @code{gmtime},
  8909. a third argument may be supplied: a strftime() format string.
  8910. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  8911. @end table
  8912. @subsection Commands
  8913. This filter supports altering parameters via commands:
  8914. @table @option
  8915. @item reinit
  8916. Alter existing filter parameters.
  8917. Syntax for the argument is the same as for filter invocation, e.g.
  8918. @example
  8919. fontsize=56:fontcolor=green:text='Hello World'
  8920. @end example
  8921. Full filter invocation with sendcmd would look like this:
  8922. @example
  8923. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  8924. @end example
  8925. @end table
  8926. If the entire argument can't be parsed or applied as valid values then the filter will
  8927. continue with its existing parameters.
  8928. @subsection Examples
  8929. @itemize
  8930. @item
  8931. Draw "Test Text" with font FreeSerif, using the default values for the
  8932. optional parameters.
  8933. @example
  8934. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  8935. @end example
  8936. @item
  8937. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  8938. and y=50 (counting from the top-left corner of the screen), text is
  8939. yellow with a red box around it. Both the text and the box have an
  8940. opacity of 20%.
  8941. @example
  8942. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  8943. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  8944. @end example
  8945. Note that the double quotes are not necessary if spaces are not used
  8946. within the parameter list.
  8947. @item
  8948. Show the text at the center of the video frame:
  8949. @example
  8950. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  8951. @end example
  8952. @item
  8953. Show the text at a random position, switching to a new position every 30 seconds:
  8954. @example
  8955. 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)"
  8956. @end example
  8957. @item
  8958. Show a text line sliding from right to left in the last row of the video
  8959. frame. The file @file{LONG_LINE} is assumed to contain a single line
  8960. with no newlines.
  8961. @example
  8962. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  8963. @end example
  8964. @item
  8965. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  8966. @example
  8967. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  8968. @end example
  8969. @item
  8970. Draw a single green letter "g", at the center of the input video.
  8971. The glyph baseline is placed at half screen height.
  8972. @example
  8973. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  8974. @end example
  8975. @item
  8976. Show text for 1 second every 3 seconds:
  8977. @example
  8978. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  8979. @end example
  8980. @item
  8981. Use fontconfig to set the font. Note that the colons need to be escaped.
  8982. @example
  8983. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  8984. @end example
  8985. @item
  8986. Draw "Test Text" with font size dependent on height of the video.
  8987. @example
  8988. drawtext="text='Test Text': fontsize=h/30: x=(w-text_w)/2: y=(h-text_h*2)"
  8989. @end example
  8990. @item
  8991. Print the date of a real-time encoding (see strftime(3)):
  8992. @example
  8993. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  8994. @end example
  8995. @item
  8996. Show text fading in and out (appearing/disappearing):
  8997. @example
  8998. #!/bin/sh
  8999. DS=1.0 # display start
  9000. DE=10.0 # display end
  9001. FID=1.5 # fade in duration
  9002. FOD=5 # fade out duration
  9003. 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 @}"
  9004. @end example
  9005. @item
  9006. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  9007. and the @option{fontsize} value are included in the @option{y} offset.
  9008. @example
  9009. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  9010. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  9011. @end example
  9012. @item
  9013. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  9014. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  9015. must have option @option{-export_path_metadata 1} for the special metadata fields
  9016. to be available for filters.
  9017. @example
  9018. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  9019. @end example
  9020. @end itemize
  9021. For more information about libfreetype, check:
  9022. @url{http://www.freetype.org/}.
  9023. For more information about fontconfig, check:
  9024. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  9025. For more information about libfribidi, check:
  9026. @url{http://fribidi.org/}.
  9027. @section edgedetect
  9028. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  9029. The filter accepts the following options:
  9030. @table @option
  9031. @item low
  9032. @item high
  9033. Set low and high threshold values used by the Canny thresholding
  9034. algorithm.
  9035. The high threshold selects the "strong" edge pixels, which are then
  9036. connected through 8-connectivity with the "weak" edge pixels selected
  9037. by the low threshold.
  9038. @var{low} and @var{high} threshold values must be chosen in the range
  9039. [0,1], and @var{low} should be lesser or equal to @var{high}.
  9040. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  9041. is @code{50/255}.
  9042. @item mode
  9043. Define the drawing mode.
  9044. @table @samp
  9045. @item wires
  9046. Draw white/gray wires on black background.
  9047. @item colormix
  9048. Mix the colors to create a paint/cartoon effect.
  9049. @item canny
  9050. Apply Canny edge detector on all selected planes.
  9051. @end table
  9052. Default value is @var{wires}.
  9053. @item planes
  9054. Select planes for filtering. By default all available planes are filtered.
  9055. @end table
  9056. @subsection Examples
  9057. @itemize
  9058. @item
  9059. Standard edge detection with custom values for the hysteresis thresholding:
  9060. @example
  9061. edgedetect=low=0.1:high=0.4
  9062. @end example
  9063. @item
  9064. Painting effect without thresholding:
  9065. @example
  9066. edgedetect=mode=colormix:high=0
  9067. @end example
  9068. @end itemize
  9069. @section elbg
  9070. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  9071. For each input image, the filter will compute the optimal mapping from
  9072. the input to the output given the codebook length, that is the number
  9073. of distinct output colors.
  9074. This filter accepts the following options.
  9075. @table @option
  9076. @item codebook_length, l
  9077. Set codebook length. The value must be a positive integer, and
  9078. represents the number of distinct output colors. Default value is 256.
  9079. @item nb_steps, n
  9080. Set the maximum number of iterations to apply for computing the optimal
  9081. mapping. The higher the value the better the result and the higher the
  9082. computation time. Default value is 1.
  9083. @item seed, s
  9084. Set a random seed, must be an integer included between 0 and
  9085. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  9086. will try to use a good random seed on a best effort basis.
  9087. @item pal8
  9088. Set pal8 output pixel format. This option does not work with codebook
  9089. length greater than 256. Default is disabled.
  9090. @item use_alpha
  9091. Include alpha values in the quantization calculation. Allows creating
  9092. palettized output images (e.g. PNG8) with multiple alpha smooth blending.
  9093. @end table
  9094. @section entropy
  9095. Measure graylevel entropy in histogram of color channels of video frames.
  9096. It accepts the following parameters:
  9097. @table @option
  9098. @item mode
  9099. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  9100. @var{diff} mode measures entropy of histogram delta values, absolute differences
  9101. between neighbour histogram values.
  9102. @end table
  9103. @section epx
  9104. Apply the EPX magnification filter which is designed for pixel art.
  9105. It accepts the following option:
  9106. @table @option
  9107. @item n
  9108. Set the scaling dimension: @code{2} for @code{2xEPX}, @code{3} for
  9109. @code{3xEPX}.
  9110. Default is @code{3}.
  9111. @end table
  9112. @section eq
  9113. Set brightness, contrast, saturation and approximate gamma adjustment.
  9114. The filter accepts the following options:
  9115. @table @option
  9116. @item contrast
  9117. Set the contrast expression. The value must be a float value in range
  9118. @code{-1000.0} to @code{1000.0}. The default value is "1".
  9119. @item brightness
  9120. Set the brightness expression. The value must be a float value in
  9121. range @code{-1.0} to @code{1.0}. The default value is "0".
  9122. @item saturation
  9123. Set the saturation expression. The value must be a float in
  9124. range @code{0.0} to @code{3.0}. The default value is "1".
  9125. @item gamma
  9126. Set the gamma expression. The value must be a float in range
  9127. @code{0.1} to @code{10.0}. The default value is "1".
  9128. @item gamma_r
  9129. Set the gamma expression for red. The value must be a float in
  9130. range @code{0.1} to @code{10.0}. The default value is "1".
  9131. @item gamma_g
  9132. Set the gamma expression for green. The value must be a float in range
  9133. @code{0.1} to @code{10.0}. The default value is "1".
  9134. @item gamma_b
  9135. Set the gamma expression for blue. The value must be a float in range
  9136. @code{0.1} to @code{10.0}. The default value is "1".
  9137. @item gamma_weight
  9138. Set the gamma weight expression. It can be used to reduce the effect
  9139. of a high gamma value on bright image areas, e.g. keep them from
  9140. getting overamplified and just plain white. The value must be a float
  9141. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  9142. gamma correction all the way down while @code{1.0} leaves it at its
  9143. full strength. Default is "1".
  9144. @item eval
  9145. Set when the expressions for brightness, contrast, saturation and
  9146. gamma expressions are evaluated.
  9147. It accepts the following values:
  9148. @table @samp
  9149. @item init
  9150. only evaluate expressions once during the filter initialization or
  9151. when a command is processed
  9152. @item frame
  9153. evaluate expressions for each incoming frame
  9154. @end table
  9155. Default value is @samp{init}.
  9156. @end table
  9157. The expressions accept the following parameters:
  9158. @table @option
  9159. @item n
  9160. frame count of the input frame starting from 0
  9161. @item pos
  9162. byte position of the corresponding packet in the input file, NAN if
  9163. unspecified
  9164. @item r
  9165. frame rate of the input video, NAN if the input frame rate is unknown
  9166. @item t
  9167. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9168. @end table
  9169. @subsection Commands
  9170. The filter supports the following commands:
  9171. @table @option
  9172. @item contrast
  9173. Set the contrast expression.
  9174. @item brightness
  9175. Set the brightness expression.
  9176. @item saturation
  9177. Set the saturation expression.
  9178. @item gamma
  9179. Set the gamma expression.
  9180. @item gamma_r
  9181. Set the gamma_r expression.
  9182. @item gamma_g
  9183. Set gamma_g expression.
  9184. @item gamma_b
  9185. Set gamma_b expression.
  9186. @item gamma_weight
  9187. Set gamma_weight expression.
  9188. The command accepts the same syntax of the corresponding option.
  9189. If the specified expression is not valid, it is kept at its current
  9190. value.
  9191. @end table
  9192. @anchor{erosion}
  9193. @section erosion
  9194. Apply erosion effect to the video.
  9195. This filter replaces the pixel by the local(3x3) minimum.
  9196. It accepts the following options:
  9197. @table @option
  9198. @item threshold0
  9199. @item threshold1
  9200. @item threshold2
  9201. @item threshold3
  9202. Limit the maximum change for each plane, default is 65535.
  9203. If 0, plane will remain unchanged.
  9204. @item coordinates
  9205. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  9206. pixels are used.
  9207. Flags to local 3x3 coordinates maps like this:
  9208. 1 2 3
  9209. 4 5
  9210. 6 7 8
  9211. @end table
  9212. @subsection Commands
  9213. This filter supports the all above options as @ref{commands}.
  9214. @section estdif
  9215. Deinterlace the input video ("estdif" stands for "Edge Slope
  9216. Tracing Deinterlacing Filter").
  9217. Spatial only filter that uses edge slope tracing algorithm
  9218. to interpolate missing lines.
  9219. It accepts the following parameters:
  9220. @table @option
  9221. @item mode
  9222. The interlacing mode to adopt. It accepts one of the following values:
  9223. @table @option
  9224. @item frame
  9225. Output one frame for each frame.
  9226. @item field
  9227. Output one frame for each field.
  9228. @end table
  9229. The default value is @code{field}.
  9230. @item parity
  9231. The picture field parity assumed for the input interlaced video. It accepts one
  9232. of the following values:
  9233. @table @option
  9234. @item tff
  9235. Assume the top field is first.
  9236. @item bff
  9237. Assume the bottom field is first.
  9238. @item auto
  9239. Enable automatic detection of field parity.
  9240. @end table
  9241. The default value is @code{auto}.
  9242. If the interlacing is unknown or the decoder does not export this information,
  9243. top field first will be assumed.
  9244. @item deint
  9245. Specify which frames to deinterlace. Accepts one of the following
  9246. values:
  9247. @table @option
  9248. @item all
  9249. Deinterlace all frames.
  9250. @item interlaced
  9251. Only deinterlace frames marked as interlaced.
  9252. @end table
  9253. The default value is @code{all}.
  9254. @item rslope
  9255. Specify the search radius for edge slope tracing. Default value is 1.
  9256. Allowed range is from 1 to 15.
  9257. @item redge
  9258. Specify the search radius for best edge matching. Default value is 2.
  9259. Allowed range is from 0 to 15.
  9260. @item ecost
  9261. Specify the edge cost for edge matching. Default value is 0.03125.
  9262. Allowed range is from 0 to 1.
  9263. @item mcost
  9264. Specify the middle cost for edge matching. Default value is 0.5.
  9265. Allowed range is from 0 to 1.
  9266. @item dcost
  9267. Specify the distance cost for edge matching. Default value is 0.5.
  9268. Allowed range is from 0 to 1.
  9269. @item interp
  9270. Specify the interpolation used. Default is 4-point interpolation. It accepts one
  9271. of the following values:
  9272. @table @option
  9273. @item 2p
  9274. Two-point interpolation.
  9275. @item 4p
  9276. Four-point interpolation.
  9277. @item 6p
  9278. Six-point interpolation.
  9279. @end table
  9280. @end table
  9281. @subsection Commands
  9282. This filter supports same @ref{commands} as options.
  9283. @section exposure
  9284. Adjust exposure of the video stream.
  9285. The filter accepts the following options:
  9286. @table @option
  9287. @item exposure
  9288. Set the exposure correction in EV. Allowed range is from -3.0 to 3.0 EV
  9289. Default value is 0 EV.
  9290. @item black
  9291. Set the black level correction. Allowed range is from -1.0 to 1.0.
  9292. Default value is 0.
  9293. @end table
  9294. @subsection Commands
  9295. This filter supports same @ref{commands} as options.
  9296. @section extractplanes
  9297. Extract color channel components from input video stream into
  9298. separate grayscale video streams.
  9299. The filter accepts the following option:
  9300. @table @option
  9301. @item planes
  9302. Set plane(s) to extract.
  9303. Available values for planes are:
  9304. @table @samp
  9305. @item y
  9306. @item u
  9307. @item v
  9308. @item a
  9309. @item r
  9310. @item g
  9311. @item b
  9312. @end table
  9313. Choosing planes not available in the input will result in an error.
  9314. That means you cannot select @code{r}, @code{g}, @code{b} planes
  9315. with @code{y}, @code{u}, @code{v} planes at same time.
  9316. @end table
  9317. @subsection Examples
  9318. @itemize
  9319. @item
  9320. Extract luma, u and v color channel component from input video frame
  9321. into 3 grayscale outputs:
  9322. @example
  9323. 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
  9324. @end example
  9325. @end itemize
  9326. @section fade
  9327. Apply a fade-in/out effect to the input video.
  9328. It accepts the following parameters:
  9329. @table @option
  9330. @item type, t
  9331. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  9332. effect.
  9333. Default is @code{in}.
  9334. @item start_frame, s
  9335. Specify the number of the frame to start applying the fade
  9336. effect at. Default is 0.
  9337. @item nb_frames, n
  9338. The number of frames that the fade effect lasts. At the end of the
  9339. fade-in effect, the output video will have the same intensity as the input video.
  9340. At the end of the fade-out transition, the output video will be filled with the
  9341. selected @option{color}.
  9342. Default is 25.
  9343. @item alpha
  9344. If set to 1, fade only alpha channel, if one exists on the input.
  9345. Default value is 0.
  9346. @item start_time, st
  9347. Specify the timestamp (in seconds) of the frame to start to apply the fade
  9348. effect. If both start_frame and start_time are specified, the fade will start at
  9349. whichever comes last. Default is 0.
  9350. @item duration, d
  9351. The number of seconds for which the fade effect has to last. At the end of the
  9352. fade-in effect the output video will have the same intensity as the input video,
  9353. at the end of the fade-out transition the output video will be filled with the
  9354. selected @option{color}.
  9355. If both duration and nb_frames are specified, duration is used. Default is 0
  9356. (nb_frames is used by default).
  9357. @item color, c
  9358. Specify the color of the fade. Default is "black".
  9359. @end table
  9360. @subsection Examples
  9361. @itemize
  9362. @item
  9363. Fade in the first 30 frames of video:
  9364. @example
  9365. fade=in:0:30
  9366. @end example
  9367. The command above is equivalent to:
  9368. @example
  9369. fade=t=in:s=0:n=30
  9370. @end example
  9371. @item
  9372. Fade out the last 45 frames of a 200-frame video:
  9373. @example
  9374. fade=out:155:45
  9375. fade=type=out:start_frame=155:nb_frames=45
  9376. @end example
  9377. @item
  9378. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  9379. @example
  9380. fade=in:0:25, fade=out:975:25
  9381. @end example
  9382. @item
  9383. Make the first 5 frames yellow, then fade in from frame 5-24:
  9384. @example
  9385. fade=in:5:20:color=yellow
  9386. @end example
  9387. @item
  9388. Fade in alpha over first 25 frames of video:
  9389. @example
  9390. fade=in:0:25:alpha=1
  9391. @end example
  9392. @item
  9393. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  9394. @example
  9395. fade=t=in:st=5.5:d=0.5
  9396. @end example
  9397. @end itemize
  9398. @section feedback
  9399. Apply feedback video filter.
  9400. This filter pass cropped input frames to 2nd output.
  9401. From there it can be filtered with other video filters.
  9402. After filter receives frame from 2nd input, that frame
  9403. is combined on top of original frame from 1st input and passed
  9404. to 1st output.
  9405. The typical usage is filter only part of frame.
  9406. The filter accepts the following options:
  9407. @table @option
  9408. @item x
  9409. @item y
  9410. Set the top left crop position.
  9411. @item w
  9412. @item h
  9413. Set the crop size.
  9414. @end table
  9415. @subsection Examples
  9416. @itemize
  9417. @item
  9418. Blur only top left rectangular part of video frame size 100x100 with gblur filter.
  9419. @example
  9420. [in][blurin]feedback=x=0:y=0:w=100:h=100[out][blurout];[blurout]gblur=8[blurin]
  9421. @end example
  9422. @item
  9423. Draw black box on top left part of video frame of size 100x100 with drawbox filter.
  9424. @example
  9425. [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]
  9426. @end example
  9427. @end itemize
  9428. @section fftdnoiz
  9429. Denoise frames using 3D FFT (frequency domain filtering).
  9430. The filter accepts the following options:
  9431. @table @option
  9432. @item sigma
  9433. Set the noise sigma constant. This sets denoising strength.
  9434. Default value is 1. Allowed range is from 0 to 30.
  9435. Using very high sigma with low overlap may give blocking artifacts.
  9436. @item amount
  9437. Set amount of denoising. By default all detected noise is reduced.
  9438. Default value is 1. Allowed range is from 0 to 1.
  9439. @item block
  9440. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  9441. Actual size of block in pixels is 2 to power of @var{block}, so by default
  9442. block size in pixels is 2^4 which is 16.
  9443. @item overlap
  9444. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  9445. @item prev
  9446. Set number of previous frames to use for denoising. By default is set to 0.
  9447. @item next
  9448. Set number of next frames to to use for denoising. By default is set to 0.
  9449. @item planes
  9450. Set planes which will be filtered, by default are all available filtered
  9451. except alpha.
  9452. @end table
  9453. @section fftfilt
  9454. Apply arbitrary expressions to samples in frequency domain
  9455. @table @option
  9456. @item dc_Y
  9457. Adjust the dc value (gain) of the luma plane of the image. The filter
  9458. accepts an integer value in range @code{0} to @code{1000}. The default
  9459. value is set to @code{0}.
  9460. @item dc_U
  9461. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  9462. filter accepts an integer value in range @code{0} to @code{1000}. The
  9463. default value is set to @code{0}.
  9464. @item dc_V
  9465. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  9466. filter accepts an integer value in range @code{0} to @code{1000}. The
  9467. default value is set to @code{0}.
  9468. @item weight_Y
  9469. Set the frequency domain weight expression for the luma plane.
  9470. @item weight_U
  9471. Set the frequency domain weight expression for the 1st chroma plane.
  9472. @item weight_V
  9473. Set the frequency domain weight expression for the 2nd chroma plane.
  9474. @item eval
  9475. Set when the expressions are evaluated.
  9476. It accepts the following values:
  9477. @table @samp
  9478. @item init
  9479. Only evaluate expressions once during the filter initialization.
  9480. @item frame
  9481. Evaluate expressions for each incoming frame.
  9482. @end table
  9483. Default value is @samp{init}.
  9484. The filter accepts the following variables:
  9485. @item X
  9486. @item Y
  9487. The coordinates of the current sample.
  9488. @item W
  9489. @item H
  9490. The width and height of the image.
  9491. @item N
  9492. The number of input frame, starting from 0.
  9493. @item WS
  9494. @item HS
  9495. The size of FFT array for horizontal and vertical processing.
  9496. @end table
  9497. @subsection Examples
  9498. @itemize
  9499. @item
  9500. High-pass:
  9501. @example
  9502. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  9503. @end example
  9504. @item
  9505. Low-pass:
  9506. @example
  9507. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  9508. @end example
  9509. @item
  9510. Sharpen:
  9511. @example
  9512. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  9513. @end example
  9514. @item
  9515. Blur:
  9516. @example
  9517. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  9518. @end example
  9519. @end itemize
  9520. @section field
  9521. Extract a single field from an interlaced image using stride
  9522. arithmetic to avoid wasting CPU time. The output frames are marked as
  9523. non-interlaced.
  9524. The filter accepts the following options:
  9525. @table @option
  9526. @item type
  9527. Specify whether to extract the top (if the value is @code{0} or
  9528. @code{top}) or the bottom field (if the value is @code{1} or
  9529. @code{bottom}).
  9530. @end table
  9531. @section fieldhint
  9532. Create new frames by copying the top and bottom fields from surrounding frames
  9533. supplied as numbers by the hint file.
  9534. @table @option
  9535. @item hint
  9536. Set file containing hints: absolute/relative frame numbers.
  9537. There must be one line for each frame in a clip. Each line must contain two
  9538. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  9539. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  9540. is current frame number for @code{absolute} mode or out of [-1, 1] range
  9541. for @code{relative} mode. First number tells from which frame to pick up top
  9542. field and second number tells from which frame to pick up bottom field.
  9543. If optionally followed by @code{+} output frame will be marked as interlaced,
  9544. else if followed by @code{-} output frame will be marked as progressive, else
  9545. it will be marked same as input frame.
  9546. If optionally followed by @code{t} output frame will use only top field, or in
  9547. case of @code{b} it will use only bottom field.
  9548. If line starts with @code{#} or @code{;} that line is skipped.
  9549. @item mode
  9550. Can be item @code{absolute} or @code{relative} or @code{pattern}. Default is @code{absolute}.
  9551. The @code{pattern} mode is same as @code{relative} mode, except at last entry of file if there
  9552. are more frames to process than @code{hint} file is seek back to start.
  9553. @end table
  9554. Example of first several lines of @code{hint} file for @code{relative} mode:
  9555. @example
  9556. 0,0 - # first frame
  9557. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  9558. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  9559. 1,0 -
  9560. 0,0 -
  9561. 0,0 -
  9562. 1,0 -
  9563. 1,0 -
  9564. 1,0 -
  9565. 0,0 -
  9566. 0,0 -
  9567. 1,0 -
  9568. 1,0 -
  9569. 1,0 -
  9570. 0,0 -
  9571. @end example
  9572. @section fieldmatch
  9573. Field matching filter for inverse telecine. It is meant to reconstruct the
  9574. progressive frames from a telecined stream. The filter does not drop duplicated
  9575. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  9576. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  9577. The separation of the field matching and the decimation is notably motivated by
  9578. the possibility of inserting a de-interlacing filter fallback between the two.
  9579. If the source has mixed telecined and real interlaced content,
  9580. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  9581. But these remaining combed frames will be marked as interlaced, and thus can be
  9582. de-interlaced by a later filter such as @ref{yadif} before decimation.
  9583. In addition to the various configuration options, @code{fieldmatch} can take an
  9584. optional second stream, activated through the @option{ppsrc} option. If
  9585. enabled, the frames reconstruction will be based on the fields and frames from
  9586. this second stream. This allows the first input to be pre-processed in order to
  9587. help the various algorithms of the filter, while keeping the output lossless
  9588. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  9589. or brightness/contrast adjustments can help.
  9590. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  9591. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  9592. which @code{fieldmatch} is based on. While the semantic and usage are very
  9593. close, some behaviour and options names can differ.
  9594. The @ref{decimate} filter currently only works for constant frame rate input.
  9595. If your input has mixed telecined (30fps) and progressive content with a lower
  9596. framerate like 24fps use the following filterchain to produce the necessary cfr
  9597. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  9598. The filter accepts the following options:
  9599. @table @option
  9600. @item order
  9601. Specify the assumed field order of the input stream. Available values are:
  9602. @table @samp
  9603. @item auto
  9604. Auto detect parity (use FFmpeg's internal parity value).
  9605. @item bff
  9606. Assume bottom field first.
  9607. @item tff
  9608. Assume top field first.
  9609. @end table
  9610. Note that it is sometimes recommended not to trust the parity announced by the
  9611. stream.
  9612. Default value is @var{auto}.
  9613. @item mode
  9614. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  9615. sense that it won't risk creating jerkiness due to duplicate frames when
  9616. possible, but if there are bad edits or blended fields it will end up
  9617. outputting combed frames when a good match might actually exist. On the other
  9618. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  9619. but will almost always find a good frame if there is one. The other values are
  9620. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  9621. jerkiness and creating duplicate frames versus finding good matches in sections
  9622. with bad edits, orphaned fields, blended fields, etc.
  9623. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  9624. Available values are:
  9625. @table @samp
  9626. @item pc
  9627. 2-way matching (p/c)
  9628. @item pc_n
  9629. 2-way matching, and trying 3rd match if still combed (p/c + n)
  9630. @item pc_u
  9631. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  9632. @item pc_n_ub
  9633. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  9634. still combed (p/c + n + u/b)
  9635. @item pcn
  9636. 3-way matching (p/c/n)
  9637. @item pcn_ub
  9638. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  9639. detected as combed (p/c/n + u/b)
  9640. @end table
  9641. The parenthesis at the end indicate the matches that would be used for that
  9642. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  9643. @var{top}).
  9644. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  9645. the slowest.
  9646. Default value is @var{pc_n}.
  9647. @item ppsrc
  9648. Mark the main input stream as a pre-processed input, and enable the secondary
  9649. input stream as the clean source to pick the fields from. See the filter
  9650. introduction for more details. It is similar to the @option{clip2} feature from
  9651. VFM/TFM.
  9652. Default value is @code{0} (disabled).
  9653. @item field
  9654. Set the field to match from. It is recommended to set this to the same value as
  9655. @option{order} unless you experience matching failures with that setting. In
  9656. certain circumstances changing the field that is used to match from can have a
  9657. large impact on matching performance. Available values are:
  9658. @table @samp
  9659. @item auto
  9660. Automatic (same value as @option{order}).
  9661. @item bottom
  9662. Match from the bottom field.
  9663. @item top
  9664. Match from the top field.
  9665. @end table
  9666. Default value is @var{auto}.
  9667. @item mchroma
  9668. Set whether or not chroma is included during the match comparisons. In most
  9669. cases it is recommended to leave this enabled. You should set this to @code{0}
  9670. only if your clip has bad chroma problems such as heavy rainbowing or other
  9671. artifacts. Setting this to @code{0} could also be used to speed things up at
  9672. the cost of some accuracy.
  9673. Default value is @code{1}.
  9674. @item y0
  9675. @item y1
  9676. These define an exclusion band which excludes the lines between @option{y0} and
  9677. @option{y1} from being included in the field matching decision. An exclusion
  9678. band can be used to ignore subtitles, a logo, or other things that may
  9679. interfere with the matching. @option{y0} sets the starting scan line and
  9680. @option{y1} sets the ending line; all lines in between @option{y0} and
  9681. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  9682. @option{y0} and @option{y1} to the same value will disable the feature.
  9683. @option{y0} and @option{y1} defaults to @code{0}.
  9684. @item scthresh
  9685. Set the scene change detection threshold as a percentage of maximum change on
  9686. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  9687. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  9688. @option{scthresh} is @code{[0.0, 100.0]}.
  9689. Default value is @code{12.0}.
  9690. @item combmatch
  9691. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  9692. account the combed scores of matches when deciding what match to use as the
  9693. final match. Available values are:
  9694. @table @samp
  9695. @item none
  9696. No final matching based on combed scores.
  9697. @item sc
  9698. Combed scores are only used when a scene change is detected.
  9699. @item full
  9700. Use combed scores all the time.
  9701. @end table
  9702. Default is @var{sc}.
  9703. @item combdbg
  9704. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  9705. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  9706. Available values are:
  9707. @table @samp
  9708. @item none
  9709. No forced calculation.
  9710. @item pcn
  9711. Force p/c/n calculations.
  9712. @item pcnub
  9713. Force p/c/n/u/b calculations.
  9714. @end table
  9715. Default value is @var{none}.
  9716. @item cthresh
  9717. This is the area combing threshold used for combed frame detection. This
  9718. essentially controls how "strong" or "visible" combing must be to be detected.
  9719. Larger values mean combing must be more visible and smaller values mean combing
  9720. can be less visible or strong and still be detected. Valid settings are from
  9721. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  9722. be detected as combed). This is basically a pixel difference value. A good
  9723. range is @code{[8, 12]}.
  9724. Default value is @code{9}.
  9725. @item chroma
  9726. Sets whether or not chroma is considered in the combed frame decision. Only
  9727. disable this if your source has chroma problems (rainbowing, etc.) that are
  9728. causing problems for the combed frame detection with chroma enabled. Actually,
  9729. using @option{chroma}=@var{0} is usually more reliable, except for the case
  9730. where there is chroma only combing in the source.
  9731. Default value is @code{0}.
  9732. @item blockx
  9733. @item blocky
  9734. Respectively set the x-axis and y-axis size of the window used during combed
  9735. frame detection. This has to do with the size of the area in which
  9736. @option{combpel} pixels are required to be detected as combed for a frame to be
  9737. declared combed. See the @option{combpel} parameter description for more info.
  9738. Possible values are any number that is a power of 2 starting at 4 and going up
  9739. to 512.
  9740. Default value is @code{16}.
  9741. @item combpel
  9742. The number of combed pixels inside any of the @option{blocky} by
  9743. @option{blockx} size blocks on the frame for the frame to be detected as
  9744. combed. While @option{cthresh} controls how "visible" the combing must be, this
  9745. setting controls "how much" combing there must be in any localized area (a
  9746. window defined by the @option{blockx} and @option{blocky} settings) on the
  9747. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  9748. which point no frames will ever be detected as combed). This setting is known
  9749. as @option{MI} in TFM/VFM vocabulary.
  9750. Default value is @code{80}.
  9751. @end table
  9752. @anchor{p/c/n/u/b meaning}
  9753. @subsection p/c/n/u/b meaning
  9754. @subsubsection p/c/n
  9755. We assume the following telecined stream:
  9756. @example
  9757. Top fields: 1 2 2 3 4
  9758. Bottom fields: 1 2 3 4 4
  9759. @end example
  9760. The numbers correspond to the progressive frame the fields relate to. Here, the
  9761. first two frames are progressive, the 3rd and 4th are combed, and so on.
  9762. When @code{fieldmatch} is configured to run a matching from bottom
  9763. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  9764. @example
  9765. Input stream:
  9766. T 1 2 2 3 4
  9767. B 1 2 3 4 4 <-- matching reference
  9768. Matches: c c n n c
  9769. Output stream:
  9770. T 1 2 3 4 4
  9771. B 1 2 3 4 4
  9772. @end example
  9773. As a result of the field matching, we can see that some frames get duplicated.
  9774. To perform a complete inverse telecine, you need to rely on a decimation filter
  9775. after this operation. See for instance the @ref{decimate} filter.
  9776. The same operation now matching from top fields (@option{field}=@var{top})
  9777. looks like this:
  9778. @example
  9779. Input stream:
  9780. T 1 2 2 3 4 <-- matching reference
  9781. B 1 2 3 4 4
  9782. Matches: c c p p c
  9783. Output stream:
  9784. T 1 2 2 3 4
  9785. B 1 2 2 3 4
  9786. @end example
  9787. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  9788. basically, they refer to the frame and field of the opposite parity:
  9789. @itemize
  9790. @item @var{p} matches the field of the opposite parity in the previous frame
  9791. @item @var{c} matches the field of the opposite parity in the current frame
  9792. @item @var{n} matches the field of the opposite parity in the next frame
  9793. @end itemize
  9794. @subsubsection u/b
  9795. The @var{u} and @var{b} matching are a bit special in the sense that they match
  9796. from the opposite parity flag. In the following examples, we assume that we are
  9797. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  9798. 'x' is placed above and below each matched fields.
  9799. With bottom matching (@option{field}=@var{bottom}):
  9800. @example
  9801. Match: c p n b u
  9802. x x x x x
  9803. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  9804. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  9805. x x x x x
  9806. Output frames:
  9807. 2 1 2 2 2
  9808. 2 2 2 1 3
  9809. @end example
  9810. With top matching (@option{field}=@var{top}):
  9811. @example
  9812. Match: c p n b u
  9813. x x x x x
  9814. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  9815. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  9816. x x x x x
  9817. Output frames:
  9818. 2 2 2 1 2
  9819. 2 1 3 2 2
  9820. @end example
  9821. @subsection Examples
  9822. Simple IVTC of a top field first telecined stream:
  9823. @example
  9824. fieldmatch=order=tff:combmatch=none, decimate
  9825. @end example
  9826. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  9827. @example
  9828. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  9829. @end example
  9830. @section fieldorder
  9831. Transform the field order of the input video.
  9832. It accepts the following parameters:
  9833. @table @option
  9834. @item order
  9835. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  9836. for bottom field first.
  9837. @end table
  9838. The default value is @samp{tff}.
  9839. The transformation is done by shifting the picture content up or down
  9840. by one line, and filling the remaining line with appropriate picture content.
  9841. This method is consistent with most broadcast field order converters.
  9842. If the input video is not flagged as being interlaced, or it is already
  9843. flagged as being of the required output field order, then this filter does
  9844. not alter the incoming video.
  9845. It is very useful when converting to or from PAL DV material,
  9846. which is bottom field first.
  9847. For example:
  9848. @example
  9849. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  9850. @end example
  9851. @section fifo, afifo
  9852. Buffer input images and send them when they are requested.
  9853. It is mainly useful when auto-inserted by the libavfilter
  9854. framework.
  9855. It does not take parameters.
  9856. @section fillborders
  9857. Fill borders of the input video, without changing video stream dimensions.
  9858. Sometimes video can have garbage at the four edges and you may not want to
  9859. crop video input to keep size multiple of some number.
  9860. This filter accepts the following options:
  9861. @table @option
  9862. @item left
  9863. Number of pixels to fill from left border.
  9864. @item right
  9865. Number of pixels to fill from right border.
  9866. @item top
  9867. Number of pixels to fill from top border.
  9868. @item bottom
  9869. Number of pixels to fill from bottom border.
  9870. @item mode
  9871. Set fill mode.
  9872. It accepts the following values:
  9873. @table @samp
  9874. @item smear
  9875. fill pixels using outermost pixels
  9876. @item mirror
  9877. fill pixels using mirroring (half sample symmetric)
  9878. @item fixed
  9879. fill pixels with constant value
  9880. @item reflect
  9881. fill pixels using reflecting (whole sample symmetric)
  9882. @item wrap
  9883. fill pixels using wrapping
  9884. @item fade
  9885. fade pixels to constant value
  9886. @item margins
  9887. fill pixels at top and bottom with weighted averages pixels near borders
  9888. @end table
  9889. Default is @var{smear}.
  9890. @item color
  9891. Set color for pixels in fixed or fade mode. Default is @var{black}.
  9892. @end table
  9893. @subsection Commands
  9894. This filter supports same @ref{commands} as options.
  9895. The command accepts the same syntax of the corresponding option.
  9896. If the specified expression is not valid, it is kept at its current
  9897. value.
  9898. @section find_rect
  9899. Find a rectangular object
  9900. It accepts the following options:
  9901. @table @option
  9902. @item object
  9903. Filepath of the object image, needs to be in gray8.
  9904. @item threshold
  9905. Detection threshold, default is 0.5.
  9906. @item mipmaps
  9907. Number of mipmaps, default is 3.
  9908. @item xmin, ymin, xmax, ymax
  9909. Specifies the rectangle in which to search.
  9910. @item discard
  9911. Discard frames where object is not detected. Default is disabled.
  9912. @end table
  9913. @subsection Examples
  9914. @itemize
  9915. @item
  9916. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  9917. @example
  9918. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  9919. @end example
  9920. @end itemize
  9921. @section floodfill
  9922. Flood area with values of same pixel components with another values.
  9923. It accepts the following options:
  9924. @table @option
  9925. @item x
  9926. Set pixel x coordinate.
  9927. @item y
  9928. Set pixel y coordinate.
  9929. @item s0
  9930. Set source #0 component value.
  9931. @item s1
  9932. Set source #1 component value.
  9933. @item s2
  9934. Set source #2 component value.
  9935. @item s3
  9936. Set source #3 component value.
  9937. @item d0
  9938. Set destination #0 component value.
  9939. @item d1
  9940. Set destination #1 component value.
  9941. @item d2
  9942. Set destination #2 component value.
  9943. @item d3
  9944. Set destination #3 component value.
  9945. @end table
  9946. @anchor{format}
  9947. @section format
  9948. Convert the input video to one of the specified pixel formats.
  9949. Libavfilter will try to pick one that is suitable as input to
  9950. the next filter.
  9951. It accepts the following parameters:
  9952. @table @option
  9953. @item pix_fmts
  9954. A '|'-separated list of pixel format names, such as
  9955. "pix_fmts=yuv420p|monow|rgb24".
  9956. @end table
  9957. @subsection Examples
  9958. @itemize
  9959. @item
  9960. Convert the input video to the @var{yuv420p} format
  9961. @example
  9962. format=pix_fmts=yuv420p
  9963. @end example
  9964. Convert the input video to any of the formats in the list
  9965. @example
  9966. format=pix_fmts=yuv420p|yuv444p|yuv410p
  9967. @end example
  9968. @end itemize
  9969. @anchor{fps}
  9970. @section fps
  9971. Convert the video to specified constant frame rate by duplicating or dropping
  9972. frames as necessary.
  9973. It accepts the following parameters:
  9974. @table @option
  9975. @item fps
  9976. The desired output frame rate. It accepts expressions containing the following
  9977. constants:
  9978. @table @samp
  9979. @item source_fps
  9980. The input's frame rate
  9981. @item ntsc
  9982. NTSC frame rate of @code{30000/1001}
  9983. @item pal
  9984. PAL frame rate of @code{25.0}
  9985. @item film
  9986. Film frame rate of @code{24.0}
  9987. @item ntsc_film
  9988. NTSC-film frame rate of @code{24000/1001}
  9989. @end table
  9990. The default is @code{25}.
  9991. @item start_time
  9992. Assume the first PTS should be the given value, in seconds. This allows for
  9993. padding/trimming at the start of stream. By default, no assumption is made
  9994. about the first frame's expected PTS, so no padding or trimming is done.
  9995. For example, this could be set to 0 to pad the beginning with duplicates of
  9996. the first frame if a video stream starts after the audio stream or to trim any
  9997. frames with a negative PTS.
  9998. @item round
  9999. Timestamp (PTS) rounding method.
  10000. Possible values are:
  10001. @table @option
  10002. @item zero
  10003. round towards 0
  10004. @item inf
  10005. round away from 0
  10006. @item down
  10007. round towards -infinity
  10008. @item up
  10009. round towards +infinity
  10010. @item near
  10011. round to nearest
  10012. @end table
  10013. The default is @code{near}.
  10014. @item eof_action
  10015. Action performed when reading the last frame.
  10016. Possible values are:
  10017. @table @option
  10018. @item round
  10019. Use same timestamp rounding method as used for other frames.
  10020. @item pass
  10021. Pass through last frame if input duration has not been reached yet.
  10022. @end table
  10023. The default is @code{round}.
  10024. @end table
  10025. Alternatively, the options can be specified as a flat string:
  10026. @var{fps}[:@var{start_time}[:@var{round}]].
  10027. See also the @ref{setpts} filter.
  10028. @subsection Examples
  10029. @itemize
  10030. @item
  10031. A typical usage in order to set the fps to 25:
  10032. @example
  10033. fps=fps=25
  10034. @end example
  10035. @item
  10036. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  10037. @example
  10038. fps=fps=film:round=near
  10039. @end example
  10040. @end itemize
  10041. @section framepack
  10042. Pack two different video streams into a stereoscopic video, setting proper
  10043. metadata on supported codecs. The two views should have the same size and
  10044. framerate and processing will stop when the shorter video ends. Please note
  10045. that you may conveniently adjust view properties with the @ref{scale} and
  10046. @ref{fps} filters.
  10047. It accepts the following parameters:
  10048. @table @option
  10049. @item format
  10050. The desired packing format. Supported values are:
  10051. @table @option
  10052. @item sbs
  10053. The views are next to each other (default).
  10054. @item tab
  10055. The views are on top of each other.
  10056. @item lines
  10057. The views are packed by line.
  10058. @item columns
  10059. The views are packed by column.
  10060. @item frameseq
  10061. The views are temporally interleaved.
  10062. @end table
  10063. @end table
  10064. Some examples:
  10065. @example
  10066. # Convert left and right views into a frame-sequential video
  10067. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  10068. # Convert views into a side-by-side video with the same output resolution as the input
  10069. 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
  10070. @end example
  10071. @section framerate
  10072. Change the frame rate by interpolating new video output frames from the source
  10073. frames.
  10074. This filter is not designed to function correctly with interlaced media. If
  10075. you wish to change the frame rate of interlaced media then you are required
  10076. to deinterlace before this filter and re-interlace after this filter.
  10077. A description of the accepted options follows.
  10078. @table @option
  10079. @item fps
  10080. Specify the output frames per second. This option can also be specified
  10081. as a value alone. The default is @code{50}.
  10082. @item interp_start
  10083. Specify the start of a range where the output frame will be created as a
  10084. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  10085. the default is @code{15}.
  10086. @item interp_end
  10087. Specify the end of a range where the output frame will be created as a
  10088. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  10089. the default is @code{240}.
  10090. @item scene
  10091. Specify the level at which a scene change is detected as a value between
  10092. 0 and 100 to indicate a new scene; a low value reflects a low
  10093. probability for the current frame to introduce a new scene, while a higher
  10094. value means the current frame is more likely to be one.
  10095. The default is @code{8.2}.
  10096. @item flags
  10097. Specify flags influencing the filter process.
  10098. Available value for @var{flags} is:
  10099. @table @option
  10100. @item scene_change_detect, scd
  10101. Enable scene change detection using the value of the option @var{scene}.
  10102. This flag is enabled by default.
  10103. @end table
  10104. @end table
  10105. @section framestep
  10106. Select one frame every N-th frame.
  10107. This filter accepts the following option:
  10108. @table @option
  10109. @item step
  10110. Select frame after every @code{step} frames.
  10111. Allowed values are positive integers higher than 0. Default value is @code{1}.
  10112. @end table
  10113. @section freezedetect
  10114. Detect frozen video.
  10115. This filter logs a message and sets frame metadata when it detects that the
  10116. input video has no significant change in content during a specified duration.
  10117. Video freeze detection calculates the mean average absolute difference of all
  10118. the components of video frames and compares it to a noise floor.
  10119. The printed times and duration are expressed in seconds. The
  10120. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  10121. whose timestamp equals or exceeds the detection duration and it contains the
  10122. timestamp of the first frame of the freeze. The
  10123. @code{lavfi.freezedetect.freeze_duration} and
  10124. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  10125. after the freeze.
  10126. The filter accepts the following options:
  10127. @table @option
  10128. @item noise, n
  10129. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  10130. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  10131. 0.001.
  10132. @item duration, d
  10133. Set freeze duration until notification (default is 2 seconds).
  10134. @end table
  10135. @section freezeframes
  10136. Freeze video frames.
  10137. This filter freezes video frames using frame from 2nd input.
  10138. The filter accepts the following options:
  10139. @table @option
  10140. @item first
  10141. Set number of first frame from which to start freeze.
  10142. @item last
  10143. Set number of last frame from which to end freeze.
  10144. @item replace
  10145. Set number of frame from 2nd input which will be used instead of replaced frames.
  10146. @end table
  10147. @anchor{frei0r}
  10148. @section frei0r
  10149. Apply a frei0r effect to the input video.
  10150. To enable the compilation of this filter, you need to install the frei0r
  10151. header and configure FFmpeg with @code{--enable-frei0r}.
  10152. It accepts the following parameters:
  10153. @table @option
  10154. @item filter_name
  10155. The name of the frei0r effect to load. If the environment variable
  10156. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  10157. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  10158. Otherwise, the standard frei0r paths are searched, in this order:
  10159. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  10160. @file{/usr/lib/frei0r-1/}.
  10161. @item filter_params
  10162. A '|'-separated list of parameters to pass to the frei0r effect.
  10163. @end table
  10164. A frei0r effect parameter can be a boolean (its value is either
  10165. "y" or "n"), a double, a color (specified as
  10166. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  10167. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  10168. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  10169. a position (specified as @var{X}/@var{Y}, where
  10170. @var{X} and @var{Y} are floating point numbers) and/or a string.
  10171. The number and types of parameters depend on the loaded effect. If an
  10172. effect parameter is not specified, the default value is set.
  10173. @subsection Examples
  10174. @itemize
  10175. @item
  10176. Apply the distort0r effect, setting the first two double parameters:
  10177. @example
  10178. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  10179. @end example
  10180. @item
  10181. Apply the colordistance effect, taking a color as the first parameter:
  10182. @example
  10183. frei0r=colordistance:0.2/0.3/0.4
  10184. frei0r=colordistance:violet
  10185. frei0r=colordistance:0x112233
  10186. @end example
  10187. @item
  10188. Apply the perspective effect, specifying the top left and top right image
  10189. positions:
  10190. @example
  10191. frei0r=perspective:0.2/0.2|0.8/0.2
  10192. @end example
  10193. @end itemize
  10194. For more information, see
  10195. @url{http://frei0r.dyne.org}
  10196. @subsection Commands
  10197. This filter supports the @option{filter_params} option as @ref{commands}.
  10198. @section fspp
  10199. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  10200. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  10201. processing filter, one of them is performed once per block, not per pixel.
  10202. This allows for much higher speed.
  10203. The filter accepts the following options:
  10204. @table @option
  10205. @item quality
  10206. Set quality. This option defines the number of levels for averaging. It accepts
  10207. an integer in the range 4-5. Default value is @code{4}.
  10208. @item qp
  10209. Force a constant quantization parameter. It accepts an integer in range 0-63.
  10210. If not set, the filter will use the QP from the video stream (if available).
  10211. @item strength
  10212. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  10213. more details but also more artifacts, while higher values make the image smoother
  10214. but also blurrier. Default value is @code{0} − PSNR optimal.
  10215. @item use_bframe_qp
  10216. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  10217. option may cause flicker since the B-Frames have often larger QP. Default is
  10218. @code{0} (not enabled).
  10219. @end table
  10220. @section gblur
  10221. Apply Gaussian blur filter.
  10222. The filter accepts the following options:
  10223. @table @option
  10224. @item sigma
  10225. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  10226. @item steps
  10227. Set number of steps for Gaussian approximation. Default is @code{1}.
  10228. @item planes
  10229. Set which planes to filter. By default all planes are filtered.
  10230. @item sigmaV
  10231. Set vertical sigma, if negative it will be same as @code{sigma}.
  10232. Default is @code{-1}.
  10233. @end table
  10234. @subsection Commands
  10235. This filter supports same commands as options.
  10236. The command accepts the same syntax of the corresponding option.
  10237. If the specified expression is not valid, it is kept at its current
  10238. value.
  10239. @section geq
  10240. Apply generic equation to each pixel.
  10241. The filter accepts the following options:
  10242. @table @option
  10243. @item lum_expr, lum
  10244. Set the luminance expression.
  10245. @item cb_expr, cb
  10246. Set the chrominance blue expression.
  10247. @item cr_expr, cr
  10248. Set the chrominance red expression.
  10249. @item alpha_expr, a
  10250. Set the alpha expression.
  10251. @item red_expr, r
  10252. Set the red expression.
  10253. @item green_expr, g
  10254. Set the green expression.
  10255. @item blue_expr, b
  10256. Set the blue expression.
  10257. @end table
  10258. The colorspace is selected according to the specified options. If one
  10259. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  10260. options is specified, the filter will automatically select a YCbCr
  10261. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  10262. @option{blue_expr} options is specified, it will select an RGB
  10263. colorspace.
  10264. If one of the chrominance expression is not defined, it falls back on the other
  10265. one. If no alpha expression is specified it will evaluate to opaque value.
  10266. If none of chrominance expressions are specified, they will evaluate
  10267. to the luminance expression.
  10268. The expressions can use the following variables and functions:
  10269. @table @option
  10270. @item N
  10271. The sequential number of the filtered frame, starting from @code{0}.
  10272. @item X
  10273. @item Y
  10274. The coordinates of the current sample.
  10275. @item W
  10276. @item H
  10277. The width and height of the image.
  10278. @item SW
  10279. @item SH
  10280. Width and height scale depending on the currently filtered plane. It is the
  10281. ratio between the corresponding luma plane number of pixels and the current
  10282. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  10283. @code{0.5,0.5} for chroma planes.
  10284. @item T
  10285. Time of the current frame, expressed in seconds.
  10286. @item p(x, y)
  10287. Return the value of the pixel at location (@var{x},@var{y}) of the current
  10288. plane.
  10289. @item lum(x, y)
  10290. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  10291. plane.
  10292. @item cb(x, y)
  10293. Return the value of the pixel at location (@var{x},@var{y}) of the
  10294. blue-difference chroma plane. Return 0 if there is no such plane.
  10295. @item cr(x, y)
  10296. Return the value of the pixel at location (@var{x},@var{y}) of the
  10297. red-difference chroma plane. Return 0 if there is no such plane.
  10298. @item r(x, y)
  10299. @item g(x, y)
  10300. @item b(x, y)
  10301. Return the value of the pixel at location (@var{x},@var{y}) of the
  10302. red/green/blue component. Return 0 if there is no such component.
  10303. @item alpha(x, y)
  10304. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  10305. plane. Return 0 if there is no such plane.
  10306. @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)
  10307. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  10308. sums of samples within a rectangle. See the functions without the sum postfix.
  10309. @item interpolation
  10310. Set one of interpolation methods:
  10311. @table @option
  10312. @item nearest, n
  10313. @item bilinear, b
  10314. @end table
  10315. Default is bilinear.
  10316. @end table
  10317. For functions, if @var{x} and @var{y} are outside the area, the value will be
  10318. automatically clipped to the closer edge.
  10319. Please note that this filter can use multiple threads in which case each slice
  10320. will have its own expression state. If you want to use only a single expression
  10321. state because your expressions depend on previous state then you should limit
  10322. the number of filter threads to 1.
  10323. @subsection Examples
  10324. @itemize
  10325. @item
  10326. Flip the image horizontally:
  10327. @example
  10328. geq=p(W-X\,Y)
  10329. @end example
  10330. @item
  10331. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  10332. wavelength of 100 pixels:
  10333. @example
  10334. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  10335. @end example
  10336. @item
  10337. Generate a fancy enigmatic moving light:
  10338. @example
  10339. 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
  10340. @end example
  10341. @item
  10342. Generate a quick emboss effect:
  10343. @example
  10344. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  10345. @end example
  10346. @item
  10347. Modify RGB components depending on pixel position:
  10348. @example
  10349. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  10350. @end example
  10351. @item
  10352. Create a radial gradient that is the same size as the input (also see
  10353. the @ref{vignette} filter):
  10354. @example
  10355. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  10356. @end example
  10357. @end itemize
  10358. @section gradfun
  10359. Fix the banding artifacts that are sometimes introduced into nearly flat
  10360. regions by truncation to 8-bit color depth.
  10361. Interpolate the gradients that should go where the bands are, and
  10362. dither them.
  10363. It is designed for playback only. Do not use it prior to
  10364. lossy compression, because compression tends to lose the dither and
  10365. bring back the bands.
  10366. It accepts the following parameters:
  10367. @table @option
  10368. @item strength
  10369. The maximum amount by which the filter will change any one pixel. This is also
  10370. the threshold for detecting nearly flat regions. Acceptable values range from
  10371. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  10372. valid range.
  10373. @item radius
  10374. The neighborhood to fit the gradient to. A larger radius makes for smoother
  10375. gradients, but also prevents the filter from modifying the pixels near detailed
  10376. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  10377. values will be clipped to the valid range.
  10378. @end table
  10379. Alternatively, the options can be specified as a flat string:
  10380. @var{strength}[:@var{radius}]
  10381. @subsection Examples
  10382. @itemize
  10383. @item
  10384. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  10385. @example
  10386. gradfun=3.5:8
  10387. @end example
  10388. @item
  10389. Specify radius, omitting the strength (which will fall-back to the default
  10390. value):
  10391. @example
  10392. gradfun=radius=8
  10393. @end example
  10394. @end itemize
  10395. @anchor{graphmonitor}
  10396. @section graphmonitor
  10397. Show various filtergraph stats.
  10398. With this filter one can debug complete filtergraph.
  10399. Especially issues with links filling with queued frames.
  10400. The filter accepts the following options:
  10401. @table @option
  10402. @item size, s
  10403. Set video output size. Default is @var{hd720}.
  10404. @item opacity, o
  10405. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  10406. @item mode, m
  10407. Set output mode, can be @var{fulll} or @var{compact}.
  10408. In @var{compact} mode only filters with some queued frames have displayed stats.
  10409. @item flags, f
  10410. Set flags which enable which stats are shown in video.
  10411. Available values for flags are:
  10412. @table @samp
  10413. @item queue
  10414. Display number of queued frames in each link.
  10415. @item frame_count_in
  10416. Display number of frames taken from filter.
  10417. @item frame_count_out
  10418. Display number of frames given out from filter.
  10419. @item frame_count_delta
  10420. Display delta number of frames between above two values.
  10421. @item pts
  10422. Display current filtered frame pts.
  10423. @item pts_delta
  10424. Display pts delta between current and previous frame.
  10425. @item time
  10426. Display current filtered frame time.
  10427. @item time_delta
  10428. Display time delta between current and previous frame.
  10429. @item timebase
  10430. Display time base for filter link.
  10431. @item format
  10432. Display used format for filter link.
  10433. @item size
  10434. Display video size or number of audio channels in case of audio used by filter link.
  10435. @item rate
  10436. Display video frame rate or sample rate in case of audio used by filter link.
  10437. @item eof
  10438. Display link output status.
  10439. @item sample_count_in
  10440. Display number of samples taken from filter.
  10441. @item sample_count_out
  10442. Display number of samples given out from filter.
  10443. @item sample_count_delta
  10444. Display delta number of samples between above two values.
  10445. @end table
  10446. @item rate, r
  10447. Set upper limit for video rate of output stream, Default value is @var{25}.
  10448. This guarantee that output video frame rate will not be higher than this value.
  10449. @end table
  10450. @section grayworld
  10451. A color constancy filter that applies color correction based on the grayworld assumption
  10452. See: @url{https://www.researchgate.net/publication/275213614_A_New_Color_Correction_Method_for_Underwater_Imaging}
  10453. The algorithm uses linear light, so input
  10454. data should be linearized beforehand (and possibly correctly tagged).
  10455. @example
  10456. ffmpeg -i INPUT -vf zscale=transfer=linear,grayworld,zscale=transfer=bt709,format=yuv420p OUTPUT
  10457. @end example
  10458. @section greyedge
  10459. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  10460. and corrects the scene colors accordingly.
  10461. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  10462. The filter accepts the following options:
  10463. @table @option
  10464. @item difford
  10465. The order of differentiation to be applied on the scene. Must be chosen in the range
  10466. [0,2] and default value is 1.
  10467. @item minknorm
  10468. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  10469. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  10470. max value instead of calculating Minkowski distance.
  10471. @item sigma
  10472. The standard deviation of Gaussian blur to be applied on the scene. Must be
  10473. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  10474. can't be equal to 0 if @var{difford} is greater than 0.
  10475. @end table
  10476. @subsection Examples
  10477. @itemize
  10478. @item
  10479. Grey Edge:
  10480. @example
  10481. greyedge=difford=1:minknorm=5:sigma=2
  10482. @end example
  10483. @item
  10484. Max Edge:
  10485. @example
  10486. greyedge=difford=1:minknorm=0:sigma=2
  10487. @end example
  10488. @end itemize
  10489. @section guided
  10490. Apply guided filter for edge-preserving smoothing, dehazing and so on.
  10491. The filter accepts the following options:
  10492. @table @option
  10493. @item radius
  10494. Set the box radius in pixels.
  10495. Allowed range is 1 to 20. Default is 3.
  10496. @item eps
  10497. Set regularization parameter (with square).
  10498. Allowed range is 0 to 1. Default is 0.01.
  10499. @item mode
  10500. Set filter mode. Can be @code{basic} or @code{fast}.
  10501. Default is @code{basic}.
  10502. @item sub
  10503. Set subsampling ratio for @code{fast} mode.
  10504. Range is 2 to 64. Default is 4.
  10505. No subsampling occurs in @code{basic} mode.
  10506. @item guidance
  10507. Set guidance mode. Can be @code{off} or @code{on}. Default is @code{off}.
  10508. If @code{off}, single input is required.
  10509. If @code{on}, two inputs of the same resolution and pixel format are required.
  10510. The second input serves as the guidance.
  10511. @item planes
  10512. Set planes to filter. Default is first only.
  10513. @end table
  10514. @subsection Commands
  10515. This filter supports the all above options as @ref{commands}.
  10516. @subsection Examples
  10517. @itemize
  10518. @item
  10519. Edge-preserving smoothing with guided filter:
  10520. @example
  10521. ffmpeg -i in.png -vf guided out.png
  10522. @end example
  10523. @item
  10524. Dehazing, structure-transferring filtering, detail enhancement with guided filter.
  10525. For the generation of guidance image, refer to paper "Guided Image Filtering".
  10526. See: @url{http://kaiminghe.com/publications/pami12guidedfilter.pdf}.
  10527. @example
  10528. ffmpeg -i in.png -i guidance.png -filter_complex guided=guidance=on out.png
  10529. @end example
  10530. @end itemize
  10531. @anchor{haldclut}
  10532. @section haldclut
  10533. Apply a Hald CLUT to a video stream.
  10534. First input is the video stream to process, and second one is the Hald CLUT.
  10535. The Hald CLUT input can be a simple picture or a complete video stream.
  10536. The filter accepts the following options:
  10537. @table @option
  10538. @item shortest
  10539. Force termination when the shortest input terminates. Default is @code{0}.
  10540. @item repeatlast
  10541. Continue applying the last CLUT after the end of the stream. A value of
  10542. @code{0} disable the filter after the last frame of the CLUT is reached.
  10543. Default is @code{1}.
  10544. @end table
  10545. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  10546. filters share the same internals).
  10547. This filter also supports the @ref{framesync} options.
  10548. More information about the Hald CLUT can be found on Eskil Steenberg's website
  10549. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  10550. @subsection Commands
  10551. This filter supports the @code{interp} option as @ref{commands}.
  10552. @subsection Workflow examples
  10553. @subsubsection Hald CLUT video stream
  10554. Generate an identity Hald CLUT stream altered with various effects:
  10555. @example
  10556. 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
  10557. @end example
  10558. Note: make sure you use a lossless codec.
  10559. Then use it with @code{haldclut} to apply it on some random stream:
  10560. @example
  10561. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  10562. @end example
  10563. The Hald CLUT will be applied to the 10 first seconds (duration of
  10564. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  10565. to the remaining frames of the @code{mandelbrot} stream.
  10566. @subsubsection Hald CLUT with preview
  10567. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  10568. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  10569. biggest possible square starting at the top left of the picture. The remaining
  10570. padding pixels (bottom or right) will be ignored. This area can be used to add
  10571. a preview of the Hald CLUT.
  10572. Typically, the following generated Hald CLUT will be supported by the
  10573. @code{haldclut} filter:
  10574. @example
  10575. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  10576. pad=iw+320 [padded_clut];
  10577. smptebars=s=320x256, split [a][b];
  10578. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  10579. [main][b] overlay=W-320" -frames:v 1 clut.png
  10580. @end example
  10581. It contains the original and a preview of the effect of the CLUT: SMPTE color
  10582. bars are displayed on the right-top, and below the same color bars processed by
  10583. the color changes.
  10584. Then, the effect of this Hald CLUT can be visualized with:
  10585. @example
  10586. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  10587. @end example
  10588. @section hflip
  10589. Flip the input video horizontally.
  10590. For example, to horizontally flip the input video with @command{ffmpeg}:
  10591. @example
  10592. ffmpeg -i in.avi -vf "hflip" out.avi
  10593. @end example
  10594. @section histeq
  10595. This filter applies a global color histogram equalization on a
  10596. per-frame basis.
  10597. It can be used to correct video that has a compressed range of pixel
  10598. intensities. The filter redistributes the pixel intensities to
  10599. equalize their distribution across the intensity range. It may be
  10600. viewed as an "automatically adjusting contrast filter". This filter is
  10601. useful only for correcting degraded or poorly captured source
  10602. video.
  10603. The filter accepts the following options:
  10604. @table @option
  10605. @item strength
  10606. Determine the amount of equalization to be applied. As the strength
  10607. is reduced, the distribution of pixel intensities more-and-more
  10608. approaches that of the input frame. The value must be a float number
  10609. in the range [0,1] and defaults to 0.200.
  10610. @item intensity
  10611. Set the maximum intensity that can generated and scale the output
  10612. values appropriately. The strength should be set as desired and then
  10613. the intensity can be limited if needed to avoid washing-out. The value
  10614. must be a float number in the range [0,1] and defaults to 0.210.
  10615. @item antibanding
  10616. Set the antibanding level. If enabled the filter will randomly vary
  10617. the luminance of output pixels by a small amount to avoid banding of
  10618. the histogram. Possible values are @code{none}, @code{weak} or
  10619. @code{strong}. It defaults to @code{none}.
  10620. @end table
  10621. @anchor{histogram}
  10622. @section histogram
  10623. Compute and draw a color distribution histogram for the input video.
  10624. The computed histogram is a representation of the color component
  10625. distribution in an image.
  10626. Standard histogram displays the color components distribution in an image.
  10627. Displays color graph for each color component. Shows distribution of
  10628. the Y, U, V, A or R, G, B components, depending on input format, in the
  10629. current frame. Below each graph a color component scale meter is shown.
  10630. The filter accepts the following options:
  10631. @table @option
  10632. @item level_height
  10633. Set height of level. Default value is @code{200}.
  10634. Allowed range is [50, 2048].
  10635. @item scale_height
  10636. Set height of color scale. Default value is @code{12}.
  10637. Allowed range is [0, 40].
  10638. @item display_mode
  10639. Set display mode.
  10640. It accepts the following values:
  10641. @table @samp
  10642. @item stack
  10643. Per color component graphs are placed below each other.
  10644. @item parade
  10645. Per color component graphs are placed side by side.
  10646. @item overlay
  10647. Presents information identical to that in the @code{parade}, except
  10648. that the graphs representing color components are superimposed directly
  10649. over one another.
  10650. @end table
  10651. Default is @code{stack}.
  10652. @item levels_mode
  10653. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  10654. Default is @code{linear}.
  10655. @item components
  10656. Set what color components to display.
  10657. Default is @code{7}.
  10658. @item fgopacity
  10659. Set foreground opacity. Default is @code{0.7}.
  10660. @item bgopacity
  10661. Set background opacity. Default is @code{0.5}.
  10662. @item colors_mode
  10663. Set colors mode.
  10664. It accepts the following values:
  10665. @table @samp
  10666. @item whiteonblack
  10667. @item blackonwhite
  10668. @item whiteongray
  10669. @item blackongray
  10670. @item coloronblack
  10671. @item coloronwhite
  10672. @item colorongray
  10673. @item blackoncolor
  10674. @item whiteoncolor
  10675. @item grayoncolor
  10676. @end table
  10677. Default is @code{whiteonblack}.
  10678. @end table
  10679. @subsection Examples
  10680. @itemize
  10681. @item
  10682. Calculate and draw histogram:
  10683. @example
  10684. ffplay -i input -vf histogram
  10685. @end example
  10686. @end itemize
  10687. @anchor{hqdn3d}
  10688. @section hqdn3d
  10689. This is a high precision/quality 3d denoise filter. It aims to reduce
  10690. image noise, producing smooth images and making still images really
  10691. still. It should enhance compressibility.
  10692. It accepts the following optional parameters:
  10693. @table @option
  10694. @item luma_spatial
  10695. A non-negative floating point number which specifies spatial luma strength.
  10696. It defaults to 4.0.
  10697. @item chroma_spatial
  10698. A non-negative floating point number which specifies spatial chroma strength.
  10699. It defaults to 3.0*@var{luma_spatial}/4.0.
  10700. @item luma_tmp
  10701. A floating point number which specifies luma temporal strength. It defaults to
  10702. 6.0*@var{luma_spatial}/4.0.
  10703. @item chroma_tmp
  10704. A floating point number which specifies chroma temporal strength. It defaults to
  10705. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  10706. @end table
  10707. @subsection Commands
  10708. This filter supports same @ref{commands} as options.
  10709. The command accepts the same syntax of the corresponding option.
  10710. If the specified expression is not valid, it is kept at its current
  10711. value.
  10712. @anchor{hwdownload}
  10713. @section hwdownload
  10714. Download hardware frames to system memory.
  10715. The input must be in hardware frames, and the output a non-hardware format.
  10716. Not all formats will be supported on the output - it may be necessary to insert
  10717. an additional @option{format} filter immediately following in the graph to get
  10718. the output in a supported format.
  10719. @section hwmap
  10720. Map hardware frames to system memory or to another device.
  10721. This filter has several different modes of operation; which one is used depends
  10722. on the input and output formats:
  10723. @itemize
  10724. @item
  10725. Hardware frame input, normal frame output
  10726. Map the input frames to system memory and pass them to the output. If the
  10727. original hardware frame is later required (for example, after overlaying
  10728. something else on part of it), the @option{hwmap} filter can be used again
  10729. in the next mode to retrieve it.
  10730. @item
  10731. Normal frame input, hardware frame output
  10732. If the input is actually a software-mapped hardware frame, then unmap it -
  10733. that is, return the original hardware frame.
  10734. Otherwise, a device must be provided. Create new hardware surfaces on that
  10735. device for the output, then map them back to the software format at the input
  10736. and give those frames to the preceding filter. This will then act like the
  10737. @option{hwupload} filter, but may be able to avoid an additional copy when
  10738. the input is already in a compatible format.
  10739. @item
  10740. Hardware frame input and output
  10741. A device must be supplied for the output, either directly or with the
  10742. @option{derive_device} option. The input and output devices must be of
  10743. different types and compatible - the exact meaning of this is
  10744. system-dependent, but typically it means that they must refer to the same
  10745. underlying hardware context (for example, refer to the same graphics card).
  10746. If the input frames were originally created on the output device, then unmap
  10747. to retrieve the original frames.
  10748. Otherwise, map the frames to the output device - create new hardware frames
  10749. on the output corresponding to the frames on the input.
  10750. @end itemize
  10751. The following additional parameters are accepted:
  10752. @table @option
  10753. @item mode
  10754. Set the frame mapping mode. Some combination of:
  10755. @table @var
  10756. @item read
  10757. The mapped frame should be readable.
  10758. @item write
  10759. The mapped frame should be writeable.
  10760. @item overwrite
  10761. The mapping will always overwrite the entire frame.
  10762. This may improve performance in some cases, as the original contents of the
  10763. frame need not be loaded.
  10764. @item direct
  10765. The mapping must not involve any copying.
  10766. Indirect mappings to copies of frames are created in some cases where either
  10767. direct mapping is not possible or it would have unexpected properties.
  10768. Setting this flag ensures that the mapping is direct and will fail if that is
  10769. not possible.
  10770. @end table
  10771. Defaults to @var{read+write} if not specified.
  10772. @item derive_device @var{type}
  10773. Rather than using the device supplied at initialisation, instead derive a new
  10774. device of type @var{type} from the device the input frames exist on.
  10775. @item reverse
  10776. In a hardware to hardware mapping, map in reverse - create frames in the sink
  10777. and map them back to the source. This may be necessary in some cases where
  10778. a mapping in one direction is required but only the opposite direction is
  10779. supported by the devices being used.
  10780. This option is dangerous - it may break the preceding filter in undefined
  10781. ways if there are any additional constraints on that filter's output.
  10782. Do not use it without fully understanding the implications of its use.
  10783. @end table
  10784. @anchor{hwupload}
  10785. @section hwupload
  10786. Upload system memory frames to hardware surfaces.
  10787. The device to upload to must be supplied when the filter is initialised. If
  10788. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  10789. option or with the @option{derive_device} option. The input and output devices
  10790. must be of different types and compatible - the exact meaning of this is
  10791. system-dependent, but typically it means that they must refer to the same
  10792. underlying hardware context (for example, refer to the same graphics card).
  10793. The following additional parameters are accepted:
  10794. @table @option
  10795. @item derive_device @var{type}
  10796. Rather than using the device supplied at initialisation, instead derive a new
  10797. device of type @var{type} from the device the input frames exist on.
  10798. @end table
  10799. @anchor{hwupload_cuda}
  10800. @section hwupload_cuda
  10801. Upload system memory frames to a CUDA device.
  10802. It accepts the following optional parameters:
  10803. @table @option
  10804. @item device
  10805. The number of the CUDA device to use
  10806. @end table
  10807. @section hqx
  10808. Apply a high-quality magnification filter designed for pixel art. This filter
  10809. was originally created by Maxim Stepin.
  10810. It accepts the following option:
  10811. @table @option
  10812. @item n
  10813. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  10814. @code{hq3x} and @code{4} for @code{hq4x}.
  10815. Default is @code{3}.
  10816. @end table
  10817. @section hstack
  10818. Stack input videos horizontally.
  10819. All streams must be of same pixel format and of same height.
  10820. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  10821. to create same output.
  10822. The filter accepts the following option:
  10823. @table @option
  10824. @item inputs
  10825. Set number of input streams. Default is 2.
  10826. @item shortest
  10827. If set to 1, force the output to terminate when the shortest input
  10828. terminates. Default value is 0.
  10829. @end table
  10830. @section hsvhold
  10831. Turns a certain HSV range into gray values.
  10832. This filter measures color difference between set HSV color in options
  10833. and ones measured in video stream. Depending on options, output
  10834. colors can be changed to be gray or not.
  10835. The filter accepts the following options:
  10836. @table @option
  10837. @item hue
  10838. Set the hue value which will be used in color difference calculation.
  10839. Allowed range is from -360 to 360. Default value is 0.
  10840. @item sat
  10841. Set the saturation value which will be used in color difference calculation.
  10842. Allowed range is from -1 to 1. Default value is 0.
  10843. @item val
  10844. Set the value which will be used in color difference calculation.
  10845. Allowed range is from -1 to 1. Default value is 0.
  10846. @item similarity
  10847. Set similarity percentage with the key color.
  10848. Allowed range is from 0 to 1. Default value is 0.01.
  10849. 0.00001 matches only the exact key color, while 1.0 matches everything.
  10850. @item blend
  10851. Blend percentage.
  10852. Allowed range is from 0 to 1. Default value is 0.
  10853. 0.0 makes pixels either fully gray, or not gray at all.
  10854. Higher values result in more gray pixels, with a higher gray pixel
  10855. the more similar the pixels color is to the key color.
  10856. @end table
  10857. @section hsvkey
  10858. Turns a certain HSV range into transparency.
  10859. This filter measures color difference between set HSV color in options
  10860. and ones measured in video stream. Depending on options, output
  10861. colors can be changed to transparent by adding alpha channel.
  10862. The filter accepts the following options:
  10863. @table @option
  10864. @item hue
  10865. Set the hue value which will be used in color difference calculation.
  10866. Allowed range is from -360 to 360. Default value is 0.
  10867. @item sat
  10868. Set the saturation value which will be used in color difference calculation.
  10869. Allowed range is from -1 to 1. Default value is 0.
  10870. @item val
  10871. Set the value which will be used in color difference calculation.
  10872. Allowed range is from -1 to 1. Default value is 0.
  10873. @item similarity
  10874. Set similarity percentage with the key color.
  10875. Allowed range is from 0 to 1. Default value is 0.01.
  10876. 0.00001 matches only the exact key color, while 1.0 matches everything.
  10877. @item blend
  10878. Blend percentage.
  10879. Allowed range is from 0 to 1. Default value is 0.
  10880. 0.0 makes pixels either fully transparent, or not transparent at all.
  10881. Higher values result in semi-transparent pixels, with a higher transparency
  10882. the more similar the pixels color is to the key color.
  10883. @end table
  10884. @section hue
  10885. Modify the hue and/or the saturation of the input.
  10886. It accepts the following parameters:
  10887. @table @option
  10888. @item h
  10889. Specify the hue angle as a number of degrees. It accepts an expression,
  10890. and defaults to "0".
  10891. @item s
  10892. Specify the saturation in the [-10,10] range. It accepts an expression and
  10893. defaults to "1".
  10894. @item H
  10895. Specify the hue angle as a number of radians. It accepts an
  10896. expression, and defaults to "0".
  10897. @item b
  10898. Specify the brightness in the [-10,10] range. It accepts an expression and
  10899. defaults to "0".
  10900. @end table
  10901. @option{h} and @option{H} are mutually exclusive, and can't be
  10902. specified at the same time.
  10903. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  10904. expressions containing the following constants:
  10905. @table @option
  10906. @item n
  10907. frame count of the input frame starting from 0
  10908. @item pts
  10909. presentation timestamp of the input frame expressed in time base units
  10910. @item r
  10911. frame rate of the input video, NAN if the input frame rate is unknown
  10912. @item t
  10913. timestamp expressed in seconds, NAN if the input timestamp is unknown
  10914. @item tb
  10915. time base of the input video
  10916. @end table
  10917. @subsection Examples
  10918. @itemize
  10919. @item
  10920. Set the hue to 90 degrees and the saturation to 1.0:
  10921. @example
  10922. hue=h=90:s=1
  10923. @end example
  10924. @item
  10925. Same command but expressing the hue in radians:
  10926. @example
  10927. hue=H=PI/2:s=1
  10928. @end example
  10929. @item
  10930. Rotate hue and make the saturation swing between 0
  10931. and 2 over a period of 1 second:
  10932. @example
  10933. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  10934. @end example
  10935. @item
  10936. Apply a 3 seconds saturation fade-in effect starting at 0:
  10937. @example
  10938. hue="s=min(t/3\,1)"
  10939. @end example
  10940. The general fade-in expression can be written as:
  10941. @example
  10942. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  10943. @end example
  10944. @item
  10945. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  10946. @example
  10947. hue="s=max(0\, min(1\, (8-t)/3))"
  10948. @end example
  10949. The general fade-out expression can be written as:
  10950. @example
  10951. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  10952. @end example
  10953. @end itemize
  10954. @subsection Commands
  10955. This filter supports the following commands:
  10956. @table @option
  10957. @item b
  10958. @item s
  10959. @item h
  10960. @item H
  10961. Modify the hue and/or the saturation and/or brightness of the input video.
  10962. The command accepts the same syntax of the corresponding option.
  10963. If the specified expression is not valid, it is kept at its current
  10964. value.
  10965. @end table
  10966. @section huesaturation
  10967. Apply hue-saturation-intensity adjustments to input video stream.
  10968. This filter operates in RGB colorspace.
  10969. This filter accepts the following options:
  10970. @table @option
  10971. @item hue
  10972. Set the hue shift in degrees to apply. Default is 0.
  10973. Allowed range is from -180 to 180.
  10974. @item saturation
  10975. Set the saturation shift. Default is 0.
  10976. Allowed range is from -1 to 1.
  10977. @item intensity
  10978. Set the intensity shift. Default is 0.
  10979. Allowed range is from -1 to 1.
  10980. @item colors
  10981. Set which primary and complementary colors are going to be adjusted.
  10982. This options is set by providing one or multiple values.
  10983. This can select multiple colors at once. By default all colors are selected.
  10984. @table @samp
  10985. @item r
  10986. Adjust reds.
  10987. @item y
  10988. Adjust yellows.
  10989. @item g
  10990. Adjust greens.
  10991. @item c
  10992. Adjust cyans.
  10993. @item b
  10994. Adjust blues.
  10995. @item m
  10996. Adjust magentas.
  10997. @item a
  10998. Adjust all colors.
  10999. @end table
  11000. @item strength
  11001. Set strength of filtering. Allowed range is from 0 to 100.
  11002. Default value is 1.
  11003. @item rw, gw, bw
  11004. Set weight for each RGB component. Allowed range is from 0 to 1.
  11005. By default is set to 0.333, 0.334, 0.333.
  11006. Those options are used in saturation and lightess processing.
  11007. @item lightness
  11008. Set preserving lightness, by default is disabled.
  11009. Adjusting hues can change lightness from original RGB triplet,
  11010. with this option enabled lightness is kept at same value.
  11011. @end table
  11012. @section hysteresis
  11013. Grow first stream into second stream by connecting components.
  11014. This makes it possible to build more robust edge masks.
  11015. This filter accepts the following options:
  11016. @table @option
  11017. @item planes
  11018. Set which planes will be processed as bitmap, unprocessed planes will be
  11019. copied from first stream.
  11020. By default value 0xf, all planes will be processed.
  11021. @item threshold
  11022. Set threshold which is used in filtering. If pixel component value is higher than
  11023. this value filter algorithm for connecting components is activated.
  11024. By default value is 0.
  11025. @end table
  11026. The @code{hysteresis} filter also supports the @ref{framesync} options.
  11027. @section iccdetect
  11028. Detect the colorspace from an embedded ICC profile (if present), and update
  11029. the frame's tags accordingly.
  11030. This filter accepts the following options:
  11031. @table @option
  11032. @item force
  11033. If true, the frame's existing colorspace tags will always be overridden by
  11034. values detected from an ICC profile. Otherwise, they will only be assigned if
  11035. they contain @code{unknown}. Enabled by default.
  11036. @end table
  11037. @section iccgen
  11038. Generate ICC profiles and attach them to frames.
  11039. This filter accepts the following options:
  11040. @table @option
  11041. @item color_primaries
  11042. @item color_trc
  11043. Configure the colorspace that the ICC profile will be generated for. The
  11044. default value of @code{auto} infers the value from the input frame's metadata,
  11045. defaulting to BT.709/sRGB as appropriate.
  11046. See the @ref{setparams} filter for a list of possible values, but note that
  11047. @code{unknown} are not valid values for this filter.
  11048. @item force
  11049. If true, an ICC profile will be generated even if it would overwrite an
  11050. already existing ICC profile. Disabled by default.
  11051. @end table
  11052. @section identity
  11053. Obtain the identity score between two input videos.
  11054. This filter takes two input videos.
  11055. Both input videos must have the same resolution and pixel format for
  11056. this filter to work correctly. Also it assumes that both inputs
  11057. have the same number of frames, which are compared one by one.
  11058. The obtained per component, average, min and max identity score is printed through
  11059. the logging system.
  11060. The filter stores the calculated identity scores of each frame in frame metadata.
  11061. In the below example the input file @file{main.mpg} being processed is compared
  11062. with the reference file @file{ref.mpg}.
  11063. @example
  11064. ffmpeg -i main.mpg -i ref.mpg -lavfi identity -f null -
  11065. @end example
  11066. @section idet
  11067. Detect video interlacing type.
  11068. This filter tries to detect if the input frames are interlaced, progressive,
  11069. top or bottom field first. It will also try to detect fields that are
  11070. repeated between adjacent frames (a sign of telecine).
  11071. Single frame detection considers only immediately adjacent frames when classifying each frame.
  11072. Multiple frame detection incorporates the classification history of previous frames.
  11073. The filter will log these metadata values:
  11074. @table @option
  11075. @item single.current_frame
  11076. Detected type of current frame using single-frame detection. One of:
  11077. ``tff'' (top field first), ``bff'' (bottom field first),
  11078. ``progressive'', or ``undetermined''
  11079. @item single.tff
  11080. Cumulative number of frames detected as top field first using single-frame detection.
  11081. @item multiple.tff
  11082. Cumulative number of frames detected as top field first using multiple-frame detection.
  11083. @item single.bff
  11084. Cumulative number of frames detected as bottom field first using single-frame detection.
  11085. @item multiple.current_frame
  11086. Detected type of current frame using multiple-frame detection. One of:
  11087. ``tff'' (top field first), ``bff'' (bottom field first),
  11088. ``progressive'', or ``undetermined''
  11089. @item multiple.bff
  11090. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  11091. @item single.progressive
  11092. Cumulative number of frames detected as progressive using single-frame detection.
  11093. @item multiple.progressive
  11094. Cumulative number of frames detected as progressive using multiple-frame detection.
  11095. @item single.undetermined
  11096. Cumulative number of frames that could not be classified using single-frame detection.
  11097. @item multiple.undetermined
  11098. Cumulative number of frames that could not be classified using multiple-frame detection.
  11099. @item repeated.current_frame
  11100. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  11101. @item repeated.neither
  11102. Cumulative number of frames with no repeated field.
  11103. @item repeated.top
  11104. Cumulative number of frames with the top field repeated from the previous frame's top field.
  11105. @item repeated.bottom
  11106. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  11107. @end table
  11108. The filter accepts the following options:
  11109. @table @option
  11110. @item intl_thres
  11111. Set interlacing threshold.
  11112. @item prog_thres
  11113. Set progressive threshold.
  11114. @item rep_thres
  11115. Threshold for repeated field detection.
  11116. @item half_life
  11117. Number of frames after which a given frame's contribution to the
  11118. statistics is halved (i.e., it contributes only 0.5 to its
  11119. classification). The default of 0 means that all frames seen are given
  11120. full weight of 1.0 forever.
  11121. @item analyze_interlaced_flag
  11122. When this is not 0 then idet will use the specified number of frames to determine
  11123. if the interlaced flag is accurate, it will not count undetermined frames.
  11124. If the flag is found to be accurate it will be used without any further
  11125. computations, if it is found to be inaccurate it will be cleared without any
  11126. further computations. This allows inserting the idet filter as a low computational
  11127. method to clean up the interlaced flag
  11128. @end table
  11129. @section il
  11130. Deinterleave or interleave fields.
  11131. This filter allows one to process interlaced images fields without
  11132. deinterlacing them. Deinterleaving splits the input frame into 2
  11133. fields (so called half pictures). Odd lines are moved to the top
  11134. half of the output image, even lines to the bottom half.
  11135. You can process (filter) them independently and then re-interleave them.
  11136. The filter accepts the following options:
  11137. @table @option
  11138. @item luma_mode, l
  11139. @item chroma_mode, c
  11140. @item alpha_mode, a
  11141. Available values for @var{luma_mode}, @var{chroma_mode} and
  11142. @var{alpha_mode} are:
  11143. @table @samp
  11144. @item none
  11145. Do nothing.
  11146. @item deinterleave, d
  11147. Deinterleave fields, placing one above the other.
  11148. @item interleave, i
  11149. Interleave fields. Reverse the effect of deinterleaving.
  11150. @end table
  11151. Default value is @code{none}.
  11152. @item luma_swap, ls
  11153. @item chroma_swap, cs
  11154. @item alpha_swap, as
  11155. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  11156. @end table
  11157. @subsection Commands
  11158. This filter supports the all above options as @ref{commands}.
  11159. @section inflate
  11160. Apply inflate effect to the video.
  11161. This filter replaces the pixel by the local(3x3) average by taking into account
  11162. only values higher than the pixel.
  11163. It accepts the following options:
  11164. @table @option
  11165. @item threshold0
  11166. @item threshold1
  11167. @item threshold2
  11168. @item threshold3
  11169. Limit the maximum change for each plane, default is 65535.
  11170. If 0, plane will remain unchanged.
  11171. @end table
  11172. @subsection Commands
  11173. This filter supports the all above options as @ref{commands}.
  11174. @section interlace
  11175. Simple interlacing filter from progressive contents. This interleaves upper (or
  11176. lower) lines from odd frames with lower (or upper) lines from even frames,
  11177. halving the frame rate and preserving image height.
  11178. @example
  11179. Original Original New Frame
  11180. Frame 'j' Frame 'j+1' (tff)
  11181. ========== =========== ==================
  11182. Line 0 --------------------> Frame 'j' Line 0
  11183. Line 1 Line 1 ----> Frame 'j+1' Line 1
  11184. Line 2 ---------------------> Frame 'j' Line 2
  11185. Line 3 Line 3 ----> Frame 'j+1' Line 3
  11186. ... ... ...
  11187. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  11188. @end example
  11189. It accepts the following optional parameters:
  11190. @table @option
  11191. @item scan
  11192. This determines whether the interlaced frame is taken from the even
  11193. (tff - default) or odd (bff) lines of the progressive frame.
  11194. @item lowpass
  11195. Vertical lowpass filter to avoid twitter interlacing and
  11196. reduce moire patterns.
  11197. @table @samp
  11198. @item 0, off
  11199. Disable vertical lowpass filter
  11200. @item 1, linear
  11201. Enable linear filter (default)
  11202. @item 2, complex
  11203. Enable complex filter. This will slightly less reduce twitter and moire
  11204. but better retain detail and subjective sharpness impression.
  11205. @end table
  11206. @end table
  11207. @section kerndeint
  11208. Deinterlace input video by applying Donald Graft's adaptive kernel
  11209. deinterling. Work on interlaced parts of a video to produce
  11210. progressive frames.
  11211. The description of the accepted parameters follows.
  11212. @table @option
  11213. @item thresh
  11214. Set the threshold which affects the filter's tolerance when
  11215. determining if a pixel line must be processed. It must be an integer
  11216. in the range [0,255] and defaults to 10. A value of 0 will result in
  11217. applying the process on every pixels.
  11218. @item map
  11219. Paint pixels exceeding the threshold value to white if set to 1.
  11220. Default is 0.
  11221. @item order
  11222. Set the fields order. Swap fields if set to 1, leave fields alone if
  11223. 0. Default is 0.
  11224. @item sharp
  11225. Enable additional sharpening if set to 1. Default is 0.
  11226. @item twoway
  11227. Enable twoway sharpening if set to 1. Default is 0.
  11228. @end table
  11229. @subsection Examples
  11230. @itemize
  11231. @item
  11232. Apply default values:
  11233. @example
  11234. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  11235. @end example
  11236. @item
  11237. Enable additional sharpening:
  11238. @example
  11239. kerndeint=sharp=1
  11240. @end example
  11241. @item
  11242. Paint processed pixels in white:
  11243. @example
  11244. kerndeint=map=1
  11245. @end example
  11246. @end itemize
  11247. @section kirsch
  11248. Apply kirsch operator to input video stream.
  11249. The filter accepts the following option:
  11250. @table @option
  11251. @item planes
  11252. Set which planes will be processed, unprocessed planes will be copied.
  11253. By default value 0xf, all planes will be processed.
  11254. @item scale
  11255. Set value which will be multiplied with filtered result.
  11256. @item delta
  11257. Set value which will be added to filtered result.
  11258. @end table
  11259. @subsection Commands
  11260. This filter supports the all above options as @ref{commands}.
  11261. @section lagfun
  11262. Slowly update darker pixels.
  11263. This filter makes short flashes of light appear longer.
  11264. This filter accepts the following options:
  11265. @table @option
  11266. @item decay
  11267. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  11268. @item planes
  11269. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  11270. @end table
  11271. @subsection Commands
  11272. This filter supports the all above options as @ref{commands}.
  11273. @section lenscorrection
  11274. Correct radial lens distortion
  11275. This filter can be used to correct for radial distortion as can result from the use
  11276. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  11277. one can use tools available for example as part of opencv or simply trial-and-error.
  11278. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  11279. and extract the k1 and k2 coefficients from the resulting matrix.
  11280. Note that effectively the same filter is available in the open-source tools Krita and
  11281. Digikam from the KDE project.
  11282. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  11283. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  11284. brightness distribution, so you may want to use both filters together in certain
  11285. cases, though you will have to take care of ordering, i.e. whether vignetting should
  11286. be applied before or after lens correction.
  11287. @subsection Options
  11288. The filter accepts the following options:
  11289. @table @option
  11290. @item cx
  11291. Relative x-coordinate of the focal point of the image, and thereby the center of the
  11292. distortion. This value has a range [0,1] and is expressed as fractions of the image
  11293. width. Default is 0.5.
  11294. @item cy
  11295. Relative y-coordinate of the focal point of the image, and thereby the center of the
  11296. distortion. This value has a range [0,1] and is expressed as fractions of the image
  11297. height. Default is 0.5.
  11298. @item k1
  11299. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  11300. no correction. Default is 0.
  11301. @item k2
  11302. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  11303. 0 means no correction. Default is 0.
  11304. @item i
  11305. Set interpolation type. Can be @code{nearest} or @code{bilinear}.
  11306. Default is @code{nearest}.
  11307. @item fc
  11308. Specify the color of the unmapped pixels. For the syntax of this option,
  11309. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11310. manual,ffmpeg-utils}. Default color is @code{black@@0}.
  11311. @end table
  11312. The formula that generates the correction is:
  11313. @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)
  11314. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  11315. distances from the focal point in the source and target images, respectively.
  11316. @subsection Commands
  11317. This filter supports the all above options as @ref{commands}.
  11318. @section lensfun
  11319. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  11320. The @code{lensfun} filter requires the camera make, camera model, and lens model
  11321. to apply the lens correction. The filter will load the lensfun database and
  11322. query it to find the corresponding camera and lens entries in the database. As
  11323. long as these entries can be found with the given options, the filter can
  11324. perform corrections on frames. Note that incomplete strings will result in the
  11325. filter choosing the best match with the given options, and the filter will
  11326. output the chosen camera and lens models (logged with level "info"). You must
  11327. provide the make, camera model, and lens model as they are required.
  11328. To obtain a list of available makes and models, leave out one or both of @code{make} and
  11329. @code{model} options. The filter will send the full list to the log with level @code{INFO}.
  11330. The first column is the make and the second column is the model.
  11331. To obtain a list of available lenses, set any values for make and model and leave out the
  11332. @code{lens_model} option. The filter will send the full list of lenses in the log with level
  11333. @code{INFO}. The ffmpeg tool will exit after the list is printed.
  11334. The filter accepts the following options:
  11335. @table @option
  11336. @item make
  11337. The make of the camera (for example, "Canon"). This option is required.
  11338. @item model
  11339. The model of the camera (for example, "Canon EOS 100D"). This option is
  11340. required.
  11341. @item lens_model
  11342. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  11343. option is required.
  11344. @item db_path
  11345. The full path to the lens database folder. If not set, the filter will attempt to
  11346. load the database from the install path when the library was built. Default is unset.
  11347. @item mode
  11348. The type of correction to apply. The following values are valid options:
  11349. @table @samp
  11350. @item vignetting
  11351. Enables fixing lens vignetting.
  11352. @item geometry
  11353. Enables fixing lens geometry. This is the default.
  11354. @item subpixel
  11355. Enables fixing chromatic aberrations.
  11356. @item vig_geo
  11357. Enables fixing lens vignetting and lens geometry.
  11358. @item vig_subpixel
  11359. Enables fixing lens vignetting and chromatic aberrations.
  11360. @item distortion
  11361. Enables fixing both lens geometry and chromatic aberrations.
  11362. @item all
  11363. Enables all possible corrections.
  11364. @end table
  11365. @item focal_length
  11366. The focal length of the image/video (zoom; expected constant for video). For
  11367. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  11368. range should be chosen when using that lens. Default 18.
  11369. @item aperture
  11370. The aperture of the image/video (expected constant for video). Note that
  11371. aperture is only used for vignetting correction. Default 3.5.
  11372. @item focus_distance
  11373. The focus distance of the image/video (expected constant for video). Note that
  11374. focus distance is only used for vignetting and only slightly affects the
  11375. vignetting correction process. If unknown, leave it at the default value (which
  11376. is 1000).
  11377. @item scale
  11378. The scale factor which is applied after transformation. After correction the
  11379. video is no longer necessarily rectangular. This parameter controls how much of
  11380. the resulting image is visible. The value 0 means that a value will be chosen
  11381. automatically such that there is little or no unmapped area in the output
  11382. image. 1.0 means that no additional scaling is done. Lower values may result
  11383. in more of the corrected image being visible, while higher values may avoid
  11384. unmapped areas in the output.
  11385. @item target_geometry
  11386. The target geometry of the output image/video. The following values are valid
  11387. options:
  11388. @table @samp
  11389. @item rectilinear (default)
  11390. @item fisheye
  11391. @item panoramic
  11392. @item equirectangular
  11393. @item fisheye_orthographic
  11394. @item fisheye_stereographic
  11395. @item fisheye_equisolid
  11396. @item fisheye_thoby
  11397. @end table
  11398. @item reverse
  11399. Apply the reverse of image correction (instead of correcting distortion, apply
  11400. it).
  11401. @item interpolation
  11402. The type of interpolation used when correcting distortion. The following values
  11403. are valid options:
  11404. @table @samp
  11405. @item nearest
  11406. @item linear (default)
  11407. @item lanczos
  11408. @end table
  11409. @end table
  11410. @subsection Examples
  11411. @itemize
  11412. @item
  11413. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  11414. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  11415. aperture of "8.0".
  11416. @example
  11417. 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
  11418. @end example
  11419. @item
  11420. Apply the same as before, but only for the first 5 seconds of video.
  11421. @example
  11422. 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
  11423. @end example
  11424. @end itemize
  11425. @section libplacebo
  11426. Flexible GPU-accelerated processing filter based on libplacebo
  11427. (@url{https://code.videolan.org/videolan/libplacebo}). Note that this filter
  11428. currently only accepts Vulkan input frames.
  11429. @subsection Options
  11430. The options for this filter are divided into the following sections:
  11431. @subsubsection Output mode
  11432. These options control the overall output mode. By default, libplacebo will try
  11433. to preserve the source colorimetry and size as best as it can, but it will
  11434. apply any embedded film grain, dolby vision metadata or anamorphic SAR present
  11435. in source frames.
  11436. @table @option
  11437. @item w
  11438. @item h
  11439. Set the output video dimension expression. Default value is the input dimension.
  11440. Allows for the same expressions as the @ref{scale} filter.
  11441. @item format
  11442. Set the output format override. If unset (the default), frames will be output
  11443. in the same format as the respective input frames. Otherwise, format conversion
  11444. will be performed.
  11445. @item force_original_aspect_ratio
  11446. @item force_divisible_by
  11447. Work the same as the identical @ref{scale} filter options.
  11448. @item normalize_sar
  11449. If enabled (the default), output frames will always have a pixel aspect ratio
  11450. of 1:1. If disabled, any aspect ratio mismatches, including those from e.g.
  11451. anamorphic video sources, are forwarded to the output pixel aspect ratio.
  11452. @item pad_crop_ratio
  11453. Specifies a ratio (between @code{0.0} and @code{1.0}) between padding and
  11454. cropping when the input aspect ratio does not match the output aspect ratio and
  11455. @option{normalize_sar} is in effect. The default of @code{0.0} always pads the
  11456. content with black borders, while a value of @code{1.0} always crops off parts
  11457. of the content. Intermediate values are possible, leading to a mix of the two
  11458. approaches.
  11459. @item colorspace
  11460. @item color_primaries
  11461. @item color_trc
  11462. @item range
  11463. Configure the colorspace that output frames will be delivered in. The default
  11464. value of @code{auto} outputs frames in the same format as the input frames,
  11465. leading to no change. For any other value, conversion will be performed.
  11466. See the @ref{setparams} filter for a list of possible values.
  11467. @item apply_filmgrain
  11468. Apply film grain (e.g. AV1 or H.274) if present in source frames, and strip
  11469. it from the output. Enabled by default.
  11470. @item apply_dolbyvision
  11471. Apply Dolby Vision RPU metadata if present in source frames, and strip it from
  11472. the output. Enabled by default. Note that Dolby Vision will always output
  11473. BT.2020+PQ, overriding the usual input frame metadata. These will also be
  11474. picked as the values of @code{auto} for the respective frame output options.
  11475. @end table
  11476. @subsubsection Scaling
  11477. The options in this section control how libplacebo performs upscaling and (if
  11478. necessary) downscaling. Note that libplacebo will always internally operate on
  11479. 4:4:4 content, so any sub-sampled chroma formats such as @code{yuv420p} will
  11480. necessarily be upsampled and downsampled as part of the rendering process. That
  11481. means scaling might be in effect even if the source and destination resolution
  11482. are the same.
  11483. @table @option
  11484. @item upscaler
  11485. @item downscaler
  11486. Configure the filter kernel used for upscaling and downscaling. The respective
  11487. defaults are @code{spline36} and @code{mitchell}. For a full list of possible
  11488. values, pass @code{help} to these options. The most important values are:
  11489. @table @samp
  11490. @item none
  11491. Forces the use of built-in GPU texture sampling (typically bilinear). Extremely
  11492. fast but poor quality, especially when downscaling.
  11493. @item bilinear
  11494. Bilinear interpolation. Can generally be done for free on GPUs, except when
  11495. doing so would lead to aliasing. Fast and low quality.
  11496. @item nearest
  11497. Nearest-neighbour interpolation. Sharp but highly aliasing.
  11498. @item oversample
  11499. Algorithm that looks visually similar to nearest-neighbour interpolation but
  11500. tries to preserve pixel aspect ratio. Good for pixel art, since it results in
  11501. minimal distortion of the artistic appearance.
  11502. @item lanczos
  11503. Standard sinc-sinc interpolation kernel.
  11504. @item spline36
  11505. Cubic spline approximation of lanczos. No difference in performance, but has
  11506. very slightly less ringing.
  11507. @item ewa_lanczos
  11508. Elliptically weighted average version of lanczos, based on a jinc-sinc kernel.
  11509. This is also popularly referred to as just "Jinc scaling". Slow but very high
  11510. quality.
  11511. @item gaussian
  11512. Gaussian kernel. Has certain ideal mathematical properties, but subjectively
  11513. very blurry.
  11514. @item mitchell
  11515. Cubic BC spline with parameters recommended by Mitchell and Netravali. Very
  11516. little ringing.
  11517. @end table
  11518. @item lut_entries
  11519. Configures the size of scaler LUTs, ranging from @code{1} to @code{256}. The
  11520. default of @code{0} will pick libplacebo's internal default, typically
  11521. @code{64}.
  11522. @item antiringing
  11523. Enables anti-ringing (for non-EWA filters). The value (between @code{0.0} and
  11524. @code{1.0}) configures the strength of the anti-ringing algorithm. May increase
  11525. aliasing if set too high. Disabled by default.
  11526. @item sigmoid
  11527. Enable sigmoidal compression during upscaling. Reduces ringing slightly.
  11528. Enabled by default.
  11529. @end table
  11530. @subsubsection Debanding
  11531. Libplacebo comes with a built-in debanding filter that is good at counteracting
  11532. many common sources of banding and blocking. Turning this on is highly
  11533. recommended whenever quality is desired.
  11534. @table @option
  11535. @item deband
  11536. Enable (fast) debanding algorithm. Disabled by default.
  11537. @item deband_iterations
  11538. Number of deband iterations of the debanding algorithm. Each iteration is
  11539. performed with progressively increased radius (and diminished threshold).
  11540. Recommended values are in the range @code{1} to @code{4}. Defaults to @code{1}.
  11541. @item deband_threshold
  11542. Debanding filter strength. Higher numbers lead to more aggressive debanding.
  11543. Defaults to @code{4.0}.
  11544. @item deband_radius
  11545. Debanding filter radius. A higher radius is better for slow gradients, while
  11546. a lower radius is better for steep gradients. Defaults to @code{16.0}.
  11547. @item deband_grain
  11548. Amount of extra output grain to add. Helps hide imperfections. Defaults to
  11549. @code{6.0}.
  11550. @end table
  11551. @subsubsection Color adjustment
  11552. A collection of subjective color controls. Not very rigorous, so the exact
  11553. effect will vary somewhat depending on the input primaries and colorspace.
  11554. @table @option
  11555. @item brightness
  11556. Brightness boost, between @code{-1.0} and @code{1.0}. Defaults to @code{0.0}.
  11557. @item contrast
  11558. Contrast gain, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  11559. @item saturation
  11560. Saturation gain, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  11561. @item hue
  11562. Hue shift in radians, between @code{-3.14} and @code{3.14}. Defaults to
  11563. @code{0.0}. This will rotate the UV subvector, defaulting to BT.709
  11564. coefficients for RGB inputs.
  11565. @item gamma
  11566. Gamma adjustment, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  11567. @item cones
  11568. Cone model to use for color blindness simulation. Accepts any combination of
  11569. @code{l}, @code{m} and @code{s}. Here are some examples:
  11570. @table @samp
  11571. @item m
  11572. Deuteranomaly / deuteranopia (affecting 3%-4% of the population)
  11573. @item l
  11574. Protanomaly / protanopia (affecting 1%-2% of the population)
  11575. @item l+m
  11576. Monochromacy (very rare)
  11577. @item l+m+s
  11578. Achromatopsy (complete loss of daytime vision, extremely rare)
  11579. @end table
  11580. @item cone-strength
  11581. Gain factor for the cones specified by @code{cones}, between @code{0.0} and
  11582. @code{10.0}. A value of @code{1.0} results in no change to color vision. A
  11583. value of @code{0.0} (the default) simulates complete loss of those cones. Values
  11584. above @code{1.0} result in exaggerating the differences between cones, which
  11585. may help compensate for reduced color vision.
  11586. @end table
  11587. @subsubsection Peak detection
  11588. To help deal with sources that only have static HDR10 metadata (or no tagging
  11589. whatsoever), libplacebo uses its own internal frame analysis compute shader to
  11590. analyze source frames and adapt the tone mapping function in realtime. If this
  11591. is too slow, or if exactly reproducible frame-perfect results are needed, it's
  11592. recommended to turn this feature off.
  11593. @table @option
  11594. @item peak_detect
  11595. Enable HDR peak detection. Ignores static MaxCLL/MaxFALL values in favor of
  11596. dynamic detection from the input. Note that the detected values do not get
  11597. written back to the output frames, they merely guide the internal tone mapping
  11598. process. Enabled by default.
  11599. @item smoothing_period
  11600. Peak detection smoothing period, between @code{0.0} and @code{1000.0}. Higher
  11601. values result in peak detection becoming less responsive to changes in the
  11602. input. Defaults to @code{100.0}.
  11603. @item minimum_peak
  11604. Lower bound on the detected peak (relative to SDR white), between @code{0.0}
  11605. and @code{100.0}. Defaults to @code{1.0}.
  11606. @item scene_threshold_low
  11607. @item scene_threshold_high
  11608. Lower and upper thresholds for scene change detection. Expressed in a
  11609. logarithmic scale between @code{0.0} and @code{100.0}. Default to @code{5.5}
  11610. and @code{10.0}, respectively. Setting either to a negative value disables
  11611. this functionality.
  11612. @item overshoot
  11613. Peak smoothing overshoot margin, between @code{0.0} and @code{1.0}. Provides a
  11614. safety margin to prevent clipping as a result of peak smoothing. Defaults to
  11615. @code{0.05}, corresponding to a margin of 5%.
  11616. @end table
  11617. @subsubsection Tone mapping
  11618. The options in this section control how libplacebo performs tone-mapping and
  11619. gamut-mapping when dealing with mismatches between wide-gamut or HDR content.
  11620. In general, libplacebo relies on accurate source tagging and mastering display
  11621. gamut information to produce the best results.
  11622. @table @option
  11623. @item intent
  11624. Rendering intent to use when adapting between different primary color gamuts
  11625. (after tone-mapping).
  11626. @table @samp
  11627. @item perceptual
  11628. Perceptual gamut mapping. Currently equivalent to relative colorimetric.
  11629. @item relative
  11630. Relative colorimetric. This is the default.
  11631. @item absolute
  11632. Absolute colorimetric.
  11633. @item saturation
  11634. Saturation mapping. Forcibly stretches the source gamut to the target gamut.
  11635. @end table
  11636. @item gamut_mode
  11637. How to handle out-of-gamut colors that can occur as a result of colorimetric
  11638. gamut mapping.
  11639. @table @samp
  11640. @item clip
  11641. Do nothing, simply clip out-of-range colors to the RGB volume. This is the
  11642. default.
  11643. @item warn
  11644. Highlight out-of-gamut pixels (by coloring them pink).
  11645. @item darken
  11646. Linearly reduces content brightness to preserves saturated details, followed by
  11647. clipping the remaining out-of-gamut colors. As the name implies, this makes
  11648. everything darker, but provides a good balance between preserving details and
  11649. colors.
  11650. @item desaturate
  11651. Hard-desaturates out-of-gamut colors towards white, while preserving the
  11652. luminance. Has a tendency to shift colors.
  11653. @end table
  11654. @item tonemapping
  11655. Tone-mapping algorithm to use. Available values are:
  11656. @table @samp
  11657. @item auto
  11658. Automatic selection based on internal heuristics. This is the default.
  11659. @item clip
  11660. Performs no tone-mapping, just clips out-of-range colors. Retains perfect color
  11661. accuracy for in-range colors but completely destroys out-of-range information.
  11662. Does not perform any black point adaptation. Not configurable.
  11663. @item bt.2390
  11664. EETF from the ITU-R Report BT.2390, a hermite spline roll-off with linear
  11665. segment. The knee point offset is configurable. Note that this parameter
  11666. defaults to @code{1.0}, rather than the value of @code{0.5} from the ITU-R
  11667. spec.
  11668. @item bt.2446a
  11669. EETF from ITU-R Report BT.2446, method A. Designed for well-mastered HDR
  11670. sources. Can be used for both forward and inverse tone mapping. Not
  11671. configurable.
  11672. @item spline
  11673. Simple spline consisting of two polynomials, joined by a single pivot point.
  11674. The parameter gives the pivot point (in PQ space), defaulting to @code{0.30}.
  11675. Can be used for both forward and inverse tone mapping.
  11676. @item reinhard
  11677. Simple non-linear, global tone mapping algorithm. The parameter specifies the
  11678. local contrast coefficient at the display peak. Essentially, a parameter of
  11679. @code{0.5} implies that the reference white will be about half as bright as
  11680. when clipping. Defaults to @code{0.5}, which results in the simplest
  11681. formulation of this function.
  11682. @item mobius
  11683. Generalization of the reinhard tone mapping algorithm to support an additional
  11684. linear slope near black. The tone mapping parameter indicates the trade-off
  11685. between the linear section and the non-linear section. Essentially, for a given
  11686. parameter @var{x}, every color value below @var{x} will be mapped linearly,
  11687. while higher values get non-linearly tone-mapped. Values near @code{1.0} make
  11688. this curve behave like @code{clip}, while values near @code{0.0} make this
  11689. curve behave like @code{reinhard}. The default value is @code{0.3}, which
  11690. provides a good balance between colorimetric accuracy and preserving
  11691. out-of-gamut details.
  11692. @item hable
  11693. Piece-wise, filmic tone-mapping algorithm developed by John Hable for use in
  11694. Uncharted 2, inspired by a similar tone-mapping algorithm used by Kodak.
  11695. Popularized by its use in video games with HDR rendering. Preserves both dark
  11696. and bright details very well, but comes with the drawback of changing the
  11697. average brightness quite significantly. This is sort of similar to
  11698. @code{reinhard} with parameter @code{0.24}.
  11699. @item gamma
  11700. Fits a gamma (power) function to transfer between the source and target color
  11701. spaces, effectively resulting in a perceptual hard-knee joining two roughly
  11702. linear sections. This preserves details at all scales fairly accurately, but
  11703. can result in an image with a muted or dull appearance. The parameter is used
  11704. as the cutoff point, defaulting to @code{0.5}.
  11705. @item linear
  11706. Linearly stretches the input range to the output range, in PQ space. This will
  11707. preserve all details accurately, but results in a significantly different
  11708. average brightness. Can be used for inverse tone-mapping in addition to regular
  11709. tone-mapping. The parameter can be used as an additional linear gain
  11710. coefficient (defaulting to @code{1.0}).
  11711. @end table
  11712. @item tonemapping_param
  11713. For tunable tone mapping functions, this parameter can be used to fine-tune the
  11714. curve behavior. Refer to the documentation of @code{tonemapping}. The default
  11715. value of @code{0.0} is replaced by the curve's preferred default setting.
  11716. @item tonemapping_mode
  11717. This option determines how the tone mapping function specified by
  11718. @code{tonemapping} is applied to the colors in a scene. Possible values are:
  11719. @table @samp
  11720. @item auto
  11721. Automatic selection based on internal heuristics. This is the default.
  11722. @item rgb
  11723. Apply the function per-channel in the RGB colorspace.
  11724. Per-channel tone-mapping in RGB. Guarantees no clipping and heavily desaturates
  11725. the output, but distorts the colors quite significantly. Very similar to the
  11726. "Hollywood" look and feel.
  11727. @item max
  11728. Tone-mapping is performed on the brightest component found in the signal. Good
  11729. at preserving details in highlights, but has a tendency to crush blacks.
  11730. @item hybrid
  11731. Tone-map per-channel for highlights and linearly (luma-based) for
  11732. midtones/shadows, based on a fixed gamma @code{2.4} coefficient curve.
  11733. @item luma
  11734. Tone-map linearly on the luma component (CIE Y), and adjust (desaturate) the
  11735. chromaticities to compensate using a simple constant factor. This is
  11736. essentially the mode used in ITU-R BT.2446 method A.
  11737. @end table
  11738. @item inverse_tonemapping
  11739. If enabled, this filter will also attempt stretching SDR signals to fill HDR
  11740. output color volumes. Disabled by default.
  11741. @item tonemapping_crosstalk
  11742. Extra tone-mapping crosstalk factor, between @code{0.0} and @code{0.3}. This
  11743. can help reduce issues tone-mapping certain bright spectral colors. Defaults to
  11744. @code{0.04}.
  11745. @item tonemapping_lut_size
  11746. Size of the tone-mapping LUT, between @code{2} and @code{1024}. Defaults to
  11747. @code{256}. Note that this figure is squared when combined with
  11748. @code{peak_detect}.
  11749. @end table
  11750. @subsubsection Dithering
  11751. By default, libplacebo will dither whenever necessary, which includes rendering
  11752. to any integer format below 16-bit precision. It's recommended to always leave
  11753. this on, since not doing so may result in visible banding in the output, even
  11754. if the @code{debanding} filter is enabled. If maximum performance is needed,
  11755. use @code{ordered_fixed} instead of disabling dithering.
  11756. @table @option
  11757. @item dithering
  11758. Dithering method to use. Accepts the following values:
  11759. @table @samp
  11760. @item none
  11761. Disables dithering completely. May result in visible banding.
  11762. @item blue
  11763. Dither with pseudo-blue noise. This is the default.
  11764. @item ordered
  11765. Tunable ordered dither pattern.
  11766. @item ordered_fixed
  11767. Faster ordered dither with a fixed size of @code{6}. Texture-less.
  11768. @item white
  11769. Dither with white noise. Texture-less.
  11770. @end table
  11771. @item dither_lut_size
  11772. Dither LUT size, as log base2 between @code{1} and @code{8}. Defaults to
  11773. @code{6}, corresponding to a LUT size of @code{64x64}.
  11774. @item dither_temporal
  11775. Enables temporal dithering. Disabled by default.
  11776. @end table
  11777. @subsubsection Custom shaders
  11778. libplacebo supports a number of custom shaders based on the mpv .hook GLSL
  11779. syntax. A collection of such shaders can be found here:
  11780. @url{https://github.com/mpv-player/mpv/wiki/User-Scripts#user-shaders}
  11781. A full description of the mpv shader format is beyond the scope of this
  11782. section, but a summary can be found here:
  11783. @url{https://mpv.io/manual/master/#options-glsl-shader}
  11784. @table @option
  11785. @item custom_shader_path
  11786. Specifies a path to a custom shader file to load at runtime.
  11787. @item custom_shader_bin
  11788. Specifies a complete custom shader as a raw string.
  11789. @end table
  11790. @subsubsection Debugging / performance
  11791. All of the options in this section default off. They may be of assistance when
  11792. attempting to squeeze the maximum performance at the cost of quality.
  11793. @table @option
  11794. @item skip_aa
  11795. Disable anti-aliasing when downscaling.
  11796. @item polar_cutoff
  11797. Truncate polar (EWA) scaler kernels below this absolute magnitude, between
  11798. @code{0.0} and @code{1.0}.
  11799. @item disable_linear
  11800. Disable linear light scaling.
  11801. @item disable_builtin
  11802. Disable built-in GPU sampling (forces LUT).
  11803. @item force_icc_lut
  11804. Force the use of a full ICC 3DLUT for gamut mapping.
  11805. @item disable_fbos
  11806. Forcibly disable FBOs, resulting in loss of almost all functionality, but
  11807. offering the maximum possible speed.
  11808. @end table
  11809. @subsection Commands
  11810. This filter supports almost all of the above options as @ref{commands}.
  11811. @subsection Examples
  11812. @itemize
  11813. @item
  11814. Complete example for how to initialize the Vulkan device, upload frames to the
  11815. GPU, perform filter conversion to yuv420p, and download frames back to the CPU
  11816. for output. Note that in specific cases you can get around the need to perform
  11817. format conversion by specifying the correct @code{format} filter option
  11818. corresponding to the input frames.
  11819. @example
  11820. ffmpeg -i $INPUT -init_hw_device vulkan -vf hwupload,libplacebo=format=yuv420p,hwdownload,format=yuv420p $OUTPUT
  11821. @end example
  11822. @item
  11823. Tone-map input to standard gamut BT.709 output:
  11824. @example
  11825. libplacebo=colorspace=bt709:color_primaries=bt709:color_trc=bt709:range=tv
  11826. @end example
  11827. @item
  11828. Rescale input to fit into standard 1080p, with high quality scaling:
  11829. @example
  11830. libplacebo=w=1920:h=1080:force_original_aspect_ratio=decrease:normalize_sar=true:upscaler=ewa_lanczos:downscaler=ewa_lanczos
  11831. @end example
  11832. @item
  11833. Convert input to standard sRGB JPEG:
  11834. @example
  11835. libplacebo=format=yuv420p:colorspace=bt470bg:color_primaries=bt709:color_trc=iec61966-2-1:range=pc
  11836. @end example
  11837. @item
  11838. Use higher quality debanding settings:
  11839. @example
  11840. libplacebo=deband=true:deband_iterations=3:deband_radius=8:deband_threshold=6
  11841. @end example
  11842. @item
  11843. Run this filter on the CPU, on systems with Mesa installed (and with the most
  11844. expensive options disabled):
  11845. @example
  11846. ffmpeg ... -init_hw_device vulkan:llvmpipe ... -vf libplacebo=upscaler=none:downscaler=none:peak_detect=false
  11847. @end example
  11848. @item
  11849. Suppress CPU-based AV1/H.274 film grain application in the decoder, in favor of
  11850. doing it with this filter. Note that this is only a gain if the frames are
  11851. either already on the GPU, or if you're using libplacebo for other purposes,
  11852. since otherwise the VRAM roundtrip will more than offset any expected speedup.
  11853. @example
  11854. ffmpeg -export_side_data +film_grain ... -vf libplacebo=apply_filmgrain=true
  11855. @end example
  11856. @end itemize
  11857. @section libvmaf
  11858. Calulate the VMAF (Video Multi-Method Assessment Fusion) score for a
  11859. reference/distorted pair of input videos.
  11860. The first input is the distorted video, and the second input is the reference video.
  11861. The obtained VMAF score is printed through the logging system.
  11862. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  11863. After installing the library it can be enabled using:
  11864. @code{./configure --enable-libvmaf}.
  11865. The filter has following options:
  11866. @table @option
  11867. @item model
  11868. A `|` delimited list of vmaf models. Each model can be configured with a number of parameters.
  11869. Default value: @code{"version=vmaf_v0.6.1"}
  11870. @item model_path
  11871. Deprecated, use model='path=...'.
  11872. @item enable_transform
  11873. Deprecated, use model='enable_transform=true'.
  11874. @item phone_model
  11875. Deprecated, use model='enable_transform=true'.
  11876. @item enable_conf_interval
  11877. Deprecated, use model='enable_conf_interval=true'.
  11878. @item feature
  11879. A `|` delimited list of features. Each feature can be configured with a number of parameters.
  11880. @item psnr
  11881. Deprecated, use feature='name=psnr'.
  11882. @item ssim
  11883. Deprecated, use feature='name=ssim'.
  11884. @item ms_ssim
  11885. Deprecated, use feature='name=ms_ssim'.
  11886. @item log_path
  11887. Set the file path to be used to store log files.
  11888. @item log_fmt
  11889. Set the format of the log file (xml, json, csv, or sub).
  11890. @item n_threads
  11891. Set number of threads to be used when initializing libvmaf.
  11892. Default value: @code{0}, no threads.
  11893. @item n_subsample
  11894. Set frame subsampling interval to be used.
  11895. @end table
  11896. This filter also supports the @ref{framesync} options.
  11897. @subsection Examples
  11898. @itemize
  11899. @item
  11900. In the examples below, a distorted video @file{distorted.mpg} is
  11901. compared with a reference file @file{reference.mpg}.
  11902. @item
  11903. Basic usage:
  11904. @example
  11905. ffmpeg -i distorted.mpg -i reference.mpg -lavfi libvmaf=log_path=output.xml -f null -
  11906. @end example
  11907. @item
  11908. Example with multiple models:
  11909. @example
  11910. 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 -
  11911. @end example
  11912. @item
  11913. Example with multiple addtional features:
  11914. @example
  11915. ffmpeg -i distorted.mpg -i reference.mpg -lavfi libvmaf='feature=name=psnr|name=ciede' -f null -
  11916. @end example
  11917. @item
  11918. Example with options and different containers:
  11919. @example
  11920. 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 -
  11921. @end example
  11922. @end itemize
  11923. @section limitdiff
  11924. Apply limited difference filter using second and optionally third video stream.
  11925. The filter accepts the following options:
  11926. @table @option
  11927. @item threshold
  11928. Set the threshold to use when allowing certain differences between video streams.
  11929. Any absolute difference value lower or exact than this threshold will pick pixel components from
  11930. first video stream.
  11931. @item elasticity
  11932. Set the elasticity of soft thresholding when processing video streams.
  11933. This value multiplied with first one sets second threshold.
  11934. Any absolute difference value greater or exact than second threshold will pick pixel components
  11935. from second video stream. For values between those two threshold
  11936. linear interpolation between first and second video stream will be used.
  11937. @item reference
  11938. Enable the reference (third) video stream processing. By default is disabled.
  11939. If set, this video stream will be used for calculating absolute difference with first video
  11940. stream.
  11941. @item planes
  11942. Specify which planes will be processed. Defaults to all available.
  11943. @end table
  11944. @subsection Commands
  11945. This filter supports the all above options as @ref{commands} except option @samp{reference}.
  11946. @section limiter
  11947. Limits the pixel components values to the specified range [min, max].
  11948. The filter accepts the following options:
  11949. @table @option
  11950. @item min
  11951. Lower bound. Defaults to the lowest allowed value for the input.
  11952. @item max
  11953. Upper bound. Defaults to the highest allowed value for the input.
  11954. @item planes
  11955. Specify which planes will be processed. Defaults to all available.
  11956. @end table
  11957. @subsection Commands
  11958. This filter supports the all above options as @ref{commands}.
  11959. @section loop
  11960. Loop video frames.
  11961. The filter accepts the following options:
  11962. @table @option
  11963. @item loop
  11964. Set the number of loops. Setting this value to -1 will result in infinite loops.
  11965. Default is 0.
  11966. @item size
  11967. Set maximal size in number of frames. Default is 0.
  11968. @item start
  11969. Set first frame of loop. Default is 0.
  11970. @end table
  11971. @subsection Examples
  11972. @itemize
  11973. @item
  11974. Loop single first frame infinitely:
  11975. @example
  11976. loop=loop=-1:size=1:start=0
  11977. @end example
  11978. @item
  11979. Loop single first frame 10 times:
  11980. @example
  11981. loop=loop=10:size=1:start=0
  11982. @end example
  11983. @item
  11984. Loop 10 first frames 5 times:
  11985. @example
  11986. loop=loop=5:size=10:start=0
  11987. @end example
  11988. @end itemize
  11989. @section lut1d
  11990. Apply a 1D LUT to an input video.
  11991. The filter accepts the following options:
  11992. @table @option
  11993. @item file
  11994. Set the 1D LUT file name.
  11995. Currently supported formats:
  11996. @table @samp
  11997. @item cube
  11998. Iridas
  11999. @item csp
  12000. cineSpace
  12001. @end table
  12002. @item interp
  12003. Select interpolation mode.
  12004. Available values are:
  12005. @table @samp
  12006. @item nearest
  12007. Use values from the nearest defined point.
  12008. @item linear
  12009. Interpolate values using the linear interpolation.
  12010. @item cosine
  12011. Interpolate values using the cosine interpolation.
  12012. @item cubic
  12013. Interpolate values using the cubic interpolation.
  12014. @item spline
  12015. Interpolate values using the spline interpolation.
  12016. @end table
  12017. @end table
  12018. @subsection Commands
  12019. This filter supports the all above options as @ref{commands}.
  12020. @anchor{lut3d}
  12021. @section lut3d
  12022. Apply a 3D LUT to an input video.
  12023. The filter accepts the following options:
  12024. @table @option
  12025. @item file
  12026. Set the 3D LUT file name.
  12027. Currently supported formats:
  12028. @table @samp
  12029. @item 3dl
  12030. AfterEffects
  12031. @item cube
  12032. Iridas
  12033. @item dat
  12034. DaVinci
  12035. @item m3d
  12036. Pandora
  12037. @item csp
  12038. cineSpace
  12039. @end table
  12040. @item interp
  12041. Select interpolation mode.
  12042. Available values are:
  12043. @table @samp
  12044. @item nearest
  12045. Use values from the nearest defined point.
  12046. @item trilinear
  12047. Interpolate values using the 8 points defining a cube.
  12048. @item tetrahedral
  12049. Interpolate values using a tetrahedron.
  12050. @item pyramid
  12051. Interpolate values using a pyramid.
  12052. @item prism
  12053. Interpolate values using a prism.
  12054. @end table
  12055. @end table
  12056. @subsection Commands
  12057. This filter supports the @code{interp} option as @ref{commands}.
  12058. @section lumakey
  12059. Turn certain luma values into transparency.
  12060. The filter accepts the following options:
  12061. @table @option
  12062. @item threshold
  12063. Set the luma which will be used as base for transparency.
  12064. Default value is @code{0}.
  12065. @item tolerance
  12066. Set the range of luma values to be keyed out.
  12067. Default value is @code{0.01}.
  12068. @item softness
  12069. Set the range of softness. Default value is @code{0}.
  12070. Use this to control gradual transition from zero to full transparency.
  12071. @end table
  12072. @subsection Commands
  12073. This filter supports same @ref{commands} as options.
  12074. The command accepts the same syntax of the corresponding option.
  12075. If the specified expression is not valid, it is kept at its current
  12076. value.
  12077. @section lut, lutrgb, lutyuv
  12078. Compute a look-up table for binding each pixel component input value
  12079. to an output value, and apply it to the input video.
  12080. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  12081. to an RGB input video.
  12082. These filters accept the following parameters:
  12083. @table @option
  12084. @item c0
  12085. set first pixel component expression
  12086. @item c1
  12087. set second pixel component expression
  12088. @item c2
  12089. set third pixel component expression
  12090. @item c3
  12091. set fourth pixel component expression, corresponds to the alpha component
  12092. @item r
  12093. set red component expression
  12094. @item g
  12095. set green component expression
  12096. @item b
  12097. set blue component expression
  12098. @item a
  12099. alpha component expression
  12100. @item y
  12101. set Y/luminance component expression
  12102. @item u
  12103. set U/Cb component expression
  12104. @item v
  12105. set V/Cr component expression
  12106. @end table
  12107. Each of them specifies the expression to use for computing the lookup table for
  12108. the corresponding pixel component values.
  12109. The exact component associated to each of the @var{c*} options depends on the
  12110. format in input.
  12111. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  12112. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  12113. The expressions can contain the following constants and functions:
  12114. @table @option
  12115. @item w
  12116. @item h
  12117. The input width and height.
  12118. @item val
  12119. The input value for the pixel component.
  12120. @item clipval
  12121. The input value, clipped to the @var{minval}-@var{maxval} range.
  12122. @item maxval
  12123. The maximum value for the pixel component.
  12124. @item minval
  12125. The minimum value for the pixel component.
  12126. @item negval
  12127. The negated value for the pixel component value, clipped to the
  12128. @var{minval}-@var{maxval} range; it corresponds to the expression
  12129. "maxval-clipval+minval".
  12130. @item clip(val)
  12131. The computed value in @var{val}, clipped to the
  12132. @var{minval}-@var{maxval} range.
  12133. @item gammaval(gamma)
  12134. The computed gamma correction value of the pixel component value,
  12135. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  12136. expression
  12137. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  12138. @end table
  12139. All expressions default to "clipval".
  12140. @subsection Commands
  12141. This filter supports same @ref{commands} as options.
  12142. @subsection Examples
  12143. @itemize
  12144. @item
  12145. Negate input video:
  12146. @example
  12147. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  12148. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  12149. @end example
  12150. The above is the same as:
  12151. @example
  12152. lutrgb="r=negval:g=negval:b=negval"
  12153. lutyuv="y=negval:u=negval:v=negval"
  12154. @end example
  12155. @item
  12156. Negate luminance:
  12157. @example
  12158. lutyuv=y=negval
  12159. @end example
  12160. @item
  12161. Remove chroma components, turning the video into a graytone image:
  12162. @example
  12163. lutyuv="u=128:v=128"
  12164. @end example
  12165. @item
  12166. Apply a luma burning effect:
  12167. @example
  12168. lutyuv="y=2*val"
  12169. @end example
  12170. @item
  12171. Remove green and blue components:
  12172. @example
  12173. lutrgb="g=0:b=0"
  12174. @end example
  12175. @item
  12176. Set a constant alpha channel value on input:
  12177. @example
  12178. format=rgba,lutrgb=a="maxval-minval/2"
  12179. @end example
  12180. @item
  12181. Correct luminance gamma by a factor of 0.5:
  12182. @example
  12183. lutyuv=y=gammaval(0.5)
  12184. @end example
  12185. @item
  12186. Discard least significant bits of luma:
  12187. @example
  12188. lutyuv=y='bitand(val, 128+64+32)'
  12189. @end example
  12190. @item
  12191. Technicolor like effect:
  12192. @example
  12193. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  12194. @end example
  12195. @end itemize
  12196. @section lut2, tlut2
  12197. The @code{lut2} filter takes two input streams and outputs one
  12198. stream.
  12199. The @code{tlut2} (time lut2) filter takes two consecutive frames
  12200. from one single stream.
  12201. This filter accepts the following parameters:
  12202. @table @option
  12203. @item c0
  12204. set first pixel component expression
  12205. @item c1
  12206. set second pixel component expression
  12207. @item c2
  12208. set third pixel component expression
  12209. @item c3
  12210. set fourth pixel component expression, corresponds to the alpha component
  12211. @item d
  12212. set output bit depth, only available for @code{lut2} filter. By default is 0,
  12213. which means bit depth is automatically picked from first input format.
  12214. @end table
  12215. The @code{lut2} filter also supports the @ref{framesync} options.
  12216. Each of them specifies the expression to use for computing the lookup table for
  12217. the corresponding pixel component values.
  12218. The exact component associated to each of the @var{c*} options depends on the
  12219. format in inputs.
  12220. The expressions can contain the following constants:
  12221. @table @option
  12222. @item w
  12223. @item h
  12224. The input width and height.
  12225. @item x
  12226. The first input value for the pixel component.
  12227. @item y
  12228. The second input value for the pixel component.
  12229. @item bdx
  12230. The first input video bit depth.
  12231. @item bdy
  12232. The second input video bit depth.
  12233. @end table
  12234. All expressions default to "x".
  12235. @subsection Commands
  12236. This filter supports the all above options as @ref{commands} except option @code{d}.
  12237. @subsection Examples
  12238. @itemize
  12239. @item
  12240. Highlight differences between two RGB video streams:
  12241. @example
  12242. 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)'
  12243. @end example
  12244. @item
  12245. Highlight differences between two YUV video streams:
  12246. @example
  12247. 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)'
  12248. @end example
  12249. @item
  12250. Show max difference between two video streams:
  12251. @example
  12252. 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)))'
  12253. @end example
  12254. @end itemize
  12255. @section maskedclamp
  12256. Clamp the first input stream with the second input and third input stream.
  12257. Returns the value of first stream to be between second input
  12258. stream - @code{undershoot} and third input stream + @code{overshoot}.
  12259. This filter accepts the following options:
  12260. @table @option
  12261. @item undershoot
  12262. Default value is @code{0}.
  12263. @item overshoot
  12264. Default value is @code{0}.
  12265. @item planes
  12266. Set which planes will be processed as bitmap, unprocessed planes will be
  12267. copied from first stream.
  12268. By default value 0xf, all planes will be processed.
  12269. @end table
  12270. @subsection Commands
  12271. This filter supports the all above options as @ref{commands}.
  12272. @section maskedmax
  12273. Merge the second and third input stream into output stream using absolute differences
  12274. between second input stream and first input stream and absolute difference between
  12275. third input stream and first input stream. The picked value will be from second input
  12276. stream if second absolute difference is greater than first one or from third input stream
  12277. otherwise.
  12278. This filter accepts the following options:
  12279. @table @option
  12280. @item planes
  12281. Set which planes will be processed as bitmap, unprocessed planes will be
  12282. copied from first stream.
  12283. By default value 0xf, all planes will be processed.
  12284. @end table
  12285. @subsection Commands
  12286. This filter supports the all above options as @ref{commands}.
  12287. @section maskedmerge
  12288. Merge the first input stream with the second input stream using per pixel
  12289. weights in the third input stream.
  12290. A value of 0 in the third stream pixel component means that pixel component
  12291. from first stream is returned unchanged, while maximum value (eg. 255 for
  12292. 8-bit videos) means that pixel component from second stream is returned
  12293. unchanged. Intermediate values define the amount of merging between both
  12294. input stream's pixel components.
  12295. This filter accepts the following options:
  12296. @table @option
  12297. @item planes
  12298. Set which planes will be processed as bitmap, unprocessed planes will be
  12299. copied from first stream.
  12300. By default value 0xf, all planes will be processed.
  12301. @end table
  12302. @subsection Commands
  12303. This filter supports the all above options as @ref{commands}.
  12304. @section maskedmin
  12305. Merge the second and third input stream into output stream using absolute differences
  12306. between second input stream and first input stream and absolute difference between
  12307. third input stream and first input stream. The picked value will be from second input
  12308. stream if second absolute difference is less than first one or from third input stream
  12309. otherwise.
  12310. This filter accepts the following options:
  12311. @table @option
  12312. @item planes
  12313. Set which planes will be processed as bitmap, unprocessed planes will be
  12314. copied from first stream.
  12315. By default value 0xf, all planes will be processed.
  12316. @end table
  12317. @subsection Commands
  12318. This filter supports the all above options as @ref{commands}.
  12319. @section maskedthreshold
  12320. Pick pixels comparing absolute difference of two video streams with fixed
  12321. threshold.
  12322. If absolute difference between pixel component of first and second video
  12323. stream is equal or lower than user supplied threshold than pixel component
  12324. from first video stream is picked, otherwise pixel component from second
  12325. video stream is picked.
  12326. This filter accepts the following options:
  12327. @table @option
  12328. @item threshold
  12329. Set threshold used when picking pixels from absolute difference from two input
  12330. video streams.
  12331. @item planes
  12332. Set which planes will be processed as bitmap, unprocessed planes will be
  12333. copied from second stream.
  12334. By default value 0xf, all planes will be processed.
  12335. @end table
  12336. @subsection Commands
  12337. This filter supports the all above options as @ref{commands}.
  12338. @section maskfun
  12339. Create mask from input video.
  12340. For example it is useful to create motion masks after @code{tblend} filter.
  12341. This filter accepts the following options:
  12342. @table @option
  12343. @item low
  12344. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  12345. @item high
  12346. Set high threshold. Any pixel component higher than this value will be set to max value
  12347. allowed for current pixel format.
  12348. @item planes
  12349. Set planes to filter, by default all available planes are filtered.
  12350. @item fill
  12351. Fill all frame pixels with this value.
  12352. @item sum
  12353. Set max average pixel value for frame. If sum of all pixel components is higher that this
  12354. average, output frame will be completely filled with value set by @var{fill} option.
  12355. Typically useful for scene changes when used in combination with @code{tblend} filter.
  12356. @end table
  12357. @subsection Commands
  12358. This filter supports the all above options as @ref{commands}.
  12359. @section mcdeint
  12360. Apply motion-compensation deinterlacing.
  12361. It needs one field per frame as input and must thus be used together
  12362. with yadif=1/3 or equivalent.
  12363. This filter is only available in ffmpeg version 4.4 or earlier.
  12364. This filter accepts the following options:
  12365. @table @option
  12366. @item mode
  12367. Set the deinterlacing mode.
  12368. It accepts one of the following values:
  12369. @table @samp
  12370. @item fast
  12371. @item medium
  12372. @item slow
  12373. use iterative motion estimation
  12374. @item extra_slow
  12375. like @samp{slow}, but use multiple reference frames.
  12376. @end table
  12377. Default value is @samp{fast}.
  12378. @item parity
  12379. Set the picture field parity assumed for the input video. It must be
  12380. one of the following values:
  12381. @table @samp
  12382. @item 0, tff
  12383. assume top field first
  12384. @item 1, bff
  12385. assume bottom field first
  12386. @end table
  12387. Default value is @samp{bff}.
  12388. @item qp
  12389. Set per-block quantization parameter (QP) used by the internal
  12390. encoder.
  12391. Higher values should result in a smoother motion vector field but less
  12392. optimal individual vectors. Default value is 1.
  12393. @end table
  12394. @section median
  12395. Pick median pixel from certain rectangle defined by radius.
  12396. This filter accepts the following options:
  12397. @table @option
  12398. @item radius
  12399. Set horizontal radius size. Default value is @code{1}.
  12400. Allowed range is integer from 1 to 127.
  12401. @item planes
  12402. Set which planes to process. Default is @code{15}, which is all available planes.
  12403. @item radiusV
  12404. Set vertical radius size. Default value is @code{0}.
  12405. Allowed range is integer from 0 to 127.
  12406. If it is 0, value will be picked from horizontal @code{radius} option.
  12407. @item percentile
  12408. Set median percentile. Default value is @code{0.5}.
  12409. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  12410. minimum values, and @code{1} maximum values.
  12411. @end table
  12412. @subsection Commands
  12413. This filter supports same @ref{commands} as options.
  12414. The command accepts the same syntax of the corresponding option.
  12415. If the specified expression is not valid, it is kept at its current
  12416. value.
  12417. @section mergeplanes
  12418. Merge color channel components from several video streams.
  12419. The filter accepts up to 4 input streams, and merge selected input
  12420. planes to the output video.
  12421. This filter accepts the following options:
  12422. @table @option
  12423. @item mapping
  12424. Set input to output plane mapping. Default is @code{0}.
  12425. The mappings is specified as a bitmap. It should be specified as a
  12426. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  12427. mapping for the first plane of the output stream. 'A' sets the number of
  12428. the input stream to use (from 0 to 3), and 'a' the plane number of the
  12429. corresponding input to use (from 0 to 3). The rest of the mappings is
  12430. similar, 'Bb' describes the mapping for the output stream second
  12431. plane, 'Cc' describes the mapping for the output stream third plane and
  12432. 'Dd' describes the mapping for the output stream fourth plane.
  12433. @item format
  12434. Set output pixel format. Default is @code{yuva444p}.
  12435. @item map0s
  12436. @item map1s
  12437. @item map2s
  12438. @item map3s
  12439. Set input to output stream mapping for output Nth plane. Default is @code{0}.
  12440. @item map0p
  12441. @item map1p
  12442. @item map2p
  12443. @item map3p
  12444. Set input to output plane mapping for output Nth plane. Default is @code{0}.
  12445. @end table
  12446. @subsection Examples
  12447. @itemize
  12448. @item
  12449. Merge three gray video streams of same width and height into single video stream:
  12450. @example
  12451. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  12452. @end example
  12453. @item
  12454. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  12455. @example
  12456. [a0][a1]mergeplanes=0x00010210:yuva444p
  12457. @end example
  12458. @item
  12459. Swap Y and A plane in yuva444p stream:
  12460. @example
  12461. format=yuva444p,mergeplanes=0x03010200:yuva444p
  12462. @end example
  12463. @item
  12464. Swap U and V plane in yuv420p stream:
  12465. @example
  12466. format=yuv420p,mergeplanes=0x000201:yuv420p
  12467. @end example
  12468. @item
  12469. Cast a rgb24 clip to yuv444p:
  12470. @example
  12471. format=rgb24,mergeplanes=0x000102:yuv444p
  12472. @end example
  12473. @end itemize
  12474. @section mestimate
  12475. Estimate and export motion vectors using block matching algorithms.
  12476. Motion vectors are stored in frame side data to be used by other filters.
  12477. This filter accepts the following options:
  12478. @table @option
  12479. @item method
  12480. Specify the motion estimation method. Accepts one of the following values:
  12481. @table @samp
  12482. @item esa
  12483. Exhaustive search algorithm.
  12484. @item tss
  12485. Three step search algorithm.
  12486. @item tdls
  12487. Two dimensional logarithmic search algorithm.
  12488. @item ntss
  12489. New three step search algorithm.
  12490. @item fss
  12491. Four step search algorithm.
  12492. @item ds
  12493. Diamond search algorithm.
  12494. @item hexbs
  12495. Hexagon-based search algorithm.
  12496. @item epzs
  12497. Enhanced predictive zonal search algorithm.
  12498. @item umh
  12499. Uneven multi-hexagon search algorithm.
  12500. @end table
  12501. Default value is @samp{esa}.
  12502. @item mb_size
  12503. Macroblock size. Default @code{16}.
  12504. @item search_param
  12505. Search parameter. Default @code{7}.
  12506. @end table
  12507. @section midequalizer
  12508. Apply Midway Image Equalization effect using two video streams.
  12509. Midway Image Equalization adjusts a pair of images to have the same
  12510. histogram, while maintaining their dynamics as much as possible. It's
  12511. useful for e.g. matching exposures from a pair of stereo cameras.
  12512. This filter has two inputs and one output, which must be of same pixel format, but
  12513. may be of different sizes. The output of filter is first input adjusted with
  12514. midway histogram of both inputs.
  12515. This filter accepts the following option:
  12516. @table @option
  12517. @item planes
  12518. Set which planes to process. Default is @code{15}, which is all available planes.
  12519. @end table
  12520. @section minterpolate
  12521. Convert the video to specified frame rate using motion interpolation.
  12522. This filter accepts the following options:
  12523. @table @option
  12524. @item fps
  12525. 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}.
  12526. @item mi_mode
  12527. Motion interpolation mode. Following values are accepted:
  12528. @table @samp
  12529. @item dup
  12530. Duplicate previous or next frame for interpolating new ones.
  12531. @item blend
  12532. Blend source frames. Interpolated frame is mean of previous and next frames.
  12533. @item mci
  12534. Motion compensated interpolation. Following options are effective when this mode is selected:
  12535. @table @samp
  12536. @item mc_mode
  12537. Motion compensation mode. Following values are accepted:
  12538. @table @samp
  12539. @item obmc
  12540. Overlapped block motion compensation.
  12541. @item aobmc
  12542. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  12543. @end table
  12544. Default mode is @samp{obmc}.
  12545. @item me_mode
  12546. Motion estimation mode. Following values are accepted:
  12547. @table @samp
  12548. @item bidir
  12549. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  12550. @item bilat
  12551. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  12552. @end table
  12553. Default mode is @samp{bilat}.
  12554. @item me
  12555. The algorithm to be used for motion estimation. Following values are accepted:
  12556. @table @samp
  12557. @item esa
  12558. Exhaustive search algorithm.
  12559. @item tss
  12560. Three step search algorithm.
  12561. @item tdls
  12562. Two dimensional logarithmic search algorithm.
  12563. @item ntss
  12564. New three step search algorithm.
  12565. @item fss
  12566. Four step search algorithm.
  12567. @item ds
  12568. Diamond search algorithm.
  12569. @item hexbs
  12570. Hexagon-based search algorithm.
  12571. @item epzs
  12572. Enhanced predictive zonal search algorithm.
  12573. @item umh
  12574. Uneven multi-hexagon search algorithm.
  12575. @end table
  12576. Default algorithm is @samp{epzs}.
  12577. @item mb_size
  12578. Macroblock size. Default @code{16}.
  12579. @item search_param
  12580. Motion estimation search parameter. Default @code{32}.
  12581. @item vsbmc
  12582. 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).
  12583. @end table
  12584. @end table
  12585. @item scd
  12586. 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:
  12587. @table @samp
  12588. @item none
  12589. Disable scene change detection.
  12590. @item fdiff
  12591. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  12592. @end table
  12593. Default method is @samp{fdiff}.
  12594. @item scd_threshold
  12595. Scene change detection threshold. Default is @code{10.}.
  12596. @end table
  12597. @section mix
  12598. Mix several video input streams into one video stream.
  12599. A description of the accepted options follows.
  12600. @table @option
  12601. @item inputs
  12602. The number of inputs. If unspecified, it defaults to 2.
  12603. @item weights
  12604. Specify weight of each input video stream as sequence.
  12605. Each weight is separated by space. If number of weights
  12606. is smaller than number of @var{frames} last specified
  12607. weight will be used for all remaining unset weights.
  12608. @item scale
  12609. Specify scale, if it is set it will be multiplied with sum
  12610. of each weight multiplied with pixel values to give final destination
  12611. pixel value. By default @var{scale} is auto scaled to sum of weights.
  12612. @item planes
  12613. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  12614. @item duration
  12615. Specify how end of stream is determined.
  12616. @table @samp
  12617. @item longest
  12618. The duration of the longest input. (default)
  12619. @item shortest
  12620. The duration of the shortest input.
  12621. @item first
  12622. The duration of the first input.
  12623. @end table
  12624. @end table
  12625. @subsection Commands
  12626. This filter supports the following commands:
  12627. @table @option
  12628. @item weights
  12629. @item scale
  12630. @item planes
  12631. Syntax is same as option with same name.
  12632. @end table
  12633. @section monochrome
  12634. Convert video to gray using custom color filter.
  12635. A description of the accepted options follows.
  12636. @table @option
  12637. @item cb
  12638. Set the chroma blue spot. Allowed range is from -1 to 1.
  12639. Default value is 0.
  12640. @item cr
  12641. Set the chroma red spot. Allowed range is from -1 to 1.
  12642. Default value is 0.
  12643. @item size
  12644. Set the color filter size. Allowed range is from .1 to 10.
  12645. Default value is 1.
  12646. @item high
  12647. Set the highlights strength. Allowed range is from 0 to 1.
  12648. Default value is 0.
  12649. @end table
  12650. @subsection Commands
  12651. This filter supports the all above options as @ref{commands}.
  12652. @section morpho
  12653. This filter allows to apply main morphological grayscale transforms,
  12654. erode and dilate with arbitrary structures set in second input stream.
  12655. Unlike naive implementation and much slower performance in @ref{erosion}
  12656. and @ref{dilation} filters, when speed is critical @code{morpho} filter
  12657. should be used instead.
  12658. A description of accepted options follows,
  12659. @table @option
  12660. @item mode
  12661. Set morphological transform to apply, can be:
  12662. @table @samp
  12663. @item erode
  12664. @item dilate
  12665. @item open
  12666. @item close
  12667. @item gradient
  12668. @item tophat
  12669. @item blackhat
  12670. @end table
  12671. Default is @code{erode}.
  12672. @item planes
  12673. Set planes to filter, by default all planes except alpha are filtered.
  12674. @item structure
  12675. Set which structure video frames will be processed from second input stream,
  12676. can be @var{first} or @var{all}. Default is @var{all}.
  12677. @end table
  12678. The @code{morpho} filter also supports the @ref{framesync} options.
  12679. @subsection Commands
  12680. This filter supports same @ref{commands} as options.
  12681. @section mpdecimate
  12682. Drop frames that do not differ greatly from the previous frame in
  12683. order to reduce frame rate.
  12684. The main use of this filter is for very-low-bitrate encoding
  12685. (e.g. streaming over dialup modem), but it could in theory be used for
  12686. fixing movies that were inverse-telecined incorrectly.
  12687. A description of the accepted options follows.
  12688. @table @option
  12689. @item max
  12690. Set the maximum number of consecutive frames which can be dropped (if
  12691. positive), or the minimum interval between dropped frames (if
  12692. negative). If the value is 0, the frame is dropped disregarding the
  12693. number of previous sequentially dropped frames.
  12694. Default value is 0.
  12695. @item hi
  12696. @item lo
  12697. @item frac
  12698. Set the dropping threshold values.
  12699. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  12700. represent actual pixel value differences, so a threshold of 64
  12701. corresponds to 1 unit of difference for each pixel, or the same spread
  12702. out differently over the block.
  12703. A frame is a candidate for dropping if no 8x8 blocks differ by more
  12704. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  12705. meaning the whole image) differ by more than a threshold of @option{lo}.
  12706. Default value for @option{hi} is 64*12, default value for @option{lo} is
  12707. 64*5, and default value for @option{frac} is 0.33.
  12708. @end table
  12709. @section msad
  12710. Obtain the MSAD (Mean Sum of Absolute Differences) between two input videos.
  12711. This filter takes two input videos.
  12712. Both input videos must have the same resolution and pixel format for
  12713. this filter to work correctly. Also it assumes that both inputs
  12714. have the same number of frames, which are compared one by one.
  12715. The obtained per component, average, min and max MSAD is printed through
  12716. the logging system.
  12717. The filter stores the calculated MSAD of each frame in frame metadata.
  12718. In the below example the input file @file{main.mpg} being processed is compared
  12719. with the reference file @file{ref.mpg}.
  12720. @example
  12721. ffmpeg -i main.mpg -i ref.mpg -lavfi msad -f null -
  12722. @end example
  12723. @section negate
  12724. Negate (invert) the input video.
  12725. It accepts the following option:
  12726. @table @option
  12727. @item components
  12728. Set components to negate.
  12729. Available values for components are:
  12730. @table @samp
  12731. @item y
  12732. @item u
  12733. @item v
  12734. @item a
  12735. @item r
  12736. @item g
  12737. @item b
  12738. @end table
  12739. @item negate_alpha
  12740. With value 1, it negates the alpha component, if present. Default value is 0.
  12741. @end table
  12742. @subsection Commands
  12743. This filter supports same @ref{commands} as options.
  12744. @anchor{nlmeans}
  12745. @section nlmeans
  12746. Denoise frames using Non-Local Means algorithm.
  12747. Each pixel is adjusted by looking for other pixels with similar contexts. This
  12748. context similarity is defined by comparing their surrounding patches of size
  12749. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  12750. around the pixel.
  12751. Note that the research area defines centers for patches, which means some
  12752. patches will be made of pixels outside that research area.
  12753. The filter accepts the following options.
  12754. @table @option
  12755. @item s
  12756. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  12757. @item p
  12758. Set patch size. Default is 7. Must be odd number in range [0, 99].
  12759. @item pc
  12760. Same as @option{p} but for chroma planes.
  12761. The default value is @var{0} and means automatic.
  12762. @item r
  12763. Set research size. Default is 15. Must be odd number in range [0, 99].
  12764. @item rc
  12765. Same as @option{r} but for chroma planes.
  12766. The default value is @var{0} and means automatic.
  12767. @end table
  12768. @section nnedi
  12769. Deinterlace video using neural network edge directed interpolation.
  12770. This filter accepts the following options:
  12771. @table @option
  12772. @item weights
  12773. Mandatory option, without binary file filter can not work.
  12774. Currently file can be found here:
  12775. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  12776. @item deint
  12777. Set which frames to deinterlace, by default it is @code{all}.
  12778. Can be @code{all} or @code{interlaced}.
  12779. @item field
  12780. Set mode of operation.
  12781. Can be one of the following:
  12782. @table @samp
  12783. @item af
  12784. Use frame flags, both fields.
  12785. @item a
  12786. Use frame flags, single field.
  12787. @item t
  12788. Use top field only.
  12789. @item b
  12790. Use bottom field only.
  12791. @item tf
  12792. Use both fields, top first.
  12793. @item bf
  12794. Use both fields, bottom first.
  12795. @end table
  12796. @item planes
  12797. Set which planes to process, by default filter process all frames.
  12798. @item nsize
  12799. Set size of local neighborhood around each pixel, used by the predictor neural
  12800. network.
  12801. Can be one of the following:
  12802. @table @samp
  12803. @item s8x6
  12804. @item s16x6
  12805. @item s32x6
  12806. @item s48x6
  12807. @item s8x4
  12808. @item s16x4
  12809. @item s32x4
  12810. @end table
  12811. @item nns
  12812. Set the number of neurons in predictor neural network.
  12813. Can be one of the following:
  12814. @table @samp
  12815. @item n16
  12816. @item n32
  12817. @item n64
  12818. @item n128
  12819. @item n256
  12820. @end table
  12821. @item qual
  12822. Controls the number of different neural network predictions that are blended
  12823. together to compute the final output value. Can be @code{fast}, default or
  12824. @code{slow}.
  12825. @item etype
  12826. Set which set of weights to use in the predictor.
  12827. Can be one of the following:
  12828. @table @samp
  12829. @item a, abs
  12830. weights trained to minimize absolute error
  12831. @item s, mse
  12832. weights trained to minimize squared error
  12833. @end table
  12834. @item pscrn
  12835. Controls whether or not the prescreener neural network is used to decide
  12836. which pixels should be processed by the predictor neural network and which
  12837. can be handled by simple cubic interpolation.
  12838. The prescreener is trained to know whether cubic interpolation will be
  12839. sufficient for a pixel or whether it should be predicted by the predictor nn.
  12840. The computational complexity of the prescreener nn is much less than that of
  12841. the predictor nn. Since most pixels can be handled by cubic interpolation,
  12842. using the prescreener generally results in much faster processing.
  12843. The prescreener is pretty accurate, so the difference between using it and not
  12844. using it is almost always unnoticeable.
  12845. Can be one of the following:
  12846. @table @samp
  12847. @item none
  12848. @item original
  12849. @item new
  12850. @item new2
  12851. @item new3
  12852. @end table
  12853. Default is @code{new}.
  12854. @end table
  12855. @subsection Commands
  12856. This filter supports same @ref{commands} as options, excluding @var{weights} option.
  12857. @section noformat
  12858. Force libavfilter not to use any of the specified pixel formats for the
  12859. input to the next filter.
  12860. It accepts the following parameters:
  12861. @table @option
  12862. @item pix_fmts
  12863. A '|'-separated list of pixel format names, such as
  12864. pix_fmts=yuv420p|monow|rgb24".
  12865. @end table
  12866. @subsection Examples
  12867. @itemize
  12868. @item
  12869. Force libavfilter to use a format different from @var{yuv420p} for the
  12870. input to the vflip filter:
  12871. @example
  12872. noformat=pix_fmts=yuv420p,vflip
  12873. @end example
  12874. @item
  12875. Convert the input video to any of the formats not contained in the list:
  12876. @example
  12877. noformat=yuv420p|yuv444p|yuv410p
  12878. @end example
  12879. @end itemize
  12880. @section noise
  12881. Add noise on video input frame.
  12882. The filter accepts the following options:
  12883. @table @option
  12884. @item all_seed
  12885. @item c0_seed
  12886. @item c1_seed
  12887. @item c2_seed
  12888. @item c3_seed
  12889. Set noise seed for specific pixel component or all pixel components in case
  12890. of @var{all_seed}. Default value is @code{123457}.
  12891. @item all_strength, alls
  12892. @item c0_strength, c0s
  12893. @item c1_strength, c1s
  12894. @item c2_strength, c2s
  12895. @item c3_strength, c3s
  12896. Set noise strength for specific pixel component or all pixel components in case
  12897. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  12898. @item all_flags, allf
  12899. @item c0_flags, c0f
  12900. @item c1_flags, c1f
  12901. @item c2_flags, c2f
  12902. @item c3_flags, c3f
  12903. Set pixel component flags or set flags for all components if @var{all_flags}.
  12904. Available values for component flags are:
  12905. @table @samp
  12906. @item a
  12907. averaged temporal noise (smoother)
  12908. @item p
  12909. mix random noise with a (semi)regular pattern
  12910. @item t
  12911. temporal noise (noise pattern changes between frames)
  12912. @item u
  12913. uniform noise (gaussian otherwise)
  12914. @end table
  12915. @end table
  12916. @subsection Examples
  12917. Add temporal and uniform noise to input video:
  12918. @example
  12919. noise=alls=20:allf=t+u
  12920. @end example
  12921. @section normalize
  12922. Normalize RGB video (aka histogram stretching, contrast stretching).
  12923. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  12924. For each channel of each frame, the filter computes the input range and maps
  12925. it linearly to the user-specified output range. The output range defaults
  12926. to the full dynamic range from pure black to pure white.
  12927. Temporal smoothing can be used on the input range to reduce flickering (rapid
  12928. changes in brightness) caused when small dark or bright objects enter or leave
  12929. the scene. This is similar to the auto-exposure (automatic gain control) on a
  12930. video camera, and, like a video camera, it may cause a period of over- or
  12931. under-exposure of the video.
  12932. The R,G,B channels can be normalized independently, which may cause some
  12933. color shifting, or linked together as a single channel, which prevents
  12934. color shifting. Linked normalization preserves hue. Independent normalization
  12935. does not, so it can be used to remove some color casts. Independent and linked
  12936. normalization can be combined in any ratio.
  12937. The normalize filter accepts the following options:
  12938. @table @option
  12939. @item blackpt
  12940. @item whitept
  12941. Colors which define the output range. The minimum input value is mapped to
  12942. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  12943. The defaults are black and white respectively. Specifying white for
  12944. @var{blackpt} and black for @var{whitept} will give color-inverted,
  12945. normalized video. Shades of grey can be used to reduce the dynamic range
  12946. (contrast). Specifying saturated colors here can create some interesting
  12947. effects.
  12948. @item smoothing
  12949. The number of previous frames to use for temporal smoothing. The input range
  12950. of each channel is smoothed using a rolling average over the current frame
  12951. and the @var{smoothing} previous frames. The default is 0 (no temporal
  12952. smoothing).
  12953. @item independence
  12954. Controls the ratio of independent (color shifting) channel normalization to
  12955. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  12956. independent. Defaults to 1.0 (fully independent).
  12957. @item strength
  12958. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  12959. expensive no-op. Defaults to 1.0 (full strength).
  12960. @end table
  12961. @subsection Commands
  12962. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  12963. The command accepts the same syntax of the corresponding option.
  12964. If the specified expression is not valid, it is kept at its current
  12965. value.
  12966. @subsection Examples
  12967. Stretch video contrast to use the full dynamic range, with no temporal
  12968. smoothing; may flicker depending on the source content:
  12969. @example
  12970. normalize=blackpt=black:whitept=white:smoothing=0
  12971. @end example
  12972. As above, but with 50 frames of temporal smoothing; flicker should be
  12973. reduced, depending on the source content:
  12974. @example
  12975. normalize=blackpt=black:whitept=white:smoothing=50
  12976. @end example
  12977. As above, but with hue-preserving linked channel normalization:
  12978. @example
  12979. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  12980. @end example
  12981. As above, but with half strength:
  12982. @example
  12983. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  12984. @end example
  12985. Map the darkest input color to red, the brightest input color to cyan:
  12986. @example
  12987. normalize=blackpt=red:whitept=cyan
  12988. @end example
  12989. @section null
  12990. Pass the video source unchanged to the output.
  12991. @section ocr
  12992. Optical Character Recognition
  12993. This filter uses Tesseract for optical character recognition. To enable
  12994. compilation of this filter, you need to configure FFmpeg with
  12995. @code{--enable-libtesseract}.
  12996. It accepts the following options:
  12997. @table @option
  12998. @item datapath
  12999. Set datapath to tesseract data. Default is to use whatever was
  13000. set at installation.
  13001. @item language
  13002. Set language, default is "eng".
  13003. @item whitelist
  13004. Set character whitelist.
  13005. @item blacklist
  13006. Set character blacklist.
  13007. @end table
  13008. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  13009. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  13010. @section ocv
  13011. Apply a video transform using libopencv.
  13012. To enable this filter, install the libopencv library and headers and
  13013. configure FFmpeg with @code{--enable-libopencv}.
  13014. It accepts the following parameters:
  13015. @table @option
  13016. @item filter_name
  13017. The name of the libopencv filter to apply.
  13018. @item filter_params
  13019. The parameters to pass to the libopencv filter. If not specified, the default
  13020. values are assumed.
  13021. @end table
  13022. Refer to the official libopencv documentation for more precise
  13023. information:
  13024. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  13025. Several libopencv filters are supported; see the following subsections.
  13026. @anchor{dilate}
  13027. @subsection dilate
  13028. Dilate an image by using a specific structuring element.
  13029. It corresponds to the libopencv function @code{cvDilate}.
  13030. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  13031. @var{struct_el} represents a structuring element, and has the syntax:
  13032. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  13033. @var{cols} and @var{rows} represent the number of columns and rows of
  13034. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  13035. point, and @var{shape} the shape for the structuring element. @var{shape}
  13036. must be "rect", "cross", "ellipse", or "custom".
  13037. If the value for @var{shape} is "custom", it must be followed by a
  13038. string of the form "=@var{filename}". The file with name
  13039. @var{filename} is assumed to represent a binary image, with each
  13040. printable character corresponding to a bright pixel. When a custom
  13041. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  13042. or columns and rows of the read file are assumed instead.
  13043. The default value for @var{struct_el} is "3x3+0x0/rect".
  13044. @var{nb_iterations} specifies the number of times the transform is
  13045. applied to the image, and defaults to 1.
  13046. Some examples:
  13047. @example
  13048. # Use the default values
  13049. ocv=dilate
  13050. # Dilate using a structuring element with a 5x5 cross, iterating two times
  13051. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  13052. # Read the shape from the file diamond.shape, iterating two times.
  13053. # The file diamond.shape may contain a pattern of characters like this
  13054. # *
  13055. # ***
  13056. # *****
  13057. # ***
  13058. # *
  13059. # The specified columns and rows are ignored
  13060. # but the anchor point coordinates are not
  13061. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  13062. @end example
  13063. @subsection erode
  13064. Erode an image by using a specific structuring element.
  13065. It corresponds to the libopencv function @code{cvErode}.
  13066. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  13067. with the same syntax and semantics as the @ref{dilate} filter.
  13068. @subsection smooth
  13069. Smooth the input video.
  13070. The filter takes the following parameters:
  13071. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  13072. @var{type} is the type of smooth filter to apply, and must be one of
  13073. the following values: "blur", "blur_no_scale", "median", "gaussian",
  13074. or "bilateral". The default value is "gaussian".
  13075. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  13076. depends on the smooth type. @var{param1} and
  13077. @var{param2} accept integer positive values or 0. @var{param3} and
  13078. @var{param4} accept floating point values.
  13079. The default value for @var{param1} is 3. The default value for the
  13080. other parameters is 0.
  13081. These parameters correspond to the parameters assigned to the
  13082. libopencv function @code{cvSmooth}.
  13083. @section oscilloscope
  13084. 2D Video Oscilloscope.
  13085. Useful to measure spatial impulse, step responses, chroma delays, etc.
  13086. It accepts the following parameters:
  13087. @table @option
  13088. @item x
  13089. Set scope center x position.
  13090. @item y
  13091. Set scope center y position.
  13092. @item s
  13093. Set scope size, relative to frame diagonal.
  13094. @item t
  13095. Set scope tilt/rotation.
  13096. @item o
  13097. Set trace opacity.
  13098. @item tx
  13099. Set trace center x position.
  13100. @item ty
  13101. Set trace center y position.
  13102. @item tw
  13103. Set trace width, relative to width of frame.
  13104. @item th
  13105. Set trace height, relative to height of frame.
  13106. @item c
  13107. Set which components to trace. By default it traces first three components.
  13108. @item g
  13109. Draw trace grid. By default is enabled.
  13110. @item st
  13111. Draw some statistics. By default is enabled.
  13112. @item sc
  13113. Draw scope. By default is enabled.
  13114. @end table
  13115. @subsection Commands
  13116. This filter supports same @ref{commands} as options.
  13117. The command accepts the same syntax of the corresponding option.
  13118. If the specified expression is not valid, it is kept at its current
  13119. value.
  13120. @subsection Examples
  13121. @itemize
  13122. @item
  13123. Inspect full first row of video frame.
  13124. @example
  13125. oscilloscope=x=0.5:y=0:s=1
  13126. @end example
  13127. @item
  13128. Inspect full last row of video frame.
  13129. @example
  13130. oscilloscope=x=0.5:y=1:s=1
  13131. @end example
  13132. @item
  13133. Inspect full 5th line of video frame of height 1080.
  13134. @example
  13135. oscilloscope=x=0.5:y=5/1080:s=1
  13136. @end example
  13137. @item
  13138. Inspect full last column of video frame.
  13139. @example
  13140. oscilloscope=x=1:y=0.5:s=1:t=1
  13141. @end example
  13142. @end itemize
  13143. @anchor{overlay}
  13144. @section overlay
  13145. Overlay one video on top of another.
  13146. It takes two inputs and has one output. The first input is the "main"
  13147. video on which the second input is overlaid.
  13148. It accepts the following parameters:
  13149. A description of the accepted options follows.
  13150. @table @option
  13151. @item x
  13152. @item y
  13153. Set the expression for the x and y coordinates of the overlaid video
  13154. on the main video. Default value is "0" for both expressions. In case
  13155. the expression is invalid, it is set to a huge value (meaning that the
  13156. overlay will not be displayed within the output visible area).
  13157. @item eof_action
  13158. See @ref{framesync}.
  13159. @item eval
  13160. Set when the expressions for @option{x}, and @option{y} are evaluated.
  13161. It accepts the following values:
  13162. @table @samp
  13163. @item init
  13164. only evaluate expressions once during the filter initialization or
  13165. when a command is processed
  13166. @item frame
  13167. evaluate expressions for each incoming frame
  13168. @end table
  13169. Default value is @samp{frame}.
  13170. @item shortest
  13171. See @ref{framesync}.
  13172. @item format
  13173. Set the format for the output video.
  13174. It accepts the following values:
  13175. @table @samp
  13176. @item yuv420
  13177. force YUV420 output
  13178. @item yuv420p10
  13179. force YUV420p10 output
  13180. @item yuv422
  13181. force YUV422 output
  13182. @item yuv422p10
  13183. force YUV422p10 output
  13184. @item yuv444
  13185. force YUV444 output
  13186. @item rgb
  13187. force packed RGB output
  13188. @item gbrp
  13189. force planar RGB output
  13190. @item auto
  13191. automatically pick format
  13192. @end table
  13193. Default value is @samp{yuv420}.
  13194. @item repeatlast
  13195. See @ref{framesync}.
  13196. @item alpha
  13197. Set format of alpha of the overlaid video, it can be @var{straight} or
  13198. @var{premultiplied}. Default is @var{straight}.
  13199. @end table
  13200. The @option{x}, and @option{y} expressions can contain the following
  13201. parameters.
  13202. @table @option
  13203. @item main_w, W
  13204. @item main_h, H
  13205. The main input width and height.
  13206. @item overlay_w, w
  13207. @item overlay_h, h
  13208. The overlay input width and height.
  13209. @item x
  13210. @item y
  13211. The computed values for @var{x} and @var{y}. They are evaluated for
  13212. each new frame.
  13213. @item hsub
  13214. @item vsub
  13215. horizontal and vertical chroma subsample values of the output
  13216. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  13217. @var{vsub} is 1.
  13218. @item n
  13219. the number of input frame, starting from 0
  13220. @item pos
  13221. the position in the file of the input frame, NAN if unknown
  13222. @item t
  13223. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  13224. @end table
  13225. This filter also supports the @ref{framesync} options.
  13226. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  13227. when evaluation is done @emph{per frame}, and will evaluate to NAN
  13228. when @option{eval} is set to @samp{init}.
  13229. Be aware that frames are taken from each input video in timestamp
  13230. order, hence, if their initial timestamps differ, it is a good idea
  13231. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  13232. have them begin in the same zero timestamp, as the example for
  13233. the @var{movie} filter does.
  13234. You can chain together more overlays but you should test the
  13235. efficiency of such approach.
  13236. @subsection Commands
  13237. This filter supports the following commands:
  13238. @table @option
  13239. @item x
  13240. @item y
  13241. Modify the x and y of the overlay input.
  13242. The command accepts the same syntax of the corresponding option.
  13243. If the specified expression is not valid, it is kept at its current
  13244. value.
  13245. @end table
  13246. @subsection Examples
  13247. @itemize
  13248. @item
  13249. Draw the overlay at 10 pixels from the bottom right corner of the main
  13250. video:
  13251. @example
  13252. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  13253. @end example
  13254. Using named options the example above becomes:
  13255. @example
  13256. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  13257. @end example
  13258. @item
  13259. Insert a transparent PNG logo in the bottom left corner of the input,
  13260. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  13261. @example
  13262. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  13263. @end example
  13264. @item
  13265. Insert 2 different transparent PNG logos (second logo on bottom
  13266. right corner) using the @command{ffmpeg} tool:
  13267. @example
  13268. 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
  13269. @end example
  13270. @item
  13271. Add a transparent color layer on top of the main video; @code{WxH}
  13272. must specify the size of the main input to the overlay filter:
  13273. @example
  13274. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  13275. @end example
  13276. @item
  13277. Play an original video and a filtered version (here with the deshake
  13278. filter) side by side using the @command{ffplay} tool:
  13279. @example
  13280. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  13281. @end example
  13282. The above command is the same as:
  13283. @example
  13284. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  13285. @end example
  13286. @item
  13287. Make a sliding overlay appearing from the left to the right top part of the
  13288. screen starting since time 2:
  13289. @example
  13290. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  13291. @end example
  13292. @item
  13293. Compose output by putting two input videos side to side:
  13294. @example
  13295. ffmpeg -i left.avi -i right.avi -filter_complex "
  13296. nullsrc=size=200x100 [background];
  13297. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  13298. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  13299. [background][left] overlay=shortest=1 [background+left];
  13300. [background+left][right] overlay=shortest=1:x=100 [left+right]
  13301. "
  13302. @end example
  13303. @item
  13304. Mask 10-20 seconds of a video by applying the delogo filter to a section
  13305. @example
  13306. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  13307. -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]'
  13308. masked.avi
  13309. @end example
  13310. @item
  13311. Chain several overlays in cascade:
  13312. @example
  13313. nullsrc=s=200x200 [bg];
  13314. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  13315. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  13316. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  13317. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  13318. [in3] null, [mid2] overlay=100:100 [out0]
  13319. @end example
  13320. @end itemize
  13321. @anchor{overlay_cuda}
  13322. @section overlay_cuda
  13323. Overlay one video on top of another.
  13324. This is the CUDA variant of the @ref{overlay} filter.
  13325. It only accepts CUDA frames. The underlying input pixel formats have to match.
  13326. It takes two inputs and has one output. The first input is the "main"
  13327. video on which the second input is overlaid.
  13328. It accepts the following parameters:
  13329. @table @option
  13330. @item x
  13331. @item y
  13332. Set expressions for the x and y coordinates of the overlaid video
  13333. on the main video.
  13334. They can contain the following parameters:
  13335. @table @option
  13336. @item main_w, W
  13337. @item main_h, H
  13338. The main input width and height.
  13339. @item overlay_w, w
  13340. @item overlay_h, h
  13341. The overlay input width and height.
  13342. @item x
  13343. @item y
  13344. The computed values for @var{x} and @var{y}. They are evaluated for
  13345. each new frame.
  13346. @item n
  13347. The ordinal index of the main input frame, starting from 0.
  13348. @item pos
  13349. The byte offset position in the file of the main input frame, NAN if unknown.
  13350. @item t
  13351. The timestamp of the main input frame, expressed in seconds, NAN if unknown.
  13352. @end table
  13353. Default value is "0" for both expressions.
  13354. @item eval
  13355. Set when the expressions for @option{x} and @option{y} are evaluated.
  13356. It accepts the following values:
  13357. @table @option
  13358. @item init
  13359. Evaluate expressions once during filter initialization or
  13360. when a command is processed.
  13361. @item frame
  13362. Evaluate expressions for each incoming frame
  13363. @end table
  13364. Default value is @option{frame}.
  13365. @item eof_action
  13366. See @ref{framesync}.
  13367. @item shortest
  13368. See @ref{framesync}.
  13369. @item repeatlast
  13370. See @ref{framesync}.
  13371. @end table
  13372. This filter also supports the @ref{framesync} options.
  13373. @section owdenoise
  13374. Apply Overcomplete Wavelet denoiser.
  13375. The filter accepts the following options:
  13376. @table @option
  13377. @item depth
  13378. Set depth.
  13379. Larger depth values will denoise lower frequency components more, but
  13380. slow down filtering.
  13381. Must be an int in the range 8-16, default is @code{8}.
  13382. @item luma_strength, ls
  13383. Set luma strength.
  13384. Must be a double value in the range 0-1000, default is @code{1.0}.
  13385. @item chroma_strength, cs
  13386. Set chroma strength.
  13387. Must be a double value in the range 0-1000, default is @code{1.0}.
  13388. @end table
  13389. @anchor{pad}
  13390. @section pad
  13391. Add paddings to the input image, and place the original input at the
  13392. provided @var{x}, @var{y} coordinates.
  13393. It accepts the following parameters:
  13394. @table @option
  13395. @item width, w
  13396. @item height, h
  13397. Specify an expression for the size of the output image with the
  13398. paddings added. If the value for @var{width} or @var{height} is 0, the
  13399. corresponding input size is used for the output.
  13400. The @var{width} expression can reference the value set by the
  13401. @var{height} expression, and vice versa.
  13402. The default value of @var{width} and @var{height} is 0.
  13403. @item x
  13404. @item y
  13405. Specify the offsets to place the input image at within the padded area,
  13406. with respect to the top/left border of the output image.
  13407. The @var{x} expression can reference the value set by the @var{y}
  13408. expression, and vice versa.
  13409. The default value of @var{x} and @var{y} is 0.
  13410. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  13411. so the input image is centered on the padded area.
  13412. @item color
  13413. Specify the color of the padded area. For the syntax of this option,
  13414. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  13415. manual,ffmpeg-utils}.
  13416. The default value of @var{color} is "black".
  13417. @item eval
  13418. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  13419. It accepts the following values:
  13420. @table @samp
  13421. @item init
  13422. Only evaluate expressions once during the filter initialization or when
  13423. a command is processed.
  13424. @item frame
  13425. Evaluate expressions for each incoming frame.
  13426. @end table
  13427. Default value is @samp{init}.
  13428. @item aspect
  13429. Pad to aspect instead to a resolution.
  13430. @end table
  13431. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  13432. options are expressions containing the following constants:
  13433. @table @option
  13434. @item in_w
  13435. @item in_h
  13436. The input video width and height.
  13437. @item iw
  13438. @item ih
  13439. These are the same as @var{in_w} and @var{in_h}.
  13440. @item out_w
  13441. @item out_h
  13442. The output width and height (the size of the padded area), as
  13443. specified by the @var{width} and @var{height} expressions.
  13444. @item ow
  13445. @item oh
  13446. These are the same as @var{out_w} and @var{out_h}.
  13447. @item x
  13448. @item y
  13449. The x and y offsets as specified by the @var{x} and @var{y}
  13450. expressions, or NAN if not yet specified.
  13451. @item a
  13452. same as @var{iw} / @var{ih}
  13453. @item sar
  13454. input sample aspect ratio
  13455. @item dar
  13456. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  13457. @item hsub
  13458. @item vsub
  13459. The horizontal and vertical chroma subsample values. For example for the
  13460. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13461. @end table
  13462. @subsection Examples
  13463. @itemize
  13464. @item
  13465. Add paddings with the color "violet" to the input video. The output video
  13466. size is 640x480, and the top-left corner of the input video is placed at
  13467. column 0, row 40
  13468. @example
  13469. pad=640:480:0:40:violet
  13470. @end example
  13471. The example above is equivalent to the following command:
  13472. @example
  13473. pad=width=640:height=480:x=0:y=40:color=violet
  13474. @end example
  13475. @item
  13476. Pad the input to get an output with dimensions increased by 3/2,
  13477. and put the input video at the center of the padded area:
  13478. @example
  13479. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  13480. @end example
  13481. @item
  13482. Pad the input to get a squared output with size equal to the maximum
  13483. value between the input width and height, and put the input video at
  13484. the center of the padded area:
  13485. @example
  13486. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  13487. @end example
  13488. @item
  13489. Pad the input to get a final w/h ratio of 16:9:
  13490. @example
  13491. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  13492. @end example
  13493. @item
  13494. In case of anamorphic video, in order to set the output display aspect
  13495. correctly, it is necessary to use @var{sar} in the expression,
  13496. according to the relation:
  13497. @example
  13498. (ih * X / ih) * sar = output_dar
  13499. X = output_dar / sar
  13500. @end example
  13501. Thus the previous example needs to be modified to:
  13502. @example
  13503. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  13504. @end example
  13505. @item
  13506. Double the output size and put the input video in the bottom-right
  13507. corner of the output padded area:
  13508. @example
  13509. pad="2*iw:2*ih:ow-iw:oh-ih"
  13510. @end example
  13511. @end itemize
  13512. @anchor{palettegen}
  13513. @section palettegen
  13514. Generate one palette for a whole video stream.
  13515. It accepts the following options:
  13516. @table @option
  13517. @item max_colors
  13518. Set the maximum number of colors to quantize in the palette.
  13519. Note: the palette will still contain 256 colors; the unused palette entries
  13520. will be black.
  13521. @item reserve_transparent
  13522. Create a palette of 255 colors maximum and reserve the last one for
  13523. transparency. Reserving the transparency color is useful for GIF optimization.
  13524. If not set, the maximum of colors in the palette will be 256. You probably want
  13525. to disable this option for a standalone image.
  13526. Set by default.
  13527. @item transparency_color
  13528. Set the color that will be used as background for transparency.
  13529. @item stats_mode
  13530. Set statistics mode.
  13531. It accepts the following values:
  13532. @table @samp
  13533. @item full
  13534. Compute full frame histograms.
  13535. @item diff
  13536. Compute histograms only for the part that differs from previous frame. This
  13537. might be relevant to give more importance to the moving part of your input if
  13538. the background is static.
  13539. @item single
  13540. Compute new histogram for each frame.
  13541. @end table
  13542. Default value is @var{full}.
  13543. @item use_alpha
  13544. Create a palette of colors with alpha components.
  13545. Setting this, will automatically disable 'reserve_transparent'.
  13546. @end table
  13547. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  13548. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  13549. color quantization of the palette. This information is also visible at
  13550. @var{info} logging level.
  13551. @subsection Examples
  13552. @itemize
  13553. @item
  13554. Generate a representative palette of a given video using @command{ffmpeg}:
  13555. @example
  13556. ffmpeg -i input.mkv -vf palettegen palette.png
  13557. @end example
  13558. @end itemize
  13559. @section paletteuse
  13560. Use a palette to downsample an input video stream.
  13561. The filter takes two inputs: one video stream and a palette. The palette must
  13562. be a 256 pixels image.
  13563. It accepts the following options:
  13564. @table @option
  13565. @item dither
  13566. Select dithering mode. Available algorithms are:
  13567. @table @samp
  13568. @item bayer
  13569. Ordered 8x8 bayer dithering (deterministic)
  13570. @item heckbert
  13571. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  13572. Note: this dithering is sometimes considered "wrong" and is included as a
  13573. reference.
  13574. @item floyd_steinberg
  13575. Floyd and Steingberg dithering (error diffusion)
  13576. @item sierra2
  13577. Frankie Sierra dithering v2 (error diffusion)
  13578. @item sierra2_4a
  13579. Frankie Sierra dithering v2 "Lite" (error diffusion)
  13580. @end table
  13581. Default is @var{sierra2_4a}.
  13582. @item bayer_scale
  13583. When @var{bayer} dithering is selected, this option defines the scale of the
  13584. pattern (how much the crosshatch pattern is visible). A low value means more
  13585. visible pattern for less banding, and higher value means less visible pattern
  13586. at the cost of more banding.
  13587. The option must be an integer value in the range [0,5]. Default is @var{2}.
  13588. @item diff_mode
  13589. If set, define the zone to process
  13590. @table @samp
  13591. @item rectangle
  13592. Only the changing rectangle will be reprocessed. This is similar to GIF
  13593. cropping/offsetting compression mechanism. This option can be useful for speed
  13594. if only a part of the image is changing, and has use cases such as limiting the
  13595. scope of the error diffusal @option{dither} to the rectangle that bounds the
  13596. moving scene (it leads to more deterministic output if the scene doesn't change
  13597. much, and as a result less moving noise and better GIF compression).
  13598. @end table
  13599. Default is @var{none}.
  13600. @item new
  13601. Take new palette for each output frame.
  13602. @item alpha_threshold
  13603. Sets the alpha threshold for transparency. Alpha values above this threshold
  13604. will be treated as completely opaque, and values below this threshold will be
  13605. treated as completely transparent.
  13606. The option must be an integer value in the range [0,255]. Default is @var{128}.
  13607. @item use_alpha
  13608. Apply the palette by taking alpha values into account. Only useful with
  13609. palettes that are containing multiple colors with alpha components.
  13610. Setting this will automatically disable 'alpha_treshold'.
  13611. @end table
  13612. @subsection Examples
  13613. @itemize
  13614. @item
  13615. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  13616. using @command{ffmpeg}:
  13617. @example
  13618. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  13619. @end example
  13620. @end itemize
  13621. @section perspective
  13622. Correct perspective of video not recorded perpendicular to the screen.
  13623. A description of the accepted parameters follows.
  13624. @table @option
  13625. @item x0
  13626. @item y0
  13627. @item x1
  13628. @item y1
  13629. @item x2
  13630. @item y2
  13631. @item x3
  13632. @item y3
  13633. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  13634. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  13635. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  13636. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  13637. then the corners of the source will be sent to the specified coordinates.
  13638. The expressions can use the following variables:
  13639. @table @option
  13640. @item W
  13641. @item H
  13642. the width and height of video frame.
  13643. @item in
  13644. Input frame count.
  13645. @item on
  13646. Output frame count.
  13647. @end table
  13648. @item interpolation
  13649. Set interpolation for perspective correction.
  13650. It accepts the following values:
  13651. @table @samp
  13652. @item linear
  13653. @item cubic
  13654. @end table
  13655. Default value is @samp{linear}.
  13656. @item sense
  13657. Set interpretation of coordinate options.
  13658. It accepts the following values:
  13659. @table @samp
  13660. @item 0, source
  13661. Send point in the source specified by the given coordinates to
  13662. the corners of the destination.
  13663. @item 1, destination
  13664. Send the corners of the source to the point in the destination specified
  13665. by the given coordinates.
  13666. Default value is @samp{source}.
  13667. @end table
  13668. @item eval
  13669. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  13670. It accepts the following values:
  13671. @table @samp
  13672. @item init
  13673. only evaluate expressions once during the filter initialization or
  13674. when a command is processed
  13675. @item frame
  13676. evaluate expressions for each incoming frame
  13677. @end table
  13678. Default value is @samp{init}.
  13679. @end table
  13680. @section phase
  13681. Delay interlaced video by one field time so that the field order changes.
  13682. The intended use is to fix PAL movies that have been captured with the
  13683. opposite field order to the film-to-video transfer.
  13684. A description of the accepted parameters follows.
  13685. @table @option
  13686. @item mode
  13687. Set phase mode.
  13688. It accepts the following values:
  13689. @table @samp
  13690. @item t
  13691. Capture field order top-first, transfer bottom-first.
  13692. Filter will delay the bottom field.
  13693. @item b
  13694. Capture field order bottom-first, transfer top-first.
  13695. Filter will delay the top field.
  13696. @item p
  13697. Capture and transfer with the same field order. This mode only exists
  13698. for the documentation of the other options to refer to, but if you
  13699. actually select it, the filter will faithfully do nothing.
  13700. @item a
  13701. Capture field order determined automatically by field flags, transfer
  13702. opposite.
  13703. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  13704. basis using field flags. If no field information is available,
  13705. then this works just like @samp{u}.
  13706. @item u
  13707. Capture unknown or varying, transfer opposite.
  13708. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  13709. analyzing the images and selecting the alternative that produces best
  13710. match between the fields.
  13711. @item T
  13712. Capture top-first, transfer unknown or varying.
  13713. Filter selects among @samp{t} and @samp{p} using image analysis.
  13714. @item B
  13715. Capture bottom-first, transfer unknown or varying.
  13716. Filter selects among @samp{b} and @samp{p} using image analysis.
  13717. @item A
  13718. Capture determined by field flags, transfer unknown or varying.
  13719. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  13720. image analysis. If no field information is available, then this works just
  13721. like @samp{U}. This is the default mode.
  13722. @item U
  13723. Both capture and transfer unknown or varying.
  13724. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  13725. @end table
  13726. @end table
  13727. @subsection Commands
  13728. This filter supports the all above options as @ref{commands}.
  13729. @section photosensitivity
  13730. Reduce various flashes in video, so to help users with epilepsy.
  13731. It accepts the following options:
  13732. @table @option
  13733. @item frames, f
  13734. Set how many frames to use when filtering. Default is 30.
  13735. @item threshold, t
  13736. Set detection threshold factor. Default is 1.
  13737. Lower is stricter.
  13738. @item skip
  13739. Set how many pixels to skip when sampling frames. Default is 1.
  13740. Allowed range is from 1 to 1024.
  13741. @item bypass
  13742. Leave frames unchanged. Default is disabled.
  13743. @end table
  13744. @section pixdesctest
  13745. Pixel format descriptor test filter, mainly useful for internal
  13746. testing. The output video should be equal to the input video.
  13747. For example:
  13748. @example
  13749. format=monow, pixdesctest
  13750. @end example
  13751. can be used to test the monowhite pixel format descriptor definition.
  13752. @section pixelize
  13753. Apply pixelization to video stream.
  13754. The filter accepts the following options:
  13755. @table @option
  13756. @item width, w
  13757. @item height, h
  13758. Set block dimensions that will be used for pixelization.
  13759. Default value is @code{16}.
  13760. @item mode, m
  13761. Set the mode of pixelization used.
  13762. Possible values are:
  13763. @table @samp
  13764. @item avg
  13765. @item min
  13766. @item max
  13767. @end table
  13768. Default value is @code{avg}.
  13769. @item planes, p
  13770. Set what planes to filter. Default is to filter all planes.
  13771. @end table
  13772. @subsection Commands
  13773. This filter supports all options as @ref{commands}.
  13774. @section pixscope
  13775. Display sample values of color channels. Mainly useful for checking color
  13776. and levels. Minimum supported resolution is 640x480.
  13777. The filters accept the following options:
  13778. @table @option
  13779. @item x
  13780. Set scope X position, relative offset on X axis.
  13781. @item y
  13782. Set scope Y position, relative offset on Y axis.
  13783. @item w
  13784. Set scope width.
  13785. @item h
  13786. Set scope height.
  13787. @item o
  13788. Set window opacity. This window also holds statistics about pixel area.
  13789. @item wx
  13790. Set window X position, relative offset on X axis.
  13791. @item wy
  13792. Set window Y position, relative offset on Y axis.
  13793. @end table
  13794. @subsection Commands
  13795. This filter supports same @ref{commands} as options.
  13796. @section pp
  13797. Enable the specified chain of postprocessing subfilters using libpostproc. This
  13798. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  13799. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  13800. Each subfilter and some options have a short and a long name that can be used
  13801. interchangeably, i.e. dr/dering are the same.
  13802. The filters accept the following options:
  13803. @table @option
  13804. @item subfilters
  13805. Set postprocessing subfilters string.
  13806. @end table
  13807. All subfilters share common options to determine their scope:
  13808. @table @option
  13809. @item a/autoq
  13810. Honor the quality commands for this subfilter.
  13811. @item c/chrom
  13812. Do chrominance filtering, too (default).
  13813. @item y/nochrom
  13814. Do luminance filtering only (no chrominance).
  13815. @item n/noluma
  13816. Do chrominance filtering only (no luminance).
  13817. @end table
  13818. These options can be appended after the subfilter name, separated by a '|'.
  13819. Available subfilters are:
  13820. @table @option
  13821. @item hb/hdeblock[|difference[|flatness]]
  13822. Horizontal deblocking filter
  13823. @table @option
  13824. @item difference
  13825. Difference factor where higher values mean more deblocking (default: @code{32}).
  13826. @item flatness
  13827. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  13828. @end table
  13829. @item vb/vdeblock[|difference[|flatness]]
  13830. Vertical deblocking filter
  13831. @table @option
  13832. @item difference
  13833. Difference factor where higher values mean more deblocking (default: @code{32}).
  13834. @item flatness
  13835. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  13836. @end table
  13837. @item ha/hadeblock[|difference[|flatness]]
  13838. Accurate horizontal deblocking filter
  13839. @table @option
  13840. @item difference
  13841. Difference factor where higher values mean more deblocking (default: @code{32}).
  13842. @item flatness
  13843. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  13844. @end table
  13845. @item va/vadeblock[|difference[|flatness]]
  13846. Accurate vertical deblocking filter
  13847. @table @option
  13848. @item difference
  13849. Difference factor where higher values mean more deblocking (default: @code{32}).
  13850. @item flatness
  13851. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  13852. @end table
  13853. @end table
  13854. The horizontal and vertical deblocking filters share the difference and
  13855. flatness values so you cannot set different horizontal and vertical
  13856. thresholds.
  13857. @table @option
  13858. @item h1/x1hdeblock
  13859. Experimental horizontal deblocking filter
  13860. @item v1/x1vdeblock
  13861. Experimental vertical deblocking filter
  13862. @item dr/dering
  13863. Deringing filter
  13864. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  13865. @table @option
  13866. @item threshold1
  13867. larger -> stronger filtering
  13868. @item threshold2
  13869. larger -> stronger filtering
  13870. @item threshold3
  13871. larger -> stronger filtering
  13872. @end table
  13873. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  13874. @table @option
  13875. @item f/fullyrange
  13876. Stretch luminance to @code{0-255}.
  13877. @end table
  13878. @item lb/linblenddeint
  13879. Linear blend deinterlacing filter that deinterlaces the given block by
  13880. filtering all lines with a @code{(1 2 1)} filter.
  13881. @item li/linipoldeint
  13882. Linear interpolating deinterlacing filter that deinterlaces the given block by
  13883. linearly interpolating every second line.
  13884. @item ci/cubicipoldeint
  13885. Cubic interpolating deinterlacing filter deinterlaces the given block by
  13886. cubically interpolating every second line.
  13887. @item md/mediandeint
  13888. Median deinterlacing filter that deinterlaces the given block by applying a
  13889. median filter to every second line.
  13890. @item fd/ffmpegdeint
  13891. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  13892. second line with a @code{(-1 4 2 4 -1)} filter.
  13893. @item l5/lowpass5
  13894. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  13895. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  13896. @item fq/forceQuant[|quantizer]
  13897. Overrides the quantizer table from the input with the constant quantizer you
  13898. specify.
  13899. @table @option
  13900. @item quantizer
  13901. Quantizer to use
  13902. @end table
  13903. @item de/default
  13904. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  13905. @item fa/fast
  13906. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  13907. @item ac
  13908. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  13909. @end table
  13910. @subsection Examples
  13911. @itemize
  13912. @item
  13913. Apply horizontal and vertical deblocking, deringing and automatic
  13914. brightness/contrast:
  13915. @example
  13916. pp=hb/vb/dr/al
  13917. @end example
  13918. @item
  13919. Apply default filters without brightness/contrast correction:
  13920. @example
  13921. pp=de/-al
  13922. @end example
  13923. @item
  13924. Apply default filters and temporal denoiser:
  13925. @example
  13926. pp=default/tmpnoise|1|2|3
  13927. @end example
  13928. @item
  13929. Apply deblocking on luminance only, and switch vertical deblocking on or off
  13930. automatically depending on available CPU time:
  13931. @example
  13932. pp=hb|y/vb|a
  13933. @end example
  13934. @end itemize
  13935. @section pp7
  13936. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  13937. similar to spp = 6 with 7 point DCT, where only the center sample is
  13938. used after IDCT.
  13939. The filter accepts the following options:
  13940. @table @option
  13941. @item qp
  13942. Force a constant quantization parameter. It accepts an integer in range
  13943. 0 to 63. If not set, the filter will use the QP from the video stream
  13944. (if available).
  13945. @item mode
  13946. Set thresholding mode. Available modes are:
  13947. @table @samp
  13948. @item hard
  13949. Set hard thresholding.
  13950. @item soft
  13951. Set soft thresholding (better de-ringing effect, but likely blurrier).
  13952. @item medium
  13953. Set medium thresholding (good results, default).
  13954. @end table
  13955. @end table
  13956. @section premultiply
  13957. Apply alpha premultiply effect to input video stream using first plane
  13958. of second stream as alpha.
  13959. Both streams must have same dimensions and same pixel format.
  13960. The filter accepts the following option:
  13961. @table @option
  13962. @item planes
  13963. Set which planes will be processed, unprocessed planes will be copied.
  13964. By default value 0xf, all planes will be processed.
  13965. @item inplace
  13966. Do not require 2nd input for processing, instead use alpha plane from input stream.
  13967. @end table
  13968. @section prewitt
  13969. Apply prewitt operator to input video stream.
  13970. The filter accepts the following option:
  13971. @table @option
  13972. @item planes
  13973. Set which planes will be processed, unprocessed planes will be copied.
  13974. By default value 0xf, all planes will be processed.
  13975. @item scale
  13976. Set value which will be multiplied with filtered result.
  13977. @item delta
  13978. Set value which will be added to filtered result.
  13979. @end table
  13980. @subsection Commands
  13981. This filter supports the all above options as @ref{commands}.
  13982. @section pseudocolor
  13983. Alter frame colors in video with pseudocolors.
  13984. This filter accepts the following options:
  13985. @table @option
  13986. @item c0
  13987. set pixel first component expression
  13988. @item c1
  13989. set pixel second component expression
  13990. @item c2
  13991. set pixel third component expression
  13992. @item c3
  13993. set pixel fourth component expression, corresponds to the alpha component
  13994. @item index, i
  13995. set component to use as base for altering colors
  13996. @item preset, p
  13997. Pick one of built-in LUTs. By default is set to none.
  13998. Available LUTs:
  13999. @table @samp
  14000. @item magma
  14001. @item inferno
  14002. @item plasma
  14003. @item viridis
  14004. @item turbo
  14005. @item cividis
  14006. @item range1
  14007. @item range2
  14008. @item shadows
  14009. @item highlights
  14010. @item solar
  14011. @item nominal
  14012. @item preferred
  14013. @item total
  14014. @end table
  14015. @item opacity
  14016. Set opacity of output colors. Allowed range is from 0 to 1.
  14017. Default value is set to 1.
  14018. @end table
  14019. Each of the expression options specifies the expression to use for computing
  14020. the lookup table for the corresponding pixel component values.
  14021. The expressions can contain the following constants and functions:
  14022. @table @option
  14023. @item w
  14024. @item h
  14025. The input width and height.
  14026. @item val
  14027. The input value for the pixel component.
  14028. @item ymin, umin, vmin, amin
  14029. The minimum allowed component value.
  14030. @item ymax, umax, vmax, amax
  14031. The maximum allowed component value.
  14032. @end table
  14033. All expressions default to "val".
  14034. @subsection Commands
  14035. This filter supports the all above options as @ref{commands}.
  14036. @subsection Examples
  14037. @itemize
  14038. @item
  14039. Change too high luma values to gradient:
  14040. @example
  14041. 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'"
  14042. @end example
  14043. @end itemize
  14044. @section psnr
  14045. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  14046. Ratio) between two input videos.
  14047. This filter takes in input two input videos, the first input is
  14048. considered the "main" source and is passed unchanged to the
  14049. output. The second input is used as a "reference" video for computing
  14050. the PSNR.
  14051. Both video inputs must have the same resolution and pixel format for
  14052. this filter to work correctly. Also it assumes that both inputs
  14053. have the same number of frames, which are compared one by one.
  14054. The obtained average PSNR is printed through the logging system.
  14055. The filter stores the accumulated MSE (mean squared error) of each
  14056. frame, and at the end of the processing it is averaged across all frames
  14057. equally, and the following formula is applied to obtain the PSNR:
  14058. @example
  14059. PSNR = 10*log10(MAX^2/MSE)
  14060. @end example
  14061. Where MAX is the average of the maximum values of each component of the
  14062. image.
  14063. The description of the accepted parameters follows.
  14064. @table @option
  14065. @item stats_file, f
  14066. If specified the filter will use the named file to save the PSNR of
  14067. each individual frame. When filename equals "-" the data is sent to
  14068. standard output.
  14069. @item stats_version
  14070. Specifies which version of the stats file format to use. Details of
  14071. each format are written below.
  14072. Default value is 1.
  14073. @item stats_add_max
  14074. Determines whether the max value is output to the stats log.
  14075. Default value is 0.
  14076. Requires stats_version >= 2. If this is set and stats_version < 2,
  14077. the filter will return an error.
  14078. @end table
  14079. This filter also supports the @ref{framesync} options.
  14080. The file printed if @var{stats_file} is selected, contains a sequence of
  14081. key/value pairs of the form @var{key}:@var{value} for each compared
  14082. couple of frames.
  14083. If a @var{stats_version} greater than 1 is specified, a header line precedes
  14084. the list of per-frame-pair stats, with key value pairs following the frame
  14085. format with the following parameters:
  14086. @table @option
  14087. @item psnr_log_version
  14088. The version of the log file format. Will match @var{stats_version}.
  14089. @item fields
  14090. A comma separated list of the per-frame-pair parameters included in
  14091. the log.
  14092. @end table
  14093. A description of each shown per-frame-pair parameter follows:
  14094. @table @option
  14095. @item n
  14096. sequential number of the input frame, starting from 1
  14097. @item mse_avg
  14098. Mean Square Error pixel-by-pixel average difference of the compared
  14099. frames, averaged over all the image components.
  14100. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  14101. Mean Square Error pixel-by-pixel average difference of the compared
  14102. frames for the component specified by the suffix.
  14103. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  14104. Peak Signal to Noise ratio of the compared frames for the component
  14105. specified by the suffix.
  14106. @item max_avg, max_y, max_u, max_v
  14107. Maximum allowed value for each channel, and average over all
  14108. channels.
  14109. @end table
  14110. @subsection Examples
  14111. @itemize
  14112. @item
  14113. For example:
  14114. @example
  14115. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  14116. [main][ref] psnr="stats_file=stats.log" [out]
  14117. @end example
  14118. On this example the input file being processed is compared with the
  14119. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  14120. is stored in @file{stats.log}.
  14121. @item
  14122. Another example with different containers:
  14123. @example
  14124. 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 -
  14125. @end example
  14126. @end itemize
  14127. @anchor{pullup}
  14128. @section pullup
  14129. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  14130. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  14131. content.
  14132. The pullup filter is designed to take advantage of future context in making
  14133. its decisions. This filter is stateless in the sense that it does not lock
  14134. onto a pattern to follow, but it instead looks forward to the following
  14135. fields in order to identify matches and rebuild progressive frames.
  14136. To produce content with an even framerate, insert the fps filter after
  14137. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  14138. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  14139. The filter accepts the following options:
  14140. @table @option
  14141. @item jl
  14142. @item jr
  14143. @item jt
  14144. @item jb
  14145. These options set the amount of "junk" to ignore at the left, right, top, and
  14146. bottom of the image, respectively. Left and right are in units of 8 pixels,
  14147. while top and bottom are in units of 2 lines.
  14148. The default is 8 pixels on each side.
  14149. @item sb
  14150. Set the strict breaks. Setting this option to 1 will reduce the chances of
  14151. filter generating an occasional mismatched frame, but it may also cause an
  14152. excessive number of frames to be dropped during high motion sequences.
  14153. Conversely, setting it to -1 will make filter match fields more easily.
  14154. This may help processing of video where there is slight blurring between
  14155. the fields, but may also cause there to be interlaced frames in the output.
  14156. Default value is @code{0}.
  14157. @item mp
  14158. Set the metric plane to use. It accepts the following values:
  14159. @table @samp
  14160. @item l
  14161. Use luma plane.
  14162. @item u
  14163. Use chroma blue plane.
  14164. @item v
  14165. Use chroma red plane.
  14166. @end table
  14167. This option may be set to use chroma plane instead of the default luma plane
  14168. for doing filter's computations. This may improve accuracy on very clean
  14169. source material, but more likely will decrease accuracy, especially if there
  14170. is chroma noise (rainbow effect) or any grayscale video.
  14171. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  14172. load and make pullup usable in realtime on slow machines.
  14173. @end table
  14174. For best results (without duplicated frames in the output file) it is
  14175. necessary to change the output frame rate. For example, to inverse
  14176. telecine NTSC input:
  14177. @example
  14178. ffmpeg -i input -vf pullup -r 24000/1001 ...
  14179. @end example
  14180. @section qp
  14181. Change video quantization parameters (QP).
  14182. The filter accepts the following option:
  14183. @table @option
  14184. @item qp
  14185. Set expression for quantization parameter.
  14186. @end table
  14187. The expression is evaluated through the eval API and can contain, among others,
  14188. the following constants:
  14189. @table @var
  14190. @item known
  14191. 1 if index is not 129, 0 otherwise.
  14192. @item qp
  14193. Sequential index starting from -129 to 128.
  14194. @end table
  14195. @subsection Examples
  14196. @itemize
  14197. @item
  14198. Some equation like:
  14199. @example
  14200. qp=2+2*sin(PI*qp)
  14201. @end example
  14202. @end itemize
  14203. @section random
  14204. Flush video frames from internal cache of frames into a random order.
  14205. No frame is discarded.
  14206. Inspired by @ref{frei0r} nervous filter.
  14207. @table @option
  14208. @item frames
  14209. Set size in number of frames of internal cache, in range from @code{2} to
  14210. @code{512}. Default is @code{30}.
  14211. @item seed
  14212. Set seed for random number generator, must be an integer included between
  14213. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  14214. less than @code{0}, the filter will try to use a good random seed on a
  14215. best effort basis.
  14216. @end table
  14217. @section readeia608
  14218. Read closed captioning (EIA-608) information from the top lines of a video frame.
  14219. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  14220. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  14221. with EIA-608 data (starting from 0). A description of each metadata value follows:
  14222. @table @option
  14223. @item lavfi.readeia608.X.cc
  14224. The two bytes stored as EIA-608 data (printed in hexadecimal).
  14225. @item lavfi.readeia608.X.line
  14226. The number of the line on which the EIA-608 data was identified and read.
  14227. @end table
  14228. This filter accepts the following options:
  14229. @table @option
  14230. @item scan_min
  14231. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  14232. @item scan_max
  14233. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  14234. @item spw
  14235. Set the ratio of width reserved for sync code detection.
  14236. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  14237. @item chp
  14238. Enable checking the parity bit. In the event of a parity error, the filter will output
  14239. @code{0x00} for that character. Default is false.
  14240. @item lp
  14241. Lowpass lines prior to further processing. Default is enabled.
  14242. @end table
  14243. @subsection Commands
  14244. This filter supports the all above options as @ref{commands}.
  14245. @subsection Examples
  14246. @itemize
  14247. @item
  14248. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  14249. @example
  14250. 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
  14251. @end example
  14252. @end itemize
  14253. @section readvitc
  14254. Read vertical interval timecode (VITC) information from the top lines of a
  14255. video frame.
  14256. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  14257. timecode value, if a valid timecode has been detected. Further metadata key
  14258. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  14259. timecode data has been found or not.
  14260. This filter accepts the following options:
  14261. @table @option
  14262. @item scan_max
  14263. Set the maximum number of lines to scan for VITC data. If the value is set to
  14264. @code{-1} the full video frame is scanned. Default is @code{45}.
  14265. @item thr_b
  14266. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  14267. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  14268. @item thr_w
  14269. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  14270. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  14271. @end table
  14272. @subsection Examples
  14273. @itemize
  14274. @item
  14275. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  14276. draw @code{--:--:--:--} as a placeholder:
  14277. @example
  14278. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  14279. @end example
  14280. @end itemize
  14281. @section remap
  14282. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  14283. Destination pixel at position (X, Y) will be picked from source (x, y) position
  14284. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  14285. value for pixel will be used for destination pixel.
  14286. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  14287. will have Xmap/Ymap video stream dimensions.
  14288. Xmap and Ymap input video streams are 16bit depth, single channel.
  14289. @table @option
  14290. @item format
  14291. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  14292. Default is @code{color}.
  14293. @item fill
  14294. Specify the color of the unmapped pixels. For the syntax of this option,
  14295. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14296. manual,ffmpeg-utils}. Default color is @code{black}.
  14297. @end table
  14298. @section removegrain
  14299. The removegrain filter is a spatial denoiser for progressive video.
  14300. @table @option
  14301. @item m0
  14302. Set mode for the first plane.
  14303. @item m1
  14304. Set mode for the second plane.
  14305. @item m2
  14306. Set mode for the third plane.
  14307. @item m3
  14308. Set mode for the fourth plane.
  14309. @end table
  14310. Range of mode is from 0 to 24. Description of each mode follows:
  14311. @table @var
  14312. @item 0
  14313. Leave input plane unchanged. Default.
  14314. @item 1
  14315. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  14316. @item 2
  14317. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  14318. @item 3
  14319. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  14320. @item 4
  14321. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  14322. This is equivalent to a median filter.
  14323. @item 5
  14324. Line-sensitive clipping giving the minimal change.
  14325. @item 6
  14326. Line-sensitive clipping, intermediate.
  14327. @item 7
  14328. Line-sensitive clipping, intermediate.
  14329. @item 8
  14330. Line-sensitive clipping, intermediate.
  14331. @item 9
  14332. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  14333. @item 10
  14334. Replaces the target pixel with the closest neighbour.
  14335. @item 11
  14336. [1 2 1] horizontal and vertical kernel blur.
  14337. @item 12
  14338. Same as mode 11.
  14339. @item 13
  14340. Bob mode, interpolates top field from the line where the neighbours
  14341. pixels are the closest.
  14342. @item 14
  14343. Bob mode, interpolates bottom field from the line where the neighbours
  14344. pixels are the closest.
  14345. @item 15
  14346. Bob mode, interpolates top field. Same as 13 but with a more complicated
  14347. interpolation formula.
  14348. @item 16
  14349. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  14350. interpolation formula.
  14351. @item 17
  14352. Clips the pixel with the minimum and maximum of respectively the maximum and
  14353. minimum of each pair of opposite neighbour pixels.
  14354. @item 18
  14355. Line-sensitive clipping using opposite neighbours whose greatest distance from
  14356. the current pixel is minimal.
  14357. @item 19
  14358. Replaces the pixel with the average of its 8 neighbours.
  14359. @item 20
  14360. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  14361. @item 21
  14362. Clips pixels using the averages of opposite neighbour.
  14363. @item 22
  14364. Same as mode 21 but simpler and faster.
  14365. @item 23
  14366. Small edge and halo removal, but reputed useless.
  14367. @item 24
  14368. Similar as 23.
  14369. @end table
  14370. @section removelogo
  14371. Suppress a TV station logo, using an image file to determine which
  14372. pixels comprise the logo. It works by filling in the pixels that
  14373. comprise the logo with neighboring pixels.
  14374. The filter accepts the following options:
  14375. @table @option
  14376. @item filename, f
  14377. Set the filter bitmap file, which can be any image format supported by
  14378. libavformat. The width and height of the image file must match those of the
  14379. video stream being processed.
  14380. @end table
  14381. Pixels in the provided bitmap image with a value of zero are not
  14382. considered part of the logo, non-zero pixels are considered part of
  14383. the logo. If you use white (255) for the logo and black (0) for the
  14384. rest, you will be safe. For making the filter bitmap, it is
  14385. recommended to take a screen capture of a black frame with the logo
  14386. visible, and then using a threshold filter followed by the erode
  14387. filter once or twice.
  14388. If needed, little splotches can be fixed manually. Remember that if
  14389. logo pixels are not covered, the filter quality will be much
  14390. reduced. Marking too many pixels as part of the logo does not hurt as
  14391. much, but it will increase the amount of blurring needed to cover over
  14392. the image and will destroy more information than necessary, and extra
  14393. pixels will slow things down on a large logo.
  14394. @section repeatfields
  14395. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  14396. fields based on its value.
  14397. @section reverse
  14398. Reverse a video clip.
  14399. Warning: This filter requires memory to buffer the entire clip, so trimming
  14400. is suggested.
  14401. @subsection Examples
  14402. @itemize
  14403. @item
  14404. Take the first 5 seconds of a clip, and reverse it.
  14405. @example
  14406. trim=end=5,reverse
  14407. @end example
  14408. @end itemize
  14409. @section rgbashift
  14410. Shift R/G/B/A pixels horizontally and/or vertically.
  14411. The filter accepts the following options:
  14412. @table @option
  14413. @item rh
  14414. Set amount to shift red horizontally.
  14415. @item rv
  14416. Set amount to shift red vertically.
  14417. @item gh
  14418. Set amount to shift green horizontally.
  14419. @item gv
  14420. Set amount to shift green vertically.
  14421. @item bh
  14422. Set amount to shift blue horizontally.
  14423. @item bv
  14424. Set amount to shift blue vertically.
  14425. @item ah
  14426. Set amount to shift alpha horizontally.
  14427. @item av
  14428. Set amount to shift alpha vertically.
  14429. @item edge
  14430. Set edge mode, can be @var{smear}, default, or @var{warp}.
  14431. @end table
  14432. @subsection Commands
  14433. This filter supports the all above options as @ref{commands}.
  14434. @section roberts
  14435. Apply roberts cross operator to input video stream.
  14436. The filter accepts the following option:
  14437. @table @option
  14438. @item planes
  14439. Set which planes will be processed, unprocessed planes will be copied.
  14440. By default value 0xf, all planes will be processed.
  14441. @item scale
  14442. Set value which will be multiplied with filtered result.
  14443. @item delta
  14444. Set value which will be added to filtered result.
  14445. @end table
  14446. @subsection Commands
  14447. This filter supports the all above options as @ref{commands}.
  14448. @section rotate
  14449. Rotate video by an arbitrary angle expressed in radians.
  14450. The filter accepts the following options:
  14451. A description of the optional parameters follows.
  14452. @table @option
  14453. @item angle, a
  14454. Set an expression for the angle by which to rotate the input video
  14455. clockwise, expressed as a number of radians. A negative value will
  14456. result in a counter-clockwise rotation. By default it is set to "0".
  14457. This expression is evaluated for each frame.
  14458. @item out_w, ow
  14459. Set the output width expression, default value is "iw".
  14460. This expression is evaluated just once during configuration.
  14461. @item out_h, oh
  14462. Set the output height expression, default value is "ih".
  14463. This expression is evaluated just once during configuration.
  14464. @item bilinear
  14465. Enable bilinear interpolation if set to 1, a value of 0 disables
  14466. it. Default value is 1.
  14467. @item fillcolor, c
  14468. Set the color used to fill the output area not covered by the rotated
  14469. image. For the general syntax of this option, check the
  14470. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14471. If the special value "none" is selected then no
  14472. background is printed (useful for example if the background is never shown).
  14473. Default value is "black".
  14474. @end table
  14475. The expressions for the angle and the output size can contain the
  14476. following constants and functions:
  14477. @table @option
  14478. @item n
  14479. sequential number of the input frame, starting from 0. It is always NAN
  14480. before the first frame is filtered.
  14481. @item t
  14482. time in seconds of the input frame, it is set to 0 when the filter is
  14483. configured. It is always NAN before the first frame is filtered.
  14484. @item hsub
  14485. @item vsub
  14486. horizontal and vertical chroma subsample values. For example for the
  14487. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14488. @item in_w, iw
  14489. @item in_h, ih
  14490. the input video width and height
  14491. @item out_w, ow
  14492. @item out_h, oh
  14493. the output width and height, that is the size of the padded area as
  14494. specified by the @var{width} and @var{height} expressions
  14495. @item rotw(a)
  14496. @item roth(a)
  14497. the minimal width/height required for completely containing the input
  14498. video rotated by @var{a} radians.
  14499. These are only available when computing the @option{out_w} and
  14500. @option{out_h} expressions.
  14501. @end table
  14502. @subsection Examples
  14503. @itemize
  14504. @item
  14505. Rotate the input by PI/6 radians clockwise:
  14506. @example
  14507. rotate=PI/6
  14508. @end example
  14509. @item
  14510. Rotate the input by PI/6 radians counter-clockwise:
  14511. @example
  14512. rotate=-PI/6
  14513. @end example
  14514. @item
  14515. Rotate the input by 45 degrees clockwise:
  14516. @example
  14517. rotate=45*PI/180
  14518. @end example
  14519. @item
  14520. Apply a constant rotation with period T, starting from an angle of PI/3:
  14521. @example
  14522. rotate=PI/3+2*PI*t/T
  14523. @end example
  14524. @item
  14525. Make the input video rotation oscillating with a period of T
  14526. seconds and an amplitude of A radians:
  14527. @example
  14528. rotate=A*sin(2*PI/T*t)
  14529. @end example
  14530. @item
  14531. Rotate the video, output size is chosen so that the whole rotating
  14532. input video is always completely contained in the output:
  14533. @example
  14534. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  14535. @end example
  14536. @item
  14537. Rotate the video, reduce the output size so that no background is ever
  14538. shown:
  14539. @example
  14540. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  14541. @end example
  14542. @end itemize
  14543. @subsection Commands
  14544. The filter supports the following commands:
  14545. @table @option
  14546. @item a, angle
  14547. Set the angle expression.
  14548. The command accepts the same syntax of the corresponding option.
  14549. If the specified expression is not valid, it is kept at its current
  14550. value.
  14551. @end table
  14552. @section sab
  14553. Apply Shape Adaptive Blur.
  14554. The filter accepts the following options:
  14555. @table @option
  14556. @item luma_radius, lr
  14557. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  14558. value is 1.0. A greater value will result in a more blurred image, and
  14559. in slower processing.
  14560. @item luma_pre_filter_radius, lpfr
  14561. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  14562. value is 1.0.
  14563. @item luma_strength, ls
  14564. Set luma maximum difference between pixels to still be considered, must
  14565. be a value in the 0.1-100.0 range, default value is 1.0.
  14566. @item chroma_radius, cr
  14567. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  14568. greater value will result in a more blurred image, and in slower
  14569. processing.
  14570. @item chroma_pre_filter_radius, cpfr
  14571. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  14572. @item chroma_strength, cs
  14573. Set chroma maximum difference between pixels to still be considered,
  14574. must be a value in the -0.9-100.0 range.
  14575. @end table
  14576. Each chroma option value, if not explicitly specified, is set to the
  14577. corresponding luma option value.
  14578. @anchor{scale}
  14579. @section scale
  14580. Scale (resize) the input video, using the libswscale library.
  14581. The scale filter forces the output display aspect ratio to be the same
  14582. of the input, by changing the output sample aspect ratio.
  14583. If the input image format is different from the format requested by
  14584. the next filter, the scale filter will convert the input to the
  14585. requested format.
  14586. @subsection Options
  14587. The filter accepts the following options, or any of the options
  14588. supported by the libswscale scaler.
  14589. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  14590. the complete list of scaler options.
  14591. @table @option
  14592. @item width, w
  14593. @item height, h
  14594. Set the output video dimension expression. Default value is the input
  14595. dimension.
  14596. If the @var{width} or @var{w} value is 0, the input width is used for
  14597. the output. If the @var{height} or @var{h} value is 0, the input height
  14598. is used for the output.
  14599. If one and only one of the values is -n with n >= 1, the scale filter
  14600. will use a value that maintains the aspect ratio of the input image,
  14601. calculated from the other specified dimension. After that it will,
  14602. however, make sure that the calculated dimension is divisible by n and
  14603. adjust the value if necessary.
  14604. If both values are -n with n >= 1, the behavior will be identical to
  14605. both values being set to 0 as previously detailed.
  14606. See below for the list of accepted constants for use in the dimension
  14607. expression.
  14608. @item eval
  14609. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  14610. @table @samp
  14611. @item init
  14612. Only evaluate expressions once during the filter initialization or when a command is processed.
  14613. @item frame
  14614. Evaluate expressions for each incoming frame.
  14615. @end table
  14616. Default value is @samp{init}.
  14617. @item interl
  14618. Set the interlacing mode. It accepts the following values:
  14619. @table @samp
  14620. @item 1
  14621. Force interlaced aware scaling.
  14622. @item 0
  14623. Do not apply interlaced scaling.
  14624. @item -1
  14625. Select interlaced aware scaling depending on whether the source frames
  14626. are flagged as interlaced or not.
  14627. @end table
  14628. Default value is @samp{0}.
  14629. @item flags
  14630. Set libswscale scaling flags. See
  14631. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  14632. complete list of values. If not explicitly specified the filter applies
  14633. the default flags.
  14634. @item param0, param1
  14635. Set libswscale input parameters for scaling algorithms that need them. See
  14636. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  14637. complete documentation. If not explicitly specified the filter applies
  14638. empty parameters.
  14639. @item size, s
  14640. Set the video size. For the syntax of this option, check the
  14641. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14642. @item in_color_matrix
  14643. @item out_color_matrix
  14644. Set in/output YCbCr color space type.
  14645. This allows the autodetected value to be overridden as well as allows forcing
  14646. a specific value used for the output and encoder.
  14647. If not specified, the color space type depends on the pixel format.
  14648. Possible values:
  14649. @table @samp
  14650. @item auto
  14651. Choose automatically.
  14652. @item bt709
  14653. Format conforming to International Telecommunication Union (ITU)
  14654. Recommendation BT.709.
  14655. @item fcc
  14656. Set color space conforming to the United States Federal Communications
  14657. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  14658. @item bt601
  14659. @item bt470
  14660. @item smpte170m
  14661. Set color space conforming to:
  14662. @itemize
  14663. @item
  14664. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  14665. @item
  14666. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  14667. @item
  14668. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  14669. @end itemize
  14670. @item smpte240m
  14671. Set color space conforming to SMPTE ST 240:1999.
  14672. @item bt2020
  14673. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  14674. @end table
  14675. @item in_range
  14676. @item out_range
  14677. Set in/output YCbCr sample range.
  14678. This allows the autodetected value to be overridden as well as allows forcing
  14679. a specific value used for the output and encoder. If not specified, the
  14680. range depends on the pixel format. Possible values:
  14681. @table @samp
  14682. @item auto/unknown
  14683. Choose automatically.
  14684. @item jpeg/full/pc
  14685. Set full range (0-255 in case of 8-bit luma).
  14686. @item mpeg/limited/tv
  14687. Set "MPEG" range (16-235 in case of 8-bit luma).
  14688. @end table
  14689. @item force_original_aspect_ratio
  14690. Enable decreasing or increasing output video width or height if necessary to
  14691. keep the original aspect ratio. Possible values:
  14692. @table @samp
  14693. @item disable
  14694. Scale the video as specified and disable this feature.
  14695. @item decrease
  14696. The output video dimensions will automatically be decreased if needed.
  14697. @item increase
  14698. The output video dimensions will automatically be increased if needed.
  14699. @end table
  14700. One useful instance of this option is that when you know a specific device's
  14701. maximum allowed resolution, you can use this to limit the output video to
  14702. that, while retaining the aspect ratio. For example, device A allows
  14703. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  14704. decrease) and specifying 1280x720 to the command line makes the output
  14705. 1280x533.
  14706. Please note that this is a different thing than specifying -1 for @option{w}
  14707. or @option{h}, you still need to specify the output resolution for this option
  14708. to work.
  14709. @item force_divisible_by
  14710. Ensures that both the output dimensions, width and height, are divisible by the
  14711. given integer when used together with @option{force_original_aspect_ratio}. This
  14712. works similar to using @code{-n} in the @option{w} and @option{h} options.
  14713. This option respects the value set for @option{force_original_aspect_ratio},
  14714. increasing or decreasing the resolution accordingly. The video's aspect ratio
  14715. may be slightly modified.
  14716. This option can be handy if you need to have a video fit within or exceed
  14717. a defined resolution using @option{force_original_aspect_ratio} but also have
  14718. encoder restrictions on width or height divisibility.
  14719. @end table
  14720. The values of the @option{w} and @option{h} options are expressions
  14721. containing the following constants:
  14722. @table @var
  14723. @item in_w
  14724. @item in_h
  14725. The input width and height
  14726. @item iw
  14727. @item ih
  14728. These are the same as @var{in_w} and @var{in_h}.
  14729. @item out_w
  14730. @item out_h
  14731. The output (scaled) width and height
  14732. @item ow
  14733. @item oh
  14734. These are the same as @var{out_w} and @var{out_h}
  14735. @item a
  14736. The same as @var{iw} / @var{ih}
  14737. @item sar
  14738. input sample aspect ratio
  14739. @item dar
  14740. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  14741. @item hsub
  14742. @item vsub
  14743. horizontal and vertical input chroma subsample values. For example for the
  14744. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14745. @item ohsub
  14746. @item ovsub
  14747. horizontal and vertical output chroma subsample values. For example for the
  14748. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14749. @item n
  14750. The (sequential) number of the input frame, starting from 0.
  14751. Only available with @code{eval=frame}.
  14752. @item t
  14753. The presentation timestamp of the input frame, expressed as a number of
  14754. seconds. Only available with @code{eval=frame}.
  14755. @item pos
  14756. The position (byte offset) of the frame in the input stream, or NaN if
  14757. this information is unavailable and/or meaningless (for example in case of synthetic video).
  14758. Only available with @code{eval=frame}.
  14759. @end table
  14760. @subsection Examples
  14761. @itemize
  14762. @item
  14763. Scale the input video to a size of 200x100
  14764. @example
  14765. scale=w=200:h=100
  14766. @end example
  14767. This is equivalent to:
  14768. @example
  14769. scale=200:100
  14770. @end example
  14771. or:
  14772. @example
  14773. scale=200x100
  14774. @end example
  14775. @item
  14776. Specify a size abbreviation for the output size:
  14777. @example
  14778. scale=qcif
  14779. @end example
  14780. which can also be written as:
  14781. @example
  14782. scale=size=qcif
  14783. @end example
  14784. @item
  14785. Scale the input to 2x:
  14786. @example
  14787. scale=w=2*iw:h=2*ih
  14788. @end example
  14789. @item
  14790. The above is the same as:
  14791. @example
  14792. scale=2*in_w:2*in_h
  14793. @end example
  14794. @item
  14795. Scale the input to 2x with forced interlaced scaling:
  14796. @example
  14797. scale=2*iw:2*ih:interl=1
  14798. @end example
  14799. @item
  14800. Scale the input to half size:
  14801. @example
  14802. scale=w=iw/2:h=ih/2
  14803. @end example
  14804. @item
  14805. Increase the width, and set the height to the same size:
  14806. @example
  14807. scale=3/2*iw:ow
  14808. @end example
  14809. @item
  14810. Seek Greek harmony:
  14811. @example
  14812. scale=iw:1/PHI*iw
  14813. scale=ih*PHI:ih
  14814. @end example
  14815. @item
  14816. Increase the height, and set the width to 3/2 of the height:
  14817. @example
  14818. scale=w=3/2*oh:h=3/5*ih
  14819. @end example
  14820. @item
  14821. Increase the size, making the size a multiple of the chroma
  14822. subsample values:
  14823. @example
  14824. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  14825. @end example
  14826. @item
  14827. Increase the width to a maximum of 500 pixels,
  14828. keeping the same aspect ratio as the input:
  14829. @example
  14830. scale=w='min(500\, iw*3/2):h=-1'
  14831. @end example
  14832. @item
  14833. Make pixels square by combining scale and setsar:
  14834. @example
  14835. scale='trunc(ih*dar):ih',setsar=1/1
  14836. @end example
  14837. @item
  14838. Make pixels square by combining scale and setsar,
  14839. making sure the resulting resolution is even (required by some codecs):
  14840. @example
  14841. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  14842. @end example
  14843. @end itemize
  14844. @subsection Commands
  14845. This filter supports the following commands:
  14846. @table @option
  14847. @item width, w
  14848. @item height, h
  14849. Set the output video dimension expression.
  14850. The command accepts the same syntax of the corresponding option.
  14851. If the specified expression is not valid, it is kept at its current
  14852. value.
  14853. @end table
  14854. @section scale_cuda
  14855. Scale (resize) and convert (pixel format) the input video, using accelerated CUDA kernels.
  14856. Setting the output width and height works in the same way as for the @ref{scale} filter.
  14857. The filter accepts the following options:
  14858. @table @option
  14859. @item w
  14860. @item h
  14861. Set the output video dimension expression. Default value is the input dimension.
  14862. Allows for the same expressions as the @ref{scale} filter.
  14863. @item interp_algo
  14864. Sets the algorithm used for scaling:
  14865. @table @var
  14866. @item nearest
  14867. Nearest neighbour
  14868. Used by default if input parameters match the desired output.
  14869. @item bilinear
  14870. Bilinear
  14871. @item bicubic
  14872. Bicubic
  14873. This is the default.
  14874. @item lanczos
  14875. Lanczos
  14876. @end table
  14877. @item format
  14878. Controls the output pixel format. By default, or if none is specified, the input
  14879. pixel format is used.
  14880. The filter does not support converting between YUV and RGB pixel formats.
  14881. @item passthrough
  14882. If set to 0, every frame is processed, even if no conversion is neccesary.
  14883. This mode can be useful to use the filter as a buffer for a downstream
  14884. frame-consumer that exhausts the limited decoder frame pool.
  14885. If set to 1, frames are passed through as-is if they match the desired output
  14886. parameters. This is the default behaviour.
  14887. @item param
  14888. Algorithm-Specific parameter.
  14889. Affects the curves of the bicubic algorithm.
  14890. @item force_original_aspect_ratio
  14891. @item force_divisible_by
  14892. Work the same as the identical @ref{scale} filter options.
  14893. @end table
  14894. @subsection Examples
  14895. @itemize
  14896. @item
  14897. Scale input to 720p, keeping aspect ratio and ensuring the output is yuv420p.
  14898. @example
  14899. scale_cuda=-2:720:format=yuv420p
  14900. @end example
  14901. @item
  14902. Upscale to 4K using nearest neighbour algorithm.
  14903. @example
  14904. scale_cuda=4096:2160:interp_algo=nearest
  14905. @end example
  14906. @item
  14907. Don't do any conversion or scaling, but copy all input frames into newly allocated ones.
  14908. This can be useful to deal with a filter and encode chain that otherwise exhausts the
  14909. decoders frame pool.
  14910. @example
  14911. scale_cuda=passthrough=0
  14912. @end example
  14913. @end itemize
  14914. @anchor{scale_npp}
  14915. @section scale_npp
  14916. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  14917. format conversion on CUDA video frames. Setting the output width and height
  14918. works in the same way as for the @var{scale} filter.
  14919. The following additional options are accepted:
  14920. @table @option
  14921. @item format
  14922. The pixel format of the output CUDA frames. If set to the string "same" (the
  14923. default), the input format will be kept. Note that automatic format negotiation
  14924. and conversion is not yet supported for hardware frames
  14925. @item interp_algo
  14926. The interpolation algorithm used for resizing. One of the following:
  14927. @table @option
  14928. @item nn
  14929. Nearest neighbour.
  14930. @item linear
  14931. @item cubic
  14932. @item cubic2p_bspline
  14933. 2-parameter cubic (B=1, C=0)
  14934. @item cubic2p_catmullrom
  14935. 2-parameter cubic (B=0, C=1/2)
  14936. @item cubic2p_b05c03
  14937. 2-parameter cubic (B=1/2, C=3/10)
  14938. @item super
  14939. Supersampling
  14940. @item lanczos
  14941. @end table
  14942. @item force_original_aspect_ratio
  14943. Enable decreasing or increasing output video width or height if necessary to
  14944. keep the original aspect ratio. Possible values:
  14945. @table @samp
  14946. @item disable
  14947. Scale the video as specified and disable this feature.
  14948. @item decrease
  14949. The output video dimensions will automatically be decreased if needed.
  14950. @item increase
  14951. The output video dimensions will automatically be increased if needed.
  14952. @end table
  14953. One useful instance of this option is that when you know a specific device's
  14954. maximum allowed resolution, you can use this to limit the output video to
  14955. that, while retaining the aspect ratio. For example, device A allows
  14956. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  14957. decrease) and specifying 1280x720 to the command line makes the output
  14958. 1280x533.
  14959. Please note that this is a different thing than specifying -1 for @option{w}
  14960. or @option{h}, you still need to specify the output resolution for this option
  14961. to work.
  14962. @item force_divisible_by
  14963. Ensures that both the output dimensions, width and height, are divisible by the
  14964. given integer when used together with @option{force_original_aspect_ratio}. This
  14965. works similar to using @code{-n} in the @option{w} and @option{h} options.
  14966. This option respects the value set for @option{force_original_aspect_ratio},
  14967. increasing or decreasing the resolution accordingly. The video's aspect ratio
  14968. may be slightly modified.
  14969. This option can be handy if you need to have a video fit within or exceed
  14970. a defined resolution using @option{force_original_aspect_ratio} but also have
  14971. encoder restrictions on width or height divisibility.
  14972. @item eval
  14973. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  14974. @table @samp
  14975. @item init
  14976. Only evaluate expressions once during the filter initialization or when a command is processed.
  14977. @item frame
  14978. Evaluate expressions for each incoming frame.
  14979. @end table
  14980. @end table
  14981. The values of the @option{w} and @option{h} options are expressions
  14982. containing the following constants:
  14983. @table @var
  14984. @item in_w
  14985. @item in_h
  14986. The input width and height
  14987. @item iw
  14988. @item ih
  14989. These are the same as @var{in_w} and @var{in_h}.
  14990. @item out_w
  14991. @item out_h
  14992. The output (scaled) width and height
  14993. @item ow
  14994. @item oh
  14995. These are the same as @var{out_w} and @var{out_h}
  14996. @item a
  14997. The same as @var{iw} / @var{ih}
  14998. @item sar
  14999. input sample aspect ratio
  15000. @item dar
  15001. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  15002. @item n
  15003. The (sequential) number of the input frame, starting from 0.
  15004. Only available with @code{eval=frame}.
  15005. @item t
  15006. The presentation timestamp of the input frame, expressed as a number of
  15007. seconds. Only available with @code{eval=frame}.
  15008. @item pos
  15009. The position (byte offset) of the frame in the input stream, or NaN if
  15010. this information is unavailable and/or meaningless (for example in case of synthetic video).
  15011. Only available with @code{eval=frame}.
  15012. @end table
  15013. @section scale2ref
  15014. Scale (resize) the input video, based on a reference video.
  15015. See the scale filter for available options, scale2ref supports the same but
  15016. uses the reference video instead of the main input as basis. scale2ref also
  15017. supports the following additional constants for the @option{w} and
  15018. @option{h} options:
  15019. @table @var
  15020. @item main_w
  15021. @item main_h
  15022. The main input video's width and height
  15023. @item main_a
  15024. The same as @var{main_w} / @var{main_h}
  15025. @item main_sar
  15026. The main input video's sample aspect ratio
  15027. @item main_dar, mdar
  15028. The main input video's display aspect ratio. Calculated from
  15029. @code{(main_w / main_h) * main_sar}.
  15030. @item main_hsub
  15031. @item main_vsub
  15032. The main input video's horizontal and vertical chroma subsample values.
  15033. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  15034. is 1.
  15035. @item main_n
  15036. The (sequential) number of the main input frame, starting from 0.
  15037. Only available with @code{eval=frame}.
  15038. @item main_t
  15039. The presentation timestamp of the main input frame, expressed as a number of
  15040. seconds. Only available with @code{eval=frame}.
  15041. @item main_pos
  15042. The position (byte offset) of the frame in the main input stream, or NaN if
  15043. this information is unavailable and/or meaningless (for example in case of synthetic video).
  15044. Only available with @code{eval=frame}.
  15045. @end table
  15046. @subsection Examples
  15047. @itemize
  15048. @item
  15049. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  15050. @example
  15051. 'scale2ref[b][a];[a][b]overlay'
  15052. @end example
  15053. @item
  15054. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  15055. @example
  15056. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  15057. @end example
  15058. @end itemize
  15059. @subsection Commands
  15060. This filter supports the following commands:
  15061. @table @option
  15062. @item width, w
  15063. @item height, h
  15064. Set the output video dimension expression.
  15065. The command accepts the same syntax of the corresponding option.
  15066. If the specified expression is not valid, it is kept at its current
  15067. value.
  15068. @end table
  15069. @section scale2ref_npp
  15070. Use the NVIDIA Performance Primitives (libnpp) to scale (resize) the input
  15071. video, based on a reference video.
  15072. See the @ref{scale_npp} filter for available options, scale2ref_npp supports the same
  15073. but uses the reference video instead of the main input as basis. scale2ref_npp
  15074. also supports the following additional constants for the @option{w} and
  15075. @option{h} options:
  15076. @table @var
  15077. @item main_w
  15078. @item main_h
  15079. The main input video's width and height
  15080. @item main_a
  15081. The same as @var{main_w} / @var{main_h}
  15082. @item main_sar
  15083. The main input video's sample aspect ratio
  15084. @item main_dar, mdar
  15085. The main input video's display aspect ratio. Calculated from
  15086. @code{(main_w / main_h) * main_sar}.
  15087. @item main_n
  15088. The (sequential) number of the main input frame, starting from 0.
  15089. Only available with @code{eval=frame}.
  15090. @item main_t
  15091. The presentation timestamp of the main input frame, expressed as a number of
  15092. seconds. Only available with @code{eval=frame}.
  15093. @item main_pos
  15094. The position (byte offset) of the frame in the main input stream, or NaN if
  15095. this information is unavailable and/or meaningless (for example in case of synthetic video).
  15096. Only available with @code{eval=frame}.
  15097. @end table
  15098. @subsection Examples
  15099. @itemize
  15100. @item
  15101. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  15102. @example
  15103. 'scale2ref_npp[b][a];[a][b]overlay_cuda'
  15104. @end example
  15105. @item
  15106. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  15107. @example
  15108. [logo-in][video-in]scale2ref_npp=w=oh*mdar:h=ih/10[logo-out][video-out]
  15109. @end example
  15110. @end itemize
  15111. @section scharr
  15112. Apply scharr operator to input video stream.
  15113. The filter accepts the following option:
  15114. @table @option
  15115. @item planes
  15116. Set which planes will be processed, unprocessed planes will be copied.
  15117. By default value 0xf, all planes will be processed.
  15118. @item scale
  15119. Set value which will be multiplied with filtered result.
  15120. @item delta
  15121. Set value which will be added to filtered result.
  15122. @end table
  15123. @subsection Commands
  15124. This filter supports the all above options as @ref{commands}.
  15125. @section scroll
  15126. Scroll input video horizontally and/or vertically by constant speed.
  15127. The filter accepts the following options:
  15128. @table @option
  15129. @item horizontal, h
  15130. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  15131. Negative values changes scrolling direction.
  15132. @item vertical, v
  15133. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  15134. Negative values changes scrolling direction.
  15135. @item hpos
  15136. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  15137. @item vpos
  15138. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  15139. @end table
  15140. @subsection Commands
  15141. This filter supports the following @ref{commands}:
  15142. @table @option
  15143. @item horizontal, h
  15144. Set the horizontal scrolling speed.
  15145. @item vertical, v
  15146. Set the vertical scrolling speed.
  15147. @end table
  15148. @anchor{scdet}
  15149. @section scdet
  15150. Detect video scene change.
  15151. This filter sets frame metadata with mafd between frame, the scene score, and
  15152. forward the frame to the next filter, so they can use these metadata to detect
  15153. scene change or others.
  15154. In addition, this filter logs a message and sets frame metadata when it detects
  15155. a scene change by @option{threshold}.
  15156. @code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
  15157. @code{lavfi.scd.score} metadata keys are set with scene change score for every frame
  15158. to detect scene change.
  15159. @code{lavfi.scd.time} metadata keys are set with current filtered frame time which
  15160. detect scene change with @option{threshold}.
  15161. The filter accepts the following options:
  15162. @table @option
  15163. @item threshold, t
  15164. Set the scene change detection threshold as a percentage of maximum change. Good
  15165. values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} is
  15166. @code{[0., 100.]}.
  15167. Default value is @code{10.}.
  15168. @item sc_pass, s
  15169. Set the flag to pass scene change frames to the next filter. Default value is @code{0}
  15170. You can enable it if you want to get snapshot of scene change frames only.
  15171. @end table
  15172. @anchor{selectivecolor}
  15173. @section selectivecolor
  15174. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  15175. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  15176. by the "purity" of the color (that is, how saturated it already is).
  15177. This filter is similar to the Adobe Photoshop Selective Color tool.
  15178. The filter accepts the following options:
  15179. @table @option
  15180. @item correction_method
  15181. Select color correction method.
  15182. Available values are:
  15183. @table @samp
  15184. @item absolute
  15185. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  15186. component value).
  15187. @item relative
  15188. Specified adjustments are relative to the original component value.
  15189. @end table
  15190. Default is @code{absolute}.
  15191. @item reds
  15192. Adjustments for red pixels (pixels where the red component is the maximum)
  15193. @item yellows
  15194. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  15195. @item greens
  15196. Adjustments for green pixels (pixels where the green component is the maximum)
  15197. @item cyans
  15198. Adjustments for cyan pixels (pixels where the red component is the minimum)
  15199. @item blues
  15200. Adjustments for blue pixels (pixels where the blue component is the maximum)
  15201. @item magentas
  15202. Adjustments for magenta pixels (pixels where the green component is the minimum)
  15203. @item whites
  15204. Adjustments for white pixels (pixels where all components are greater than 128)
  15205. @item neutrals
  15206. Adjustments for all pixels except pure black and pure white
  15207. @item blacks
  15208. Adjustments for black pixels (pixels where all components are lesser than 128)
  15209. @item psfile
  15210. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  15211. @end table
  15212. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  15213. 4 space separated floating point adjustment values in the [-1,1] range,
  15214. respectively to adjust the amount of cyan, magenta, yellow and black for the
  15215. pixels of its range.
  15216. @subsection Examples
  15217. @itemize
  15218. @item
  15219. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  15220. increase magenta by 27% in blue areas:
  15221. @example
  15222. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  15223. @end example
  15224. @item
  15225. Use a Photoshop selective color preset:
  15226. @example
  15227. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  15228. @end example
  15229. @end itemize
  15230. @anchor{separatefields}
  15231. @section separatefields
  15232. The @code{separatefields} takes a frame-based video input and splits
  15233. each frame into its components fields, producing a new half height clip
  15234. with twice the frame rate and twice the frame count.
  15235. This filter use field-dominance information in frame to decide which
  15236. of each pair of fields to place first in the output.
  15237. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  15238. @section setdar, setsar
  15239. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  15240. output video.
  15241. This is done by changing the specified Sample (aka Pixel) Aspect
  15242. Ratio, according to the following equation:
  15243. @example
  15244. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  15245. @end example
  15246. Keep in mind that the @code{setdar} filter does not modify the pixel
  15247. dimensions of the video frame. Also, the display aspect ratio set by
  15248. this filter may be changed by later filters in the filterchain,
  15249. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  15250. applied.
  15251. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  15252. the filter output video.
  15253. Note that as a consequence of the application of this filter, the
  15254. output display aspect ratio will change according to the equation
  15255. above.
  15256. Keep in mind that the sample aspect ratio set by the @code{setsar}
  15257. filter may be changed by later filters in the filterchain, e.g. if
  15258. another "setsar" or a "setdar" filter is applied.
  15259. It accepts the following parameters:
  15260. @table @option
  15261. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  15262. Set the aspect ratio used by the filter.
  15263. The parameter can be a floating point number string, an expression, or
  15264. a string of the form @var{num}:@var{den}, where @var{num} and
  15265. @var{den} are the numerator and denominator of the aspect ratio. If
  15266. the parameter is not specified, it is assumed the value "0".
  15267. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  15268. should be escaped.
  15269. @item max
  15270. Set the maximum integer value to use for expressing numerator and
  15271. denominator when reducing the expressed aspect ratio to a rational.
  15272. Default value is @code{100}.
  15273. @end table
  15274. The parameter @var{sar} is an expression containing
  15275. the following constants:
  15276. @table @option
  15277. @item E, PI, PHI
  15278. These are approximated values for the mathematical constants e
  15279. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  15280. @item w, h
  15281. The input width and height.
  15282. @item a
  15283. These are the same as @var{w} / @var{h}.
  15284. @item sar
  15285. The input sample aspect ratio.
  15286. @item dar
  15287. The input display aspect ratio. It is the same as
  15288. (@var{w} / @var{h}) * @var{sar}.
  15289. @item hsub, vsub
  15290. Horizontal and vertical chroma subsample values. For example, for the
  15291. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15292. @end table
  15293. @subsection Examples
  15294. @itemize
  15295. @item
  15296. To change the display aspect ratio to 16:9, specify one of the following:
  15297. @example
  15298. setdar=dar=1.77777
  15299. setdar=dar=16/9
  15300. @end example
  15301. @item
  15302. To change the sample aspect ratio to 10:11, specify:
  15303. @example
  15304. setsar=sar=10/11
  15305. @end example
  15306. @item
  15307. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  15308. 1000 in the aspect ratio reduction, use the command:
  15309. @example
  15310. setdar=ratio=16/9:max=1000
  15311. @end example
  15312. @end itemize
  15313. @anchor{setfield}
  15314. @section setfield
  15315. Force field for the output video frame.
  15316. The @code{setfield} filter marks the interlace type field for the
  15317. output frames. It does not change the input frame, but only sets the
  15318. corresponding property, which affects how the frame is treated by
  15319. following filters (e.g. @code{fieldorder} or @code{yadif}).
  15320. The filter accepts the following options:
  15321. @table @option
  15322. @item mode
  15323. Available values are:
  15324. @table @samp
  15325. @item auto
  15326. Keep the same field property.
  15327. @item bff
  15328. Mark the frame as bottom-field-first.
  15329. @item tff
  15330. Mark the frame as top-field-first.
  15331. @item prog
  15332. Mark the frame as progressive.
  15333. @end table
  15334. @end table
  15335. @anchor{setparams}
  15336. @section setparams
  15337. Force frame parameter for the output video frame.
  15338. The @code{setparams} filter marks interlace and color range for the
  15339. output frames. It does not change the input frame, but only sets the
  15340. corresponding property, which affects how the frame is treated by
  15341. filters/encoders.
  15342. @table @option
  15343. @item field_mode
  15344. Available values are:
  15345. @table @samp
  15346. @item auto
  15347. Keep the same field property (default).
  15348. @item bff
  15349. Mark the frame as bottom-field-first.
  15350. @item tff
  15351. Mark the frame as top-field-first.
  15352. @item prog
  15353. Mark the frame as progressive.
  15354. @end table
  15355. @item range
  15356. Available values are:
  15357. @table @samp
  15358. @item auto
  15359. Keep the same color range property (default).
  15360. @item unspecified, unknown
  15361. Mark the frame as unspecified color range.
  15362. @item limited, tv, mpeg
  15363. Mark the frame as limited range.
  15364. @item full, pc, jpeg
  15365. Mark the frame as full range.
  15366. @end table
  15367. @item color_primaries
  15368. Set the color primaries.
  15369. Available values are:
  15370. @table @samp
  15371. @item auto
  15372. Keep the same color primaries property (default).
  15373. @item bt709
  15374. @item unknown
  15375. @item bt470m
  15376. @item bt470bg
  15377. @item smpte170m
  15378. @item smpte240m
  15379. @item film
  15380. @item bt2020
  15381. @item smpte428
  15382. @item smpte431
  15383. @item smpte432
  15384. @item jedec-p22
  15385. @end table
  15386. @item color_trc
  15387. Set the color transfer.
  15388. Available values are:
  15389. @table @samp
  15390. @item auto
  15391. Keep the same color trc property (default).
  15392. @item bt709
  15393. @item unknown
  15394. @item bt470m
  15395. @item bt470bg
  15396. @item smpte170m
  15397. @item smpte240m
  15398. @item linear
  15399. @item log100
  15400. @item log316
  15401. @item iec61966-2-4
  15402. @item bt1361e
  15403. @item iec61966-2-1
  15404. @item bt2020-10
  15405. @item bt2020-12
  15406. @item smpte2084
  15407. @item smpte428
  15408. @item arib-std-b67
  15409. @end table
  15410. @item colorspace
  15411. Set the colorspace.
  15412. Available values are:
  15413. @table @samp
  15414. @item auto
  15415. Keep the same colorspace property (default).
  15416. @item gbr
  15417. @item bt709
  15418. @item unknown
  15419. @item fcc
  15420. @item bt470bg
  15421. @item smpte170m
  15422. @item smpte240m
  15423. @item ycgco
  15424. @item bt2020nc
  15425. @item bt2020c
  15426. @item smpte2085
  15427. @item chroma-derived-nc
  15428. @item chroma-derived-c
  15429. @item ictcp
  15430. @end table
  15431. @end table
  15432. @section sharpen_npp
  15433. Use the NVIDIA Performance Primitives (libnpp) to perform image sharpening with
  15434. border control.
  15435. The following additional options are accepted:
  15436. @table @option
  15437. @item border_type
  15438. Type of sampling to be used ad frame borders. One of the following:
  15439. @table @option
  15440. @item replicate
  15441. Replicate pixel values.
  15442. @end table
  15443. @end table
  15444. @section shear
  15445. Apply shear transform to input video.
  15446. This filter supports the following options:
  15447. @table @option
  15448. @item shx
  15449. Shear factor in X-direction. Default value is 0.
  15450. Allowed range is from -2 to 2.
  15451. @item shy
  15452. Shear factor in Y-direction. Default value is 0.
  15453. Allowed range is from -2 to 2.
  15454. @item fillcolor, c
  15455. Set the color used to fill the output area not covered by the transformed
  15456. video. For the general syntax of this option, check the
  15457. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15458. If the special value "none" is selected then no
  15459. background is printed (useful for example if the background is never shown).
  15460. Default value is "black".
  15461. @item interp
  15462. Set interpolation type. Can be @code{bilinear} or @code{nearest}. Default is @code{bilinear}.
  15463. @end table
  15464. @subsection Commands
  15465. This filter supports the all above options as @ref{commands}.
  15466. @section showinfo
  15467. Show a line containing various information for each input video frame.
  15468. The input video is not modified.
  15469. This filter supports the following options:
  15470. @table @option
  15471. @item checksum
  15472. Calculate checksums of each plane. By default enabled.
  15473. @end table
  15474. The shown line contains a sequence of key/value pairs of the form
  15475. @var{key}:@var{value}.
  15476. The following values are shown in the output:
  15477. @table @option
  15478. @item n
  15479. The (sequential) number of the input frame, starting from 0.
  15480. @item pts
  15481. The Presentation TimeStamp of the input frame, expressed as a number of
  15482. time base units. The time base unit depends on the filter input pad.
  15483. @item pts_time
  15484. The Presentation TimeStamp of the input frame, expressed as a number of
  15485. seconds.
  15486. @item pos
  15487. The position of the frame in the input stream, or -1 if this information is
  15488. unavailable and/or meaningless (for example in case of synthetic video).
  15489. @item fmt
  15490. The pixel format name.
  15491. @item sar
  15492. The sample aspect ratio of the input frame, expressed in the form
  15493. @var{num}/@var{den}.
  15494. @item s
  15495. The size of the input frame. For the syntax of this option, check the
  15496. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15497. @item i
  15498. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  15499. for bottom field first).
  15500. @item iskey
  15501. This is 1 if the frame is a key frame, 0 otherwise.
  15502. @item type
  15503. The picture type of the input frame ("I" for an I-frame, "P" for a
  15504. P-frame, "B" for a B-frame, or "?" for an unknown type).
  15505. Also refer to the documentation of the @code{AVPictureType} enum and of
  15506. the @code{av_get_picture_type_char} function defined in
  15507. @file{libavutil/avutil.h}.
  15508. @item checksum
  15509. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  15510. @item plane_checksum
  15511. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  15512. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  15513. @item mean
  15514. The mean value of pixels in each plane of the input frame, expressed in the form
  15515. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  15516. @item stdev
  15517. The standard deviation of pixel values in each plane of the input frame, expressed
  15518. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  15519. @end table
  15520. @section showpalette
  15521. Displays the 256 colors palette of each frame. This filter is only relevant for
  15522. @var{pal8} pixel format frames.
  15523. It accepts the following option:
  15524. @table @option
  15525. @item s
  15526. Set the size of the box used to represent one palette color entry. Default is
  15527. @code{30} (for a @code{30x30} pixel box).
  15528. @end table
  15529. @section shuffleframes
  15530. Reorder and/or duplicate and/or drop video frames.
  15531. It accepts the following parameters:
  15532. @table @option
  15533. @item mapping
  15534. Set the destination indexes of input frames.
  15535. This is space or '|' separated list of indexes that maps input frames to output
  15536. frames. Number of indexes also sets maximal value that each index may have.
  15537. '-1' index have special meaning and that is to drop frame.
  15538. @end table
  15539. The first frame has the index 0. The default is to keep the input unchanged.
  15540. @subsection Examples
  15541. @itemize
  15542. @item
  15543. Swap second and third frame of every three frames of the input:
  15544. @example
  15545. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  15546. @end example
  15547. @item
  15548. Swap 10th and 1st frame of every ten frames of the input:
  15549. @example
  15550. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  15551. @end example
  15552. @end itemize
  15553. @section shufflepixels
  15554. Reorder pixels in video frames.
  15555. This filter accepts the following options:
  15556. @table @option
  15557. @item direction, d
  15558. Set shuffle direction. Can be forward or inverse direction.
  15559. Default direction is forward.
  15560. @item mode, m
  15561. Set shuffle mode. Can be horizontal, vertical or block mode.
  15562. @item width, w
  15563. @item height, h
  15564. Set shuffle block_size. In case of horizontal shuffle mode only width
  15565. part of size is used, and in case of vertical shuffle mode only height
  15566. part of size is used.
  15567. @item seed, s
  15568. Set random seed used with shuffling pixels. Mainly useful to set to be able
  15569. to reverse filtering process to get original input.
  15570. For example, to reverse forward shuffle you need to use same parameters
  15571. and exact same seed and to set direction to inverse.
  15572. @end table
  15573. @section shuffleplanes
  15574. Reorder and/or duplicate video planes.
  15575. It accepts the following parameters:
  15576. @table @option
  15577. @item map0
  15578. The index of the input plane to be used as the first output plane.
  15579. @item map1
  15580. The index of the input plane to be used as the second output plane.
  15581. @item map2
  15582. The index of the input plane to be used as the third output plane.
  15583. @item map3
  15584. The index of the input plane to be used as the fourth output plane.
  15585. @end table
  15586. The first plane has the index 0. The default is to keep the input unchanged.
  15587. @subsection Examples
  15588. @itemize
  15589. @item
  15590. Swap the second and third planes of the input:
  15591. @example
  15592. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  15593. @end example
  15594. @end itemize
  15595. @anchor{signalstats}
  15596. @section signalstats
  15597. Evaluate various visual metrics that assist in determining issues associated
  15598. with the digitization of analog video media.
  15599. By default the filter will log these metadata values:
  15600. @table @option
  15601. @item YMIN
  15602. Display the minimal Y value contained within the input frame. Expressed in
  15603. range of [0-255].
  15604. @item YLOW
  15605. Display the Y value at the 10% percentile within the input frame. Expressed in
  15606. range of [0-255].
  15607. @item YAVG
  15608. Display the average Y value within the input frame. Expressed in range of
  15609. [0-255].
  15610. @item YHIGH
  15611. Display the Y value at the 90% percentile within the input frame. Expressed in
  15612. range of [0-255].
  15613. @item YMAX
  15614. Display the maximum Y value contained within the input frame. Expressed in
  15615. range of [0-255].
  15616. @item UMIN
  15617. Display the minimal U value contained within the input frame. Expressed in
  15618. range of [0-255].
  15619. @item ULOW
  15620. Display the U value at the 10% percentile within the input frame. Expressed in
  15621. range of [0-255].
  15622. @item UAVG
  15623. Display the average U value within the input frame. Expressed in range of
  15624. [0-255].
  15625. @item UHIGH
  15626. Display the U value at the 90% percentile within the input frame. Expressed in
  15627. range of [0-255].
  15628. @item UMAX
  15629. Display the maximum U value contained within the input frame. Expressed in
  15630. range of [0-255].
  15631. @item VMIN
  15632. Display the minimal V value contained within the input frame. Expressed in
  15633. range of [0-255].
  15634. @item VLOW
  15635. Display the V value at the 10% percentile within the input frame. Expressed in
  15636. range of [0-255].
  15637. @item VAVG
  15638. Display the average V value within the input frame. Expressed in range of
  15639. [0-255].
  15640. @item VHIGH
  15641. Display the V value at the 90% percentile within the input frame. Expressed in
  15642. range of [0-255].
  15643. @item VMAX
  15644. Display the maximum V value contained within the input frame. Expressed in
  15645. range of [0-255].
  15646. @item SATMIN
  15647. Display the minimal saturation value contained within the input frame.
  15648. Expressed in range of [0-~181.02].
  15649. @item SATLOW
  15650. Display the saturation value at the 10% percentile within the input frame.
  15651. Expressed in range of [0-~181.02].
  15652. @item SATAVG
  15653. Display the average saturation value within the input frame. Expressed in range
  15654. of [0-~181.02].
  15655. @item SATHIGH
  15656. Display the saturation value at the 90% percentile within the input frame.
  15657. Expressed in range of [0-~181.02].
  15658. @item SATMAX
  15659. Display the maximum saturation value contained within the input frame.
  15660. Expressed in range of [0-~181.02].
  15661. @item HUEMED
  15662. Display the median value for hue within the input frame. Expressed in range of
  15663. [0-360].
  15664. @item HUEAVG
  15665. Display the average value for hue within the input frame. Expressed in range of
  15666. [0-360].
  15667. @item YDIF
  15668. Display the average of sample value difference between all values of the Y
  15669. plane in the current frame and corresponding values of the previous input frame.
  15670. Expressed in range of [0-255].
  15671. @item UDIF
  15672. Display the average of sample value difference between all values of the U
  15673. plane in the current frame and corresponding values of the previous input frame.
  15674. Expressed in range of [0-255].
  15675. @item VDIF
  15676. Display the average of sample value difference between all values of the V
  15677. plane in the current frame and corresponding values of the previous input frame.
  15678. Expressed in range of [0-255].
  15679. @item YBITDEPTH
  15680. Display bit depth of Y plane in current frame.
  15681. Expressed in range of [0-16].
  15682. @item UBITDEPTH
  15683. Display bit depth of U plane in current frame.
  15684. Expressed in range of [0-16].
  15685. @item VBITDEPTH
  15686. Display bit depth of V plane in current frame.
  15687. Expressed in range of [0-16].
  15688. @end table
  15689. The filter accepts the following options:
  15690. @table @option
  15691. @item stat
  15692. @item out
  15693. @option{stat} specify an additional form of image analysis.
  15694. @option{out} output video with the specified type of pixel highlighted.
  15695. Both options accept the following values:
  15696. @table @samp
  15697. @item tout
  15698. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  15699. unlike the neighboring pixels of the same field. Examples of temporal outliers
  15700. include the results of video dropouts, head clogs, or tape tracking issues.
  15701. @item vrep
  15702. Identify @var{vertical line repetition}. Vertical line repetition includes
  15703. similar rows of pixels within a frame. In born-digital video vertical line
  15704. repetition is common, but this pattern is uncommon in video digitized from an
  15705. analog source. When it occurs in video that results from the digitization of an
  15706. analog source it can indicate concealment from a dropout compensator.
  15707. @item brng
  15708. Identify pixels that fall outside of legal broadcast range.
  15709. @end table
  15710. @item color, c
  15711. Set the highlight color for the @option{out} option. The default color is
  15712. yellow.
  15713. @end table
  15714. @subsection Examples
  15715. @itemize
  15716. @item
  15717. Output data of various video metrics:
  15718. @example
  15719. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  15720. @end example
  15721. @item
  15722. Output specific data about the minimum and maximum values of the Y plane per frame:
  15723. @example
  15724. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  15725. @end example
  15726. @item
  15727. Playback video while highlighting pixels that are outside of broadcast range in red.
  15728. @example
  15729. ffplay example.mov -vf signalstats="out=brng:color=red"
  15730. @end example
  15731. @item
  15732. Playback video with signalstats metadata drawn over the frame.
  15733. @example
  15734. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  15735. @end example
  15736. The contents of signalstat_drawtext.txt used in the command are:
  15737. @example
  15738. time %@{pts:hms@}
  15739. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  15740. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  15741. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  15742. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  15743. @end example
  15744. @end itemize
  15745. @anchor{signature}
  15746. @section signature
  15747. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  15748. input. In this case the matching between the inputs can be calculated additionally.
  15749. The filter always passes through the first input. The signature of each stream can
  15750. be written into a file.
  15751. It accepts the following options:
  15752. @table @option
  15753. @item detectmode
  15754. Enable or disable the matching process.
  15755. Available values are:
  15756. @table @samp
  15757. @item off
  15758. Disable the calculation of a matching (default).
  15759. @item full
  15760. Calculate the matching for the whole video and output whether the whole video
  15761. matches or only parts.
  15762. @item fast
  15763. Calculate only until a matching is found or the video ends. Should be faster in
  15764. some cases.
  15765. @end table
  15766. @item nb_inputs
  15767. Set the number of inputs. The option value must be a non negative integer.
  15768. Default value is 1.
  15769. @item filename
  15770. Set the path to which the output is written. If there is more than one input,
  15771. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  15772. integer), that will be replaced with the input number. If no filename is
  15773. specified, no output will be written. This is the default.
  15774. @item format
  15775. Choose the output format.
  15776. Available values are:
  15777. @table @samp
  15778. @item binary
  15779. Use the specified binary representation (default).
  15780. @item xml
  15781. Use the specified xml representation.
  15782. @end table
  15783. @item th_d
  15784. Set threshold to detect one word as similar. The option value must be an integer
  15785. greater than zero. The default value is 9000.
  15786. @item th_dc
  15787. Set threshold to detect all words as similar. The option value must be an integer
  15788. greater than zero. The default value is 60000.
  15789. @item th_xh
  15790. Set threshold to detect frames as similar. The option value must be an integer
  15791. greater than zero. The default value is 116.
  15792. @item th_di
  15793. Set the minimum length of a sequence in frames to recognize it as matching
  15794. sequence. The option value must be a non negative integer value.
  15795. The default value is 0.
  15796. @item th_it
  15797. Set the minimum relation, that matching frames to all frames must have.
  15798. The option value must be a double value between 0 and 1. The default value is 0.5.
  15799. @end table
  15800. @subsection Examples
  15801. @itemize
  15802. @item
  15803. To calculate the signature of an input video and store it in signature.bin:
  15804. @example
  15805. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  15806. @end example
  15807. @item
  15808. To detect whether two videos match and store the signatures in XML format in
  15809. signature0.xml and signature1.xml:
  15810. @example
  15811. 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 -
  15812. @end example
  15813. @end itemize
  15814. @anchor{siti}
  15815. @section siti
  15816. Calculate Spatial Info (SI) and Temporal Info (TI) scores for a video, as defined
  15817. in ITU-T P.910: Subjective video quality assessment methods for multimedia
  15818. applications. Available PDF at @url{https://www.itu.int/rec/T-REC-P.910-199909-S/en }.
  15819. It accepts the following option:
  15820. @table @option
  15821. @item print_summary
  15822. If set to 1, Summary statistics will be printed to the console. Default 0.
  15823. @end table
  15824. @subsection Examples
  15825. @itemize
  15826. @item
  15827. To calculate SI/TI metrics and print summary:
  15828. @example
  15829. ffmpeg -i input.mp4 -vf siti=print_summary=1 -f null -
  15830. @end example
  15831. @end itemize
  15832. @anchor{smartblur}
  15833. @section smartblur
  15834. Blur the input video without impacting the outlines.
  15835. It accepts the following options:
  15836. @table @option
  15837. @item luma_radius, lr
  15838. Set the luma radius. The option value must be a float number in
  15839. the range [0.1,5.0] that specifies the variance of the gaussian filter
  15840. used to blur the image (slower if larger). Default value is 1.0.
  15841. @item luma_strength, ls
  15842. Set the luma strength. The option value must be a float number
  15843. in the range [-1.0,1.0] that configures the blurring. A value included
  15844. in [0.0,1.0] will blur the image whereas a value included in
  15845. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  15846. @item luma_threshold, lt
  15847. Set the luma threshold used as a coefficient to determine
  15848. whether a pixel should be blurred or not. The option value must be an
  15849. integer in the range [-30,30]. A value of 0 will filter all the image,
  15850. a value included in [0,30] will filter flat areas and a value included
  15851. in [-30,0] will filter edges. Default value is 0.
  15852. @item chroma_radius, cr
  15853. Set the chroma radius. The option value must be a float number in
  15854. the range [0.1,5.0] that specifies the variance of the gaussian filter
  15855. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  15856. @item chroma_strength, cs
  15857. Set the chroma strength. The option value must be a float number
  15858. in the range [-1.0,1.0] that configures the blurring. A value included
  15859. in [0.0,1.0] will blur the image whereas a value included in
  15860. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  15861. @item chroma_threshold, ct
  15862. Set the chroma threshold used as a coefficient to determine
  15863. whether a pixel should be blurred or not. The option value must be an
  15864. integer in the range [-30,30]. A value of 0 will filter all the image,
  15865. a value included in [0,30] will filter flat areas and a value included
  15866. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  15867. @end table
  15868. If a chroma option is not explicitly set, the corresponding luma value
  15869. is set.
  15870. @section sobel
  15871. Apply sobel operator to input video stream.
  15872. The filter accepts the following option:
  15873. @table @option
  15874. @item planes
  15875. Set which planes will be processed, unprocessed planes will be copied.
  15876. By default value 0xf, all planes will be processed.
  15877. @item scale
  15878. Set value which will be multiplied with filtered result.
  15879. @item delta
  15880. Set value which will be added to filtered result.
  15881. @end table
  15882. @subsection Commands
  15883. This filter supports the all above options as @ref{commands}.
  15884. @anchor{spp}
  15885. @section spp
  15886. Apply a simple postprocessing filter that compresses and decompresses the image
  15887. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  15888. and average the results.
  15889. The filter accepts the following options:
  15890. @table @option
  15891. @item quality
  15892. Set quality. This option defines the number of levels for averaging. It accepts
  15893. an integer in the range 0-6. If set to @code{0}, the filter will have no
  15894. effect. A value of @code{6} means the higher quality. For each increment of
  15895. that value the speed drops by a factor of approximately 2. Default value is
  15896. @code{3}.
  15897. @item qp
  15898. Force a constant quantization parameter. If not set, the filter will use the QP
  15899. from the video stream (if available).
  15900. @item mode
  15901. Set thresholding mode. Available modes are:
  15902. @table @samp
  15903. @item hard
  15904. Set hard thresholding (default).
  15905. @item soft
  15906. Set soft thresholding (better de-ringing effect, but likely blurrier).
  15907. @end table
  15908. @item use_bframe_qp
  15909. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  15910. option may cause flicker since the B-Frames have often larger QP. Default is
  15911. @code{0} (not enabled).
  15912. @end table
  15913. @subsection Commands
  15914. This filter supports the following commands:
  15915. @table @option
  15916. @item quality, level
  15917. Set quality level. The value @code{max} can be used to set the maximum level,
  15918. currently @code{6}.
  15919. @end table
  15920. @anchor{sr}
  15921. @section sr
  15922. Scale the input by applying one of the super-resolution methods based on
  15923. convolutional neural networks. Supported models:
  15924. @itemize
  15925. @item
  15926. Super-Resolution Convolutional Neural Network model (SRCNN).
  15927. See @url{https://arxiv.org/abs/1501.00092}.
  15928. @item
  15929. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  15930. See @url{https://arxiv.org/abs/1609.05158}.
  15931. @end itemize
  15932. Training scripts as well as scripts for model file (.pb) saving can be found at
  15933. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  15934. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  15935. Native model files (.model) can be generated from TensorFlow model
  15936. files (.pb) by using tools/python/convert.py
  15937. The filter accepts the following options:
  15938. @table @option
  15939. @item dnn_backend
  15940. Specify which DNN backend to use for model loading and execution. This option accepts
  15941. the following values:
  15942. @table @samp
  15943. @item native
  15944. Native implementation of DNN loading and execution.
  15945. @item tensorflow
  15946. TensorFlow backend. To enable this backend you
  15947. need to install the TensorFlow for C library (see
  15948. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  15949. @code{--enable-libtensorflow}
  15950. @end table
  15951. Default value is @samp{native}.
  15952. @item model
  15953. Set path to model file specifying network architecture and its parameters.
  15954. Note that different backends use different file formats. TensorFlow backend
  15955. can load files for both formats, while native backend can load files for only
  15956. its format.
  15957. @item scale_factor
  15958. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  15959. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  15960. input upscaled using bicubic upscaling with proper scale factor.
  15961. @end table
  15962. To get full functionality (such as async execution), please use the @ref{dnn_processing} filter.
  15963. @section ssim
  15964. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  15965. This filter takes in input two input videos, the first input is
  15966. considered the "main" source and is passed unchanged to the
  15967. output. The second input is used as a "reference" video for computing
  15968. the SSIM.
  15969. Both video inputs must have the same resolution and pixel format for
  15970. this filter to work correctly. Also it assumes that both inputs
  15971. have the same number of frames, which are compared one by one.
  15972. The filter stores the calculated SSIM of each frame.
  15973. The description of the accepted parameters follows.
  15974. @table @option
  15975. @item stats_file, f
  15976. If specified the filter will use the named file to save the SSIM of
  15977. each individual frame. When filename equals "-" the data is sent to
  15978. standard output.
  15979. @end table
  15980. The file printed if @var{stats_file} is selected, contains a sequence of
  15981. key/value pairs of the form @var{key}:@var{value} for each compared
  15982. couple of frames.
  15983. A description of each shown parameter follows:
  15984. @table @option
  15985. @item n
  15986. sequential number of the input frame, starting from 1
  15987. @item Y, U, V, R, G, B
  15988. SSIM of the compared frames for the component specified by the suffix.
  15989. @item All
  15990. SSIM of the compared frames for the whole frame.
  15991. @item dB
  15992. Same as above but in dB representation.
  15993. @end table
  15994. This filter also supports the @ref{framesync} options.
  15995. @subsection Examples
  15996. @itemize
  15997. @item
  15998. For example:
  15999. @example
  16000. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  16001. [main][ref] ssim="stats_file=stats.log" [out]
  16002. @end example
  16003. On this example the input file being processed is compared with the
  16004. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  16005. is stored in @file{stats.log}.
  16006. @item
  16007. Another example with both psnr and ssim at same time:
  16008. @example
  16009. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  16010. @end example
  16011. @item
  16012. Another example with different containers:
  16013. @example
  16014. 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 -
  16015. @end example
  16016. @end itemize
  16017. @section stereo3d
  16018. Convert between different stereoscopic image formats.
  16019. The filters accept the following options:
  16020. @table @option
  16021. @item in
  16022. Set stereoscopic image format of input.
  16023. Available values for input image formats are:
  16024. @table @samp
  16025. @item sbsl
  16026. side by side parallel (left eye left, right eye right)
  16027. @item sbsr
  16028. side by side crosseye (right eye left, left eye right)
  16029. @item sbs2l
  16030. side by side parallel with half width resolution
  16031. (left eye left, right eye right)
  16032. @item sbs2r
  16033. side by side crosseye with half width resolution
  16034. (right eye left, left eye right)
  16035. @item abl
  16036. @item tbl
  16037. above-below (left eye above, right eye below)
  16038. @item abr
  16039. @item tbr
  16040. above-below (right eye above, left eye below)
  16041. @item ab2l
  16042. @item tb2l
  16043. above-below with half height resolution
  16044. (left eye above, right eye below)
  16045. @item ab2r
  16046. @item tb2r
  16047. above-below with half height resolution
  16048. (right eye above, left eye below)
  16049. @item al
  16050. alternating frames (left eye first, right eye second)
  16051. @item ar
  16052. alternating frames (right eye first, left eye second)
  16053. @item irl
  16054. interleaved rows (left eye has top row, right eye starts on next row)
  16055. @item irr
  16056. interleaved rows (right eye has top row, left eye starts on next row)
  16057. @item icl
  16058. interleaved columns, left eye first
  16059. @item icr
  16060. interleaved columns, right eye first
  16061. Default value is @samp{sbsl}.
  16062. @end table
  16063. @item out
  16064. Set stereoscopic image format of output.
  16065. @table @samp
  16066. @item sbsl
  16067. side by side parallel (left eye left, right eye right)
  16068. @item sbsr
  16069. side by side crosseye (right eye left, left eye right)
  16070. @item sbs2l
  16071. side by side parallel with half width resolution
  16072. (left eye left, right eye right)
  16073. @item sbs2r
  16074. side by side crosseye with half width resolution
  16075. (right eye left, left eye right)
  16076. @item abl
  16077. @item tbl
  16078. above-below (left eye above, right eye below)
  16079. @item abr
  16080. @item tbr
  16081. above-below (right eye above, left eye below)
  16082. @item ab2l
  16083. @item tb2l
  16084. above-below with half height resolution
  16085. (left eye above, right eye below)
  16086. @item ab2r
  16087. @item tb2r
  16088. above-below with half height resolution
  16089. (right eye above, left eye below)
  16090. @item al
  16091. alternating frames (left eye first, right eye second)
  16092. @item ar
  16093. alternating frames (right eye first, left eye second)
  16094. @item irl
  16095. interleaved rows (left eye has top row, right eye starts on next row)
  16096. @item irr
  16097. interleaved rows (right eye has top row, left eye starts on next row)
  16098. @item arbg
  16099. anaglyph red/blue gray
  16100. (red filter on left eye, blue filter on right eye)
  16101. @item argg
  16102. anaglyph red/green gray
  16103. (red filter on left eye, green filter on right eye)
  16104. @item arcg
  16105. anaglyph red/cyan gray
  16106. (red filter on left eye, cyan filter on right eye)
  16107. @item arch
  16108. anaglyph red/cyan half colored
  16109. (red filter on left eye, cyan filter on right eye)
  16110. @item arcc
  16111. anaglyph red/cyan color
  16112. (red filter on left eye, cyan filter on right eye)
  16113. @item arcd
  16114. anaglyph red/cyan color optimized with the least squares projection of dubois
  16115. (red filter on left eye, cyan filter on right eye)
  16116. @item agmg
  16117. anaglyph green/magenta gray
  16118. (green filter on left eye, magenta filter on right eye)
  16119. @item agmh
  16120. anaglyph green/magenta half colored
  16121. (green filter on left eye, magenta filter on right eye)
  16122. @item agmc
  16123. anaglyph green/magenta colored
  16124. (green filter on left eye, magenta filter on right eye)
  16125. @item agmd
  16126. anaglyph green/magenta color optimized with the least squares projection of dubois
  16127. (green filter on left eye, magenta filter on right eye)
  16128. @item aybg
  16129. anaglyph yellow/blue gray
  16130. (yellow filter on left eye, blue filter on right eye)
  16131. @item aybh
  16132. anaglyph yellow/blue half colored
  16133. (yellow filter on left eye, blue filter on right eye)
  16134. @item aybc
  16135. anaglyph yellow/blue colored
  16136. (yellow filter on left eye, blue filter on right eye)
  16137. @item aybd
  16138. anaglyph yellow/blue color optimized with the least squares projection of dubois
  16139. (yellow filter on left eye, blue filter on right eye)
  16140. @item ml
  16141. mono output (left eye only)
  16142. @item mr
  16143. mono output (right eye only)
  16144. @item chl
  16145. checkerboard, left eye first
  16146. @item chr
  16147. checkerboard, right eye first
  16148. @item icl
  16149. interleaved columns, left eye first
  16150. @item icr
  16151. interleaved columns, right eye first
  16152. @item hdmi
  16153. HDMI frame pack
  16154. @end table
  16155. Default value is @samp{arcd}.
  16156. @end table
  16157. @subsection Examples
  16158. @itemize
  16159. @item
  16160. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  16161. @example
  16162. stereo3d=sbsl:aybd
  16163. @end example
  16164. @item
  16165. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  16166. @example
  16167. stereo3d=abl:sbsr
  16168. @end example
  16169. @end itemize
  16170. @section streamselect, astreamselect
  16171. Select video or audio streams.
  16172. The filter accepts the following options:
  16173. @table @option
  16174. @item inputs
  16175. Set number of inputs. Default is 2.
  16176. @item map
  16177. Set input indexes to remap to outputs.
  16178. @end table
  16179. @subsection Commands
  16180. The @code{streamselect} and @code{astreamselect} filter supports the following
  16181. commands:
  16182. @table @option
  16183. @item map
  16184. Set input indexes to remap to outputs.
  16185. @end table
  16186. @subsection Examples
  16187. @itemize
  16188. @item
  16189. Select first 5 seconds 1st stream and rest of time 2nd stream:
  16190. @example
  16191. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  16192. @end example
  16193. @item
  16194. Same as above, but for audio:
  16195. @example
  16196. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  16197. @end example
  16198. @end itemize
  16199. @anchor{subtitles}
  16200. @section subtitles
  16201. Draw subtitles on top of input video using the libass library.
  16202. To enable compilation of this filter you need to configure FFmpeg with
  16203. @code{--enable-libass}. This filter also requires a build with libavcodec and
  16204. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  16205. Alpha) subtitles format.
  16206. The filter accepts the following options:
  16207. @table @option
  16208. @item filename, f
  16209. Set the filename of the subtitle file to read. It must be specified.
  16210. @item original_size
  16211. Specify the size of the original video, the video for which the ASS file
  16212. was composed. For the syntax of this option, check the
  16213. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16214. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  16215. correctly scale the fonts if the aspect ratio has been changed.
  16216. @item fontsdir
  16217. Set a directory path containing fonts that can be used by the filter.
  16218. These fonts will be used in addition to whatever the font provider uses.
  16219. @item alpha
  16220. Process alpha channel, by default alpha channel is untouched.
  16221. @item charenc
  16222. Set subtitles input character encoding. @code{subtitles} filter only. Only
  16223. useful if not UTF-8.
  16224. @item stream_index, si
  16225. Set subtitles stream index. @code{subtitles} filter only.
  16226. @item force_style
  16227. Override default style or script info parameters of the subtitles. It accepts a
  16228. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  16229. @end table
  16230. If the first key is not specified, it is assumed that the first value
  16231. specifies the @option{filename}.
  16232. For example, to render the file @file{sub.srt} on top of the input
  16233. video, use the command:
  16234. @example
  16235. subtitles=sub.srt
  16236. @end example
  16237. which is equivalent to:
  16238. @example
  16239. subtitles=filename=sub.srt
  16240. @end example
  16241. To render the default subtitles stream from file @file{video.mkv}, use:
  16242. @example
  16243. subtitles=video.mkv
  16244. @end example
  16245. To render the second subtitles stream from that file, use:
  16246. @example
  16247. subtitles=video.mkv:si=1
  16248. @end example
  16249. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  16250. @code{DejaVu Serif}, use:
  16251. @example
  16252. subtitles=sub.srt:force_style='Fontname=DejaVu Serif,PrimaryColour=&HCCFF0000'
  16253. @end example
  16254. @section super2xsai
  16255. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  16256. Interpolate) pixel art scaling algorithm.
  16257. Useful for enlarging pixel art images without reducing sharpness.
  16258. @section swaprect
  16259. Swap two rectangular objects in video.
  16260. This filter accepts the following options:
  16261. @table @option
  16262. @item w
  16263. Set object width.
  16264. @item h
  16265. Set object height.
  16266. @item x1
  16267. Set 1st rect x coordinate.
  16268. @item y1
  16269. Set 1st rect y coordinate.
  16270. @item x2
  16271. Set 2nd rect x coordinate.
  16272. @item y2
  16273. Set 2nd rect y coordinate.
  16274. All expressions are evaluated once for each frame.
  16275. @end table
  16276. The all options are expressions containing the following constants:
  16277. @table @option
  16278. @item w
  16279. @item h
  16280. The input width and height.
  16281. @item a
  16282. same as @var{w} / @var{h}
  16283. @item sar
  16284. input sample aspect ratio
  16285. @item dar
  16286. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  16287. @item n
  16288. The number of the input frame, starting from 0.
  16289. @item t
  16290. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  16291. @item pos
  16292. the position in the file of the input frame, NAN if unknown
  16293. @end table
  16294. @subsection Commands
  16295. This filter supports the all above options as @ref{commands}.
  16296. @section swapuv
  16297. Swap U & V plane.
  16298. @section tblend
  16299. Blend successive video frames.
  16300. See @ref{blend}
  16301. @section telecine
  16302. Apply telecine process to the video.
  16303. This filter accepts the following options:
  16304. @table @option
  16305. @item first_field
  16306. @table @samp
  16307. @item top, t
  16308. top field first
  16309. @item bottom, b
  16310. bottom field first
  16311. The default value is @code{top}.
  16312. @end table
  16313. @item pattern
  16314. A string of numbers representing the pulldown pattern you wish to apply.
  16315. The default value is @code{23}.
  16316. @end table
  16317. @example
  16318. Some typical patterns:
  16319. NTSC output (30i):
  16320. 27.5p: 32222
  16321. 24p: 23 (classic)
  16322. 24p: 2332 (preferred)
  16323. 20p: 33
  16324. 18p: 334
  16325. 16p: 3444
  16326. PAL output (25i):
  16327. 27.5p: 12222
  16328. 24p: 222222222223 ("Euro pulldown")
  16329. 16.67p: 33
  16330. 16p: 33333334
  16331. @end example
  16332. @section thistogram
  16333. Compute and draw a color distribution histogram for the input video across time.
  16334. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  16335. at certain time, this filter shows also past histograms of number of frames defined
  16336. by @code{width} option.
  16337. The computed histogram is a representation of the color component
  16338. distribution in an image.
  16339. The filter accepts the following options:
  16340. @table @option
  16341. @item width, w
  16342. Set width of single color component output. Default value is @code{0}.
  16343. Value of @code{0} means width will be picked from input video.
  16344. This also set number of passed histograms to keep.
  16345. Allowed range is [0, 8192].
  16346. @item display_mode, d
  16347. Set display mode.
  16348. It accepts the following values:
  16349. @table @samp
  16350. @item stack
  16351. Per color component graphs are placed below each other.
  16352. @item parade
  16353. Per color component graphs are placed side by side.
  16354. @item overlay
  16355. Presents information identical to that in the @code{parade}, except
  16356. that the graphs representing color components are superimposed directly
  16357. over one another.
  16358. @end table
  16359. Default is @code{stack}.
  16360. @item levels_mode, m
  16361. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  16362. Default is @code{linear}.
  16363. @item components, c
  16364. Set what color components to display.
  16365. Default is @code{7}.
  16366. @item bgopacity, b
  16367. Set background opacity. Default is @code{0.9}.
  16368. @item envelope, e
  16369. Show envelope. Default is disabled.
  16370. @item ecolor, ec
  16371. Set envelope color. Default is @code{gold}.
  16372. @item slide
  16373. Set slide mode.
  16374. Available values for slide is:
  16375. @table @samp
  16376. @item frame
  16377. Draw new frame when right border is reached.
  16378. @item replace
  16379. Replace old columns with new ones.
  16380. @item scroll
  16381. Scroll from right to left.
  16382. @item rscroll
  16383. Scroll from left to right.
  16384. @item picture
  16385. Draw single picture.
  16386. @end table
  16387. Default is @code{replace}.
  16388. @end table
  16389. @section threshold
  16390. Apply threshold effect to video stream.
  16391. This filter needs four video streams to perform thresholding.
  16392. First stream is stream we are filtering.
  16393. Second stream is holding threshold values, third stream is holding min values,
  16394. and last, fourth stream is holding max values.
  16395. The filter accepts the following option:
  16396. @table @option
  16397. @item planes
  16398. Set which planes will be processed, unprocessed planes will be copied.
  16399. By default value 0xf, all planes will be processed.
  16400. @end table
  16401. For example if first stream pixel's component value is less then threshold value
  16402. of pixel component from 2nd threshold stream, third stream value will picked,
  16403. otherwise fourth stream pixel component value will be picked.
  16404. Using color source filter one can perform various types of thresholding:
  16405. @subsection Commands
  16406. This filter supports the all options as @ref{commands}.
  16407. @subsection Examples
  16408. @itemize
  16409. @item
  16410. Binary threshold, using gray color as threshold:
  16411. @example
  16412. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  16413. @end example
  16414. @item
  16415. Inverted binary threshold, using gray color as threshold:
  16416. @example
  16417. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  16418. @end example
  16419. @item
  16420. Truncate binary threshold, using gray color as threshold:
  16421. @example
  16422. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  16423. @end example
  16424. @item
  16425. Threshold to zero, using gray color as threshold:
  16426. @example
  16427. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  16428. @end example
  16429. @item
  16430. Inverted threshold to zero, using gray color as threshold:
  16431. @example
  16432. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  16433. @end example
  16434. @end itemize
  16435. @section thumbnail
  16436. Select the most representative frame in a given sequence of consecutive frames.
  16437. The filter accepts the following options:
  16438. @table @option
  16439. @item n
  16440. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  16441. will pick one of them, and then handle the next batch of @var{n} frames until
  16442. the end. Default is @code{100}.
  16443. @end table
  16444. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  16445. value will result in a higher memory usage, so a high value is not recommended.
  16446. @subsection Examples
  16447. @itemize
  16448. @item
  16449. Extract one picture each 50 frames:
  16450. @example
  16451. thumbnail=50
  16452. @end example
  16453. @item
  16454. Complete example of a thumbnail creation with @command{ffmpeg}:
  16455. @example
  16456. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  16457. @end example
  16458. @end itemize
  16459. @anchor{tile}
  16460. @section tile
  16461. Tile several successive frames together.
  16462. The @ref{untile} filter can do the reverse.
  16463. The filter accepts the following options:
  16464. @table @option
  16465. @item layout
  16466. Set the grid size in the form @code{COLUMNSxROWS}. Range is upto UINT_MAX cells.
  16467. Default is @code{6x5}.
  16468. @item nb_frames
  16469. Set the maximum number of frames to render in the given area. It must be less
  16470. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  16471. the area will be used.
  16472. @item margin
  16473. Set the outer border margin in pixels. Range is 0 to 1024. Default is @code{0}.
  16474. @item padding
  16475. Set the inner border thickness (i.e. the number of pixels between frames). For
  16476. more advanced padding options (such as having different values for the edges),
  16477. refer to the pad video filter. Range is 0 to 1024. Default is @code{0}.
  16478. @item color
  16479. Specify the color of the unused area. For the syntax of this option, check the
  16480. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16481. The default value of @var{color} is "black".
  16482. @item overlap
  16483. Set the number of frames to overlap when tiling several successive frames together.
  16484. The value must be between @code{0} and @var{nb_frames - 1}. Default is @code{0}.
  16485. @item init_padding
  16486. Set the number of frames to initially be empty before displaying first output frame.
  16487. This controls how soon will one get first output frame.
  16488. The value must be between @code{0} and @var{nb_frames - 1}. Default is @code{0}.
  16489. @end table
  16490. @subsection Examples
  16491. @itemize
  16492. @item
  16493. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  16494. @example
  16495. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  16496. @end example
  16497. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  16498. duplicating each output frame to accommodate the originally detected frame
  16499. rate.
  16500. @item
  16501. Display @code{5} pictures in an area of @code{3x2} frames,
  16502. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  16503. mixed flat and named options:
  16504. @example
  16505. tile=3x2:nb_frames=5:padding=7:margin=2
  16506. @end example
  16507. @end itemize
  16508. @section tinterlace
  16509. Perform various types of temporal field interlacing.
  16510. Frames are counted starting from 1, so the first input frame is
  16511. considered odd.
  16512. The filter accepts the following options:
  16513. @table @option
  16514. @item mode
  16515. Specify the mode of the interlacing. This option can also be specified
  16516. as a value alone. See below for a list of values for this option.
  16517. Available values are:
  16518. @table @samp
  16519. @item merge, 0
  16520. Move odd frames into the upper field, even into the lower field,
  16521. generating a double height frame at half frame rate.
  16522. @example
  16523. ------> time
  16524. Input:
  16525. Frame 1 Frame 2 Frame 3 Frame 4
  16526. 11111 22222 33333 44444
  16527. 11111 22222 33333 44444
  16528. 11111 22222 33333 44444
  16529. 11111 22222 33333 44444
  16530. Output:
  16531. 11111 33333
  16532. 22222 44444
  16533. 11111 33333
  16534. 22222 44444
  16535. 11111 33333
  16536. 22222 44444
  16537. 11111 33333
  16538. 22222 44444
  16539. @end example
  16540. @item drop_even, 1
  16541. Only output odd frames, even frames are dropped, generating a frame with
  16542. unchanged height at half frame rate.
  16543. @example
  16544. ------> time
  16545. Input:
  16546. Frame 1 Frame 2 Frame 3 Frame 4
  16547. 11111 22222 33333 44444
  16548. 11111 22222 33333 44444
  16549. 11111 22222 33333 44444
  16550. 11111 22222 33333 44444
  16551. Output:
  16552. 11111 33333
  16553. 11111 33333
  16554. 11111 33333
  16555. 11111 33333
  16556. @end example
  16557. @item drop_odd, 2
  16558. Only output even frames, odd frames are dropped, generating a frame with
  16559. unchanged height at half frame rate.
  16560. @example
  16561. ------> time
  16562. Input:
  16563. Frame 1 Frame 2 Frame 3 Frame 4
  16564. 11111 22222 33333 44444
  16565. 11111 22222 33333 44444
  16566. 11111 22222 33333 44444
  16567. 11111 22222 33333 44444
  16568. Output:
  16569. 22222 44444
  16570. 22222 44444
  16571. 22222 44444
  16572. 22222 44444
  16573. @end example
  16574. @item pad, 3
  16575. Expand each frame to full height, but pad alternate lines with black,
  16576. generating a frame with double height at the same input frame rate.
  16577. @example
  16578. ------> time
  16579. Input:
  16580. Frame 1 Frame 2 Frame 3 Frame 4
  16581. 11111 22222 33333 44444
  16582. 11111 22222 33333 44444
  16583. 11111 22222 33333 44444
  16584. 11111 22222 33333 44444
  16585. Output:
  16586. 11111 ..... 33333 .....
  16587. ..... 22222 ..... 44444
  16588. 11111 ..... 33333 .....
  16589. ..... 22222 ..... 44444
  16590. 11111 ..... 33333 .....
  16591. ..... 22222 ..... 44444
  16592. 11111 ..... 33333 .....
  16593. ..... 22222 ..... 44444
  16594. @end example
  16595. @item interleave_top, 4
  16596. Interleave the upper field from odd frames with the lower field from
  16597. even frames, generating a frame with unchanged height at half frame rate.
  16598. @example
  16599. ------> time
  16600. Input:
  16601. Frame 1 Frame 2 Frame 3 Frame 4
  16602. 11111<- 22222 33333<- 44444
  16603. 11111 22222<- 33333 44444<-
  16604. 11111<- 22222 33333<- 44444
  16605. 11111 22222<- 33333 44444<-
  16606. Output:
  16607. 11111 33333
  16608. 22222 44444
  16609. 11111 33333
  16610. 22222 44444
  16611. @end example
  16612. @item interleave_bottom, 5
  16613. Interleave the lower field from odd frames with the upper field from
  16614. even frames, generating a frame with unchanged height at half frame rate.
  16615. @example
  16616. ------> time
  16617. Input:
  16618. Frame 1 Frame 2 Frame 3 Frame 4
  16619. 11111 22222<- 33333 44444<-
  16620. 11111<- 22222 33333<- 44444
  16621. 11111 22222<- 33333 44444<-
  16622. 11111<- 22222 33333<- 44444
  16623. Output:
  16624. 22222 44444
  16625. 11111 33333
  16626. 22222 44444
  16627. 11111 33333
  16628. @end example
  16629. @item interlacex2, 6
  16630. Double frame rate with unchanged height. Frames are inserted each
  16631. containing the second temporal field from the previous input frame and
  16632. the first temporal field from the next input frame. This mode relies on
  16633. the top_field_first flag. Useful for interlaced video displays with no
  16634. field synchronisation.
  16635. @example
  16636. ------> time
  16637. Input:
  16638. Frame 1 Frame 2 Frame 3 Frame 4
  16639. 11111 22222 33333 44444
  16640. 11111 22222 33333 44444
  16641. 11111 22222 33333 44444
  16642. 11111 22222 33333 44444
  16643. Output:
  16644. 11111 22222 22222 33333 33333 44444 44444
  16645. 11111 11111 22222 22222 33333 33333 44444
  16646. 11111 22222 22222 33333 33333 44444 44444
  16647. 11111 11111 22222 22222 33333 33333 44444
  16648. @end example
  16649. @item mergex2, 7
  16650. Move odd frames into the upper field, even into the lower field,
  16651. generating a double height frame at same frame rate.
  16652. @example
  16653. ------> time
  16654. Input:
  16655. Frame 1 Frame 2 Frame 3 Frame 4
  16656. 11111 22222 33333 44444
  16657. 11111 22222 33333 44444
  16658. 11111 22222 33333 44444
  16659. 11111 22222 33333 44444
  16660. Output:
  16661. 11111 33333 33333 55555
  16662. 22222 22222 44444 44444
  16663. 11111 33333 33333 55555
  16664. 22222 22222 44444 44444
  16665. 11111 33333 33333 55555
  16666. 22222 22222 44444 44444
  16667. 11111 33333 33333 55555
  16668. 22222 22222 44444 44444
  16669. @end example
  16670. @end table
  16671. Numeric values are deprecated but are accepted for backward
  16672. compatibility reasons.
  16673. Default mode is @code{merge}.
  16674. @item flags
  16675. Specify flags influencing the filter process.
  16676. Available value for @var{flags} is:
  16677. @table @option
  16678. @item low_pass_filter, vlpf
  16679. Enable linear vertical low-pass filtering in the filter.
  16680. Vertical low-pass filtering is required when creating an interlaced
  16681. destination from a progressive source which contains high-frequency
  16682. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  16683. patterning.
  16684. @item complex_filter, cvlpf
  16685. Enable complex vertical low-pass filtering.
  16686. This will slightly less reduce interlace 'twitter' and Moire
  16687. patterning but better retain detail and subjective sharpness impression.
  16688. @item bypass_il
  16689. Bypass already interlaced frames, only adjust the frame rate.
  16690. @end table
  16691. Vertical low-pass filtering and bypassing already interlaced frames can only be
  16692. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  16693. @end table
  16694. @section tmedian
  16695. Pick median pixels from several successive input video frames.
  16696. The filter accepts the following options:
  16697. @table @option
  16698. @item radius
  16699. Set radius of median filter.
  16700. Default is 1. Allowed range is from 1 to 127.
  16701. @item planes
  16702. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  16703. @item percentile
  16704. Set median percentile. Default value is @code{0.5}.
  16705. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  16706. minimum values, and @code{1} maximum values.
  16707. @end table
  16708. @subsection Commands
  16709. This filter supports all above options as @ref{commands}, excluding option @code{radius}.
  16710. @section tmidequalizer
  16711. Apply Temporal Midway Video Equalization effect.
  16712. Midway Video Equalization adjusts a sequence of video frames to have the same
  16713. histograms, while maintaining their dynamics as much as possible. It's
  16714. useful for e.g. matching exposures from a video frames sequence.
  16715. This filter accepts the following option:
  16716. @table @option
  16717. @item radius
  16718. Set filtering radius. Default is @code{5}. Allowed range is from 1 to 127.
  16719. @item sigma
  16720. Set filtering sigma. Default is @code{0.5}. This controls strength of filtering.
  16721. Setting this option to 0 effectively does nothing.
  16722. @item planes
  16723. Set which planes to process. Default is @code{15}, which is all available planes.
  16724. @end table
  16725. @section tmix
  16726. Mix successive video frames.
  16727. A description of the accepted options follows.
  16728. @table @option
  16729. @item frames
  16730. The number of successive frames to mix. If unspecified, it defaults to 3.
  16731. @item weights
  16732. Specify weight of each input video frame.
  16733. Each weight is separated by space. If number of weights is smaller than
  16734. number of @var{frames} last specified weight will be used for all remaining
  16735. unset weights.
  16736. @item scale
  16737. Specify scale, if it is set it will be multiplied with sum
  16738. of each weight multiplied with pixel values to give final destination
  16739. pixel value. By default @var{scale} is auto scaled to sum of weights.
  16740. @item planes
  16741. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  16742. @end table
  16743. @subsection Examples
  16744. @itemize
  16745. @item
  16746. Average 7 successive frames:
  16747. @example
  16748. tmix=frames=7:weights="1 1 1 1 1 1 1"
  16749. @end example
  16750. @item
  16751. Apply simple temporal convolution:
  16752. @example
  16753. tmix=frames=3:weights="-1 3 -1"
  16754. @end example
  16755. @item
  16756. Similar as above but only showing temporal differences:
  16757. @example
  16758. tmix=frames=3:weights="-1 2 -1":scale=1
  16759. @end example
  16760. @end itemize
  16761. @subsection Commands
  16762. This filter supports the following commands:
  16763. @table @option
  16764. @item weights
  16765. @item scale
  16766. @item planes
  16767. Syntax is same as option with same name.
  16768. @end table
  16769. @anchor{tonemap}
  16770. @section tonemap
  16771. Tone map colors from different dynamic ranges.
  16772. This filter expects data in single precision floating point, as it needs to
  16773. operate on (and can output) out-of-range values. Another filter, such as
  16774. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  16775. The tonemapping algorithms implemented only work on linear light, so input
  16776. data should be linearized beforehand (and possibly correctly tagged).
  16777. @example
  16778. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  16779. @end example
  16780. @subsection Options
  16781. The filter accepts the following options.
  16782. @table @option
  16783. @item tonemap
  16784. Set the tone map algorithm to use.
  16785. Possible values are:
  16786. @table @var
  16787. @item none
  16788. Do not apply any tone map, only desaturate overbright pixels.
  16789. @item clip
  16790. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  16791. in-range values, while distorting out-of-range values.
  16792. @item linear
  16793. Stretch the entire reference gamut to a linear multiple of the display.
  16794. @item gamma
  16795. Fit a logarithmic transfer between the tone curves.
  16796. @item reinhard
  16797. Preserve overall image brightness with a simple curve, using nonlinear
  16798. contrast, which results in flattening details and degrading color accuracy.
  16799. @item hable
  16800. Preserve both dark and bright details better than @var{reinhard}, at the cost
  16801. of slightly darkening everything. Use it when detail preservation is more
  16802. important than color and brightness accuracy.
  16803. @item mobius
  16804. Smoothly map out-of-range values, while retaining contrast and colors for
  16805. in-range material as much as possible. Use it when color accuracy is more
  16806. important than detail preservation.
  16807. @end table
  16808. Default is none.
  16809. @item param
  16810. Tune the tone mapping algorithm.
  16811. This affects the following algorithms:
  16812. @table @var
  16813. @item none
  16814. Ignored.
  16815. @item linear
  16816. Specifies the scale factor to use while stretching.
  16817. Default to 1.0.
  16818. @item gamma
  16819. Specifies the exponent of the function.
  16820. Default to 1.8.
  16821. @item clip
  16822. Specify an extra linear coefficient to multiply into the signal before clipping.
  16823. Default to 1.0.
  16824. @item reinhard
  16825. Specify the local contrast coefficient at the display peak.
  16826. Default to 0.5, which means that in-gamut values will be about half as bright
  16827. as when clipping.
  16828. @item hable
  16829. Ignored.
  16830. @item mobius
  16831. Specify the transition point from linear to mobius transform. Every value
  16832. below this point is guaranteed to be mapped 1:1. The higher the value, the
  16833. more accurate the result will be, at the cost of losing bright details.
  16834. Default to 0.3, which due to the steep initial slope still preserves in-range
  16835. colors fairly accurately.
  16836. @end table
  16837. @item desat
  16838. Apply desaturation for highlights that exceed this level of brightness. The
  16839. higher the parameter, the more color information will be preserved. This
  16840. setting helps prevent unnaturally blown-out colors for super-highlights, by
  16841. (smoothly) turning into white instead. This makes images feel more natural,
  16842. at the cost of reducing information about out-of-range colors.
  16843. The default of 2.0 is somewhat conservative and will mostly just apply to
  16844. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  16845. This option works only if the input frame has a supported color tag.
  16846. @item peak
  16847. Override signal/nominal/reference peak with this value. Useful when the
  16848. embedded peak information in display metadata is not reliable or when tone
  16849. mapping from a lower range to a higher range.
  16850. @end table
  16851. @section tpad
  16852. Temporarily pad video frames.
  16853. The filter accepts the following options:
  16854. @table @option
  16855. @item start
  16856. Specify number of delay frames before input video stream. Default is 0.
  16857. @item stop
  16858. Specify number of padding frames after input video stream.
  16859. Set to -1 to pad indefinitely. Default is 0.
  16860. @item start_mode
  16861. Set kind of frames added to beginning of stream.
  16862. Can be either @var{add} or @var{clone}.
  16863. With @var{add} frames of solid-color are added.
  16864. With @var{clone} frames are clones of first frame.
  16865. Default is @var{add}.
  16866. @item stop_mode
  16867. Set kind of frames added to end of stream.
  16868. Can be either @var{add} or @var{clone}.
  16869. With @var{add} frames of solid-color are added.
  16870. With @var{clone} frames are clones of last frame.
  16871. Default is @var{add}.
  16872. @item start_duration, stop_duration
  16873. Specify the duration of the start/stop delay. See
  16874. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  16875. for the accepted syntax.
  16876. These options override @var{start} and @var{stop}. Default is 0.
  16877. @item color
  16878. Specify the color of the padded area. For the syntax of this option,
  16879. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  16880. manual,ffmpeg-utils}.
  16881. The default value of @var{color} is "black".
  16882. @end table
  16883. @anchor{transpose}
  16884. @section transpose
  16885. Transpose rows with columns in the input video and optionally flip it.
  16886. It accepts the following parameters:
  16887. @table @option
  16888. @item dir
  16889. Specify the transposition direction.
  16890. Can assume the following values:
  16891. @table @samp
  16892. @item 0, 4, cclock_flip
  16893. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  16894. @example
  16895. L.R L.l
  16896. . . -> . .
  16897. l.r R.r
  16898. @end example
  16899. @item 1, 5, clock
  16900. Rotate by 90 degrees clockwise, that is:
  16901. @example
  16902. L.R l.L
  16903. . . -> . .
  16904. l.r r.R
  16905. @end example
  16906. @item 2, 6, cclock
  16907. Rotate by 90 degrees counterclockwise, that is:
  16908. @example
  16909. L.R R.r
  16910. . . -> . .
  16911. l.r L.l
  16912. @end example
  16913. @item 3, 7, clock_flip
  16914. Rotate by 90 degrees clockwise and vertically flip, that is:
  16915. @example
  16916. L.R r.R
  16917. . . -> . .
  16918. l.r l.L
  16919. @end example
  16920. @end table
  16921. For values between 4-7, the transposition is only done if the input
  16922. video geometry is portrait and not landscape. These values are
  16923. deprecated, the @code{passthrough} option should be used instead.
  16924. Numerical values are deprecated, and should be dropped in favor of
  16925. symbolic constants.
  16926. @item passthrough
  16927. Do not apply the transposition if the input geometry matches the one
  16928. specified by the specified value. It accepts the following values:
  16929. @table @samp
  16930. @item none
  16931. Always apply transposition.
  16932. @item portrait
  16933. Preserve portrait geometry (when @var{height} >= @var{width}).
  16934. @item landscape
  16935. Preserve landscape geometry (when @var{width} >= @var{height}).
  16936. @end table
  16937. Default value is @code{none}.
  16938. @end table
  16939. For example to rotate by 90 degrees clockwise and preserve portrait
  16940. layout:
  16941. @example
  16942. transpose=dir=1:passthrough=portrait
  16943. @end example
  16944. The command above can also be specified as:
  16945. @example
  16946. transpose=1:portrait
  16947. @end example
  16948. @section transpose_npp
  16949. Transpose rows with columns in the input video and optionally flip it.
  16950. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  16951. It accepts the following parameters:
  16952. @table @option
  16953. @item dir
  16954. Specify the transposition direction.
  16955. Can assume the following values:
  16956. @table @samp
  16957. @item cclock_flip
  16958. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  16959. @item clock
  16960. Rotate by 90 degrees clockwise.
  16961. @item cclock
  16962. Rotate by 90 degrees counterclockwise.
  16963. @item clock_flip
  16964. Rotate by 90 degrees clockwise and vertically flip.
  16965. @end table
  16966. @item passthrough
  16967. Do not apply the transposition if the input geometry matches the one
  16968. specified by the specified value. It accepts the following values:
  16969. @table @samp
  16970. @item none
  16971. Always apply transposition. (default)
  16972. @item portrait
  16973. Preserve portrait geometry (when @var{height} >= @var{width}).
  16974. @item landscape
  16975. Preserve landscape geometry (when @var{width} >= @var{height}).
  16976. @end table
  16977. @end table
  16978. @section trim
  16979. Trim the input so that the output contains one continuous subpart of the input.
  16980. It accepts the following parameters:
  16981. @table @option
  16982. @item start
  16983. Specify the time of the start of the kept section, i.e. the frame with the
  16984. timestamp @var{start} will be the first frame in the output.
  16985. @item end
  16986. Specify the time of the first frame that will be dropped, i.e. the frame
  16987. immediately preceding the one with the timestamp @var{end} will be the last
  16988. frame in the output.
  16989. @item start_pts
  16990. This is the same as @var{start}, except this option sets the start timestamp
  16991. in timebase units instead of seconds.
  16992. @item end_pts
  16993. This is the same as @var{end}, except this option sets the end timestamp
  16994. in timebase units instead of seconds.
  16995. @item duration
  16996. The maximum duration of the output in seconds.
  16997. @item start_frame
  16998. The number of the first frame that should be passed to the output.
  16999. @item end_frame
  17000. The number of the first frame that should be dropped.
  17001. @end table
  17002. @option{start}, @option{end}, and @option{duration} are expressed as time
  17003. duration specifications; see
  17004. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17005. for the accepted syntax.
  17006. Note that the first two sets of the start/end options and the @option{duration}
  17007. option look at the frame timestamp, while the _frame variants simply count the
  17008. frames that pass through the filter. Also note that this filter does not modify
  17009. the timestamps. If you wish for the output timestamps to start at zero, insert a
  17010. setpts filter after the trim filter.
  17011. If multiple start or end options are set, this filter tries to be greedy and
  17012. keep all the frames that match at least one of the specified constraints. To keep
  17013. only the part that matches all the constraints at once, chain multiple trim
  17014. filters.
  17015. The defaults are such that all the input is kept. So it is possible to set e.g.
  17016. just the end values to keep everything before the specified time.
  17017. Examples:
  17018. @itemize
  17019. @item
  17020. Drop everything except the second minute of input:
  17021. @example
  17022. ffmpeg -i INPUT -vf trim=60:120
  17023. @end example
  17024. @item
  17025. Keep only the first second:
  17026. @example
  17027. ffmpeg -i INPUT -vf trim=duration=1
  17028. @end example
  17029. @end itemize
  17030. @section unpremultiply
  17031. Apply alpha unpremultiply effect to input video stream using first plane
  17032. of second stream as alpha.
  17033. Both streams must have same dimensions and same pixel format.
  17034. The filter accepts the following option:
  17035. @table @option
  17036. @item planes
  17037. Set which planes will be processed, unprocessed planes will be copied.
  17038. By default value 0xf, all planes will be processed.
  17039. If the format has 1 or 2 components, then luma is bit 0.
  17040. If the format has 3 or 4 components:
  17041. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  17042. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  17043. If present, the alpha channel is always the last bit.
  17044. @item inplace
  17045. Do not require 2nd input for processing, instead use alpha plane from input stream.
  17046. @end table
  17047. @anchor{unsharp}
  17048. @section unsharp
  17049. Sharpen or blur the input video.
  17050. It accepts the following parameters:
  17051. @table @option
  17052. @item luma_msize_x, lx
  17053. Set the luma matrix horizontal size. It must be an odd integer between
  17054. 3 and 23. The default value is 5.
  17055. @item luma_msize_y, ly
  17056. Set the luma matrix vertical size. It must be an odd integer between 3
  17057. and 23. The default value is 5.
  17058. @item luma_amount, la
  17059. Set the luma effect strength. It must be a floating point number, reasonable
  17060. values lay between -1.5 and 1.5.
  17061. Negative values will blur the input video, while positive values will
  17062. sharpen it, a value of zero will disable the effect.
  17063. Default value is 1.0.
  17064. @item chroma_msize_x, cx
  17065. Set the chroma matrix horizontal size. It must be an odd integer
  17066. between 3 and 23. The default value is 5.
  17067. @item chroma_msize_y, cy
  17068. Set the chroma matrix vertical size. It must be an odd integer
  17069. between 3 and 23. The default value is 5.
  17070. @item chroma_amount, ca
  17071. Set the chroma effect strength. It must be a floating point number, reasonable
  17072. values lay between -1.5 and 1.5.
  17073. Negative values will blur the input video, while positive values will
  17074. sharpen it, a value of zero will disable the effect.
  17075. Default value is 0.0.
  17076. @item alpha_msize_x, ax
  17077. Set the alpha matrix horizontal size. It must be an odd integer
  17078. between 3 and 23. The default value is 5.
  17079. @item alpha_msize_y, ay
  17080. Set the alpha matrix vertical size. It must be an odd integer
  17081. between 3 and 23. The default value is 5.
  17082. @item alpha_amount, aa
  17083. Set the alpha effect strength. It must be a floating point number, reasonable
  17084. values lay between -1.5 and 1.5.
  17085. Negative values will blur the input video, while positive values will
  17086. sharpen it, a value of zero will disable the effect.
  17087. Default value is 0.0.
  17088. @end table
  17089. All parameters are optional and default to the equivalent of the
  17090. string '5:5:1.0:5:5:0.0'.
  17091. @subsection Examples
  17092. @itemize
  17093. @item
  17094. Apply strong luma sharpen effect:
  17095. @example
  17096. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  17097. @end example
  17098. @item
  17099. Apply a strong blur of both luma and chroma parameters:
  17100. @example
  17101. unsharp=7:7:-2:7:7:-2
  17102. @end example
  17103. @end itemize
  17104. @anchor{untile}
  17105. @section untile
  17106. Decompose a video made of tiled images into the individual images.
  17107. The frame rate of the output video is the frame rate of the input video
  17108. multiplied by the number of tiles.
  17109. This filter does the reverse of @ref{tile}.
  17110. The filter accepts the following options:
  17111. @table @option
  17112. @item layout
  17113. Set the grid size (i.e. the number of lines and columns). For the syntax of
  17114. this option, check the
  17115. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17116. @end table
  17117. @subsection Examples
  17118. @itemize
  17119. @item
  17120. Produce a 1-second video from a still image file made of 25 frames stacked
  17121. vertically, like an analogic film reel:
  17122. @example
  17123. ffmpeg -r 1 -i image.jpg -vf untile=1x25 movie.mkv
  17124. @end example
  17125. @end itemize
  17126. @section uspp
  17127. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  17128. the image at several (or - in the case of @option{quality} level @code{8} - all)
  17129. shifts and average the results.
  17130. The way this differs from the behavior of spp is that uspp actually encodes &
  17131. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  17132. DCT similar to MJPEG.
  17133. This filter is only available in ffmpeg version 4.4 or earlier.
  17134. The filter accepts the following options:
  17135. @table @option
  17136. @item quality
  17137. Set quality. This option defines the number of levels for averaging. It accepts
  17138. an integer in the range 0-8. If set to @code{0}, the filter will have no
  17139. effect. A value of @code{8} means the higher quality. For each increment of
  17140. that value the speed drops by a factor of approximately 2. Default value is
  17141. @code{3}.
  17142. @item qp
  17143. Force a constant quantization parameter. If not set, the filter will use the QP
  17144. from the video stream (if available).
  17145. @end table
  17146. @section v360
  17147. Convert 360 videos between various formats.
  17148. The filter accepts the following options:
  17149. @table @option
  17150. @item input
  17151. @item output
  17152. Set format of the input/output video.
  17153. Available formats:
  17154. @table @samp
  17155. @item e
  17156. @item equirect
  17157. Equirectangular projection.
  17158. @item c3x2
  17159. @item c6x1
  17160. @item c1x6
  17161. Cubemap with 3x2/6x1/1x6 layout.
  17162. Format specific options:
  17163. @table @option
  17164. @item in_pad
  17165. @item out_pad
  17166. Set padding proportion for the input/output cubemap. Values in decimals.
  17167. Example values:
  17168. @table @samp
  17169. @item 0
  17170. No padding.
  17171. @item 0.01
  17172. 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)
  17173. @end table
  17174. Default value is @b{@samp{0}}.
  17175. Maximum value is @b{@samp{0.1}}.
  17176. @item fin_pad
  17177. @item fout_pad
  17178. Set fixed padding for the input/output cubemap. Values in pixels.
  17179. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  17180. @item in_forder
  17181. @item out_forder
  17182. Set order of faces for the input/output cubemap. Choose one direction for each position.
  17183. Designation of directions:
  17184. @table @samp
  17185. @item r
  17186. right
  17187. @item l
  17188. left
  17189. @item u
  17190. up
  17191. @item d
  17192. down
  17193. @item f
  17194. forward
  17195. @item b
  17196. back
  17197. @end table
  17198. Default value is @b{@samp{rludfb}}.
  17199. @item in_frot
  17200. @item out_frot
  17201. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  17202. Designation of angles:
  17203. @table @samp
  17204. @item 0
  17205. 0 degrees clockwise
  17206. @item 1
  17207. 90 degrees clockwise
  17208. @item 2
  17209. 180 degrees clockwise
  17210. @item 3
  17211. 270 degrees clockwise
  17212. @end table
  17213. Default value is @b{@samp{000000}}.
  17214. @end table
  17215. @item eac
  17216. Equi-Angular Cubemap.
  17217. @item flat
  17218. @item gnomonic
  17219. @item rectilinear
  17220. Regular video.
  17221. Format specific options:
  17222. @table @option
  17223. @item h_fov
  17224. @item v_fov
  17225. @item d_fov
  17226. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17227. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17228. @item ih_fov
  17229. @item iv_fov
  17230. @item id_fov
  17231. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17232. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17233. @end table
  17234. @item dfisheye
  17235. Dual fisheye.
  17236. Format specific options:
  17237. @table @option
  17238. @item h_fov
  17239. @item v_fov
  17240. @item d_fov
  17241. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17242. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17243. @item ih_fov
  17244. @item iv_fov
  17245. @item id_fov
  17246. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17247. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17248. @end table
  17249. @item barrel
  17250. @item fb
  17251. @item barrelsplit
  17252. Facebook's 360 formats.
  17253. @item sg
  17254. Stereographic format.
  17255. Format specific options:
  17256. @table @option
  17257. @item h_fov
  17258. @item v_fov
  17259. @item d_fov
  17260. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17261. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17262. @item ih_fov
  17263. @item iv_fov
  17264. @item id_fov
  17265. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17266. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17267. @end table
  17268. @item mercator
  17269. Mercator format.
  17270. @item ball
  17271. Ball format, gives significant distortion toward the back.
  17272. @item hammer
  17273. Hammer-Aitoff map projection format.
  17274. @item sinusoidal
  17275. Sinusoidal map projection format.
  17276. @item fisheye
  17277. Fisheye projection.
  17278. Format specific options:
  17279. @table @option
  17280. @item h_fov
  17281. @item v_fov
  17282. @item d_fov
  17283. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17284. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17285. @item ih_fov
  17286. @item iv_fov
  17287. @item id_fov
  17288. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17289. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17290. @end table
  17291. @item pannini
  17292. Pannini projection.
  17293. Format specific options:
  17294. @table @option
  17295. @item h_fov
  17296. Set output pannini parameter.
  17297. @item ih_fov
  17298. Set input pannini parameter.
  17299. @end table
  17300. @item cylindrical
  17301. Cylindrical projection.
  17302. Format specific options:
  17303. @table @option
  17304. @item h_fov
  17305. @item v_fov
  17306. @item d_fov
  17307. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17308. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17309. @item ih_fov
  17310. @item iv_fov
  17311. @item id_fov
  17312. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17313. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17314. @end table
  17315. @item perspective
  17316. Perspective projection. @i{(output only)}
  17317. Format specific options:
  17318. @table @option
  17319. @item v_fov
  17320. Set perspective parameter.
  17321. @end table
  17322. @item tetrahedron
  17323. Tetrahedron projection.
  17324. @item tsp
  17325. Truncated square pyramid projection.
  17326. @item he
  17327. @item hequirect
  17328. Half equirectangular projection.
  17329. @item equisolid
  17330. Equisolid format.
  17331. Format specific options:
  17332. @table @option
  17333. @item h_fov
  17334. @item v_fov
  17335. @item d_fov
  17336. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17337. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17338. @item ih_fov
  17339. @item iv_fov
  17340. @item id_fov
  17341. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17342. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17343. @end table
  17344. @item og
  17345. Orthographic format.
  17346. Format specific options:
  17347. @table @option
  17348. @item h_fov
  17349. @item v_fov
  17350. @item d_fov
  17351. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17352. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17353. @item ih_fov
  17354. @item iv_fov
  17355. @item id_fov
  17356. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17357. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17358. @end table
  17359. @item octahedron
  17360. Octahedron projection.
  17361. @item cylindricalea
  17362. Cylindrical Equal Area projection.
  17363. @end table
  17364. @item interp
  17365. Set interpolation method.@*
  17366. @i{Note: more complex interpolation methods require much more memory to run.}
  17367. Available methods:
  17368. @table @samp
  17369. @item near
  17370. @item nearest
  17371. Nearest neighbour.
  17372. @item line
  17373. @item linear
  17374. Bilinear interpolation.
  17375. @item lagrange9
  17376. Lagrange9 interpolation.
  17377. @item cube
  17378. @item cubic
  17379. Bicubic interpolation.
  17380. @item lanc
  17381. @item lanczos
  17382. Lanczos interpolation.
  17383. @item sp16
  17384. @item spline16
  17385. Spline16 interpolation.
  17386. @item gauss
  17387. @item gaussian
  17388. Gaussian interpolation.
  17389. @item mitchell
  17390. Mitchell interpolation.
  17391. @end table
  17392. Default value is @b{@samp{line}}.
  17393. @item w
  17394. @item h
  17395. Set the output video resolution.
  17396. Default resolution depends on formats.
  17397. @item in_stereo
  17398. @item out_stereo
  17399. Set the input/output stereo format.
  17400. @table @samp
  17401. @item 2d
  17402. 2D mono
  17403. @item sbs
  17404. Side by side
  17405. @item tb
  17406. Top bottom
  17407. @end table
  17408. Default value is @b{@samp{2d}} for input and output format.
  17409. @item yaw
  17410. @item pitch
  17411. @item roll
  17412. Set rotation for the output video. Values in degrees.
  17413. @item rorder
  17414. Set rotation order for the output video. Choose one item for each position.
  17415. @table @samp
  17416. @item y, Y
  17417. yaw
  17418. @item p, P
  17419. pitch
  17420. @item r, R
  17421. roll
  17422. @end table
  17423. Default value is @b{@samp{ypr}}.
  17424. @item h_flip
  17425. @item v_flip
  17426. @item d_flip
  17427. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  17428. @item ih_flip
  17429. @item iv_flip
  17430. Set if input video is flipped horizontally/vertically. Boolean values.
  17431. @item in_trans
  17432. Set if input video is transposed. Boolean value, by default disabled.
  17433. @item out_trans
  17434. Set if output video needs to be transposed. Boolean value, by default disabled.
  17435. @item h_offset
  17436. @item v_offset
  17437. Set output horizontal/vertical off-axis offset. Default is set to 0.
  17438. Allowed range is from -1 to 1.
  17439. @item alpha_mask
  17440. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  17441. @item reset_rot
  17442. Reset rotation of output video. Boolean value, by default disabled.
  17443. @end table
  17444. @subsection Examples
  17445. @itemize
  17446. @item
  17447. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  17448. @example
  17449. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  17450. @end example
  17451. @item
  17452. Extract back view of Equi-Angular Cubemap:
  17453. @example
  17454. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  17455. @end example
  17456. @item
  17457. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  17458. @example
  17459. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  17460. @end example
  17461. @end itemize
  17462. @subsection Commands
  17463. This filter supports subset of above options as @ref{commands}.
  17464. @section vaguedenoiser
  17465. Apply a wavelet based denoiser.
  17466. It transforms each frame from the video input into the wavelet domain,
  17467. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  17468. the obtained coefficients. It does an inverse wavelet transform after.
  17469. Due to wavelet properties, it should give a nice smoothed result, and
  17470. reduced noise, without blurring picture features.
  17471. This filter accepts the following options:
  17472. @table @option
  17473. @item threshold
  17474. The filtering strength. The higher, the more filtered the video will be.
  17475. Hard thresholding can use a higher threshold than soft thresholding
  17476. before the video looks overfiltered. Default value is 2.
  17477. @item method
  17478. The filtering method the filter will use.
  17479. It accepts the following values:
  17480. @table @samp
  17481. @item hard
  17482. All values under the threshold will be zeroed.
  17483. @item soft
  17484. All values under the threshold will be zeroed. All values above will be
  17485. reduced by the threshold.
  17486. @item garrote
  17487. Scales or nullifies coefficients - intermediary between (more) soft and
  17488. (less) hard thresholding.
  17489. @end table
  17490. Default is garrote.
  17491. @item nsteps
  17492. Number of times, the wavelet will decompose the picture. Picture can't
  17493. be decomposed beyond a particular point (typically, 8 for a 640x480
  17494. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  17495. @item percent
  17496. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  17497. @item planes
  17498. A list of the planes to process. By default all planes are processed.
  17499. @item type
  17500. The threshold type the filter will use.
  17501. It accepts the following values:
  17502. @table @samp
  17503. @item universal
  17504. Threshold used is same for all decompositions.
  17505. @item bayes
  17506. Threshold used depends also on each decomposition coefficients.
  17507. @end table
  17508. Default is universal.
  17509. @end table
  17510. @section varblur
  17511. Apply variable blur filter by using 2nd video stream to set blur radius.
  17512. The 2nd stream must have the same dimensions.
  17513. This filter accepts the following options:
  17514. @table @option
  17515. @item min_r
  17516. Set min allowed radius. Allowed range is from 0 to 254. Default is 0.
  17517. @item max_r
  17518. Set max allowed radius. Allowed range is from 1 to 255. Default is 8.
  17519. @item planes
  17520. Set which planes to process. By default, all are used.
  17521. @end table
  17522. The @code{varblur} filter also supports the @ref{framesync} options.
  17523. @subsection Commands
  17524. This filter supports all the above options as @ref{commands}.
  17525. @section vectorscope
  17526. Display 2 color component values in the two dimensional graph (which is called
  17527. a vectorscope).
  17528. This filter accepts the following options:
  17529. @table @option
  17530. @item mode, m
  17531. Set vectorscope mode.
  17532. It accepts the following values:
  17533. @table @samp
  17534. @item gray
  17535. @item tint
  17536. Gray values are displayed on graph, higher brightness means more pixels have
  17537. same component color value on location in graph. This is the default mode.
  17538. @item color
  17539. Gray values are displayed on graph. Surrounding pixels values which are not
  17540. present in video frame are drawn in gradient of 2 color components which are
  17541. set by option @code{x} and @code{y}. The 3rd color component is static.
  17542. @item color2
  17543. Actual color components values present in video frame are displayed on graph.
  17544. @item color3
  17545. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  17546. on graph increases value of another color component, which is luminance by
  17547. default values of @code{x} and @code{y}.
  17548. @item color4
  17549. Actual colors present in video frame are displayed on graph. If two different
  17550. colors map to same position on graph then color with higher value of component
  17551. not present in graph is picked.
  17552. @item color5
  17553. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  17554. component picked from radial gradient.
  17555. @end table
  17556. @item x
  17557. Set which color component will be represented on X-axis. Default is @code{1}.
  17558. @item y
  17559. Set which color component will be represented on Y-axis. Default is @code{2}.
  17560. @item intensity, i
  17561. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  17562. of color component which represents frequency of (X, Y) location in graph.
  17563. @item envelope, e
  17564. @table @samp
  17565. @item none
  17566. No envelope, this is default.
  17567. @item instant
  17568. Instant envelope, even darkest single pixel will be clearly highlighted.
  17569. @item peak
  17570. Hold maximum and minimum values presented in graph over time. This way you
  17571. can still spot out of range values without constantly looking at vectorscope.
  17572. @item peak+instant
  17573. Peak and instant envelope combined together.
  17574. @end table
  17575. @item graticule, g
  17576. Set what kind of graticule to draw.
  17577. @table @samp
  17578. @item none
  17579. @item green
  17580. @item color
  17581. @item invert
  17582. @end table
  17583. @item opacity, o
  17584. Set graticule opacity.
  17585. @item flags, f
  17586. Set graticule flags.
  17587. @table @samp
  17588. @item white
  17589. Draw graticule for white point.
  17590. @item black
  17591. Draw graticule for black point.
  17592. @item name
  17593. Draw color points short names.
  17594. @end table
  17595. @item bgopacity, b
  17596. Set background opacity.
  17597. @item lthreshold, l
  17598. Set low threshold for color component not represented on X or Y axis.
  17599. Values lower than this value will be ignored. Default is 0.
  17600. Note this value is multiplied with actual max possible value one pixel component
  17601. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  17602. is 0.1 * 255 = 25.
  17603. @item hthreshold, h
  17604. Set high threshold for color component not represented on X or Y axis.
  17605. Values higher than this value will be ignored. Default is 1.
  17606. Note this value is multiplied with actual max possible value one pixel component
  17607. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  17608. is 0.9 * 255 = 230.
  17609. @item colorspace, c
  17610. Set what kind of colorspace to use when drawing graticule.
  17611. @table @samp
  17612. @item auto
  17613. @item 601
  17614. @item 709
  17615. @end table
  17616. Default is auto.
  17617. @item tint0, t0
  17618. @item tint1, t1
  17619. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  17620. This means no tint, and output will remain gray.
  17621. @end table
  17622. @anchor{vidstabdetect}
  17623. @section vidstabdetect
  17624. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  17625. @ref{vidstabtransform} for pass 2.
  17626. This filter generates a file with relative translation and rotation
  17627. transform information about subsequent frames, which is then used by
  17628. the @ref{vidstabtransform} filter.
  17629. To enable compilation of this filter you need to configure FFmpeg with
  17630. @code{--enable-libvidstab}.
  17631. This filter accepts the following options:
  17632. @table @option
  17633. @item result
  17634. Set the path to the file used to write the transforms information.
  17635. Default value is @file{transforms.trf}.
  17636. @item shakiness
  17637. Set how shaky the video is and how quick the camera is. It accepts an
  17638. integer in the range 1-10, a value of 1 means little shakiness, a
  17639. value of 10 means strong shakiness. Default value is 5.
  17640. @item accuracy
  17641. Set the accuracy of the detection process. It must be a value in the
  17642. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  17643. accuracy. Default value is 15.
  17644. @item stepsize
  17645. Set stepsize of the search process. The region around minimum is
  17646. scanned with 1 pixel resolution. Default value is 6.
  17647. @item mincontrast
  17648. Set minimum contrast. Below this value a local measurement field is
  17649. discarded. Must be a floating point value in the range 0-1. Default
  17650. value is 0.3.
  17651. @item tripod
  17652. Set reference frame number for tripod mode.
  17653. If enabled, the motion of the frames is compared to a reference frame
  17654. in the filtered stream, identified by the specified number. The idea
  17655. is to compensate all movements in a more-or-less static scene and keep
  17656. the camera view absolutely still.
  17657. If set to 0, it is disabled. The frames are counted starting from 1.
  17658. @item show
  17659. Show fields and transforms in the resulting frames. It accepts an
  17660. integer in the range 0-2. Default value is 0, which disables any
  17661. visualization.
  17662. @end table
  17663. @subsection Examples
  17664. @itemize
  17665. @item
  17666. Use default values:
  17667. @example
  17668. vidstabdetect
  17669. @end example
  17670. @item
  17671. Analyze strongly shaky movie and put the results in file
  17672. @file{mytransforms.trf}:
  17673. @example
  17674. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  17675. @end example
  17676. @item
  17677. Visualize the result of internal transformations in the resulting
  17678. video:
  17679. @example
  17680. vidstabdetect=show=1
  17681. @end example
  17682. @item
  17683. Analyze a video with medium shakiness using @command{ffmpeg}:
  17684. @example
  17685. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  17686. @end example
  17687. @end itemize
  17688. @anchor{vidstabtransform}
  17689. @section vidstabtransform
  17690. Video stabilization/deshaking: pass 2 of 2,
  17691. see @ref{vidstabdetect} for pass 1.
  17692. Read a file with transform information for each frame and
  17693. apply/compensate them. Together with the @ref{vidstabdetect}
  17694. filter this can be used to deshake videos. See also
  17695. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  17696. the @ref{unsharp} filter, see below.
  17697. To enable compilation of this filter you need to configure FFmpeg with
  17698. @code{--enable-libvidstab}.
  17699. @subsection Options
  17700. @table @option
  17701. @item input
  17702. Set path to the file used to read the transforms. Default value is
  17703. @file{transforms.trf}.
  17704. @item smoothing
  17705. Set the number of frames (value*2 + 1) used for lowpass filtering the
  17706. camera movements. Default value is 10.
  17707. For example a number of 10 means that 21 frames are used (10 in the
  17708. past and 10 in the future) to smoothen the motion in the video. A
  17709. larger value leads to a smoother video, but limits the acceleration of
  17710. the camera (pan/tilt movements). 0 is a special case where a static
  17711. camera is simulated.
  17712. @item optalgo
  17713. Set the camera path optimization algorithm.
  17714. Accepted values are:
  17715. @table @samp
  17716. @item gauss
  17717. gaussian kernel low-pass filter on camera motion (default)
  17718. @item avg
  17719. averaging on transformations
  17720. @end table
  17721. @item maxshift
  17722. Set maximal number of pixels to translate frames. Default value is -1,
  17723. meaning no limit.
  17724. @item maxangle
  17725. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  17726. value is -1, meaning no limit.
  17727. @item crop
  17728. Specify how to deal with borders that may be visible due to movement
  17729. compensation.
  17730. Available values are:
  17731. @table @samp
  17732. @item keep
  17733. keep image information from previous frame (default)
  17734. @item black
  17735. fill the border black
  17736. @end table
  17737. @item invert
  17738. Invert transforms if set to 1. Default value is 0.
  17739. @item relative
  17740. Consider transforms as relative to previous frame if set to 1,
  17741. absolute if set to 0. Default value is 0.
  17742. @item zoom
  17743. Set percentage to zoom. A positive value will result in a zoom-in
  17744. effect, a negative value in a zoom-out effect. Default value is 0 (no
  17745. zoom).
  17746. @item optzoom
  17747. Set optimal zooming to avoid borders.
  17748. Accepted values are:
  17749. @table @samp
  17750. @item 0
  17751. disabled
  17752. @item 1
  17753. optimal static zoom value is determined (only very strong movements
  17754. will lead to visible borders) (default)
  17755. @item 2
  17756. optimal adaptive zoom value is determined (no borders will be
  17757. visible), see @option{zoomspeed}
  17758. @end table
  17759. Note that the value given at zoom is added to the one calculated here.
  17760. @item zoomspeed
  17761. Set percent to zoom maximally each frame (enabled when
  17762. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  17763. 0.25.
  17764. @item interpol
  17765. Specify type of interpolation.
  17766. Available values are:
  17767. @table @samp
  17768. @item no
  17769. no interpolation
  17770. @item linear
  17771. linear only horizontal
  17772. @item bilinear
  17773. linear in both directions (default)
  17774. @item bicubic
  17775. cubic in both directions (slow)
  17776. @end table
  17777. @item tripod
  17778. Enable virtual tripod mode if set to 1, which is equivalent to
  17779. @code{relative=0:smoothing=0}. Default value is 0.
  17780. Use also @code{tripod} option of @ref{vidstabdetect}.
  17781. @item debug
  17782. Increase log verbosity if set to 1. Also the detected global motions
  17783. are written to the temporary file @file{global_motions.trf}. Default
  17784. value is 0.
  17785. @end table
  17786. @subsection Examples
  17787. @itemize
  17788. @item
  17789. Use @command{ffmpeg} for a typical stabilization with default values:
  17790. @example
  17791. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  17792. @end example
  17793. Note the use of the @ref{unsharp} filter which is always recommended.
  17794. @item
  17795. Zoom in a bit more and load transform data from a given file:
  17796. @example
  17797. vidstabtransform=zoom=5:input="mytransforms.trf"
  17798. @end example
  17799. @item
  17800. Smoothen the video even more:
  17801. @example
  17802. vidstabtransform=smoothing=30
  17803. @end example
  17804. @end itemize
  17805. @section vflip
  17806. Flip the input video vertically.
  17807. For example, to vertically flip a video with @command{ffmpeg}:
  17808. @example
  17809. ffmpeg -i in.avi -vf "vflip" out.avi
  17810. @end example
  17811. @section vfrdet
  17812. Detect variable frame rate video.
  17813. This filter tries to detect if the input is variable or constant frame rate.
  17814. At end it will output number of frames detected as having variable delta pts,
  17815. and ones with constant delta pts.
  17816. If there was frames with variable delta, than it will also show min, max and
  17817. average delta encountered.
  17818. @section vibrance
  17819. Boost or alter saturation.
  17820. The filter accepts the following options:
  17821. @table @option
  17822. @item intensity
  17823. Set strength of boost if positive value or strength of alter if negative value.
  17824. Default is 0. Allowed range is from -2 to 2.
  17825. @item rbal
  17826. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  17827. @item gbal
  17828. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  17829. @item bbal
  17830. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  17831. @item rlum
  17832. Set the red luma coefficient.
  17833. @item glum
  17834. Set the green luma coefficient.
  17835. @item blum
  17836. Set the blue luma coefficient.
  17837. @item alternate
  17838. If @code{intensity} is negative and this is set to 1, colors will change,
  17839. otherwise colors will be less saturated, more towards gray.
  17840. @end table
  17841. @subsection Commands
  17842. This filter supports the all above options as @ref{commands}.
  17843. @section vif
  17844. Obtain the average VIF (Visual Information Fidelity) between two input videos.
  17845. This filter takes two input videos.
  17846. Both input videos must have the same resolution and pixel format for
  17847. this filter to work correctly. Also it assumes that both inputs
  17848. have the same number of frames, which are compared one by one.
  17849. The obtained average VIF score is printed through the logging system.
  17850. The filter stores the calculated VIF score of each frame.
  17851. In the below example the input file @file{main.mpg} being processed is compared
  17852. with the reference file @file{ref.mpg}.
  17853. @example
  17854. ffmpeg -i main.mpg -i ref.mpg -lavfi vif -f null -
  17855. @end example
  17856. @anchor{vignette}
  17857. @section vignette
  17858. Make or reverse a natural vignetting effect.
  17859. The filter accepts the following options:
  17860. @table @option
  17861. @item angle, a
  17862. Set lens angle expression as a number of radians.
  17863. The value is clipped in the @code{[0,PI/2]} range.
  17864. Default value: @code{"PI/5"}
  17865. @item x0
  17866. @item y0
  17867. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  17868. by default.
  17869. @item mode
  17870. Set forward/backward mode.
  17871. Available modes are:
  17872. @table @samp
  17873. @item forward
  17874. The larger the distance from the central point, the darker the image becomes.
  17875. @item backward
  17876. The larger the distance from the central point, the brighter the image becomes.
  17877. This can be used to reverse a vignette effect, though there is no automatic
  17878. detection to extract the lens @option{angle} and other settings (yet). It can
  17879. also be used to create a burning effect.
  17880. @end table
  17881. Default value is @samp{forward}.
  17882. @item eval
  17883. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  17884. It accepts the following values:
  17885. @table @samp
  17886. @item init
  17887. Evaluate expressions only once during the filter initialization.
  17888. @item frame
  17889. Evaluate expressions for each incoming frame. This is way slower than the
  17890. @samp{init} mode since it requires all the scalers to be re-computed, but it
  17891. allows advanced dynamic expressions.
  17892. @end table
  17893. Default value is @samp{init}.
  17894. @item dither
  17895. Set dithering to reduce the circular banding effects. Default is @code{1}
  17896. (enabled).
  17897. @item aspect
  17898. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  17899. Setting this value to the SAR of the input will make a rectangular vignetting
  17900. following the dimensions of the video.
  17901. Default is @code{1/1}.
  17902. @end table
  17903. @subsection Expressions
  17904. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  17905. following parameters.
  17906. @table @option
  17907. @item w
  17908. @item h
  17909. input width and height
  17910. @item n
  17911. the number of input frame, starting from 0
  17912. @item pts
  17913. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  17914. @var{TB} units, NAN if undefined
  17915. @item r
  17916. frame rate of the input video, NAN if the input frame rate is unknown
  17917. @item t
  17918. the PTS (Presentation TimeStamp) of the filtered video frame,
  17919. expressed in seconds, NAN if undefined
  17920. @item tb
  17921. time base of the input video
  17922. @end table
  17923. @subsection Examples
  17924. @itemize
  17925. @item
  17926. Apply simple strong vignetting effect:
  17927. @example
  17928. vignette=PI/4
  17929. @end example
  17930. @item
  17931. Make a flickering vignetting:
  17932. @example
  17933. vignette='PI/4+random(1)*PI/50':eval=frame
  17934. @end example
  17935. @end itemize
  17936. @section vmafmotion
  17937. Obtain the average VMAF motion score of a video.
  17938. It is one of the component metrics of VMAF.
  17939. The obtained average motion score is printed through the logging system.
  17940. The filter accepts the following options:
  17941. @table @option
  17942. @item stats_file
  17943. If specified, the filter will use the named file to save the motion score of
  17944. each frame with respect to the previous frame.
  17945. When filename equals "-" the data is sent to standard output.
  17946. @end table
  17947. Example:
  17948. @example
  17949. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  17950. @end example
  17951. @section vstack
  17952. Stack input videos vertically.
  17953. All streams must be of same pixel format and of same width.
  17954. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  17955. to create same output.
  17956. The filter accepts the following options:
  17957. @table @option
  17958. @item inputs
  17959. Set number of input streams. Default is 2.
  17960. @item shortest
  17961. If set to 1, force the output to terminate when the shortest input
  17962. terminates. Default value is 0.
  17963. @end table
  17964. @section w3fdif
  17965. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  17966. Deinterlacing Filter").
  17967. Based on the process described by Martin Weston for BBC R&D, and
  17968. implemented based on the de-interlace algorithm written by Jim
  17969. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  17970. uses filter coefficients calculated by BBC R&D.
  17971. This filter uses field-dominance information in frame to decide which
  17972. of each pair of fields to place first in the output.
  17973. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  17974. There are two sets of filter coefficients, so called "simple"
  17975. and "complex". Which set of filter coefficients is used can
  17976. be set by passing an optional parameter:
  17977. @table @option
  17978. @item filter
  17979. Set the interlacing filter coefficients. Accepts one of the following values:
  17980. @table @samp
  17981. @item simple
  17982. Simple filter coefficient set.
  17983. @item complex
  17984. More-complex filter coefficient set.
  17985. @end table
  17986. Default value is @samp{complex}.
  17987. @item mode
  17988. The interlacing mode to adopt. It accepts one of the following values:
  17989. @table @option
  17990. @item frame
  17991. Output one frame for each frame.
  17992. @item field
  17993. Output one frame for each field.
  17994. @end table
  17995. The default value is @code{field}.
  17996. @item parity
  17997. The picture field parity assumed for the input interlaced video. It accepts one
  17998. of the following values:
  17999. @table @option
  18000. @item tff
  18001. Assume the top field is first.
  18002. @item bff
  18003. Assume the bottom field is first.
  18004. @item auto
  18005. Enable automatic detection of field parity.
  18006. @end table
  18007. The default value is @code{auto}.
  18008. If the interlacing is unknown or the decoder does not export this information,
  18009. top field first will be assumed.
  18010. @item deint
  18011. Specify which frames to deinterlace. Accepts one of the following values:
  18012. @table @samp
  18013. @item all
  18014. Deinterlace all frames,
  18015. @item interlaced
  18016. Only deinterlace frames marked as interlaced.
  18017. @end table
  18018. Default value is @samp{all}.
  18019. @end table
  18020. @subsection Commands
  18021. This filter supports same @ref{commands} as options.
  18022. @section waveform
  18023. Video waveform monitor.
  18024. The waveform monitor plots color component intensity. By default luminance
  18025. only. Each column of the waveform corresponds to a column of pixels in the
  18026. source video.
  18027. It accepts the following options:
  18028. @table @option
  18029. @item mode, m
  18030. Can be either @code{row}, or @code{column}. Default is @code{column}.
  18031. In row mode, the graph on the left side represents color component value 0 and
  18032. the right side represents value = 255. In column mode, the top side represents
  18033. color component value = 0 and bottom side represents value = 255.
  18034. @item intensity, i
  18035. Set intensity. Smaller values are useful to find out how many values of the same
  18036. luminance are distributed across input rows/columns.
  18037. Default value is @code{0.04}. Allowed range is [0, 1].
  18038. @item mirror, r
  18039. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  18040. In mirrored mode, higher values will be represented on the left
  18041. side for @code{row} mode and at the top for @code{column} mode. Default is
  18042. @code{1} (mirrored).
  18043. @item display, d
  18044. Set display mode.
  18045. It accepts the following values:
  18046. @table @samp
  18047. @item overlay
  18048. Presents information identical to that in the @code{parade}, except
  18049. that the graphs representing color components are superimposed directly
  18050. over one another.
  18051. This display mode makes it easier to spot relative differences or similarities
  18052. in overlapping areas of the color components that are supposed to be identical,
  18053. such as neutral whites, grays, or blacks.
  18054. @item stack
  18055. Display separate graph for the color components side by side in
  18056. @code{row} mode or one below the other in @code{column} mode.
  18057. @item parade
  18058. Display separate graph for the color components side by side in
  18059. @code{column} mode or one below the other in @code{row} mode.
  18060. Using this display mode makes it easy to spot color casts in the highlights
  18061. and shadows of an image, by comparing the contours of the top and the bottom
  18062. graphs of each waveform. Since whites, grays, and blacks are characterized
  18063. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  18064. should display three waveforms of roughly equal width/height. If not, the
  18065. correction is easy to perform by making level adjustments the three waveforms.
  18066. @end table
  18067. Default is @code{stack}.
  18068. @item components, c
  18069. Set which color components to display. Default is 1, which means only luminance
  18070. or red color component if input is in RGB colorspace. If is set for example to
  18071. 7 it will display all 3 (if) available color components.
  18072. @item envelope, e
  18073. @table @samp
  18074. @item none
  18075. No envelope, this is default.
  18076. @item instant
  18077. Instant envelope, minimum and maximum values presented in graph will be easily
  18078. visible even with small @code{step} value.
  18079. @item peak
  18080. Hold minimum and maximum values presented in graph across time. This way you
  18081. can still spot out of range values without constantly looking at waveforms.
  18082. @item peak+instant
  18083. Peak and instant envelope combined together.
  18084. @end table
  18085. @item filter, f
  18086. @table @samp
  18087. @item lowpass
  18088. No filtering, this is default.
  18089. @item flat
  18090. Luma and chroma combined together.
  18091. @item aflat
  18092. Similar as above, but shows difference between blue and red chroma.
  18093. @item xflat
  18094. Similar as above, but use different colors.
  18095. @item yflat
  18096. Similar as above, but again with different colors.
  18097. @item chroma
  18098. Displays only chroma.
  18099. @item color
  18100. Displays actual color value on waveform.
  18101. @item acolor
  18102. Similar as above, but with luma showing frequency of chroma values.
  18103. @end table
  18104. @item graticule, g
  18105. Set which graticule to display.
  18106. @table @samp
  18107. @item none
  18108. Do not display graticule.
  18109. @item green
  18110. Display green graticule showing legal broadcast ranges.
  18111. @item orange
  18112. Display orange graticule showing legal broadcast ranges.
  18113. @item invert
  18114. Display invert graticule showing legal broadcast ranges.
  18115. @end table
  18116. @item opacity, o
  18117. Set graticule opacity.
  18118. @item flags, fl
  18119. Set graticule flags.
  18120. @table @samp
  18121. @item numbers
  18122. Draw numbers above lines. By default enabled.
  18123. @item dots
  18124. Draw dots instead of lines.
  18125. @end table
  18126. @item scale, s
  18127. Set scale used for displaying graticule.
  18128. @table @samp
  18129. @item digital
  18130. @item millivolts
  18131. @item ire
  18132. @end table
  18133. Default is digital.
  18134. @item bgopacity, b
  18135. Set background opacity.
  18136. @item tint0, t0
  18137. @item tint1, t1
  18138. Set tint for output.
  18139. Only used with lowpass filter and when display is not overlay and input
  18140. pixel formats are not RGB.
  18141. @item fitmode, fm
  18142. Set sample aspect ratio of video output frames.
  18143. Can be used to configure waveform so it is not
  18144. streched too much in one of directions.
  18145. @table @samp
  18146. @item none
  18147. Set sample aspect ration to 1/1.
  18148. @item size
  18149. Set sample aspect ratio to match input size of video
  18150. @end table
  18151. Default is @samp{none}.
  18152. @end table
  18153. @section weave, doubleweave
  18154. The @code{weave} takes a field-based video input and join
  18155. each two sequential fields into single frame, producing a new double
  18156. height clip with half the frame rate and half the frame count.
  18157. The @code{doubleweave} works same as @code{weave} but without
  18158. halving frame rate and frame count.
  18159. It accepts the following option:
  18160. @table @option
  18161. @item first_field
  18162. Set first field. Available values are:
  18163. @table @samp
  18164. @item top, t
  18165. Set the frame as top-field-first.
  18166. @item bottom, b
  18167. Set the frame as bottom-field-first.
  18168. @end table
  18169. @end table
  18170. @subsection Examples
  18171. @itemize
  18172. @item
  18173. Interlace video using @ref{select} and @ref{separatefields} filter:
  18174. @example
  18175. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  18176. @end example
  18177. @end itemize
  18178. @section xbr
  18179. Apply the xBR high-quality magnification filter which is designed for pixel
  18180. art. It follows a set of edge-detection rules, see
  18181. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  18182. It accepts the following option:
  18183. @table @option
  18184. @item n
  18185. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  18186. @code{3xBR} and @code{4} for @code{4xBR}.
  18187. Default is @code{3}.
  18188. @end table
  18189. @section xcorrelate
  18190. Apply normalized cross-correlation between first and second input video stream.
  18191. Second input video stream dimensions must be lower than first input video stream.
  18192. The filter accepts the following options:
  18193. @table @option
  18194. @item planes
  18195. Set which planes to process.
  18196. @item secondary
  18197. Set which secondary video frames will be processed from second input video stream,
  18198. can be @var{first} or @var{all}. Default is @var{all}.
  18199. @end table
  18200. The @code{xcorrelate} filter also supports the @ref{framesync} options.
  18201. @section xfade
  18202. Apply cross fade from one input video stream to another input video stream.
  18203. The cross fade is applied for specified duration.
  18204. Both inputs must be constant frame-rate and have the same resolution, pixel format,
  18205. frame rate and timebase.
  18206. The filter accepts the following options:
  18207. @table @option
  18208. @item transition
  18209. Set one of available transition effects:
  18210. @table @samp
  18211. @item custom
  18212. @item fade
  18213. @item wipeleft
  18214. @item wiperight
  18215. @item wipeup
  18216. @item wipedown
  18217. @item slideleft
  18218. @item slideright
  18219. @item slideup
  18220. @item slidedown
  18221. @item circlecrop
  18222. @item rectcrop
  18223. @item distance
  18224. @item fadeblack
  18225. @item fadewhite
  18226. @item radial
  18227. @item smoothleft
  18228. @item smoothright
  18229. @item smoothup
  18230. @item smoothdown
  18231. @item circleopen
  18232. @item circleclose
  18233. @item vertopen
  18234. @item vertclose
  18235. @item horzopen
  18236. @item horzclose
  18237. @item dissolve
  18238. @item pixelize
  18239. @item diagtl
  18240. @item diagtr
  18241. @item diagbl
  18242. @item diagbr
  18243. @item hlslice
  18244. @item hrslice
  18245. @item vuslice
  18246. @item vdslice
  18247. @item hblur
  18248. @item fadegrays
  18249. @item wipetl
  18250. @item wipetr
  18251. @item wipebl
  18252. @item wipebr
  18253. @item squeezeh
  18254. @item squeezev
  18255. @item zoomin
  18256. @end table
  18257. Default transition effect is fade.
  18258. @item duration
  18259. Set cross fade duration in seconds.
  18260. Range is 0 to 60 seconds.
  18261. Default duration is 1 second.
  18262. @item offset
  18263. Set cross fade start relative to first input stream in seconds.
  18264. Default offset is 0.
  18265. @item expr
  18266. Set expression for custom transition effect.
  18267. The expressions can use the following variables and functions:
  18268. @table @option
  18269. @item X
  18270. @item Y
  18271. The coordinates of the current sample.
  18272. @item W
  18273. @item H
  18274. The width and height of the image.
  18275. @item P
  18276. Progress of transition effect.
  18277. @item PLANE
  18278. Currently processed plane.
  18279. @item A
  18280. Return value of first input at current location and plane.
  18281. @item B
  18282. Return value of second input at current location and plane.
  18283. @item a0(x, y)
  18284. @item a1(x, y)
  18285. @item a2(x, y)
  18286. @item a3(x, y)
  18287. Return the value of the pixel at location (@var{x},@var{y}) of the
  18288. first/second/third/fourth component of first input.
  18289. @item b0(x, y)
  18290. @item b1(x, y)
  18291. @item b2(x, y)
  18292. @item b3(x, y)
  18293. Return the value of the pixel at location (@var{x},@var{y}) of the
  18294. first/second/third/fourth component of second input.
  18295. @end table
  18296. @end table
  18297. @subsection Examples
  18298. @itemize
  18299. @item
  18300. Cross fade from one input video to another input video, with fade transition and duration of transition
  18301. of 2 seconds starting at offset of 5 seconds:
  18302. @example
  18303. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  18304. @end example
  18305. @end itemize
  18306. @section xmedian
  18307. Pick median pixels from several input videos.
  18308. The filter accepts the following options:
  18309. @table @option
  18310. @item inputs
  18311. Set number of inputs.
  18312. Default is 3. Allowed range is from 3 to 255.
  18313. If number of inputs is even number, than result will be mean value between two median values.
  18314. @item planes
  18315. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  18316. @item percentile
  18317. Set median percentile. Default value is @code{0.5}.
  18318. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  18319. minimum values, and @code{1} maximum values.
  18320. @end table
  18321. @subsection Commands
  18322. This filter supports all above options as @ref{commands}, excluding option @code{inputs}.
  18323. @section xstack
  18324. Stack video inputs into custom layout.
  18325. All streams must be of same pixel format.
  18326. The filter accepts the following options:
  18327. @table @option
  18328. @item inputs
  18329. Set number of input streams. Default is 2.
  18330. @item layout
  18331. Specify layout of inputs.
  18332. This option requires the desired layout configuration to be explicitly set by the user.
  18333. This sets position of each video input in output. Each input
  18334. is separated by '|'.
  18335. The first number represents the column, and the second number represents the row.
  18336. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  18337. where X is video input from which to take width or height.
  18338. Multiple values can be used when separated by '+'. In such
  18339. case values are summed together.
  18340. Note that if inputs are of different sizes gaps may appear, as not all of
  18341. the output video frame will be filled. Similarly, videos can overlap each
  18342. other if their position doesn't leave enough space for the full frame of
  18343. adjoining videos.
  18344. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  18345. a layout must be set by the user.
  18346. @item shortest
  18347. If set to 1, force the output to terminate when the shortest input
  18348. terminates. Default value is 0.
  18349. @item fill
  18350. If set to valid color, all unused pixels will be filled with that color.
  18351. By default fill is set to none, so it is disabled.
  18352. @end table
  18353. @subsection Examples
  18354. @itemize
  18355. @item
  18356. Display 4 inputs into 2x2 grid.
  18357. Layout:
  18358. @example
  18359. input1(0, 0) | input3(w0, 0)
  18360. input2(0, h0) | input4(w0, h0)
  18361. @end example
  18362. @example
  18363. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  18364. @end example
  18365. Note that if inputs are of different sizes, gaps or overlaps may occur.
  18366. @item
  18367. Display 4 inputs into 1x4 grid.
  18368. Layout:
  18369. @example
  18370. input1(0, 0)
  18371. input2(0, h0)
  18372. input3(0, h0+h1)
  18373. input4(0, h0+h1+h2)
  18374. @end example
  18375. @example
  18376. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  18377. @end example
  18378. Note that if inputs are of different widths, unused space will appear.
  18379. @item
  18380. Display 9 inputs into 3x3 grid.
  18381. Layout:
  18382. @example
  18383. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  18384. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  18385. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  18386. @end example
  18387. @example
  18388. 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
  18389. @end example
  18390. Note that if inputs are of different sizes, gaps or overlaps may occur.
  18391. @item
  18392. Display 16 inputs into 4x4 grid.
  18393. Layout:
  18394. @example
  18395. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  18396. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  18397. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  18398. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  18399. @end example
  18400. @example
  18401. 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|
  18402. 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
  18403. @end example
  18404. Note that if inputs are of different sizes, gaps or overlaps may occur.
  18405. @end itemize
  18406. @anchor{yadif}
  18407. @section yadif
  18408. Deinterlace the input video ("yadif" means "yet another deinterlacing
  18409. filter").
  18410. It accepts the following parameters:
  18411. @table @option
  18412. @item mode
  18413. The interlacing mode to adopt. It accepts one of the following values:
  18414. @table @option
  18415. @item 0, send_frame
  18416. Output one frame for each frame.
  18417. @item 1, send_field
  18418. Output one frame for each field.
  18419. @item 2, send_frame_nospatial
  18420. Like @code{send_frame}, but it skips the spatial interlacing check.
  18421. @item 3, send_field_nospatial
  18422. Like @code{send_field}, but it skips the spatial interlacing check.
  18423. @end table
  18424. The default value is @code{send_frame}.
  18425. @item parity
  18426. The picture field parity assumed for the input interlaced video. It accepts one
  18427. of the following values:
  18428. @table @option
  18429. @item 0, tff
  18430. Assume the top field is first.
  18431. @item 1, bff
  18432. Assume the bottom field is first.
  18433. @item -1, auto
  18434. Enable automatic detection of field parity.
  18435. @end table
  18436. The default value is @code{auto}.
  18437. If the interlacing is unknown or the decoder does not export this information,
  18438. top field first will be assumed.
  18439. @item deint
  18440. Specify which frames to deinterlace. Accepts one of the following
  18441. values:
  18442. @table @option
  18443. @item 0, all
  18444. Deinterlace all frames.
  18445. @item 1, interlaced
  18446. Only deinterlace frames marked as interlaced.
  18447. @end table
  18448. The default value is @code{all}.
  18449. @end table
  18450. @section yadif_cuda
  18451. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  18452. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  18453. and/or nvenc.
  18454. It accepts the following parameters:
  18455. @table @option
  18456. @item mode
  18457. The interlacing mode to adopt. It accepts one of the following values:
  18458. @table @option
  18459. @item 0, send_frame
  18460. Output one frame for each frame.
  18461. @item 1, send_field
  18462. Output one frame for each field.
  18463. @item 2, send_frame_nospatial
  18464. Like @code{send_frame}, but it skips the spatial interlacing check.
  18465. @item 3, send_field_nospatial
  18466. Like @code{send_field}, but it skips the spatial interlacing check.
  18467. @end table
  18468. The default value is @code{send_frame}.
  18469. @item parity
  18470. The picture field parity assumed for the input interlaced video. It accepts one
  18471. of the following values:
  18472. @table @option
  18473. @item 0, tff
  18474. Assume the top field is first.
  18475. @item 1, bff
  18476. Assume the bottom field is first.
  18477. @item -1, auto
  18478. Enable automatic detection of field parity.
  18479. @end table
  18480. The default value is @code{auto}.
  18481. If the interlacing is unknown or the decoder does not export this information,
  18482. top field first will be assumed.
  18483. @item deint
  18484. Specify which frames to deinterlace. Accepts one of the following
  18485. values:
  18486. @table @option
  18487. @item 0, all
  18488. Deinterlace all frames.
  18489. @item 1, interlaced
  18490. Only deinterlace frames marked as interlaced.
  18491. @end table
  18492. The default value is @code{all}.
  18493. @end table
  18494. @section yaepblur
  18495. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  18496. The algorithm is described in
  18497. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  18498. It accepts the following parameters:
  18499. @table @option
  18500. @item radius, r
  18501. Set the window radius. Default value is 3.
  18502. @item planes, p
  18503. Set which planes to filter. Default is only the first plane.
  18504. @item sigma, s
  18505. Set blur strength. Default value is 128.
  18506. @end table
  18507. @subsection Commands
  18508. This filter supports same @ref{commands} as options.
  18509. @section zoompan
  18510. Apply Zoom & Pan effect.
  18511. This filter accepts the following options:
  18512. @table @option
  18513. @item zoom, z
  18514. Set the zoom expression. Range is 1-10. Default is 1.
  18515. @item x
  18516. @item y
  18517. Set the x and y expression. Default is 0.
  18518. @item d
  18519. Set the duration expression in number of frames.
  18520. This sets for how many number of frames effect will last for
  18521. single input image. Default is 90.
  18522. @item s
  18523. Set the output image size, default is 'hd720'.
  18524. @item fps
  18525. Set the output frame rate, default is '25'.
  18526. @end table
  18527. Each expression can contain the following constants:
  18528. @table @option
  18529. @item in_w, iw
  18530. Input width.
  18531. @item in_h, ih
  18532. Input height.
  18533. @item out_w, ow
  18534. Output width.
  18535. @item out_h, oh
  18536. Output height.
  18537. @item in
  18538. Input frame count.
  18539. @item on
  18540. Output frame count.
  18541. @item in_time, it
  18542. The input timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  18543. @item out_time, time, ot
  18544. The output timestamp expressed in seconds.
  18545. @item x
  18546. @item y
  18547. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  18548. for current input frame.
  18549. @item px
  18550. @item py
  18551. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  18552. not yet such frame (first input frame).
  18553. @item zoom
  18554. Last calculated zoom from 'z' expression for current input frame.
  18555. @item pzoom
  18556. Last calculated zoom of last output frame of previous input frame.
  18557. @item duration
  18558. Number of output frames for current input frame. Calculated from 'd' expression
  18559. for each input frame.
  18560. @item pduration
  18561. number of output frames created for previous input frame
  18562. @item a
  18563. Rational number: input width / input height
  18564. @item sar
  18565. sample aspect ratio
  18566. @item dar
  18567. display aspect ratio
  18568. @end table
  18569. @subsection Examples
  18570. @itemize
  18571. @item
  18572. Zoom in up to 1.5x and pan at same time to some spot near center of picture:
  18573. @example
  18574. 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
  18575. @end example
  18576. @item
  18577. Zoom in up to 1.5x and pan always at center of picture:
  18578. @example
  18579. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  18580. @end example
  18581. @item
  18582. Same as above but without pausing:
  18583. @example
  18584. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  18585. @end example
  18586. @item
  18587. Zoom in 2x into center of picture only for the first second of the input video:
  18588. @example
  18589. zoompan=z='if(between(in_time,0,1),2,1)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  18590. @end example
  18591. @end itemize
  18592. @anchor{zscale}
  18593. @section zscale
  18594. Scale (resize) the input video, using the z.lib library:
  18595. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  18596. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  18597. The zscale filter forces the output display aspect ratio to be the same
  18598. as the input, by changing the output sample aspect ratio.
  18599. If the input image format is different from the format requested by
  18600. the next filter, the zscale filter will convert the input to the
  18601. requested format.
  18602. @subsection Options
  18603. The filter accepts the following options.
  18604. @table @option
  18605. @item width, w
  18606. @item height, h
  18607. Set the output video dimension expression. Default value is the input
  18608. dimension.
  18609. If the @var{width} or @var{w} value is 0, the input width is used for
  18610. the output. If the @var{height} or @var{h} value is 0, the input height
  18611. is used for the output.
  18612. If one and only one of the values is -n with n >= 1, the zscale filter
  18613. will use a value that maintains the aspect ratio of the input image,
  18614. calculated from the other specified dimension. After that it will,
  18615. however, make sure that the calculated dimension is divisible by n and
  18616. adjust the value if necessary.
  18617. If both values are -n with n >= 1, the behavior will be identical to
  18618. both values being set to 0 as previously detailed.
  18619. See below for the list of accepted constants for use in the dimension
  18620. expression.
  18621. @item size, s
  18622. Set the video size. For the syntax of this option, check the
  18623. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18624. @item dither, d
  18625. Set the dither type.
  18626. Possible values are:
  18627. @table @var
  18628. @item none
  18629. @item ordered
  18630. @item random
  18631. @item error_diffusion
  18632. @end table
  18633. Default is none.
  18634. @item filter, f
  18635. Set the resize filter type.
  18636. Possible values are:
  18637. @table @var
  18638. @item point
  18639. @item bilinear
  18640. @item bicubic
  18641. @item spline16
  18642. @item spline36
  18643. @item lanczos
  18644. @end table
  18645. Default is bilinear.
  18646. @item range, r
  18647. Set the color range.
  18648. Possible values are:
  18649. @table @var
  18650. @item input
  18651. @item limited
  18652. @item full
  18653. @end table
  18654. Default is same as input.
  18655. @item primaries, p
  18656. Set the color primaries.
  18657. Possible values are:
  18658. @table @var
  18659. @item input
  18660. @item 709
  18661. @item unspecified
  18662. @item 170m
  18663. @item 240m
  18664. @item 2020
  18665. @end table
  18666. Default is same as input.
  18667. @item transfer, t
  18668. Set the transfer characteristics.
  18669. Possible values are:
  18670. @table @var
  18671. @item input
  18672. @item 709
  18673. @item unspecified
  18674. @item 601
  18675. @item linear
  18676. @item 2020_10
  18677. @item 2020_12
  18678. @item smpte2084
  18679. @item iec61966-2-1
  18680. @item arib-std-b67
  18681. @end table
  18682. Default is same as input.
  18683. @item matrix, m
  18684. Set the colorspace matrix.
  18685. Possible value are:
  18686. @table @var
  18687. @item input
  18688. @item 709
  18689. @item unspecified
  18690. @item 470bg
  18691. @item 170m
  18692. @item 2020_ncl
  18693. @item 2020_cl
  18694. @end table
  18695. Default is same as input.
  18696. @item rangein, rin
  18697. Set the input color range.
  18698. Possible values are:
  18699. @table @var
  18700. @item input
  18701. @item limited
  18702. @item full
  18703. @end table
  18704. Default is same as input.
  18705. @item primariesin, pin
  18706. Set the input color primaries.
  18707. Possible values are:
  18708. @table @var
  18709. @item input
  18710. @item 709
  18711. @item unspecified
  18712. @item 170m
  18713. @item 240m
  18714. @item 2020
  18715. @end table
  18716. Default is same as input.
  18717. @item transferin, tin
  18718. Set the input transfer characteristics.
  18719. Possible values are:
  18720. @table @var
  18721. @item input
  18722. @item 709
  18723. @item unspecified
  18724. @item 601
  18725. @item linear
  18726. @item 2020_10
  18727. @item 2020_12
  18728. @end table
  18729. Default is same as input.
  18730. @item matrixin, min
  18731. Set the input colorspace matrix.
  18732. Possible value are:
  18733. @table @var
  18734. @item input
  18735. @item 709
  18736. @item unspecified
  18737. @item 470bg
  18738. @item 170m
  18739. @item 2020_ncl
  18740. @item 2020_cl
  18741. @end table
  18742. @item chromal, c
  18743. Set the output chroma location.
  18744. Possible values are:
  18745. @table @var
  18746. @item input
  18747. @item left
  18748. @item center
  18749. @item topleft
  18750. @item top
  18751. @item bottomleft
  18752. @item bottom
  18753. @end table
  18754. @item chromalin, cin
  18755. Set the input chroma location.
  18756. Possible values are:
  18757. @table @var
  18758. @item input
  18759. @item left
  18760. @item center
  18761. @item topleft
  18762. @item top
  18763. @item bottomleft
  18764. @item bottom
  18765. @end table
  18766. @item npl
  18767. Set the nominal peak luminance.
  18768. @item param_a
  18769. Parameter A for scaling filters. Parameter "b" for bicubic, and the number of
  18770. filter taps for lanczos.
  18771. @item param_b
  18772. Parameter B for scaling filters. Parameter "c" for bicubic.
  18773. @end table
  18774. The values of the @option{w} and @option{h} options are expressions
  18775. containing the following constants:
  18776. @table @var
  18777. @item in_w
  18778. @item in_h
  18779. The input width and height
  18780. @item iw
  18781. @item ih
  18782. These are the same as @var{in_w} and @var{in_h}.
  18783. @item out_w
  18784. @item out_h
  18785. The output (scaled) width and height
  18786. @item ow
  18787. @item oh
  18788. These are the same as @var{out_w} and @var{out_h}
  18789. @item a
  18790. The same as @var{iw} / @var{ih}
  18791. @item sar
  18792. input sample aspect ratio
  18793. @item dar
  18794. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  18795. @item hsub
  18796. @item vsub
  18797. horizontal and vertical input chroma subsample values. For example for the
  18798. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  18799. @item ohsub
  18800. @item ovsub
  18801. horizontal and vertical output chroma subsample values. For example for the
  18802. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  18803. @end table
  18804. @subsection Commands
  18805. This filter supports the following commands:
  18806. @table @option
  18807. @item width, w
  18808. @item height, h
  18809. Set the output video dimension expression.
  18810. The command accepts the same syntax of the corresponding option.
  18811. If the specified expression is not valid, it is kept at its current
  18812. value.
  18813. @end table
  18814. @c man end VIDEO FILTERS
  18815. @chapter OpenCL Video Filters
  18816. @c man begin OPENCL VIDEO FILTERS
  18817. Below is a description of the currently available OpenCL video filters.
  18818. To enable compilation of these filters you need to configure FFmpeg with
  18819. @code{--enable-opencl}.
  18820. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  18821. @table @option
  18822. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  18823. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  18824. given device parameters.
  18825. @item -filter_hw_device @var{name}
  18826. Pass the hardware device called @var{name} to all filters in any filter graph.
  18827. @end table
  18828. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  18829. @itemize
  18830. @item
  18831. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  18832. @example
  18833. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  18834. @end example
  18835. @end itemize
  18836. 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.
  18837. @section avgblur_opencl
  18838. Apply average blur filter.
  18839. The filter accepts the following options:
  18840. @table @option
  18841. @item sizeX
  18842. Set horizontal radius size.
  18843. Range is @code{[1, 1024]} and default value is @code{1}.
  18844. @item planes
  18845. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  18846. @item sizeY
  18847. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  18848. @end table
  18849. @subsection Example
  18850. @itemize
  18851. @item
  18852. 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.
  18853. @example
  18854. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  18855. @end example
  18856. @end itemize
  18857. @section boxblur_opencl
  18858. Apply a boxblur algorithm to the input video.
  18859. It accepts the following parameters:
  18860. @table @option
  18861. @item luma_radius, lr
  18862. @item luma_power, lp
  18863. @item chroma_radius, cr
  18864. @item chroma_power, cp
  18865. @item alpha_radius, ar
  18866. @item alpha_power, ap
  18867. @end table
  18868. A description of the accepted options follows.
  18869. @table @option
  18870. @item luma_radius, lr
  18871. @item chroma_radius, cr
  18872. @item alpha_radius, ar
  18873. Set an expression for the box radius in pixels used for blurring the
  18874. corresponding input plane.
  18875. The radius value must be a non-negative number, and must not be
  18876. greater than the value of the expression @code{min(w,h)/2} for the
  18877. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  18878. planes.
  18879. Default value for @option{luma_radius} is "2". If not specified,
  18880. @option{chroma_radius} and @option{alpha_radius} default to the
  18881. corresponding value set for @option{luma_radius}.
  18882. The expressions can contain the following constants:
  18883. @table @option
  18884. @item w
  18885. @item h
  18886. The input width and height in pixels.
  18887. @item cw
  18888. @item ch
  18889. The input chroma image width and height in pixels.
  18890. @item hsub
  18891. @item vsub
  18892. The horizontal and vertical chroma subsample values. For example, for the
  18893. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  18894. @end table
  18895. @item luma_power, lp
  18896. @item chroma_power, cp
  18897. @item alpha_power, ap
  18898. Specify how many times the boxblur filter is applied to the
  18899. corresponding plane.
  18900. Default value for @option{luma_power} is 2. If not specified,
  18901. @option{chroma_power} and @option{alpha_power} default to the
  18902. corresponding value set for @option{luma_power}.
  18903. A value of 0 will disable the effect.
  18904. @end table
  18905. @subsection Examples
  18906. 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.
  18907. @itemize
  18908. @item
  18909. Apply a boxblur filter with the luma, chroma, and alpha radius
  18910. 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.
  18911. @example
  18912. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  18913. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  18914. @end example
  18915. @item
  18916. 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.
  18917. For the luma plane, a 2x2 box radius will be run once.
  18918. For the chroma plane, a 4x4 box radius will be run 5 times.
  18919. For the alpha plane, a 3x3 box radius will be run 7 times.
  18920. @example
  18921. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  18922. @end example
  18923. @end itemize
  18924. @section colorkey_opencl
  18925. RGB colorspace color keying.
  18926. The filter accepts the following options:
  18927. @table @option
  18928. @item color
  18929. The color which will be replaced with transparency.
  18930. @item similarity
  18931. Similarity percentage with the key color.
  18932. 0.01 matches only the exact key color, while 1.0 matches everything.
  18933. @item blend
  18934. Blend percentage.
  18935. 0.0 makes pixels either fully transparent, or not transparent at all.
  18936. Higher values result in semi-transparent pixels, with a higher transparency
  18937. the more similar the pixels color is to the key color.
  18938. @end table
  18939. @subsection Examples
  18940. @itemize
  18941. @item
  18942. Make every semi-green pixel in the input transparent with some slight blending:
  18943. @example
  18944. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  18945. @end example
  18946. @end itemize
  18947. @section convolution_opencl
  18948. Apply convolution of 3x3, 5x5, 7x7 matrix.
  18949. The filter accepts the following options:
  18950. @table @option
  18951. @item 0m
  18952. @item 1m
  18953. @item 2m
  18954. @item 3m
  18955. Set matrix for each plane.
  18956. Matrix is sequence of 9, 25 or 49 signed numbers.
  18957. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  18958. @item 0rdiv
  18959. @item 1rdiv
  18960. @item 2rdiv
  18961. @item 3rdiv
  18962. Set multiplier for calculated value for each plane.
  18963. If unset or 0, it will be sum of all matrix elements.
  18964. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  18965. @item 0bias
  18966. @item 1bias
  18967. @item 2bias
  18968. @item 3bias
  18969. Set bias for each plane. This value is added to the result of the multiplication.
  18970. Useful for making the overall image brighter or darker.
  18971. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  18972. @end table
  18973. @subsection Examples
  18974. @itemize
  18975. @item
  18976. Apply sharpen:
  18977. @example
  18978. -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
  18979. @end example
  18980. @item
  18981. Apply blur:
  18982. @example
  18983. -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
  18984. @end example
  18985. @item
  18986. Apply edge enhance:
  18987. @example
  18988. -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
  18989. @end example
  18990. @item
  18991. Apply edge detect:
  18992. @example
  18993. -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
  18994. @end example
  18995. @item
  18996. Apply laplacian edge detector which includes diagonals:
  18997. @example
  18998. -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
  18999. @end example
  19000. @item
  19001. Apply emboss:
  19002. @example
  19003. -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
  19004. @end example
  19005. @end itemize
  19006. @section erosion_opencl
  19007. Apply erosion effect to the video.
  19008. This filter replaces the pixel by the local(3x3) minimum.
  19009. It accepts the following options:
  19010. @table @option
  19011. @item threshold0
  19012. @item threshold1
  19013. @item threshold2
  19014. @item threshold3
  19015. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  19016. If @code{0}, plane will remain unchanged.
  19017. @item coordinates
  19018. Flag which specifies the pixel to refer to.
  19019. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  19020. Flags to local 3x3 coordinates region centered on @code{x}:
  19021. 1 2 3
  19022. 4 x 5
  19023. 6 7 8
  19024. @end table
  19025. @subsection Example
  19026. @itemize
  19027. @item
  19028. 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.
  19029. @example
  19030. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  19031. @end example
  19032. @end itemize
  19033. @section deshake_opencl
  19034. Feature-point based video stabilization filter.
  19035. The filter accepts the following options:
  19036. @table @option
  19037. @item tripod
  19038. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  19039. @item debug
  19040. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  19041. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  19042. Viewing point matches in the output video is only supported for RGB input.
  19043. Defaults to @code{0}.
  19044. @item adaptive_crop
  19045. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  19046. Defaults to @code{1}.
  19047. @item refine_features
  19048. Whether or not feature points should be refined at a sub-pixel level.
  19049. This can be turned off for a slight performance gain at the cost of precision.
  19050. Defaults to @code{1}.
  19051. @item smooth_strength
  19052. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  19053. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  19054. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  19055. Defaults to @code{0.0}.
  19056. @item smooth_window_multiplier
  19057. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  19058. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  19059. Acceptable values range from @code{0.1} to @code{10.0}.
  19060. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  19061. potentially improving smoothness, but also increase latency and memory usage.
  19062. Defaults to @code{2.0}.
  19063. @end table
  19064. @subsection Examples
  19065. @itemize
  19066. @item
  19067. Stabilize a video with a fixed, medium smoothing strength:
  19068. @example
  19069. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  19070. @end example
  19071. @item
  19072. Stabilize a video with debugging (both in console and in rendered video):
  19073. @example
  19074. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  19075. @end example
  19076. @end itemize
  19077. @section dilation_opencl
  19078. Apply dilation effect to the video.
  19079. This filter replaces the pixel by the local(3x3) maximum.
  19080. It accepts the following options:
  19081. @table @option
  19082. @item threshold0
  19083. @item threshold1
  19084. @item threshold2
  19085. @item threshold3
  19086. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  19087. If @code{0}, plane will remain unchanged.
  19088. @item coordinates
  19089. Flag which specifies the pixel to refer to.
  19090. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  19091. Flags to local 3x3 coordinates region centered on @code{x}:
  19092. 1 2 3
  19093. 4 x 5
  19094. 6 7 8
  19095. @end table
  19096. @subsection Example
  19097. @itemize
  19098. @item
  19099. 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.
  19100. @example
  19101. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  19102. @end example
  19103. @end itemize
  19104. @section nlmeans_opencl
  19105. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  19106. @section overlay_opencl
  19107. Overlay one video on top of another.
  19108. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  19109. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  19110. The filter accepts the following options:
  19111. @table @option
  19112. @item x
  19113. Set the x coordinate of the overlaid video on the main video.
  19114. Default value is @code{0}.
  19115. @item y
  19116. Set the y coordinate of the overlaid video on the main video.
  19117. Default value is @code{0}.
  19118. @end table
  19119. @subsection Examples
  19120. @itemize
  19121. @item
  19122. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  19123. @example
  19124. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  19125. @end example
  19126. @item
  19127. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  19128. @example
  19129. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  19130. @end example
  19131. @end itemize
  19132. @section pad_opencl
  19133. Add paddings to the input image, and place the original input at the
  19134. provided @var{x}, @var{y} coordinates.
  19135. It accepts the following options:
  19136. @table @option
  19137. @item width, w
  19138. @item height, h
  19139. Specify an expression for the size of the output image with the
  19140. paddings added. If the value for @var{width} or @var{height} is 0, the
  19141. corresponding input size is used for the output.
  19142. The @var{width} expression can reference the value set by the
  19143. @var{height} expression, and vice versa.
  19144. The default value of @var{width} and @var{height} is 0.
  19145. @item x
  19146. @item y
  19147. Specify the offsets to place the input image at within the padded area,
  19148. with respect to the top/left border of the output image.
  19149. The @var{x} expression can reference the value set by the @var{y}
  19150. expression, and vice versa.
  19151. The default value of @var{x} and @var{y} is 0.
  19152. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  19153. so the input image is centered on the padded area.
  19154. @item color
  19155. Specify the color of the padded area. For the syntax of this option,
  19156. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  19157. manual,ffmpeg-utils}.
  19158. @item aspect
  19159. Pad to an aspect instead to a resolution.
  19160. @end table
  19161. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  19162. options are expressions containing the following constants:
  19163. @table @option
  19164. @item in_w
  19165. @item in_h
  19166. The input video width and height.
  19167. @item iw
  19168. @item ih
  19169. These are the same as @var{in_w} and @var{in_h}.
  19170. @item out_w
  19171. @item out_h
  19172. The output width and height (the size of the padded area), as
  19173. specified by the @var{width} and @var{height} expressions.
  19174. @item ow
  19175. @item oh
  19176. These are the same as @var{out_w} and @var{out_h}.
  19177. @item x
  19178. @item y
  19179. The x and y offsets as specified by the @var{x} and @var{y}
  19180. expressions, or NAN if not yet specified.
  19181. @item a
  19182. same as @var{iw} / @var{ih}
  19183. @item sar
  19184. input sample aspect ratio
  19185. @item dar
  19186. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  19187. @end table
  19188. @section prewitt_opencl
  19189. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  19190. The filter accepts the following option:
  19191. @table @option
  19192. @item planes
  19193. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  19194. @item scale
  19195. Set value which will be multiplied with filtered result.
  19196. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  19197. @item delta
  19198. Set value which will be added to filtered result.
  19199. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  19200. @end table
  19201. @subsection Example
  19202. @itemize
  19203. @item
  19204. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  19205. @example
  19206. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  19207. @end example
  19208. @end itemize
  19209. @anchor{program_opencl}
  19210. @section program_opencl
  19211. Filter video using an OpenCL program.
  19212. @table @option
  19213. @item source
  19214. OpenCL program source file.
  19215. @item kernel
  19216. Kernel name in program.
  19217. @item inputs
  19218. Number of inputs to the filter. Defaults to 1.
  19219. @item size, s
  19220. Size of output frames. Defaults to the same as the first input.
  19221. @end table
  19222. The @code{program_opencl} filter also supports the @ref{framesync} options.
  19223. The program source file must contain a kernel function with the given name,
  19224. which will be run once for each plane of the output. Each run on a plane
  19225. gets enqueued as a separate 2D global NDRange with one work-item for each
  19226. pixel to be generated. The global ID offset for each work-item is therefore
  19227. the coordinates of a pixel in the destination image.
  19228. The kernel function needs to take the following arguments:
  19229. @itemize
  19230. @item
  19231. Destination image, @var{__write_only image2d_t}.
  19232. This image will become the output; the kernel should write all of it.
  19233. @item
  19234. Frame index, @var{unsigned int}.
  19235. This is a counter starting from zero and increasing by one for each frame.
  19236. @item
  19237. Source images, @var{__read_only image2d_t}.
  19238. These are the most recent images on each input. The kernel may read from
  19239. them to generate the output, but they can't be written to.
  19240. @end itemize
  19241. Example programs:
  19242. @itemize
  19243. @item
  19244. Copy the input to the output (output must be the same size as the input).
  19245. @verbatim
  19246. __kernel void copy(__write_only image2d_t destination,
  19247. unsigned int index,
  19248. __read_only image2d_t source)
  19249. {
  19250. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  19251. int2 location = (int2)(get_global_id(0), get_global_id(1));
  19252. float4 value = read_imagef(source, sampler, location);
  19253. write_imagef(destination, location, value);
  19254. }
  19255. @end verbatim
  19256. @item
  19257. Apply a simple transformation, rotating the input by an amount increasing
  19258. with the index counter. Pixel values are linearly interpolated by the
  19259. sampler, and the output need not have the same dimensions as the input.
  19260. @verbatim
  19261. __kernel void rotate_image(__write_only image2d_t dst,
  19262. unsigned int index,
  19263. __read_only image2d_t src)
  19264. {
  19265. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  19266. CLK_FILTER_LINEAR);
  19267. float angle = (float)index / 100.0f;
  19268. float2 dst_dim = convert_float2(get_image_dim(dst));
  19269. float2 src_dim = convert_float2(get_image_dim(src));
  19270. float2 dst_cen = dst_dim / 2.0f;
  19271. float2 src_cen = src_dim / 2.0f;
  19272. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  19273. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  19274. float2 src_pos = {
  19275. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  19276. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  19277. };
  19278. src_pos = src_pos * src_dim / dst_dim;
  19279. float2 src_loc = src_pos + src_cen;
  19280. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  19281. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  19282. write_imagef(dst, dst_loc, 0.5f);
  19283. else
  19284. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  19285. }
  19286. @end verbatim
  19287. @item
  19288. Blend two inputs together, with the amount of each input used varying
  19289. with the index counter.
  19290. @verbatim
  19291. __kernel void blend_images(__write_only image2d_t dst,
  19292. unsigned int index,
  19293. __read_only image2d_t src1,
  19294. __read_only image2d_t src2)
  19295. {
  19296. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  19297. CLK_FILTER_LINEAR);
  19298. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  19299. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  19300. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  19301. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  19302. float4 val1 = read_imagef(src1, sampler, src1_loc);
  19303. float4 val2 = read_imagef(src2, sampler, src2_loc);
  19304. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  19305. }
  19306. @end verbatim
  19307. @end itemize
  19308. @section roberts_opencl
  19309. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  19310. The filter accepts the following option:
  19311. @table @option
  19312. @item planes
  19313. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  19314. @item scale
  19315. Set value which will be multiplied with filtered result.
  19316. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  19317. @item delta
  19318. Set value which will be added to filtered result.
  19319. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  19320. @end table
  19321. @subsection Example
  19322. @itemize
  19323. @item
  19324. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  19325. @example
  19326. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  19327. @end example
  19328. @end itemize
  19329. @section sobel_opencl
  19330. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  19331. The filter accepts the following option:
  19332. @table @option
  19333. @item planes
  19334. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  19335. @item scale
  19336. Set value which will be multiplied with filtered result.
  19337. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  19338. @item delta
  19339. Set value which will be added to filtered result.
  19340. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  19341. @end table
  19342. @subsection Example
  19343. @itemize
  19344. @item
  19345. Apply sobel operator with scale set to 2 and delta set to 10
  19346. @example
  19347. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  19348. @end example
  19349. @end itemize
  19350. @section tonemap_opencl
  19351. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  19352. It accepts the following parameters:
  19353. @table @option
  19354. @item tonemap
  19355. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  19356. @item param
  19357. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  19358. @item desat
  19359. Apply desaturation for highlights that exceed this level of brightness. The
  19360. higher the parameter, the more color information will be preserved. This
  19361. setting helps prevent unnaturally blown-out colors for super-highlights, by
  19362. (smoothly) turning into white instead. This makes images feel more natural,
  19363. at the cost of reducing information about out-of-range colors.
  19364. The default value is 0.5, and the algorithm here is a little different from
  19365. the cpu version tonemap currently. A setting of 0.0 disables this option.
  19366. @item threshold
  19367. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  19368. is used to detect whether the scene has changed or not. If the distance between
  19369. the current frame average brightness and the current running average exceeds
  19370. a threshold value, we would re-calculate scene average and peak brightness.
  19371. The default value is 0.2.
  19372. @item format
  19373. Specify the output pixel format.
  19374. Currently supported formats are:
  19375. @table @var
  19376. @item p010
  19377. @item nv12
  19378. @end table
  19379. @item range, r
  19380. Set the output color range.
  19381. Possible values are:
  19382. @table @var
  19383. @item tv/mpeg
  19384. @item pc/jpeg
  19385. @end table
  19386. Default is same as input.
  19387. @item primaries, p
  19388. Set the output color primaries.
  19389. Possible values are:
  19390. @table @var
  19391. @item bt709
  19392. @item bt2020
  19393. @end table
  19394. Default is same as input.
  19395. @item transfer, t
  19396. Set the output transfer characteristics.
  19397. Possible values are:
  19398. @table @var
  19399. @item bt709
  19400. @item bt2020
  19401. @end table
  19402. Default is bt709.
  19403. @item matrix, m
  19404. Set the output colorspace matrix.
  19405. Possible value are:
  19406. @table @var
  19407. @item bt709
  19408. @item bt2020
  19409. @end table
  19410. Default is same as input.
  19411. @end table
  19412. @subsection Example
  19413. @itemize
  19414. @item
  19415. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  19416. @example
  19417. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  19418. @end example
  19419. @end itemize
  19420. @section unsharp_opencl
  19421. Sharpen or blur the input video.
  19422. It accepts the following parameters:
  19423. @table @option
  19424. @item luma_msize_x, lx
  19425. Set the luma matrix horizontal size.
  19426. Range is @code{[1, 23]} and default value is @code{5}.
  19427. @item luma_msize_y, ly
  19428. Set the luma matrix vertical size.
  19429. Range is @code{[1, 23]} and default value is @code{5}.
  19430. @item luma_amount, la
  19431. Set the luma effect strength.
  19432. Range is @code{[-10, 10]} and default value is @code{1.0}.
  19433. Negative values will blur the input video, while positive values will
  19434. sharpen it, a value of zero will disable the effect.
  19435. @item chroma_msize_x, cx
  19436. Set the chroma matrix horizontal size.
  19437. Range is @code{[1, 23]} and default value is @code{5}.
  19438. @item chroma_msize_y, cy
  19439. Set the chroma matrix vertical size.
  19440. Range is @code{[1, 23]} and default value is @code{5}.
  19441. @item chroma_amount, ca
  19442. Set the chroma effect strength.
  19443. Range is @code{[-10, 10]} and default value is @code{0.0}.
  19444. Negative values will blur the input video, while positive values will
  19445. sharpen it, a value of zero will disable the effect.
  19446. @end table
  19447. All parameters are optional and default to the equivalent of the
  19448. string '5:5:1.0:5:5:0.0'.
  19449. @subsection Examples
  19450. @itemize
  19451. @item
  19452. Apply strong luma sharpen effect:
  19453. @example
  19454. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  19455. @end example
  19456. @item
  19457. Apply a strong blur of both luma and chroma parameters:
  19458. @example
  19459. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  19460. @end example
  19461. @end itemize
  19462. @section xfade_opencl
  19463. Cross fade two videos with custom transition effect by using OpenCL.
  19464. It accepts the following options:
  19465. @table @option
  19466. @item transition
  19467. Set one of possible transition effects.
  19468. @table @option
  19469. @item custom
  19470. Select custom transition effect, the actual transition description
  19471. will be picked from source and kernel options.
  19472. @item fade
  19473. @item wipeleft
  19474. @item wiperight
  19475. @item wipeup
  19476. @item wipedown
  19477. @item slideleft
  19478. @item slideright
  19479. @item slideup
  19480. @item slidedown
  19481. Default transition is fade.
  19482. @end table
  19483. @item source
  19484. OpenCL program source file for custom transition.
  19485. @item kernel
  19486. Set name of kernel to use for custom transition from program source file.
  19487. @item duration
  19488. Set duration of video transition.
  19489. @item offset
  19490. Set time of start of transition relative to first video.
  19491. @end table
  19492. The program source file must contain a kernel function with the given name,
  19493. which will be run once for each plane of the output. Each run on a plane
  19494. gets enqueued as a separate 2D global NDRange with one work-item for each
  19495. pixel to be generated. The global ID offset for each work-item is therefore
  19496. the coordinates of a pixel in the destination image.
  19497. The kernel function needs to take the following arguments:
  19498. @itemize
  19499. @item
  19500. Destination image, @var{__write_only image2d_t}.
  19501. This image will become the output; the kernel should write all of it.
  19502. @item
  19503. First Source image, @var{__read_only image2d_t}.
  19504. Second Source image, @var{__read_only image2d_t}.
  19505. These are the most recent images on each input. The kernel may read from
  19506. them to generate the output, but they can't be written to.
  19507. @item
  19508. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  19509. @end itemize
  19510. Example programs:
  19511. @itemize
  19512. @item
  19513. Apply dots curtain transition effect:
  19514. @verbatim
  19515. __kernel void blend_images(__write_only image2d_t dst,
  19516. __read_only image2d_t src1,
  19517. __read_only image2d_t src2,
  19518. float progress)
  19519. {
  19520. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  19521. CLK_FILTER_LINEAR);
  19522. int2 p = (int2)(get_global_id(0), get_global_id(1));
  19523. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  19524. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  19525. rp = rp / dim;
  19526. float2 dots = (float2)(20.0, 20.0);
  19527. float2 center = (float2)(0,0);
  19528. float2 unused;
  19529. float4 val1 = read_imagef(src1, sampler, p);
  19530. float4 val2 = read_imagef(src2, sampler, p);
  19531. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  19532. write_imagef(dst, p, next ? val1 : val2);
  19533. }
  19534. @end verbatim
  19535. @end itemize
  19536. @c man end OPENCL VIDEO FILTERS
  19537. @chapter VAAPI Video Filters
  19538. @c man begin VAAPI VIDEO FILTERS
  19539. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  19540. To enable compilation of these filters you need to configure FFmpeg with
  19541. @code{--enable-vaapi}.
  19542. 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}
  19543. @section overlay_vaapi
  19544. Overlay one video on the top of another.
  19545. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  19546. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  19547. The filter accepts the following options:
  19548. @table @option
  19549. @item x
  19550. Set the x coordinate of the overlaid video on the main video.
  19551. Default value is @code{0}.
  19552. @item y
  19553. Set the y coordinate of the overlaid video on the main video.
  19554. Default value is @code{0}.
  19555. @item w
  19556. Set the width of the overlaid video on the main video.
  19557. Default value is the width of input overlay video.
  19558. @item h
  19559. Set the height of the overlaid video on the main video.
  19560. Default value is the height of input overlay video.
  19561. @item alpha
  19562. Set blocking detection thresholds. Allowed range is 0.0 to 1.0, it
  19563. requires an input video with alpha channel.
  19564. Default value is @code{0.0}.
  19565. @end table
  19566. @subsection Examples
  19567. @itemize
  19568. @item
  19569. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs for this filter are yuv420p format.
  19570. @example
  19571. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_vaapi" OUTPUT
  19572. @end example
  19573. @item
  19574. Overlay an image LOGO at the offset (200, 100) from the top-left corner of the INPUT video.
  19575. The inputs have same memory layout for color channels, the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  19576. @example
  19577. -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
  19578. @end example
  19579. @end itemize
  19580. @section tonemap_vaapi
  19581. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  19582. It maps the dynamic range of HDR10 content to the SDR content.
  19583. It currently only accepts HDR10 as input.
  19584. It accepts the following parameters:
  19585. @table @option
  19586. @item format
  19587. Specify the output pixel format.
  19588. Currently supported formats are:
  19589. @table @var
  19590. @item p010
  19591. @item nv12
  19592. @end table
  19593. Default is nv12.
  19594. @item primaries, p
  19595. Set the output color primaries.
  19596. Default is same as input.
  19597. @item transfer, t
  19598. Set the output transfer characteristics.
  19599. Default is bt709.
  19600. @item matrix, m
  19601. Set the output colorspace matrix.
  19602. Default is same as input.
  19603. @end table
  19604. @subsection Example
  19605. @itemize
  19606. @item
  19607. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  19608. @example
  19609. tonemap_vaapi=format=p010:t=bt2020-10
  19610. @end example
  19611. @end itemize
  19612. @c man end VAAPI VIDEO FILTERS
  19613. @chapter Video Sources
  19614. @c man begin VIDEO SOURCES
  19615. Below is a description of the currently available video sources.
  19616. @section buffer
  19617. Buffer video frames, and make them available to the filter chain.
  19618. This source is mainly intended for a programmatic use, in particular
  19619. through the interface defined in @file{libavfilter/buffersrc.h}.
  19620. It accepts the following parameters:
  19621. @table @option
  19622. @item video_size
  19623. Specify the size (width and height) of the buffered video frames. For the
  19624. syntax of this option, check the
  19625. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19626. @item width
  19627. The input video width.
  19628. @item height
  19629. The input video height.
  19630. @item pix_fmt
  19631. A string representing the pixel format of the buffered video frames.
  19632. It may be a number corresponding to a pixel format, or a pixel format
  19633. name.
  19634. @item time_base
  19635. Specify the timebase assumed by the timestamps of the buffered frames.
  19636. @item frame_rate
  19637. Specify the frame rate expected for the video stream.
  19638. @item pixel_aspect, sar
  19639. The sample (pixel) aspect ratio of the input video.
  19640. @item sws_param
  19641. This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};}
  19642. to the filtergraph description to specify swscale flags for automatically
  19643. inserted scalers. See @ref{Filtergraph syntax}.
  19644. @item hw_frames_ctx
  19645. When using a hardware pixel format, this should be a reference to an
  19646. AVHWFramesContext describing input frames.
  19647. @end table
  19648. For example:
  19649. @example
  19650. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  19651. @end example
  19652. will instruct the source to accept video frames with size 320x240 and
  19653. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  19654. square pixels (1:1 sample aspect ratio).
  19655. Since the pixel format with name "yuv410p" corresponds to the number 6
  19656. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  19657. this example corresponds to:
  19658. @example
  19659. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  19660. @end example
  19661. Alternatively, the options can be specified as a flat string, but this
  19662. syntax is deprecated:
  19663. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  19664. @section cellauto
  19665. Create a pattern generated by an elementary cellular automaton.
  19666. The initial state of the cellular automaton can be defined through the
  19667. @option{filename} and @option{pattern} options. If such options are
  19668. not specified an initial state is created randomly.
  19669. At each new frame a new row in the video is filled with the result of
  19670. the cellular automaton next generation. The behavior when the whole
  19671. frame is filled is defined by the @option{scroll} option.
  19672. This source accepts the following options:
  19673. @table @option
  19674. @item filename, f
  19675. Read the initial cellular automaton state, i.e. the starting row, from
  19676. the specified file.
  19677. In the file, each non-whitespace character is considered an alive
  19678. cell, a newline will terminate the row, and further characters in the
  19679. file will be ignored.
  19680. @item pattern, p
  19681. Read the initial cellular automaton state, i.e. the starting row, from
  19682. the specified string.
  19683. Each non-whitespace character in the string is considered an alive
  19684. cell, a newline will terminate the row, and further characters in the
  19685. string will be ignored.
  19686. @item rate, r
  19687. Set the video rate, that is the number of frames generated per second.
  19688. Default is 25.
  19689. @item random_fill_ratio, ratio
  19690. Set the random fill ratio for the initial cellular automaton row. It
  19691. is a floating point number value ranging from 0 to 1, defaults to
  19692. 1/PHI.
  19693. This option is ignored when a file or a pattern is specified.
  19694. @item random_seed, seed
  19695. Set the seed for filling randomly the initial row, must be an integer
  19696. included between 0 and UINT32_MAX. If not specified, or if explicitly
  19697. set to -1, the filter will try to use a good random seed on a best
  19698. effort basis.
  19699. @item rule
  19700. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  19701. Default value is 110.
  19702. @item size, s
  19703. Set the size of the output video. For the syntax of this option, check the
  19704. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19705. If @option{filename} or @option{pattern} is specified, the size is set
  19706. by default to the width of the specified initial state row, and the
  19707. height is set to @var{width} * PHI.
  19708. If @option{size} is set, it must contain the width of the specified
  19709. pattern string, and the specified pattern will be centered in the
  19710. larger row.
  19711. If a filename or a pattern string is not specified, the size value
  19712. defaults to "320x518" (used for a randomly generated initial state).
  19713. @item scroll
  19714. If set to 1, scroll the output upward when all the rows in the output
  19715. have been already filled. If set to 0, the new generated row will be
  19716. written over the top row just after the bottom row is filled.
  19717. Defaults to 1.
  19718. @item start_full, full
  19719. If set to 1, completely fill the output with generated rows before
  19720. outputting the first frame.
  19721. This is the default behavior, for disabling set the value to 0.
  19722. @item stitch
  19723. If set to 1, stitch the left and right row edges together.
  19724. This is the default behavior, for disabling set the value to 0.
  19725. @end table
  19726. @subsection Examples
  19727. @itemize
  19728. @item
  19729. Read the initial state from @file{pattern}, and specify an output of
  19730. size 200x400.
  19731. @example
  19732. cellauto=f=pattern:s=200x400
  19733. @end example
  19734. @item
  19735. Generate a random initial row with a width of 200 cells, with a fill
  19736. ratio of 2/3:
  19737. @example
  19738. cellauto=ratio=2/3:s=200x200
  19739. @end example
  19740. @item
  19741. Create a pattern generated by rule 18 starting by a single alive cell
  19742. centered on an initial row with width 100:
  19743. @example
  19744. cellauto=p=@@:s=100x400:full=0:rule=18
  19745. @end example
  19746. @item
  19747. Specify a more elaborated initial pattern:
  19748. @example
  19749. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  19750. @end example
  19751. @end itemize
  19752. @anchor{coreimagesrc}
  19753. @section coreimagesrc
  19754. Video source generated on GPU using Apple's CoreImage API on OSX.
  19755. This video source is a specialized version of the @ref{coreimage} video filter.
  19756. Use a core image generator at the beginning of the applied filterchain to
  19757. generate the content.
  19758. The coreimagesrc video source accepts the following options:
  19759. @table @option
  19760. @item list_generators
  19761. List all available generators along with all their respective options as well as
  19762. possible minimum and maximum values along with the default values.
  19763. @example
  19764. list_generators=true
  19765. @end example
  19766. @item size, s
  19767. Specify the size of the sourced video. For the syntax of this option, check the
  19768. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19769. The default value is @code{320x240}.
  19770. @item rate, r
  19771. Specify the frame rate of the sourced video, as the number of frames
  19772. generated per second. It has to be a string in the format
  19773. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  19774. number or a valid video frame rate abbreviation. The default value is
  19775. "25".
  19776. @item sar
  19777. Set the sample aspect ratio of the sourced video.
  19778. @item duration, d
  19779. Set the duration of the sourced video. See
  19780. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  19781. for the accepted syntax.
  19782. If not specified, or the expressed duration is negative, the video is
  19783. supposed to be generated forever.
  19784. @end table
  19785. Additionally, all options of the @ref{coreimage} video filter are accepted.
  19786. A complete filterchain can be used for further processing of the
  19787. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  19788. and examples for details.
  19789. @subsection Examples
  19790. @itemize
  19791. @item
  19792. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  19793. given as complete and escaped command-line for Apple's standard bash shell:
  19794. @example
  19795. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  19796. @end example
  19797. This example is equivalent to the QRCode example of @ref{coreimage} without the
  19798. need for a nullsrc video source.
  19799. @end itemize
  19800. @section gradients
  19801. Generate several gradients.
  19802. @table @option
  19803. @item size, s
  19804. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  19805. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  19806. @item rate, r
  19807. Set frame rate, expressed as number of frames per second. Default
  19808. value is "25".
  19809. @item c0, c1, c2, c3, c4, c5, c6, c7
  19810. Set 8 colors. Default values for colors is to pick random one.
  19811. @item x0, y0, y0, y1
  19812. Set gradient line source and destination points. If negative or out of range, random ones
  19813. are picked.
  19814. @item nb_colors, n
  19815. Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.
  19816. @item seed
  19817. Set seed for picking gradient line points.
  19818. @item duration, d
  19819. Set the duration of the sourced video. See
  19820. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  19821. for the accepted syntax.
  19822. If not specified, or the expressed duration is negative, the video is
  19823. supposed to be generated forever.
  19824. @item speed
  19825. Set speed of gradients rotation.
  19826. @item type, t
  19827. Set type of gradients, can be @code{linear} or @code{radial} or @code{circular} or @code{spiral}.
  19828. @end table
  19829. @section mandelbrot
  19830. Generate a Mandelbrot set fractal, and progressively zoom towards the
  19831. point specified with @var{start_x} and @var{start_y}.
  19832. This source accepts the following options:
  19833. @table @option
  19834. @item end_pts
  19835. Set the terminal pts value. Default value is 400.
  19836. @item end_scale
  19837. Set the terminal scale value.
  19838. Must be a floating point value. Default value is 0.3.
  19839. @item inner
  19840. Set the inner coloring mode, that is the algorithm used to draw the
  19841. Mandelbrot fractal internal region.
  19842. It shall assume one of the following values:
  19843. @table @option
  19844. @item black
  19845. Set black mode.
  19846. @item convergence
  19847. Show time until convergence.
  19848. @item mincol
  19849. Set color based on point closest to the origin of the iterations.
  19850. @item period
  19851. Set period mode.
  19852. @end table
  19853. Default value is @var{mincol}.
  19854. @item bailout
  19855. Set the bailout value. Default value is 10.0.
  19856. @item maxiter
  19857. Set the maximum of iterations performed by the rendering
  19858. algorithm. Default value is 7189.
  19859. @item outer
  19860. Set outer coloring mode.
  19861. It shall assume one of following values:
  19862. @table @option
  19863. @item iteration_count
  19864. Set iteration count mode.
  19865. @item normalized_iteration_count
  19866. set normalized iteration count mode.
  19867. @end table
  19868. Default value is @var{normalized_iteration_count}.
  19869. @item rate, r
  19870. Set frame rate, expressed as number of frames per second. Default
  19871. value is "25".
  19872. @item size, s
  19873. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  19874. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  19875. @item start_scale
  19876. Set the initial scale value. Default value is 3.0.
  19877. @item start_x
  19878. Set the initial x position. Must be a floating point value between
  19879. -100 and 100. Default value is -0.743643887037158704752191506114774.
  19880. @item start_y
  19881. Set the initial y position. Must be a floating point value between
  19882. -100 and 100. Default value is -0.131825904205311970493132056385139.
  19883. @end table
  19884. @section mptestsrc
  19885. Generate various test patterns, as generated by the MPlayer test filter.
  19886. The size of the generated video is fixed, and is 256x256.
  19887. This source is useful in particular for testing encoding features.
  19888. This source accepts the following options:
  19889. @table @option
  19890. @item rate, r
  19891. Specify the frame rate of the sourced video, as the number of frames
  19892. generated per second. It has to be a string in the format
  19893. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  19894. number or a valid video frame rate abbreviation. The default value is
  19895. "25".
  19896. @item duration, d
  19897. Set the duration of the sourced video. See
  19898. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  19899. for the accepted syntax.
  19900. If not specified, or the expressed duration is negative, the video is
  19901. supposed to be generated forever.
  19902. @item test, t
  19903. Set the number or the name of the test to perform. Supported tests are:
  19904. @table @option
  19905. @item dc_luma
  19906. @item dc_chroma
  19907. @item freq_luma
  19908. @item freq_chroma
  19909. @item amp_luma
  19910. @item amp_chroma
  19911. @item cbp
  19912. @item mv
  19913. @item ring1
  19914. @item ring2
  19915. @item all
  19916. @item max_frames, m
  19917. Set the maximum number of frames generated for each test, default value is 30.
  19918. @end table
  19919. Default value is "all", which will cycle through the list of all tests.
  19920. @end table
  19921. Some examples:
  19922. @example
  19923. mptestsrc=t=dc_luma
  19924. @end example
  19925. will generate a "dc_luma" test pattern.
  19926. @section frei0r_src
  19927. Provide a frei0r source.
  19928. To enable compilation of this filter you need to install the frei0r
  19929. header and configure FFmpeg with @code{--enable-frei0r}.
  19930. This source accepts the following parameters:
  19931. @table @option
  19932. @item size
  19933. The size of the video to generate. For the syntax of this option, check the
  19934. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19935. @item framerate
  19936. The framerate of the generated video. It may be a string of the form
  19937. @var{num}/@var{den} or a frame rate abbreviation.
  19938. @item filter_name
  19939. The name to the frei0r source to load. For more information regarding frei0r and
  19940. how to set the parameters, read the @ref{frei0r} section in the video filters
  19941. documentation.
  19942. @item filter_params
  19943. A '|'-separated list of parameters to pass to the frei0r source.
  19944. @end table
  19945. For example, to generate a frei0r partik0l source with size 200x200
  19946. and frame rate 10 which is overlaid on the overlay filter main input:
  19947. @example
  19948. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  19949. @end example
  19950. @section life
  19951. Generate a life pattern.
  19952. This source is based on a generalization of John Conway's life game.
  19953. The sourced input represents a life grid, each pixel represents a cell
  19954. which can be in one of two possible states, alive or dead. Every cell
  19955. interacts with its eight neighbours, which are the cells that are
  19956. horizontally, vertically, or diagonally adjacent.
  19957. At each interaction the grid evolves according to the adopted rule,
  19958. which specifies the number of neighbor alive cells which will make a
  19959. cell stay alive or born. The @option{rule} option allows one to specify
  19960. the rule to adopt.
  19961. This source accepts the following options:
  19962. @table @option
  19963. @item filename, f
  19964. Set the file from which to read the initial grid state. In the file,
  19965. each non-whitespace character is considered an alive cell, and newline
  19966. is used to delimit the end of each row.
  19967. If this option is not specified, the initial grid is generated
  19968. randomly.
  19969. @item rate, r
  19970. Set the video rate, that is the number of frames generated per second.
  19971. Default is 25.
  19972. @item random_fill_ratio, ratio
  19973. Set the random fill ratio for the initial random grid. It is a
  19974. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  19975. It is ignored when a file is specified.
  19976. @item random_seed, seed
  19977. Set the seed for filling the initial random grid, must be an integer
  19978. included between 0 and UINT32_MAX. If not specified, or if explicitly
  19979. set to -1, the filter will try to use a good random seed on a best
  19980. effort basis.
  19981. @item rule
  19982. Set the life rule.
  19983. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  19984. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  19985. @var{NS} specifies the number of alive neighbor cells which make a
  19986. live cell stay alive, and @var{NB} the number of alive neighbor cells
  19987. which make a dead cell to become alive (i.e. to "born").
  19988. "s" and "b" can be used in place of "S" and "B", respectively.
  19989. Alternatively a rule can be specified by an 18-bits integer. The 9
  19990. high order bits are used to encode the next cell state if it is alive
  19991. for each number of neighbor alive cells, the low order bits specify
  19992. the rule for "borning" new cells. Higher order bits encode for an
  19993. higher number of neighbor cells.
  19994. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  19995. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  19996. Default value is "S23/B3", which is the original Conway's game of life
  19997. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  19998. cells, and will born a new cell if there are three alive cells around
  19999. a dead cell.
  20000. @item size, s
  20001. Set the size of the output video. For the syntax of this option, check the
  20002. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20003. If @option{filename} is specified, the size is set by default to the
  20004. same size of the input file. If @option{size} is set, it must contain
  20005. the size specified in the input file, and the initial grid defined in
  20006. that file is centered in the larger resulting area.
  20007. If a filename is not specified, the size value defaults to "320x240"
  20008. (used for a randomly generated initial grid).
  20009. @item stitch
  20010. If set to 1, stitch the left and right grid edges together, and the
  20011. top and bottom edges also. Defaults to 1.
  20012. @item mold
  20013. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  20014. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  20015. value from 0 to 255.
  20016. @item life_color
  20017. Set the color of living (or new born) cells.
  20018. @item death_color
  20019. Set the color of dead cells. If @option{mold} is set, this is the first color
  20020. used to represent a dead cell.
  20021. @item mold_color
  20022. Set mold color, for definitely dead and moldy cells.
  20023. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  20024. ffmpeg-utils manual,ffmpeg-utils}.
  20025. @end table
  20026. @subsection Examples
  20027. @itemize
  20028. @item
  20029. Read a grid from @file{pattern}, and center it on a grid of size
  20030. 300x300 pixels:
  20031. @example
  20032. life=f=pattern:s=300x300
  20033. @end example
  20034. @item
  20035. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  20036. @example
  20037. life=ratio=2/3:s=200x200
  20038. @end example
  20039. @item
  20040. Specify a custom rule for evolving a randomly generated grid:
  20041. @example
  20042. life=rule=S14/B34
  20043. @end example
  20044. @item
  20045. Full example with slow death effect (mold) using @command{ffplay}:
  20046. @example
  20047. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  20048. @end example
  20049. @end itemize
  20050. @anchor{allrgb}
  20051. @anchor{allyuv}
  20052. @anchor{color}
  20053. @anchor{colorchart}
  20054. @anchor{colorspectrum}
  20055. @anchor{haldclutsrc}
  20056. @anchor{nullsrc}
  20057. @anchor{pal75bars}
  20058. @anchor{pal100bars}
  20059. @anchor{rgbtestsrc}
  20060. @anchor{smptebars}
  20061. @anchor{smptehdbars}
  20062. @anchor{testsrc}
  20063. @anchor{testsrc2}
  20064. @anchor{yuvtestsrc}
  20065. @section allrgb, allyuv, color, colorspectrum, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  20066. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  20067. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  20068. The @code{color} source provides an uniformly colored input.
  20069. The @code{colorchart} source provides a colors checker chart.
  20070. The @code{colorspectrum} source provides a color spectrum input.
  20071. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  20072. @ref{haldclut} filter.
  20073. The @code{nullsrc} source returns unprocessed video frames. It is
  20074. mainly useful to be employed in analysis / debugging tools, or as the
  20075. source for filters which ignore the input data.
  20076. The @code{pal75bars} source generates a color bars pattern, based on
  20077. EBU PAL recommendations with 75% color levels.
  20078. The @code{pal100bars} source generates a color bars pattern, based on
  20079. EBU PAL recommendations with 100% color levels.
  20080. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  20081. detecting RGB vs BGR issues. You should see a red, green and blue
  20082. stripe from top to bottom.
  20083. The @code{smptebars} source generates a color bars pattern, based on
  20084. the SMPTE Engineering Guideline EG 1-1990.
  20085. The @code{smptehdbars} source generates a color bars pattern, based on
  20086. the SMPTE RP 219-2002.
  20087. The @code{testsrc} source generates a test video pattern, showing a
  20088. color pattern, a scrolling gradient and a timestamp. This is mainly
  20089. intended for testing purposes.
  20090. The @code{testsrc2} source is similar to testsrc, but supports more
  20091. pixel formats instead of just @code{rgb24}. This allows using it as an
  20092. input for other tests without requiring a format conversion.
  20093. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  20094. see a y, cb and cr stripe from top to bottom.
  20095. The sources accept the following parameters:
  20096. @table @option
  20097. @item level
  20098. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  20099. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  20100. pixels to be used as identity matrix for 3D lookup tables. Each component is
  20101. coded on a @code{1/(N*N)} scale.
  20102. @item color, c
  20103. Specify the color of the source, only available in the @code{color}
  20104. source. For the syntax of this option, check the
  20105. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20106. @item size, s
  20107. Specify the size of the sourced video. For the syntax of this option, check the
  20108. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20109. The default value is @code{320x240}.
  20110. This option is not available with the @code{allrgb}, @code{allyuv}, and
  20111. @code{haldclutsrc} filters.
  20112. @item rate, r
  20113. Specify the frame rate of the sourced video, as the number of frames
  20114. generated per second. It has to be a string in the format
  20115. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  20116. number or a valid video frame rate abbreviation. The default value is
  20117. "25".
  20118. @item duration, d
  20119. Set the duration of the sourced video. See
  20120. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  20121. for the accepted syntax.
  20122. If not specified, or the expressed duration is negative, the video is
  20123. supposed to be generated forever.
  20124. Since the frame rate is used as time base, all frames including the last one
  20125. will have their full duration. If the specified duration is not a multiple
  20126. of the frame duration, it will be rounded up.
  20127. @item sar
  20128. Set the sample aspect ratio of the sourced video.
  20129. @item alpha
  20130. Specify the alpha (opacity) of the background, only available in the
  20131. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  20132. 255 (fully opaque, the default).
  20133. @item decimals, n
  20134. Set the number of decimals to show in the timestamp, only available in the
  20135. @code{testsrc} source.
  20136. The displayed timestamp value will correspond to the original
  20137. timestamp value multiplied by the power of 10 of the specified
  20138. value. Default value is 0.
  20139. @item type
  20140. Set the type of the color spectrum, only available in the
  20141. @code{colorspectrum} source. Can be one of the following:
  20142. @table @samp
  20143. @item black
  20144. @item white
  20145. @item all
  20146. @end table
  20147. @item patch_size
  20148. Set patch size of single color patch, only available in the
  20149. @code{colorchart} source. Default is @code{64x64}.
  20150. @item preset
  20151. Set colorchecker colors preset, only available in the
  20152. @code{colorchart} source.
  20153. Available values are:
  20154. @table @samp
  20155. @item reference
  20156. @item skintones
  20157. @end table
  20158. Default value is @code{reference}.
  20159. @end table
  20160. @subsection Examples
  20161. @itemize
  20162. @item
  20163. Generate a video with a duration of 5.3 seconds, with size
  20164. 176x144 and a frame rate of 10 frames per second:
  20165. @example
  20166. testsrc=duration=5.3:size=qcif:rate=10
  20167. @end example
  20168. @item
  20169. The following graph description will generate a red source
  20170. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  20171. frames per second:
  20172. @example
  20173. color=c=red@@0.2:s=qcif:r=10
  20174. @end example
  20175. @item
  20176. If the input content is to be ignored, @code{nullsrc} can be used. The
  20177. following command generates noise in the luminance plane by employing
  20178. the @code{geq} filter:
  20179. @example
  20180. nullsrc=s=256x256, geq=random(1)*255:128:128
  20181. @end example
  20182. @end itemize
  20183. @subsection Commands
  20184. The @code{color} source supports the following commands:
  20185. @table @option
  20186. @item c, color
  20187. Set the color of the created image. Accepts the same syntax of the
  20188. corresponding @option{color} option.
  20189. @end table
  20190. @section openclsrc
  20191. Generate video using an OpenCL program.
  20192. @table @option
  20193. @item source
  20194. OpenCL program source file.
  20195. @item kernel
  20196. Kernel name in program.
  20197. @item size, s
  20198. Size of frames to generate. This must be set.
  20199. @item format
  20200. Pixel format to use for the generated frames. This must be set.
  20201. @item rate, r
  20202. Number of frames generated every second. Default value is '25'.
  20203. @end table
  20204. For details of how the program loading works, see the @ref{program_opencl}
  20205. filter.
  20206. Example programs:
  20207. @itemize
  20208. @item
  20209. Generate a colour ramp by setting pixel values from the position of the pixel
  20210. in the output image. (Note that this will work with all pixel formats, but
  20211. the generated output will not be the same.)
  20212. @verbatim
  20213. __kernel void ramp(__write_only image2d_t dst,
  20214. unsigned int index)
  20215. {
  20216. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  20217. float4 val;
  20218. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  20219. write_imagef(dst, loc, val);
  20220. }
  20221. @end verbatim
  20222. @item
  20223. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  20224. @verbatim
  20225. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  20226. unsigned int index)
  20227. {
  20228. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  20229. float4 value = 0.0f;
  20230. int x = loc.x + index;
  20231. int y = loc.y + index;
  20232. while (x > 0 || y > 0) {
  20233. if (x % 3 == 1 && y % 3 == 1) {
  20234. value = 1.0f;
  20235. break;
  20236. }
  20237. x /= 3;
  20238. y /= 3;
  20239. }
  20240. write_imagef(dst, loc, value);
  20241. }
  20242. @end verbatim
  20243. @end itemize
  20244. @section sierpinski
  20245. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  20246. This source accepts the following options:
  20247. @table @option
  20248. @item size, s
  20249. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  20250. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  20251. @item rate, r
  20252. Set frame rate, expressed as number of frames per second. Default
  20253. value is "25".
  20254. @item seed
  20255. Set seed which is used for random panning.
  20256. @item jump
  20257. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  20258. @item type
  20259. Set fractal type, can be default @code{carpet} or @code{triangle}.
  20260. @end table
  20261. @c man end VIDEO SOURCES
  20262. @chapter Video Sinks
  20263. @c man begin VIDEO SINKS
  20264. Below is a description of the currently available video sinks.
  20265. @section buffersink
  20266. Buffer video frames, and make them available to the end of the filter
  20267. graph.
  20268. This sink is mainly intended for programmatic use, in particular
  20269. through the interface defined in @file{libavfilter/buffersink.h}
  20270. or the options system.
  20271. It accepts a pointer to an AVBufferSinkContext structure, which
  20272. defines the incoming buffers' formats, to be passed as the opaque
  20273. parameter to @code{avfilter_init_filter} for initialization.
  20274. @section nullsink
  20275. Null video sink: do absolutely nothing with the input video. It is
  20276. mainly useful as a template and for use in analysis / debugging
  20277. tools.
  20278. @c man end VIDEO SINKS
  20279. @chapter Multimedia Filters
  20280. @c man begin MULTIMEDIA FILTERS
  20281. Below is a description of the currently available multimedia filters.
  20282. @section abitscope
  20283. Convert input audio to a video output, displaying the audio bit scope.
  20284. The filter accepts the following options:
  20285. @table @option
  20286. @item rate, r
  20287. Set frame rate, expressed as number of frames per second. Default
  20288. value is "25".
  20289. @item size, s
  20290. Specify the video size for the output. For the syntax of this option, check the
  20291. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20292. Default value is @code{1024x256}.
  20293. @item colors
  20294. Specify list of colors separated by space or by '|' which will be used to
  20295. draw channels. Unrecognized or missing colors will be replaced
  20296. by white color.
  20297. @item mode, m
  20298. Set output mode. Can be @code{bars} or @code{trace}. Default is @code{bars}.
  20299. @end table
  20300. @section adrawgraph
  20301. Draw a graph using input audio metadata.
  20302. See @ref{drawgraph}
  20303. @section agraphmonitor
  20304. See @ref{graphmonitor}.
  20305. @section ahistogram
  20306. Convert input audio to a video output, displaying the volume histogram.
  20307. The filter accepts the following options:
  20308. @table @option
  20309. @item dmode
  20310. Specify how histogram is calculated.
  20311. It accepts the following values:
  20312. @table @samp
  20313. @item single
  20314. Use single histogram for all channels.
  20315. @item separate
  20316. Use separate histogram for each channel.
  20317. @end table
  20318. Default is @code{single}.
  20319. @item rate, r
  20320. Set frame rate, expressed as number of frames per second. Default
  20321. value is "25".
  20322. @item size, s
  20323. Specify the video size for the output. For the syntax of this option, check the
  20324. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20325. Default value is @code{hd720}.
  20326. @item scale
  20327. Set display scale.
  20328. It accepts the following values:
  20329. @table @samp
  20330. @item log
  20331. logarithmic
  20332. @item sqrt
  20333. square root
  20334. @item cbrt
  20335. cubic root
  20336. @item lin
  20337. linear
  20338. @item rlog
  20339. reverse logarithmic
  20340. @end table
  20341. Default is @code{log}.
  20342. @item ascale
  20343. Set amplitude scale.
  20344. It accepts the following values:
  20345. @table @samp
  20346. @item log
  20347. logarithmic
  20348. @item lin
  20349. linear
  20350. @end table
  20351. Default is @code{log}.
  20352. @item acount
  20353. Set how much frames to accumulate in histogram.
  20354. Default is 1. Setting this to -1 accumulates all frames.
  20355. @item rheight
  20356. Set histogram ratio of window height.
  20357. @item slide
  20358. Set sonogram sliding.
  20359. It accepts the following values:
  20360. @table @samp
  20361. @item replace
  20362. replace old rows with new ones.
  20363. @item scroll
  20364. scroll from top to bottom.
  20365. @end table
  20366. Default is @code{replace}.
  20367. @item hmode
  20368. Set histogram mode.
  20369. It accepts the following values:
  20370. @table @samp
  20371. @item abs
  20372. Use absolute values of samples.
  20373. @item sign
  20374. Use untouched values of samples.
  20375. @end table
  20376. Default is @code{abs}.
  20377. @end table
  20378. @section aphasemeter
  20379. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  20380. representing mean phase of current audio frame. A video output can also be produced and is
  20381. enabled by default. The audio is passed through as first output.
  20382. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  20383. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  20384. and @code{1} means channels are in phase.
  20385. The filter accepts the following options, all related to its video output:
  20386. @table @option
  20387. @item rate, r
  20388. Set the output frame rate. Default value is @code{25}.
  20389. @item size, s
  20390. Set the video size for the output. For the syntax of this option, check the
  20391. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20392. Default value is @code{800x400}.
  20393. @item rc
  20394. @item gc
  20395. @item bc
  20396. Specify the red, green, blue contrast. Default values are @code{2},
  20397. @code{7} and @code{1}.
  20398. Allowed range is @code{[0, 255]}.
  20399. @item mpc
  20400. Set color which will be used for drawing median phase. If color is
  20401. @code{none} which is default, no median phase value will be drawn.
  20402. @item video
  20403. Enable video output. Default is enabled.
  20404. @end table
  20405. @subsection phasing detection
  20406. The filter also detects out of phase and mono sequences in stereo streams.
  20407. It logs the sequence start, end and duration when it lasts longer or as long as the minimum set.
  20408. The filter accepts the following options for this detection:
  20409. @table @option
  20410. @item phasing
  20411. Enable mono and out of phase detection. Default is disabled.
  20412. @item tolerance, t
  20413. Set phase tolerance for mono detection, in amplitude ratio. Default is @code{0}.
  20414. Allowed range is @code{[0, 1]}.
  20415. @item angle, a
  20416. Set angle threshold for out of phase detection, in degree. Default is @code{170}.
  20417. Allowed range is @code{[90, 180]}.
  20418. @item duration, d
  20419. Set mono or out of phase duration until notification, expressed in seconds. Default is @code{2}.
  20420. @end table
  20421. @subsection Examples
  20422. @itemize
  20423. @item
  20424. Complete example with @command{ffmpeg} to detect 1 second of mono with 0.001 phase tolerance:
  20425. @example
  20426. ffmpeg -i stereo.wav -af aphasemeter=video=0:phasing=1:duration=1:tolerance=0.001 -f null -
  20427. @end example
  20428. @end itemize
  20429. @section avectorscope
  20430. Convert input audio to a video output, representing the audio vector
  20431. scope.
  20432. The filter is used to measure the difference between channels of stereo
  20433. audio stream. A monaural signal, consisting of identical left and right
  20434. signal, results in straight vertical line. Any stereo separation is visible
  20435. as a deviation from this line, creating a Lissajous figure.
  20436. If the straight (or deviation from it) but horizontal line appears this
  20437. indicates that the left and right channels are out of phase.
  20438. The filter accepts the following options:
  20439. @table @option
  20440. @item mode, m
  20441. Set the vectorscope mode.
  20442. Available values are:
  20443. @table @samp
  20444. @item lissajous
  20445. Lissajous rotated by 45 degrees.
  20446. @item lissajous_xy
  20447. Same as above but not rotated.
  20448. @item polar
  20449. Shape resembling half of circle.
  20450. @end table
  20451. Default value is @samp{lissajous}.
  20452. @item size, s
  20453. Set the video size for the output. For the syntax of this option, check the
  20454. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20455. Default value is @code{400x400}.
  20456. @item rate, r
  20457. Set the output frame rate. Default value is @code{25}.
  20458. @item rc
  20459. @item gc
  20460. @item bc
  20461. @item ac
  20462. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  20463. @code{160}, @code{80} and @code{255}.
  20464. Allowed range is @code{[0, 255]}.
  20465. @item rf
  20466. @item gf
  20467. @item bf
  20468. @item af
  20469. Specify the red, green, blue and alpha fade. Default values are @code{15},
  20470. @code{10}, @code{5} and @code{5}.
  20471. Allowed range is @code{[0, 255]}.
  20472. @item zoom
  20473. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  20474. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  20475. @item draw
  20476. Set the vectorscope drawing mode.
  20477. Available values are:
  20478. @table @samp
  20479. @item dot
  20480. Draw dot for each sample.
  20481. @item line
  20482. Draw line between previous and current sample.
  20483. @end table
  20484. Default value is @samp{dot}.
  20485. @item scale
  20486. Specify amplitude scale of audio samples.
  20487. Available values are:
  20488. @table @samp
  20489. @item lin
  20490. Linear.
  20491. @item sqrt
  20492. Square root.
  20493. @item cbrt
  20494. Cubic root.
  20495. @item log
  20496. Logarithmic.
  20497. @end table
  20498. @item swap
  20499. Swap left channel axis with right channel axis.
  20500. @item mirror
  20501. Mirror axis.
  20502. @table @samp
  20503. @item none
  20504. No mirror.
  20505. @item x
  20506. Mirror only x axis.
  20507. @item y
  20508. Mirror only y axis.
  20509. @item xy
  20510. Mirror both axis.
  20511. @end table
  20512. @end table
  20513. @subsection Examples
  20514. @itemize
  20515. @item
  20516. Complete example using @command{ffplay}:
  20517. @example
  20518. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  20519. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  20520. @end example
  20521. @end itemize
  20522. @subsection Commands
  20523. This filter supports the all above options as commands except options @code{size} and @code{rate}.
  20524. @section bench, abench
  20525. Benchmark part of a filtergraph.
  20526. The filter accepts the following options:
  20527. @table @option
  20528. @item action
  20529. Start or stop a timer.
  20530. Available values are:
  20531. @table @samp
  20532. @item start
  20533. Get the current time, set it as frame metadata (using the key
  20534. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  20535. @item stop
  20536. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  20537. the input frame metadata to get the time difference. Time difference, average,
  20538. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  20539. @code{min}) are then printed. The timestamps are expressed in seconds.
  20540. @end table
  20541. @end table
  20542. @subsection Examples
  20543. @itemize
  20544. @item
  20545. Benchmark @ref{selectivecolor} filter:
  20546. @example
  20547. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  20548. @end example
  20549. @end itemize
  20550. @section concat
  20551. Concatenate audio and video streams, joining them together one after the
  20552. other.
  20553. The filter works on segments of synchronized video and audio streams. All
  20554. segments must have the same number of streams of each type, and that will
  20555. also be the number of streams at output.
  20556. The filter accepts the following options:
  20557. @table @option
  20558. @item n
  20559. Set the number of segments. Default is 2.
  20560. @item v
  20561. Set the number of output video streams, that is also the number of video
  20562. streams in each segment. Default is 1.
  20563. @item a
  20564. Set the number of output audio streams, that is also the number of audio
  20565. streams in each segment. Default is 0.
  20566. @item unsafe
  20567. Activate unsafe mode: do not fail if segments have a different format.
  20568. @end table
  20569. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  20570. @var{a} audio outputs.
  20571. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  20572. segment, in the same order as the outputs, then the inputs for the second
  20573. segment, etc.
  20574. Related streams do not always have exactly the same duration, for various
  20575. reasons including codec frame size or sloppy authoring. For that reason,
  20576. related synchronized streams (e.g. a video and its audio track) should be
  20577. concatenated at once. The concat filter will use the duration of the longest
  20578. stream in each segment (except the last one), and if necessary pad shorter
  20579. audio streams with silence.
  20580. For this filter to work correctly, all segments must start at timestamp 0.
  20581. All corresponding streams must have the same parameters in all segments; the
  20582. filtering system will automatically select a common pixel format for video
  20583. streams, and a common sample format, sample rate and channel layout for
  20584. audio streams, but other settings, such as resolution, must be converted
  20585. explicitly by the user.
  20586. Different frame rates are acceptable but will result in variable frame rate
  20587. at output; be sure to configure the output file to handle it.
  20588. @subsection Examples
  20589. @itemize
  20590. @item
  20591. Concatenate an opening, an episode and an ending, all in bilingual version
  20592. (video in stream 0, audio in streams 1 and 2):
  20593. @example
  20594. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  20595. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  20596. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  20597. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  20598. @end example
  20599. @item
  20600. Concatenate two parts, handling audio and video separately, using the
  20601. (a)movie sources, and adjusting the resolution:
  20602. @example
  20603. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  20604. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  20605. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  20606. @end example
  20607. Note that a desync will happen at the stitch if the audio and video streams
  20608. do not have exactly the same duration in the first file.
  20609. @end itemize
  20610. @subsection Commands
  20611. This filter supports the following commands:
  20612. @table @option
  20613. @item next
  20614. Close the current segment and step to the next one
  20615. @end table
  20616. @anchor{ebur128}
  20617. @section ebur128
  20618. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  20619. level. By default, it logs a message at a frequency of 10Hz with the
  20620. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  20621. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  20622. The filter can only analyze streams which have
  20623. sample format is double-precision floating point. The input stream will be converted to
  20624. this specification, if needed. Users may need to insert aformat and/or aresample filters
  20625. after this filter to obtain the original parameters.
  20626. The filter also has a video output (see the @var{video} option) with a real
  20627. time graph to observe the loudness evolution. The graphic contains the logged
  20628. message mentioned above, so it is not printed anymore when this option is set,
  20629. unless the verbose logging is set. The main graphing area contains the
  20630. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  20631. the momentary loudness (400 milliseconds), but can optionally be configured
  20632. to instead display short-term loudness (see @var{gauge}).
  20633. The green area marks a +/- 1LU target range around the target loudness
  20634. (-23LUFS by default, unless modified through @var{target}).
  20635. More information about the Loudness Recommendation EBU R128 on
  20636. @url{http://tech.ebu.ch/loudness}.
  20637. The filter accepts the following options:
  20638. @table @option
  20639. @item video
  20640. Activate the video output. The audio stream is passed unchanged whether this
  20641. option is set or no. The video stream will be the first output stream if
  20642. activated. Default is @code{0}.
  20643. @item size
  20644. Set the video size. This option is for video only. For the syntax of this
  20645. option, check the
  20646. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20647. Default and minimum resolution is @code{640x480}.
  20648. @item meter
  20649. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  20650. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  20651. other integer value between this range is allowed.
  20652. @item metadata
  20653. Set metadata injection. If set to @code{1}, the audio input will be segmented
  20654. into 100ms output frames, each of them containing various loudness information
  20655. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  20656. Default is @code{0}.
  20657. @item framelog
  20658. Force the frame logging level.
  20659. Available values are:
  20660. @table @samp
  20661. @item info
  20662. information logging level
  20663. @item verbose
  20664. verbose logging level
  20665. @end table
  20666. By default, the logging level is set to @var{info}. If the @option{video} or
  20667. the @option{metadata} options are set, it switches to @var{verbose}.
  20668. @item peak
  20669. Set peak mode(s).
  20670. Available modes can be cumulated (the option is a @code{flag} type). Possible
  20671. values are:
  20672. @table @samp
  20673. @item none
  20674. Disable any peak mode (default).
  20675. @item sample
  20676. Enable sample-peak mode.
  20677. Simple peak mode looking for the higher sample value. It logs a message
  20678. for sample-peak (identified by @code{SPK}).
  20679. @item true
  20680. Enable true-peak mode.
  20681. If enabled, the peak lookup is done on an over-sampled version of the input
  20682. stream for better peak accuracy. It logs a message for true-peak.
  20683. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  20684. This mode requires a build with @code{libswresample}.
  20685. @end table
  20686. @item dualmono
  20687. Treat mono input files as "dual mono". If a mono file is intended for playback
  20688. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  20689. If set to @code{true}, this option will compensate for this effect.
  20690. Multi-channel input files are not affected by this option.
  20691. @item panlaw
  20692. Set a specific pan law to be used for the measurement of dual mono files.
  20693. This parameter is optional, and has a default value of -3.01dB.
  20694. @item target
  20695. Set a specific target level (in LUFS) used as relative zero in the visualization.
  20696. This parameter is optional and has a default value of -23LUFS as specified
  20697. by EBU R128. However, material published online may prefer a level of -16LUFS
  20698. (e.g. for use with podcasts or video platforms).
  20699. @item gauge
  20700. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  20701. @code{shortterm}. By default the momentary value will be used, but in certain
  20702. scenarios it may be more useful to observe the short term value instead (e.g.
  20703. live mixing).
  20704. @item scale
  20705. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  20706. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  20707. video output, not the summary or continuous log output.
  20708. @end table
  20709. @subsection Examples
  20710. @itemize
  20711. @item
  20712. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  20713. @example
  20714. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  20715. @end example
  20716. @item
  20717. Run an analysis with @command{ffmpeg}:
  20718. @example
  20719. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  20720. @end example
  20721. @end itemize
  20722. @section interleave, ainterleave
  20723. Temporally interleave frames from several inputs.
  20724. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  20725. These filters read frames from several inputs and send the oldest
  20726. queued frame to the output.
  20727. Input streams must have well defined, monotonically increasing frame
  20728. timestamp values.
  20729. In order to submit one frame to output, these filters need to enqueue
  20730. at least one frame for each input, so they cannot work in case one
  20731. input is not yet terminated and will not receive incoming frames.
  20732. For example consider the case when one input is a @code{select} filter
  20733. which always drops input frames. The @code{interleave} filter will keep
  20734. reading from that input, but it will never be able to send new frames
  20735. to output until the input sends an end-of-stream signal.
  20736. Also, depending on inputs synchronization, the filters will drop
  20737. frames in case one input receives more frames than the other ones, and
  20738. the queue is already filled.
  20739. These filters accept the following options:
  20740. @table @option
  20741. @item nb_inputs, n
  20742. Set the number of different inputs, it is 2 by default.
  20743. @item duration
  20744. How to determine the end-of-stream.
  20745. @table @option
  20746. @item longest
  20747. The duration of the longest input. (default)
  20748. @item shortest
  20749. The duration of the shortest input.
  20750. @item first
  20751. The duration of the first input.
  20752. @end table
  20753. @end table
  20754. @subsection Examples
  20755. @itemize
  20756. @item
  20757. Interleave frames belonging to different streams using @command{ffmpeg}:
  20758. @example
  20759. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  20760. @end example
  20761. @item
  20762. Add flickering blur effect:
  20763. @example
  20764. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  20765. @end example
  20766. @end itemize
  20767. @section latency, alatency
  20768. Measure filtering latency.
  20769. Report previous filter filtering latency, delay in number of audio samples for audio filters
  20770. or number of video frames for video filters.
  20771. On end of input stream, filter will report min and max measured latency for previous running filter
  20772. in filtergraph.
  20773. @section metadata, ametadata
  20774. Manipulate frame metadata.
  20775. This filter accepts the following options:
  20776. @table @option
  20777. @item mode
  20778. Set mode of operation of the filter.
  20779. Can be one of the following:
  20780. @table @samp
  20781. @item select
  20782. If both @code{value} and @code{key} is set, select frames
  20783. which have such metadata. If only @code{key} is set, select
  20784. every frame that has such key in metadata.
  20785. @item add
  20786. Add new metadata @code{key} and @code{value}. If key is already available
  20787. do nothing.
  20788. @item modify
  20789. Modify value of already present key.
  20790. @item delete
  20791. If @code{value} is set, delete only keys that have such value.
  20792. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  20793. the frame.
  20794. @item print
  20795. Print key and its value if metadata was found. If @code{key} is not set print all
  20796. metadata values available in frame.
  20797. @end table
  20798. @item key
  20799. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  20800. @item value
  20801. Set metadata value which will be used. This option is mandatory for
  20802. @code{modify} and @code{add} mode.
  20803. @item function
  20804. Which function to use when comparing metadata value and @code{value}.
  20805. Can be one of following:
  20806. @table @samp
  20807. @item same_str
  20808. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  20809. @item starts_with
  20810. Values are interpreted as strings, returns true if metadata value starts with
  20811. the @code{value} option string.
  20812. @item less
  20813. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  20814. @item equal
  20815. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  20816. @item greater
  20817. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  20818. @item expr
  20819. Values are interpreted as floats, returns true if expression from option @code{expr}
  20820. evaluates to true.
  20821. @item ends_with
  20822. Values are interpreted as strings, returns true if metadata value ends with
  20823. the @code{value} option string.
  20824. @end table
  20825. @item expr
  20826. Set expression which is used when @code{function} is set to @code{expr}.
  20827. The expression is evaluated through the eval API and can contain the following
  20828. constants:
  20829. @table @option
  20830. @item VALUE1, FRAMEVAL
  20831. Float representation of @code{value} from metadata key.
  20832. @item VALUE2, USERVAL
  20833. Float representation of @code{value} as supplied by user in @code{value} option.
  20834. @end table
  20835. @item file
  20836. If specified in @code{print} mode, output is written to the named file. Instead of
  20837. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  20838. for standard output. If @code{file} option is not set, output is written to the log
  20839. with AV_LOG_INFO loglevel.
  20840. @item direct
  20841. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  20842. @end table
  20843. @subsection Examples
  20844. @itemize
  20845. @item
  20846. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  20847. between 0 and 1.
  20848. @example
  20849. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  20850. @end example
  20851. @item
  20852. Print silencedetect output to file @file{metadata.txt}.
  20853. @example
  20854. silencedetect,ametadata=mode=print:file=metadata.txt
  20855. @end example
  20856. @item
  20857. Direct all metadata to a pipe with file descriptor 4.
  20858. @example
  20859. metadata=mode=print:file='pipe\:4'
  20860. @end example
  20861. @end itemize
  20862. @section perms, aperms
  20863. Set read/write permissions for the output frames.
  20864. These filters are mainly aimed at developers to test direct path in the
  20865. following filter in the filtergraph.
  20866. The filters accept the following options:
  20867. @table @option
  20868. @item mode
  20869. Select the permissions mode.
  20870. It accepts the following values:
  20871. @table @samp
  20872. @item none
  20873. Do nothing. This is the default.
  20874. @item ro
  20875. Set all the output frames read-only.
  20876. @item rw
  20877. Set all the output frames directly writable.
  20878. @item toggle
  20879. Make the frame read-only if writable, and writable if read-only.
  20880. @item random
  20881. Set each output frame read-only or writable randomly.
  20882. @end table
  20883. @item seed
  20884. Set the seed for the @var{random} mode, must be an integer included between
  20885. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  20886. @code{-1}, the filter will try to use a good random seed on a best effort
  20887. basis.
  20888. @end table
  20889. Note: in case of auto-inserted filter between the permission filter and the
  20890. following one, the permission might not be received as expected in that
  20891. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  20892. perms/aperms filter can avoid this problem.
  20893. @section realtime, arealtime
  20894. Slow down filtering to match real time approximately.
  20895. These filters will pause the filtering for a variable amount of time to
  20896. match the output rate with the input timestamps.
  20897. They are similar to the @option{re} option to @code{ffmpeg}.
  20898. They accept the following options:
  20899. @table @option
  20900. @item limit
  20901. Time limit for the pauses. Any pause longer than that will be considered
  20902. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  20903. @item speed
  20904. Speed factor for processing. The value must be a float larger than zero.
  20905. Values larger than 1.0 will result in faster than realtime processing,
  20906. smaller will slow processing down. The @var{limit} is automatically adapted
  20907. accordingly. Default is 1.0.
  20908. A processing speed faster than what is possible without these filters cannot
  20909. be achieved.
  20910. @end table
  20911. @subsection Commands
  20912. Both filters supports the all above options as @ref{commands}.
  20913. @section segment, asegment
  20914. Split single input stream into multiple streams.
  20915. This filter does opposite of concat filters.
  20916. @code{segment} works on video frames, @code{asegment} on audio samples.
  20917. This filter accepts the following options:
  20918. @table @option
  20919. @item timestamps
  20920. Timestamps of output segments separated by '|'. The first segment will run
  20921. from the beginning of the input stream. The last segment will run until
  20922. the end of the input stream
  20923. @item frames, samples
  20924. Exact frame/sample count to split the segments.
  20925. @end table
  20926. In all cases, prefixing an each segment with '+' will make it relative to the
  20927. previous segment.
  20928. @subsection Examples
  20929. @itemize
  20930. @item
  20931. Split input audio stream into three output audio streams, starting at start of input audio stream
  20932. and storing that in 1st output audio stream, then following at 60th second and storing than in 2nd
  20933. output audio stream, and last after 150th second of input audio stream store in 3rd output audio stream:
  20934. @example
  20935. asegment=timestamps="60|150"
  20936. @end example
  20937. @end itemize
  20938. @anchor{select}
  20939. @section select, aselect
  20940. Select frames to pass in output.
  20941. This filter accepts the following options:
  20942. @table @option
  20943. @item expr, e
  20944. Set expression, which is evaluated for each input frame.
  20945. If the expression is evaluated to zero, the frame is discarded.
  20946. If the evaluation result is negative or NaN, the frame is sent to the
  20947. first output; otherwise it is sent to the output with index
  20948. @code{ceil(val)-1}, assuming that the input index starts from 0.
  20949. For example a value of @code{1.2} corresponds to the output with index
  20950. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  20951. @item outputs, n
  20952. Set the number of outputs. The output to which to send the selected
  20953. frame is based on the result of the evaluation. Default value is 1.
  20954. @end table
  20955. The expression can contain the following constants:
  20956. @table @option
  20957. @item n
  20958. The (sequential) number of the filtered frame, starting from 0.
  20959. @item selected_n
  20960. The (sequential) number of the selected frame, starting from 0.
  20961. @item prev_selected_n
  20962. The sequential number of the last selected frame. It's NAN if undefined.
  20963. @item TB
  20964. The timebase of the input timestamps.
  20965. @item pts
  20966. The PTS (Presentation TimeStamp) of the filtered frame,
  20967. expressed in @var{TB} units. It's NAN if undefined.
  20968. @item t
  20969. The PTS of the filtered frame,
  20970. expressed in seconds. It's NAN if undefined.
  20971. @item prev_pts
  20972. The PTS of the previously filtered frame. It's NAN if undefined.
  20973. @item prev_selected_pts
  20974. The PTS of the last previously filtered frame. It's NAN if undefined.
  20975. @item prev_selected_t
  20976. The PTS of the last previously selected frame, expressed in seconds. It's NAN if undefined.
  20977. @item start_pts
  20978. The first PTS in the stream which is not NAN. It remains NAN if not found.
  20979. @item start_t
  20980. The first PTS, in seconds, in the stream which is not NAN. It remains NAN if not found.
  20981. @item pict_type @emph{(video only)}
  20982. The type of the filtered frame. It can assume one of the following
  20983. values:
  20984. @table @option
  20985. @item I
  20986. @item P
  20987. @item B
  20988. @item S
  20989. @item SI
  20990. @item SP
  20991. @item BI
  20992. @end table
  20993. @item interlace_type @emph{(video only)}
  20994. The frame interlace type. It can assume one of the following values:
  20995. @table @option
  20996. @item PROGRESSIVE
  20997. The frame is progressive (not interlaced).
  20998. @item TOPFIRST
  20999. The frame is top-field-first.
  21000. @item BOTTOMFIRST
  21001. The frame is bottom-field-first.
  21002. @end table
  21003. @item consumed_sample_n @emph{(audio only)}
  21004. the number of selected samples before the current frame
  21005. @item samples_n @emph{(audio only)}
  21006. the number of samples in the current frame
  21007. @item sample_rate @emph{(audio only)}
  21008. the input sample rate
  21009. @item key
  21010. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  21011. @item pos
  21012. the position in the file of the filtered frame, -1 if the information
  21013. is not available (e.g. for synthetic video)
  21014. @item scene @emph{(video only)}
  21015. value between 0 and 1 to indicate a new scene; a low value reflects a low
  21016. probability for the current frame to introduce a new scene, while a higher
  21017. value means the current frame is more likely to be one (see the example below)
  21018. @item concatdec_select
  21019. The concat demuxer can select only part of a concat input file by setting an
  21020. inpoint and an outpoint, but the output packets may not be entirely contained
  21021. in the selected interval. By using this variable, it is possible to skip frames
  21022. generated by the concat demuxer which are not exactly contained in the selected
  21023. interval.
  21024. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  21025. and the @var{lavf.concat.duration} packet metadata values which are also
  21026. present in the decoded frames.
  21027. The @var{concatdec_select} variable is -1 if the frame pts is at least
  21028. start_time and either the duration metadata is missing or the frame pts is less
  21029. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  21030. missing.
  21031. That basically means that an input frame is selected if its pts is within the
  21032. interval set by the concat demuxer.
  21033. @end table
  21034. The default value of the select expression is "1".
  21035. @subsection Examples
  21036. @itemize
  21037. @item
  21038. Select all frames in input:
  21039. @example
  21040. select
  21041. @end example
  21042. The example above is the same as:
  21043. @example
  21044. select=1
  21045. @end example
  21046. @item
  21047. Skip all frames:
  21048. @example
  21049. select=0
  21050. @end example
  21051. @item
  21052. Select only I-frames:
  21053. @example
  21054. select='eq(pict_type\,I)'
  21055. @end example
  21056. @item
  21057. Select one frame every 100:
  21058. @example
  21059. select='not(mod(n\,100))'
  21060. @end example
  21061. @item
  21062. Select only frames contained in the 10-20 time interval:
  21063. @example
  21064. select=between(t\,10\,20)
  21065. @end example
  21066. @item
  21067. Select only I-frames contained in the 10-20 time interval:
  21068. @example
  21069. select=between(t\,10\,20)*eq(pict_type\,I)
  21070. @end example
  21071. @item
  21072. Select frames with a minimum distance of 10 seconds:
  21073. @example
  21074. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  21075. @end example
  21076. @item
  21077. Use aselect to select only audio frames with samples number > 100:
  21078. @example
  21079. aselect='gt(samples_n\,100)'
  21080. @end example
  21081. @item
  21082. Create a mosaic of the first scenes:
  21083. @example
  21084. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  21085. @end example
  21086. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  21087. choice.
  21088. @item
  21089. Send even and odd frames to separate outputs, and compose them:
  21090. @example
  21091. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  21092. @end example
  21093. @item
  21094. Select useful frames from an ffconcat file which is using inpoints and
  21095. outpoints but where the source files are not intra frame only.
  21096. @example
  21097. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  21098. @end example
  21099. @end itemize
  21100. @section sendcmd, asendcmd
  21101. Send commands to filters in the filtergraph.
  21102. These filters read commands to be sent to other filters in the
  21103. filtergraph.
  21104. @code{sendcmd} must be inserted between two video filters,
  21105. @code{asendcmd} must be inserted between two audio filters, but apart
  21106. from that they act the same way.
  21107. The specification of commands can be provided in the filter arguments
  21108. with the @var{commands} option, or in a file specified by the
  21109. @var{filename} option.
  21110. These filters accept the following options:
  21111. @table @option
  21112. @item commands, c
  21113. Set the commands to be read and sent to the other filters.
  21114. @item filename, f
  21115. Set the filename of the commands to be read and sent to the other
  21116. filters.
  21117. @end table
  21118. @subsection Commands syntax
  21119. A commands description consists of a sequence of interval
  21120. specifications, comprising a list of commands to be executed when a
  21121. particular event related to that interval occurs. The occurring event
  21122. is typically the current frame time entering or leaving a given time
  21123. interval.
  21124. An interval is specified by the following syntax:
  21125. @example
  21126. @var{START}[-@var{END}] @var{COMMANDS};
  21127. @end example
  21128. The time interval is specified by the @var{START} and @var{END} times.
  21129. @var{END} is optional and defaults to the maximum time.
  21130. The current frame time is considered within the specified interval if
  21131. it is included in the interval [@var{START}, @var{END}), that is when
  21132. the time is greater or equal to @var{START} and is lesser than
  21133. @var{END}.
  21134. @var{COMMANDS} consists of a sequence of one or more command
  21135. specifications, separated by ",", relating to that interval. The
  21136. syntax of a command specification is given by:
  21137. @example
  21138. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  21139. @end example
  21140. @var{FLAGS} is optional and specifies the type of events relating to
  21141. the time interval which enable sending the specified command, and must
  21142. be a non-null sequence of identifier flags separated by "+" or "|" and
  21143. enclosed between "[" and "]".
  21144. The following flags are recognized:
  21145. @table @option
  21146. @item enter
  21147. The command is sent when the current frame timestamp enters the
  21148. specified interval. In other words, the command is sent when the
  21149. previous frame timestamp was not in the given interval, and the
  21150. current is.
  21151. @item leave
  21152. The command is sent when the current frame timestamp leaves the
  21153. specified interval. In other words, the command is sent when the
  21154. previous frame timestamp was in the given interval, and the
  21155. current is not.
  21156. @item expr
  21157. The command @var{ARG} is interpreted as expression and result of
  21158. expression is passed as @var{ARG}.
  21159. The expression is evaluated through the eval API and can contain the following
  21160. constants:
  21161. @table @option
  21162. @item POS
  21163. Original position in the file of the frame, or undefined if undefined
  21164. for the current frame.
  21165. @item PTS
  21166. The presentation timestamp in input.
  21167. @item N
  21168. The count of the input frame for video or audio, starting from 0.
  21169. @item T
  21170. The time in seconds of the current frame.
  21171. @item TS
  21172. The start time in seconds of the current command interval.
  21173. @item TE
  21174. The end time in seconds of the current command interval.
  21175. @item TI
  21176. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  21177. @item W
  21178. The video frame width.
  21179. @item H
  21180. The video frame height.
  21181. @end table
  21182. @end table
  21183. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  21184. assumed.
  21185. @var{TARGET} specifies the target of the command, usually the name of
  21186. the filter class or a specific filter instance name.
  21187. @var{COMMAND} specifies the name of the command for the target filter.
  21188. @var{ARG} is optional and specifies the optional list of argument for
  21189. the given @var{COMMAND}.
  21190. Between one interval specification and another, whitespaces, or
  21191. sequences of characters starting with @code{#} until the end of line,
  21192. are ignored and can be used to annotate comments.
  21193. A simplified BNF description of the commands specification syntax
  21194. follows:
  21195. @example
  21196. @var{COMMAND_FLAG} ::= "enter" | "leave"
  21197. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  21198. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  21199. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  21200. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  21201. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  21202. @end example
  21203. @subsection Examples
  21204. @itemize
  21205. @item
  21206. Specify audio tempo change at second 4:
  21207. @example
  21208. asendcmd=c='4.0 atempo tempo 1.5',atempo
  21209. @end example
  21210. @item
  21211. Target a specific filter instance:
  21212. @example
  21213. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  21214. @end example
  21215. @item
  21216. Specify a list of drawtext and hue commands in a file.
  21217. @example
  21218. # show text in the interval 5-10
  21219. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  21220. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  21221. # desaturate the image in the interval 15-20
  21222. 15.0-20.0 [enter] hue s 0,
  21223. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  21224. [leave] hue s 1,
  21225. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  21226. # apply an exponential saturation fade-out effect, starting from time 25
  21227. 25 [enter] hue s exp(25-t)
  21228. @end example
  21229. A filtergraph allowing to read and process the above command list
  21230. stored in a file @file{test.cmd}, can be specified with:
  21231. @example
  21232. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  21233. @end example
  21234. @end itemize
  21235. @anchor{setpts}
  21236. @section setpts, asetpts
  21237. Change the PTS (presentation timestamp) of the input frames.
  21238. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  21239. This filter accepts the following options:
  21240. @table @option
  21241. @item expr
  21242. The expression which is evaluated for each frame to construct its timestamp.
  21243. @end table
  21244. The expression is evaluated through the eval API and can contain the following
  21245. constants:
  21246. @table @option
  21247. @item FRAME_RATE, FR
  21248. frame rate, only defined for constant frame-rate video
  21249. @item PTS
  21250. The presentation timestamp in input
  21251. @item N
  21252. The count of the input frame for video or the number of consumed samples,
  21253. not including the current frame for audio, starting from 0.
  21254. @item NB_CONSUMED_SAMPLES
  21255. The number of consumed samples, not including the current frame (only
  21256. audio)
  21257. @item NB_SAMPLES, S
  21258. The number of samples in the current frame (only audio)
  21259. @item SAMPLE_RATE, SR
  21260. The audio sample rate.
  21261. @item STARTPTS
  21262. The PTS of the first frame.
  21263. @item STARTT
  21264. the time in seconds of the first frame
  21265. @item INTERLACED
  21266. State whether the current frame is interlaced.
  21267. @item T
  21268. the time in seconds of the current frame
  21269. @item POS
  21270. original position in the file of the frame, or undefined if undefined
  21271. for the current frame
  21272. @item PREV_INPTS
  21273. The previous input PTS.
  21274. @item PREV_INT
  21275. previous input time in seconds
  21276. @item PREV_OUTPTS
  21277. The previous output PTS.
  21278. @item PREV_OUTT
  21279. previous output time in seconds
  21280. @item RTCTIME
  21281. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  21282. instead.
  21283. @item RTCSTART
  21284. The wallclock (RTC) time at the start of the movie in microseconds.
  21285. @item TB
  21286. The timebase of the input timestamps.
  21287. @end table
  21288. @subsection Examples
  21289. @itemize
  21290. @item
  21291. Start counting PTS from zero
  21292. @example
  21293. setpts=PTS-STARTPTS
  21294. @end example
  21295. @item
  21296. Apply fast motion effect:
  21297. @example
  21298. setpts=0.5*PTS
  21299. @end example
  21300. @item
  21301. Apply slow motion effect:
  21302. @example
  21303. setpts=2.0*PTS
  21304. @end example
  21305. @item
  21306. Set fixed rate of 25 frames per second:
  21307. @example
  21308. setpts=N/(25*TB)
  21309. @end example
  21310. @item
  21311. Set fixed rate 25 fps with some jitter:
  21312. @example
  21313. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  21314. @end example
  21315. @item
  21316. Apply an offset of 10 seconds to the input PTS:
  21317. @example
  21318. setpts=PTS+10/TB
  21319. @end example
  21320. @item
  21321. Generate timestamps from a "live source" and rebase onto the current timebase:
  21322. @example
  21323. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  21324. @end example
  21325. @item
  21326. Generate timestamps by counting samples:
  21327. @example
  21328. asetpts=N/SR/TB
  21329. @end example
  21330. @end itemize
  21331. @section setrange
  21332. Force color range for the output video frame.
  21333. The @code{setrange} filter marks the color range property for the
  21334. output frames. It does not change the input frame, but only sets the
  21335. corresponding property, which affects how the frame is treated by
  21336. following filters.
  21337. The filter accepts the following options:
  21338. @table @option
  21339. @item range
  21340. Available values are:
  21341. @table @samp
  21342. @item auto
  21343. Keep the same color range property.
  21344. @item unspecified, unknown
  21345. Set the color range as unspecified.
  21346. @item limited, tv, mpeg
  21347. Set the color range as limited.
  21348. @item full, pc, jpeg
  21349. Set the color range as full.
  21350. @end table
  21351. @end table
  21352. @section settb, asettb
  21353. Set the timebase to use for the output frames timestamps.
  21354. It is mainly useful for testing timebase configuration.
  21355. It accepts the following parameters:
  21356. @table @option
  21357. @item expr, tb
  21358. The expression which is evaluated into the output timebase.
  21359. @end table
  21360. The value for @option{tb} is an arithmetic expression representing a
  21361. rational. The expression can contain the constants "AVTB" (the default
  21362. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  21363. audio only). Default value is "intb".
  21364. @subsection Examples
  21365. @itemize
  21366. @item
  21367. Set the timebase to 1/25:
  21368. @example
  21369. settb=expr=1/25
  21370. @end example
  21371. @item
  21372. Set the timebase to 1/10:
  21373. @example
  21374. settb=expr=0.1
  21375. @end example
  21376. @item
  21377. Set the timebase to 1001/1000:
  21378. @example
  21379. settb=1+0.001
  21380. @end example
  21381. @item
  21382. Set the timebase to 2*intb:
  21383. @example
  21384. settb=2*intb
  21385. @end example
  21386. @item
  21387. Set the default timebase value:
  21388. @example
  21389. settb=AVTB
  21390. @end example
  21391. @end itemize
  21392. @section showcqt
  21393. Convert input audio to a video output representing frequency spectrum
  21394. logarithmically using Brown-Puckette constant Q transform algorithm with
  21395. direct frequency domain coefficient calculation (but the transform itself
  21396. is not really constant Q, instead the Q factor is actually variable/clamped),
  21397. with musical tone scale, from E0 to D#10.
  21398. The filter accepts the following options:
  21399. @table @option
  21400. @item size, s
  21401. Specify the video size for the output. It must be even. For the syntax of this option,
  21402. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21403. Default value is @code{1920x1080}.
  21404. @item fps, rate, r
  21405. Set the output frame rate. Default value is @code{25}.
  21406. @item bar_h
  21407. Set the bargraph height. It must be even. Default value is @code{-1} which
  21408. computes the bargraph height automatically.
  21409. @item axis_h
  21410. Set the axis height. It must be even. Default value is @code{-1} which computes
  21411. the axis height automatically.
  21412. @item sono_h
  21413. Set the sonogram height. It must be even. Default value is @code{-1} which
  21414. computes the sonogram height automatically.
  21415. @item fullhd
  21416. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  21417. instead. Default value is @code{1}.
  21418. @item sono_v, volume
  21419. Specify the sonogram volume expression. It can contain variables:
  21420. @table @option
  21421. @item bar_v
  21422. the @var{bar_v} evaluated expression
  21423. @item frequency, freq, f
  21424. the frequency where it is evaluated
  21425. @item timeclamp, tc
  21426. the value of @var{timeclamp} option
  21427. @end table
  21428. and functions:
  21429. @table @option
  21430. @item a_weighting(f)
  21431. A-weighting of equal loudness
  21432. @item b_weighting(f)
  21433. B-weighting of equal loudness
  21434. @item c_weighting(f)
  21435. C-weighting of equal loudness.
  21436. @end table
  21437. Default value is @code{16}.
  21438. @item bar_v, volume2
  21439. Specify the bargraph volume expression. It can contain variables:
  21440. @table @option
  21441. @item sono_v
  21442. the @var{sono_v} evaluated expression
  21443. @item frequency, freq, f
  21444. the frequency where it is evaluated
  21445. @item timeclamp, tc
  21446. the value of @var{timeclamp} option
  21447. @end table
  21448. and functions:
  21449. @table @option
  21450. @item a_weighting(f)
  21451. A-weighting of equal loudness
  21452. @item b_weighting(f)
  21453. B-weighting of equal loudness
  21454. @item c_weighting(f)
  21455. C-weighting of equal loudness.
  21456. @end table
  21457. Default value is @code{sono_v}.
  21458. @item sono_g, gamma
  21459. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  21460. higher gamma makes the spectrum having more range. Default value is @code{3}.
  21461. Acceptable range is @code{[1, 7]}.
  21462. @item bar_g, gamma2
  21463. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  21464. @code{[1, 7]}.
  21465. @item bar_t
  21466. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  21467. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  21468. @item timeclamp, tc
  21469. Specify the transform timeclamp. At low frequency, there is trade-off between
  21470. accuracy in time domain and frequency domain. If timeclamp is lower,
  21471. event in time domain is represented more accurately (such as fast bass drum),
  21472. otherwise event in frequency domain is represented more accurately
  21473. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  21474. @item attack
  21475. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  21476. limits future samples by applying asymmetric windowing in time domain, useful
  21477. when low latency is required. Accepted range is @code{[0, 1]}.
  21478. @item basefreq
  21479. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  21480. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  21481. @item endfreq
  21482. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  21483. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  21484. @item coeffclamp
  21485. This option is deprecated and ignored.
  21486. @item tlength
  21487. Specify the transform length in time domain. Use this option to control accuracy
  21488. trade-off between time domain and frequency domain at every frequency sample.
  21489. It can contain variables:
  21490. @table @option
  21491. @item frequency, freq, f
  21492. the frequency where it is evaluated
  21493. @item timeclamp, tc
  21494. the value of @var{timeclamp} option.
  21495. @end table
  21496. Default value is @code{384*tc/(384+tc*f)}.
  21497. @item count
  21498. Specify the transform count for every video frame. Default value is @code{6}.
  21499. Acceptable range is @code{[1, 30]}.
  21500. @item fcount
  21501. Specify the transform count for every single pixel. Default value is @code{0},
  21502. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  21503. @item fontfile
  21504. Specify font file for use with freetype to draw the axis. If not specified,
  21505. use embedded font. Note that drawing with font file or embedded font is not
  21506. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  21507. option instead.
  21508. @item font
  21509. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  21510. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  21511. escaping.
  21512. @item fontcolor
  21513. Specify font color expression. This is arithmetic expression that should return
  21514. integer value 0xRRGGBB. It can contain variables:
  21515. @table @option
  21516. @item frequency, freq, f
  21517. the frequency where it is evaluated
  21518. @item timeclamp, tc
  21519. the value of @var{timeclamp} option
  21520. @end table
  21521. and functions:
  21522. @table @option
  21523. @item midi(f)
  21524. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  21525. @item r(x), g(x), b(x)
  21526. red, green, and blue value of intensity x.
  21527. @end table
  21528. Default value is @code{st(0, (midi(f)-59.5)/12);
  21529. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  21530. r(1-ld(1)) + b(ld(1))}.
  21531. @item axisfile
  21532. Specify image file to draw the axis. This option override @var{fontfile} and
  21533. @var{fontcolor} option.
  21534. @item axis, text
  21535. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  21536. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  21537. Default value is @code{1}.
  21538. @item csp
  21539. Set colorspace. The accepted values are:
  21540. @table @samp
  21541. @item unspecified
  21542. Unspecified (default)
  21543. @item bt709
  21544. BT.709
  21545. @item fcc
  21546. FCC
  21547. @item bt470bg
  21548. BT.470BG or BT.601-6 625
  21549. @item smpte170m
  21550. SMPTE-170M or BT.601-6 525
  21551. @item smpte240m
  21552. SMPTE-240M
  21553. @item bt2020ncl
  21554. BT.2020 with non-constant luminance
  21555. @end table
  21556. @item cscheme
  21557. Set spectrogram color scheme. This is list of floating point values with format
  21558. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  21559. The default is @code{1|0.5|0|0|0.5|1}.
  21560. @end table
  21561. @subsection Examples
  21562. @itemize
  21563. @item
  21564. Playing audio while showing the spectrum:
  21565. @example
  21566. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  21567. @end example
  21568. @item
  21569. Same as above, but with frame rate 30 fps:
  21570. @example
  21571. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  21572. @end example
  21573. @item
  21574. Playing at 1280x720:
  21575. @example
  21576. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  21577. @end example
  21578. @item
  21579. Disable sonogram display:
  21580. @example
  21581. sono_h=0
  21582. @end example
  21583. @item
  21584. A1 and its harmonics: A1, A2, (near)E3, A3:
  21585. @example
  21586. 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),
  21587. asplit[a][out1]; [a] showcqt [out0]'
  21588. @end example
  21589. @item
  21590. Same as above, but with more accuracy in frequency domain:
  21591. @example
  21592. 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),
  21593. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  21594. @end example
  21595. @item
  21596. Custom volume:
  21597. @example
  21598. bar_v=10:sono_v=bar_v*a_weighting(f)
  21599. @end example
  21600. @item
  21601. Custom gamma, now spectrum is linear to the amplitude.
  21602. @example
  21603. bar_g=2:sono_g=2
  21604. @end example
  21605. @item
  21606. Custom tlength equation:
  21607. @example
  21608. 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)))'
  21609. @end example
  21610. @item
  21611. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  21612. @example
  21613. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  21614. @end example
  21615. @item
  21616. Custom font using fontconfig:
  21617. @example
  21618. font='Courier New,Monospace,mono|bold'
  21619. @end example
  21620. @item
  21621. Custom frequency range with custom axis using image file:
  21622. @example
  21623. axisfile=myaxis.png:basefreq=40:endfreq=10000
  21624. @end example
  21625. @end itemize
  21626. @section showfreqs
  21627. Convert input audio to video output representing the audio power spectrum.
  21628. Audio amplitude is on Y-axis while frequency is on X-axis.
  21629. The filter accepts the following options:
  21630. @table @option
  21631. @item size, s
  21632. Specify size of video. For the syntax of this option, check the
  21633. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21634. Default is @code{1024x512}.
  21635. @item mode
  21636. Set display mode.
  21637. This set how each frequency bin will be represented.
  21638. It accepts the following values:
  21639. @table @samp
  21640. @item line
  21641. @item bar
  21642. @item dot
  21643. @end table
  21644. Default is @code{bar}.
  21645. @item ascale
  21646. Set amplitude scale.
  21647. It accepts the following values:
  21648. @table @samp
  21649. @item lin
  21650. Linear scale.
  21651. @item sqrt
  21652. Square root scale.
  21653. @item cbrt
  21654. Cubic root scale.
  21655. @item log
  21656. Logarithmic scale.
  21657. @end table
  21658. Default is @code{log}.
  21659. @item fscale
  21660. Set frequency scale.
  21661. It accepts the following values:
  21662. @table @samp
  21663. @item lin
  21664. Linear scale.
  21665. @item log
  21666. Logarithmic scale.
  21667. @item rlog
  21668. Reverse logarithmic scale.
  21669. @end table
  21670. Default is @code{lin}.
  21671. @item win_size
  21672. Set window size. Allowed range is from 16 to 65536.
  21673. Default is @code{2048}
  21674. @item win_func
  21675. Set windowing function.
  21676. It accepts the following values:
  21677. @table @samp
  21678. @item rect
  21679. @item bartlett
  21680. @item hanning
  21681. @item hamming
  21682. @item blackman
  21683. @item welch
  21684. @item flattop
  21685. @item bharris
  21686. @item bnuttall
  21687. @item bhann
  21688. @item sine
  21689. @item nuttall
  21690. @item lanczos
  21691. @item gauss
  21692. @item tukey
  21693. @item dolph
  21694. @item cauchy
  21695. @item parzen
  21696. @item poisson
  21697. @item bohman
  21698. @end table
  21699. Default is @code{hanning}.
  21700. @item overlap
  21701. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  21702. which means optimal overlap for selected window function will be picked.
  21703. @item averaging
  21704. Set time averaging. Setting this to 0 will display current maximal peaks.
  21705. Default is @code{1}, which means time averaging is disabled.
  21706. @item colors
  21707. Specify list of colors separated by space or by '|' which will be used to
  21708. draw channel frequencies. Unrecognized or missing colors will be replaced
  21709. by white color.
  21710. @item cmode
  21711. Set channel display mode.
  21712. It accepts the following values:
  21713. @table @samp
  21714. @item combined
  21715. @item separate
  21716. @end table
  21717. Default is @code{combined}.
  21718. @item minamp
  21719. Set minimum amplitude used in @code{log} amplitude scaler.
  21720. @item data
  21721. Set data display mode.
  21722. It accepts the following values:
  21723. @table @samp
  21724. @item magnitude
  21725. @item phase
  21726. @item delay
  21727. @end table
  21728. Default is @code{magnitude}.
  21729. @item channels
  21730. Set channels to use when processing audio. By default all are processed.
  21731. @end table
  21732. @section showspatial
  21733. Convert stereo input audio to a video output, representing the spatial relationship
  21734. between two channels.
  21735. The filter accepts the following options:
  21736. @table @option
  21737. @item size, s
  21738. Specify the video size for the output. For the syntax of this option, check the
  21739. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21740. Default value is @code{512x512}.
  21741. @item win_size
  21742. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  21743. @item win_func
  21744. Set window function.
  21745. It accepts the following values:
  21746. @table @samp
  21747. @item rect
  21748. @item bartlett
  21749. @item hann
  21750. @item hanning
  21751. @item hamming
  21752. @item blackman
  21753. @item welch
  21754. @item flattop
  21755. @item bharris
  21756. @item bnuttall
  21757. @item bhann
  21758. @item sine
  21759. @item nuttall
  21760. @item lanczos
  21761. @item gauss
  21762. @item tukey
  21763. @item dolph
  21764. @item cauchy
  21765. @item parzen
  21766. @item poisson
  21767. @item bohman
  21768. @end table
  21769. Default value is @code{hann}.
  21770. @item overlap
  21771. Set ratio of overlap window. Default value is @code{0.5}.
  21772. When value is @code{1} overlap is set to recommended size for specific
  21773. window function currently used.
  21774. @end table
  21775. @anchor{showspectrum}
  21776. @section showspectrum
  21777. Convert input audio to a video output, representing the audio frequency
  21778. spectrum.
  21779. The filter accepts the following options:
  21780. @table @option
  21781. @item size, s
  21782. Specify the video size for the output. For the syntax of this option, check the
  21783. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21784. Default value is @code{640x512}.
  21785. @item slide
  21786. Specify how the spectrum should slide along the window.
  21787. It accepts the following values:
  21788. @table @samp
  21789. @item replace
  21790. the samples start again on the left when they reach the right
  21791. @item scroll
  21792. the samples scroll from right to left
  21793. @item fullframe
  21794. frames are only produced when the samples reach the right
  21795. @item rscroll
  21796. the samples scroll from left to right
  21797. @item lreplace
  21798. the samples start again on the right when they reach the left
  21799. @end table
  21800. Default value is @code{replace}.
  21801. @item mode
  21802. Specify display mode.
  21803. It accepts the following values:
  21804. @table @samp
  21805. @item combined
  21806. all channels are displayed in the same row
  21807. @item separate
  21808. all channels are displayed in separate rows
  21809. @end table
  21810. Default value is @samp{combined}.
  21811. @item color
  21812. Specify display color mode.
  21813. It accepts the following values:
  21814. @table @samp
  21815. @item channel
  21816. each channel is displayed in a separate color
  21817. @item intensity
  21818. each channel is displayed using the same color scheme
  21819. @item rainbow
  21820. each channel is displayed using the rainbow color scheme
  21821. @item moreland
  21822. each channel is displayed using the moreland color scheme
  21823. @item nebulae
  21824. each channel is displayed using the nebulae color scheme
  21825. @item fire
  21826. each channel is displayed using the fire color scheme
  21827. @item fiery
  21828. each channel is displayed using the fiery color scheme
  21829. @item fruit
  21830. each channel is displayed using the fruit color scheme
  21831. @item cool
  21832. each channel is displayed using the cool color scheme
  21833. @item magma
  21834. each channel is displayed using the magma color scheme
  21835. @item green
  21836. each channel is displayed using the green color scheme
  21837. @item viridis
  21838. each channel is displayed using the viridis color scheme
  21839. @item plasma
  21840. each channel is displayed using the plasma color scheme
  21841. @item cividis
  21842. each channel is displayed using the cividis color scheme
  21843. @item terrain
  21844. each channel is displayed using the terrain color scheme
  21845. @end table
  21846. Default value is @samp{channel}.
  21847. @item scale
  21848. Specify scale used for calculating intensity color values.
  21849. It accepts the following values:
  21850. @table @samp
  21851. @item lin
  21852. linear
  21853. @item sqrt
  21854. square root, default
  21855. @item cbrt
  21856. cubic root
  21857. @item log
  21858. logarithmic
  21859. @item 4thrt
  21860. 4th root
  21861. @item 5thrt
  21862. 5th root
  21863. @end table
  21864. Default value is @samp{sqrt}.
  21865. @item fscale
  21866. Specify frequency scale.
  21867. It accepts the following values:
  21868. @table @samp
  21869. @item lin
  21870. linear
  21871. @item log
  21872. logarithmic
  21873. @end table
  21874. Default value is @samp{lin}.
  21875. @item saturation
  21876. Set saturation modifier for displayed colors. Negative values provide
  21877. alternative color scheme. @code{0} is no saturation at all.
  21878. Saturation must be in [-10.0, 10.0] range.
  21879. Default value is @code{1}.
  21880. @item win_func
  21881. Set window function.
  21882. It accepts the following values:
  21883. @table @samp
  21884. @item rect
  21885. @item bartlett
  21886. @item hann
  21887. @item hanning
  21888. @item hamming
  21889. @item blackman
  21890. @item welch
  21891. @item flattop
  21892. @item bharris
  21893. @item bnuttall
  21894. @item bhann
  21895. @item sine
  21896. @item nuttall
  21897. @item lanczos
  21898. @item gauss
  21899. @item tukey
  21900. @item dolph
  21901. @item cauchy
  21902. @item parzen
  21903. @item poisson
  21904. @item bohman
  21905. @end table
  21906. Default value is @code{hann}.
  21907. @item orientation
  21908. Set orientation of time vs frequency axis. Can be @code{vertical} or
  21909. @code{horizontal}. Default is @code{vertical}.
  21910. @item overlap
  21911. Set ratio of overlap window. Default value is @code{0}.
  21912. When value is @code{1} overlap is set to recommended size for specific
  21913. window function currently used.
  21914. @item gain
  21915. Set scale gain for calculating intensity color values.
  21916. Default value is @code{1}.
  21917. @item data
  21918. Set which data to display. Can be @code{magnitude}, default or @code{phase},
  21919. or unwrapped phase: @code{uphase}.
  21920. @item rotation
  21921. Set color rotation, must be in [-1.0, 1.0] range.
  21922. Default value is @code{0}.
  21923. @item start
  21924. Set start frequency from which to display spectrogram. Default is @code{0}.
  21925. @item stop
  21926. Set stop frequency to which to display spectrogram. Default is @code{0}.
  21927. @item fps
  21928. Set upper frame rate limit. Default is @code{auto}, unlimited.
  21929. @item legend
  21930. Draw time and frequency axes and legends. Default is disabled.
  21931. @item drange
  21932. Set dynamic range used to calculate intensity color values. Default is 120 dBFS.
  21933. Allowed range is from 10 to 200.
  21934. @item limit
  21935. Set upper limit of input audio samples volume in dBFS. Default is 0 dBFS.
  21936. Allowed range is from -100 to 100.
  21937. @item opacity
  21938. Set opacity strength when using pixel format output with alpha component.
  21939. @end table
  21940. The usage is very similar to the showwaves filter; see the examples in that
  21941. section.
  21942. @subsection Examples
  21943. @itemize
  21944. @item
  21945. Large window with logarithmic color scaling:
  21946. @example
  21947. showspectrum=s=1280x480:scale=log
  21948. @end example
  21949. @item
  21950. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  21951. @example
  21952. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  21953. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  21954. @end example
  21955. @end itemize
  21956. @section showspectrumpic
  21957. Convert input audio to a single video frame, representing the audio frequency
  21958. spectrum.
  21959. The filter accepts the following options:
  21960. @table @option
  21961. @item size, s
  21962. Specify the video size for the output. For the syntax of this option, check the
  21963. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21964. Default value is @code{4096x2048}.
  21965. @item mode
  21966. Specify display mode.
  21967. It accepts the following values:
  21968. @table @samp
  21969. @item combined
  21970. all channels are displayed in the same row
  21971. @item separate
  21972. all channels are displayed in separate rows
  21973. @end table
  21974. Default value is @samp{combined}.
  21975. @item color
  21976. Specify display color mode.
  21977. It accepts the following values:
  21978. @table @samp
  21979. @item channel
  21980. each channel is displayed in a separate color
  21981. @item intensity
  21982. each channel is displayed using the same color scheme
  21983. @item rainbow
  21984. each channel is displayed using the rainbow color scheme
  21985. @item moreland
  21986. each channel is displayed using the moreland color scheme
  21987. @item nebulae
  21988. each channel is displayed using the nebulae color scheme
  21989. @item fire
  21990. each channel is displayed using the fire color scheme
  21991. @item fiery
  21992. each channel is displayed using the fiery color scheme
  21993. @item fruit
  21994. each channel is displayed using the fruit color scheme
  21995. @item cool
  21996. each channel is displayed using the cool color scheme
  21997. @item magma
  21998. each channel is displayed using the magma color scheme
  21999. @item green
  22000. each channel is displayed using the green color scheme
  22001. @item viridis
  22002. each channel is displayed using the viridis color scheme
  22003. @item plasma
  22004. each channel is displayed using the plasma color scheme
  22005. @item cividis
  22006. each channel is displayed using the cividis color scheme
  22007. @item terrain
  22008. each channel is displayed using the terrain color scheme
  22009. @end table
  22010. Default value is @samp{intensity}.
  22011. @item scale
  22012. Specify scale used for calculating intensity color values.
  22013. It accepts the following values:
  22014. @table @samp
  22015. @item lin
  22016. linear
  22017. @item sqrt
  22018. square root, default
  22019. @item cbrt
  22020. cubic root
  22021. @item log
  22022. logarithmic
  22023. @item 4thrt
  22024. 4th root
  22025. @item 5thrt
  22026. 5th root
  22027. @end table
  22028. Default value is @samp{log}.
  22029. @item fscale
  22030. Specify frequency scale.
  22031. It accepts the following values:
  22032. @table @samp
  22033. @item lin
  22034. linear
  22035. @item log
  22036. logarithmic
  22037. @end table
  22038. Default value is @samp{lin}.
  22039. @item saturation
  22040. Set saturation modifier for displayed colors. Negative values provide
  22041. alternative color scheme. @code{0} is no saturation at all.
  22042. Saturation must be in [-10.0, 10.0] range.
  22043. Default value is @code{1}.
  22044. @item win_func
  22045. Set window function.
  22046. It accepts the following values:
  22047. @table @samp
  22048. @item rect
  22049. @item bartlett
  22050. @item hann
  22051. @item hanning
  22052. @item hamming
  22053. @item blackman
  22054. @item welch
  22055. @item flattop
  22056. @item bharris
  22057. @item bnuttall
  22058. @item bhann
  22059. @item sine
  22060. @item nuttall
  22061. @item lanczos
  22062. @item gauss
  22063. @item tukey
  22064. @item dolph
  22065. @item cauchy
  22066. @item parzen
  22067. @item poisson
  22068. @item bohman
  22069. @end table
  22070. Default value is @code{hann}.
  22071. @item orientation
  22072. Set orientation of time vs frequency axis. Can be @code{vertical} or
  22073. @code{horizontal}. Default is @code{vertical}.
  22074. @item gain
  22075. Set scale gain for calculating intensity color values.
  22076. Default value is @code{1}.
  22077. @item legend
  22078. Draw time and frequency axes and legends. Default is enabled.
  22079. @item rotation
  22080. Set color rotation, must be in [-1.0, 1.0] range.
  22081. Default value is @code{0}.
  22082. @item start
  22083. Set start frequency from which to display spectrogram. Default is @code{0}.
  22084. @item stop
  22085. Set stop frequency to which to display spectrogram. Default is @code{0}.
  22086. @item drange
  22087. Set dynamic range used to calculate intensity color values. Default is 120 dBFS.
  22088. Allowed range is from 10 to 200.
  22089. @item limit
  22090. Set upper limit of input audio samples volume in dBFS. Default is 0 dBFS.
  22091. Allowed range is from -100 to 100.
  22092. @item opacity
  22093. Set opacity strength when using pixel format output with alpha component.
  22094. @end table
  22095. @subsection Examples
  22096. @itemize
  22097. @item
  22098. Extract an audio spectrogram of a whole audio track
  22099. in a 1024x1024 picture using @command{ffmpeg}:
  22100. @example
  22101. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  22102. @end example
  22103. @end itemize
  22104. @section showvolume
  22105. Convert input audio volume to a video output.
  22106. The filter accepts the following options:
  22107. @table @option
  22108. @item rate, r
  22109. Set video rate.
  22110. @item b
  22111. Set border width, allowed range is [0, 5]. Default is 1.
  22112. @item w
  22113. Set channel width, allowed range is [80, 8192]. Default is 400.
  22114. @item h
  22115. Set channel height, allowed range is [1, 900]. Default is 20.
  22116. @item f
  22117. Set fade, allowed range is [0, 1]. Default is 0.95.
  22118. @item c
  22119. Set volume color expression.
  22120. The expression can use the following variables:
  22121. @table @option
  22122. @item VOLUME
  22123. Current max volume of channel in dB.
  22124. @item PEAK
  22125. Current peak.
  22126. @item CHANNEL
  22127. Current channel number, starting from 0.
  22128. @end table
  22129. @item t
  22130. If set, displays channel names. Default is enabled.
  22131. @item v
  22132. If set, displays volume values. Default is enabled.
  22133. @item o
  22134. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  22135. default is @code{h}.
  22136. @item s
  22137. Set step size, allowed range is [0, 5]. Default is 0, which means
  22138. step is disabled.
  22139. @item p
  22140. Set background opacity, allowed range is [0, 1]. Default is 0.
  22141. @item m
  22142. Set metering mode, can be peak: @code{p} or rms: @code{r},
  22143. default is @code{p}.
  22144. @item ds
  22145. Set display scale, can be linear: @code{lin} or log: @code{log},
  22146. default is @code{lin}.
  22147. @item dm
  22148. In second.
  22149. If set to > 0., display a line for the max level
  22150. in the previous seconds.
  22151. default is disabled: @code{0.}
  22152. @item dmc
  22153. The color of the max line. Use when @code{dm} option is set to > 0.
  22154. default is: @code{orange}
  22155. @end table
  22156. @section showwaves
  22157. Convert input audio to a video output, representing the samples waves.
  22158. The filter accepts the following options:
  22159. @table @option
  22160. @item size, s
  22161. Specify the video size for the output. For the syntax of this option, check the
  22162. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22163. Default value is @code{600x240}.
  22164. @item mode
  22165. Set display mode.
  22166. Available values are:
  22167. @table @samp
  22168. @item point
  22169. Draw a point for each sample.
  22170. @item line
  22171. Draw a vertical line for each sample.
  22172. @item p2p
  22173. Draw a point for each sample and a line between them.
  22174. @item cline
  22175. Draw a centered vertical line for each sample.
  22176. @end table
  22177. Default value is @code{point}.
  22178. @item n
  22179. Set the number of samples which are printed on the same column. A
  22180. larger value will decrease the frame rate. Must be a positive
  22181. integer. This option can be set only if the value for @var{rate}
  22182. is not explicitly specified.
  22183. @item rate, r
  22184. Set the (approximate) output frame rate. This is done by setting the
  22185. option @var{n}. Default value is "25".
  22186. @item split_channels
  22187. Set if channels should be drawn separately or overlap. Default value is 0.
  22188. @item colors
  22189. Set colors separated by '|' which are going to be used for drawing of each channel.
  22190. @item scale
  22191. Set amplitude scale.
  22192. Available values are:
  22193. @table @samp
  22194. @item lin
  22195. Linear.
  22196. @item log
  22197. Logarithmic.
  22198. @item sqrt
  22199. Square root.
  22200. @item cbrt
  22201. Cubic root.
  22202. @end table
  22203. Default is linear.
  22204. @item draw
  22205. Set the draw mode. This is mostly useful to set for high @var{n}.
  22206. Available values are:
  22207. @table @samp
  22208. @item scale
  22209. Scale pixel values for each drawn sample.
  22210. @item full
  22211. Draw every sample directly.
  22212. @end table
  22213. Default value is @code{scale}.
  22214. @end table
  22215. @subsection Examples
  22216. @itemize
  22217. @item
  22218. Output the input file audio and the corresponding video representation
  22219. at the same time:
  22220. @example
  22221. amovie=a.mp3,asplit[out0],showwaves[out1]
  22222. @end example
  22223. @item
  22224. Create a synthetic signal and show it with showwaves, forcing a
  22225. frame rate of 30 frames per second:
  22226. @example
  22227. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  22228. @end example
  22229. @end itemize
  22230. @section showwavespic
  22231. Convert input audio to a single video frame, representing the samples waves.
  22232. The filter accepts the following options:
  22233. @table @option
  22234. @item size, s
  22235. Specify the video size for the output. For the syntax of this option, check the
  22236. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22237. Default value is @code{600x240}.
  22238. @item split_channels
  22239. Set if channels should be drawn separately or overlap. Default value is 0.
  22240. @item colors
  22241. Set colors separated by '|' which are going to be used for drawing of each channel.
  22242. @item scale
  22243. Set amplitude scale.
  22244. Available values are:
  22245. @table @samp
  22246. @item lin
  22247. Linear.
  22248. @item log
  22249. Logarithmic.
  22250. @item sqrt
  22251. Square root.
  22252. @item cbrt
  22253. Cubic root.
  22254. @end table
  22255. Default is linear.
  22256. @item draw
  22257. Set the draw mode.
  22258. Available values are:
  22259. @table @samp
  22260. @item scale
  22261. Scale pixel values for each drawn sample.
  22262. @item full
  22263. Draw every sample directly.
  22264. @end table
  22265. Default value is @code{scale}.
  22266. @item filter
  22267. Set the filter mode.
  22268. Available values are:
  22269. @table @samp
  22270. @item average
  22271. Use average samples values for each drawn sample.
  22272. @item peak
  22273. Use peak samples values for each drawn sample.
  22274. @end table
  22275. Default value is @code{average}.
  22276. @end table
  22277. @subsection Examples
  22278. @itemize
  22279. @item
  22280. Extract a channel split representation of the wave form of a whole audio track
  22281. in a 1024x800 picture using @command{ffmpeg}:
  22282. @example
  22283. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  22284. @end example
  22285. @end itemize
  22286. @section sidedata, asidedata
  22287. Delete frame side data, or select frames based on it.
  22288. This filter accepts the following options:
  22289. @table @option
  22290. @item mode
  22291. Set mode of operation of the filter.
  22292. Can be one of the following:
  22293. @table @samp
  22294. @item select
  22295. Select every frame with side data of @code{type}.
  22296. @item delete
  22297. Delete side data of @code{type}. If @code{type} is not set, delete all side
  22298. data in the frame.
  22299. @end table
  22300. @item type
  22301. Set side data type used with all modes. Must be set for @code{select} mode. For
  22302. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  22303. in @file{libavutil/frame.h}. For example, to choose
  22304. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  22305. @end table
  22306. @section spectrumsynth
  22307. Synthesize audio from 2 input video spectrums, first input stream represents
  22308. magnitude across time and second represents phase across time.
  22309. The filter will transform from frequency domain as displayed in videos back
  22310. to time domain as presented in audio output.
  22311. This filter is primarily created for reversing processed @ref{showspectrum}
  22312. filter outputs, but can synthesize sound from other spectrograms too.
  22313. But in such case results are going to be poor if the phase data is not
  22314. available, because in such cases phase data need to be recreated, usually
  22315. it's just recreated from random noise.
  22316. For best results use gray only output (@code{channel} color mode in
  22317. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  22318. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  22319. @code{data} option. Inputs videos should generally use @code{fullframe}
  22320. slide mode as that saves resources needed for decoding video.
  22321. The filter accepts the following options:
  22322. @table @option
  22323. @item sample_rate
  22324. Specify sample rate of output audio, the sample rate of audio from which
  22325. spectrum was generated may differ.
  22326. @item channels
  22327. Set number of channels represented in input video spectrums.
  22328. @item scale
  22329. Set scale which was used when generating magnitude input spectrum.
  22330. Can be @code{lin} or @code{log}. Default is @code{log}.
  22331. @item slide
  22332. Set slide which was used when generating inputs spectrums.
  22333. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  22334. Default is @code{fullframe}.
  22335. @item win_func
  22336. Set window function used for resynthesis.
  22337. @item overlap
  22338. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  22339. which means optimal overlap for selected window function will be picked.
  22340. @item orientation
  22341. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  22342. Default is @code{vertical}.
  22343. @end table
  22344. @subsection Examples
  22345. @itemize
  22346. @item
  22347. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  22348. then resynthesize videos back to audio with spectrumsynth:
  22349. @example
  22350. 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
  22351. 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
  22352. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  22353. @end example
  22354. @end itemize
  22355. @section split, asplit
  22356. Split input into several identical outputs.
  22357. @code{asplit} works with audio input, @code{split} with video.
  22358. The filter accepts a single parameter which specifies the number of outputs. If
  22359. unspecified, it defaults to 2.
  22360. @subsection Examples
  22361. @itemize
  22362. @item
  22363. Create two separate outputs from the same input:
  22364. @example
  22365. [in] split [out0][out1]
  22366. @end example
  22367. @item
  22368. To create 3 or more outputs, you need to specify the number of
  22369. outputs, like in:
  22370. @example
  22371. [in] asplit=3 [out0][out1][out2]
  22372. @end example
  22373. @item
  22374. Create two separate outputs from the same input, one cropped and
  22375. one padded:
  22376. @example
  22377. [in] split [splitout1][splitout2];
  22378. [splitout1] crop=100:100:0:0 [cropout];
  22379. [splitout2] pad=200:200:100:100 [padout];
  22380. @end example
  22381. @item
  22382. Create 5 copies of the input audio with @command{ffmpeg}:
  22383. @example
  22384. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  22385. @end example
  22386. @end itemize
  22387. @section zmq, azmq
  22388. Receive commands sent through a libzmq client, and forward them to
  22389. filters in the filtergraph.
  22390. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  22391. must be inserted between two video filters, @code{azmq} between two
  22392. audio filters. Both are capable to send messages to any filter type.
  22393. To enable these filters you need to install the libzmq library and
  22394. headers and configure FFmpeg with @code{--enable-libzmq}.
  22395. For more information about libzmq see:
  22396. @url{http://www.zeromq.org/}
  22397. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  22398. receives messages sent through a network interface defined by the
  22399. @option{bind_address} (or the abbreviation "@option{b}") option.
  22400. Default value of this option is @file{tcp://localhost:5555}. You may
  22401. want to alter this value to your needs, but do not forget to escape any
  22402. ':' signs (see @ref{filtergraph escaping}).
  22403. The received message must be in the form:
  22404. @example
  22405. @var{TARGET} @var{COMMAND} [@var{ARG}]
  22406. @end example
  22407. @var{TARGET} specifies the target of the command, usually the name of
  22408. the filter class or a specific filter instance name. The default
  22409. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  22410. but you can override this by using the @samp{filter_name@@id} syntax
  22411. (see @ref{Filtergraph syntax}).
  22412. @var{COMMAND} specifies the name of the command for the target filter.
  22413. @var{ARG} is optional and specifies the optional argument list for the
  22414. given @var{COMMAND}.
  22415. Upon reception, the message is processed and the corresponding command
  22416. is injected into the filtergraph. Depending on the result, the filter
  22417. will send a reply to the client, adopting the format:
  22418. @example
  22419. @var{ERROR_CODE} @var{ERROR_REASON}
  22420. @var{MESSAGE}
  22421. @end example
  22422. @var{MESSAGE} is optional.
  22423. @subsection Examples
  22424. Look at @file{tools/zmqsend} for an example of a zmq client which can
  22425. be used to send commands processed by these filters.
  22426. Consider the following filtergraph generated by @command{ffplay}.
  22427. In this example the last overlay filter has an instance name. All other
  22428. filters will have default instance names.
  22429. @example
  22430. ffplay -dumpgraph 1 -f lavfi "
  22431. color=s=100x100:c=red [l];
  22432. color=s=100x100:c=blue [r];
  22433. nullsrc=s=200x100, zmq [bg];
  22434. [bg][l] overlay [bg+l];
  22435. [bg+l][r] overlay@@my=x=100 "
  22436. @end example
  22437. To change the color of the left side of the video, the following
  22438. command can be used:
  22439. @example
  22440. echo Parsed_color_0 c yellow | tools/zmqsend
  22441. @end example
  22442. To change the right side:
  22443. @example
  22444. echo Parsed_color_1 c pink | tools/zmqsend
  22445. @end example
  22446. To change the position of the right side:
  22447. @example
  22448. echo overlay@@my x 150 | tools/zmqsend
  22449. @end example
  22450. @c man end MULTIMEDIA FILTERS
  22451. @chapter Multimedia Sources
  22452. @c man begin MULTIMEDIA SOURCES
  22453. Below is a description of the currently available multimedia sources.
  22454. @section amovie
  22455. This is the same as @ref{movie} source, except it selects an audio
  22456. stream by default.
  22457. @section avsynctest
  22458. Generate an Audio/Video Sync Test.
  22459. Generated stream periodically shows flash video frame and emits beep in audio.
  22460. Useful to inspect A/V sync issues.
  22461. It accepts the following options:
  22462. @table @option
  22463. @item size, s
  22464. Set output video size. Default value is @code{hd720}.
  22465. @item framerate, fr
  22466. Set output video frame rate. Default value is @code{30}.
  22467. @item samplerate, sr
  22468. Set output audio sample rate. Default value is @code{44100}.
  22469. @item amplitude, a
  22470. Set output audio beep amplitude. Default value is @code{0.7}.
  22471. @item period, p
  22472. Set output audio beep period in seconds. Default value is @code{3}.
  22473. @item delay, dl
  22474. Set output video flash delay in number of frames. Default value is @code{0}.
  22475. @item cycle, c
  22476. Enable cycling of video delays, by default is disabled.
  22477. @item duration, d
  22478. Set stream output duration. By default duration is unlimited.
  22479. @item fg, bg, ag
  22480. Set foreground/background/additional color.
  22481. @end table
  22482. @anchor{movie}
  22483. @section movie
  22484. Read audio and/or video stream(s) from a movie container.
  22485. It accepts the following parameters:
  22486. @table @option
  22487. @item filename
  22488. The name of the resource to read (not necessarily a file; it can also be a
  22489. device or a stream accessed through some protocol).
  22490. @item format_name, f
  22491. Specifies the format assumed for the movie to read, and can be either
  22492. the name of a container or an input device. If not specified, the
  22493. format is guessed from @var{movie_name} or by probing.
  22494. @item seek_point, sp
  22495. Specifies the seek point in seconds. The frames will be output
  22496. starting from this seek point. The parameter is evaluated with
  22497. @code{av_strtod}, so the numerical value may be suffixed by an IS
  22498. postfix. The default value is "0".
  22499. @item streams, s
  22500. Specifies the streams to read. Several streams can be specified,
  22501. separated by "+". The source will then have as many outputs, in the
  22502. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  22503. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  22504. respectively the default (best suited) video and audio stream. Default
  22505. is "dv", or "da" if the filter is called as "amovie".
  22506. @item stream_index, si
  22507. Specifies the index of the video stream to read. If the value is -1,
  22508. the most suitable video stream will be automatically selected. The default
  22509. value is "-1". Deprecated. If the filter is called "amovie", it will select
  22510. audio instead of video.
  22511. @item loop
  22512. Specifies how many times to read the stream in sequence.
  22513. If the value is 0, the stream will be looped infinitely.
  22514. Default value is "1".
  22515. Note that when the movie is looped the source timestamps are not
  22516. changed, so it will generate non monotonically increasing timestamps.
  22517. @item discontinuity
  22518. Specifies the time difference between frames above which the point is
  22519. considered a timestamp discontinuity which is removed by adjusting the later
  22520. timestamps.
  22521. @item dec_threads
  22522. Specifies the number of threads for decoding
  22523. @item format_opts
  22524. Specify format options for the opened file. Format options can be specified
  22525. as a list of @var{key}=@var{value} pairs separated by ':'. The following example
  22526. shows how to add protocol_whitelist and protocol_blacklist options:
  22527. @example
  22528. ffplay -f lavfi
  22529. "movie=filename='1.sdp':format_opts='protocol_whitelist=file,rtp,udp\:protocol_blacklist=http'"
  22530. @end example
  22531. @end table
  22532. It allows overlaying a second video on top of the main input of
  22533. a filtergraph, as shown in this graph:
  22534. @example
  22535. input -----------> deltapts0 --> overlay --> output
  22536. ^
  22537. |
  22538. movie --> scale--> deltapts1 -------+
  22539. @end example
  22540. @subsection Examples
  22541. @itemize
  22542. @item
  22543. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  22544. on top of the input labelled "in":
  22545. @example
  22546. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  22547. [in] setpts=PTS-STARTPTS [main];
  22548. [main][over] overlay=16:16 [out]
  22549. @end example
  22550. @item
  22551. Read from a video4linux2 device, and overlay it on top of the input
  22552. labelled "in":
  22553. @example
  22554. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  22555. [in] setpts=PTS-STARTPTS [main];
  22556. [main][over] overlay=16:16 [out]
  22557. @end example
  22558. @item
  22559. Read the first video stream and the audio stream with id 0x81 from
  22560. dvd.vob; the video is connected to the pad named "video" and the audio is
  22561. connected to the pad named "audio":
  22562. @example
  22563. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  22564. @end example
  22565. @end itemize
  22566. @subsection Commands
  22567. Both movie and amovie support the following commands:
  22568. @table @option
  22569. @item seek
  22570. Perform seek using "av_seek_frame".
  22571. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  22572. @itemize
  22573. @item
  22574. @var{stream_index}: If stream_index is -1, a default
  22575. stream is selected, and @var{timestamp} is automatically converted
  22576. from AV_TIME_BASE units to the stream specific time_base.
  22577. @item
  22578. @var{timestamp}: Timestamp in AVStream.time_base units
  22579. or, if no stream is specified, in AV_TIME_BASE units.
  22580. @item
  22581. @var{flags}: Flags which select direction and seeking mode.
  22582. @end itemize
  22583. @item get_duration
  22584. Get movie duration in AV_TIME_BASE units.
  22585. @end table
  22586. @c man end MULTIMEDIA SOURCES