filters.texi 828 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023
  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. A special syntax implemented in the @command{ffmpeg} CLI tool allows loading
  138. option values from files. This is done be prepending a slash '/' to the option
  139. name, then the supplied value is interpreted as a path from which the actual
  140. value is loaded. E.g.
  141. @example
  142. ffmpeg -i <INPUT> -vf drawtext=/text=/tmp/some_text <OUTPUT>
  143. @end example
  144. will load the text to be drawn from @file{/tmp/some_text}. API users wishing to
  145. implement a similar feature should use the @code{avfilter_graph_segment_*()}
  146. functions together with custom IO code.
  147. The name and arguments of the filter are optionally preceded and
  148. followed by a list of link labels.
  149. A link label allows one to name a link and associate it to a filter output
  150. or input pad. The preceding labels @var{in_link_1}
  151. ... @var{in_link_N}, are associated to the filter input pads,
  152. the following labels @var{out_link_1} ... @var{out_link_M}, are
  153. associated to the output pads.
  154. When two link labels with the same name are found in the
  155. filtergraph, a link between the corresponding input and output pad is
  156. created.
  157. If an output pad is not labelled, it is linked by default to the first
  158. unlabelled input pad of the next filter in the filterchain.
  159. For example in the filterchain
  160. @example
  161. nullsrc, split[L1], [L2]overlay, nullsink
  162. @end example
  163. the split filter instance has two output pads, and the overlay filter
  164. instance two input pads. The first output pad of split is labelled
  165. "L1", the first input pad of overlay is labelled "L2", and the second
  166. output pad of split is linked to the second input pad of overlay,
  167. which are both unlabelled.
  168. In a filter description, if the input label of the first filter is not
  169. specified, "in" is assumed; if the output label of the last filter is not
  170. specified, "out" is assumed.
  171. In a complete filterchain all the unlabelled filter input and output
  172. pads must be connected. A filtergraph is considered valid if all the
  173. filter input and output pads of all the filterchains are connected.
  174. Libavfilter will automatically insert @ref{scale} filters where format
  175. conversion is required. It is possible to specify swscale flags
  176. for those automatically inserted scalers by prepending
  177. @code{sws_flags=@var{flags};}
  178. to the filtergraph description.
  179. Here is a BNF description of the filtergraph syntax:
  180. @example
  181. @var{NAME} ::= sequence of alphanumeric characters and '_'
  182. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  183. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  184. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  185. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  186. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  187. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  188. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  189. @end example
  190. @anchor{filtergraph escaping}
  191. @section Notes on filtergraph escaping
  192. Filtergraph description composition entails several levels of
  193. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  194. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  195. information about the employed escaping procedure.
  196. A first level escaping affects the content of each filter option
  197. value, which may contain the special character @code{:} used to
  198. separate values, or one of the escaping characters @code{\'}.
  199. A second level escaping affects the whole filter description, which
  200. may contain the escaping characters @code{\'} or the special
  201. characters @code{[],;} used by the filtergraph description.
  202. Finally, when you specify a filtergraph on a shell commandline, you
  203. need to perform a third level escaping for the shell special
  204. characters contained within it.
  205. For example, consider the following string to be embedded in
  206. the @ref{drawtext} filter description @option{text} value:
  207. @example
  208. this is a 'string': may contain one, or more, special characters
  209. @end example
  210. This string contains the @code{'} special escaping character, and the
  211. @code{:} special character, so it needs to be escaped in this way:
  212. @example
  213. text=this is a \'string\'\: may contain one, or more, special characters
  214. @end example
  215. A second level of escaping is required when embedding the filter
  216. description in a filtergraph description, in order to escape all the
  217. filtergraph special characters. Thus the example above becomes:
  218. @example
  219. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  220. @end example
  221. (note that in addition to the @code{\'} escaping special characters,
  222. also @code{,} needs to be escaped).
  223. Finally an additional level of escaping is needed when writing the
  224. filtergraph description in a shell command, which depends on the
  225. escaping rules of the adopted shell. For example, assuming that
  226. @code{\} is special and needs to be escaped with another @code{\}, the
  227. previous string will finally result in:
  228. @example
  229. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  230. @end example
  231. @chapter Timeline editing
  232. Some filters support a generic @option{enable} option. For the filters
  233. supporting timeline editing, this option can be set to an expression which is
  234. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  235. the filter will be enabled, otherwise the frame will be sent unchanged to the
  236. next filter in the filtergraph.
  237. The expression accepts the following values:
  238. @table @samp
  239. @item t
  240. timestamp expressed in seconds, NAN if the input timestamp is unknown
  241. @item n
  242. sequential number of the input frame, starting from 0
  243. @item pos
  244. the position in the file of the input frame, NAN if unknown
  245. @item w
  246. @item h
  247. width and height of the input frame if video
  248. @end table
  249. Additionally, these filters support an @option{enable} command that can be used
  250. to re-define the expression.
  251. Like any other filtering option, the @option{enable} option follows the same
  252. rules.
  253. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  254. minutes, and a @ref{curves} filter starting at 3 seconds:
  255. @example
  256. smartblur = enable='between(t,10,3*60)',
  257. curves = enable='gte(t,3)' : preset=cross_process
  258. @end example
  259. See @code{ffmpeg -filters} to view which filters have timeline support.
  260. @c man end FILTERGRAPH DESCRIPTION
  261. @anchor{commands}
  262. @chapter Changing options at runtime with a command
  263. Some options can be changed during the operation of the filter using
  264. a command. These options are marked 'T' on the output of
  265. @command{ffmpeg} @option{-h filter=<name of filter>}.
  266. The name of the command is the name of the option and the argument is
  267. the new value.
  268. @anchor{framesync}
  269. @chapter Options for filters with several inputs (framesync)
  270. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  271. Some filters with several inputs support a common set of options.
  272. These options can only be set by name, not with the short notation.
  273. @table @option
  274. @item eof_action
  275. The action to take when EOF is encountered on the secondary input; it accepts
  276. one of the following values:
  277. @table @option
  278. @item repeat
  279. Repeat the last frame (the default).
  280. @item endall
  281. End both streams.
  282. @item pass
  283. Pass the main input through.
  284. @end table
  285. @item shortest
  286. If set to 1, force the output to terminate when the shortest input
  287. terminates. Default value is 0.
  288. @item repeatlast
  289. If set to 1, force the filter to extend the last frame of secondary streams
  290. until the end of the primary stream. A value of 0 disables this behavior.
  291. Default value is 1.
  292. @item ts_sync_mode
  293. How strictly to sync streams based on secondary input timestamps; it accepts
  294. one of the following values:
  295. @table @option
  296. @item default
  297. Frame from secondary input with the nearest lower or equal timestamp to the
  298. primary input frame.
  299. @item nearest
  300. Frame from secondary input with the absolute nearest timestamp to the primary
  301. input frame.
  302. @end table
  303. @end table
  304. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  305. @chapter Audio Filters
  306. @c man begin AUDIO FILTERS
  307. When you configure your FFmpeg build, you can disable any of the
  308. existing filters using @code{--disable-filters}.
  309. The configure output will show the audio filters included in your
  310. build.
  311. Below is a description of the currently available audio filters.
  312. @section acompressor
  313. A compressor is mainly used to reduce the dynamic range of a signal.
  314. Especially modern music is mostly compressed at a high ratio to
  315. improve the overall loudness. It's done to get the highest attention
  316. of a listener, "fatten" the sound and bring more "power" to the track.
  317. If a signal is compressed too much it may sound dull or "dead"
  318. afterwards or it may start to "pump" (which could be a powerful effect
  319. but can also destroy a track completely).
  320. The right compression is the key to reach a professional sound and is
  321. the high art of mixing and mastering. Because of its complex settings
  322. it may take a long time to get the right feeling for this kind of effect.
  323. Compression is done by detecting the volume above a chosen level
  324. @code{threshold} and dividing it by the factor set with @code{ratio}.
  325. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  326. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  327. the signal would cause distortion of the waveform the reduction can be
  328. levelled over the time. This is done by setting "Attack" and "Release".
  329. @code{attack} determines how long the signal has to rise above the threshold
  330. before any reduction will occur and @code{release} sets the time the signal
  331. has to fall below the threshold to reduce the reduction again. Shorter signals
  332. than the chosen attack time will be left untouched.
  333. The overall reduction of the signal can be made up afterwards with the
  334. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  335. raising the makeup to this level results in a signal twice as loud than the
  336. source. To gain a softer entry in the compression the @code{knee} flattens the
  337. hard edge at the threshold in the range of the chosen decibels.
  338. The filter accepts the following options:
  339. @table @option
  340. @item level_in
  341. Set input gain. Default is 1. Range is between 0.015625 and 64.
  342. @item mode
  343. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  344. Default is @code{downward}.
  345. @item threshold
  346. If a signal of stream rises above this level it will affect the gain
  347. reduction.
  348. By default it is 0.125. Range is between 0.00097563 and 1.
  349. @item ratio
  350. Set a ratio by which the signal is reduced. 1:2 means that if the level
  351. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  352. Default is 2. Range is between 1 and 20.
  353. @item attack
  354. Amount of milliseconds the signal has to rise above the threshold before gain
  355. reduction starts. Default is 20. Range is between 0.01 and 2000.
  356. @item release
  357. Amount of milliseconds the signal has to fall below the threshold before
  358. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  359. @item makeup
  360. Set the amount by how much signal will be amplified after processing.
  361. Default is 1. Range is from 1 to 64.
  362. @item knee
  363. Curve the sharp knee around the threshold to enter gain reduction more softly.
  364. Default is 2.82843. Range is between 1 and 8.
  365. @item link
  366. Choose if the @code{average} level between all channels of input stream
  367. or the louder(@code{maximum}) channel of input stream affects the
  368. reduction. Default is @code{average}.
  369. @item detection
  370. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  371. of @code{rms}. Default is @code{rms} which is mostly smoother.
  372. @item mix
  373. How much to use compressed signal in output. Default is 1.
  374. Range is between 0 and 1.
  375. @end table
  376. @subsection Commands
  377. This filter supports the all above options as @ref{commands}.
  378. @section acontrast
  379. Simple audio dynamic range compression/expansion filter.
  380. The filter accepts the following options:
  381. @table @option
  382. @item contrast
  383. Set contrast. Default is 33. Allowed range is between 0 and 100.
  384. @end table
  385. @section acopy
  386. Copy the input audio source unchanged to the output. This is mainly useful for
  387. testing purposes.
  388. @section acrossfade
  389. Apply cross fade from one input audio stream to another input audio stream.
  390. The cross fade is applied for specified duration near the end of first stream.
  391. The filter accepts the following options:
  392. @table @option
  393. @item nb_samples, ns
  394. Specify the number of samples for which the cross fade effect has to last.
  395. At the end of the cross fade effect the first input audio will be completely
  396. silent. Default is 44100.
  397. @item duration, d
  398. Specify the duration of the cross fade effect. See
  399. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  400. for the accepted syntax.
  401. By default the duration is determined by @var{nb_samples}.
  402. If set this option is used instead of @var{nb_samples}.
  403. @item overlap, o
  404. Should first stream end overlap with second stream start. Default is enabled.
  405. @item curve1
  406. Set curve for cross fade transition for first stream.
  407. @item curve2
  408. Set curve for cross fade transition for second stream.
  409. For description of available curve types see @ref{afade} filter description.
  410. @end table
  411. @subsection Examples
  412. @itemize
  413. @item
  414. Cross fade from one input to another:
  415. @example
  416. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  417. @end example
  418. @item
  419. Cross fade from one input to another but without overlapping:
  420. @example
  421. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  422. @end example
  423. @end itemize
  424. @section acrossover
  425. Split audio stream into several bands.
  426. This filter splits audio stream into two or more frequency ranges.
  427. Summing all streams back will give flat output.
  428. The filter accepts the following options:
  429. @table @option
  430. @item split
  431. Set split frequencies. Those must be positive and increasing.
  432. @item order
  433. Set filter order for each band split. This controls filter roll-off or steepness
  434. of filter transfer function.
  435. Available values are:
  436. @table @samp
  437. @item 2nd
  438. 12 dB per octave.
  439. @item 4th
  440. 24 dB per octave.
  441. @item 6th
  442. 36 dB per octave.
  443. @item 8th
  444. 48 dB per octave.
  445. @item 10th
  446. 60 dB per octave.
  447. @item 12th
  448. 72 dB per octave.
  449. @item 14th
  450. 84 dB per octave.
  451. @item 16th
  452. 96 dB per octave.
  453. @item 18th
  454. 108 dB per octave.
  455. @item 20th
  456. 120 dB per octave.
  457. @end table
  458. Default is @var{4th}.
  459. @item level
  460. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  461. @item gains
  462. Set output gain for each band. Default value is 1 for all bands.
  463. @item precision
  464. Set which precision to use when processing samples.
  465. @table @option
  466. @item auto
  467. Auto pick internal sample format depending on other filters.
  468. @item float
  469. Always use single-floating point precision sample format.
  470. @item double
  471. Always use double-floating point precision sample format.
  472. @end table
  473. Default value is @code{auto}.
  474. @end table
  475. @subsection Examples
  476. @itemize
  477. @item
  478. Split input audio stream into two bands (low and high) with split frequency of 1500 Hz,
  479. each band will be in separate stream:
  480. @example
  481. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  482. @end example
  483. @item
  484. Same as above, but with higher filter order:
  485. @example
  486. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500:order=8th[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  487. @end example
  488. @item
  489. Same as above, but also with additional middle band (frequencies between 1500 and 8000):
  490. @example
  491. 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
  492. @end example
  493. @end itemize
  494. @section acrusher
  495. Reduce audio bit resolution.
  496. This filter is bit crusher with enhanced functionality. A bit crusher
  497. is used to audibly reduce number of bits an audio signal is sampled
  498. with. This doesn't change the bit depth at all, it just produces the
  499. effect. Material reduced in bit depth sounds more harsh and "digital".
  500. This filter is able to even round to continuous values instead of discrete
  501. bit depths.
  502. Additionally it has a D/C offset which results in different crushing of
  503. the lower and the upper half of the signal.
  504. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  505. Another feature of this filter is the logarithmic mode.
  506. This setting switches from linear distances between bits to logarithmic ones.
  507. The result is a much more "natural" sounding crusher which doesn't gate low
  508. signals for example. The human ear has a logarithmic perception,
  509. so this kind of crushing is much more pleasant.
  510. Logarithmic crushing is also able to get anti-aliased.
  511. The filter accepts the following options:
  512. @table @option
  513. @item level_in
  514. Set level in.
  515. @item level_out
  516. Set level out.
  517. @item bits
  518. Set bit reduction.
  519. @item mix
  520. Set mixing amount.
  521. @item mode
  522. Can be linear: @code{lin} or logarithmic: @code{log}.
  523. @item dc
  524. Set DC.
  525. @item aa
  526. Set anti-aliasing.
  527. @item samples
  528. Set sample reduction.
  529. @item lfo
  530. Enable LFO. By default disabled.
  531. @item lforange
  532. Set LFO range.
  533. @item lforate
  534. Set LFO rate.
  535. @end table
  536. @subsection Commands
  537. This filter supports the all above options as @ref{commands}.
  538. @section acue
  539. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  540. filter.
  541. @section adeclick
  542. Remove impulsive noise from input audio.
  543. Samples detected as impulsive noise are replaced by interpolated samples using
  544. autoregressive modelling.
  545. @table @option
  546. @item window, w
  547. Set window size, in milliseconds. Allowed range is from @code{10} to
  548. @code{100}. Default value is @code{55} milliseconds.
  549. This sets size of window which will be processed at once.
  550. @item overlap, o
  551. Set window overlap, in percentage of window size. Allowed range is from
  552. @code{50} to @code{95}. Default value is @code{75} percent.
  553. Setting this to a very high value increases impulsive noise removal but makes
  554. whole process much slower.
  555. @item arorder, a
  556. Set autoregression order, in percentage of window size. Allowed range is from
  557. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  558. controls quality of interpolated samples using neighbour good samples.
  559. @item threshold, t
  560. Set threshold value. Allowed range is from @code{1} to @code{100}.
  561. Default value is @code{2}.
  562. This controls the strength of impulsive noise which is going to be removed.
  563. The lower value, the more samples will be detected as impulsive noise.
  564. @item burst, b
  565. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  566. @code{10}. Default value is @code{2}.
  567. If any two samples detected as noise are spaced less than this value then any
  568. sample between those two samples will be also detected as noise.
  569. @item method, m
  570. Set overlap method.
  571. It accepts the following values:
  572. @table @option
  573. @item add, a
  574. Select overlap-add method. Even not interpolated samples are slightly
  575. changed with this method.
  576. @item save, s
  577. Select overlap-save method. Not interpolated samples remain unchanged.
  578. @end table
  579. Default value is @code{a}.
  580. @end table
  581. @section adeclip
  582. Remove clipped samples from input audio.
  583. Samples detected as clipped are replaced by interpolated samples using
  584. autoregressive modelling.
  585. @table @option
  586. @item window, w
  587. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  588. Default value is @code{55} milliseconds.
  589. This sets size of window which will be processed at once.
  590. @item overlap, o
  591. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  592. to @code{95}. Default value is @code{75} percent.
  593. @item arorder, a
  594. Set autoregression order, in percentage of window size. Allowed range is from
  595. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  596. quality of interpolated samples using neighbour good samples.
  597. @item threshold, t
  598. Set threshold value. Allowed range is from @code{1} to @code{100}.
  599. Default value is @code{10}. Higher values make clip detection less aggressive.
  600. @item hsize, n
  601. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  602. Default value is @code{1000}. Higher values make clip detection less aggressive.
  603. @item method, m
  604. Set overlap method.
  605. It accepts the following values:
  606. @table @option
  607. @item add, a
  608. Select overlap-add method. Even not interpolated samples are slightly changed
  609. with this method.
  610. @item save, s
  611. Select overlap-save method. Not interpolated samples remain unchanged.
  612. @end table
  613. Default value is @code{a}.
  614. @end table
  615. @section adecorrelate
  616. Apply decorrelation to input audio stream.
  617. The filter accepts the following options:
  618. @table @option
  619. @item stages
  620. Set decorrelation stages of filtering. Allowed
  621. range is from 1 to 16. Default value is 6.
  622. @item seed
  623. Set random seed used for setting delay in samples across channels.
  624. @end table
  625. @section adelay
  626. Delay one or more audio channels.
  627. Samples in delayed channel are filled with silence.
  628. The filter accepts the following option:
  629. @table @option
  630. @item delays
  631. Set list of delays in milliseconds for each channel separated by '|'.
  632. Unused delays will be silently ignored. If number of given delays is
  633. smaller than number of channels all remaining channels will not be delayed.
  634. If you want to delay exact number of samples, append 'S' to number.
  635. If you want instead to delay in seconds, append 's' to number.
  636. @item all
  637. Use last set delay for all remaining channels. By default is disabled.
  638. This option if enabled changes how option @code{delays} is interpreted.
  639. @end table
  640. @subsection Examples
  641. @itemize
  642. @item
  643. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  644. the second channel (and any other channels that may be present) unchanged.
  645. @example
  646. adelay=1500|0|500
  647. @end example
  648. @item
  649. Delay second channel by 500 samples, the third channel by 700 samples and leave
  650. the first channel (and any other channels that may be present) unchanged.
  651. @example
  652. adelay=0|500S|700S
  653. @end example
  654. @item
  655. Delay all channels by same number of samples:
  656. @example
  657. adelay=delays=64S:all=1
  658. @end example
  659. @end itemize
  660. @section adenorm
  661. Remedy denormals in audio by adding extremely low-level noise.
  662. This filter shall be placed before any filter that can produce denormals.
  663. A description of the accepted parameters follows.
  664. @table @option
  665. @item level
  666. Set level of added noise in dB. Default is @code{-351}.
  667. Allowed range is from -451 to -90.
  668. @item type
  669. Set type of added noise.
  670. @table @option
  671. @item dc
  672. Add DC signal.
  673. @item ac
  674. Add AC signal.
  675. @item square
  676. Add square signal.
  677. @item pulse
  678. Add pulse signal.
  679. @end table
  680. Default is @code{dc}.
  681. @end table
  682. @subsection Commands
  683. This filter supports the all above options as @ref{commands}.
  684. @section aderivative, aintegral
  685. Compute derivative/integral of audio stream.
  686. Applying both filters one after another produces original audio.
  687. @section adrc
  688. Apply spectral dynamic range controller filter to input audio stream.
  689. A description of the accepted options follows.
  690. @table @option
  691. @item transfer
  692. Set the transfer expression.
  693. The expression can contain the following constants:
  694. @table @option
  695. @item ch
  696. current channel number
  697. @item sn
  698. current sample number
  699. @item nb_channels
  700. number of channels
  701. @item t
  702. timestamp expressed in seconds
  703. @item sr
  704. sample rate
  705. @item p
  706. current frequency power value, in dB
  707. @item f
  708. current frequency in Hz
  709. @end table
  710. Default value is @code{p}.
  711. @item attack
  712. Set the attack in milliseconds. Default is @code{50} milliseconds.
  713. Allowed range is from 1 to 1000 milliseconds.
  714. @item release
  715. Set the release in milliseconds. Default is @code{100} milliseconds.
  716. Allowed range is from 5 to 2000 milliseconds.
  717. @item channels
  718. Set which channels to filter, by default @code{all} channels in audio stream are filtered.
  719. @end table
  720. @subsection Commands
  721. This filter supports the all above options as @ref{commands}.
  722. @subsection Examples
  723. @itemize
  724. @item
  725. Apply spectral compression to all frequencies with threshold of -50 dB and 1:6 ratio:
  726. @example
  727. adrc=transfer='if(gt(p,-50),-50+(p-(-50))/6,p)':attack=50:release=100
  728. @end example
  729. @item
  730. Similar to above but with 1:2 ratio and filtering only front center channel:
  731. @example
  732. adrc=transfer='if(gt(p,-50),-50+(p-(-50))/2,p)':attack=50:release=100:channels=FC
  733. @end example
  734. @item
  735. Apply spectral noise gate to all frequencies with threshold of -85 dB and with short attack time and short release time:
  736. @example
  737. adrc=transfer='if(lte(p,-85),p-800,p)':attack=1:release=5
  738. @end example
  739. @item
  740. Apply spectral expansion to all frequencies with threshold of -10 dB and 1:2 ratio:
  741. @example
  742. adrc=transfer='if(lt(p,-10),-10+(p-(-10))*2,p)':attack=50:release=100
  743. @end example
  744. @item
  745. Apply limiter to max -60 dB to all frequencies, with attack of 2 ms and release of 10 ms:
  746. @example
  747. adrc=transfer='min(p,-60)':attack=2:release=10
  748. @end example
  749. @end itemize
  750. @section adynamicequalizer
  751. Apply dynamic equalization to input audio stream.
  752. A description of the accepted options follows.
  753. @table @option
  754. @item threshold
  755. Set the detection threshold used to trigger equalization.
  756. Threshold detection is using bandpass filter.
  757. Default value is 0. Allowed range is from 0 to 100.
  758. @item dfrequency
  759. Set the detection frequency in Hz used for bandpass filter used to trigger equalization.
  760. Default value is 1000 Hz. Allowed range is between 2 and 1000000 Hz.
  761. @item dqfactor
  762. Set the detection resonance factor for bandpass filter used to trigger equalization.
  763. Default value is 1. Allowed range is from 0.001 to 1000.
  764. @item tfrequency
  765. Set the target frequency of equalization filter.
  766. Default value is 1000 Hz. Allowed range is between 2 and 1000000 Hz.
  767. @item tqfactor
  768. Set the target resonance factor for target equalization filter.
  769. Default value is 1. Allowed range is from 0.001 to 1000.
  770. @item attack
  771. Set the amount of milliseconds the signal from detection has to rise above
  772. the detection threshold before equalization starts.
  773. Default is 20. Allowed range is between 1 and 2000.
  774. @item release
  775. Set the amount of milliseconds the signal from detection has to fall below the
  776. detection threshold before equalization ends.
  777. Default is 200. Allowed range is between 1 and 2000.
  778. @item ratio
  779. Set the ratio by which the equalization gain is raised.
  780. Default is 1. Allowed range is between 0 and 30.
  781. @item makeup
  782. Set the makeup offset by which the equalization gain is raised.
  783. Default is 0. Allowed range is between 0 and 100.
  784. @item range
  785. Set the max allowed cut/boost amount. Default is 50.
  786. Allowed range is from 1 to 200.
  787. @item mode
  788. Set the mode of filter operation, can be one of the following:
  789. @table @samp
  790. @item listen
  791. Output only isolated bandpass signal.
  792. @item cut
  793. Cut frequencies above detection threshold.
  794. @item boost
  795. Boost frequencies bellow detection threshold.
  796. @end table
  797. Default mode is @samp{cut}.
  798. @item tftype
  799. Set the type of target filter, can be one of the following:
  800. @table @samp
  801. @item bell
  802. @item lowshelf
  803. @item highshelf
  804. @end table
  805. Default type is @samp{bell}.
  806. @item direction
  807. Set processing direction relative to threshold.
  808. @table @samp
  809. @item downward
  810. Boost/Cut if threshold is higher/lower than detected volume.
  811. @item upward
  812. Boost/Cut if threshold is lower/higher than detected volume.
  813. @end table
  814. Default direction is @samp{downward}.
  815. @item auto
  816. Automatically gather threshold from detection filter. By default
  817. is @samp{disabled}.
  818. This option is useful to detect threshold in certain time frame of
  819. input audio stream, in such case option value is changed at runtime.
  820. Available values are:
  821. @table @samp
  822. @item disabled
  823. Disable using automatically gathered threshold value.
  824. @item off
  825. Stop picking threshold value.
  826. @item on
  827. Start picking threshold value.
  828. @end table
  829. @end table
  830. @subsection Commands
  831. This filter supports the all above options as @ref{commands}.
  832. @section adynamicsmooth
  833. Apply dynamic smoothing to input audio stream.
  834. A description of the accepted options follows.
  835. @table @option
  836. @item sensitivity
  837. Set an amount of sensitivity to frequency fluctations. Default is 2.
  838. Allowed range is from 0 to 1e+06.
  839. @item basefreq
  840. Set a base frequency for smoothing. Default value is 22050.
  841. Allowed range is from 2 to 1e+06.
  842. @end table
  843. @subsection Commands
  844. This filter supports the all above options as @ref{commands}.
  845. @section aecho
  846. Apply echoing to the input audio.
  847. Echoes are reflected sound and can occur naturally amongst mountains
  848. (and sometimes large buildings) when talking or shouting; digital echo
  849. effects emulate this behaviour and are often used to help fill out the
  850. sound of a single instrument or vocal. The time difference between the
  851. original signal and the reflection is the @code{delay}, and the
  852. loudness of the reflected signal is the @code{decay}.
  853. Multiple echoes can have different delays and decays.
  854. A description of the accepted parameters follows.
  855. @table @option
  856. @item in_gain
  857. Set input gain of reflected signal. Default is @code{0.6}.
  858. @item out_gain
  859. Set output gain of reflected signal. Default is @code{0.3}.
  860. @item delays
  861. Set list of time intervals in milliseconds between original signal and reflections
  862. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  863. Default is @code{1000}.
  864. @item decays
  865. Set list of loudness of reflected signals separated by '|'.
  866. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  867. Default is @code{0.5}.
  868. @end table
  869. @subsection Examples
  870. @itemize
  871. @item
  872. Make it sound as if there are twice as many instruments as are actually playing:
  873. @example
  874. aecho=0.8:0.88:60:0.4
  875. @end example
  876. @item
  877. If delay is very short, then it sounds like a (metallic) robot playing music:
  878. @example
  879. aecho=0.8:0.88:6:0.4
  880. @end example
  881. @item
  882. A longer delay will sound like an open air concert in the mountains:
  883. @example
  884. aecho=0.8:0.9:1000:0.3
  885. @end example
  886. @item
  887. Same as above but with one more mountain:
  888. @example
  889. aecho=0.8:0.9:1000|1800:0.3|0.25
  890. @end example
  891. @end itemize
  892. @section aemphasis
  893. Audio emphasis filter creates or restores material directly taken from LPs or
  894. emphased CDs with different filter curves. E.g. to store music on vinyl the
  895. signal has to be altered by a filter first to even out the disadvantages of
  896. this recording medium.
  897. Once the material is played back the inverse filter has to be applied to
  898. restore the distortion of the frequency response.
  899. The filter accepts the following options:
  900. @table @option
  901. @item level_in
  902. Set input gain.
  903. @item level_out
  904. Set output gain.
  905. @item mode
  906. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  907. use @code{production} mode. Default is @code{reproduction} mode.
  908. @item type
  909. Set filter type. Selects medium. Can be one of the following:
  910. @table @option
  911. @item col
  912. select Columbia.
  913. @item emi
  914. select EMI.
  915. @item bsi
  916. select BSI (78RPM).
  917. @item riaa
  918. select RIAA.
  919. @item cd
  920. select Compact Disc (CD).
  921. @item 50fm
  922. select 50µs (FM).
  923. @item 75fm
  924. select 75µs (FM).
  925. @item 50kf
  926. select 50µs (FM-KF).
  927. @item 75kf
  928. select 75µs (FM-KF).
  929. @end table
  930. @end table
  931. @subsection Commands
  932. This filter supports the all above options as @ref{commands}.
  933. @section aeval
  934. Modify an audio signal according to the specified expressions.
  935. This filter accepts one or more expressions (one for each channel),
  936. which are evaluated and used to modify a corresponding audio signal.
  937. It accepts the following parameters:
  938. @table @option
  939. @item exprs
  940. Set the '|'-separated expressions list for each separate channel. If
  941. the number of input channels is greater than the number of
  942. expressions, the last specified expression is used for the remaining
  943. output channels.
  944. @item channel_layout, c
  945. Set output channel layout. If not specified, the channel layout is
  946. specified by the number of expressions. If set to @samp{same}, it will
  947. use by default the same input channel layout.
  948. @end table
  949. Each expression in @var{exprs} can contain the following constants and functions:
  950. @table @option
  951. @item ch
  952. channel number of the current expression
  953. @item n
  954. number of the evaluated sample, starting from 0
  955. @item s
  956. sample rate
  957. @item t
  958. time of the evaluated sample expressed in seconds
  959. @item nb_in_channels
  960. @item nb_out_channels
  961. input and output number of channels
  962. @item val(CH)
  963. the value of input channel with number @var{CH}
  964. @end table
  965. Note: this filter is slow. For faster processing you should use a
  966. dedicated filter.
  967. @subsection Examples
  968. @itemize
  969. @item
  970. Half volume:
  971. @example
  972. aeval=val(ch)/2:c=same
  973. @end example
  974. @item
  975. Invert phase of the second channel:
  976. @example
  977. aeval=val(0)|-val(1)
  978. @end example
  979. @end itemize
  980. @section aexciter
  981. An exciter is used to produce high sound that is not present in the
  982. original signal. This is done by creating harmonic distortions of the
  983. signal which are restricted in range and added to the original signal.
  984. An Exciter raises the upper end of an audio signal without simply raising
  985. the higher frequencies like an equalizer would do to create a more
  986. "crisp" or "brilliant" sound.
  987. The filter accepts the following options:
  988. @table @option
  989. @item level_in
  990. Set input level prior processing of signal.
  991. Allowed range is from 0 to 64.
  992. Default value is 1.
  993. @item level_out
  994. Set output level after processing of signal.
  995. Allowed range is from 0 to 64.
  996. Default value is 1.
  997. @item amount
  998. Set the amount of harmonics added to original signal.
  999. Allowed range is from 0 to 64.
  1000. Default value is 1.
  1001. @item drive
  1002. Set the amount of newly created harmonics.
  1003. Allowed range is from 0.1 to 10.
  1004. Default value is 8.5.
  1005. @item blend
  1006. Set the octave of newly created harmonics.
  1007. Allowed range is from -10 to 10.
  1008. Default value is 0.
  1009. @item freq
  1010. Set the lower frequency limit of producing harmonics in Hz.
  1011. Allowed range is from 2000 to 12000 Hz.
  1012. Default is 7500 Hz.
  1013. @item ceil
  1014. Set the upper frequency limit of producing harmonics.
  1015. Allowed range is from 9999 to 20000 Hz.
  1016. If value is lower than 10000 Hz no limit is applied.
  1017. @item listen
  1018. Mute the original signal and output only added harmonics.
  1019. By default is disabled.
  1020. @end table
  1021. @subsection Commands
  1022. This filter supports the all above options as @ref{commands}.
  1023. @anchor{afade}
  1024. @section afade
  1025. Apply fade-in/out effect to input audio.
  1026. A description of the accepted parameters follows.
  1027. @table @option
  1028. @item type, t
  1029. Specify the effect type, can be either @code{in} for fade-in, or
  1030. @code{out} for a fade-out effect. Default is @code{in}.
  1031. @item start_sample, ss
  1032. Specify the number of the start sample for starting to apply the fade
  1033. effect. Default is 0.
  1034. @item nb_samples, ns
  1035. Specify the number of samples for which the fade effect has to last. At
  1036. the end of the fade-in effect the output audio will have the same
  1037. volume as the input audio, at the end of the fade-out transition
  1038. the output audio will be silence. Default is 44100.
  1039. @item start_time, st
  1040. Specify the start time of the fade effect. Default is 0.
  1041. The value must be specified as a time duration; see
  1042. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1043. for the accepted syntax.
  1044. If set this option is used instead of @var{start_sample}.
  1045. @item duration, d
  1046. Specify the duration of the fade effect. See
  1047. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1048. for the accepted syntax.
  1049. At the end of the fade-in effect the output audio will have the same
  1050. volume as the input audio, at the end of the fade-out transition
  1051. the output audio will be silence.
  1052. By default the duration is determined by @var{nb_samples}.
  1053. If set this option is used instead of @var{nb_samples}.
  1054. @item curve
  1055. Set curve for fade transition.
  1056. It accepts the following values:
  1057. @table @option
  1058. @item tri
  1059. select triangular, linear slope (default)
  1060. @item qsin
  1061. select quarter of sine wave
  1062. @item hsin
  1063. select half of sine wave
  1064. @item esin
  1065. select exponential sine wave
  1066. @item log
  1067. select logarithmic
  1068. @item ipar
  1069. select inverted parabola
  1070. @item qua
  1071. select quadratic
  1072. @item cub
  1073. select cubic
  1074. @item squ
  1075. select square root
  1076. @item cbr
  1077. select cubic root
  1078. @item par
  1079. select parabola
  1080. @item exp
  1081. select exponential
  1082. @item iqsin
  1083. select inverted quarter of sine wave
  1084. @item ihsin
  1085. select inverted half of sine wave
  1086. @item dese
  1087. select double-exponential seat
  1088. @item desi
  1089. select double-exponential sigmoid
  1090. @item losi
  1091. select logistic sigmoid
  1092. @item sinc
  1093. select sine cardinal function
  1094. @item isinc
  1095. select inverted sine cardinal function
  1096. @item nofade
  1097. no fade applied
  1098. @end table
  1099. @item silence
  1100. Set the initial gain for fade-in or final gain for fade-out.
  1101. Default value is @code{0.0}.
  1102. @item unity
  1103. Set the initial gain for fade-out or final gain for fade-in.
  1104. Default value is @code{1.0}.
  1105. @end table
  1106. @subsection Commands
  1107. This filter supports the all above options as @ref{commands}.
  1108. @subsection Examples
  1109. @itemize
  1110. @item
  1111. Fade in first 15 seconds of audio:
  1112. @example
  1113. afade=t=in:ss=0:d=15
  1114. @end example
  1115. @item
  1116. Fade out last 25 seconds of a 900 seconds audio:
  1117. @example
  1118. afade=t=out:st=875:d=25
  1119. @end example
  1120. @end itemize
  1121. @section afftdn
  1122. Denoise audio samples with FFT.
  1123. A description of the accepted parameters follows.
  1124. @table @option
  1125. @item noise_reduction, nr
  1126. Set the noise reduction in dB, allowed range is 0.01 to 97.
  1127. Default value is 12 dB.
  1128. @item noise_floor, nf
  1129. Set the noise floor in dB, allowed range is -80 to -20.
  1130. Default value is -50 dB.
  1131. @item noise_type, nt
  1132. Set the noise type.
  1133. It accepts the following values:
  1134. @table @option
  1135. @item white, w
  1136. Select white noise.
  1137. @item vinyl, v
  1138. Select vinyl noise.
  1139. @item shellac, s
  1140. Select shellac noise.
  1141. @item custom, c
  1142. Select custom noise, defined in @code{bn} option.
  1143. Default value is white noise.
  1144. @end table
  1145. @item band_noise, bn
  1146. Set custom band noise profile for every one of 15 bands.
  1147. Bands are separated by ' ' or '|'.
  1148. @item residual_floor, rf
  1149. Set the residual floor in dB, allowed range is -80 to -20.
  1150. Default value is -38 dB.
  1151. @item track_noise, tn
  1152. Enable noise floor tracking. By default is disabled.
  1153. With this enabled, noise floor is automatically adjusted.
  1154. @item track_residual, tr
  1155. Enable residual tracking. By default is disabled.
  1156. @item output_mode, om
  1157. Set the output mode.
  1158. It accepts the following values:
  1159. @table @option
  1160. @item input, i
  1161. Pass input unchanged.
  1162. @item output, o
  1163. Pass noise filtered out.
  1164. @item noise, n
  1165. Pass only noise.
  1166. Default value is @var{output}.
  1167. @end table
  1168. @item adaptivity, ad
  1169. Set the adaptivity factor, used how fast to adapt gains adjustments per
  1170. each frequency bin. Value @var{0} enables instant adaptation, while higher values
  1171. react much slower.
  1172. Allowed range is from @var{0} to @var{1}. Default value is @var{0.5}.
  1173. @item floor_offset, fo
  1174. Set the noise floor offset factor. This option is used to adjust offset applied to measured
  1175. noise floor. It is only effective when noise floor tracking is enabled.
  1176. Allowed range is from @var{-2.0} to @var{2.0}. Default value is @var{1.0}.
  1177. @item noise_link, nl
  1178. Set the noise link used for multichannel audio.
  1179. It accepts the following values:
  1180. @table @option
  1181. @item none
  1182. Use unchanged channel's noise floor.
  1183. @item min
  1184. Use measured min noise floor of all channels.
  1185. @item max
  1186. Use measured max noise floor of all channels.
  1187. @item average
  1188. Use measured average noise floor of all channels.
  1189. Default value is @var{min}.
  1190. @end table
  1191. @item band_multiplier, bm
  1192. Set the band multiplier factor, used how much to spread bands across frequency bins.
  1193. Allowed range is from @var{0.2} to @var{5}. Default value is @var{1.25}.
  1194. @item sample_noise, sn
  1195. Toggle capturing and measurement of noise profile from input audio.
  1196. It accepts the following values:
  1197. @table @option
  1198. @item start, begin
  1199. Start sample noise capture.
  1200. @item stop, end
  1201. Stop sample noise capture and measure new noise band profile.
  1202. Default value is @code{none}.
  1203. @end table
  1204. @item gain_smooth, gs
  1205. Set gain smooth spatial radius, used to smooth gains applied to each frequency bin.
  1206. Useful to reduce random music noise artefacts.
  1207. Higher values increases smoothing of gains.
  1208. Allowed range is from @code{0} to @code{50}.
  1209. Default value is @code{0}.
  1210. @end table
  1211. @subsection Commands
  1212. This filter supports the some above mentioned options as @ref{commands}.
  1213. @subsection Examples
  1214. @itemize
  1215. @item
  1216. Reduce white noise by 10dB, and use previously measured noise floor of -40dB:
  1217. @example
  1218. afftdn=nr=10:nf=-40
  1219. @end example
  1220. @item
  1221. Reduce white noise by 10dB, also set initial noise floor to -80dB and enable automatic
  1222. tracking of noise floor so noise floor will gradually change during processing:
  1223. @example
  1224. afftdn=nr=10:nf=-80:tn=1
  1225. @end example
  1226. @item
  1227. Reduce noise by 20dB, using noise floor of -40dB and using commands to take noise profile
  1228. of first 0.4 seconds of input audio:
  1229. @example
  1230. asendcmd=0.0 afftdn sn start,asendcmd=0.4 afftdn sn stop,afftdn=nr=20:nf=-40
  1231. @end example
  1232. @end itemize
  1233. @section afftfilt
  1234. Apply arbitrary expressions to samples in frequency domain.
  1235. @table @option
  1236. @item real
  1237. Set frequency domain real expression for each separate channel separated
  1238. by '|'. Default is "re".
  1239. If the number of input channels is greater than the number of
  1240. expressions, the last specified expression is used for the remaining
  1241. output channels.
  1242. @item imag
  1243. Set frequency domain imaginary expression for each separate channel
  1244. separated by '|'. Default is "im".
  1245. Each expression in @var{real} and @var{imag} can contain the following
  1246. constants and functions:
  1247. @table @option
  1248. @item sr
  1249. sample rate
  1250. @item b
  1251. current frequency bin number
  1252. @item nb
  1253. number of available bins
  1254. @item ch
  1255. channel number of the current expression
  1256. @item chs
  1257. number of channels
  1258. @item pts
  1259. current frame pts
  1260. @item re
  1261. current real part of frequency bin of current channel
  1262. @item im
  1263. current imaginary part of frequency bin of current channel
  1264. @item real(b, ch)
  1265. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  1266. @item imag(b, ch)
  1267. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  1268. @end table
  1269. @item win_size
  1270. Set window size. Allowed range is from 16 to 131072.
  1271. Default is @code{4096}
  1272. @item win_func
  1273. Set window function.
  1274. It accepts the following values:
  1275. @table @samp
  1276. @item rect
  1277. @item bartlett
  1278. @item hann, hanning
  1279. @item hamming
  1280. @item blackman
  1281. @item welch
  1282. @item flattop
  1283. @item bharris
  1284. @item bnuttall
  1285. @item bhann
  1286. @item sine
  1287. @item nuttall
  1288. @item lanczos
  1289. @item gauss
  1290. @item tukey
  1291. @item dolph
  1292. @item cauchy
  1293. @item parzen
  1294. @item poisson
  1295. @item bohman
  1296. @item kaiser
  1297. @end table
  1298. Default is @code{hann}.
  1299. @item overlap
  1300. Set window overlap. If set to 1, the recommended overlap for selected
  1301. window function will be picked. Default is @code{0.75}.
  1302. @end table
  1303. @subsection Examples
  1304. @itemize
  1305. @item
  1306. Leave almost only low frequencies in audio:
  1307. @example
  1308. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  1309. @end example
  1310. @item
  1311. Apply robotize effect:
  1312. @example
  1313. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  1314. @end example
  1315. @item
  1316. Apply whisper effect:
  1317. @example
  1318. 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"
  1319. @end example
  1320. @item
  1321. Apply phase shift:
  1322. @example
  1323. afftfilt="real=re*cos(1)-im*sin(1):imag=re*sin(1)+im*cos(1)"
  1324. @end example
  1325. @end itemize
  1326. @anchor{afir}
  1327. @section afir
  1328. Apply an arbitrary Finite Impulse Response filter.
  1329. This filter is designed for applying long FIR filters,
  1330. up to 60 seconds long.
  1331. It can be used as component for digital crossover filters,
  1332. room equalization, cross talk cancellation, wavefield synthesis,
  1333. auralization, ambiophonics, ambisonics and spatialization.
  1334. This filter uses the streams higher than first one as FIR coefficients.
  1335. If the non-first stream holds a single channel, it will be used
  1336. for all input channels in the first stream, otherwise
  1337. the number of channels in the non-first stream must be same as
  1338. the number of channels in the first stream.
  1339. It accepts the following parameters:
  1340. @table @option
  1341. @item dry
  1342. Set dry gain. This sets input gain.
  1343. @item wet
  1344. Set wet gain. This sets final output gain.
  1345. @item length
  1346. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  1347. @item gtype
  1348. Enable applying gain measured from power of IR.
  1349. Set which approach to use for auto gain measurement.
  1350. @table @option
  1351. @item none
  1352. Do not apply any gain.
  1353. @item peak
  1354. select peak gain, very conservative approach. This is default value.
  1355. @item dc
  1356. select DC gain, limited application.
  1357. @item gn
  1358. select gain to noise approach, this is most popular one.
  1359. @item ac
  1360. select AC gain.
  1361. @item rms
  1362. select RMS gain.
  1363. @end table
  1364. @item irgain
  1365. Set gain to be applied to IR coefficients before filtering.
  1366. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  1367. @item irfmt
  1368. Set format of IR stream. Can be @code{mono} or @code{input}.
  1369. Default is @code{input}.
  1370. @item maxir
  1371. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  1372. Allowed range is 0.1 to 60 seconds.
  1373. @item response
  1374. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1375. By default it is disabled.
  1376. @item channel
  1377. Set for which IR channel to display frequency response. By default is first channel
  1378. displayed. This option is used only when @var{response} is enabled.
  1379. @item size
  1380. Set video stream size. This option is used only when @var{response} is enabled.
  1381. @item rate
  1382. Set video stream frame rate. This option is used only when @var{response} is enabled.
  1383. @item minp
  1384. Set minimal partition size used for convolution. Default is @var{8192}.
  1385. Allowed range is from @var{1} to @var{65536}.
  1386. Lower values decreases latency at cost of higher CPU usage.
  1387. @item maxp
  1388. Set maximal partition size used for convolution. Default is @var{8192}.
  1389. Allowed range is from @var{8} to @var{65536}.
  1390. Lower values may increase CPU usage.
  1391. @item nbirs
  1392. Set number of input impulse responses streams which will be switchable at runtime.
  1393. Allowed range is from @var{1} to @var{32}. Default is @var{1}.
  1394. @item ir
  1395. Set IR stream which will be used for convolution, starting from @var{0}, should always be
  1396. lower than supplied value by @code{nbirs} option. Default is @var{0}.
  1397. This option can be changed at runtime via @ref{commands}.
  1398. @item precision
  1399. Set which precision to use when processing samples.
  1400. @table @option
  1401. @item auto
  1402. Auto pick internal sample format depending on other filters.
  1403. @item float
  1404. Always use single-floating point precision sample format.
  1405. @item double
  1406. Always use double-floating point precision sample format.
  1407. @end table
  1408. Default value is auto.
  1409. @end table
  1410. @subsection Examples
  1411. @itemize
  1412. @item
  1413. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  1414. @example
  1415. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  1416. @end example
  1417. @item
  1418. Apply true stereo processing given input stereo stream, and two stereo impulse responses for left and right channel,
  1419. the impulse response files are files with names l_ir.wav and r_ir.wav:
  1420. @example
  1421. "pan=4C|c0=FL|c1=FL|c2=FR|c3=FR[a];amovie=l_ir.wav[LIR];amovie=r_ir.wav[RIR];[LIR][RIR]amerge[ir];[a][ir]afir=irfmt=input:gtype=gn:irgain=-5dB,pan=stereo|FL<c0+c2|FR<c1+c3"
  1422. @end example
  1423. @end itemize
  1424. @anchor{aformat}
  1425. @section aformat
  1426. Set output format constraints for the input audio. The framework will
  1427. negotiate the most appropriate format to minimize conversions.
  1428. It accepts the following parameters:
  1429. @table @option
  1430. @item sample_fmts, f
  1431. A '|'-separated list of requested sample formats.
  1432. @item sample_rates, r
  1433. A '|'-separated list of requested sample rates.
  1434. @item channel_layouts, cl
  1435. A '|'-separated list of requested channel layouts.
  1436. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1437. for the required syntax.
  1438. @end table
  1439. If a parameter is omitted, all values are allowed.
  1440. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1441. @example
  1442. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1443. @end example
  1444. @section afreqshift
  1445. Apply frequency shift to input audio samples.
  1446. The filter accepts the following options:
  1447. @table @option
  1448. @item shift
  1449. Specify frequency shift. Allowed range is -INT_MAX to INT_MAX.
  1450. Default value is 0.0.
  1451. @item level
  1452. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  1453. Default value is 1.0.
  1454. @item order
  1455. Set filter order used for filtering. Allowed range is from 1 to 16.
  1456. Default value is 8.
  1457. @end table
  1458. @subsection Commands
  1459. This filter supports the all above options as @ref{commands}.
  1460. @section afwtdn
  1461. Reduce broadband noise from input samples using Wavelets.
  1462. A description of the accepted options follows.
  1463. @table @option
  1464. @item sigma
  1465. Set the noise sigma, allowed range is from 0 to 1.
  1466. Default value is 0.
  1467. This option controls strength of denoising applied to input samples.
  1468. Most useful way to set this option is via decibels, eg. -45dB.
  1469. @item levels
  1470. Set the number of wavelet levels of decomposition.
  1471. Allowed range is from 1 to 12.
  1472. Default value is 10.
  1473. Setting this too low make denoising performance very poor.
  1474. @item wavet
  1475. Set wavelet type for decomposition of input frame.
  1476. They are sorted by number of coefficients, from lowest to highest.
  1477. More coefficients means worse filtering speed, but overall better quality.
  1478. Available wavelets are:
  1479. @table @samp
  1480. @item sym2
  1481. @item sym4
  1482. @item rbior68
  1483. @item deb10
  1484. @item sym10
  1485. @item coif5
  1486. @item bl3
  1487. @end table
  1488. @item percent
  1489. Set percent of full denoising. Allowed range is from 0 to 100 percent.
  1490. Default value is 85 percent or partial denoising.
  1491. @item profile
  1492. If enabled, first input frame will be used as noise profile.
  1493. If first frame samples contain non-noise performance will be very poor.
  1494. @item adaptive
  1495. If enabled, input frames are analyzed for presence of noise.
  1496. If noise is detected with high possibility then input frame profile will be
  1497. used for processing following frames, until new noise frame is detected.
  1498. @item samples
  1499. Set size of single frame in number of samples. Allowed range is from 512 to
  1500. 65536. Default frame size is 8192 samples.
  1501. @item softness
  1502. Set softness applied inside thresholding function. Allowed range is from 0 to
  1503. 10. Default softness is 1.
  1504. @end table
  1505. @subsection Commands
  1506. This filter supports the all above options as @ref{commands}.
  1507. @section agate
  1508. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1509. processing reduces disturbing noise between useful signals.
  1510. Gating is done by detecting the volume below a chosen level @var{threshold}
  1511. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1512. floor is set via @var{range}. Because an exact manipulation of the signal
  1513. would cause distortion of the waveform the reduction can be levelled over
  1514. time. This is done by setting @var{attack} and @var{release}.
  1515. @var{attack} determines how long the signal has to fall below the threshold
  1516. before any reduction will occur and @var{release} sets the time the signal
  1517. has to rise above the threshold to reduce the reduction again.
  1518. Shorter signals than the chosen attack time will be left untouched.
  1519. @table @option
  1520. @item level_in
  1521. Set input level before filtering.
  1522. Default is 1. Allowed range is from 0.015625 to 64.
  1523. @item mode
  1524. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1525. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1526. will be amplified, expanding dynamic range in upward direction.
  1527. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1528. @item range
  1529. Set the level of gain reduction when the signal is below the threshold.
  1530. Default is 0.06125. Allowed range is from 0 to 1.
  1531. Setting this to 0 disables reduction and then filter behaves like expander.
  1532. @item threshold
  1533. If a signal rises above this level the gain reduction is released.
  1534. Default is 0.125. Allowed range is from 0 to 1.
  1535. @item ratio
  1536. Set a ratio by which the signal is reduced.
  1537. Default is 2. Allowed range is from 1 to 9000.
  1538. @item attack
  1539. Amount of milliseconds the signal has to rise above the threshold before gain
  1540. reduction stops.
  1541. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1542. @item release
  1543. Amount of milliseconds the signal has to fall below the threshold before the
  1544. reduction is increased again. Default is 250 milliseconds.
  1545. Allowed range is from 0.01 to 9000.
  1546. @item makeup
  1547. Set amount of amplification of signal after processing.
  1548. Default is 1. Allowed range is from 1 to 64.
  1549. @item knee
  1550. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1551. Default is 2.828427125. Allowed range is from 1 to 8.
  1552. @item detection
  1553. Choose if exact signal should be taken for detection or an RMS like one.
  1554. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1555. @item link
  1556. Choose if the average level between all channels or the louder channel affects
  1557. the reduction.
  1558. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1559. @end table
  1560. @subsection Commands
  1561. This filter supports the all above options as @ref{commands}.
  1562. @section aiir
  1563. Apply an arbitrary Infinite Impulse Response filter.
  1564. It accepts the following parameters:
  1565. @table @option
  1566. @item zeros, z
  1567. Set B/numerator/zeros/reflection coefficients.
  1568. @item poles, p
  1569. Set A/denominator/poles/ladder coefficients.
  1570. @item gains, k
  1571. Set channels gains.
  1572. @item dry_gain
  1573. Set input gain.
  1574. @item wet_gain
  1575. Set output gain.
  1576. @item format, f
  1577. Set coefficients format.
  1578. @table @samp
  1579. @item ll
  1580. lattice-ladder function
  1581. @item sf
  1582. analog transfer function
  1583. @item tf
  1584. digital transfer function
  1585. @item zp
  1586. Z-plane zeros/poles, cartesian (default)
  1587. @item pr
  1588. Z-plane zeros/poles, polar radians
  1589. @item pd
  1590. Z-plane zeros/poles, polar degrees
  1591. @item sp
  1592. S-plane zeros/poles
  1593. @end table
  1594. @item process, r
  1595. Set type of processing.
  1596. @table @samp
  1597. @item d
  1598. direct processing
  1599. @item s
  1600. serial processing
  1601. @item p
  1602. parallel processing
  1603. @end table
  1604. @item precision, e
  1605. Set filtering precision.
  1606. @table @samp
  1607. @item dbl
  1608. double-precision floating-point (default)
  1609. @item flt
  1610. single-precision floating-point
  1611. @item i32
  1612. 32-bit integers
  1613. @item i16
  1614. 16-bit integers
  1615. @end table
  1616. @item normalize, n
  1617. Normalize filter coefficients, by default is enabled.
  1618. Enabling it will normalize magnitude response at DC to 0dB.
  1619. @item mix
  1620. How much to use filtered signal in output. Default is 1.
  1621. Range is between 0 and 1.
  1622. @item response
  1623. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1624. By default it is disabled.
  1625. @item channel
  1626. Set for which IR channel to display frequency response. By default is first channel
  1627. displayed. This option is used only when @var{response} is enabled.
  1628. @item size
  1629. Set video stream size. This option is used only when @var{response} is enabled.
  1630. @end table
  1631. Coefficients in @code{tf} and @code{sf} format are separated by spaces and are in ascending
  1632. order.
  1633. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1634. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1635. imaginary unit.
  1636. Different coefficients and gains can be provided for every channel, in such case
  1637. use '|' to separate coefficients or gains. Last provided coefficients will be
  1638. used for all remaining channels.
  1639. @subsection Examples
  1640. @itemize
  1641. @item
  1642. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1643. @example
  1644. 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
  1645. @end example
  1646. @item
  1647. Same as above but in @code{zp} format:
  1648. @example
  1649. 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
  1650. @end example
  1651. @item
  1652. Apply 3-rd order analog normalized Butterworth low-pass filter, using analog transfer function format:
  1653. @example
  1654. aiir=z=1.3057 0 0 0:p=1.3057 2.3892 2.1860 1:f=sf:r=d
  1655. @end example
  1656. @end itemize
  1657. @section alimiter
  1658. The limiter prevents an input signal from rising over a desired threshold.
  1659. This limiter uses lookahead technology to prevent your signal from distorting.
  1660. It means that there is a small delay after the signal is processed. Keep in mind
  1661. that the delay it produces is the attack time you set.
  1662. The filter accepts the following options:
  1663. @table @option
  1664. @item level_in
  1665. Set input gain. Default is 1.
  1666. @item level_out
  1667. Set output gain. Default is 1.
  1668. @item limit
  1669. Don't let signals above this level pass the limiter. Default is 1.
  1670. @item attack
  1671. The limiter will reach its attenuation level in this amount of time in
  1672. milliseconds. Default is 5 milliseconds.
  1673. @item release
  1674. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1675. Default is 50 milliseconds.
  1676. @item asc
  1677. When gain reduction is always needed ASC takes care of releasing to an
  1678. average reduction level rather than reaching a reduction of 0 in the release
  1679. time.
  1680. @item asc_level
  1681. Select how much the release time is affected by ASC, 0 means nearly no changes
  1682. in release time while 1 produces higher release times.
  1683. @item level
  1684. Auto level output signal. Default is enabled.
  1685. This normalizes audio back to 0dB if enabled.
  1686. @item latency
  1687. Compensate the delay introduced by using the lookahead buffer set with attack
  1688. parameter. Also flush the valid audio data in the lookahead buffer when the
  1689. stream hits EOF.
  1690. @end table
  1691. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1692. with @ref{aresample} before applying this filter.
  1693. @section allpass
  1694. Apply a two-pole all-pass filter with central frequency (in Hz)
  1695. @var{frequency}, and filter-width @var{width}.
  1696. An all-pass filter changes the audio's frequency to phase relationship
  1697. without changing its frequency to amplitude relationship.
  1698. The filter accepts the following options:
  1699. @table @option
  1700. @item frequency, f
  1701. Set frequency in Hz.
  1702. @item width_type, t
  1703. Set method to specify band-width of filter.
  1704. @table @option
  1705. @item h
  1706. Hz
  1707. @item q
  1708. Q-Factor
  1709. @item o
  1710. octave
  1711. @item s
  1712. slope
  1713. @item k
  1714. kHz
  1715. @end table
  1716. @item width, w
  1717. Specify the band-width of a filter in width_type units.
  1718. @item mix, m
  1719. How much to use filtered signal in output. Default is 1.
  1720. Range is between 0 and 1.
  1721. @item channels, c
  1722. Specify which channels to filter, by default all available are filtered.
  1723. @item normalize, n
  1724. Normalize biquad coefficients, by default is disabled.
  1725. Enabling it will normalize magnitude response at DC to 0dB.
  1726. @item order, o
  1727. Set the filter order, can be 1 or 2. Default is 2.
  1728. @item transform, a
  1729. Set transform type of IIR filter.
  1730. @table @option
  1731. @item di
  1732. @item dii
  1733. @item tdi
  1734. @item tdii
  1735. @item latt
  1736. @item svf
  1737. @item zdf
  1738. @end table
  1739. @item precision, r
  1740. Set precison of filtering.
  1741. @table @option
  1742. @item auto
  1743. Pick automatic sample format depending on surround filters.
  1744. @item s16
  1745. Always use signed 16-bit.
  1746. @item s32
  1747. Always use signed 32-bit.
  1748. @item f32
  1749. Always use float 32-bit.
  1750. @item f64
  1751. Always use float 64-bit.
  1752. @end table
  1753. @end table
  1754. @subsection Commands
  1755. This filter supports the following commands:
  1756. @table @option
  1757. @item frequency, f
  1758. Change allpass frequency.
  1759. Syntax for the command is : "@var{frequency}"
  1760. @item width_type, t
  1761. Change allpass width_type.
  1762. Syntax for the command is : "@var{width_type}"
  1763. @item width, w
  1764. Change allpass width.
  1765. Syntax for the command is : "@var{width}"
  1766. @item mix, m
  1767. Change allpass mix.
  1768. Syntax for the command is : "@var{mix}"
  1769. @end table
  1770. @section aloop
  1771. Loop audio samples.
  1772. The filter accepts the following options:
  1773. @table @option
  1774. @item loop
  1775. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1776. Default is 0.
  1777. @item size
  1778. Set maximal number of samples. Default is 0.
  1779. @item start
  1780. Set first sample of loop. Default is 0.
  1781. @end table
  1782. @anchor{amerge}
  1783. @section amerge
  1784. Merge two or more audio streams into a single multi-channel stream.
  1785. The filter accepts the following options:
  1786. @table @option
  1787. @item inputs
  1788. Set the number of inputs. Default is 2.
  1789. @end table
  1790. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1791. the channel layout of the output will be set accordingly and the channels
  1792. will be reordered as necessary. If the channel layouts of the inputs are not
  1793. disjoint, the output will have all the channels of the first input then all
  1794. the channels of the second input, in that order, and the channel layout of
  1795. the output will be the default value corresponding to the total number of
  1796. channels.
  1797. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1798. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1799. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1800. first input, b1 is the first channel of the second input).
  1801. On the other hand, if both input are in stereo, the output channels will be
  1802. in the default order: a1, a2, b1, b2, and the channel layout will be
  1803. arbitrarily set to 4.0, which may or may not be the expected value.
  1804. All inputs must have the same sample rate, and format.
  1805. If inputs do not have the same duration, the output will stop with the
  1806. shortest.
  1807. @subsection Examples
  1808. @itemize
  1809. @item
  1810. Merge two mono files into a stereo stream:
  1811. @example
  1812. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1813. @end example
  1814. @item
  1815. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1816. @example
  1817. 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
  1818. @end example
  1819. @end itemize
  1820. @section amix
  1821. Mixes multiple audio inputs into a single output.
  1822. Note that this filter only supports float samples (the @var{amerge}
  1823. and @var{pan} audio filters support many formats). If the @var{amix}
  1824. input has integer samples then @ref{aresample} will be automatically
  1825. inserted to perform the conversion to float samples.
  1826. It accepts the following parameters:
  1827. @table @option
  1828. @item inputs
  1829. The number of inputs. If unspecified, it defaults to 2.
  1830. @item duration
  1831. How to determine the end-of-stream.
  1832. @table @option
  1833. @item longest
  1834. The duration of the longest input. (default)
  1835. @item shortest
  1836. The duration of the shortest input.
  1837. @item first
  1838. The duration of the first input.
  1839. @end table
  1840. @item dropout_transition
  1841. The transition time, in seconds, for volume renormalization when an input
  1842. stream ends. The default value is 2 seconds.
  1843. @item weights
  1844. Specify weight of each input audio stream as a sequence of numbers separated
  1845. by a space. If fewer weights are specified compared to number of inputs, the
  1846. last weight is assigned to the remaining inputs.
  1847. Default weight for each input is 1.
  1848. @item normalize
  1849. Always scale inputs instead of only doing summation of samples.
  1850. Beware of heavy clipping if inputs are not normalized prior or after filtering
  1851. by this filter if this option is disabled. By default is enabled.
  1852. @end table
  1853. @subsection Examples
  1854. @itemize
  1855. @item
  1856. This will mix 3 input audio streams to a single output with the same duration as the
  1857. first input and a dropout transition time of 3 seconds:
  1858. @example
  1859. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1860. @end example
  1861. @item
  1862. This will mix one vocal and one music input audio stream to a single output with the same duration as the
  1863. longest input. The music will have quarter the weight as the vocals, and the inputs are not normalized:
  1864. @example
  1865. ffmpeg -i VOCALS -i MUSIC -filter_complex amix=inputs=2:duration=longest:dropout_transition=0:weights="1 0.25":normalize=0 OUTPUT
  1866. @end example
  1867. @end itemize
  1868. @subsection Commands
  1869. This filter supports the following commands:
  1870. @table @option
  1871. @item weights
  1872. @item normalize
  1873. Syntax is same as option with same name.
  1874. @end table
  1875. @section amultiply
  1876. Multiply first audio stream with second audio stream and store result
  1877. in output audio stream. Multiplication is done by multiplying each
  1878. sample from first stream with sample at same position from second stream.
  1879. With this element-wise multiplication one can create amplitude fades and
  1880. amplitude modulations.
  1881. @section anequalizer
  1882. High-order parametric multiband equalizer for each channel.
  1883. It accepts the following parameters:
  1884. @table @option
  1885. @item params
  1886. This option string is in format:
  1887. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1888. Each equalizer band is separated by '|'.
  1889. @table @option
  1890. @item chn
  1891. Set channel number to which equalization will be applied.
  1892. If input doesn't have that channel the entry is ignored.
  1893. @item f
  1894. Set central frequency for band.
  1895. If input doesn't have that frequency the entry is ignored.
  1896. @item w
  1897. Set band width in Hertz.
  1898. @item g
  1899. Set band gain in dB.
  1900. @item t
  1901. Set filter type for band, optional, can be:
  1902. @table @samp
  1903. @item 0
  1904. Butterworth, this is default.
  1905. @item 1
  1906. Chebyshev type 1.
  1907. @item 2
  1908. Chebyshev type 2.
  1909. @end table
  1910. @end table
  1911. @item curves
  1912. With this option activated frequency response of anequalizer is displayed
  1913. in video stream.
  1914. @item size
  1915. Set video stream size. Only useful if curves option is activated.
  1916. @item mgain
  1917. Set max gain that will be displayed. Only useful if curves option is activated.
  1918. Setting this to a reasonable value makes it possible to display gain which is derived from
  1919. neighbour bands which are too close to each other and thus produce higher gain
  1920. when both are activated.
  1921. @item fscale
  1922. Set frequency scale used to draw frequency response in video output.
  1923. Can be linear or logarithmic. Default is logarithmic.
  1924. @item colors
  1925. Set color for each channel curve which is going to be displayed in video stream.
  1926. This is list of color names separated by space or by '|'.
  1927. Unrecognised or missing colors will be replaced by white color.
  1928. @end table
  1929. @subsection Examples
  1930. @itemize
  1931. @item
  1932. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1933. for first 2 channels using Chebyshev type 1 filter:
  1934. @example
  1935. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1936. @end example
  1937. @end itemize
  1938. @subsection Commands
  1939. This filter supports the following commands:
  1940. @table @option
  1941. @item change
  1942. Alter existing filter parameters.
  1943. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1944. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1945. error is returned.
  1946. @var{freq} set new frequency parameter.
  1947. @var{width} set new width parameter in Hertz.
  1948. @var{gain} set new gain parameter in dB.
  1949. Full filter invocation with asendcmd may look like this:
  1950. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1951. @end table
  1952. @section anlmdn
  1953. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1954. Each sample is adjusted by looking for other samples with similar contexts. This
  1955. context similarity is defined by comparing their surrounding patches of size
  1956. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1957. The filter accepts the following options:
  1958. @table @option
  1959. @item strength, s
  1960. Set denoising strength. Allowed range is from 0.00001 to 10000. Default value is 0.00001.
  1961. @item patch, p
  1962. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1963. Default value is 2 milliseconds.
  1964. @item research, r
  1965. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1966. Default value is 6 milliseconds.
  1967. @item output, o
  1968. Set the output mode.
  1969. It accepts the following values:
  1970. @table @option
  1971. @item i
  1972. Pass input unchanged.
  1973. @item o
  1974. Pass noise filtered out.
  1975. @item n
  1976. Pass only noise.
  1977. Default value is @var{o}.
  1978. @end table
  1979. @item smooth, m
  1980. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{1000}.
  1981. @end table
  1982. @subsection Commands
  1983. This filter supports the all above options as @ref{commands}.
  1984. @section anlmf, anlms
  1985. Apply Normalized Least-Mean-(Squares|Fourth) algorithm to the first audio stream using the second audio stream.
  1986. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1987. relate to producing the least mean square of the error signal (difference between the desired,
  1988. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1989. A description of the accepted options follows.
  1990. @table @option
  1991. @item order
  1992. Set filter order.
  1993. @item mu
  1994. Set filter mu.
  1995. @item eps
  1996. Set the filter eps.
  1997. @item leakage
  1998. Set the filter leakage.
  1999. @item out_mode
  2000. It accepts the following values:
  2001. @table @option
  2002. @item i
  2003. Pass the 1st input.
  2004. @item d
  2005. Pass the 2nd input.
  2006. @item o
  2007. Pass filtered samples.
  2008. @item n
  2009. Pass difference between desired and filtered samples.
  2010. Default value is @var{o}.
  2011. @end table
  2012. @end table
  2013. @subsection Examples
  2014. @itemize
  2015. @item
  2016. One of many usages of this filter is noise reduction, input audio is filtered
  2017. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  2018. @example
  2019. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  2020. @end example
  2021. @end itemize
  2022. @subsection Commands
  2023. This filter supports the same commands as options, excluding option @code{order}.
  2024. @section anull
  2025. Pass the audio source unchanged to the output.
  2026. @section apad
  2027. Pad the end of an audio stream with silence.
  2028. This can be used together with @command{ffmpeg} @option{-shortest} to
  2029. extend audio streams to the same length as the video stream.
  2030. A description of the accepted options follows.
  2031. @table @option
  2032. @item packet_size
  2033. Set silence packet size. Default value is 4096.
  2034. @item pad_len
  2035. Set the number of samples of silence to add to the end. After the
  2036. value is reached, the stream is terminated. This option is mutually
  2037. exclusive with @option{whole_len}.
  2038. @item whole_len
  2039. Set the minimum total number of samples in the output audio stream. If
  2040. the value is longer than the input audio length, silence is added to
  2041. the end, until the value is reached. This option is mutually exclusive
  2042. with @option{pad_len}.
  2043. @item pad_dur
  2044. Specify the duration of samples of silence to add. See
  2045. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2046. for the accepted syntax. Used only if set to non-negative value.
  2047. @item whole_dur
  2048. Specify the minimum total duration in the output audio stream. See
  2049. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2050. for the accepted syntax. Used only if set to non-negative value. If the value is longer than
  2051. the input audio length, silence is added to the end, until the value is reached.
  2052. This option is mutually exclusive with @option{pad_dur}
  2053. @end table
  2054. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  2055. nor @option{whole_dur} option is set, the filter will add silence to the end of
  2056. the input stream indefinitely.
  2057. Note that for ffmpeg 4.4 and earlier a zero @option{pad_dur} or
  2058. @option{whole_dur} also caused the filter to add silence indefinitely.
  2059. @subsection Examples
  2060. @itemize
  2061. @item
  2062. Add 1024 samples of silence to the end of the input:
  2063. @example
  2064. apad=pad_len=1024
  2065. @end example
  2066. @item
  2067. Make sure the audio output will contain at least 10000 samples, pad
  2068. the input with silence if required:
  2069. @example
  2070. apad=whole_len=10000
  2071. @end example
  2072. @item
  2073. Use @command{ffmpeg} to pad the audio input with silence, so that the
  2074. video stream will always result the shortest and will be converted
  2075. until the end in the output file when using the @option{shortest}
  2076. option:
  2077. @example
  2078. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  2079. @end example
  2080. @end itemize
  2081. @section aphaser
  2082. Add a phasing effect to the input audio.
  2083. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  2084. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  2085. A description of the accepted parameters follows.
  2086. @table @option
  2087. @item in_gain
  2088. Set input gain. Default is 0.4.
  2089. @item out_gain
  2090. Set output gain. Default is 0.74
  2091. @item delay
  2092. Set delay in milliseconds. Default is 3.0.
  2093. @item decay
  2094. Set decay. Default is 0.4.
  2095. @item speed
  2096. Set modulation speed in Hz. Default is 0.5.
  2097. @item type
  2098. Set modulation type. Default is triangular.
  2099. It accepts the following values:
  2100. @table @samp
  2101. @item triangular, t
  2102. @item sinusoidal, s
  2103. @end table
  2104. @end table
  2105. @section aphaseshift
  2106. Apply phase shift to input audio samples.
  2107. The filter accepts the following options:
  2108. @table @option
  2109. @item shift
  2110. Specify phase shift. Allowed range is from -1.0 to 1.0.
  2111. Default value is 0.0.
  2112. @item level
  2113. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  2114. Default value is 1.0.
  2115. @item order
  2116. Set filter order used for filtering. Allowed range is from 1 to 16.
  2117. Default value is 8.
  2118. @end table
  2119. @subsection Commands
  2120. This filter supports the all above options as @ref{commands}.
  2121. @section apsyclip
  2122. Apply Psychoacoustic clipper to input audio stream.
  2123. The filter accepts the following options:
  2124. @table @option
  2125. @item level_in
  2126. Set input gain. By default it is 1. Range is [0.015625 - 64].
  2127. @item level_out
  2128. Set output gain. By default it is 1. Range is [0.015625 - 64].
  2129. @item clip
  2130. Set the clipping start value. Default value is 0dBFS or 1.
  2131. @item diff
  2132. Output only difference samples, useful to hear introduced distortions.
  2133. By default is disabled.
  2134. @item adaptive
  2135. Set strength of adaptive distortion applied. Default value is 0.5.
  2136. Allowed range is from 0 to 1.
  2137. @item iterations
  2138. Set number of iterations of psychoacoustic clipper.
  2139. Allowed range is from 1 to 20. Default value is 10.
  2140. @item level
  2141. Auto level output signal. Default is disabled.
  2142. This normalizes audio back to 0dBFS if enabled.
  2143. @end table
  2144. @subsection Commands
  2145. This filter supports the all above options as @ref{commands}.
  2146. @section apulsator
  2147. Audio pulsator is something between an autopanner and a tremolo.
  2148. But it can produce funny stereo effects as well. Pulsator changes the volume
  2149. of the left and right channel based on a LFO (low frequency oscillator) with
  2150. different waveforms and shifted phases.
  2151. This filter have the ability to define an offset between left and right
  2152. channel. An offset of 0 means that both LFO shapes match each other.
  2153. The left and right channel are altered equally - a conventional tremolo.
  2154. An offset of 50% means that the shape of the right channel is exactly shifted
  2155. in phase (or moved backwards about half of the frequency) - pulsator acts as
  2156. an autopanner. At 1 both curves match again. Every setting in between moves the
  2157. phase shift gapless between all stages and produces some "bypassing" sounds with
  2158. sine and triangle waveforms. The more you set the offset near 1 (starting from
  2159. the 0.5) the faster the signal passes from the left to the right speaker.
  2160. The filter accepts the following options:
  2161. @table @option
  2162. @item level_in
  2163. Set input gain. By default it is 1. Range is [0.015625 - 64].
  2164. @item level_out
  2165. Set output gain. By default it is 1. Range is [0.015625 - 64].
  2166. @item mode
  2167. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  2168. sawup or sawdown. Default is sine.
  2169. @item amount
  2170. Set modulation. Define how much of original signal is affected by the LFO.
  2171. @item offset_l
  2172. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  2173. @item offset_r
  2174. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  2175. @item width
  2176. Set pulse width. Default is 1. Allowed range is [0 - 2].
  2177. @item timing
  2178. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  2179. @item bpm
  2180. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  2181. is set to bpm.
  2182. @item ms
  2183. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  2184. is set to ms.
  2185. @item hz
  2186. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  2187. if timing is set to hz.
  2188. @end table
  2189. @anchor{aresample}
  2190. @section aresample
  2191. Resample the input audio to the specified parameters, using the
  2192. libswresample library. If none are specified then the filter will
  2193. automatically convert between its input and output.
  2194. This filter is also able to stretch/squeeze the audio data to make it match
  2195. the timestamps or to inject silence / cut out audio to make it match the
  2196. timestamps, do a combination of both or do neither.
  2197. The filter accepts the syntax
  2198. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  2199. expresses a sample rate and @var{resampler_options} is a list of
  2200. @var{key}=@var{value} pairs, separated by ":". See the
  2201. @ref{Resampler Options,,"Resampler Options" section in the
  2202. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  2203. for the complete list of supported options.
  2204. @subsection Examples
  2205. @itemize
  2206. @item
  2207. Resample the input audio to 44100Hz:
  2208. @example
  2209. aresample=44100
  2210. @end example
  2211. @item
  2212. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  2213. samples per second compensation:
  2214. @example
  2215. aresample=async=1000
  2216. @end example
  2217. @end itemize
  2218. @section areverse
  2219. Reverse an audio clip.
  2220. Warning: This filter requires memory to buffer the entire clip, so trimming
  2221. is suggested.
  2222. @subsection Examples
  2223. @itemize
  2224. @item
  2225. Take the first 5 seconds of a clip, and reverse it.
  2226. @example
  2227. atrim=end=5,areverse
  2228. @end example
  2229. @end itemize
  2230. @section arnndn
  2231. Reduce noise from speech using Recurrent Neural Networks.
  2232. This filter accepts the following options:
  2233. @table @option
  2234. @item model, m
  2235. Set train model file to load. This option is always required.
  2236. @item mix
  2237. Set how much to mix filtered samples into final output.
  2238. Allowed range is from -1 to 1. Default value is 1.
  2239. Negative values are special, they set how much to keep filtered noise
  2240. in the final filter output. Set this option to -1 to hear actual
  2241. noise removed from input signal.
  2242. @end table
  2243. @subsection Commands
  2244. This filter supports the all above options as @ref{commands}.
  2245. @section asdr
  2246. Measure Audio Signal-to-Distortion Ratio.
  2247. This filter takes two audio streams for input, and outputs first
  2248. audio stream.
  2249. Results are in dB per channel at end of either input.
  2250. @section asetnsamples
  2251. Set the number of samples per each output audio frame.
  2252. The last output packet may contain a different number of samples, as
  2253. the filter will flush all the remaining samples when the input audio
  2254. signals its end.
  2255. The filter accepts the following options:
  2256. @table @option
  2257. @item nb_out_samples, n
  2258. Set the number of frames per each output audio frame. The number is
  2259. intended as the number of samples @emph{per each channel}.
  2260. Default value is 1024.
  2261. @item pad, p
  2262. If set to 1, the filter will pad the last audio frame with zeroes, so
  2263. that the last frame will contain the same number of samples as the
  2264. previous ones. Default value is 1.
  2265. @end table
  2266. For example, to set the number of per-frame samples to 1234 and
  2267. disable padding for the last frame, use:
  2268. @example
  2269. asetnsamples=n=1234:p=0
  2270. @end example
  2271. @section asetrate
  2272. Set the sample rate without altering the PCM data.
  2273. This will result in a change of speed and pitch.
  2274. The filter accepts the following options:
  2275. @table @option
  2276. @item sample_rate, r
  2277. Set the output sample rate. Default is 44100 Hz.
  2278. @end table
  2279. @section ashowinfo
  2280. Show a line containing various information for each input audio frame.
  2281. The input audio is not modified.
  2282. The shown line contains a sequence of key/value pairs of the form
  2283. @var{key}:@var{value}.
  2284. The following values are shown in the output:
  2285. @table @option
  2286. @item n
  2287. The (sequential) number of the input frame, starting from 0.
  2288. @item pts
  2289. The presentation timestamp of the input frame, in time base units; the time base
  2290. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  2291. @item pts_time
  2292. The presentation timestamp of the input frame in seconds.
  2293. @item pos
  2294. position of the frame in the input stream, -1 if this information in
  2295. unavailable and/or meaningless (for example in case of synthetic audio)
  2296. @item fmt
  2297. The sample format.
  2298. @item chlayout
  2299. The channel layout.
  2300. @item rate
  2301. The sample rate for the audio frame.
  2302. @item nb_samples
  2303. The number of samples (per channel) in the frame.
  2304. @item checksum
  2305. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  2306. audio, the data is treated as if all the planes were concatenated.
  2307. @item plane_checksums
  2308. A list of Adler-32 checksums for each data plane.
  2309. @end table
  2310. @section asoftclip
  2311. Apply audio soft clipping.
  2312. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  2313. along a smooth curve, rather than the abrupt shape of hard-clipping.
  2314. This filter accepts the following options:
  2315. @table @option
  2316. @item type
  2317. Set type of soft-clipping.
  2318. It accepts the following values:
  2319. @table @option
  2320. @item hard
  2321. @item tanh
  2322. @item atan
  2323. @item cubic
  2324. @item exp
  2325. @item alg
  2326. @item quintic
  2327. @item sin
  2328. @item erf
  2329. @end table
  2330. @item threshold
  2331. Set threshold from where to start clipping. Default value is 0dB or 1.
  2332. @item output
  2333. Set gain applied to output. Default value is 0dB or 1.
  2334. @item param
  2335. Set additional parameter which controls sigmoid function.
  2336. @item oversample
  2337. Set oversampling factor.
  2338. @end table
  2339. @subsection Commands
  2340. This filter supports the all above options as @ref{commands}.
  2341. @section aspectralstats
  2342. Display frequency domain statistical information about the audio channels.
  2343. Statistics are calculated and stored as metadata for each audio channel and for each audio frame.
  2344. It accepts the following option:
  2345. @table @option
  2346. @item win_size
  2347. Set the window length in samples. Default value is 2048.
  2348. Allowed range is from 32 to 65536.
  2349. @item win_func
  2350. Set window function.
  2351. It accepts the following values:
  2352. @table @samp
  2353. @item rect
  2354. @item bartlett
  2355. @item hann, hanning
  2356. @item hamming
  2357. @item blackman
  2358. @item welch
  2359. @item flattop
  2360. @item bharris
  2361. @item bnuttall
  2362. @item bhann
  2363. @item sine
  2364. @item nuttall
  2365. @item lanczos
  2366. @item gauss
  2367. @item tukey
  2368. @item dolph
  2369. @item cauchy
  2370. @item parzen
  2371. @item poisson
  2372. @item bohman
  2373. @item kaiser
  2374. @end table
  2375. Default is @code{hann}.
  2376. @item overlap
  2377. Set window overlap. Allowed range is from @code{0}
  2378. to @code{1}. Default value is @code{0.5}.
  2379. @item measure
  2380. Select the parameters which are measured. The metadata keys can
  2381. be used as flags, default is @option{all} which measures everything.
  2382. @option{none} disables all measurement.
  2383. @end table
  2384. A list of each metadata key follows:
  2385. @table @option
  2386. @item mean
  2387. @item variance
  2388. @item centroid
  2389. @item spread
  2390. @item skewness
  2391. @item kurtosis
  2392. @item entropy
  2393. @item flatness
  2394. @item crest
  2395. @item flux
  2396. @item slope
  2397. @item decrease
  2398. @item rolloff
  2399. @end table
  2400. @section asr
  2401. Automatic Speech Recognition
  2402. This filter uses PocketSphinx for speech recognition. To enable
  2403. compilation of this filter, you need to configure FFmpeg with
  2404. @code{--enable-pocketsphinx}.
  2405. It accepts the following options:
  2406. @table @option
  2407. @item rate
  2408. Set sampling rate of input audio. Defaults is @code{16000}.
  2409. This need to match speech models, otherwise one will get poor results.
  2410. @item hmm
  2411. Set dictionary containing acoustic model files.
  2412. @item dict
  2413. Set pronunciation dictionary.
  2414. @item lm
  2415. Set language model file.
  2416. @item lmctl
  2417. Set language model set.
  2418. @item lmname
  2419. Set which language model to use.
  2420. @item logfn
  2421. Set output for log messages.
  2422. @end table
  2423. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  2424. @anchor{astats}
  2425. @section astats
  2426. Display time domain statistical information about the audio channels.
  2427. Statistics are calculated and displayed for each audio channel and,
  2428. where applicable, an overall figure is also given.
  2429. It accepts the following option:
  2430. @table @option
  2431. @item length
  2432. Short window length in seconds, used for peak and trough RMS measurement.
  2433. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0 - 10]}.
  2434. @item metadata
  2435. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  2436. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  2437. disabled.
  2438. Available keys for each channel are:
  2439. @var{Bit_depth}
  2440. @var{Crest_factor}
  2441. @var{DC_offset}
  2442. @var{Dynamic_range}
  2443. @var{Entropy}
  2444. @var{Flat_factor}
  2445. @var{Max_difference}
  2446. @var{Max_level}
  2447. @var{Mean_difference}
  2448. @var{Min_difference}
  2449. @var{Min_level}
  2450. @var{Noise_floor}
  2451. @var{Noise_floor_count}
  2452. @var{Number_of_Infs}
  2453. @var{Number_of_NaNs}
  2454. @var{Number_of_denormals}
  2455. @var{Peak_count}
  2456. @var{Peak_level}
  2457. @var{RMS_difference}
  2458. @var{RMS_peak}
  2459. @var{RMS_trough}
  2460. @var{Zero_crossings}
  2461. @var{Zero_crossings_rate}
  2462. and for @code{Overall}:
  2463. @var{Bit_depth}
  2464. @var{DC_offset}
  2465. @var{Entropy}
  2466. @var{Flat_factor}
  2467. @var{Max_difference}
  2468. @var{Max_level}
  2469. @var{Mean_difference}
  2470. @var{Min_difference}
  2471. @var{Min_level}
  2472. @var{Noise_floor}
  2473. @var{Noise_floor_count}
  2474. @var{Number_of_Infs}
  2475. @var{Number_of_NaNs}
  2476. @var{Number_of_denormals}
  2477. @var{Number_of_samples}
  2478. @var{Peak_count}
  2479. @var{Peak_level}
  2480. @var{RMS_difference}
  2481. @var{RMS_level}
  2482. @var{RMS_peak}
  2483. @var{RMS_trough}
  2484. For example, a full key looks like @code{lavfi.astats.1.DC_offset} or
  2485. @code{lavfi.astats.Overall.Peak_count}.
  2486. Read below for the description of the keys.
  2487. @item reset
  2488. Set the number of frames over which cumulative stats are calculated before
  2489. being reset. Default is disabled.
  2490. @item measure_perchannel
  2491. Select the parameters which are measured per channel. The metadata keys can
  2492. be used as flags, default is @option{all} which measures everything.
  2493. @option{none} disables all per channel measurement.
  2494. @item measure_overall
  2495. Select the parameters which are measured overall. The metadata keys can
  2496. be used as flags, default is @option{all} which measures everything.
  2497. @option{none} disables all overall measurement.
  2498. @end table
  2499. A description of the measure keys follow:
  2500. @table @option
  2501. @item none
  2502. no measures
  2503. @item all
  2504. all measures
  2505. @item Bit_depth
  2506. overall bit depth of audio, i.e. number of bits used for each sample
  2507. @item Crest_factor
  2508. standard ratio of peak to RMS level (note: not in dB)
  2509. @item DC_offset
  2510. mean amplitude displacement from zero
  2511. @item Dynamic_range
  2512. measured dynamic range of audio in dB
  2513. @item Entropy
  2514. entropy measured across whole audio, entropy of value near 1.0 is typically measured for white noise
  2515. @item Flat_factor
  2516. flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  2517. (i.e. either @var{Min_level} or @var{Max_level})
  2518. @item Max_difference
  2519. maximal difference between two consecutive samples
  2520. @item Max_level
  2521. maximal sample level
  2522. @item Mean_difference
  2523. mean difference between two consecutive samples, i.e. the average of each difference between two consecutive samples
  2524. @item Min_difference
  2525. minimal difference between two consecutive samples
  2526. @item Min_level
  2527. minimal sample level
  2528. @item Noise_floor
  2529. minimum local peak measured in dBFS over a short window
  2530. @item Noise_floor_count
  2531. number of occasions (not the number of samples) that the signal attained
  2532. @var{Noise floor}
  2533. @item Number_of_Infs
  2534. number of samples with an infinite value
  2535. @item Number_of_NaNs
  2536. number of samples with a NaN (not a number) value
  2537. @item Number_of_denormals
  2538. number of samples with a subnormal value
  2539. @item Number_of_samples
  2540. number of samples
  2541. @item Peak_count
  2542. number of occasions (not the number of samples) that the signal attained either
  2543. @var{Min_level} or @var{Max_level}
  2544. @item Peak_level
  2545. standard peak level measured in dBFS
  2546. @item RMS_difference
  2547. Root Mean Square difference between two consecutive samples
  2548. @item RMS_level
  2549. standard RMS level measured in dBFS
  2550. @item RMS_peak
  2551. @item RMS_trough
  2552. peak and trough values for RMS level measured over a short window,
  2553. measured in dBFS.
  2554. @item Zero crossings
  2555. number of points where the waveform crosses the zero level axis
  2556. @item Zero crossings rate
  2557. rate of Zero crossings and number of audio samples
  2558. @end table
  2559. @section asubboost
  2560. Boost subwoofer frequencies.
  2561. The filter accepts the following options:
  2562. @table @option
  2563. @item dry
  2564. Set dry gain, how much of original signal is kept. Allowed range is from 0 to 1.
  2565. Default value is 1.0.
  2566. @item wet
  2567. Set wet gain, how much of filtered signal is kept. Allowed range is from 0 to 1.
  2568. Default value is 1.0.
  2569. @item boost
  2570. Set max boost factor. Allowed range is from 1 to 12. Default value is 2.
  2571. @item decay
  2572. Set delay line decay gain value. Allowed range is from 0 to 1.
  2573. Default value is 0.0.
  2574. @item feedback
  2575. Set delay line feedback gain value. Allowed range is from 0 to 1.
  2576. Default value is 0.9.
  2577. @item cutoff
  2578. Set cutoff frequency in Hertz. Allowed range is 50 to 900.
  2579. Default value is 100.
  2580. @item slope
  2581. Set slope amount for cutoff frequency. Allowed range is 0.0001 to 1.
  2582. Default value is 0.5.
  2583. @item delay
  2584. Set delay. Allowed range is from 1 to 100.
  2585. Default value is 20.
  2586. @item channels
  2587. Set the channels to process. Default value is all available.
  2588. @end table
  2589. @subsection Commands
  2590. This filter supports the all above options as @ref{commands}.
  2591. @section asubcut
  2592. Cut subwoofer frequencies.
  2593. This filter allows to set custom, steeper
  2594. roll off than highpass filter, and thus is able to more attenuate
  2595. frequency content in stop-band.
  2596. The filter accepts the following options:
  2597. @table @option
  2598. @item cutoff
  2599. Set cutoff frequency in Hertz. Allowed range is 2 to 200.
  2600. Default value is 20.
  2601. @item order
  2602. Set filter order. Available values are from 3 to 20.
  2603. Default value is 10.
  2604. @item level
  2605. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2606. @end table
  2607. @subsection Commands
  2608. This filter supports the all above options as @ref{commands}.
  2609. @section asupercut
  2610. Cut super frequencies.
  2611. The filter accepts the following options:
  2612. @table @option
  2613. @item cutoff
  2614. Set cutoff frequency in Hertz. Allowed range is 20000 to 192000.
  2615. Default value is 20000.
  2616. @item order
  2617. Set filter order. Available values are from 3 to 20.
  2618. Default value is 10.
  2619. @item level
  2620. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2621. @end table
  2622. @subsection Commands
  2623. This filter supports the all above options as @ref{commands}.
  2624. @section asuperpass
  2625. Apply high order Butterworth band-pass filter.
  2626. The filter accepts the following options:
  2627. @table @option
  2628. @item centerf
  2629. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2630. Default value is 1000.
  2631. @item order
  2632. Set filter order. Available values are from 4 to 20.
  2633. Default value is 4.
  2634. @item qfactor
  2635. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2636. @item level
  2637. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2638. @end table
  2639. @subsection Commands
  2640. This filter supports the all above options as @ref{commands}.
  2641. @section asuperstop
  2642. Apply high order Butterworth band-stop filter.
  2643. The filter accepts the following options:
  2644. @table @option
  2645. @item centerf
  2646. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2647. Default value is 1000.
  2648. @item order
  2649. Set filter order. Available values are from 4 to 20.
  2650. Default value is 4.
  2651. @item qfactor
  2652. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2653. @item level
  2654. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2655. @end table
  2656. @subsection Commands
  2657. This filter supports the all above options as @ref{commands}.
  2658. @section atempo
  2659. Adjust audio tempo.
  2660. The filter accepts exactly one parameter, the audio tempo. If not
  2661. specified then the filter will assume nominal 1.0 tempo. Tempo must
  2662. be in the [0.5, 100.0] range.
  2663. Note that tempo greater than 2 will skip some samples rather than
  2664. blend them in. If for any reason this is a concern it is always
  2665. possible to daisy-chain several instances of atempo to achieve the
  2666. desired product tempo.
  2667. @subsection Examples
  2668. @itemize
  2669. @item
  2670. Slow down audio to 80% tempo:
  2671. @example
  2672. atempo=0.8
  2673. @end example
  2674. @item
  2675. To speed up audio to 300% tempo:
  2676. @example
  2677. atempo=3
  2678. @end example
  2679. @item
  2680. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  2681. @example
  2682. atempo=sqrt(3),atempo=sqrt(3)
  2683. @end example
  2684. @end itemize
  2685. @subsection Commands
  2686. This filter supports the following commands:
  2687. @table @option
  2688. @item tempo
  2689. Change filter tempo scale factor.
  2690. Syntax for the command is : "@var{tempo}"
  2691. @end table
  2692. @section atilt
  2693. Apply spectral tilt filter to audio stream.
  2694. This filter apply any spectral roll-off slope over any specified frequency band.
  2695. The filter accepts the following options:
  2696. @table @option
  2697. @item freq
  2698. Set central frequency of tilt in Hz. Default is 10000 Hz.
  2699. @item slope
  2700. Set slope direction of tilt. Default is 0. Allowed range is from -1 to 1.
  2701. @item width
  2702. Set width of tilt. Default is 1000. Allowed range is from 100 to 10000.
  2703. @item order
  2704. Set order of tilt filter.
  2705. @item level
  2706. Set input volume level. Allowed range is from 0 to 4.
  2707. Defalt is 1.
  2708. @end table
  2709. @subsection Commands
  2710. This filter supports the all above options as @ref{commands}.
  2711. @section atrim
  2712. Trim the input so that the output contains one continuous subpart of the input.
  2713. It accepts the following parameters:
  2714. @table @option
  2715. @item start
  2716. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  2717. sample with the timestamp @var{start} will be the first sample in the output.
  2718. @item end
  2719. Specify time of the first audio sample that will be dropped, i.e. the
  2720. audio sample immediately preceding the one with the timestamp @var{end} will be
  2721. the last sample in the output.
  2722. @item start_pts
  2723. Same as @var{start}, except this option sets the start timestamp in samples
  2724. instead of seconds.
  2725. @item end_pts
  2726. Same as @var{end}, except this option sets the end timestamp in samples instead
  2727. of seconds.
  2728. @item duration
  2729. The maximum duration of the output in seconds.
  2730. @item start_sample
  2731. The number of the first sample that should be output.
  2732. @item end_sample
  2733. The number of the first sample that should be dropped.
  2734. @end table
  2735. @option{start}, @option{end}, and @option{duration} are expressed as time
  2736. duration specifications; see
  2737. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  2738. Note that the first two sets of the start/end options and the @option{duration}
  2739. option look at the frame timestamp, while the _sample options simply count the
  2740. samples that pass through the filter. So start/end_pts and start/end_sample will
  2741. give different results when the timestamps are wrong, inexact or do not start at
  2742. zero. Also note that this filter does not modify the timestamps. If you wish
  2743. to have the output timestamps start at zero, insert the asetpts filter after the
  2744. atrim filter.
  2745. If multiple start or end options are set, this filter tries to be greedy and
  2746. keep all samples that match at least one of the specified constraints. To keep
  2747. only the part that matches all the constraints at once, chain multiple atrim
  2748. filters.
  2749. The defaults are such that all the input is kept. So it is possible to set e.g.
  2750. just the end values to keep everything before the specified time.
  2751. Examples:
  2752. @itemize
  2753. @item
  2754. Drop everything except the second minute of input:
  2755. @example
  2756. ffmpeg -i INPUT -af atrim=60:120
  2757. @end example
  2758. @item
  2759. Keep only the first 1000 samples:
  2760. @example
  2761. ffmpeg -i INPUT -af atrim=end_sample=1000
  2762. @end example
  2763. @end itemize
  2764. @section axcorrelate
  2765. Calculate normalized windowed cross-correlation between two input audio streams.
  2766. Resulted samples are always between -1 and 1 inclusive.
  2767. If result is 1 it means two input samples are highly correlated in that selected segment.
  2768. Result 0 means they are not correlated at all.
  2769. If result is -1 it means two input samples are out of phase, which means they cancel each
  2770. other.
  2771. The filter accepts the following options:
  2772. @table @option
  2773. @item size
  2774. Set size of segment over which cross-correlation is calculated.
  2775. Default is 256. Allowed range is from 2 to 131072.
  2776. @item algo
  2777. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast}.
  2778. Default is @code{slow}. Fast algorithm assumes mean values over any given segment
  2779. are always zero and thus need much less calculations to make.
  2780. This is generally not true, but is valid for typical audio streams.
  2781. @end table
  2782. @subsection Examples
  2783. @itemize
  2784. @item
  2785. Calculate correlation between channels in stereo audio stream:
  2786. @example
  2787. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  2788. @end example
  2789. @end itemize
  2790. @section bandpass
  2791. Apply a two-pole Butterworth band-pass filter with central
  2792. frequency @var{frequency}, and (3dB-point) band-width width.
  2793. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  2794. instead of the default: constant 0dB peak gain.
  2795. The filter roll off at 6dB per octave (20dB per decade).
  2796. The filter accepts the following options:
  2797. @table @option
  2798. @item frequency, f
  2799. Set the filter's central frequency. Default is @code{3000}.
  2800. @item csg
  2801. Constant skirt gain if set to 1. Defaults to 0.
  2802. @item width_type, t
  2803. Set method to specify band-width of filter.
  2804. @table @option
  2805. @item h
  2806. Hz
  2807. @item q
  2808. Q-Factor
  2809. @item o
  2810. octave
  2811. @item s
  2812. slope
  2813. @item k
  2814. kHz
  2815. @end table
  2816. @item width, w
  2817. Specify the band-width of a filter in width_type units.
  2818. @item mix, m
  2819. How much to use filtered signal in output. Default is 1.
  2820. Range is between 0 and 1.
  2821. @item channels, c
  2822. Specify which channels to filter, by default all available are filtered.
  2823. @item normalize, n
  2824. Normalize biquad coefficients, by default is disabled.
  2825. Enabling it will normalize magnitude response at DC to 0dB.
  2826. @item transform, a
  2827. Set transform type of IIR filter.
  2828. @table @option
  2829. @item di
  2830. @item dii
  2831. @item tdi
  2832. @item tdii
  2833. @item latt
  2834. @item svf
  2835. @item zdf
  2836. @end table
  2837. @item precision, r
  2838. Set precison of filtering.
  2839. @table @option
  2840. @item auto
  2841. Pick automatic sample format depending on surround filters.
  2842. @item s16
  2843. Always use signed 16-bit.
  2844. @item s32
  2845. Always use signed 32-bit.
  2846. @item f32
  2847. Always use float 32-bit.
  2848. @item f64
  2849. Always use float 64-bit.
  2850. @end table
  2851. @item block_size, b
  2852. Set block size used for reverse IIR processing. If this value is set to high enough
  2853. value (higher than impulse response length truncated when reaches near zero values) filtering
  2854. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  2855. Note that filter delay will be exactly this many samples when set to non-zero value.
  2856. @end table
  2857. @subsection Commands
  2858. This filter supports the following commands:
  2859. @table @option
  2860. @item frequency, f
  2861. Change bandpass frequency.
  2862. Syntax for the command is : "@var{frequency}"
  2863. @item width_type, t
  2864. Change bandpass width_type.
  2865. Syntax for the command is : "@var{width_type}"
  2866. @item width, w
  2867. Change bandpass width.
  2868. Syntax for the command is : "@var{width}"
  2869. @item mix, m
  2870. Change bandpass mix.
  2871. Syntax for the command is : "@var{mix}"
  2872. @end table
  2873. @section bandreject
  2874. Apply a two-pole Butterworth band-reject filter with central
  2875. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2876. The filter roll off at 6dB per octave (20dB per decade).
  2877. The filter accepts the following options:
  2878. @table @option
  2879. @item frequency, f
  2880. Set the filter's central frequency. Default is @code{3000}.
  2881. @item width_type, t
  2882. Set method to specify band-width of filter.
  2883. @table @option
  2884. @item h
  2885. Hz
  2886. @item q
  2887. Q-Factor
  2888. @item o
  2889. octave
  2890. @item s
  2891. slope
  2892. @item k
  2893. kHz
  2894. @end table
  2895. @item width, w
  2896. Specify the band-width of a filter in width_type units.
  2897. @item mix, m
  2898. How much to use filtered signal in output. Default is 1.
  2899. Range is between 0 and 1.
  2900. @item channels, c
  2901. Specify which channels to filter, by default all available are filtered.
  2902. @item normalize, n
  2903. Normalize biquad coefficients, by default is disabled.
  2904. Enabling it will normalize magnitude response at DC to 0dB.
  2905. @item transform, a
  2906. Set transform type of IIR filter.
  2907. @table @option
  2908. @item di
  2909. @item dii
  2910. @item tdi
  2911. @item tdii
  2912. @item latt
  2913. @item svf
  2914. @item zdf
  2915. @end table
  2916. @item precision, r
  2917. Set precison of filtering.
  2918. @table @option
  2919. @item auto
  2920. Pick automatic sample format depending on surround filters.
  2921. @item s16
  2922. Always use signed 16-bit.
  2923. @item s32
  2924. Always use signed 32-bit.
  2925. @item f32
  2926. Always use float 32-bit.
  2927. @item f64
  2928. Always use float 64-bit.
  2929. @end table
  2930. @item block_size, b
  2931. Set block size used for reverse IIR processing. If this value is set to high enough
  2932. value (higher than impulse response length truncated when reaches near zero values) filtering
  2933. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  2934. Note that filter delay will be exactly this many samples when set to non-zero value.
  2935. @end table
  2936. @subsection Commands
  2937. This filter supports the following commands:
  2938. @table @option
  2939. @item frequency, f
  2940. Change bandreject frequency.
  2941. Syntax for the command is : "@var{frequency}"
  2942. @item width_type, t
  2943. Change bandreject width_type.
  2944. Syntax for the command is : "@var{width_type}"
  2945. @item width, w
  2946. Change bandreject width.
  2947. Syntax for the command is : "@var{width}"
  2948. @item mix, m
  2949. Change bandreject mix.
  2950. Syntax for the command is : "@var{mix}"
  2951. @end table
  2952. @section bass, lowshelf
  2953. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2954. shelving filter with a response similar to that of a standard
  2955. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2956. The filter accepts the following options:
  2957. @table @option
  2958. @item gain, g
  2959. Give the gain at 0 Hz. Its useful range is about -20
  2960. (for a large cut) to +20 (for a large boost).
  2961. Beware of clipping when using a positive gain.
  2962. @item frequency, f
  2963. Set the filter's central frequency and so can be used
  2964. to extend or reduce the frequency range to be boosted or cut.
  2965. The default value is @code{100} Hz.
  2966. @item width_type, t
  2967. Set method to specify band-width of filter.
  2968. @table @option
  2969. @item h
  2970. Hz
  2971. @item q
  2972. Q-Factor
  2973. @item o
  2974. octave
  2975. @item s
  2976. slope
  2977. @item k
  2978. kHz
  2979. @end table
  2980. @item width, w
  2981. Determine how steep is the filter's shelf transition.
  2982. @item poles, p
  2983. Set number of poles. Default is 2.
  2984. @item mix, m
  2985. How much to use filtered signal in output. Default is 1.
  2986. Range is between 0 and 1.
  2987. @item channels, c
  2988. Specify which channels to filter, by default all available are filtered.
  2989. @item normalize, n
  2990. Normalize biquad coefficients, by default is disabled.
  2991. Enabling it will normalize magnitude response at DC to 0dB.
  2992. @item transform, a
  2993. Set transform type of IIR filter.
  2994. @table @option
  2995. @item di
  2996. @item dii
  2997. @item tdi
  2998. @item tdii
  2999. @item latt
  3000. @item svf
  3001. @item zdf
  3002. @end table
  3003. @item precision, r
  3004. Set precison of filtering.
  3005. @table @option
  3006. @item auto
  3007. Pick automatic sample format depending on surround filters.
  3008. @item s16
  3009. Always use signed 16-bit.
  3010. @item s32
  3011. Always use signed 32-bit.
  3012. @item f32
  3013. Always use float 32-bit.
  3014. @item f64
  3015. Always use float 64-bit.
  3016. @end table
  3017. @item block_size, b
  3018. Set block size used for reverse IIR processing. If this value is set to high enough
  3019. value (higher than impulse response length truncated when reaches near zero values) filtering
  3020. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3021. Note that filter delay will be exactly this many samples when set to non-zero value.
  3022. @end table
  3023. @subsection Commands
  3024. This filter supports the following commands:
  3025. @table @option
  3026. @item frequency, f
  3027. Change bass frequency.
  3028. Syntax for the command is : "@var{frequency}"
  3029. @item width_type, t
  3030. Change bass width_type.
  3031. Syntax for the command is : "@var{width_type}"
  3032. @item width, w
  3033. Change bass width.
  3034. Syntax for the command is : "@var{width}"
  3035. @item gain, g
  3036. Change bass gain.
  3037. Syntax for the command is : "@var{gain}"
  3038. @item mix, m
  3039. Change bass mix.
  3040. Syntax for the command is : "@var{mix}"
  3041. @end table
  3042. @section biquad
  3043. Apply a biquad IIR filter with the given coefficients.
  3044. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  3045. are the numerator and denominator coefficients respectively.
  3046. and @var{channels}, @var{c} specify which channels to filter, by default all
  3047. available are filtered.
  3048. @subsection Commands
  3049. This filter supports the following commands:
  3050. @table @option
  3051. @item a0
  3052. @item a1
  3053. @item a2
  3054. @item b0
  3055. @item b1
  3056. @item b2
  3057. Change biquad parameter.
  3058. Syntax for the command is : "@var{value}"
  3059. @item mix, m
  3060. How much to use filtered signal in output. Default is 1.
  3061. Range is between 0 and 1.
  3062. @item channels, c
  3063. Specify which channels to filter, by default all available are filtered.
  3064. @item normalize, n
  3065. Normalize biquad coefficients, by default is disabled.
  3066. Enabling it will normalize magnitude response at DC to 0dB.
  3067. @item transform, a
  3068. Set transform type of IIR filter.
  3069. @table @option
  3070. @item di
  3071. @item dii
  3072. @item tdi
  3073. @item tdii
  3074. @item latt
  3075. @item svf
  3076. @item zdf
  3077. @end table
  3078. @item precision, r
  3079. Set precison of filtering.
  3080. @table @option
  3081. @item auto
  3082. Pick automatic sample format depending on surround filters.
  3083. @item s16
  3084. Always use signed 16-bit.
  3085. @item s32
  3086. Always use signed 32-bit.
  3087. @item f32
  3088. Always use float 32-bit.
  3089. @item f64
  3090. Always use float 64-bit.
  3091. @end table
  3092. @item block_size, b
  3093. Set block size used for reverse IIR processing. If this value is set to high enough
  3094. value (higher than impulse response length truncated when reaches near zero values) filtering
  3095. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3096. Note that filter delay will be exactly this many samples when set to non-zero value.
  3097. @end table
  3098. @section bs2b
  3099. Bauer stereo to binaural transformation, which improves headphone listening of
  3100. stereo audio records.
  3101. To enable compilation of this filter you need to configure FFmpeg with
  3102. @code{--enable-libbs2b}.
  3103. It accepts the following parameters:
  3104. @table @option
  3105. @item profile
  3106. Pre-defined crossfeed level.
  3107. @table @option
  3108. @item default
  3109. Default level (fcut=700, feed=50).
  3110. @item cmoy
  3111. Chu Moy circuit (fcut=700, feed=60).
  3112. @item jmeier
  3113. Jan Meier circuit (fcut=650, feed=95).
  3114. @end table
  3115. @item fcut
  3116. Cut frequency (in Hz).
  3117. @item feed
  3118. Feed level (in Hz).
  3119. @end table
  3120. @section channelmap
  3121. Remap input channels to new locations.
  3122. It accepts the following parameters:
  3123. @table @option
  3124. @item map
  3125. Map channels from input to output. The argument is a '|'-separated list of
  3126. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  3127. @var{in_channel} form. @var{in_channel} can be either the name of the input
  3128. channel (e.g. FL for front left) or its index in the input channel layout.
  3129. @var{out_channel} is the name of the output channel or its index in the output
  3130. channel layout. If @var{out_channel} is not given then it is implicitly an
  3131. index, starting with zero and increasing by one for each mapping.
  3132. @item channel_layout
  3133. The channel layout of the output stream.
  3134. @end table
  3135. If no mapping is present, the filter will implicitly map input channels to
  3136. output channels, preserving indices.
  3137. @subsection Examples
  3138. @itemize
  3139. @item
  3140. For example, assuming a 5.1+downmix input MOV file,
  3141. @example
  3142. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  3143. @end example
  3144. will create an output WAV file tagged as stereo from the downmix channels of
  3145. the input.
  3146. @item
  3147. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  3148. @example
  3149. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  3150. @end example
  3151. @end itemize
  3152. @section channelsplit
  3153. Split each channel from an input audio stream into a separate output stream.
  3154. It accepts the following parameters:
  3155. @table @option
  3156. @item channel_layout
  3157. The channel layout of the input stream. The default is "stereo".
  3158. @item channels
  3159. A channel layout describing the channels to be extracted as separate output streams
  3160. or "all" to extract each input channel as a separate stream. The default is "all".
  3161. Choosing channels not present in channel layout in the input will result in an error.
  3162. @end table
  3163. @subsection Examples
  3164. @itemize
  3165. @item
  3166. For example, assuming a stereo input MP3 file,
  3167. @example
  3168. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  3169. @end example
  3170. will create an output Matroska file with two audio streams, one containing only
  3171. the left channel and the other the right channel.
  3172. @item
  3173. Split a 5.1 WAV file into per-channel files:
  3174. @example
  3175. ffmpeg -i in.wav -filter_complex
  3176. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  3177. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  3178. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  3179. side_right.wav
  3180. @end example
  3181. @item
  3182. Extract only LFE from a 5.1 WAV file:
  3183. @example
  3184. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  3185. -map '[LFE]' lfe.wav
  3186. @end example
  3187. @end itemize
  3188. @section chorus
  3189. Add a chorus effect to the audio.
  3190. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  3191. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  3192. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  3193. The modulation depth defines the range the modulated delay is played before or after
  3194. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  3195. sound tuned around the original one, like in a chorus where some vocals are slightly
  3196. off key.
  3197. It accepts the following parameters:
  3198. @table @option
  3199. @item in_gain
  3200. Set input gain. Default is 0.4.
  3201. @item out_gain
  3202. Set output gain. Default is 0.4.
  3203. @item delays
  3204. Set delays. A typical delay is around 40ms to 60ms.
  3205. @item decays
  3206. Set decays.
  3207. @item speeds
  3208. Set speeds.
  3209. @item depths
  3210. Set depths.
  3211. @end table
  3212. @subsection Examples
  3213. @itemize
  3214. @item
  3215. A single delay:
  3216. @example
  3217. chorus=0.7:0.9:55:0.4:0.25:2
  3218. @end example
  3219. @item
  3220. Two delays:
  3221. @example
  3222. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  3223. @end example
  3224. @item
  3225. Fuller sounding chorus with three delays:
  3226. @example
  3227. 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
  3228. @end example
  3229. @end itemize
  3230. @section compand
  3231. Compress or expand the audio's dynamic range.
  3232. It accepts the following parameters:
  3233. @table @option
  3234. @item attacks
  3235. @item decays
  3236. A list of times in seconds for each channel over which the instantaneous level
  3237. of the input signal is averaged to determine its volume. @var{attacks} refers to
  3238. increase of volume and @var{decays} refers to decrease of volume. For most
  3239. situations, the attack time (response to the audio getting louder) should be
  3240. shorter than the decay time, because the human ear is more sensitive to sudden
  3241. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  3242. a typical value for decay is 0.8 seconds.
  3243. If specified number of attacks & decays is lower than number of channels, the last
  3244. set attack/decay will be used for all remaining channels.
  3245. @item points
  3246. A list of points for the transfer function, specified in dB relative to the
  3247. maximum possible signal amplitude. Each key points list must be defined using
  3248. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  3249. @code{x0/y0 x1/y1 x2/y2 ....}
  3250. The input values must be in strictly increasing order but the transfer function
  3251. does not have to be monotonically rising. The point @code{0/0} is assumed but
  3252. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  3253. function are @code{-70/-70|-60/-20|1/0}.
  3254. @item soft-knee
  3255. Set the curve radius in dB for all joints. It defaults to 0.01.
  3256. @item gain
  3257. Set the additional gain in dB to be applied at all points on the transfer
  3258. function. This allows for easy adjustment of the overall gain.
  3259. It defaults to 0.
  3260. @item volume
  3261. Set an initial volume, in dB, to be assumed for each channel when filtering
  3262. starts. This permits the user to supply a nominal level initially, so that, for
  3263. example, a very large gain is not applied to initial signal levels before the
  3264. companding has begun to operate. A typical value for audio which is initially
  3265. quiet is -90 dB. It defaults to 0.
  3266. @item delay
  3267. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  3268. delayed before being fed to the volume adjuster. Specifying a delay
  3269. approximately equal to the attack/decay times allows the filter to effectively
  3270. operate in predictive rather than reactive mode. It defaults to 0.
  3271. @end table
  3272. @subsection Examples
  3273. @itemize
  3274. @item
  3275. Make music with both quiet and loud passages suitable for listening to in a
  3276. noisy environment:
  3277. @example
  3278. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  3279. @end example
  3280. Another example for audio with whisper and explosion parts:
  3281. @example
  3282. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  3283. @end example
  3284. @item
  3285. A noise gate for when the noise is at a lower level than the signal:
  3286. @example
  3287. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  3288. @end example
  3289. @item
  3290. Here is another noise gate, this time for when the noise is at a higher level
  3291. than the signal (making it, in some ways, similar to squelch):
  3292. @example
  3293. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  3294. @end example
  3295. @item
  3296. 2:1 compression starting at -6dB:
  3297. @example
  3298. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  3299. @end example
  3300. @item
  3301. 2:1 compression starting at -9dB:
  3302. @example
  3303. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  3304. @end example
  3305. @item
  3306. 2:1 compression starting at -12dB:
  3307. @example
  3308. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  3309. @end example
  3310. @item
  3311. 2:1 compression starting at -18dB:
  3312. @example
  3313. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  3314. @end example
  3315. @item
  3316. 3:1 compression starting at -15dB:
  3317. @example
  3318. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  3319. @end example
  3320. @item
  3321. Compressor/Gate:
  3322. @example
  3323. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  3324. @end example
  3325. @item
  3326. Expander:
  3327. @example
  3328. 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
  3329. @end example
  3330. @item
  3331. Hard limiter at -6dB:
  3332. @example
  3333. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  3334. @end example
  3335. @item
  3336. Hard limiter at -12dB:
  3337. @example
  3338. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  3339. @end example
  3340. @item
  3341. Hard noise gate at -35 dB:
  3342. @example
  3343. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  3344. @end example
  3345. @item
  3346. Soft limiter:
  3347. @example
  3348. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  3349. @end example
  3350. @end itemize
  3351. @section compensationdelay
  3352. Compensation Delay Line is a metric based delay to compensate differing
  3353. positions of microphones or speakers.
  3354. For example, you have recorded guitar with two microphones placed in
  3355. different locations. Because the front of sound wave has fixed speed in
  3356. normal conditions, the phasing of microphones can vary and depends on
  3357. their location and interposition. The best sound mix can be achieved when
  3358. these microphones are in phase (synchronized). Note that a distance of
  3359. ~30 cm between microphones makes one microphone capture the signal in
  3360. antiphase to the other microphone. That makes the final mix sound moody.
  3361. This filter helps to solve phasing problems by adding different delays
  3362. to each microphone track and make them synchronized.
  3363. The best result can be reached when you take one track as base and
  3364. synchronize other tracks one by one with it.
  3365. Remember that synchronization/delay tolerance depends on sample rate, too.
  3366. Higher sample rates will give more tolerance.
  3367. The filter accepts the following parameters:
  3368. @table @option
  3369. @item mm
  3370. Set millimeters distance. This is compensation distance for fine tuning.
  3371. Default is 0.
  3372. @item cm
  3373. Set cm distance. This is compensation distance for tightening distance setup.
  3374. Default is 0.
  3375. @item m
  3376. Set meters distance. This is compensation distance for hard distance setup.
  3377. Default is 0.
  3378. @item dry
  3379. Set dry amount. Amount of unprocessed (dry) signal.
  3380. Default is 0.
  3381. @item wet
  3382. Set wet amount. Amount of processed (wet) signal.
  3383. Default is 1.
  3384. @item temp
  3385. Set temperature in degrees Celsius. This is the temperature of the environment.
  3386. Default is 20.
  3387. @end table
  3388. @subsection Commands
  3389. This filter supports the all above options as @ref{commands}.
  3390. @section crossfeed
  3391. Apply headphone crossfeed filter.
  3392. Crossfeed is the process of blending the left and right channels of stereo
  3393. audio recording.
  3394. It is mainly used to reduce extreme stereo separation of low frequencies.
  3395. The intent is to produce more speaker like sound to the listener.
  3396. The filter accepts the following options:
  3397. @table @option
  3398. @item strength
  3399. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  3400. This sets gain of low shelf filter for side part of stereo image.
  3401. Default is -6dB. Max allowed is -30db when strength is set to 1.
  3402. @item range
  3403. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  3404. This sets cut off frequency of low shelf filter. Default is cut off near
  3405. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  3406. @item slope
  3407. Set curve slope of low shelf filter. Default is 0.5.
  3408. Allowed range is from 0.01 to 1.
  3409. @item level_in
  3410. Set input gain. Default is 0.9.
  3411. @item level_out
  3412. Set output gain. Default is 1.
  3413. @item block_size
  3414. Set block size used for reverse IIR processing. If this value is set to high enough
  3415. value (higher than impulse response length truncated when reaches near zero values) filtering
  3416. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3417. Note that filter delay will be exactly this many samples when set to non-zero value.
  3418. @end table
  3419. @subsection Commands
  3420. This filter supports the all above options as @ref{commands}.
  3421. @section crystalizer
  3422. Simple algorithm for audio noise sharpening.
  3423. This filter linearly increases differences betweeen each audio sample.
  3424. The filter accepts the following options:
  3425. @table @option
  3426. @item i
  3427. Sets the intensity of effect (default: 2.0). Must be in range between -10.0 to 0
  3428. (unchanged sound) to 10.0 (maximum effect).
  3429. To inverse filtering use negative value.
  3430. @item c
  3431. Enable clipping. By default is enabled.
  3432. @end table
  3433. @subsection Commands
  3434. This filter supports the all above options as @ref{commands}.
  3435. @section dcshift
  3436. Apply a DC shift to the audio.
  3437. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  3438. in the recording chain) from the audio. The effect of a DC offset is reduced
  3439. headroom and hence volume. The @ref{astats} filter can be used to determine if
  3440. a signal has a DC offset.
  3441. @table @option
  3442. @item shift
  3443. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  3444. the audio.
  3445. @item limitergain
  3446. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  3447. used to prevent clipping.
  3448. @end table
  3449. @section deesser
  3450. Apply de-essing to the audio samples.
  3451. @table @option
  3452. @item i
  3453. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  3454. Default is 0.
  3455. @item m
  3456. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  3457. Default is 0.5.
  3458. @item f
  3459. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  3460. Default is 0.5.
  3461. @item s
  3462. Set the output mode.
  3463. It accepts the following values:
  3464. @table @option
  3465. @item i
  3466. Pass input unchanged.
  3467. @item o
  3468. Pass ess filtered out.
  3469. @item e
  3470. Pass only ess.
  3471. Default value is @var{o}.
  3472. @end table
  3473. @end table
  3474. @section dialoguenhance
  3475. Enhance dialogue in stereo audio.
  3476. This filter accepts stereo input and produce surround (3.0) channels output.
  3477. The newly produced front center channel have enhanced speech dialogue originally
  3478. available in both stereo channels.
  3479. This filter outputs front left and front right channels same as available in stereo input.
  3480. The filter accepts the following options:
  3481. @table @option
  3482. @item original
  3483. Set the original center factor to keep in front center channel output.
  3484. Allowed range is from 0 to 1. Default value is 1.
  3485. @item enhance
  3486. Set the dialogue enhance factor to put in front center channel output.
  3487. Allowed range is from 0 to 3. Default value is 1.
  3488. @item voice
  3489. Set the voice detection factor.
  3490. Allowed range is from 2 to 32. Default value is 2.
  3491. @end table
  3492. @subsection Commands
  3493. This filter supports the all above options as @ref{commands}.
  3494. @section drmeter
  3495. Measure audio dynamic range.
  3496. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  3497. is found in transition material. And anything less that 8 have very poor dynamics
  3498. and is very compressed.
  3499. The filter accepts the following options:
  3500. @table @option
  3501. @item length
  3502. Set window length in seconds used to split audio into segments of equal length.
  3503. Default is 3 seconds.
  3504. @end table
  3505. @section dynaudnorm
  3506. Dynamic Audio Normalizer.
  3507. This filter applies a certain amount of gain to the input audio in order
  3508. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  3509. contrast to more "simple" normalization algorithms, the Dynamic Audio
  3510. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  3511. This allows for applying extra gain to the "quiet" sections of the audio
  3512. while avoiding distortions or clipping the "loud" sections. In other words:
  3513. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  3514. sections, in the sense that the volume of each section is brought to the
  3515. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  3516. this goal *without* applying "dynamic range compressing". It will retain 100%
  3517. of the dynamic range *within* each section of the audio file.
  3518. @table @option
  3519. @item framelen, f
  3520. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  3521. Default is 500 milliseconds.
  3522. The Dynamic Audio Normalizer processes the input audio in small chunks,
  3523. referred to as frames. This is required, because a peak magnitude has no
  3524. meaning for just a single sample value. Instead, we need to determine the
  3525. peak magnitude for a contiguous sequence of sample values. While a "standard"
  3526. normalizer would simply use the peak magnitude of the complete file, the
  3527. Dynamic Audio Normalizer determines the peak magnitude individually for each
  3528. frame. The length of a frame is specified in milliseconds. By default, the
  3529. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  3530. been found to give good results with most files.
  3531. Note that the exact frame length, in number of samples, will be determined
  3532. automatically, based on the sampling rate of the individual input audio file.
  3533. @item gausssize, g
  3534. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  3535. number. Default is 31.
  3536. Probably the most important parameter of the Dynamic Audio Normalizer is the
  3537. @code{window size} of the Gaussian smoothing filter. The filter's window size
  3538. is specified in frames, centered around the current frame. For the sake of
  3539. simplicity, this must be an odd number. Consequently, the default value of 31
  3540. takes into account the current frame, as well as the 15 preceding frames and
  3541. the 15 subsequent frames. Using a larger window results in a stronger
  3542. smoothing effect and thus in less gain variation, i.e. slower gain
  3543. adaptation. Conversely, using a smaller window results in a weaker smoothing
  3544. effect and thus in more gain variation, i.e. faster gain adaptation.
  3545. In other words, the more you increase this value, the more the Dynamic Audio
  3546. Normalizer will behave like a "traditional" normalization filter. On the
  3547. contrary, the more you decrease this value, the more the Dynamic Audio
  3548. Normalizer will behave like a dynamic range compressor.
  3549. @item peak, p
  3550. Set the target peak value. This specifies the highest permissible magnitude
  3551. level for the normalized audio input. This filter will try to approach the
  3552. target peak magnitude as closely as possible, but at the same time it also
  3553. makes sure that the normalized signal will never exceed the peak magnitude.
  3554. A frame's maximum local gain factor is imposed directly by the target peak
  3555. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  3556. It is not recommended to go above this value.
  3557. @item maxgain, m
  3558. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  3559. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  3560. factor for each input frame, i.e. the maximum gain factor that does not
  3561. result in clipping or distortion. The maximum gain factor is determined by
  3562. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  3563. additionally bounds the frame's maximum gain factor by a predetermined
  3564. (global) maximum gain factor. This is done in order to avoid excessive gain
  3565. factors in "silent" or almost silent frames. By default, the maximum gain
  3566. factor is 10.0, For most inputs the default value should be sufficient and
  3567. it usually is not recommended to increase this value. Though, for input
  3568. with an extremely low overall volume level, it may be necessary to allow even
  3569. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  3570. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  3571. Instead, a "sigmoid" threshold function will be applied. This way, the
  3572. gain factors will smoothly approach the threshold value, but never exceed that
  3573. value.
  3574. @item targetrms, r
  3575. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  3576. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  3577. This means that the maximum local gain factor for each frame is defined
  3578. (only) by the frame's highest magnitude sample. This way, the samples can
  3579. be amplified as much as possible without exceeding the maximum signal
  3580. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  3581. Normalizer can also take into account the frame's root mean square,
  3582. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  3583. determine the power of a time-varying signal. It is therefore considered
  3584. that the RMS is a better approximation of the "perceived loudness" than
  3585. just looking at the signal's peak magnitude. Consequently, by adjusting all
  3586. frames to a constant RMS value, a uniform "perceived loudness" can be
  3587. established. If a target RMS value has been specified, a frame's local gain
  3588. factor is defined as the factor that would result in exactly that RMS value.
  3589. Note, however, that the maximum local gain factor is still restricted by the
  3590. frame's highest magnitude sample, in order to prevent clipping.
  3591. @item coupling, n
  3592. Enable channels coupling. By default is enabled.
  3593. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  3594. amount. This means the same gain factor will be applied to all channels, i.e.
  3595. the maximum possible gain factor is determined by the "loudest" channel.
  3596. However, in some recordings, it may happen that the volume of the different
  3597. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  3598. In this case, this option can be used to disable the channel coupling. This way,
  3599. the gain factor will be determined independently for each channel, depending
  3600. only on the individual channel's highest magnitude sample. This allows for
  3601. harmonizing the volume of the different channels.
  3602. @item correctdc, c
  3603. Enable DC bias correction. By default is disabled.
  3604. An audio signal (in the time domain) is a sequence of sample values.
  3605. In the Dynamic Audio Normalizer these sample values are represented in the
  3606. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  3607. audio signal, or "waveform", should be centered around the zero point.
  3608. That means if we calculate the mean value of all samples in a file, or in a
  3609. single frame, then the result should be 0.0 or at least very close to that
  3610. value. If, however, there is a significant deviation of the mean value from
  3611. 0.0, in either positive or negative direction, this is referred to as a
  3612. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  3613. Audio Normalizer provides optional DC bias correction.
  3614. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  3615. the mean value, or "DC correction" offset, of each input frame and subtract
  3616. that value from all of the frame's sample values which ensures those samples
  3617. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  3618. boundaries, the DC correction offset values will be interpolated smoothly
  3619. between neighbouring frames.
  3620. @item altboundary, b
  3621. Enable alternative boundary mode. By default is disabled.
  3622. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  3623. around each frame. This includes the preceding frames as well as the
  3624. subsequent frames. However, for the "boundary" frames, located at the very
  3625. beginning and at the very end of the audio file, not all neighbouring
  3626. frames are available. In particular, for the first few frames in the audio
  3627. file, the preceding frames are not known. And, similarly, for the last few
  3628. frames in the audio file, the subsequent frames are not known. Thus, the
  3629. question arises which gain factors should be assumed for the missing frames
  3630. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  3631. to deal with this situation. The default boundary mode assumes a gain factor
  3632. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  3633. "fade out" at the beginning and at the end of the input, respectively.
  3634. @item compress, s
  3635. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  3636. By default, the Dynamic Audio Normalizer does not apply "traditional"
  3637. compression. This means that signal peaks will not be pruned and thus the
  3638. full dynamic range will be retained within each local neighbourhood. However,
  3639. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  3640. normalization algorithm with a more "traditional" compression.
  3641. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  3642. (thresholding) function. If (and only if) the compression feature is enabled,
  3643. all input frames will be processed by a soft knee thresholding function prior
  3644. to the actual normalization process. Put simply, the thresholding function is
  3645. going to prune all samples whose magnitude exceeds a certain threshold value.
  3646. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  3647. value. Instead, the threshold value will be adjusted for each individual
  3648. frame.
  3649. In general, smaller parameters result in stronger compression, and vice versa.
  3650. Values below 3.0 are not recommended, because audible distortion may appear.
  3651. @item threshold, t
  3652. Set the target threshold value. This specifies the lowest permissible
  3653. magnitude level for the audio input which will be normalized.
  3654. If input frame volume is above this value frame will be normalized.
  3655. Otherwise frame may not be normalized at all. The default value is set
  3656. to 0, which means all input frames will be normalized.
  3657. This option is mostly useful if digital noise is not wanted to be amplified.
  3658. @item channels, h
  3659. Specify which channels to filter, by default all available channels are filtered.
  3660. @item overlap, o
  3661. Specify overlap for frames. If set to 0 (default) no frame overlapping is done.
  3662. Using >0 and <1 values will make less conservative gain adjustments, like
  3663. when framelen option is set to smaller value, if framelen option value is
  3664. compensated for non-zero overlap then gain adjustments will be smoother across time
  3665. compared to zero overlap case.
  3666. @item curve, v
  3667. Specify the peak mapping curve expression which is going to be used when calculating
  3668. gain applied to frames. The max output frame gain will still be limited by other
  3669. options mentioned previously for this filter.
  3670. The expression can contain the following constants:
  3671. @table @option
  3672. @item ch
  3673. current channel number
  3674. @item sn
  3675. current sample number
  3676. @item nb_channels
  3677. number of channels
  3678. @item t
  3679. timestamp expressed in seconds
  3680. @item sr
  3681. sample rate
  3682. @item p
  3683. current frame peak value
  3684. @end table
  3685. @end table
  3686. @subsection Commands
  3687. This filter supports the all above options as @ref{commands}.
  3688. @section earwax
  3689. Make audio easier to listen to on headphones.
  3690. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  3691. so that when listened to on headphones the stereo image is moved from
  3692. inside your head (standard for headphones) to outside and in front of
  3693. the listener (standard for speakers).
  3694. Ported from SoX.
  3695. @section equalizer
  3696. Apply a two-pole peaking equalisation (EQ) filter. With this
  3697. filter, the signal-level at and around a selected frequency can
  3698. be increased or decreased, whilst (unlike bandpass and bandreject
  3699. filters) that at all other frequencies is unchanged.
  3700. In order to produce complex equalisation curves, this filter can
  3701. be given several times, each with a different central frequency.
  3702. The filter accepts the following options:
  3703. @table @option
  3704. @item frequency, f
  3705. Set the filter's central frequency in Hz.
  3706. @item width_type, t
  3707. Set method to specify band-width of filter.
  3708. @table @option
  3709. @item h
  3710. Hz
  3711. @item q
  3712. Q-Factor
  3713. @item o
  3714. octave
  3715. @item s
  3716. slope
  3717. @item k
  3718. kHz
  3719. @end table
  3720. @item width, w
  3721. Specify the band-width of a filter in width_type units.
  3722. @item gain, g
  3723. Set the required gain or attenuation in dB.
  3724. Beware of clipping when using a positive gain.
  3725. @item mix, m
  3726. How much to use filtered signal in output. Default is 1.
  3727. Range is between 0 and 1.
  3728. @item channels, c
  3729. Specify which channels to filter, by default all available are filtered.
  3730. @item normalize, n
  3731. Normalize biquad coefficients, by default is disabled.
  3732. Enabling it will normalize magnitude response at DC to 0dB.
  3733. @item transform, a
  3734. Set transform type of IIR filter.
  3735. @table @option
  3736. @item di
  3737. @item dii
  3738. @item tdi
  3739. @item tdii
  3740. @item latt
  3741. @item svf
  3742. @item zdf
  3743. @end table
  3744. @item precision, r
  3745. Set precison of filtering.
  3746. @table @option
  3747. @item auto
  3748. Pick automatic sample format depending on surround filters.
  3749. @item s16
  3750. Always use signed 16-bit.
  3751. @item s32
  3752. Always use signed 32-bit.
  3753. @item f32
  3754. Always use float 32-bit.
  3755. @item f64
  3756. Always use float 64-bit.
  3757. @end table
  3758. @item block_size, b
  3759. Set block size used for reverse IIR processing. If this value is set to high enough
  3760. value (higher than impulse response length truncated when reaches near zero values) filtering
  3761. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3762. Note that filter delay will be exactly this many samples when set to non-zero value.
  3763. @end table
  3764. @subsection Examples
  3765. @itemize
  3766. @item
  3767. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  3768. @example
  3769. equalizer=f=1000:t=h:width=200:g=-10
  3770. @end example
  3771. @item
  3772. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  3773. @example
  3774. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  3775. @end example
  3776. @end itemize
  3777. @subsection Commands
  3778. This filter supports the following commands:
  3779. @table @option
  3780. @item frequency, f
  3781. Change equalizer frequency.
  3782. Syntax for the command is : "@var{frequency}"
  3783. @item width_type, t
  3784. Change equalizer width_type.
  3785. Syntax for the command is : "@var{width_type}"
  3786. @item width, w
  3787. Change equalizer width.
  3788. Syntax for the command is : "@var{width}"
  3789. @item gain, g
  3790. Change equalizer gain.
  3791. Syntax for the command is : "@var{gain}"
  3792. @item mix, m
  3793. Change equalizer mix.
  3794. Syntax for the command is : "@var{mix}"
  3795. @end table
  3796. @section extrastereo
  3797. Linearly increases the difference between left and right channels which
  3798. adds some sort of "live" effect to playback.
  3799. The filter accepts the following options:
  3800. @table @option
  3801. @item m
  3802. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  3803. (average of both channels), with 1.0 sound will be unchanged, with
  3804. -1.0 left and right channels will be swapped.
  3805. @item c
  3806. Enable clipping. By default is enabled.
  3807. @end table
  3808. @subsection Commands
  3809. This filter supports the all above options as @ref{commands}.
  3810. @section firequalizer
  3811. Apply FIR Equalization using arbitrary frequency response.
  3812. The filter accepts the following option:
  3813. @table @option
  3814. @item gain
  3815. Set gain curve equation (in dB). The expression can contain variables:
  3816. @table @option
  3817. @item f
  3818. the evaluated frequency
  3819. @item sr
  3820. sample rate
  3821. @item ch
  3822. channel number, set to 0 when multichannels evaluation is disabled
  3823. @item chid
  3824. channel id, see libavutil/channel_layout.h, set to the first channel id when
  3825. multichannels evaluation is disabled
  3826. @item chs
  3827. number of channels
  3828. @item chlayout
  3829. channel_layout, see libavutil/channel_layout.h
  3830. @end table
  3831. and functions:
  3832. @table @option
  3833. @item gain_interpolate(f)
  3834. interpolate gain on frequency f based on gain_entry
  3835. @item cubic_interpolate(f)
  3836. same as gain_interpolate, but smoother
  3837. @end table
  3838. This option is also available as command. Default is @code{gain_interpolate(f)}.
  3839. @item gain_entry
  3840. Set gain entry for gain_interpolate function. The expression can
  3841. contain functions:
  3842. @table @option
  3843. @item entry(f, g)
  3844. store gain entry at frequency f with value g
  3845. @end table
  3846. This option is also available as command.
  3847. @item delay
  3848. Set filter delay in seconds. Higher value means more accurate.
  3849. Default is @code{0.01}.
  3850. @item accuracy
  3851. Set filter accuracy in Hz. Lower value means more accurate.
  3852. Default is @code{5}.
  3853. @item wfunc
  3854. Set window function. Acceptable values are:
  3855. @table @option
  3856. @item rectangular
  3857. rectangular window, useful when gain curve is already smooth
  3858. @item hann
  3859. hann window (default)
  3860. @item hamming
  3861. hamming window
  3862. @item blackman
  3863. blackman window
  3864. @item nuttall3
  3865. 3-terms continuous 1st derivative nuttall window
  3866. @item mnuttall3
  3867. minimum 3-terms discontinuous nuttall window
  3868. @item nuttall
  3869. 4-terms continuous 1st derivative nuttall window
  3870. @item bnuttall
  3871. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  3872. @item bharris
  3873. blackman-harris window
  3874. @item tukey
  3875. tukey window
  3876. @end table
  3877. @item fixed
  3878. If enabled, use fixed number of audio samples. This improves speed when
  3879. filtering with large delay. Default is disabled.
  3880. @item multi
  3881. Enable multichannels evaluation on gain. Default is disabled.
  3882. @item zero_phase
  3883. Enable zero phase mode by subtracting timestamp to compensate delay.
  3884. Default is disabled.
  3885. @item scale
  3886. Set scale used by gain. Acceptable values are:
  3887. @table @option
  3888. @item linlin
  3889. linear frequency, linear gain
  3890. @item linlog
  3891. linear frequency, logarithmic (in dB) gain (default)
  3892. @item loglin
  3893. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  3894. @item loglog
  3895. logarithmic frequency, logarithmic gain
  3896. @end table
  3897. @item dumpfile
  3898. Set file for dumping, suitable for gnuplot.
  3899. @item dumpscale
  3900. Set scale for dumpfile. Acceptable values are same with scale option.
  3901. Default is linlog.
  3902. @item fft2
  3903. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  3904. Default is disabled.
  3905. @item min_phase
  3906. Enable minimum phase impulse response. Default is disabled.
  3907. @end table
  3908. @subsection Examples
  3909. @itemize
  3910. @item
  3911. lowpass at 1000 Hz:
  3912. @example
  3913. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  3914. @end example
  3915. @item
  3916. lowpass at 1000 Hz with gain_entry:
  3917. @example
  3918. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  3919. @end example
  3920. @item
  3921. custom equalization:
  3922. @example
  3923. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  3924. @end example
  3925. @item
  3926. higher delay with zero phase to compensate delay:
  3927. @example
  3928. firequalizer=delay=0.1:fixed=on:zero_phase=on
  3929. @end example
  3930. @item
  3931. lowpass on left channel, highpass on right channel:
  3932. @example
  3933. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  3934. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  3935. @end example
  3936. @end itemize
  3937. @section flanger
  3938. Apply a flanging effect to the audio.
  3939. The filter accepts the following options:
  3940. @table @option
  3941. @item delay
  3942. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  3943. @item depth
  3944. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  3945. @item regen
  3946. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  3947. Default value is 0.
  3948. @item width
  3949. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  3950. Default value is 71.
  3951. @item speed
  3952. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  3953. @item shape
  3954. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  3955. Default value is @var{sinusoidal}.
  3956. @item phase
  3957. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  3958. Default value is 25.
  3959. @item interp
  3960. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  3961. Default is @var{linear}.
  3962. @end table
  3963. @section haas
  3964. Apply Haas effect to audio.
  3965. Note that this makes most sense to apply on mono signals.
  3966. With this filter applied to mono signals it give some directionality and
  3967. stretches its stereo image.
  3968. The filter accepts the following options:
  3969. @table @option
  3970. @item level_in
  3971. Set input level. By default is @var{1}, or 0dB
  3972. @item level_out
  3973. Set output level. By default is @var{1}, or 0dB.
  3974. @item side_gain
  3975. Set gain applied to side part of signal. By default is @var{1}.
  3976. @item middle_source
  3977. Set kind of middle source. Can be one of the following:
  3978. @table @samp
  3979. @item left
  3980. Pick left channel.
  3981. @item right
  3982. Pick right channel.
  3983. @item mid
  3984. Pick middle part signal of stereo image.
  3985. @item side
  3986. Pick side part signal of stereo image.
  3987. @end table
  3988. @item middle_phase
  3989. Change middle phase. By default is disabled.
  3990. @item left_delay
  3991. Set left channel delay. By default is @var{2.05} milliseconds.
  3992. @item left_balance
  3993. Set left channel balance. By default is @var{-1}.
  3994. @item left_gain
  3995. Set left channel gain. By default is @var{1}.
  3996. @item left_phase
  3997. Change left phase. By default is disabled.
  3998. @item right_delay
  3999. Set right channel delay. By defaults is @var{2.12} milliseconds.
  4000. @item right_balance
  4001. Set right channel balance. By default is @var{1}.
  4002. @item right_gain
  4003. Set right channel gain. By default is @var{1}.
  4004. @item right_phase
  4005. Change right phase. By default is enabled.
  4006. @end table
  4007. @section hdcd
  4008. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  4009. embedded HDCD codes is expanded into a 20-bit PCM stream.
  4010. The filter supports the Peak Extend and Low-level Gain Adjustment features
  4011. of HDCD, and detects the Transient Filter flag.
  4012. @example
  4013. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  4014. @end example
  4015. When using the filter with wav, note the default encoding for wav is 16-bit,
  4016. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  4017. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  4018. @example
  4019. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  4020. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  4021. @end example
  4022. The filter accepts the following options:
  4023. @table @option
  4024. @item disable_autoconvert
  4025. Disable any automatic format conversion or resampling in the filter graph.
  4026. @item process_stereo
  4027. Process the stereo channels together. If target_gain does not match between
  4028. channels, consider it invalid and use the last valid target_gain.
  4029. @item cdt_ms
  4030. Set the code detect timer period in ms.
  4031. @item force_pe
  4032. Always extend peaks above -3dBFS even if PE isn't signaled.
  4033. @item analyze_mode
  4034. Replace audio with a solid tone and adjust the amplitude to signal some
  4035. specific aspect of the decoding process. The output file can be loaded in
  4036. an audio editor alongside the original to aid analysis.
  4037. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  4038. Modes are:
  4039. @table @samp
  4040. @item 0, off
  4041. Disabled
  4042. @item 1, lle
  4043. Gain adjustment level at each sample
  4044. @item 2, pe
  4045. Samples where peak extend occurs
  4046. @item 3, cdt
  4047. Samples where the code detect timer is active
  4048. @item 4, tgm
  4049. Samples where the target gain does not match between channels
  4050. @end table
  4051. @end table
  4052. @section headphone
  4053. Apply head-related transfer functions (HRTFs) to create virtual
  4054. loudspeakers around the user for binaural listening via headphones.
  4055. The HRIRs are provided via additional streams, for each channel
  4056. one stereo input stream is needed.
  4057. The filter accepts the following options:
  4058. @table @option
  4059. @item map
  4060. Set mapping of input streams for convolution.
  4061. The argument is a '|'-separated list of channel names in order as they
  4062. are given as additional stream inputs for filter.
  4063. This also specify number of input streams. Number of input streams
  4064. must be not less than number of channels in first stream plus one.
  4065. @item gain
  4066. Set gain applied to audio. Value is in dB. Default is 0.
  4067. @item type
  4068. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  4069. processing audio in time domain which is slow.
  4070. @var{freq} is processing audio in frequency domain which is fast.
  4071. Default is @var{freq}.
  4072. @item lfe
  4073. Set custom gain for LFE channels. Value is in dB. Default is 0.
  4074. @item size
  4075. Set size of frame in number of samples which will be processed at once.
  4076. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  4077. @item hrir
  4078. Set format of hrir stream.
  4079. Default value is @var{stereo}. Alternative value is @var{multich}.
  4080. If value is set to @var{stereo}, number of additional streams should
  4081. be greater or equal to number of input channels in first input stream.
  4082. Also each additional stream should have stereo number of channels.
  4083. If value is set to @var{multich}, number of additional streams should
  4084. be exactly one. Also number of input channels of additional stream
  4085. should be equal or greater than twice number of channels of first input
  4086. stream.
  4087. @end table
  4088. @subsection Examples
  4089. @itemize
  4090. @item
  4091. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  4092. each amovie filter use stereo file with IR coefficients as input.
  4093. The files give coefficients for each position of virtual loudspeaker:
  4094. @example
  4095. ffmpeg -i input.wav
  4096. -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"
  4097. output.wav
  4098. @end example
  4099. @item
  4100. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  4101. but now in @var{multich} @var{hrir} format.
  4102. @example
  4103. 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"
  4104. output.wav
  4105. @end example
  4106. @end itemize
  4107. @section highpass
  4108. Apply a high-pass filter with 3dB point frequency.
  4109. The filter can be either single-pole, or double-pole (the default).
  4110. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  4111. The filter accepts the following options:
  4112. @table @option
  4113. @item frequency, f
  4114. Set frequency in Hz. Default is 3000.
  4115. @item poles, p
  4116. Set number of poles. Default is 2.
  4117. @item width_type, t
  4118. Set method to specify band-width of filter.
  4119. @table @option
  4120. @item h
  4121. Hz
  4122. @item q
  4123. Q-Factor
  4124. @item o
  4125. octave
  4126. @item s
  4127. slope
  4128. @item k
  4129. kHz
  4130. @end table
  4131. @item width, w
  4132. Specify the band-width of a filter in width_type units.
  4133. Applies only to double-pole filter.
  4134. The default is 0.707q and gives a Butterworth response.
  4135. @item mix, m
  4136. How much to use filtered signal in output. Default is 1.
  4137. Range is between 0 and 1.
  4138. @item channels, c
  4139. Specify which channels to filter, by default all available are filtered.
  4140. @item normalize, n
  4141. Normalize biquad coefficients, by default is disabled.
  4142. Enabling it will normalize magnitude response at DC to 0dB.
  4143. @item transform, a
  4144. Set transform type of IIR filter.
  4145. @table @option
  4146. @item di
  4147. @item dii
  4148. @item tdi
  4149. @item tdii
  4150. @item latt
  4151. @item svf
  4152. @item zdf
  4153. @end table
  4154. @item precision, r
  4155. Set precison of filtering.
  4156. @table @option
  4157. @item auto
  4158. Pick automatic sample format depending on surround filters.
  4159. @item s16
  4160. Always use signed 16-bit.
  4161. @item s32
  4162. Always use signed 32-bit.
  4163. @item f32
  4164. Always use float 32-bit.
  4165. @item f64
  4166. Always use float 64-bit.
  4167. @end table
  4168. @item block_size, b
  4169. Set block size used for reverse IIR processing. If this value is set to high enough
  4170. value (higher than impulse response length truncated when reaches near zero values) filtering
  4171. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  4172. Note that filter delay will be exactly this many samples when set to non-zero value.
  4173. @end table
  4174. @subsection Commands
  4175. This filter supports the following commands:
  4176. @table @option
  4177. @item frequency, f
  4178. Change highpass frequency.
  4179. Syntax for the command is : "@var{frequency}"
  4180. @item width_type, t
  4181. Change highpass width_type.
  4182. Syntax for the command is : "@var{width_type}"
  4183. @item width, w
  4184. Change highpass width.
  4185. Syntax for the command is : "@var{width}"
  4186. @item mix, m
  4187. Change highpass mix.
  4188. Syntax for the command is : "@var{mix}"
  4189. @end table
  4190. @section join
  4191. Join multiple input streams into one multi-channel stream.
  4192. It accepts the following parameters:
  4193. @table @option
  4194. @item inputs
  4195. The number of input streams. It defaults to 2.
  4196. @item channel_layout
  4197. The desired output channel layout. It defaults to stereo.
  4198. @item map
  4199. Map channels from inputs to output. The argument is a '|'-separated list of
  4200. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  4201. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  4202. can be either the name of the input channel (e.g. FL for front left) or its
  4203. index in the specified input stream. @var{out_channel} is the name of the output
  4204. channel.
  4205. @end table
  4206. The filter will attempt to guess the mappings when they are not specified
  4207. explicitly. It does so by first trying to find an unused matching input channel
  4208. and if that fails it picks the first unused input channel.
  4209. Join 3 inputs (with properly set channel layouts):
  4210. @example
  4211. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  4212. @end example
  4213. Build a 5.1 output from 6 single-channel streams:
  4214. @example
  4215. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  4216. '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'
  4217. out
  4218. @end example
  4219. @section ladspa
  4220. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  4221. To enable compilation of this filter you need to configure FFmpeg with
  4222. @code{--enable-ladspa}.
  4223. @table @option
  4224. @item file, f
  4225. Specifies the name of LADSPA plugin library to load. If the environment
  4226. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  4227. each one of the directories specified by the colon separated list in
  4228. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  4229. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  4230. @file{/usr/lib/ladspa/}.
  4231. @item plugin, p
  4232. Specifies the plugin within the library. Some libraries contain only
  4233. one plugin, but others contain many of them. If this is not set filter
  4234. will list all available plugins within the specified library.
  4235. @item controls, c
  4236. Set the '|' separated list of controls which are zero or more floating point
  4237. values that determine the behavior of the loaded plugin (for example delay,
  4238. threshold or gain).
  4239. Controls need to be defined using the following syntax:
  4240. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  4241. @var{valuei} is the value set on the @var{i}-th control.
  4242. Alternatively they can be also defined using the following syntax:
  4243. @var{value0}|@var{value1}|@var{value2}|..., where
  4244. @var{valuei} is the value set on the @var{i}-th control.
  4245. If @option{controls} is set to @code{help}, all available controls and
  4246. their valid ranges are printed.
  4247. @item sample_rate, s
  4248. Specify the sample rate, default to 44100. Only used if plugin have
  4249. zero inputs.
  4250. @item nb_samples, n
  4251. Set the number of samples per channel per each output frame, default
  4252. is 1024. Only used if plugin have zero inputs.
  4253. @item duration, d
  4254. Set the minimum duration of the sourced audio. See
  4255. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4256. for the accepted syntax.
  4257. Note that the resulting duration may be greater than the specified duration,
  4258. as the generated audio is always cut at the end of a complete frame.
  4259. If not specified, or the expressed duration is negative, the audio is
  4260. supposed to be generated forever.
  4261. Only used if plugin have zero inputs.
  4262. @item latency, l
  4263. Enable latency compensation, by default is disabled.
  4264. Only used if plugin have inputs.
  4265. @end table
  4266. @subsection Examples
  4267. @itemize
  4268. @item
  4269. List all available plugins within amp (LADSPA example plugin) library:
  4270. @example
  4271. ladspa=file=amp
  4272. @end example
  4273. @item
  4274. List all available controls and their valid ranges for @code{vcf_notch}
  4275. plugin from @code{VCF} library:
  4276. @example
  4277. ladspa=f=vcf:p=vcf_notch:c=help
  4278. @end example
  4279. @item
  4280. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  4281. plugin library:
  4282. @example
  4283. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  4284. @end example
  4285. @item
  4286. Add reverberation to the audio using TAP-plugins
  4287. (Tom's Audio Processing plugins):
  4288. @example
  4289. ladspa=file=tap_reverb:tap_reverb
  4290. @end example
  4291. @item
  4292. Generate white noise, with 0.2 amplitude:
  4293. @example
  4294. ladspa=file=cmt:noise_source_white:c=c0=.2
  4295. @end example
  4296. @item
  4297. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  4298. @code{C* Audio Plugin Suite} (CAPS) library:
  4299. @example
  4300. ladspa=file=caps:Click:c=c1=20'
  4301. @end example
  4302. @item
  4303. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  4304. @example
  4305. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  4306. @end example
  4307. @item
  4308. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  4309. @code{SWH Plugins} collection:
  4310. @example
  4311. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  4312. @end example
  4313. @item
  4314. Attenuate low frequencies using Multiband EQ from Steve Harris
  4315. @code{SWH Plugins} collection:
  4316. @example
  4317. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  4318. @end example
  4319. @item
  4320. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  4321. (CAPS) library:
  4322. @example
  4323. ladspa=caps:Narrower
  4324. @end example
  4325. @item
  4326. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  4327. @example
  4328. ladspa=caps:White:.2
  4329. @end example
  4330. @item
  4331. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  4332. @example
  4333. ladspa=caps:Fractal:c=c1=1
  4334. @end example
  4335. @item
  4336. Dynamic volume normalization using @code{VLevel} plugin:
  4337. @example
  4338. ladspa=vlevel-ladspa:vlevel_mono
  4339. @end example
  4340. @end itemize
  4341. @subsection Commands
  4342. This filter supports the following commands:
  4343. @table @option
  4344. @item cN
  4345. Modify the @var{N}-th control value.
  4346. If the specified value is not valid, it is ignored and prior one is kept.
  4347. @end table
  4348. @section loudnorm
  4349. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  4350. Support for both single pass (livestreams, files) and double pass (files) modes.
  4351. This algorithm can target IL, LRA, and maximum true peak. In dynamic mode, to accurately
  4352. detect true peaks, the audio stream will be upsampled to 192 kHz.
  4353. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  4354. The filter accepts the following options:
  4355. @table @option
  4356. @item I, i
  4357. Set integrated loudness target.
  4358. Range is -70.0 - -5.0. Default value is -24.0.
  4359. @item LRA, lra
  4360. Set loudness range target.
  4361. Range is 1.0 - 50.0. Default value is 7.0.
  4362. @item TP, tp
  4363. Set maximum true peak.
  4364. Range is -9.0 - +0.0. Default value is -2.0.
  4365. @item measured_I, measured_i
  4366. Measured IL of input file.
  4367. Range is -99.0 - +0.0.
  4368. @item measured_LRA, measured_lra
  4369. Measured LRA of input file.
  4370. Range is 0.0 - 99.0.
  4371. @item measured_TP, measured_tp
  4372. Measured true peak of input file.
  4373. Range is -99.0 - +99.0.
  4374. @item measured_thresh
  4375. Measured threshold of input file.
  4376. Range is -99.0 - +0.0.
  4377. @item offset
  4378. Set offset gain. Gain is applied before the true-peak limiter.
  4379. Range is -99.0 - +99.0. Default is +0.0.
  4380. @item linear
  4381. Normalize by linearly scaling the source audio.
  4382. @code{measured_I}, @code{measured_LRA}, @code{measured_TP},
  4383. and @code{measured_thresh} must all be specified. Target LRA shouldn't
  4384. be lower than source LRA and the change in integrated loudness shouldn't
  4385. result in a true peak which exceeds the target TP. If any of these
  4386. conditions aren't met, normalization mode will revert to @var{dynamic}.
  4387. Options are @code{true} or @code{false}. Default is @code{true}.
  4388. @item dual_mono
  4389. Treat mono input files as "dual-mono". If a mono file is intended for playback
  4390. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  4391. If set to @code{true}, this option will compensate for this effect.
  4392. Multi-channel input files are not affected by this option.
  4393. Options are true or false. Default is false.
  4394. @item print_format
  4395. Set print format for stats. Options are summary, json, or none.
  4396. Default value is none.
  4397. @end table
  4398. @section lowpass
  4399. Apply a low-pass filter with 3dB point frequency.
  4400. The filter can be either single-pole or double-pole (the default).
  4401. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  4402. The filter accepts the following options:
  4403. @table @option
  4404. @item frequency, f
  4405. Set frequency in Hz. Default is 500.
  4406. @item poles, p
  4407. Set number of poles. Default is 2.
  4408. @item width_type, t
  4409. Set method to specify band-width of filter.
  4410. @table @option
  4411. @item h
  4412. Hz
  4413. @item q
  4414. Q-Factor
  4415. @item o
  4416. octave
  4417. @item s
  4418. slope
  4419. @item k
  4420. kHz
  4421. @end table
  4422. @item width, w
  4423. Specify the band-width of a filter in width_type units.
  4424. Applies only to double-pole filter.
  4425. The default is 0.707q and gives a Butterworth response.
  4426. @item mix, m
  4427. How much to use filtered signal in output. Default is 1.
  4428. Range is between 0 and 1.
  4429. @item channels, c
  4430. Specify which channels to filter, by default all available are filtered.
  4431. @item normalize, n
  4432. Normalize biquad coefficients, by default is disabled.
  4433. Enabling it will normalize magnitude response at DC to 0dB.
  4434. @item transform, a
  4435. Set transform type of IIR filter.
  4436. @table @option
  4437. @item di
  4438. @item dii
  4439. @item tdi
  4440. @item tdii
  4441. @item latt
  4442. @item svf
  4443. @item zdf
  4444. @end table
  4445. @item precision, r
  4446. Set precison of filtering.
  4447. @table @option
  4448. @item auto
  4449. Pick automatic sample format depending on surround filters.
  4450. @item s16
  4451. Always use signed 16-bit.
  4452. @item s32
  4453. Always use signed 32-bit.
  4454. @item f32
  4455. Always use float 32-bit.
  4456. @item f64
  4457. Always use float 64-bit.
  4458. @end table
  4459. @item block_size, b
  4460. Set block size used for reverse IIR processing. If this value is set to high enough
  4461. value (higher than impulse response length truncated when reaches near zero values) filtering
  4462. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  4463. Note that filter delay will be exactly this many samples when set to non-zero value.
  4464. @end table
  4465. @subsection Examples
  4466. @itemize
  4467. @item
  4468. Lowpass only LFE channel, it LFE is not present it does nothing:
  4469. @example
  4470. lowpass=c=LFE
  4471. @end example
  4472. @end itemize
  4473. @subsection Commands
  4474. This filter supports the following commands:
  4475. @table @option
  4476. @item frequency, f
  4477. Change lowpass frequency.
  4478. Syntax for the command is : "@var{frequency}"
  4479. @item width_type, t
  4480. Change lowpass width_type.
  4481. Syntax for the command is : "@var{width_type}"
  4482. @item width, w
  4483. Change lowpass width.
  4484. Syntax for the command is : "@var{width}"
  4485. @item mix, m
  4486. Change lowpass mix.
  4487. Syntax for the command is : "@var{mix}"
  4488. @end table
  4489. @section lv2
  4490. Load a LV2 (LADSPA Version 2) plugin.
  4491. To enable compilation of this filter you need to configure FFmpeg with
  4492. @code{--enable-lv2}.
  4493. @table @option
  4494. @item plugin, p
  4495. Specifies the plugin URI. You may need to escape ':'.
  4496. @item controls, c
  4497. Set the '|' separated list of controls which are zero or more floating point
  4498. values that determine the behavior of the loaded plugin (for example delay,
  4499. threshold or gain).
  4500. If @option{controls} is set to @code{help}, all available controls and
  4501. their valid ranges are printed.
  4502. @item sample_rate, s
  4503. Specify the sample rate, default to 44100. Only used if plugin have
  4504. zero inputs.
  4505. @item nb_samples, n
  4506. Set the number of samples per channel per each output frame, default
  4507. is 1024. Only used if plugin have zero inputs.
  4508. @item duration, d
  4509. Set the minimum duration of the sourced audio. See
  4510. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4511. for the accepted syntax.
  4512. Note that the resulting duration may be greater than the specified duration,
  4513. as the generated audio is always cut at the end of a complete frame.
  4514. If not specified, or the expressed duration is negative, the audio is
  4515. supposed to be generated forever.
  4516. Only used if plugin have zero inputs.
  4517. @end table
  4518. @subsection Examples
  4519. @itemize
  4520. @item
  4521. Apply bass enhancer plugin from Calf:
  4522. @example
  4523. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  4524. @end example
  4525. @item
  4526. Apply vinyl plugin from Calf:
  4527. @example
  4528. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  4529. @end example
  4530. @item
  4531. Apply bit crusher plugin from ArtyFX:
  4532. @example
  4533. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  4534. @end example
  4535. @end itemize
  4536. @subsection Commands
  4537. This filter supports all options that are exported by plugin as commands.
  4538. @section mcompand
  4539. Multiband Compress or expand the audio's dynamic range.
  4540. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  4541. This is akin to the crossover of a loudspeaker, and results in flat frequency
  4542. response when absent compander action.
  4543. It accepts the following parameters:
  4544. @table @option
  4545. @item args
  4546. This option syntax is:
  4547. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  4548. For explanation of each item refer to compand filter documentation.
  4549. @end table
  4550. @anchor{pan}
  4551. @section pan
  4552. Mix channels with specific gain levels. The filter accepts the output
  4553. channel layout followed by a set of channels definitions.
  4554. This filter is also designed to efficiently remap the channels of an audio
  4555. stream.
  4556. The filter accepts parameters of the form:
  4557. "@var{l}|@var{outdef}|@var{outdef}|..."
  4558. @table @option
  4559. @item l
  4560. output channel layout or number of channels
  4561. @item outdef
  4562. output channel specification, of the form:
  4563. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  4564. @item out_name
  4565. output channel to define, either a channel name (FL, FR, etc.) or a channel
  4566. number (c0, c1, etc.)
  4567. @item gain
  4568. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  4569. @item in_name
  4570. input channel to use, see out_name for details; it is not possible to mix
  4571. named and numbered input channels
  4572. @end table
  4573. If the `=' in a channel specification is replaced by `<', then the gains for
  4574. that specification will be renormalized so that the total is 1, thus
  4575. avoiding clipping noise.
  4576. @subsection Mixing examples
  4577. For example, if you want to down-mix from stereo to mono, but with a bigger
  4578. factor for the left channel:
  4579. @example
  4580. pan=1c|c0=0.9*c0+0.1*c1
  4581. @end example
  4582. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  4583. 7-channels surround:
  4584. @example
  4585. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  4586. @end example
  4587. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  4588. that should be preferred (see "-ac" option) unless you have very specific
  4589. needs.
  4590. @subsection Remapping examples
  4591. The channel remapping will be effective if, and only if:
  4592. @itemize
  4593. @item gain coefficients are zeroes or ones,
  4594. @item only one input per channel output,
  4595. @end itemize
  4596. If all these conditions are satisfied, the filter will notify the user ("Pure
  4597. channel mapping detected"), and use an optimized and lossless method to do the
  4598. remapping.
  4599. For example, if you have a 5.1 source and want a stereo audio stream by
  4600. dropping the extra channels:
  4601. @example
  4602. pan="stereo| c0=FL | c1=FR"
  4603. @end example
  4604. Given the same source, you can also switch front left and front right channels
  4605. and keep the input channel layout:
  4606. @example
  4607. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  4608. @end example
  4609. If the input is a stereo audio stream, you can mute the front left channel (and
  4610. still keep the stereo channel layout) with:
  4611. @example
  4612. pan="stereo|c1=c1"
  4613. @end example
  4614. Still with a stereo audio stream input, you can copy the right channel in both
  4615. front left and right:
  4616. @example
  4617. pan="stereo| c0=FR | c1=FR"
  4618. @end example
  4619. @section replaygain
  4620. ReplayGain scanner filter. This filter takes an audio stream as an input and
  4621. outputs it unchanged.
  4622. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  4623. @section resample
  4624. Convert the audio sample format, sample rate and channel layout. It is
  4625. not meant to be used directly.
  4626. @section rubberband
  4627. Apply time-stretching and pitch-shifting with librubberband.
  4628. To enable compilation of this filter, you need to configure FFmpeg with
  4629. @code{--enable-librubberband}.
  4630. The filter accepts the following options:
  4631. @table @option
  4632. @item tempo
  4633. Set tempo scale factor.
  4634. @item pitch
  4635. Set pitch scale factor.
  4636. @item transients
  4637. Set transients detector.
  4638. Possible values are:
  4639. @table @var
  4640. @item crisp
  4641. @item mixed
  4642. @item smooth
  4643. @end table
  4644. @item detector
  4645. Set detector.
  4646. Possible values are:
  4647. @table @var
  4648. @item compound
  4649. @item percussive
  4650. @item soft
  4651. @end table
  4652. @item phase
  4653. Set phase.
  4654. Possible values are:
  4655. @table @var
  4656. @item laminar
  4657. @item independent
  4658. @end table
  4659. @item window
  4660. Set processing window size.
  4661. Possible values are:
  4662. @table @var
  4663. @item standard
  4664. @item short
  4665. @item long
  4666. @end table
  4667. @item smoothing
  4668. Set smoothing.
  4669. Possible values are:
  4670. @table @var
  4671. @item off
  4672. @item on
  4673. @end table
  4674. @item formant
  4675. Enable formant preservation when shift pitching.
  4676. Possible values are:
  4677. @table @var
  4678. @item shifted
  4679. @item preserved
  4680. @end table
  4681. @item pitchq
  4682. Set pitch quality.
  4683. Possible values are:
  4684. @table @var
  4685. @item quality
  4686. @item speed
  4687. @item consistency
  4688. @end table
  4689. @item channels
  4690. Set channels.
  4691. Possible values are:
  4692. @table @var
  4693. @item apart
  4694. @item together
  4695. @end table
  4696. @end table
  4697. @subsection Commands
  4698. This filter supports the following commands:
  4699. @table @option
  4700. @item tempo
  4701. Change filter tempo scale factor.
  4702. Syntax for the command is : "@var{tempo}"
  4703. @item pitch
  4704. Change filter pitch scale factor.
  4705. Syntax for the command is : "@var{pitch}"
  4706. @end table
  4707. @section sidechaincompress
  4708. This filter acts like normal compressor but has the ability to compress
  4709. detected signal using second input signal.
  4710. It needs two input streams and returns one output stream.
  4711. First input stream will be processed depending on second stream signal.
  4712. The filtered signal then can be filtered with other filters in later stages of
  4713. processing. See @ref{pan} and @ref{amerge} filter.
  4714. The filter accepts the following options:
  4715. @table @option
  4716. @item level_in
  4717. Set input gain. Default is 1. Range is between 0.015625 and 64.
  4718. @item mode
  4719. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  4720. Default is @code{downward}.
  4721. @item threshold
  4722. If a signal of second stream raises above this level it will affect the gain
  4723. reduction of first stream.
  4724. By default is 0.125. Range is between 0.00097563 and 1.
  4725. @item ratio
  4726. Set a ratio about which the signal is reduced. 1:2 means that if the level
  4727. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  4728. Default is 2. Range is between 1 and 20.
  4729. @item attack
  4730. Amount of milliseconds the signal has to rise above the threshold before gain
  4731. reduction starts. Default is 20. Range is between 0.01 and 2000.
  4732. @item release
  4733. Amount of milliseconds the signal has to fall below the threshold before
  4734. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  4735. @item makeup
  4736. Set the amount by how much signal will be amplified after processing.
  4737. Default is 1. Range is from 1 to 64.
  4738. @item knee
  4739. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4740. Default is 2.82843. Range is between 1 and 8.
  4741. @item link
  4742. Choose if the @code{average} level between all channels of side-chain stream
  4743. or the louder(@code{maximum}) channel of side-chain stream affects the
  4744. reduction. Default is @code{average}.
  4745. @item detection
  4746. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  4747. of @code{rms}. Default is @code{rms} which is mainly smoother.
  4748. @item level_sc
  4749. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  4750. @item mix
  4751. How much to use compressed signal in output. Default is 1.
  4752. Range is between 0 and 1.
  4753. @end table
  4754. @subsection Commands
  4755. This filter supports the all above options as @ref{commands}.
  4756. @subsection Examples
  4757. @itemize
  4758. @item
  4759. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  4760. depending on the signal of 2nd input and later compressed signal to be
  4761. merged with 2nd input:
  4762. @example
  4763. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  4764. @end example
  4765. @end itemize
  4766. @section sidechaingate
  4767. A sidechain gate acts like a normal (wideband) gate but has the ability to
  4768. filter the detected signal before sending it to the gain reduction stage.
  4769. Normally a gate uses the full range signal to detect a level above the
  4770. threshold.
  4771. For example: If you cut all lower frequencies from your sidechain signal
  4772. the gate will decrease the volume of your track only if not enough highs
  4773. appear. With this technique you are able to reduce the resonation of a
  4774. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  4775. guitar.
  4776. It needs two input streams and returns one output stream.
  4777. First input stream will be processed depending on second stream signal.
  4778. The filter accepts the following options:
  4779. @table @option
  4780. @item level_in
  4781. Set input level before filtering.
  4782. Default is 1. Allowed range is from 0.015625 to 64.
  4783. @item mode
  4784. Set the mode of operation. Can be @code{upward} or @code{downward}.
  4785. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  4786. will be amplified, expanding dynamic range in upward direction.
  4787. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  4788. @item range
  4789. Set the level of gain reduction when the signal is below the threshold.
  4790. Default is 0.06125. Allowed range is from 0 to 1.
  4791. Setting this to 0 disables reduction and then filter behaves like expander.
  4792. @item threshold
  4793. If a signal rises above this level the gain reduction is released.
  4794. Default is 0.125. Allowed range is from 0 to 1.
  4795. @item ratio
  4796. Set a ratio about which the signal is reduced.
  4797. Default is 2. Allowed range is from 1 to 9000.
  4798. @item attack
  4799. Amount of milliseconds the signal has to rise above the threshold before gain
  4800. reduction stops.
  4801. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  4802. @item release
  4803. Amount of milliseconds the signal has to fall below the threshold before the
  4804. reduction is increased again. Default is 250 milliseconds.
  4805. Allowed range is from 0.01 to 9000.
  4806. @item makeup
  4807. Set amount of amplification of signal after processing.
  4808. Default is 1. Allowed range is from 1 to 64.
  4809. @item knee
  4810. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4811. Default is 2.828427125. Allowed range is from 1 to 8.
  4812. @item detection
  4813. Choose if exact signal should be taken for detection or an RMS like one.
  4814. Default is rms. Can be peak or rms.
  4815. @item link
  4816. Choose if the average level between all channels or the louder channel affects
  4817. the reduction.
  4818. Default is average. Can be average or maximum.
  4819. @item level_sc
  4820. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  4821. @end table
  4822. @subsection Commands
  4823. This filter supports the all above options as @ref{commands}.
  4824. @section silencedetect
  4825. Detect silence in an audio stream.
  4826. This filter logs a message when it detects that the input audio volume is less
  4827. or equal to a noise tolerance value for a duration greater or equal to the
  4828. minimum detected noise duration.
  4829. The printed times and duration are expressed in seconds. The
  4830. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  4831. is set on the first frame whose timestamp equals or exceeds the detection
  4832. duration and it contains the timestamp of the first frame of the silence.
  4833. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  4834. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  4835. keys are set on the first frame after the silence. If @option{mono} is
  4836. enabled, and each channel is evaluated separately, the @code{.X}
  4837. suffixed keys are used, and @code{X} corresponds to the channel number.
  4838. The filter accepts the following options:
  4839. @table @option
  4840. @item noise, n
  4841. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  4842. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  4843. @item duration, d
  4844. Set silence duration until notification (default is 2 seconds). See
  4845. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4846. for the accepted syntax.
  4847. @item mono, m
  4848. Process each channel separately, instead of combined. By default is disabled.
  4849. @end table
  4850. @subsection Examples
  4851. @itemize
  4852. @item
  4853. Detect 5 seconds of silence with -50dB noise tolerance:
  4854. @example
  4855. silencedetect=n=-50dB:d=5
  4856. @end example
  4857. @item
  4858. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  4859. tolerance in @file{silence.mp3}:
  4860. @example
  4861. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  4862. @end example
  4863. @end itemize
  4864. @section silenceremove
  4865. Remove silence from the beginning, middle or end of the audio.
  4866. The filter accepts the following options:
  4867. @table @option
  4868. @item start_periods
  4869. This value is used to indicate if audio should be trimmed at beginning of
  4870. the audio. A value of zero indicates no silence should be trimmed from the
  4871. beginning. When specifying a non-zero value, it trims audio up until it
  4872. finds non-silence. Normally, when trimming silence from beginning of audio
  4873. the @var{start_periods} will be @code{1} but it can be increased to higher
  4874. values to trim all audio up to specific count of non-silence periods.
  4875. Default value is @code{0}.
  4876. @item start_duration
  4877. Specify the amount of time that non-silence must be detected before it stops
  4878. trimming audio. By increasing the duration, bursts of noises can be treated
  4879. as silence and trimmed off. Default value is @code{0}.
  4880. @item start_threshold
  4881. This indicates what sample value should be treated as silence. For digital
  4882. audio, a value of @code{0} may be fine but for audio recorded from analog,
  4883. you may wish to increase the value to account for background noise.
  4884. Can be specified in dB (in case "dB" is appended to the specified value)
  4885. or amplitude ratio. Default value is @code{0}.
  4886. @item start_silence
  4887. Specify max duration of silence at beginning that will be kept after
  4888. trimming. Default is 0, which is equal to trimming all samples detected
  4889. as silence.
  4890. @item start_mode
  4891. Specify mode of detection of silence end in start of multi-channel audio.
  4892. Can be @var{any} or @var{all}. Default is @var{any}.
  4893. With @var{any}, any sample that is detected as non-silence will cause
  4894. stopped trimming of silence.
  4895. With @var{all}, only if all channels are detected as non-silence will cause
  4896. stopped trimming of silence.
  4897. @item stop_periods
  4898. Set the count for trimming silence from the end of audio.
  4899. To remove silence from the middle of a file, specify a @var{stop_periods}
  4900. that is negative. This value is then treated as a positive value and is
  4901. used to indicate the effect should restart processing as specified by
  4902. @var{start_periods}, making it suitable for removing periods of silence
  4903. in the middle of the audio.
  4904. Default value is @code{0}.
  4905. @item stop_duration
  4906. Specify a duration of silence that must exist before audio is not copied any
  4907. more. By specifying a higher duration, silence that is wanted can be left in
  4908. the audio.
  4909. Default value is @code{0}.
  4910. @item stop_threshold
  4911. This is the same as @option{start_threshold} but for trimming silence from
  4912. the end of audio.
  4913. Can be specified in dB (in case "dB" is appended to the specified value)
  4914. or amplitude ratio. Default value is @code{0}.
  4915. @item stop_silence
  4916. Specify max duration of silence at end that will be kept after
  4917. trimming. Default is 0, which is equal to trimming all samples detected
  4918. as silence.
  4919. @item stop_mode
  4920. Specify mode of detection of silence start in end of multi-channel audio.
  4921. Can be @var{any} or @var{all}. Default is @var{any}.
  4922. With @var{any}, any sample that is detected as non-silence will cause
  4923. stopped trimming of silence.
  4924. With @var{all}, only if all channels are detected as non-silence will cause
  4925. stopped trimming of silence.
  4926. @item detection
  4927. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  4928. and works better with digital silence which is exactly 0.
  4929. Default value is @code{rms}.
  4930. @item window
  4931. Set duration in number of seconds used to calculate size of window in number
  4932. of samples for detecting silence.
  4933. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  4934. @end table
  4935. @subsection Examples
  4936. @itemize
  4937. @item
  4938. The following example shows how this filter can be used to start a recording
  4939. that does not contain the delay at the start which usually occurs between
  4940. pressing the record button and the start of the performance:
  4941. @example
  4942. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  4943. @end example
  4944. @item
  4945. Trim all silence encountered from beginning to end where there is more than 1
  4946. second of silence in audio:
  4947. @example
  4948. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  4949. @end example
  4950. @item
  4951. Trim all digital silence samples, using peak detection, from beginning to end
  4952. where there is more than 0 samples of digital silence in audio and digital
  4953. silence is detected in all channels at same positions in stream:
  4954. @example
  4955. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  4956. @end example
  4957. @end itemize
  4958. @section sofalizer
  4959. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  4960. loudspeakers around the user for binaural listening via headphones (audio
  4961. formats up to 9 channels supported).
  4962. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  4963. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  4964. Austrian Academy of Sciences.
  4965. To enable compilation of this filter you need to configure FFmpeg with
  4966. @code{--enable-libmysofa}.
  4967. The filter accepts the following options:
  4968. @table @option
  4969. @item sofa
  4970. Set the SOFA file used for rendering.
  4971. @item gain
  4972. Set gain applied to audio. Value is in dB. Default is 0.
  4973. @item rotation
  4974. Set rotation of virtual loudspeakers in deg. Default is 0.
  4975. @item elevation
  4976. Set elevation of virtual speakers in deg. Default is 0.
  4977. @item radius
  4978. Set distance in meters between loudspeakers and the listener with near-field
  4979. HRTFs. Default is 1.
  4980. @item type
  4981. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  4982. processing audio in time domain which is slow.
  4983. @var{freq} is processing audio in frequency domain which is fast.
  4984. Default is @var{freq}.
  4985. @item speakers
  4986. Set custom positions of virtual loudspeakers. Syntax for this option is:
  4987. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  4988. Each virtual loudspeaker is described with short channel name following with
  4989. azimuth and elevation in degrees.
  4990. Each virtual loudspeaker description is separated by '|'.
  4991. For example to override front left and front right channel positions use:
  4992. 'speakers=FL 45 15|FR 345 15'.
  4993. Descriptions with unrecognised channel names are ignored.
  4994. @item lfegain
  4995. Set custom gain for LFE channels. Value is in dB. Default is 0.
  4996. @item framesize
  4997. Set custom frame size in number of samples. Default is 1024.
  4998. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  4999. is set to @var{freq}.
  5000. @item normalize
  5001. Should all IRs be normalized upon importing SOFA file.
  5002. By default is enabled.
  5003. @item interpolate
  5004. Should nearest IRs be interpolated with neighbor IRs if exact position
  5005. does not match. By default is disabled.
  5006. @item minphase
  5007. Minphase all IRs upon loading of SOFA file. By default is disabled.
  5008. @item anglestep
  5009. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  5010. @item radstep
  5011. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  5012. @end table
  5013. @subsection Examples
  5014. @itemize
  5015. @item
  5016. Using ClubFritz6 sofa file:
  5017. @example
  5018. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  5019. @end example
  5020. @item
  5021. Using ClubFritz12 sofa file and bigger radius with small rotation:
  5022. @example
  5023. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  5024. @end example
  5025. @item
  5026. Similar as above but with custom speaker positions for front left, front right, back left and back right
  5027. and also with custom gain:
  5028. @example
  5029. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  5030. @end example
  5031. @end itemize
  5032. @section speechnorm
  5033. Speech Normalizer.
  5034. This filter expands or compresses each half-cycle of audio samples
  5035. (local set of samples all above or all below zero and between two nearest zero crossings) depending
  5036. on threshold value, so audio reaches target peak value under conditions controlled by below options.
  5037. The filter accepts the following options:
  5038. @table @option
  5039. @item peak, p
  5040. Set the expansion target peak value. This specifies the highest allowed absolute amplitude
  5041. level for the normalized audio input. Default value is 0.95. Allowed range is from 0.0 to 1.0.
  5042. @item expansion, e
  5043. Set the maximum expansion factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  5044. This option controls maximum local half-cycle of samples expansion. The maximum expansion
  5045. would be such that local peak value reaches target peak value but never to surpass it and that
  5046. ratio between new and previous peak value does not surpass this option value.
  5047. @item compression, c
  5048. Set the maximum compression factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  5049. This option controls maximum local half-cycle of samples compression. This option is used
  5050. only if @option{threshold} option is set to value greater than 0.0, then in such cases
  5051. when local peak is lower or same as value set by @option{threshold} all samples belonging to
  5052. that peak's half-cycle will be compressed by current compression factor.
  5053. @item threshold, t
  5054. Set the threshold value. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  5055. This option specifies which half-cycles of samples will be compressed and which will be expanded.
  5056. Any half-cycle samples with their local peak value below or same as this option value will be
  5057. compressed by current compression factor, otherwise, if greater than threshold value they will be
  5058. expanded with expansion factor so that it could reach peak target value but never surpass it.
  5059. @item raise, r
  5060. Set the expansion raising amount per each half-cycle of samples. Default value is 0.001.
  5061. Allowed range is from 0.0 to 1.0. This controls how fast expansion factor is raised per
  5062. each new half-cycle until it reaches @option{expansion} value.
  5063. Setting this options too high may lead to distortions.
  5064. @item fall, f
  5065. Set the compression raising amount per each half-cycle of samples. Default value is 0.001.
  5066. Allowed range is from 0.0 to 1.0. This controls how fast compression factor is raised per
  5067. each new half-cycle until it reaches @option{compression} value.
  5068. @item channels, h
  5069. Specify which channels to filter, by default all available channels are filtered.
  5070. @item invert, i
  5071. Enable inverted filtering, by default is disabled. This inverts interpretation of @option{threshold}
  5072. option. When enabled any half-cycle of samples with their local peak value below or same as
  5073. @option{threshold} option will be expanded otherwise it will be compressed.
  5074. @item link, l
  5075. Link channels when calculating gain applied to each filtered channel sample, by default is disabled.
  5076. When disabled each filtered channel gain calculation is independent, otherwise when this option
  5077. is enabled the minimum of all possible gains for each filtered channel is used.
  5078. @item rms, m
  5079. Set the expansion target RMS value. This specifies the highest allowed RMS level for the normalized
  5080. audio input. Default value is 0.0, thus disabled. Allowed range is from 0.0 to 1.0.
  5081. @end table
  5082. @subsection Commands
  5083. This filter supports the all above options as @ref{commands}.
  5084. @subsection Examples
  5085. @itemize
  5086. @item
  5087. Weak and slow amplification:
  5088. @example
  5089. speechnorm=e=3:r=0.00001:l=1
  5090. @end example
  5091. @item
  5092. Moderate and slow amplification:
  5093. @example
  5094. speechnorm=e=6.25:r=0.00001:l=1
  5095. @end example
  5096. @item
  5097. Strong and fast amplification:
  5098. @example
  5099. speechnorm=e=12.5:r=0.0001:l=1
  5100. @end example
  5101. @item
  5102. Very strong and fast amplification:
  5103. @example
  5104. speechnorm=e=25:r=0.0001:l=1
  5105. @end example
  5106. @item
  5107. Extreme and fast amplification:
  5108. @example
  5109. speechnorm=e=50:r=0.0001:l=1
  5110. @end example
  5111. @end itemize
  5112. @section stereotools
  5113. This filter has some handy utilities to manage stereo signals, for converting
  5114. M/S stereo recordings to L/R signal while having control over the parameters
  5115. or spreading the stereo image of master track.
  5116. The filter accepts the following options:
  5117. @table @option
  5118. @item level_in
  5119. Set input level before filtering for both channels. Defaults is 1.
  5120. Allowed range is from 0.015625 to 64.
  5121. @item level_out
  5122. Set output level after filtering for both channels. Defaults is 1.
  5123. Allowed range is from 0.015625 to 64.
  5124. @item balance_in
  5125. Set input balance between both channels. Default is 0.
  5126. Allowed range is from -1 to 1.
  5127. @item balance_out
  5128. Set output balance between both channels. Default is 0.
  5129. Allowed range is from -1 to 1.
  5130. @item softclip
  5131. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  5132. clipping. Disabled by default.
  5133. @item mutel
  5134. Mute the left channel. Disabled by default.
  5135. @item muter
  5136. Mute the right channel. Disabled by default.
  5137. @item phasel
  5138. Change the phase of the left channel. Disabled by default.
  5139. @item phaser
  5140. Change the phase of the right channel. Disabled by default.
  5141. @item mode
  5142. Set stereo mode. Available values are:
  5143. @table @samp
  5144. @item lr>lr
  5145. Left/Right to Left/Right, this is default.
  5146. @item lr>ms
  5147. Left/Right to Mid/Side.
  5148. @item ms>lr
  5149. Mid/Side to Left/Right.
  5150. @item lr>ll
  5151. Left/Right to Left/Left.
  5152. @item lr>rr
  5153. Left/Right to Right/Right.
  5154. @item lr>l+r
  5155. Left/Right to Left + Right.
  5156. @item lr>rl
  5157. Left/Right to Right/Left.
  5158. @item ms>ll
  5159. Mid/Side to Left/Left.
  5160. @item ms>rr
  5161. Mid/Side to Right/Right.
  5162. @item ms>rl
  5163. Mid/Side to Right/Left.
  5164. @item lr>l-r
  5165. Left/Right to Left - Right.
  5166. @end table
  5167. @item slev
  5168. Set level of side signal. Default is 1.
  5169. Allowed range is from 0.015625 to 64.
  5170. @item sbal
  5171. Set balance of side signal. Default is 0.
  5172. Allowed range is from -1 to 1.
  5173. @item mlev
  5174. Set level of the middle signal. Default is 1.
  5175. Allowed range is from 0.015625 to 64.
  5176. @item mpan
  5177. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  5178. @item base
  5179. Set stereo base between mono and inversed channels. Default is 0.
  5180. Allowed range is from -1 to 1.
  5181. @item delay
  5182. Set delay in milliseconds how much to delay left from right channel and
  5183. vice versa. Default is 0. Allowed range is from -20 to 20.
  5184. @item sclevel
  5185. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  5186. @item phase
  5187. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  5188. @item bmode_in, bmode_out
  5189. Set balance mode for balance_in/balance_out option.
  5190. Can be one of the following:
  5191. @table @samp
  5192. @item balance
  5193. Classic balance mode. Attenuate one channel at time.
  5194. Gain is raised up to 1.
  5195. @item amplitude
  5196. Similar as classic mode above but gain is raised up to 2.
  5197. @item power
  5198. Equal power distribution, from -6dB to +6dB range.
  5199. @end table
  5200. @end table
  5201. @subsection Commands
  5202. This filter supports the all above options as @ref{commands}.
  5203. @subsection Examples
  5204. @itemize
  5205. @item
  5206. Apply karaoke like effect:
  5207. @example
  5208. stereotools=mlev=0.015625
  5209. @end example
  5210. @item
  5211. Convert M/S signal to L/R:
  5212. @example
  5213. "stereotools=mode=ms>lr"
  5214. @end example
  5215. @end itemize
  5216. @section stereowiden
  5217. This filter enhance the stereo effect by suppressing signal common to both
  5218. channels and by delaying the signal of left into right and vice versa,
  5219. thereby widening the stereo effect.
  5220. The filter accepts the following options:
  5221. @table @option
  5222. @item delay
  5223. Time in milliseconds of the delay of left signal into right and vice versa.
  5224. Default is 20 milliseconds.
  5225. @item feedback
  5226. Amount of gain in delayed signal into right and vice versa. Gives a delay
  5227. effect of left signal in right output and vice versa which gives widening
  5228. effect. Default is 0.3.
  5229. @item crossfeed
  5230. Cross feed of left into right with inverted phase. This helps in suppressing
  5231. the mono. If the value is 1 it will cancel all the signal common to both
  5232. channels. Default is 0.3.
  5233. @item drymix
  5234. Set level of input signal of original channel. Default is 0.8.
  5235. @end table
  5236. @subsection Commands
  5237. This filter supports the all above options except @code{delay} as @ref{commands}.
  5238. @section superequalizer
  5239. Apply 18 band equalizer.
  5240. The filter accepts the following options:
  5241. @table @option
  5242. @item 1b
  5243. Set 65Hz band gain.
  5244. @item 2b
  5245. Set 92Hz band gain.
  5246. @item 3b
  5247. Set 131Hz band gain.
  5248. @item 4b
  5249. Set 185Hz band gain.
  5250. @item 5b
  5251. Set 262Hz band gain.
  5252. @item 6b
  5253. Set 370Hz band gain.
  5254. @item 7b
  5255. Set 523Hz band gain.
  5256. @item 8b
  5257. Set 740Hz band gain.
  5258. @item 9b
  5259. Set 1047Hz band gain.
  5260. @item 10b
  5261. Set 1480Hz band gain.
  5262. @item 11b
  5263. Set 2093Hz band gain.
  5264. @item 12b
  5265. Set 2960Hz band gain.
  5266. @item 13b
  5267. Set 4186Hz band gain.
  5268. @item 14b
  5269. Set 5920Hz band gain.
  5270. @item 15b
  5271. Set 8372Hz band gain.
  5272. @item 16b
  5273. Set 11840Hz band gain.
  5274. @item 17b
  5275. Set 16744Hz band gain.
  5276. @item 18b
  5277. Set 20000Hz band gain.
  5278. @end table
  5279. @section surround
  5280. Apply audio surround upmix filter.
  5281. This filter allows to produce multichannel output from audio stream.
  5282. The filter accepts the following options:
  5283. @table @option
  5284. @item chl_out
  5285. Set output channel layout. By default, this is @var{5.1}.
  5286. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5287. for the required syntax.
  5288. @item chl_in
  5289. Set input channel layout. By default, this is @var{stereo}.
  5290. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5291. for the required syntax.
  5292. @item level_in
  5293. Set input volume level. By default, this is @var{1}.
  5294. @item level_out
  5295. Set output volume level. By default, this is @var{1}.
  5296. @item lfe
  5297. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  5298. @item lfe_low
  5299. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  5300. @item lfe_high
  5301. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  5302. @item lfe_mode
  5303. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  5304. In @var{add} mode, LFE channel is created from input audio and added to output.
  5305. In @var{sub} mode, LFE channel is created from input audio and added to output but
  5306. also all non-LFE output channels are subtracted with output LFE channel.
  5307. @item smooth
  5308. Set temporal smoothness strength, used to gradually change factors when transforming
  5309. stereo sound in time. Allowed range is from @var{0.0} to @var{1.0}.
  5310. Useful to improve output quality with @var{focus} option values greater than @var{0.0}.
  5311. Default is @var{0.0}. Only values inside this range and without edges are effective.
  5312. @item angle
  5313. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  5314. Default is @var{90}.
  5315. @item focus
  5316. Set focus of stereo surround transform, Allowed range is from @var{-1} to @var{1}.
  5317. Default is @var{0}.
  5318. @item fc_in
  5319. Set front center input volume. By default, this is @var{1}.
  5320. @item fc_out
  5321. Set front center output volume. By default, this is @var{1}.
  5322. @item fl_in
  5323. Set front left input volume. By default, this is @var{1}.
  5324. @item fl_out
  5325. Set front left output volume. By default, this is @var{1}.
  5326. @item fr_in
  5327. Set front right input volume. By default, this is @var{1}.
  5328. @item fr_out
  5329. Set front right output volume. By default, this is @var{1}.
  5330. @item sl_in
  5331. Set side left input volume. By default, this is @var{1}.
  5332. @item sl_out
  5333. Set side left output volume. By default, this is @var{1}.
  5334. @item sr_in
  5335. Set side right input volume. By default, this is @var{1}.
  5336. @item sr_out
  5337. Set side right output volume. By default, this is @var{1}.
  5338. @item bl_in
  5339. Set back left input volume. By default, this is @var{1}.
  5340. @item bl_out
  5341. Set back left output volume. By default, this is @var{1}.
  5342. @item br_in
  5343. Set back right input volume. By default, this is @var{1}.
  5344. @item br_out
  5345. Set back right output volume. By default, this is @var{1}.
  5346. @item bc_in
  5347. Set back center input volume. By default, this is @var{1}.
  5348. @item bc_out
  5349. Set back center output volume. By default, this is @var{1}.
  5350. @item lfe_in
  5351. Set LFE input volume. By default, this is @var{1}.
  5352. @item lfe_out
  5353. Set LFE output volume. By default, this is @var{1}.
  5354. @item allx
  5355. Set spread usage of stereo image across X axis for all channels.
  5356. Allowed range is from @var{-1} to @var{15}.
  5357. By default this value is negative @var{-1}, and thus unused.
  5358. @item ally
  5359. Set spread usage of stereo image across Y axis for all channels.
  5360. Allowed range is from @var{-1} to @var{15}.
  5361. By default this value is negative @var{-1}, and thus unused.
  5362. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  5363. Set spread usage of stereo image across X axis for each channel.
  5364. Allowed range is from @var{0.06} to @var{15}.
  5365. By default this value is @var{0.5}.
  5366. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  5367. Set spread usage of stereo image across Y axis for each channel.
  5368. Allowed range is from @var{0.06} to @var{15}.
  5369. By default this value is @var{0.5}.
  5370. @item win_size
  5371. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  5372. @item win_func
  5373. Set window function.
  5374. It accepts the following values:
  5375. @table @samp
  5376. @item rect
  5377. @item bartlett
  5378. @item hann, hanning
  5379. @item hamming
  5380. @item blackman
  5381. @item welch
  5382. @item flattop
  5383. @item bharris
  5384. @item bnuttall
  5385. @item bhann
  5386. @item sine
  5387. @item nuttall
  5388. @item lanczos
  5389. @item gauss
  5390. @item tukey
  5391. @item dolph
  5392. @item cauchy
  5393. @item parzen
  5394. @item poisson
  5395. @item bohman
  5396. @item kaiser
  5397. @end table
  5398. Default is @code{hann}.
  5399. @item overlap
  5400. Set window overlap. If set to 1, the recommended overlap for selected
  5401. window function will be picked. Default is @code{0.5}.
  5402. @end table
  5403. @section tiltshelf
  5404. Boost or cut the lower frequencies and cut or boost higher frequencies
  5405. of the audio using a two-pole shelving filter with a response similar to
  5406. that of a standard hi-fi's tone-controls.
  5407. This is also known as shelving equalisation (EQ).
  5408. The filter accepts the following options:
  5409. @table @option
  5410. @item gain, g
  5411. Give the gain at 0 Hz. Its useful range is about -20
  5412. (for a large cut) to +20 (for a large boost).
  5413. Beware of clipping when using a positive gain.
  5414. @item frequency, f
  5415. Set the filter's central frequency and so can be used
  5416. to extend or reduce the frequency range to be boosted or cut.
  5417. The default value is @code{3000} Hz.
  5418. @item width_type, t
  5419. Set method to specify band-width of filter.
  5420. @table @option
  5421. @item h
  5422. Hz
  5423. @item q
  5424. Q-Factor
  5425. @item o
  5426. octave
  5427. @item s
  5428. slope
  5429. @item k
  5430. kHz
  5431. @end table
  5432. @item width, w
  5433. Determine how steep is the filter's shelf transition.
  5434. @item poles, p
  5435. Set number of poles. Default is 2.
  5436. @item mix, m
  5437. How much to use filtered signal in output. Default is 1.
  5438. Range is between 0 and 1.
  5439. @item channels, c
  5440. Specify which channels to filter, by default all available are filtered.
  5441. @item normalize, n
  5442. Normalize biquad coefficients, by default is disabled.
  5443. Enabling it will normalize magnitude response at DC to 0dB.
  5444. @item transform, a
  5445. Set transform type of IIR filter.
  5446. @table @option
  5447. @item di
  5448. @item dii
  5449. @item tdi
  5450. @item tdii
  5451. @item latt
  5452. @item svf
  5453. @item zdf
  5454. @end table
  5455. @item precision, r
  5456. Set precison of filtering.
  5457. @table @option
  5458. @item auto
  5459. Pick automatic sample format depending on surround filters.
  5460. @item s16
  5461. Always use signed 16-bit.
  5462. @item s32
  5463. Always use signed 32-bit.
  5464. @item f32
  5465. Always use float 32-bit.
  5466. @item f64
  5467. Always use float 64-bit.
  5468. @end table
  5469. @item block_size, b
  5470. Set block size used for reverse IIR processing. If this value is set to high enough
  5471. value (higher than impulse response length truncated when reaches near zero values) filtering
  5472. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  5473. Note that filter delay will be exactly this many samples when set to non-zero value.
  5474. @end table
  5475. @subsection Commands
  5476. This filter supports some options as @ref{commands}.
  5477. @section treble, highshelf
  5478. Boost or cut treble (upper) frequencies of the audio using a two-pole
  5479. shelving filter with a response similar to that of a standard
  5480. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  5481. The filter accepts the following options:
  5482. @table @option
  5483. @item gain, g
  5484. Give the gain at whichever is the lower of ~22 kHz and the
  5485. Nyquist frequency. Its useful range is about -20 (for a large cut)
  5486. to +20 (for a large boost). Beware of clipping when using a positive gain.
  5487. @item frequency, f
  5488. Set the filter's central frequency and so can be used
  5489. to extend or reduce the frequency range to be boosted or cut.
  5490. The default value is @code{3000} Hz.
  5491. @item width_type, t
  5492. Set method to specify band-width of filter.
  5493. @table @option
  5494. @item h
  5495. Hz
  5496. @item q
  5497. Q-Factor
  5498. @item o
  5499. octave
  5500. @item s
  5501. slope
  5502. @item k
  5503. kHz
  5504. @end table
  5505. @item width, w
  5506. Determine how steep is the filter's shelf transition.
  5507. @item poles, p
  5508. Set number of poles. Default is 2.
  5509. @item mix, m
  5510. How much to use filtered signal in output. Default is 1.
  5511. Range is between 0 and 1.
  5512. @item channels, c
  5513. Specify which channels to filter, by default all available are filtered.
  5514. @item normalize, n
  5515. Normalize biquad coefficients, by default is disabled.
  5516. Enabling it will normalize magnitude response at DC to 0dB.
  5517. @item transform, a
  5518. Set transform type of IIR filter.
  5519. @table @option
  5520. @item di
  5521. @item dii
  5522. @item tdi
  5523. @item tdii
  5524. @item latt
  5525. @item svf
  5526. @item zdf
  5527. @end table
  5528. @item precision, r
  5529. Set precison of filtering.
  5530. @table @option
  5531. @item auto
  5532. Pick automatic sample format depending on surround filters.
  5533. @item s16
  5534. Always use signed 16-bit.
  5535. @item s32
  5536. Always use signed 32-bit.
  5537. @item f32
  5538. Always use float 32-bit.
  5539. @item f64
  5540. Always use float 64-bit.
  5541. @end table
  5542. @item block_size, b
  5543. Set block size used for reverse IIR processing. If this value is set to high enough
  5544. value (higher than impulse response length truncated when reaches near zero values) filtering
  5545. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  5546. Note that filter delay will be exactly this many samples when set to non-zero value.
  5547. @end table
  5548. @subsection Commands
  5549. This filter supports the following commands:
  5550. @table @option
  5551. @item frequency, f
  5552. Change treble frequency.
  5553. Syntax for the command is : "@var{frequency}"
  5554. @item width_type, t
  5555. Change treble width_type.
  5556. Syntax for the command is : "@var{width_type}"
  5557. @item width, w
  5558. Change treble width.
  5559. Syntax for the command is : "@var{width}"
  5560. @item gain, g
  5561. Change treble gain.
  5562. Syntax for the command is : "@var{gain}"
  5563. @item mix, m
  5564. Change treble mix.
  5565. Syntax for the command is : "@var{mix}"
  5566. @end table
  5567. @section tremolo
  5568. Sinusoidal amplitude modulation.
  5569. The filter accepts the following options:
  5570. @table @option
  5571. @item f
  5572. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  5573. (20 Hz or lower) will result in a tremolo effect.
  5574. This filter may also be used as a ring modulator by specifying
  5575. a modulation frequency higher than 20 Hz.
  5576. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  5577. @item d
  5578. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  5579. Default value is 0.5.
  5580. @end table
  5581. @section vibrato
  5582. Sinusoidal phase modulation.
  5583. The filter accepts the following options:
  5584. @table @option
  5585. @item f
  5586. Modulation frequency in Hertz.
  5587. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  5588. @item d
  5589. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  5590. Default value is 0.5.
  5591. @end table
  5592. @section virtualbass
  5593. Apply audio Virtual Bass filter.
  5594. This filter accepts stereo input and produce stereo with LFE (2.1) channels output.
  5595. The newly produced LFE channel have enhanced virtual bass originally obtained from both stereo channels.
  5596. This filter outputs front left and front right channels unchanged as available in stereo input.
  5597. The filter accepts the following options:
  5598. @table @option
  5599. @item cutoff
  5600. Set the virtual bass cutoff frequency. Default value is 250 Hz.
  5601. Allowed range is from 100 to 500 Hz.
  5602. @item strength
  5603. Set the virtual bass strength. Allowed range is from 0.5 to 3.
  5604. Default value is 3.
  5605. @end table
  5606. @section volume
  5607. Adjust the input audio volume.
  5608. It accepts the following parameters:
  5609. @table @option
  5610. @item volume
  5611. Set audio volume expression.
  5612. Output values are clipped to the maximum value.
  5613. The output audio volume is given by the relation:
  5614. @example
  5615. @var{output_volume} = @var{volume} * @var{input_volume}
  5616. @end example
  5617. The default value for @var{volume} is "1.0".
  5618. @item precision
  5619. This parameter represents the mathematical precision.
  5620. It determines which input sample formats will be allowed, which affects the
  5621. precision of the volume scaling.
  5622. @table @option
  5623. @item fixed
  5624. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  5625. @item float
  5626. 32-bit floating-point; this limits input sample format to FLT. (default)
  5627. @item double
  5628. 64-bit floating-point; this limits input sample format to DBL.
  5629. @end table
  5630. @item replaygain
  5631. Choose the behaviour on encountering ReplayGain side data in input frames.
  5632. @table @option
  5633. @item drop
  5634. Remove ReplayGain side data, ignoring its contents (the default).
  5635. @item ignore
  5636. Ignore ReplayGain side data, but leave it in the frame.
  5637. @item track
  5638. Prefer the track gain, if present.
  5639. @item album
  5640. Prefer the album gain, if present.
  5641. @end table
  5642. @item replaygain_preamp
  5643. Pre-amplification gain in dB to apply to the selected replaygain gain.
  5644. Default value for @var{replaygain_preamp} is 0.0.
  5645. @item replaygain_noclip
  5646. Prevent clipping by limiting the gain applied.
  5647. Default value for @var{replaygain_noclip} is 1.
  5648. @item eval
  5649. Set when the volume expression is evaluated.
  5650. It accepts the following values:
  5651. @table @samp
  5652. @item once
  5653. only evaluate expression once during the filter initialization, or
  5654. when the @samp{volume} command is sent
  5655. @item frame
  5656. evaluate expression for each incoming frame
  5657. @end table
  5658. Default value is @samp{once}.
  5659. @end table
  5660. The volume expression can contain the following parameters.
  5661. @table @option
  5662. @item n
  5663. frame number (starting at zero)
  5664. @item nb_channels
  5665. number of channels
  5666. @item nb_consumed_samples
  5667. number of samples consumed by the filter
  5668. @item nb_samples
  5669. number of samples in the current frame
  5670. @item pos
  5671. original frame position in the file
  5672. @item pts
  5673. frame PTS
  5674. @item sample_rate
  5675. sample rate
  5676. @item startpts
  5677. PTS at start of stream
  5678. @item startt
  5679. time at start of stream
  5680. @item t
  5681. frame time
  5682. @item tb
  5683. timestamp timebase
  5684. @item volume
  5685. last set volume value
  5686. @end table
  5687. Note that when @option{eval} is set to @samp{once} only the
  5688. @var{sample_rate} and @var{tb} variables are available, all other
  5689. variables will evaluate to NAN.
  5690. @subsection Commands
  5691. This filter supports the following commands:
  5692. @table @option
  5693. @item volume
  5694. Modify the volume expression.
  5695. The command accepts the same syntax of the corresponding option.
  5696. If the specified expression is not valid, it is kept at its current
  5697. value.
  5698. @end table
  5699. @subsection Examples
  5700. @itemize
  5701. @item
  5702. Halve the input audio volume:
  5703. @example
  5704. volume=volume=0.5
  5705. volume=volume=1/2
  5706. volume=volume=-6.0206dB
  5707. @end example
  5708. In all the above example the named key for @option{volume} can be
  5709. omitted, for example like in:
  5710. @example
  5711. volume=0.5
  5712. @end example
  5713. @item
  5714. Increase input audio power by 6 decibels using fixed-point precision:
  5715. @example
  5716. volume=volume=6dB:precision=fixed
  5717. @end example
  5718. @item
  5719. Fade volume after time 10 with an annihilation period of 5 seconds:
  5720. @example
  5721. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  5722. @end example
  5723. @end itemize
  5724. @section volumedetect
  5725. Detect the volume of the input video.
  5726. The filter has no parameters. It supports only 16-bit signed integer samples,
  5727. so the input will be converted when needed. Statistics about the volume will
  5728. be printed in the log when the input stream end is reached.
  5729. In particular it will show the mean volume (root mean square), maximum
  5730. volume (on a per-sample basis), and the beginning of a histogram of the
  5731. registered volume values (from the maximum value to a cumulated 1/1000 of
  5732. the samples).
  5733. All volumes are in decibels relative to the maximum PCM value.
  5734. @subsection Examples
  5735. Here is an excerpt of the output:
  5736. @example
  5737. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  5738. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  5739. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  5740. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  5741. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  5742. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  5743. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  5744. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  5745. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  5746. @end example
  5747. It means that:
  5748. @itemize
  5749. @item
  5750. The mean square energy is approximately -27 dB, or 10^-2.7.
  5751. @item
  5752. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  5753. @item
  5754. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  5755. @end itemize
  5756. In other words, raising the volume by +4 dB does not cause any clipping,
  5757. raising it by +5 dB causes clipping for 6 samples, etc.
  5758. @c man end AUDIO FILTERS
  5759. @chapter Audio Sources
  5760. @c man begin AUDIO SOURCES
  5761. Below is a description of the currently available audio sources.
  5762. @section abuffer
  5763. Buffer audio frames, and make them available to the filter chain.
  5764. This source is mainly intended for a programmatic use, in particular
  5765. through the interface defined in @file{libavfilter/buffersrc.h}.
  5766. It accepts the following parameters:
  5767. @table @option
  5768. @item time_base
  5769. The timebase which will be used for timestamps of submitted frames. It must be
  5770. either a floating-point number or in @var{numerator}/@var{denominator} form.
  5771. @item sample_rate
  5772. The sample rate of the incoming audio buffers.
  5773. @item sample_fmt
  5774. The sample format of the incoming audio buffers.
  5775. Either a sample format name or its corresponding integer representation from
  5776. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  5777. @item channel_layout
  5778. The channel layout of the incoming audio buffers.
  5779. Either a channel layout name from channel_layout_map in
  5780. @file{libavutil/channel_layout.c} or its corresponding integer representation
  5781. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  5782. @item channels
  5783. The number of channels of the incoming audio buffers.
  5784. If both @var{channels} and @var{channel_layout} are specified, then they
  5785. must be consistent.
  5786. @end table
  5787. @subsection Examples
  5788. @example
  5789. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  5790. @end example
  5791. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  5792. Since the sample format with name "s16p" corresponds to the number
  5793. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  5794. equivalent to:
  5795. @example
  5796. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  5797. @end example
  5798. @section aevalsrc
  5799. Generate an audio signal specified by an expression.
  5800. This source accepts in input one or more expressions (one for each
  5801. channel), which are evaluated and used to generate a corresponding
  5802. audio signal.
  5803. This source accepts the following options:
  5804. @table @option
  5805. @item exprs
  5806. Set the '|'-separated expressions list for each separate channel. In case the
  5807. @option{channel_layout} option is not specified, the selected channel layout
  5808. depends on the number of provided expressions. Otherwise the last
  5809. specified expression is applied to the remaining output channels.
  5810. @item channel_layout, c
  5811. Set the channel layout. The number of channels in the specified layout
  5812. must be equal to the number of specified expressions.
  5813. @item duration, d
  5814. Set the minimum duration of the sourced audio. See
  5815. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5816. for the accepted syntax.
  5817. Note that the resulting duration may be greater than the specified
  5818. duration, as the generated audio is always cut at the end of a
  5819. complete frame.
  5820. If not specified, or the expressed duration is negative, the audio is
  5821. supposed to be generated forever.
  5822. @item nb_samples, n
  5823. Set the number of samples per channel per each output frame,
  5824. default to 1024.
  5825. @item sample_rate, s
  5826. Specify the sample rate, default to 44100.
  5827. @end table
  5828. Each expression in @var{exprs} can contain the following constants:
  5829. @table @option
  5830. @item n
  5831. number of the evaluated sample, starting from 0
  5832. @item t
  5833. time of the evaluated sample expressed in seconds, starting from 0
  5834. @item s
  5835. sample rate
  5836. @end table
  5837. @subsection Examples
  5838. @itemize
  5839. @item
  5840. Generate silence:
  5841. @example
  5842. aevalsrc=0
  5843. @end example
  5844. @item
  5845. Generate a sin signal with frequency of 440 Hz, set sample rate to
  5846. 8000 Hz:
  5847. @example
  5848. aevalsrc="sin(440*2*PI*t):s=8000"
  5849. @end example
  5850. @item
  5851. Generate a two channels signal, specify the channel layout (Front
  5852. Center + Back Center) explicitly:
  5853. @example
  5854. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  5855. @end example
  5856. @item
  5857. Generate white noise:
  5858. @example
  5859. aevalsrc="-2+random(0)"
  5860. @end example
  5861. @item
  5862. Generate an amplitude modulated signal:
  5863. @example
  5864. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  5865. @end example
  5866. @item
  5867. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  5868. @example
  5869. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  5870. @end example
  5871. @end itemize
  5872. @section afdelaysrc
  5873. Generate a fractional delay FIR coefficients.
  5874. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  5875. The filter accepts the following options:
  5876. @table @option
  5877. @item delay, d
  5878. Set the fractional delay. Default is 0.
  5879. @item sample_rate, r
  5880. Set the sample rate, default is 44100.
  5881. @item nb_samples, n
  5882. Set the number of samples per each frame. Default is 1024.
  5883. @item taps, t
  5884. Set the number of filter coefficents in output audio stream.
  5885. Default value is 0.
  5886. @item channel_layout, c
  5887. Specifies the channel layout, and can be a string representing a channel layout.
  5888. The default value of @var{channel_layout} is "stereo".
  5889. @end table
  5890. @section afirsrc
  5891. Generate a FIR coefficients using frequency sampling method.
  5892. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  5893. The filter accepts the following options:
  5894. @table @option
  5895. @item taps, t
  5896. Set number of filter coefficents in output audio stream.
  5897. Default value is 1025.
  5898. @item frequency, f
  5899. Set frequency points from where magnitude and phase are set.
  5900. This must be in non decreasing order, and first element must be 0, while last element
  5901. must be 1. Elements are separated by white spaces.
  5902. @item magnitude, m
  5903. Set magnitude value for every frequency point set by @option{frequency}.
  5904. Number of values must be same as number of frequency points.
  5905. Values are separated by white spaces.
  5906. @item phase, p
  5907. Set phase value for every frequency point set by @option{frequency}.
  5908. Number of values must be same as number of frequency points.
  5909. Values are separated by white spaces.
  5910. @item sample_rate, r
  5911. Set sample rate, default is 44100.
  5912. @item nb_samples, n
  5913. Set number of samples per each frame. Default is 1024.
  5914. @item win_func, w
  5915. Set window function. Default is blackman.
  5916. @end table
  5917. @section anullsrc
  5918. The null audio source, return unprocessed audio frames. It is mainly useful
  5919. as a template and to be employed in analysis / debugging tools, or as
  5920. the source for filters which ignore the input data (for example the sox
  5921. synth filter).
  5922. This source accepts the following options:
  5923. @table @option
  5924. @item channel_layout, cl
  5925. Specifies the channel layout, and can be either an integer or a string
  5926. representing a channel layout. The default value of @var{channel_layout}
  5927. is "stereo".
  5928. Check the channel_layout_map definition in
  5929. @file{libavutil/channel_layout.c} for the mapping between strings and
  5930. channel layout values.
  5931. @item sample_rate, r
  5932. Specifies the sample rate, and defaults to 44100.
  5933. @item nb_samples, n
  5934. Set the number of samples per requested frames.
  5935. @item duration, d
  5936. Set the duration of the sourced audio. See
  5937. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5938. for the accepted syntax.
  5939. If not specified, or the expressed duration is negative, the audio is
  5940. supposed to be generated forever.
  5941. @end table
  5942. @subsection Examples
  5943. @itemize
  5944. @item
  5945. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  5946. @example
  5947. anullsrc=r=48000:cl=4
  5948. @end example
  5949. @item
  5950. Do the same operation with a more obvious syntax:
  5951. @example
  5952. anullsrc=r=48000:cl=mono
  5953. @end example
  5954. @end itemize
  5955. All the parameters need to be explicitly defined.
  5956. @section flite
  5957. Synthesize a voice utterance using the libflite library.
  5958. To enable compilation of this filter you need to configure FFmpeg with
  5959. @code{--enable-libflite}.
  5960. Note that versions of the flite library prior to 2.0 are not thread-safe.
  5961. The filter accepts the following options:
  5962. @table @option
  5963. @item list_voices
  5964. If set to 1, list the names of the available voices and exit
  5965. immediately. Default value is 0.
  5966. @item nb_samples, n
  5967. Set the maximum number of samples per frame. Default value is 512.
  5968. @item textfile
  5969. Set the filename containing the text to speak.
  5970. @item text
  5971. Set the text to speak.
  5972. @item voice, v
  5973. Set the voice to use for the speech synthesis. Default value is
  5974. @code{kal}. See also the @var{list_voices} option.
  5975. @end table
  5976. @subsection Examples
  5977. @itemize
  5978. @item
  5979. Read from file @file{speech.txt}, and synthesize the text using the
  5980. standard flite voice:
  5981. @example
  5982. flite=textfile=speech.txt
  5983. @end example
  5984. @item
  5985. Read the specified text selecting the @code{slt} voice:
  5986. @example
  5987. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  5988. @end example
  5989. @item
  5990. Input text to ffmpeg:
  5991. @example
  5992. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  5993. @end example
  5994. @item
  5995. Make @file{ffplay} speak the specified text, using @code{flite} and
  5996. the @code{lavfi} device:
  5997. @example
  5998. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  5999. @end example
  6000. @end itemize
  6001. For more information about libflite, check:
  6002. @url{http://www.festvox.org/flite/}
  6003. @section anoisesrc
  6004. Generate a noise audio signal.
  6005. The filter accepts the following options:
  6006. @table @option
  6007. @item sample_rate, r
  6008. Specify the sample rate. Default value is 48000 Hz.
  6009. @item amplitude, a
  6010. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  6011. is 1.0.
  6012. @item duration, d
  6013. Specify the duration of the generated audio stream. Not specifying this option
  6014. results in noise with an infinite length.
  6015. @item color, colour, c
  6016. Specify the color of noise. Available noise colors are white, pink, brown,
  6017. blue, violet and velvet. Default color is white.
  6018. @item seed, s
  6019. Specify a value used to seed the PRNG.
  6020. @item nb_samples, n
  6021. Set the number of samples per each output frame, default is 1024.
  6022. @end table
  6023. @subsection Examples
  6024. @itemize
  6025. @item
  6026. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  6027. @example
  6028. anoisesrc=d=60:c=pink:r=44100:a=0.5
  6029. @end example
  6030. @end itemize
  6031. @section hilbert
  6032. Generate odd-tap Hilbert transform FIR coefficients.
  6033. The resulting stream can be used with @ref{afir} filter for phase-shifting
  6034. the signal by 90 degrees.
  6035. This is used in many matrix coding schemes and for analytic signal generation.
  6036. The process is often written as a multiplication by i (or j), the imaginary unit.
  6037. The filter accepts the following options:
  6038. @table @option
  6039. @item sample_rate, s
  6040. Set sample rate, default is 44100.
  6041. @item taps, t
  6042. Set length of FIR filter, default is 22051.
  6043. @item nb_samples, n
  6044. Set number of samples per each frame.
  6045. @item win_func, w
  6046. Set window function to be used when generating FIR coefficients.
  6047. @end table
  6048. @section sinc
  6049. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  6050. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  6051. The filter accepts the following options:
  6052. @table @option
  6053. @item sample_rate, r
  6054. Set sample rate, default is 44100.
  6055. @item nb_samples, n
  6056. Set number of samples per each frame. Default is 1024.
  6057. @item hp
  6058. Set high-pass frequency. Default is 0.
  6059. @item lp
  6060. Set low-pass frequency. Default is 0.
  6061. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  6062. is higher than 0 then filter will create band-pass filter coefficients,
  6063. otherwise band-reject filter coefficients.
  6064. @item phase
  6065. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  6066. @item beta
  6067. Set Kaiser window beta.
  6068. @item att
  6069. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  6070. @item round
  6071. Enable rounding, by default is disabled.
  6072. @item hptaps
  6073. Set number of taps for high-pass filter.
  6074. @item lptaps
  6075. Set number of taps for low-pass filter.
  6076. @end table
  6077. @section sine
  6078. Generate an audio signal made of a sine wave with amplitude 1/8.
  6079. The audio signal is bit-exact.
  6080. The filter accepts the following options:
  6081. @table @option
  6082. @item frequency, f
  6083. Set the carrier frequency. Default is 440 Hz.
  6084. @item beep_factor, b
  6085. Enable a periodic beep every second with frequency @var{beep_factor} times
  6086. the carrier frequency. Default is 0, meaning the beep is disabled.
  6087. @item sample_rate, r
  6088. Specify the sample rate, default is 44100.
  6089. @item duration, d
  6090. Specify the duration of the generated audio stream.
  6091. @item samples_per_frame
  6092. Set the number of samples per output frame.
  6093. The expression can contain the following constants:
  6094. @table @option
  6095. @item n
  6096. The (sequential) number of the output audio frame, starting from 0.
  6097. @item pts
  6098. The PTS (Presentation TimeStamp) of the output audio frame,
  6099. expressed in @var{TB} units.
  6100. @item t
  6101. The PTS of the output audio frame, expressed in seconds.
  6102. @item TB
  6103. The timebase of the output audio frames.
  6104. @end table
  6105. Default is @code{1024}.
  6106. @end table
  6107. @subsection Examples
  6108. @itemize
  6109. @item
  6110. Generate a simple 440 Hz sine wave:
  6111. @example
  6112. sine
  6113. @end example
  6114. @item
  6115. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  6116. @example
  6117. sine=220:4:d=5
  6118. sine=f=220:b=4:d=5
  6119. sine=frequency=220:beep_factor=4:duration=5
  6120. @end example
  6121. @item
  6122. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  6123. pattern:
  6124. @example
  6125. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  6126. @end example
  6127. @end itemize
  6128. @c man end AUDIO SOURCES
  6129. @chapter Audio Sinks
  6130. @c man begin AUDIO SINKS
  6131. Below is a description of the currently available audio sinks.
  6132. @section abuffersink
  6133. Buffer audio frames, and make them available to the end of filter chain.
  6134. This sink is mainly intended for programmatic use, in particular
  6135. through the interface defined in @file{libavfilter/buffersink.h}
  6136. or the options system.
  6137. It accepts a pointer to an AVABufferSinkContext structure, which
  6138. defines the incoming buffers' formats, to be passed as the opaque
  6139. parameter to @code{avfilter_init_filter} for initialization.
  6140. @section anullsink
  6141. Null audio sink; do absolutely nothing with the input audio. It is
  6142. mainly useful as a template and for use in analysis / debugging
  6143. tools.
  6144. @c man end AUDIO SINKS
  6145. @chapter Video Filters
  6146. @c man begin VIDEO FILTERS
  6147. When you configure your FFmpeg build, you can disable any of the
  6148. existing filters using @code{--disable-filters}.
  6149. The configure output will show the video filters included in your
  6150. build.
  6151. Below is a description of the currently available video filters.
  6152. @section addroi
  6153. Mark a region of interest in a video frame.
  6154. The frame data is passed through unchanged, but metadata is attached
  6155. to the frame indicating regions of interest which can affect the
  6156. behaviour of later encoding. Multiple regions can be marked by
  6157. applying the filter multiple times.
  6158. @table @option
  6159. @item x
  6160. Region distance in pixels from the left edge of the frame.
  6161. @item y
  6162. Region distance in pixels from the top edge of the frame.
  6163. @item w
  6164. Region width in pixels.
  6165. @item h
  6166. Region height in pixels.
  6167. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  6168. and may contain the following variables:
  6169. @table @option
  6170. @item iw
  6171. Width of the input frame.
  6172. @item ih
  6173. Height of the input frame.
  6174. @end table
  6175. @item qoffset
  6176. Quantisation offset to apply within the region.
  6177. This must be a real value in the range -1 to +1. A value of zero
  6178. indicates no quality change. A negative value asks for better quality
  6179. (less quantisation), while a positive value asks for worse quality
  6180. (greater quantisation).
  6181. The range is calibrated so that the extreme values indicate the
  6182. largest possible offset - if the rest of the frame is encoded with the
  6183. worst possible quality, an offset of -1 indicates that this region
  6184. should be encoded with the best possible quality anyway. Intermediate
  6185. values are then interpolated in some codec-dependent way.
  6186. For example, in 10-bit H.264 the quantisation parameter varies between
  6187. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  6188. this region should be encoded with a QP around one-tenth of the full
  6189. range better than the rest of the frame. So, if most of the frame
  6190. were to be encoded with a QP of around 30, this region would get a QP
  6191. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  6192. An extreme value of -1 would indicate that this region should be
  6193. encoded with the best possible quality regardless of the treatment of
  6194. the rest of the frame - that is, should be encoded at a QP of -12.
  6195. @item clear
  6196. If set to true, remove any existing regions of interest marked on the
  6197. frame before adding the new one.
  6198. @end table
  6199. @subsection Examples
  6200. @itemize
  6201. @item
  6202. Mark the centre quarter of the frame as interesting.
  6203. @example
  6204. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  6205. @end example
  6206. @item
  6207. Mark the 100-pixel-wide region on the left edge of the frame as very
  6208. uninteresting (to be encoded at much lower quality than the rest of
  6209. the frame).
  6210. @example
  6211. addroi=0:0:100:ih:+1/5
  6212. @end example
  6213. @end itemize
  6214. @section alphaextract
  6215. Extract the alpha component from the input as a grayscale video. This
  6216. is especially useful with the @var{alphamerge} filter.
  6217. @section alphamerge
  6218. Add or replace the alpha component of the primary input with the
  6219. grayscale value of a second input. This is intended for use with
  6220. @var{alphaextract} to allow the transmission or storage of frame
  6221. sequences that have alpha in a format that doesn't support an alpha
  6222. channel.
  6223. For example, to reconstruct full frames from a normal YUV-encoded video
  6224. and a separate video created with @var{alphaextract}, you might use:
  6225. @example
  6226. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  6227. @end example
  6228. @section amplify
  6229. Amplify differences between current pixel and pixels of adjacent frames in
  6230. same pixel location.
  6231. This filter accepts the following options:
  6232. @table @option
  6233. @item radius
  6234. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  6235. For example radius of 3 will instruct filter to calculate average of 7 frames.
  6236. @item factor
  6237. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  6238. @item threshold
  6239. Set threshold for difference amplification. Any difference greater or equal to
  6240. this value will not alter source pixel. Default is 10.
  6241. Allowed range is from 0 to 65535.
  6242. @item tolerance
  6243. Set tolerance for difference amplification. Any difference lower to
  6244. this value will not alter source pixel. Default is 0.
  6245. Allowed range is from 0 to 65535.
  6246. @item low
  6247. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  6248. This option controls maximum possible value that will decrease source pixel value.
  6249. @item high
  6250. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  6251. This option controls maximum possible value that will increase source pixel value.
  6252. @item planes
  6253. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  6254. @end table
  6255. @subsection Commands
  6256. This filter supports the following @ref{commands} that corresponds to option of same name:
  6257. @table @option
  6258. @item factor
  6259. @item threshold
  6260. @item tolerance
  6261. @item low
  6262. @item high
  6263. @item planes
  6264. @end table
  6265. @section ass
  6266. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  6267. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  6268. Substation Alpha) subtitles files.
  6269. This filter accepts the following option in addition to the common options from
  6270. the @ref{subtitles} filter:
  6271. @table @option
  6272. @item shaping
  6273. Set the shaping engine
  6274. Available values are:
  6275. @table @samp
  6276. @item auto
  6277. The default libass shaping engine, which is the best available.
  6278. @item simple
  6279. Fast, font-agnostic shaper that can do only substitutions
  6280. @item complex
  6281. Slower shaper using OpenType for substitutions and positioning
  6282. @end table
  6283. The default is @code{auto}.
  6284. @end table
  6285. @section atadenoise
  6286. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  6287. The filter accepts the following options:
  6288. @table @option
  6289. @item 0a
  6290. Set threshold A for 1st plane. Default is 0.02.
  6291. Valid range is 0 to 0.3.
  6292. @item 0b
  6293. Set threshold B for 1st plane. Default is 0.04.
  6294. Valid range is 0 to 5.
  6295. @item 1a
  6296. Set threshold A for 2nd plane. Default is 0.02.
  6297. Valid range is 0 to 0.3.
  6298. @item 1b
  6299. Set threshold B for 2nd plane. Default is 0.04.
  6300. Valid range is 0 to 5.
  6301. @item 2a
  6302. Set threshold A for 3rd plane. Default is 0.02.
  6303. Valid range is 0 to 0.3.
  6304. @item 2b
  6305. Set threshold B for 3rd plane. Default is 0.04.
  6306. Valid range is 0 to 5.
  6307. Threshold A is designed to react on abrupt changes in the input signal and
  6308. threshold B is designed to react on continuous changes in the input signal.
  6309. @item s
  6310. Set number of frames filter will use for averaging. Default is 9. Must be odd
  6311. number in range [5, 129].
  6312. @item p
  6313. Set what planes of frame filter will use for averaging. Default is all.
  6314. @item a
  6315. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  6316. Alternatively can be set to @code{s} serial.
  6317. Parallel can be faster then serial, while other way around is never true.
  6318. Parallel will abort early on first change being greater then thresholds, while serial
  6319. will continue processing other side of frames if they are equal or below thresholds.
  6320. @item 0s
  6321. @item 1s
  6322. @item 2s
  6323. Set sigma for 1st plane, 2nd plane or 3rd plane. Default is 32767.
  6324. Valid range is from 0 to 32767.
  6325. This options controls weight for each pixel in radius defined by size.
  6326. Default value means every pixel have same weight.
  6327. Setting this option to 0 effectively disables filtering.
  6328. @end table
  6329. @subsection Commands
  6330. This filter supports same @ref{commands} as options except option @code{s}.
  6331. The command accepts the same syntax of the corresponding option.
  6332. @section avgblur
  6333. Apply average blur filter.
  6334. The filter accepts the following options:
  6335. @table @option
  6336. @item sizeX
  6337. Set horizontal radius size.
  6338. @item planes
  6339. Set which planes to filter. By default all planes are filtered.
  6340. @item sizeY
  6341. Set vertical radius size, if zero it will be same as @code{sizeX}.
  6342. Default is @code{0}.
  6343. @end table
  6344. @subsection Commands
  6345. This filter supports same commands as options.
  6346. The command accepts the same syntax of the corresponding option.
  6347. If the specified expression is not valid, it is kept at its current
  6348. value.
  6349. @section backgroundkey
  6350. Turns a static background into transparency.
  6351. The filter accepts the following option:
  6352. @table @option
  6353. @item threshold
  6354. Threshold for scene change detection.
  6355. @item similarity
  6356. Similarity percentage with the background.
  6357. @item blend
  6358. Set the blend amount for pixels that are not similar.
  6359. @end table
  6360. @subsection Commands
  6361. This filter supports the all above options as @ref{commands}.
  6362. @section bbox
  6363. Compute the bounding box for the non-black pixels in the input frame
  6364. luminance plane.
  6365. This filter computes the bounding box containing all the pixels with a
  6366. luminance value greater than the minimum allowed value.
  6367. The parameters describing the bounding box are printed on the filter
  6368. log.
  6369. The filter accepts the following option:
  6370. @table @option
  6371. @item min_val
  6372. Set the minimal luminance value. Default is @code{16}.
  6373. @end table
  6374. @subsection Commands
  6375. This filter supports the all above options as @ref{commands}.
  6376. @section bilateral
  6377. Apply bilateral filter, spatial smoothing while preserving edges.
  6378. The filter accepts the following options:
  6379. @table @option
  6380. @item sigmaS
  6381. Set sigma of gaussian function to calculate spatial weight.
  6382. Allowed range is 0 to 512. Default is 0.1.
  6383. @item sigmaR
  6384. Set sigma of gaussian function to calculate range weight.
  6385. Allowed range is 0 to 1. Default is 0.1.
  6386. @item planes
  6387. Set planes to filter. Default is first only.
  6388. @end table
  6389. @subsection Commands
  6390. This filter supports the all above options as @ref{commands}.
  6391. @section bilateral_cuda
  6392. CUDA accelerated bilateral filter, an edge preserving filter.
  6393. This filter is mathematically accurate thanks to the use of GPU acceleration.
  6394. For best output quality, use one to one chroma subsampling, i.e. yuv444p format.
  6395. The filter accepts the following options:
  6396. @table @option
  6397. @item sigmaS
  6398. Set sigma of gaussian function to calculate spatial weight, also called sigma space.
  6399. Allowed range is 0.1 to 512. Default is 0.1.
  6400. @item sigmaR
  6401. Set sigma of gaussian function to calculate color range weight, also called sigma color.
  6402. Allowed range is 0.1 to 512. Default is 0.1.
  6403. @item window_size
  6404. Set window size of the bilateral function to determine the number of neighbours to loop on.
  6405. If the number entered is even, one will be added automatically.
  6406. Allowed range is 1 to 255. Default is 1.
  6407. @end table
  6408. @subsection Examples
  6409. @itemize
  6410. @item
  6411. Apply the bilateral filter on a video.
  6412. @example
  6413. ./ffmpeg -v verbose \
  6414. -hwaccel cuda -hwaccel_output_format cuda -i input.mp4 \
  6415. -init_hw_device cuda \
  6416. -filter_complex \
  6417. " \
  6418. [0:v]scale_cuda=format=yuv444p[scaled_video];
  6419. [scaled_video]bilateral_cuda=window_size=9:sigmaS=3.0:sigmaR=50.0" \
  6420. -an -sn -c:v h264_nvenc -cq 20 out.mp4
  6421. @end example
  6422. @end itemize
  6423. @section bitplanenoise
  6424. Show and measure bit plane noise.
  6425. The filter accepts the following options:
  6426. @table @option
  6427. @item bitplane
  6428. Set which plane to analyze. Default is @code{1}.
  6429. @item filter
  6430. Filter out noisy pixels from @code{bitplane} set above.
  6431. Default is disabled.
  6432. @end table
  6433. @section blackdetect
  6434. Detect video intervals that are (almost) completely black. Can be
  6435. useful to detect chapter transitions, commercials, or invalid
  6436. recordings.
  6437. The filter outputs its detection analysis to both the log as well as
  6438. frame metadata. If a black segment of at least the specified minimum
  6439. duration is found, a line with the start and end timestamps as well
  6440. as duration is printed to the log with level @code{info}. In addition,
  6441. a log line with level @code{debug} is printed per frame showing the
  6442. black amount detected for that frame.
  6443. The filter also attaches metadata to the first frame of a black
  6444. segment with key @code{lavfi.black_start} and to the first frame
  6445. after the black segment ends with key @code{lavfi.black_end}. The
  6446. value is the frame's timestamp. This metadata is added regardless
  6447. of the minimum duration specified.
  6448. The filter accepts the following options:
  6449. @table @option
  6450. @item black_min_duration, d
  6451. Set the minimum detected black duration expressed in seconds. It must
  6452. be a non-negative floating point number.
  6453. Default value is 2.0.
  6454. @item picture_black_ratio_th, pic_th
  6455. Set the threshold for considering a picture "black".
  6456. Express the minimum value for the ratio:
  6457. @example
  6458. @var{nb_black_pixels} / @var{nb_pixels}
  6459. @end example
  6460. for which a picture is considered black.
  6461. Default value is 0.98.
  6462. @item pixel_black_th, pix_th
  6463. Set the threshold for considering a pixel "black".
  6464. The threshold expresses the maximum pixel luminance value for which a
  6465. pixel is considered "black". The provided value is scaled according to
  6466. the following equation:
  6467. @example
  6468. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  6469. @end example
  6470. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  6471. the input video format, the range is [0-255] for YUV full-range
  6472. formats and [16-235] for YUV non full-range formats.
  6473. Default value is 0.10.
  6474. @end table
  6475. The following example sets the maximum pixel threshold to the minimum
  6476. value, and detects only black intervals of 2 or more seconds:
  6477. @example
  6478. blackdetect=d=2:pix_th=0.00
  6479. @end example
  6480. @section blackframe
  6481. Detect frames that are (almost) completely black. Can be useful to
  6482. detect chapter transitions or commercials. Output lines consist of
  6483. the frame number of the detected frame, the percentage of blackness,
  6484. the position in the file if known or -1 and the timestamp in seconds.
  6485. In order to display the output lines, you need to set the loglevel at
  6486. least to the AV_LOG_INFO value.
  6487. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  6488. The value represents the percentage of pixels in the picture that
  6489. are below the threshold value.
  6490. It accepts the following parameters:
  6491. @table @option
  6492. @item amount
  6493. The percentage of the pixels that have to be below the threshold; it defaults to
  6494. @code{98}.
  6495. @item threshold, thresh
  6496. The threshold below which a pixel value is considered black; it defaults to
  6497. @code{32}.
  6498. @end table
  6499. @anchor{blend}
  6500. @section blend
  6501. Blend two video frames into each other.
  6502. The @code{blend} filter takes two input streams and outputs one
  6503. stream, the first input is the "top" layer and second input is
  6504. "bottom" layer. By default, the output terminates when the longest input terminates.
  6505. The @code{tblend} (time blend) filter takes two consecutive frames
  6506. from one single stream, and outputs the result obtained by blending
  6507. the new frame on top of the old frame.
  6508. A description of the accepted options follows.
  6509. @table @option
  6510. @item c0_mode
  6511. @item c1_mode
  6512. @item c2_mode
  6513. @item c3_mode
  6514. @item all_mode
  6515. Set blend mode for specific pixel component or all pixel components in case
  6516. of @var{all_mode}. Default value is @code{normal}.
  6517. Available values for component modes are:
  6518. @table @samp
  6519. @item addition
  6520. @item and
  6521. @item average
  6522. @item bleach
  6523. @item burn
  6524. @item darken
  6525. @item difference
  6526. @item divide
  6527. @item dodge
  6528. @item exclusion
  6529. @item extremity
  6530. @item freeze
  6531. @item geometric
  6532. @item glow
  6533. @item grainextract
  6534. @item grainmerge
  6535. @item hardlight
  6536. @item hardmix
  6537. @item hardoverlay
  6538. @item harmonic
  6539. @item heat
  6540. @item interpolate
  6541. @item lighten
  6542. @item linearlight
  6543. @item multiply
  6544. @item multiply128
  6545. @item negation
  6546. @item normal
  6547. @item or
  6548. @item overlay
  6549. @item phoenix
  6550. @item pinlight
  6551. @item reflect
  6552. @item screen
  6553. @item softdifference
  6554. @item softlight
  6555. @item stain
  6556. @item subtract
  6557. @item vividlight
  6558. @item xor
  6559. @end table
  6560. @item c0_opacity
  6561. @item c1_opacity
  6562. @item c2_opacity
  6563. @item c3_opacity
  6564. @item all_opacity
  6565. Set blend opacity for specific pixel component or all pixel components in case
  6566. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  6567. @item c0_expr
  6568. @item c1_expr
  6569. @item c2_expr
  6570. @item c3_expr
  6571. @item all_expr
  6572. Set blend expression for specific pixel component or all pixel components in case
  6573. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  6574. The expressions can use the following variables:
  6575. @table @option
  6576. @item N
  6577. The sequential number of the filtered frame, starting from @code{0}.
  6578. @item X
  6579. @item Y
  6580. the coordinates of the current sample
  6581. @item W
  6582. @item H
  6583. the width and height of currently filtered plane
  6584. @item SW
  6585. @item SH
  6586. Width and height scale for the plane being filtered. It is the
  6587. ratio between the dimensions of the current plane to the luma plane,
  6588. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  6589. the luma plane and @code{0.5,0.5} for the chroma planes.
  6590. @item T
  6591. Time of the current frame, expressed in seconds.
  6592. @item TOP, A
  6593. Value of pixel component at current location for first video frame (top layer).
  6594. @item BOTTOM, B
  6595. Value of pixel component at current location for second video frame (bottom layer).
  6596. @end table
  6597. @end table
  6598. The @code{blend} filter also supports the @ref{framesync} options.
  6599. @subsection Examples
  6600. @itemize
  6601. @item
  6602. Apply transition from bottom layer to top layer in first 10 seconds:
  6603. @example
  6604. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  6605. @end example
  6606. @item
  6607. Apply linear horizontal transition from top layer to bottom layer:
  6608. @example
  6609. blend=all_expr='A*(X/W)+B*(1-X/W)'
  6610. @end example
  6611. @item
  6612. Apply 1x1 checkerboard effect:
  6613. @example
  6614. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  6615. @end example
  6616. @item
  6617. Apply uncover left effect:
  6618. @example
  6619. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  6620. @end example
  6621. @item
  6622. Apply uncover down effect:
  6623. @example
  6624. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  6625. @end example
  6626. @item
  6627. Apply uncover up-left effect:
  6628. @example
  6629. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  6630. @end example
  6631. @item
  6632. Split diagonally video and shows top and bottom layer on each side:
  6633. @example
  6634. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  6635. @end example
  6636. @item
  6637. Display differences between the current and the previous frame:
  6638. @example
  6639. tblend=all_mode=grainextract
  6640. @end example
  6641. @end itemize
  6642. @subsection Commands
  6643. This filter supports same @ref{commands} as options.
  6644. @anchor{blockdetect}
  6645. @section blockdetect
  6646. Determines blockiness of frames without altering the input frames.
  6647. Based on Remco Muijs and Ihor Kirenko: "A no-reference blocking artifact measure for adaptive video processing." 2005 13th European signal processing conference.
  6648. The filter accepts the following options:
  6649. @table @option
  6650. @item period_min
  6651. @item period_max
  6652. Set minimum and maximum values for determining pixel grids (periods).
  6653. Default values are [3,24].
  6654. @item planes
  6655. Set planes to filter. Default is first only.
  6656. @end table
  6657. @subsection Examples
  6658. @itemize
  6659. @item
  6660. Determine blockiness for the first plane and search for periods within [8,32]:
  6661. @example
  6662. blockdetect=period_min=8:period_max=32:planes=1
  6663. @end example
  6664. @end itemize
  6665. @anchor{blurdetect}
  6666. @section blurdetect
  6667. Determines blurriness of frames without altering the input frames.
  6668. Based on Marziliano, Pina, et al. "A no-reference perceptual blur metric."
  6669. Allows for a block-based abbreviation.
  6670. The filter accepts the following options:
  6671. @table @option
  6672. @item low
  6673. @item high
  6674. Set low and high threshold values used by the Canny thresholding
  6675. algorithm.
  6676. The high threshold selects the "strong" edge pixels, which are then
  6677. connected through 8-connectivity with the "weak" edge pixels selected
  6678. by the low threshold.
  6679. @var{low} and @var{high} threshold values must be chosen in the range
  6680. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6681. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6682. is @code{50/255}.
  6683. @item radius
  6684. Define the radius to search around an edge pixel for local maxima.
  6685. @item block_pct
  6686. Determine blurriness only for the most significant blocks, given in percentage.
  6687. @item block_width
  6688. 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}.
  6689. @item block_height
  6690. 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}.
  6691. @item planes
  6692. Set planes to filter. Default is first only.
  6693. @end table
  6694. @subsection Examples
  6695. @itemize
  6696. @item
  6697. Determine blur for 80% of most significant 32x32 blocks:
  6698. @example
  6699. blurdetect=block_width=32:block_height=32:block_pct=80
  6700. @end example
  6701. @end itemize
  6702. @section bm3d
  6703. Denoise frames using Block-Matching 3D algorithm.
  6704. The filter accepts the following options.
  6705. @table @option
  6706. @item sigma
  6707. Set denoising strength. Default value is 1.
  6708. Allowed range is from 0 to 999.9.
  6709. The denoising algorithm is very sensitive to sigma, so adjust it
  6710. according to the source.
  6711. @item block
  6712. Set local patch size. This sets dimensions in 2D.
  6713. @item bstep
  6714. Set sliding step for processing blocks. Default value is 4.
  6715. Allowed range is from 1 to 64.
  6716. Smaller values allows processing more reference blocks and is slower.
  6717. @item group
  6718. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  6719. When set to 1, no block matching is done. Larger values allows more blocks
  6720. in single group.
  6721. Allowed range is from 1 to 256.
  6722. @item range
  6723. Set radius for search block matching. Default is 9.
  6724. Allowed range is from 1 to INT32_MAX.
  6725. @item mstep
  6726. Set step between two search locations for block matching. Default is 1.
  6727. Allowed range is from 1 to 64. Smaller is slower.
  6728. @item thmse
  6729. Set threshold of mean square error for block matching. Valid range is 0 to
  6730. INT32_MAX.
  6731. @item hdthr
  6732. Set thresholding parameter for hard thresholding in 3D transformed domain.
  6733. Larger values results in stronger hard-thresholding filtering in frequency
  6734. domain.
  6735. @item estim
  6736. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  6737. Default is @code{basic}.
  6738. @item ref
  6739. If enabled, filter will use 2nd stream for block matching.
  6740. Default is disabled for @code{basic} value of @var{estim} option,
  6741. and always enabled if value of @var{estim} is @code{final}.
  6742. @item planes
  6743. Set planes to filter. Default is all available except alpha.
  6744. @end table
  6745. @subsection Examples
  6746. @itemize
  6747. @item
  6748. Basic filtering with bm3d:
  6749. @example
  6750. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  6751. @end example
  6752. @item
  6753. Same as above, but filtering only luma:
  6754. @example
  6755. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  6756. @end example
  6757. @item
  6758. Same as above, but with both estimation modes:
  6759. @example
  6760. 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
  6761. @end example
  6762. @item
  6763. Same as above, but prefilter with @ref{nlmeans} filter instead:
  6764. @example
  6765. 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
  6766. @end example
  6767. @end itemize
  6768. @section boxblur
  6769. Apply a boxblur algorithm to the input video.
  6770. It accepts the following parameters:
  6771. @table @option
  6772. @item luma_radius, lr
  6773. @item luma_power, lp
  6774. @item chroma_radius, cr
  6775. @item chroma_power, cp
  6776. @item alpha_radius, ar
  6777. @item alpha_power, ap
  6778. @end table
  6779. A description of the accepted options follows.
  6780. @table @option
  6781. @item luma_radius, lr
  6782. @item chroma_radius, cr
  6783. @item alpha_radius, ar
  6784. Set an expression for the box radius in pixels used for blurring the
  6785. corresponding input plane.
  6786. The radius value must be a non-negative number, and must not be
  6787. greater than the value of the expression @code{min(w,h)/2} for the
  6788. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  6789. planes.
  6790. Default value for @option{luma_radius} is "2". If not specified,
  6791. @option{chroma_radius} and @option{alpha_radius} default to the
  6792. corresponding value set for @option{luma_radius}.
  6793. The expressions can contain the following constants:
  6794. @table @option
  6795. @item w
  6796. @item h
  6797. The input width and height in pixels.
  6798. @item cw
  6799. @item ch
  6800. The input chroma image width and height in pixels.
  6801. @item hsub
  6802. @item vsub
  6803. The horizontal and vertical chroma subsample values. For example, for the
  6804. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  6805. @end table
  6806. @item luma_power, lp
  6807. @item chroma_power, cp
  6808. @item alpha_power, ap
  6809. Specify how many times the boxblur filter is applied to the
  6810. corresponding plane.
  6811. Default value for @option{luma_power} is 2. If not specified,
  6812. @option{chroma_power} and @option{alpha_power} default to the
  6813. corresponding value set for @option{luma_power}.
  6814. A value of 0 will disable the effect.
  6815. @end table
  6816. @subsection Examples
  6817. @itemize
  6818. @item
  6819. Apply a boxblur filter with the luma, chroma, and alpha radii
  6820. set to 2:
  6821. @example
  6822. boxblur=luma_radius=2:luma_power=1
  6823. boxblur=2:1
  6824. @end example
  6825. @item
  6826. Set the luma radius to 2, and alpha and chroma radius to 0:
  6827. @example
  6828. boxblur=2:1:cr=0:ar=0
  6829. @end example
  6830. @item
  6831. Set the luma and chroma radii to a fraction of the video dimension:
  6832. @example
  6833. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  6834. @end example
  6835. @end itemize
  6836. @section bwdif
  6837. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  6838. Deinterlacing Filter").
  6839. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  6840. interpolation algorithms.
  6841. It accepts the following parameters:
  6842. @table @option
  6843. @item mode
  6844. The interlacing mode to adopt. It accepts one of the following values:
  6845. @table @option
  6846. @item 0, send_frame
  6847. Output one frame for each frame.
  6848. @item 1, send_field
  6849. Output one frame for each field.
  6850. @end table
  6851. The default value is @code{send_field}.
  6852. @item parity
  6853. The picture field parity assumed for the input interlaced video. It accepts one
  6854. of the following values:
  6855. @table @option
  6856. @item 0, tff
  6857. Assume the top field is first.
  6858. @item 1, bff
  6859. Assume the bottom field is first.
  6860. @item -1, auto
  6861. Enable automatic detection of field parity.
  6862. @end table
  6863. The default value is @code{auto}.
  6864. If the interlacing is unknown or the decoder does not export this information,
  6865. top field first will be assumed.
  6866. @item deint
  6867. Specify which frames to deinterlace. Accepts one of the following
  6868. values:
  6869. @table @option
  6870. @item 0, all
  6871. Deinterlace all frames.
  6872. @item 1, interlaced
  6873. Only deinterlace frames marked as interlaced.
  6874. @end table
  6875. The default value is @code{all}.
  6876. @end table
  6877. @section cas
  6878. Apply Contrast Adaptive Sharpen filter to video stream.
  6879. The filter accepts the following options:
  6880. @table @option
  6881. @item strength
  6882. Set the sharpening strength. Default value is 0.
  6883. @item planes
  6884. Set planes to filter. Default value is to filter all
  6885. planes except alpha plane.
  6886. @end table
  6887. @subsection Commands
  6888. This filter supports same @ref{commands} as options.
  6889. @section chromahold
  6890. Remove all color information for all colors except for certain one.
  6891. The filter accepts the following options:
  6892. @table @option
  6893. @item color
  6894. The color which will not be replaced with neutral chroma.
  6895. @item similarity
  6896. Similarity percentage with the above color.
  6897. 0.01 matches only the exact key color, while 1.0 matches everything.
  6898. @item blend
  6899. Blend percentage.
  6900. 0.0 makes pixels either fully gray, or not gray at all.
  6901. Higher values result in more preserved color.
  6902. @item yuv
  6903. Signals that the color passed is already in YUV instead of RGB.
  6904. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  6905. This can be used to pass exact YUV values as hexadecimal numbers.
  6906. @end table
  6907. @subsection Commands
  6908. This filter supports same @ref{commands} as options.
  6909. The command accepts the same syntax of the corresponding option.
  6910. If the specified expression is not valid, it is kept at its current
  6911. value.
  6912. @anchor{chromakey}
  6913. @section chromakey
  6914. YUV colorspace color/chroma keying.
  6915. The filter accepts the following options:
  6916. @table @option
  6917. @item color
  6918. The color which will be replaced with transparency.
  6919. @item similarity
  6920. Similarity percentage with the key color.
  6921. 0.01 matches only the exact key color, while 1.0 matches everything.
  6922. @item blend
  6923. Blend percentage.
  6924. 0.0 makes pixels either fully transparent, or not transparent at all.
  6925. Higher values result in semi-transparent pixels, with a higher transparency
  6926. the more similar the pixels color is to the key color.
  6927. @item yuv
  6928. Signals that the color passed is already in YUV instead of RGB.
  6929. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  6930. This can be used to pass exact YUV values as hexadecimal numbers.
  6931. @end table
  6932. @subsection Commands
  6933. This filter supports same @ref{commands} as options.
  6934. The command accepts the same syntax of the corresponding option.
  6935. If the specified expression is not valid, it is kept at its current
  6936. value.
  6937. @subsection Examples
  6938. @itemize
  6939. @item
  6940. Make every green pixel in the input image transparent:
  6941. @example
  6942. ffmpeg -i input.png -vf chromakey=green out.png
  6943. @end example
  6944. @item
  6945. Overlay a greenscreen-video on top of a static black background.
  6946. @example
  6947. 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
  6948. @end example
  6949. @end itemize
  6950. @section chromakey_cuda
  6951. CUDA accelerated YUV colorspace color/chroma keying.
  6952. This filter works like normal chromakey filter but operates on CUDA frames.
  6953. for more details and parameters see @ref{chromakey}.
  6954. @subsection Examples
  6955. @itemize
  6956. @item
  6957. Make all the green pixels in the input video transparent and use it as an overlay for another video:
  6958. @example
  6959. ./ffmpeg \
  6960. -hwaccel cuda -hwaccel_output_format cuda -i input_green.mp4 \
  6961. -hwaccel cuda -hwaccel_output_format cuda -i base_video.mp4 \
  6962. -init_hw_device cuda \
  6963. -filter_complex \
  6964. " \
  6965. [0:v]chromakey_cuda=0x25302D:0.1:0.12:1[overlay_video]; \
  6966. [1:v]scale_cuda=format=yuv420p[base]; \
  6967. [base][overlay_video]overlay_cuda" \
  6968. -an -sn -c:v h264_nvenc -cq 20 output.mp4
  6969. @end example
  6970. @item
  6971. Process two software sources, explicitly uploading the frames:
  6972. @example
  6973. ./ffmpeg -init_hw_device cuda=cuda -filter_hw_device cuda \
  6974. -f lavfi -i color=size=800x600:color=white,format=yuv420p \
  6975. -f lavfi -i yuvtestsrc=size=200x200,format=yuv420p \
  6976. -filter_complex \
  6977. " \
  6978. [0]hwupload[under]; \
  6979. [1]hwupload,chromakey_cuda=green:0.1:0.12[over]; \
  6980. [under][over]overlay_cuda" \
  6981. -c:v hevc_nvenc -cq 18 -preset slow output.mp4
  6982. @end example
  6983. @end itemize
  6984. @section chromanr
  6985. Reduce chrominance noise.
  6986. The filter accepts the following options:
  6987. @table @option
  6988. @item thres
  6989. Set threshold for averaging chrominance values.
  6990. Sum of absolute difference of Y, U and V pixel components of current
  6991. pixel and neighbour pixels lower than this threshold will be used in
  6992. averaging. Luma component is left unchanged and is copied to output.
  6993. Default value is 30. Allowed range is from 1 to 200.
  6994. @item sizew
  6995. Set horizontal radius of rectangle used for averaging.
  6996. Allowed range is from 1 to 100. Default value is 5.
  6997. @item sizeh
  6998. Set vertical radius of rectangle used for averaging.
  6999. Allowed range is from 1 to 100. Default value is 5.
  7000. @item stepw
  7001. Set horizontal step when averaging. Default value is 1.
  7002. Allowed range is from 1 to 50.
  7003. Mostly useful to speed-up filtering.
  7004. @item steph
  7005. Set vertical step when averaging. Default value is 1.
  7006. Allowed range is from 1 to 50.
  7007. Mostly useful to speed-up filtering.
  7008. @item threy
  7009. Set Y threshold for averaging chrominance values.
  7010. Set finer control for max allowed difference between Y components
  7011. of current pixel and neigbour pixels.
  7012. Default value is 200. Allowed range is from 1 to 200.
  7013. @item threu
  7014. Set U threshold for averaging chrominance values.
  7015. Set finer control for max allowed difference between U components
  7016. of current pixel and neigbour pixels.
  7017. Default value is 200. Allowed range is from 1 to 200.
  7018. @item threv
  7019. Set V threshold for averaging chrominance values.
  7020. Set finer control for max allowed difference between V components
  7021. of current pixel and neigbour pixels.
  7022. Default value is 200. Allowed range is from 1 to 200.
  7023. @item distance
  7024. Set distance type used in calculations.
  7025. @table @samp
  7026. @item manhattan
  7027. Absolute difference.
  7028. @item euclidean
  7029. Difference squared.
  7030. @end table
  7031. Default distance type is manhattan.
  7032. @end table
  7033. @subsection Commands
  7034. This filter supports same @ref{commands} as options.
  7035. The command accepts the same syntax of the corresponding option.
  7036. @section chromashift
  7037. Shift chroma pixels horizontally and/or vertically.
  7038. The filter accepts the following options:
  7039. @table @option
  7040. @item cbh
  7041. Set amount to shift chroma-blue horizontally.
  7042. @item cbv
  7043. Set amount to shift chroma-blue vertically.
  7044. @item crh
  7045. Set amount to shift chroma-red horizontally.
  7046. @item crv
  7047. Set amount to shift chroma-red vertically.
  7048. @item edge
  7049. Set edge mode, can be @var{smear}, default, or @var{warp}.
  7050. @end table
  7051. @subsection Commands
  7052. This filter supports the all above options as @ref{commands}.
  7053. @section ciescope
  7054. Display CIE color diagram with pixels overlaid onto it.
  7055. The filter accepts the following options:
  7056. @table @option
  7057. @item system
  7058. Set color system.
  7059. @table @samp
  7060. @item ntsc, 470m
  7061. @item ebu, 470bg
  7062. @item smpte
  7063. @item 240m
  7064. @item apple
  7065. @item widergb
  7066. @item cie1931
  7067. @item rec709, hdtv
  7068. @item uhdtv, rec2020
  7069. @item dcip3
  7070. @end table
  7071. @item cie
  7072. Set CIE system.
  7073. @table @samp
  7074. @item xyy
  7075. @item ucs
  7076. @item luv
  7077. @end table
  7078. @item gamuts
  7079. Set what gamuts to draw.
  7080. See @code{system} option for available values.
  7081. @item size, s
  7082. Set ciescope size, by default set to 512.
  7083. @item intensity, i
  7084. Set intensity used to map input pixel values to CIE diagram.
  7085. @item contrast
  7086. Set contrast used to draw tongue colors that are out of active color system gamut.
  7087. @item corrgamma
  7088. Correct gamma displayed on scope, by default enabled.
  7089. @item showwhite
  7090. Show white point on CIE diagram, by default disabled.
  7091. @item gamma
  7092. Set input gamma. Used only with XYZ input color space.
  7093. @item fill
  7094. Fill with CIE colors. By default is enabled.
  7095. @end table
  7096. @section codecview
  7097. Visualize information exported by some codecs.
  7098. Some codecs can export information through frames using side-data or other
  7099. means. For example, some MPEG based codecs export motion vectors through the
  7100. @var{export_mvs} flag in the codec @option{flags2} option.
  7101. The filter accepts the following option:
  7102. @table @option
  7103. @item block
  7104. Display block partition structure using the luma plane.
  7105. @item mv
  7106. Set motion vectors to visualize.
  7107. Available flags for @var{mv} are:
  7108. @table @samp
  7109. @item pf
  7110. forward predicted MVs of P-frames
  7111. @item bf
  7112. forward predicted MVs of B-frames
  7113. @item bb
  7114. backward predicted MVs of B-frames
  7115. @end table
  7116. @item qp
  7117. Display quantization parameters using the chroma planes.
  7118. @item mv_type, mvt
  7119. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  7120. Available flags for @var{mv_type} are:
  7121. @table @samp
  7122. @item fp
  7123. forward predicted MVs
  7124. @item bp
  7125. backward predicted MVs
  7126. @end table
  7127. @item frame_type, ft
  7128. Set frame type to visualize motion vectors of.
  7129. Available flags for @var{frame_type} are:
  7130. @table @samp
  7131. @item if
  7132. intra-coded frames (I-frames)
  7133. @item pf
  7134. predicted frames (P-frames)
  7135. @item bf
  7136. bi-directionally predicted frames (B-frames)
  7137. @end table
  7138. @end table
  7139. @subsection Examples
  7140. @itemize
  7141. @item
  7142. Visualize forward predicted MVs of all frames using @command{ffplay}:
  7143. @example
  7144. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  7145. @end example
  7146. @item
  7147. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  7148. @example
  7149. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  7150. @end example
  7151. @end itemize
  7152. @section colorbalance
  7153. Modify intensity of primary colors (red, green and blue) of input frames.
  7154. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  7155. regions for the red-cyan, green-magenta or blue-yellow balance.
  7156. A positive adjustment value shifts the balance towards the primary color, a negative
  7157. value towards the complementary color.
  7158. The filter accepts the following options:
  7159. @table @option
  7160. @item rs
  7161. @item gs
  7162. @item bs
  7163. Adjust red, green and blue shadows (darkest pixels).
  7164. @item rm
  7165. @item gm
  7166. @item bm
  7167. Adjust red, green and blue midtones (medium pixels).
  7168. @item rh
  7169. @item gh
  7170. @item bh
  7171. Adjust red, green and blue highlights (brightest pixels).
  7172. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  7173. @item pl
  7174. Preserve lightness when changing color balance. Default is disabled.
  7175. @end table
  7176. @subsection Examples
  7177. @itemize
  7178. @item
  7179. Add red color cast to shadows:
  7180. @example
  7181. colorbalance=rs=.3
  7182. @end example
  7183. @end itemize
  7184. @subsection Commands
  7185. This filter supports the all above options as @ref{commands}.
  7186. @section colorcontrast
  7187. Adjust color contrast between RGB components.
  7188. The filter accepts the following options:
  7189. @table @option
  7190. @item rc
  7191. Set the red-cyan contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  7192. @item gm
  7193. Set the green-magenta contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  7194. @item by
  7195. Set the blue-yellow contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  7196. @item rcw
  7197. @item gmw
  7198. @item byw
  7199. Set the weight of each @code{rc}, @code{gm}, @code{by} option value. Default value is 0.0.
  7200. Allowed range is from 0.0 to 1.0. If all weights are 0.0 filtering is disabled.
  7201. @item pl
  7202. Set the amount of preserving lightness. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  7203. @end table
  7204. @subsection Commands
  7205. This filter supports the all above options as @ref{commands}.
  7206. @section colorcorrect
  7207. Adjust color white balance selectively for blacks and whites.
  7208. This filter operates in YUV colorspace.
  7209. The filter accepts the following options:
  7210. @table @option
  7211. @item rl
  7212. Set the red shadow spot. Allowed range is from -1.0 to 1.0.
  7213. Default value is 0.
  7214. @item bl
  7215. Set the blue shadow spot. Allowed range is from -1.0 to 1.0.
  7216. Default value is 0.
  7217. @item rh
  7218. Set the red highlight spot. Allowed range is from -1.0 to 1.0.
  7219. Default value is 0.
  7220. @item bh
  7221. Set the red highlight spot. Allowed range is from -1.0 to 1.0.
  7222. Default value is 0.
  7223. @item saturation
  7224. Set the amount of saturation. Allowed range is from -3.0 to 3.0.
  7225. Default value is 1.
  7226. @item analyze
  7227. If set to anything other than @code{manual} it will analyze every frame and use derived
  7228. parameters for filtering output frame.
  7229. Possible values are:
  7230. @table @samp
  7231. @item manual
  7232. @item average
  7233. @item minmax
  7234. @item median
  7235. @end table
  7236. Default value is @code{manual}.
  7237. @end table
  7238. @subsection Commands
  7239. This filter supports the all above options as @ref{commands}.
  7240. @section colorchannelmixer
  7241. Adjust video input frames by re-mixing color channels.
  7242. This filter modifies a color channel by adding the values associated to
  7243. the other channels of the same pixels. For example if the value to
  7244. modify is red, the output value will be:
  7245. @example
  7246. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  7247. @end example
  7248. The filter accepts the following options:
  7249. @table @option
  7250. @item rr
  7251. @item rg
  7252. @item rb
  7253. @item ra
  7254. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  7255. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  7256. @item gr
  7257. @item gg
  7258. @item gb
  7259. @item ga
  7260. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  7261. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  7262. @item br
  7263. @item bg
  7264. @item bb
  7265. @item ba
  7266. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  7267. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  7268. @item ar
  7269. @item ag
  7270. @item ab
  7271. @item aa
  7272. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  7273. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  7274. Allowed ranges for options are @code{[-2.0, 2.0]}.
  7275. @item pc
  7276. Set preserve color mode. The accepted values are:
  7277. @table @samp
  7278. @item none
  7279. Disable color preserving, this is default.
  7280. @item lum
  7281. Preserve luminance.
  7282. @item max
  7283. Preserve max value of RGB triplet.
  7284. @item avg
  7285. Preserve average value of RGB triplet.
  7286. @item sum
  7287. Preserve sum value of RGB triplet.
  7288. @item nrm
  7289. Preserve normalized value of RGB triplet.
  7290. @item pwr
  7291. Preserve power value of RGB triplet.
  7292. @end table
  7293. @item pa
  7294. Set the preserve color amount when changing colors. Allowed range is from @code{[0.0, 1.0]}.
  7295. Default is @code{0.0}, thus disabled.
  7296. @end table
  7297. @subsection Examples
  7298. @itemize
  7299. @item
  7300. Convert source to grayscale:
  7301. @example
  7302. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  7303. @end example
  7304. @item
  7305. Simulate sepia tones:
  7306. @example
  7307. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  7308. @end example
  7309. @end itemize
  7310. @subsection Commands
  7311. This filter supports the all above options as @ref{commands}.
  7312. @section colorize
  7313. Overlay a solid color on the video stream.
  7314. The filter accepts the following options:
  7315. @table @option
  7316. @item hue
  7317. Set the color hue. Allowed range is from 0 to 360.
  7318. Default value is 0.
  7319. @item saturation
  7320. Set the color saturation. Allowed range is from 0 to 1.
  7321. Default value is 0.5.
  7322. @item lightness
  7323. Set the color lightness. Allowed range is from 0 to 1.
  7324. Default value is 0.5.
  7325. @item mix
  7326. Set the mix of source lightness. By default is set to 1.0.
  7327. Allowed range is from 0.0 to 1.0.
  7328. @end table
  7329. @subsection Commands
  7330. This filter supports the all above options as @ref{commands}.
  7331. @section colorkey
  7332. RGB colorspace color keying.
  7333. This filter operates on 8-bit RGB format frames by setting the alpha component of each pixel
  7334. which falls within the similarity radius of the key color to 0. The alpha value for pixels outside
  7335. the similarity radius depends on the value of the blend option.
  7336. The filter accepts the following options:
  7337. @table @option
  7338. @item color
  7339. Set the color for which alpha will be set to 0 (full transparency).
  7340. See @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7341. Default is @code{black}.
  7342. @item similarity
  7343. Set the radius from the key color within which other colors also have full transparency.
  7344. The computed distance is related to the unit fractional distance in 3D space between the RGB values
  7345. of the key color and the pixel's color. Range is 0.01 to 1.0. 0.01 matches within a very small radius
  7346. around the exact key color, while 1.0 matches everything.
  7347. Default is @code{0.01}.
  7348. @item blend
  7349. Set how the alpha value for pixels that fall outside the similarity radius is computed.
  7350. 0.0 makes pixels either fully transparent or fully opaque.
  7351. Higher values result in semi-transparent pixels, with greater transparency
  7352. the more similar the pixel color is to the key color.
  7353. Range is 0.0 to 1.0. Default is @code{0.0}.
  7354. @end table
  7355. @subsection Examples
  7356. @itemize
  7357. @item
  7358. Make every green pixel in the input image transparent:
  7359. @example
  7360. ffmpeg -i input.png -vf colorkey=green out.png
  7361. @end example
  7362. @item
  7363. Overlay a greenscreen-video on top of a static background image.
  7364. @example
  7365. 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
  7366. @end example
  7367. @end itemize
  7368. @subsection Commands
  7369. This filter supports same @ref{commands} as options.
  7370. The command accepts the same syntax of the corresponding option.
  7371. If the specified expression is not valid, it is kept at its current
  7372. value.
  7373. @section colorhold
  7374. Remove all color information for all RGB colors except for certain one.
  7375. The filter accepts the following options:
  7376. @table @option
  7377. @item color
  7378. The color which will not be replaced with neutral gray.
  7379. @item similarity
  7380. Similarity percentage with the above color.
  7381. 0.01 matches only the exact key color, while 1.0 matches everything.
  7382. @item blend
  7383. Blend percentage. 0.0 makes pixels fully gray.
  7384. Higher values result in more preserved color.
  7385. @end table
  7386. @subsection Commands
  7387. This filter supports same @ref{commands} as options.
  7388. The command accepts the same syntax of the corresponding option.
  7389. If the specified expression is not valid, it is kept at its current
  7390. value.
  7391. @section colorlevels
  7392. Adjust video input frames using levels.
  7393. The filter accepts the following options:
  7394. @table @option
  7395. @item rimin
  7396. @item gimin
  7397. @item bimin
  7398. @item aimin
  7399. Adjust red, green, blue and alpha input black point.
  7400. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  7401. @item rimax
  7402. @item gimax
  7403. @item bimax
  7404. @item aimax
  7405. Adjust red, green, blue and alpha input white point.
  7406. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  7407. Input levels are used to lighten highlights (bright tones), darken shadows
  7408. (dark tones), change the balance of bright and dark tones.
  7409. @item romin
  7410. @item gomin
  7411. @item bomin
  7412. @item aomin
  7413. Adjust red, green, blue and alpha output black point.
  7414. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  7415. @item romax
  7416. @item gomax
  7417. @item bomax
  7418. @item aomax
  7419. Adjust red, green, blue and alpha output white point.
  7420. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  7421. Output levels allows manual selection of a constrained output level range.
  7422. @item preserve
  7423. Set preserve color mode. The accepted values are:
  7424. @table @samp
  7425. @item none
  7426. Disable color preserving, this is default.
  7427. @item lum
  7428. Preserve luminance.
  7429. @item max
  7430. Preserve max value of RGB triplet.
  7431. @item avg
  7432. Preserve average value of RGB triplet.
  7433. @item sum
  7434. Preserve sum value of RGB triplet.
  7435. @item nrm
  7436. Preserve normalized value of RGB triplet.
  7437. @item pwr
  7438. Preserve power value of RGB triplet.
  7439. @end table
  7440. @end table
  7441. @subsection Examples
  7442. @itemize
  7443. @item
  7444. Make video output darker:
  7445. @example
  7446. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  7447. @end example
  7448. @item
  7449. Increase contrast:
  7450. @example
  7451. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  7452. @end example
  7453. @item
  7454. Make video output lighter:
  7455. @example
  7456. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  7457. @end example
  7458. @item
  7459. Increase brightness:
  7460. @example
  7461. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  7462. @end example
  7463. @end itemize
  7464. @subsection Commands
  7465. This filter supports the all above options as @ref{commands}.
  7466. @section colormap
  7467. Apply custom color maps to video stream.
  7468. This filter needs three input video streams.
  7469. First stream is video stream that is going to be filtered out.
  7470. Second and third video stream specify color patches for source
  7471. color to target color mapping.
  7472. The filter accepts the following options:
  7473. @table @option
  7474. @item patch_size
  7475. Set the source and target video stream patch size in pixels.
  7476. @item nb_patches
  7477. Set the max number of used patches from source and target video stream.
  7478. Default value is number of patches available in additional video streams.
  7479. Max allowed number of patches is @code{64}.
  7480. @item type
  7481. Set the adjustments used for target colors. Can be @code{relative} or @code{absolute}.
  7482. Defaults is @code{absolute}.
  7483. @item kernel
  7484. Set the kernel used to measure color differences between mapped colors.
  7485. The accepted values are:
  7486. @table @samp
  7487. @item euclidean
  7488. @item weuclidean
  7489. @end table
  7490. Default is @code{euclidean}.
  7491. @end table
  7492. @section colormatrix
  7493. Convert color matrix.
  7494. The filter accepts the following options:
  7495. @table @option
  7496. @item src
  7497. @item dst
  7498. Specify the source and destination color matrix. Both values must be
  7499. specified.
  7500. The accepted values are:
  7501. @table @samp
  7502. @item bt709
  7503. BT.709
  7504. @item fcc
  7505. FCC
  7506. @item bt601
  7507. BT.601
  7508. @item bt470
  7509. BT.470
  7510. @item bt470bg
  7511. BT.470BG
  7512. @item smpte170m
  7513. SMPTE-170M
  7514. @item smpte240m
  7515. SMPTE-240M
  7516. @item bt2020
  7517. BT.2020
  7518. @end table
  7519. @end table
  7520. For example to convert from BT.601 to SMPTE-240M, use the command:
  7521. @example
  7522. colormatrix=bt601:smpte240m
  7523. @end example
  7524. @section colorspace
  7525. Convert colorspace, transfer characteristics or color primaries.
  7526. Input video needs to have an even size.
  7527. The filter accepts the following options:
  7528. @table @option
  7529. @anchor{all}
  7530. @item all
  7531. Specify all color properties at once.
  7532. The accepted values are:
  7533. @table @samp
  7534. @item bt470m
  7535. BT.470M
  7536. @item bt470bg
  7537. BT.470BG
  7538. @item bt601-6-525
  7539. BT.601-6 525
  7540. @item bt601-6-625
  7541. BT.601-6 625
  7542. @item bt709
  7543. BT.709
  7544. @item smpte170m
  7545. SMPTE-170M
  7546. @item smpte240m
  7547. SMPTE-240M
  7548. @item bt2020
  7549. BT.2020
  7550. @end table
  7551. @anchor{space}
  7552. @item space
  7553. Specify output colorspace.
  7554. The accepted values are:
  7555. @table @samp
  7556. @item bt709
  7557. BT.709
  7558. @item fcc
  7559. FCC
  7560. @item bt470bg
  7561. BT.470BG or BT.601-6 625
  7562. @item smpte170m
  7563. SMPTE-170M or BT.601-6 525
  7564. @item smpte240m
  7565. SMPTE-240M
  7566. @item ycgco
  7567. YCgCo
  7568. @item bt2020ncl
  7569. BT.2020 with non-constant luminance
  7570. @end table
  7571. @anchor{trc}
  7572. @item trc
  7573. Specify output transfer characteristics.
  7574. The accepted values are:
  7575. @table @samp
  7576. @item bt709
  7577. BT.709
  7578. @item bt470m
  7579. BT.470M
  7580. @item bt470bg
  7581. BT.470BG
  7582. @item gamma22
  7583. Constant gamma of 2.2
  7584. @item gamma28
  7585. Constant gamma of 2.8
  7586. @item smpte170m
  7587. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  7588. @item smpte240m
  7589. SMPTE-240M
  7590. @item srgb
  7591. SRGB
  7592. @item iec61966-2-1
  7593. iec61966-2-1
  7594. @item iec61966-2-4
  7595. iec61966-2-4
  7596. @item xvycc
  7597. xvycc
  7598. @item bt2020-10
  7599. BT.2020 for 10-bits content
  7600. @item bt2020-12
  7601. BT.2020 for 12-bits content
  7602. @end table
  7603. @anchor{primaries}
  7604. @item primaries
  7605. Specify output color primaries.
  7606. The accepted values are:
  7607. @table @samp
  7608. @item bt709
  7609. BT.709
  7610. @item bt470m
  7611. BT.470M
  7612. @item bt470bg
  7613. BT.470BG or BT.601-6 625
  7614. @item smpte170m
  7615. SMPTE-170M or BT.601-6 525
  7616. @item smpte240m
  7617. SMPTE-240M
  7618. @item film
  7619. film
  7620. @item smpte431
  7621. SMPTE-431
  7622. @item smpte432
  7623. SMPTE-432
  7624. @item bt2020
  7625. BT.2020
  7626. @item jedec-p22
  7627. JEDEC P22 phosphors
  7628. @end table
  7629. @anchor{range}
  7630. @item range
  7631. Specify output color range.
  7632. The accepted values are:
  7633. @table @samp
  7634. @item tv
  7635. TV (restricted) range
  7636. @item mpeg
  7637. MPEG (restricted) range
  7638. @item pc
  7639. PC (full) range
  7640. @item jpeg
  7641. JPEG (full) range
  7642. @end table
  7643. @item format
  7644. Specify output color format.
  7645. The accepted values are:
  7646. @table @samp
  7647. @item yuv420p
  7648. YUV 4:2:0 planar 8-bits
  7649. @item yuv420p10
  7650. YUV 4:2:0 planar 10-bits
  7651. @item yuv420p12
  7652. YUV 4:2:0 planar 12-bits
  7653. @item yuv422p
  7654. YUV 4:2:2 planar 8-bits
  7655. @item yuv422p10
  7656. YUV 4:2:2 planar 10-bits
  7657. @item yuv422p12
  7658. YUV 4:2:2 planar 12-bits
  7659. @item yuv444p
  7660. YUV 4:4:4 planar 8-bits
  7661. @item yuv444p10
  7662. YUV 4:4:4 planar 10-bits
  7663. @item yuv444p12
  7664. YUV 4:4:4 planar 12-bits
  7665. @end table
  7666. @item fast
  7667. Do a fast conversion, which skips gamma/primary correction. This will take
  7668. significantly less CPU, but will be mathematically incorrect. To get output
  7669. compatible with that produced by the colormatrix filter, use fast=1.
  7670. @item dither
  7671. Specify dithering mode.
  7672. The accepted values are:
  7673. @table @samp
  7674. @item none
  7675. No dithering
  7676. @item fsb
  7677. Floyd-Steinberg dithering
  7678. @end table
  7679. @item wpadapt
  7680. Whitepoint adaptation mode.
  7681. The accepted values are:
  7682. @table @samp
  7683. @item bradford
  7684. Bradford whitepoint adaptation
  7685. @item vonkries
  7686. von Kries whitepoint adaptation
  7687. @item identity
  7688. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  7689. @end table
  7690. @item iall
  7691. Override all input properties at once. Same accepted values as @ref{all}.
  7692. @item ispace
  7693. Override input colorspace. Same accepted values as @ref{space}.
  7694. @item iprimaries
  7695. Override input color primaries. Same accepted values as @ref{primaries}.
  7696. @item itrc
  7697. Override input transfer characteristics. Same accepted values as @ref{trc}.
  7698. @item irange
  7699. Override input color range. Same accepted values as @ref{range}.
  7700. @end table
  7701. The filter converts the transfer characteristics, color space and color
  7702. primaries to the specified user values. The output value, if not specified,
  7703. is set to a default value based on the "all" property. If that property is
  7704. also not specified, the filter will log an error. The output color range and
  7705. format default to the same value as the input color range and format. The
  7706. input transfer characteristics, color space, color primaries and color range
  7707. should be set on the input data. If any of these are missing, the filter will
  7708. log an error and no conversion will take place.
  7709. For example to convert the input to SMPTE-240M, use the command:
  7710. @example
  7711. colorspace=smpte240m
  7712. @end example
  7713. @section colorspace_cuda
  7714. CUDA accelerated implementation of the colorspace filter.
  7715. It is by no means feature complete compared to the software colorspace filter,
  7716. and at the current time only supports color range conversion between jpeg/full
  7717. and mpeg/limited range.
  7718. The filter accepts the following options:
  7719. @table @option
  7720. @item range
  7721. Specify output color range.
  7722. The accepted values are:
  7723. @table @samp
  7724. @item tv
  7725. TV (restricted) range
  7726. @item mpeg
  7727. MPEG (restricted) range
  7728. @item pc
  7729. PC (full) range
  7730. @item jpeg
  7731. JPEG (full) range
  7732. @end table
  7733. @end table
  7734. @section colortemperature
  7735. Adjust color temperature in video to simulate variations in ambient color temperature.
  7736. The filter accepts the following options:
  7737. @table @option
  7738. @item temperature
  7739. Set the temperature in Kelvin. Allowed range is from 1000 to 40000.
  7740. Default value is 6500 K.
  7741. @item mix
  7742. Set mixing with filtered output. Allowed range is from 0 to 1.
  7743. Default value is 1.
  7744. @item pl
  7745. Set the amount of preserving lightness. Allowed range is from 0 to 1.
  7746. Default value is 0.
  7747. @end table
  7748. @subsection Commands
  7749. This filter supports same @ref{commands} as options.
  7750. @section convolution
  7751. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  7752. The filter accepts the following options:
  7753. @table @option
  7754. @item 0m
  7755. @item 1m
  7756. @item 2m
  7757. @item 3m
  7758. Set matrix for each plane.
  7759. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  7760. and from 1 to 49 odd number of signed integers in @var{row} mode.
  7761. @item 0rdiv
  7762. @item 1rdiv
  7763. @item 2rdiv
  7764. @item 3rdiv
  7765. Set multiplier for calculated value for each plane.
  7766. If unset or 0, it will be sum of all matrix elements.
  7767. @item 0bias
  7768. @item 1bias
  7769. @item 2bias
  7770. @item 3bias
  7771. Set bias for each plane. This value is added to the result of the multiplication.
  7772. Useful for making the overall image brighter or darker. Default is 0.0.
  7773. @item 0mode
  7774. @item 1mode
  7775. @item 2mode
  7776. @item 3mode
  7777. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  7778. Default is @var{square}.
  7779. @end table
  7780. @subsection Commands
  7781. This filter supports the all above options as @ref{commands}.
  7782. @subsection Examples
  7783. @itemize
  7784. @item
  7785. Apply sharpen:
  7786. @example
  7787. 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"
  7788. @end example
  7789. @item
  7790. Apply blur:
  7791. @example
  7792. 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"
  7793. @end example
  7794. @item
  7795. Apply edge enhance:
  7796. @example
  7797. 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"
  7798. @end example
  7799. @item
  7800. Apply edge detect:
  7801. @example
  7802. 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"
  7803. @end example
  7804. @item
  7805. Apply laplacian edge detector which includes diagonals:
  7806. @example
  7807. 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"
  7808. @end example
  7809. @item
  7810. Apply emboss:
  7811. @example
  7812. 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"
  7813. @end example
  7814. @end itemize
  7815. @section convolve
  7816. Apply 2D convolution of video stream in frequency domain using second stream
  7817. as impulse.
  7818. The filter accepts the following options:
  7819. @table @option
  7820. @item planes
  7821. Set which planes to process.
  7822. @item impulse
  7823. Set which impulse video frames will be processed, can be @var{first}
  7824. or @var{all}. Default is @var{all}.
  7825. @end table
  7826. The @code{convolve} filter also supports the @ref{framesync} options.
  7827. @section copy
  7828. Copy the input video source unchanged to the output. This is mainly useful for
  7829. testing purposes.
  7830. @anchor{coreimage}
  7831. @section coreimage
  7832. Video filtering on GPU using Apple's CoreImage API on OSX.
  7833. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  7834. processed by video hardware. However, software-based OpenGL implementations
  7835. exist which means there is no guarantee for hardware processing. It depends on
  7836. the respective OSX.
  7837. There are many filters and image generators provided by Apple that come with a
  7838. large variety of options. The filter has to be referenced by its name along
  7839. with its options.
  7840. The coreimage filter accepts the following options:
  7841. @table @option
  7842. @item list_filters
  7843. List all available filters and generators along with all their respective
  7844. options as well as possible minimum and maximum values along with the default
  7845. values.
  7846. @example
  7847. list_filters=true
  7848. @end example
  7849. @item filter
  7850. Specify all filters by their respective name and options.
  7851. Use @var{list_filters} to determine all valid filter names and options.
  7852. Numerical options are specified by a float value and are automatically clamped
  7853. to their respective value range. Vector and color options have to be specified
  7854. by a list of space separated float values. Character escaping has to be done.
  7855. A special option name @code{default} is available to use default options for a
  7856. filter.
  7857. It is required to specify either @code{default} or at least one of the filter options.
  7858. All omitted options are used with their default values.
  7859. The syntax of the filter string is as follows:
  7860. @example
  7861. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  7862. @end example
  7863. @item output_rect
  7864. Specify a rectangle where the output of the filter chain is copied into the
  7865. input image. It is given by a list of space separated float values:
  7866. @example
  7867. output_rect=x\ y\ width\ height
  7868. @end example
  7869. If not given, the output rectangle equals the dimensions of the input image.
  7870. The output rectangle is automatically cropped at the borders of the input
  7871. image. Negative values are valid for each component.
  7872. @example
  7873. output_rect=25\ 25\ 100\ 100
  7874. @end example
  7875. @end table
  7876. Several filters can be chained for successive processing without GPU-HOST
  7877. transfers allowing for fast processing of complex filter chains.
  7878. Currently, only filters with zero (generators) or exactly one (filters) input
  7879. image and one output image are supported. Also, transition filters are not yet
  7880. usable as intended.
  7881. Some filters generate output images with additional padding depending on the
  7882. respective filter kernel. The padding is automatically removed to ensure the
  7883. filter output has the same size as the input image.
  7884. For image generators, the size of the output image is determined by the
  7885. previous output image of the filter chain or the input image of the whole
  7886. filterchain, respectively. The generators do not use the pixel information of
  7887. this image to generate their output. However, the generated output is
  7888. blended onto this image, resulting in partial or complete coverage of the
  7889. output image.
  7890. The @ref{coreimagesrc} video source can be used for generating input images
  7891. which are directly fed into the filter chain. By using it, providing input
  7892. images by another video source or an input video is not required.
  7893. @subsection Examples
  7894. @itemize
  7895. @item
  7896. List all filters available:
  7897. @example
  7898. coreimage=list_filters=true
  7899. @end example
  7900. @item
  7901. Use the CIBoxBlur filter with default options to blur an image:
  7902. @example
  7903. coreimage=filter=CIBoxBlur@@default
  7904. @end example
  7905. @item
  7906. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  7907. its center at 100x100 and a radius of 50 pixels:
  7908. @example
  7909. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  7910. @end example
  7911. @item
  7912. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  7913. given as complete and escaped command-line for Apple's standard bash shell:
  7914. @example
  7915. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  7916. @end example
  7917. @end itemize
  7918. @section corr
  7919. Obtain the correlation between two input videos.
  7920. This filter takes two input videos.
  7921. Both input videos must have the same resolution and pixel format for
  7922. this filter to work correctly. Also it assumes that both inputs
  7923. have the same number of frames, which are compared one by one.
  7924. The obtained per component, average, min and max correlation is printed through
  7925. the logging system.
  7926. The filter stores the calculated correlation of each frame in frame metadata.
  7927. This filter also supports the @ref{framesync} options.
  7928. In the below example the input file @file{main.mpg} being processed is compared
  7929. with the reference file @file{ref.mpg}.
  7930. @example
  7931. ffmpeg -i main.mpg -i ref.mpg -lavfi corr -f null -
  7932. @end example
  7933. @section cover_rect
  7934. Cover a rectangular object
  7935. It accepts the following options:
  7936. @table @option
  7937. @item cover
  7938. Filepath of the optional cover image, needs to be in yuv420.
  7939. @item mode
  7940. Set covering mode.
  7941. It accepts the following values:
  7942. @table @samp
  7943. @item cover
  7944. cover it by the supplied image
  7945. @item blur
  7946. cover it by interpolating the surrounding pixels
  7947. @end table
  7948. Default value is @var{blur}.
  7949. @end table
  7950. @subsection Examples
  7951. @itemize
  7952. @item
  7953. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  7954. @example
  7955. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7956. @end example
  7957. @end itemize
  7958. @section crop
  7959. Crop the input video to given dimensions.
  7960. It accepts the following parameters:
  7961. @table @option
  7962. @item w, out_w
  7963. The width of the output video. It defaults to @code{iw}.
  7964. This expression is evaluated only once during the filter
  7965. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  7966. @item h, out_h
  7967. The height of the output video. It defaults to @code{ih}.
  7968. This expression is evaluated only once during the filter
  7969. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  7970. @item x
  7971. The horizontal position, in the input video, of the left edge of the output
  7972. video. It defaults to @code{(in_w-out_w)/2}.
  7973. This expression is evaluated per-frame.
  7974. @item y
  7975. The vertical position, in the input video, of the top edge of the output video.
  7976. It defaults to @code{(in_h-out_h)/2}.
  7977. This expression is evaluated per-frame.
  7978. @item keep_aspect
  7979. If set to 1 will force the output display aspect ratio
  7980. to be the same of the input, by changing the output sample aspect
  7981. ratio. It defaults to 0.
  7982. @item exact
  7983. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  7984. width/height/x/y as specified and will not be rounded to nearest smaller value.
  7985. It defaults to 0.
  7986. @end table
  7987. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  7988. expressions containing the following constants:
  7989. @table @option
  7990. @item x
  7991. @item y
  7992. The computed values for @var{x} and @var{y}. They are evaluated for
  7993. each new frame.
  7994. @item in_w
  7995. @item in_h
  7996. The input width and height.
  7997. @item iw
  7998. @item ih
  7999. These are the same as @var{in_w} and @var{in_h}.
  8000. @item out_w
  8001. @item out_h
  8002. The output (cropped) width and height.
  8003. @item ow
  8004. @item oh
  8005. These are the same as @var{out_w} and @var{out_h}.
  8006. @item a
  8007. same as @var{iw} / @var{ih}
  8008. @item sar
  8009. input sample aspect ratio
  8010. @item dar
  8011. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8012. @item hsub
  8013. @item vsub
  8014. horizontal and vertical chroma subsample values. For example for the
  8015. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8016. @item n
  8017. The number of the input frame, starting from 0.
  8018. @item pos
  8019. the position in the file of the input frame, NAN if unknown
  8020. @item t
  8021. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  8022. @end table
  8023. The expression for @var{out_w} may depend on the value of @var{out_h},
  8024. and the expression for @var{out_h} may depend on @var{out_w}, but they
  8025. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  8026. evaluated after @var{out_w} and @var{out_h}.
  8027. The @var{x} and @var{y} parameters specify the expressions for the
  8028. position of the top-left corner of the output (non-cropped) area. They
  8029. are evaluated for each frame. If the evaluated value is not valid, it
  8030. is approximated to the nearest valid value.
  8031. The expression for @var{x} may depend on @var{y}, and the expression
  8032. for @var{y} may depend on @var{x}.
  8033. @subsection Examples
  8034. @itemize
  8035. @item
  8036. Crop area with size 100x100 at position (12,34).
  8037. @example
  8038. crop=100:100:12:34
  8039. @end example
  8040. Using named options, the example above becomes:
  8041. @example
  8042. crop=w=100:h=100:x=12:y=34
  8043. @end example
  8044. @item
  8045. Crop the central input area with size 100x100:
  8046. @example
  8047. crop=100:100
  8048. @end example
  8049. @item
  8050. Crop the central input area with size 2/3 of the input video:
  8051. @example
  8052. crop=2/3*in_w:2/3*in_h
  8053. @end example
  8054. @item
  8055. Crop the input video central square:
  8056. @example
  8057. crop=out_w=in_h
  8058. crop=in_h
  8059. @end example
  8060. @item
  8061. Delimit the rectangle with the top-left corner placed at position
  8062. 100:100 and the right-bottom corner corresponding to the right-bottom
  8063. corner of the input image.
  8064. @example
  8065. crop=in_w-100:in_h-100:100:100
  8066. @end example
  8067. @item
  8068. Crop 10 pixels from the left and right borders, and 20 pixels from
  8069. the top and bottom borders
  8070. @example
  8071. crop=in_w-2*10:in_h-2*20
  8072. @end example
  8073. @item
  8074. Keep only the bottom right quarter of the input image:
  8075. @example
  8076. crop=in_w/2:in_h/2:in_w/2:in_h/2
  8077. @end example
  8078. @item
  8079. Crop height for getting Greek harmony:
  8080. @example
  8081. crop=in_w:1/PHI*in_w
  8082. @end example
  8083. @item
  8084. Apply trembling effect:
  8085. @example
  8086. 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)
  8087. @end example
  8088. @item
  8089. Apply erratic camera effect depending on timestamp:
  8090. @example
  8091. 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)"
  8092. @end example
  8093. @item
  8094. Set x depending on the value of y:
  8095. @example
  8096. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  8097. @end example
  8098. @end itemize
  8099. @subsection Commands
  8100. This filter supports the following commands:
  8101. @table @option
  8102. @item w, out_w
  8103. @item h, out_h
  8104. @item x
  8105. @item y
  8106. Set width/height of the output video and the horizontal/vertical position
  8107. in the input video.
  8108. The command accepts the same syntax of the corresponding option.
  8109. If the specified expression is not valid, it is kept at its current
  8110. value.
  8111. @end table
  8112. @section cropdetect
  8113. Auto-detect the crop size.
  8114. It calculates the necessary cropping parameters and prints the
  8115. recommended parameters via the logging system. The detected dimensions
  8116. correspond to the non-black or video area of the input video according to @var{mode}.
  8117. It accepts the following parameters:
  8118. @table @option
  8119. @item mode
  8120. Depending on @var{mode} crop detection is based on either the mere black value of surrounding pixels or a combination of motion vectors and edge pixels.
  8121. @table @samp
  8122. @item black
  8123. Detect black pixels surrounding the playing video. For fine control use option @var{limit}.
  8124. @item mvedges
  8125. Detect the playing video by the motion vectors inside the video and scanning for edge pixels typically forming the border of a playing video.
  8126. @end table
  8127. @item limit
  8128. Set higher black value threshold, which can be optionally specified
  8129. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  8130. value greater to the set value is considered non-black. It defaults to 24.
  8131. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  8132. on the bitdepth of the pixel format.
  8133. @item round
  8134. The value which the width/height should be divisible by. It defaults to
  8135. 16. The offset is automatically adjusted to center the video. Use 2 to
  8136. get only even dimensions (needed for 4:2:2 video). 16 is best when
  8137. encoding to most video codecs.
  8138. @item skip
  8139. Set the number of initial frames for which evaluation is skipped.
  8140. Default is 2. Range is 0 to INT_MAX.
  8141. @item reset_count, reset
  8142. Set the counter that determines after how many frames cropdetect will
  8143. reset the previously detected largest video area and start over to
  8144. detect the current optimal crop area. Default value is 0.
  8145. This can be useful when channel logos distort the video area. 0
  8146. indicates 'never reset', and returns the largest area encountered during
  8147. playback.
  8148. @item mv_threshold
  8149. Set motion in pixel units as threshold for motion detection. It defaults to 8.
  8150. @item low
  8151. @item high
  8152. Set low and high threshold values used by the Canny thresholding
  8153. algorithm.
  8154. The high threshold selects the "strong" edge pixels, which are then
  8155. connected through 8-connectivity with the "weak" edge pixels selected
  8156. by the low threshold.
  8157. @var{low} and @var{high} threshold values must be chosen in the range
  8158. [0,1], and @var{low} should be lesser or equal to @var{high}.
  8159. Default value for @var{low} is @code{5/255}, and default value for @var{high}
  8160. is @code{15/255}.
  8161. @end table
  8162. @subsection Examples
  8163. @itemize
  8164. @item
  8165. Find video area surrounded by black borders:
  8166. @example
  8167. ffmpeg -i file.mp4 -vf cropdetect,metadata=mode=print -f null -
  8168. @end example
  8169. @item
  8170. Find an embedded video area, generate motion vectors beforehand:
  8171. @example
  8172. ffmpeg -i file.mp4 -vf mestimate,cropdetect=mode=mvedges,metadata=mode=print -f null -
  8173. @end example
  8174. @item
  8175. Find an embedded video area, use motion vectors from decoder:
  8176. @example
  8177. ffmpeg -flags2 +export_mvs -i file.mp4 -vf cropdetect=mode=mvedges,metadata=mode=print -f null -
  8178. @end example
  8179. @end itemize
  8180. @subsection Commands
  8181. This filter supports the following commands:
  8182. @table @option
  8183. @item limit
  8184. The command accepts the same syntax of the corresponding option.
  8185. If the specified expression is not valid, it is kept at its current value.
  8186. @end table
  8187. @anchor{cue}
  8188. @section cue
  8189. Delay video filtering until a given wallclock timestamp. The filter first
  8190. passes on @option{preroll} amount of frames, then it buffers at most
  8191. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  8192. it forwards the buffered frames and also any subsequent frames coming in its
  8193. input.
  8194. The filter can be used synchronize the output of multiple ffmpeg processes for
  8195. realtime output devices like decklink. By putting the delay in the filtering
  8196. chain and pre-buffering frames the process can pass on data to output almost
  8197. immediately after the target wallclock timestamp is reached.
  8198. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  8199. some use cases.
  8200. @table @option
  8201. @item cue
  8202. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  8203. @item preroll
  8204. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  8205. @item buffer
  8206. The maximum duration of content to buffer before waiting for the cue expressed
  8207. in seconds. Default is 0.
  8208. @end table
  8209. @anchor{curves}
  8210. @section curves
  8211. Apply color adjustments using curves.
  8212. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  8213. component (red, green and blue) has its values defined by @var{N} key points
  8214. tied from each other using a smooth curve. The x-axis represents the pixel
  8215. values from the input frame, and the y-axis the new pixel values to be set for
  8216. the output frame.
  8217. By default, a component curve is defined by the two points @var{(0;0)} and
  8218. @var{(1;1)}. This creates a straight line where each original pixel value is
  8219. "adjusted" to its own value, which means no change to the image.
  8220. The filter allows you to redefine these two points and add some more. A new
  8221. curve will be define to pass smoothly through all these new coordinates. The
  8222. new defined points needs to be strictly increasing over the x-axis, and their
  8223. @var{x} and @var{y} values must be in the @var{[0;1]} interval. The curve is
  8224. formed by using a natural or monotonic cubic spline interpolation, depending
  8225. on the @var{interp} option (default: @code{natural}). The @code{natural}
  8226. spline produces a smoother curve in general while the monotonic (@code{pchip})
  8227. spline guarantees the transitions between the specified points to be
  8228. monotonic. If the computed curves happened to go outside the vector spaces,
  8229. the values will be clipped accordingly.
  8230. The filter accepts the following options:
  8231. @table @option
  8232. @item preset
  8233. Select one of the available color presets. This option can be used in addition
  8234. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  8235. options takes priority on the preset values.
  8236. Available presets are:
  8237. @table @samp
  8238. @item none
  8239. @item color_negative
  8240. @item cross_process
  8241. @item darker
  8242. @item increase_contrast
  8243. @item lighter
  8244. @item linear_contrast
  8245. @item medium_contrast
  8246. @item negative
  8247. @item strong_contrast
  8248. @item vintage
  8249. @end table
  8250. Default is @code{none}.
  8251. @item master, m
  8252. Set the master key points. These points will define a second pass mapping. It
  8253. is sometimes called a "luminance" or "value" mapping. It can be used with
  8254. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  8255. post-processing LUT.
  8256. @item red, r
  8257. Set the key points for the red component.
  8258. @item green, g
  8259. Set the key points for the green component.
  8260. @item blue, b
  8261. Set the key points for the blue component.
  8262. @item all
  8263. Set the key points for all components (not including master).
  8264. Can be used in addition to the other key points component
  8265. options. In this case, the unset component(s) will fallback on this
  8266. @option{all} setting.
  8267. @item psfile
  8268. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  8269. @item plot
  8270. Save Gnuplot script of the curves in specified file.
  8271. @item interp
  8272. Specify the kind of interpolation. Available algorithms are:
  8273. @table @samp
  8274. @item natural
  8275. Natural cubic spline using a piece-wise cubic polynomial that is twice continuously differentiable.
  8276. @item pchip
  8277. Monotonic cubic spline using a piecewise cubic Hermite interpolating polynomial (PCHIP).
  8278. @end table
  8279. @end table
  8280. To avoid some filtergraph syntax conflicts, each key points list need to be
  8281. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  8282. @subsection Commands
  8283. This filter supports same @ref{commands} as options.
  8284. @subsection Examples
  8285. @itemize
  8286. @item
  8287. Increase slightly the middle level of blue:
  8288. @example
  8289. curves=blue='0/0 0.5/0.58 1/1'
  8290. @end example
  8291. @item
  8292. Vintage effect:
  8293. @example
  8294. 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'
  8295. @end example
  8296. Here we obtain the following coordinates for each components:
  8297. @table @var
  8298. @item red
  8299. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  8300. @item green
  8301. @code{(0;0) (0.50;0.48) (1;1)}
  8302. @item blue
  8303. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  8304. @end table
  8305. @item
  8306. The previous example can also be achieved with the associated built-in preset:
  8307. @example
  8308. curves=preset=vintage
  8309. @end example
  8310. @item
  8311. Or simply:
  8312. @example
  8313. curves=vintage
  8314. @end example
  8315. @item
  8316. Use a Photoshop preset and redefine the points of the green component:
  8317. @example
  8318. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  8319. @end example
  8320. @item
  8321. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  8322. and @command{gnuplot}:
  8323. @example
  8324. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  8325. gnuplot -p /tmp/curves.plt
  8326. @end example
  8327. @end itemize
  8328. @section datascope
  8329. Video data analysis filter.
  8330. This filter shows hexadecimal pixel values of part of video.
  8331. The filter accepts the following options:
  8332. @table @option
  8333. @item size, s
  8334. Set output video size.
  8335. @item x
  8336. Set x offset from where to pick pixels.
  8337. @item y
  8338. Set y offset from where to pick pixels.
  8339. @item mode
  8340. Set scope mode, can be one of the following:
  8341. @table @samp
  8342. @item mono
  8343. Draw hexadecimal pixel values with white color on black background.
  8344. @item color
  8345. Draw hexadecimal pixel values with input video pixel color on black
  8346. background.
  8347. @item color2
  8348. Draw hexadecimal pixel values on color background picked from input video,
  8349. the text color is picked in such way so its always visible.
  8350. @end table
  8351. @item axis
  8352. Draw rows and columns numbers on left and top of video.
  8353. @item opacity
  8354. Set background opacity.
  8355. @item format
  8356. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  8357. @item components
  8358. Set pixel components to display. By default all pixel components are displayed.
  8359. @end table
  8360. @subsection Commands
  8361. This filter supports same @ref{commands} as options excluding @code{size} option.
  8362. @section dblur
  8363. Apply Directional blur filter.
  8364. The filter accepts the following options:
  8365. @table @option
  8366. @item angle
  8367. Set angle of directional blur. Default is @code{45}.
  8368. @item radius
  8369. Set radius of directional blur. Default is @code{5}.
  8370. @item planes
  8371. Set which planes to filter. By default all planes are filtered.
  8372. @end table
  8373. @subsection Commands
  8374. This filter supports same @ref{commands} as options.
  8375. The command accepts the same syntax of the corresponding option.
  8376. If the specified expression is not valid, it is kept at its current
  8377. value.
  8378. @section dctdnoiz
  8379. Denoise frames using 2D DCT (frequency domain filtering).
  8380. This filter is not designed for real time.
  8381. The filter accepts the following options:
  8382. @table @option
  8383. @item sigma, s
  8384. Set the noise sigma constant.
  8385. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  8386. coefficient (absolute value) below this threshold with be dropped.
  8387. If you need a more advanced filtering, see @option{expr}.
  8388. Default is @code{0}.
  8389. @item overlap
  8390. Set number overlapping pixels for each block. Since the filter can be slow, you
  8391. may want to reduce this value, at the cost of a less effective filter and the
  8392. risk of various artefacts.
  8393. If the overlapping value doesn't permit processing the whole input width or
  8394. height, a warning will be displayed and according borders won't be denoised.
  8395. Default value is @var{blocksize}-1, which is the best possible setting.
  8396. @item expr, e
  8397. Set the coefficient factor expression.
  8398. For each coefficient of a DCT block, this expression will be evaluated as a
  8399. multiplier value for the coefficient.
  8400. If this is option is set, the @option{sigma} option will be ignored.
  8401. The absolute value of the coefficient can be accessed through the @var{c}
  8402. variable.
  8403. @item n
  8404. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  8405. @var{blocksize}, which is the width and height of the processed blocks.
  8406. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  8407. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  8408. on the speed processing. Also, a larger block size does not necessarily means a
  8409. better de-noising.
  8410. @end table
  8411. @subsection Examples
  8412. Apply a denoise with a @option{sigma} of @code{4.5}:
  8413. @example
  8414. dctdnoiz=4.5
  8415. @end example
  8416. The same operation can be achieved using the expression system:
  8417. @example
  8418. dctdnoiz=e='gte(c, 4.5*3)'
  8419. @end example
  8420. Violent denoise using a block size of @code{16x16}:
  8421. @example
  8422. dctdnoiz=15:n=4
  8423. @end example
  8424. @section deband
  8425. Remove banding artifacts from input video.
  8426. It works by replacing banded pixels with average value of referenced pixels.
  8427. The filter accepts the following options:
  8428. @table @option
  8429. @item 1thr
  8430. @item 2thr
  8431. @item 3thr
  8432. @item 4thr
  8433. Set banding detection threshold for each plane. Default is 0.02.
  8434. Valid range is 0.00003 to 0.5.
  8435. If difference between current pixel and reference pixel is less than threshold,
  8436. it will be considered as banded.
  8437. @item range, r
  8438. Banding detection range in pixels. Default is 16. If positive, random number
  8439. in range 0 to set value will be used. If negative, exact absolute value
  8440. will be used.
  8441. The range defines square of four pixels around current pixel.
  8442. @item direction, d
  8443. Set direction in radians from which four pixel will be compared. If positive,
  8444. random direction from 0 to set direction will be picked. If negative, exact of
  8445. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  8446. will pick only pixels on same row and -PI/2 will pick only pixels on same
  8447. column.
  8448. @item blur, b
  8449. If enabled, current pixel is compared with average value of all four
  8450. surrounding pixels. The default is enabled. If disabled current pixel is
  8451. compared with all four surrounding pixels. The pixel is considered banded
  8452. if only all four differences with surrounding pixels are less than threshold.
  8453. @item coupling, c
  8454. If enabled, current pixel is changed if and only if all pixel components are banded,
  8455. e.g. banding detection threshold is triggered for all color components.
  8456. The default is disabled.
  8457. @end table
  8458. @subsection Commands
  8459. This filter supports the all above options as @ref{commands}.
  8460. @section deblock
  8461. Remove blocking artifacts from input video.
  8462. The filter accepts the following options:
  8463. @table @option
  8464. @item filter
  8465. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  8466. This controls what kind of deblocking is applied.
  8467. @item block
  8468. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  8469. @item alpha
  8470. @item beta
  8471. @item gamma
  8472. @item delta
  8473. Set blocking detection thresholds. Allowed range is 0 to 1.
  8474. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  8475. Using higher threshold gives more deblocking strength.
  8476. Setting @var{alpha} controls threshold detection at exact edge of block.
  8477. Remaining options controls threshold detection near the edge. Each one for
  8478. below/above or left/right. Setting any of those to @var{0} disables
  8479. deblocking.
  8480. @item planes
  8481. Set planes to filter. Default is to filter all available planes.
  8482. @end table
  8483. @subsection Examples
  8484. @itemize
  8485. @item
  8486. Deblock using weak filter and block size of 4 pixels.
  8487. @example
  8488. deblock=filter=weak:block=4
  8489. @end example
  8490. @item
  8491. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  8492. deblocking more edges.
  8493. @example
  8494. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  8495. @end example
  8496. @item
  8497. Similar as above, but filter only first plane.
  8498. @example
  8499. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  8500. @end example
  8501. @item
  8502. Similar as above, but filter only second and third plane.
  8503. @example
  8504. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  8505. @end example
  8506. @end itemize
  8507. @subsection Commands
  8508. This filter supports the all above options as @ref{commands}.
  8509. @anchor{decimate}
  8510. @section decimate
  8511. Drop duplicated frames at regular intervals.
  8512. The filter accepts the following options:
  8513. @table @option
  8514. @item cycle
  8515. Set the number of frames from which one will be dropped. Setting this to
  8516. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  8517. Default is @code{5}.
  8518. @item dupthresh
  8519. Set the threshold for duplicate detection. If the difference metric for a frame
  8520. is less than or equal to this value, then it is declared as duplicate. Default
  8521. is @code{1.1}
  8522. @item scthresh
  8523. Set scene change threshold. Default is @code{15}.
  8524. @item blockx
  8525. @item blocky
  8526. Set the size of the x and y-axis blocks used during metric calculations.
  8527. Larger blocks give better noise suppression, but also give worse detection of
  8528. small movements. Must be a power of two. Default is @code{32}.
  8529. @item ppsrc
  8530. Mark main input as a pre-processed input and activate clean source input
  8531. stream. This allows the input to be pre-processed with various filters to help
  8532. the metrics calculation while keeping the frame selection lossless. When set to
  8533. @code{1}, the first stream is for the pre-processed input, and the second
  8534. stream is the clean source from where the kept frames are chosen. Default is
  8535. @code{0}.
  8536. @item chroma
  8537. Set whether or not chroma is considered in the metric calculations. Default is
  8538. @code{1}.
  8539. @item mixed
  8540. Set whether or not the input only partially contains content to be decimated.
  8541. Default is @code{false}.
  8542. If enabled video output stream will be in variable frame rate.
  8543. @end table
  8544. @section deconvolve
  8545. Apply 2D deconvolution of video stream in frequency domain using second stream
  8546. as impulse.
  8547. The filter accepts the following options:
  8548. @table @option
  8549. @item planes
  8550. Set which planes to process.
  8551. @item impulse
  8552. Set which impulse video frames will be processed, can be @var{first}
  8553. or @var{all}. Default is @var{all}.
  8554. @item noise
  8555. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  8556. and height are not same and not power of 2 or if stream prior to convolving
  8557. had noise.
  8558. @end table
  8559. The @code{deconvolve} filter also supports the @ref{framesync} options.
  8560. @section dedot
  8561. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  8562. It accepts the following options:
  8563. @table @option
  8564. @item m
  8565. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  8566. @var{rainbows} for cross-color reduction.
  8567. @item lt
  8568. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  8569. @item tl
  8570. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  8571. @item tc
  8572. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  8573. @item ct
  8574. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  8575. @end table
  8576. @section deflate
  8577. Apply deflate effect to the video.
  8578. This filter replaces the pixel by the local(3x3) average by taking into account
  8579. only values lower than the pixel.
  8580. It accepts the following options:
  8581. @table @option
  8582. @item threshold0
  8583. @item threshold1
  8584. @item threshold2
  8585. @item threshold3
  8586. Limit the maximum change for each plane, default is 65535.
  8587. If 0, plane will remain unchanged.
  8588. @end table
  8589. @subsection Commands
  8590. This filter supports the all above options as @ref{commands}.
  8591. @section deflicker
  8592. Remove temporal frame luminance variations.
  8593. It accepts the following options:
  8594. @table @option
  8595. @item size, s
  8596. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  8597. @item mode, m
  8598. Set averaging mode to smooth temporal luminance variations.
  8599. Available values are:
  8600. @table @samp
  8601. @item am
  8602. Arithmetic mean
  8603. @item gm
  8604. Geometric mean
  8605. @item hm
  8606. Harmonic mean
  8607. @item qm
  8608. Quadratic mean
  8609. @item cm
  8610. Cubic mean
  8611. @item pm
  8612. Power mean
  8613. @item median
  8614. Median
  8615. @end table
  8616. @item bypass
  8617. Do not actually modify frame. Useful when one only wants metadata.
  8618. @end table
  8619. @section dejudder
  8620. Remove judder produced by partially interlaced telecined content.
  8621. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  8622. source was partially telecined content then the output of @code{pullup,dejudder}
  8623. will have a variable frame rate. May change the recorded frame rate of the
  8624. container. Aside from that change, this filter will not affect constant frame
  8625. rate video.
  8626. The option available in this filter is:
  8627. @table @option
  8628. @item cycle
  8629. Specify the length of the window over which the judder repeats.
  8630. Accepts any integer greater than 1. Useful values are:
  8631. @table @samp
  8632. @item 4
  8633. If the original was telecined from 24 to 30 fps (Film to NTSC).
  8634. @item 5
  8635. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  8636. @item 20
  8637. If a mixture of the two.
  8638. @end table
  8639. The default is @samp{4}.
  8640. @end table
  8641. @section delogo
  8642. Suppress a TV station logo by a simple interpolation of the surrounding
  8643. pixels. Just set a rectangle covering the logo and watch it disappear
  8644. (and sometimes something even uglier appear - your mileage may vary).
  8645. It accepts the following parameters:
  8646. @table @option
  8647. @item x
  8648. @item y
  8649. Specify the top left corner coordinates of the logo. They must be
  8650. specified.
  8651. @item w
  8652. @item h
  8653. Specify the width and height of the logo to clear. They must be
  8654. specified.
  8655. @item show
  8656. When set to 1, a green rectangle is drawn on the screen to simplify
  8657. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  8658. The default value is 0.
  8659. The rectangle is drawn on the outermost pixels which will be (partly)
  8660. replaced with interpolated values. The values of the next pixels
  8661. immediately outside this rectangle in each direction will be used to
  8662. compute the interpolated pixel values inside the rectangle.
  8663. @end table
  8664. @subsection Examples
  8665. @itemize
  8666. @item
  8667. Set a rectangle covering the area with top left corner coordinates 0,0
  8668. and size 100x77:
  8669. @example
  8670. delogo=x=0:y=0:w=100:h=77
  8671. @end example
  8672. @end itemize
  8673. @anchor{derain}
  8674. @section derain
  8675. Remove the rain in the input image/video by applying the derain methods based on
  8676. convolutional neural networks. Supported models:
  8677. @itemize
  8678. @item
  8679. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  8680. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  8681. @end itemize
  8682. Training as well as model generation scripts are provided in
  8683. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  8684. Native model files (.model) can be generated from TensorFlow model
  8685. files (.pb) by using tools/python/convert.py
  8686. The filter accepts the following options:
  8687. @table @option
  8688. @item filter_type
  8689. Specify which filter to use. This option accepts the following values:
  8690. @table @samp
  8691. @item derain
  8692. Derain filter. To conduct derain filter, you need to use a derain model.
  8693. @item dehaze
  8694. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  8695. @end table
  8696. Default value is @samp{derain}.
  8697. @item dnn_backend
  8698. Specify which DNN backend to use for model loading and execution. This option accepts
  8699. the following values:
  8700. @table @samp
  8701. @item native
  8702. Native implementation of DNN loading and execution.
  8703. @item tensorflow
  8704. TensorFlow backend. To enable this backend you
  8705. need to install the TensorFlow for C library (see
  8706. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  8707. @code{--enable-libtensorflow}
  8708. @end table
  8709. Default value is @samp{native}.
  8710. @item model
  8711. Set path to model file specifying network architecture and its parameters.
  8712. Note that different backends use different file formats. TensorFlow and native
  8713. backend can load files for only its format.
  8714. @end table
  8715. To get full functionality (such as async execution), please use the @ref{dnn_processing} filter.
  8716. @section deshake
  8717. Attempt to fix small changes in horizontal and/or vertical shift. This
  8718. filter helps remove camera shake from hand-holding a camera, bumping a
  8719. tripod, moving on a vehicle, etc.
  8720. The filter accepts the following options:
  8721. @table @option
  8722. @item x
  8723. @item y
  8724. @item w
  8725. @item h
  8726. Specify a rectangular area where to limit the search for motion
  8727. vectors.
  8728. If desired the search for motion vectors can be limited to a
  8729. rectangular area of the frame defined by its top left corner, width
  8730. and height. These parameters have the same meaning as the drawbox
  8731. filter which can be used to visualise the position of the bounding
  8732. box.
  8733. This is useful when simultaneous movement of subjects within the frame
  8734. might be confused for camera motion by the motion vector search.
  8735. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  8736. then the full frame is used. This allows later options to be set
  8737. without specifying the bounding box for the motion vector search.
  8738. Default - search the whole frame.
  8739. @item rx
  8740. @item ry
  8741. Specify the maximum extent of movement in x and y directions in the
  8742. range 0-64 pixels. Default 16.
  8743. @item edge
  8744. Specify how to generate pixels to fill blanks at the edge of the
  8745. frame. Available values are:
  8746. @table @samp
  8747. @item blank, 0
  8748. Fill zeroes at blank locations
  8749. @item original, 1
  8750. Original image at blank locations
  8751. @item clamp, 2
  8752. Extruded edge value at blank locations
  8753. @item mirror, 3
  8754. Mirrored edge at blank locations
  8755. @end table
  8756. Default value is @samp{mirror}.
  8757. @item blocksize
  8758. Specify the blocksize to use for motion search. Range 4-128 pixels,
  8759. default 8.
  8760. @item contrast
  8761. Specify the contrast threshold for blocks. Only blocks with more than
  8762. the specified contrast (difference between darkest and lightest
  8763. pixels) will be considered. Range 1-255, default 125.
  8764. @item search
  8765. Specify the search strategy. Available values are:
  8766. @table @samp
  8767. @item exhaustive, 0
  8768. Set exhaustive search
  8769. @item less, 1
  8770. Set less exhaustive search.
  8771. @end table
  8772. Default value is @samp{exhaustive}.
  8773. @item filename
  8774. If set then a detailed log of the motion search is written to the
  8775. specified file.
  8776. @end table
  8777. @section despill
  8778. Remove unwanted contamination of foreground colors, caused by reflected color of
  8779. greenscreen or bluescreen.
  8780. This filter accepts the following options:
  8781. @table @option
  8782. @item type
  8783. Set what type of despill to use.
  8784. @item mix
  8785. Set how spillmap will be generated.
  8786. @item expand
  8787. Set how much to get rid of still remaining spill.
  8788. @item red
  8789. Controls amount of red in spill area.
  8790. @item green
  8791. Controls amount of green in spill area.
  8792. Should be -1 for greenscreen.
  8793. @item blue
  8794. Controls amount of blue in spill area.
  8795. Should be -1 for bluescreen.
  8796. @item brightness
  8797. Controls brightness of spill area, preserving colors.
  8798. @item alpha
  8799. Modify alpha from generated spillmap.
  8800. @end table
  8801. @subsection Commands
  8802. This filter supports the all above options as @ref{commands}.
  8803. @section detelecine
  8804. Apply an exact inverse of the telecine operation. It requires a predefined
  8805. pattern specified using the pattern option which must be the same as that passed
  8806. to the telecine filter.
  8807. This filter accepts the following options:
  8808. @table @option
  8809. @item first_field
  8810. @table @samp
  8811. @item top, t
  8812. top field first
  8813. @item bottom, b
  8814. bottom field first
  8815. The default value is @code{top}.
  8816. @end table
  8817. @item pattern
  8818. A string of numbers representing the pulldown pattern you wish to apply.
  8819. The default value is @code{23}.
  8820. @item start_frame
  8821. A number representing position of the first frame with respect to the telecine
  8822. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  8823. @end table
  8824. @anchor{dilation}
  8825. @section dilation
  8826. Apply dilation effect to the video.
  8827. This filter replaces the pixel by the local(3x3) maximum.
  8828. It accepts the following options:
  8829. @table @option
  8830. @item threshold0
  8831. @item threshold1
  8832. @item threshold2
  8833. @item threshold3
  8834. Limit the maximum change for each plane, default is 65535.
  8835. If 0, plane will remain unchanged.
  8836. @item coordinates
  8837. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  8838. pixels are used.
  8839. Flags to local 3x3 coordinates maps like this:
  8840. 1 2 3
  8841. 4 5
  8842. 6 7 8
  8843. @end table
  8844. @subsection Commands
  8845. This filter supports the all above options as @ref{commands}.
  8846. @section displace
  8847. Displace pixels as indicated by second and third input stream.
  8848. It takes three input streams and outputs one stream, the first input is the
  8849. source, and second and third input are displacement maps.
  8850. The second input specifies how much to displace pixels along the
  8851. x-axis, while the third input specifies how much to displace pixels
  8852. along the y-axis.
  8853. If one of displacement map streams terminates, last frame from that
  8854. displacement map will be used.
  8855. Note that once generated, displacements maps can be reused over and over again.
  8856. A description of the accepted options follows.
  8857. @table @option
  8858. @item edge
  8859. Set displace behavior for pixels that are out of range.
  8860. Available values are:
  8861. @table @samp
  8862. @item blank
  8863. Missing pixels are replaced by black pixels.
  8864. @item smear
  8865. Adjacent pixels will spread out to replace missing pixels.
  8866. @item wrap
  8867. Out of range pixels are wrapped so they point to pixels of other side.
  8868. @item mirror
  8869. Out of range pixels will be replaced with mirrored pixels.
  8870. @end table
  8871. Default is @samp{smear}.
  8872. @end table
  8873. @subsection Examples
  8874. @itemize
  8875. @item
  8876. Add ripple effect to rgb input of video size hd720:
  8877. @example
  8878. 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
  8879. @end example
  8880. @item
  8881. Add wave effect to rgb input of video size hd720:
  8882. @example
  8883. 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
  8884. @end example
  8885. @end itemize
  8886. @section dnn_classify
  8887. Do classification with deep neural networks based on bounding boxes.
  8888. The filter accepts the following options:
  8889. @table @option
  8890. @item dnn_backend
  8891. Specify which DNN backend to use for model loading and execution. This option accepts
  8892. only openvino now, tensorflow backends will be added.
  8893. @item model
  8894. Set path to model file specifying network architecture and its parameters.
  8895. Note that different backends use different file formats.
  8896. @item input
  8897. Set the input name of the dnn network.
  8898. @item output
  8899. Set the output name of the dnn network.
  8900. @item confidence
  8901. Set the confidence threshold (default: 0.5).
  8902. @item labels
  8903. Set path to label file specifying the mapping between label id and name.
  8904. Each label name is written in one line, tailing spaces and empty lines are skipped.
  8905. The first line is the name of label id 0,
  8906. and the second line is the name of label id 1, etc.
  8907. The label id is considered as name if the label file is not provided.
  8908. @item backend_configs
  8909. Set the configs to be passed into backend
  8910. For tensorflow backend, you can set its configs with @option{sess_config} options,
  8911. please use tools/python/tf_sess_config.py to get the configs for your system.
  8912. @end table
  8913. @section dnn_detect
  8914. Do object detection with deep neural networks.
  8915. The filter accepts the following options:
  8916. @table @option
  8917. @item dnn_backend
  8918. Specify which DNN backend to use for model loading and execution. This option accepts
  8919. only openvino now, tensorflow backends will be added.
  8920. @item model
  8921. Set path to model file specifying network architecture and its parameters.
  8922. Note that different backends use different file formats.
  8923. @item input
  8924. Set the input name of the dnn network.
  8925. @item output
  8926. Set the output name of the dnn network.
  8927. @item confidence
  8928. Set the confidence threshold (default: 0.5).
  8929. @item labels
  8930. Set path to label file specifying the mapping between label id and name.
  8931. Each label name is written in one line, tailing spaces and empty lines are skipped.
  8932. The first line is the name of label id 0 (usually it is 'background'),
  8933. and the second line is the name of label id 1, etc.
  8934. The label id is considered as name if the label file is not provided.
  8935. @item backend_configs
  8936. Set the configs to be passed into backend. To use async execution, set async (default: set).
  8937. Roll back to sync execution if the backend does not support async.
  8938. @end table
  8939. @anchor{dnn_processing}
  8940. @section dnn_processing
  8941. Do image processing with deep neural networks. It works together with another filter
  8942. which converts the pixel format of the Frame to what the dnn network requires.
  8943. The filter accepts the following options:
  8944. @table @option
  8945. @item dnn_backend
  8946. Specify which DNN backend to use for model loading and execution. This option accepts
  8947. the following values:
  8948. @table @samp
  8949. @item native
  8950. Native implementation of DNN loading and execution.
  8951. @item tensorflow
  8952. TensorFlow backend. To enable this backend you
  8953. need to install the TensorFlow for C library (see
  8954. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  8955. @code{--enable-libtensorflow}
  8956. @item openvino
  8957. OpenVINO backend. To enable this backend you
  8958. need to build and install the OpenVINO for C library (see
  8959. @url{https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md}) and configure FFmpeg with
  8960. @code{--enable-libopenvino} (--extra-cflags=-I... --extra-ldflags=-L... might
  8961. be needed if the header files and libraries are not installed into system path)
  8962. @end table
  8963. Default value is @samp{native}.
  8964. @item model
  8965. Set path to model file specifying network architecture and its parameters.
  8966. Note that different backends use different file formats. TensorFlow, OpenVINO and native
  8967. backend can load files for only its format.
  8968. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  8969. @item input
  8970. Set the input name of the dnn network.
  8971. @item output
  8972. Set the output name of the dnn network.
  8973. @item backend_configs
  8974. Set the configs to be passed into backend. To use async execution, set async (default: set).
  8975. Roll back to sync execution if the backend does not support async.
  8976. For tensorflow backend, you can set its configs with @option{sess_config} options,
  8977. please use tools/python/tf_sess_config.py to get the configs of TensorFlow backend for your system.
  8978. @end table
  8979. @subsection Examples
  8980. @itemize
  8981. @item
  8982. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  8983. @example
  8984. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  8985. @end example
  8986. @item
  8987. Halve the pixel value of the frame with format gray32f:
  8988. @example
  8989. 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
  8990. @end example
  8991. @item
  8992. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  8993. @example
  8994. ./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
  8995. @end example
  8996. @item
  8997. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported),
  8998. please use tools/python/tf_sess_config.py to get the configs of TensorFlow backend for your system.
  8999. @example
  9000. ./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
  9001. @end example
  9002. @end itemize
  9003. @section drawbox
  9004. Draw a colored box on the input image.
  9005. It accepts the following parameters:
  9006. @table @option
  9007. @item x
  9008. @item y
  9009. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  9010. @item width, w
  9011. @item height, h
  9012. The expressions which specify the width and height of the box; if 0 they are interpreted as
  9013. the input width and height. It defaults to 0.
  9014. @item color, c
  9015. Specify the color of the box to write. For the general syntax of this option,
  9016. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  9017. value @code{invert} is used, the box edge color is the same as the
  9018. video with inverted luma.
  9019. @item thickness, t
  9020. The expression which sets the thickness of the box edge.
  9021. A value of @code{fill} will create a filled box. Default value is @code{3}.
  9022. See below for the list of accepted constants.
  9023. @item replace
  9024. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  9025. will overwrite the video's color and alpha pixels.
  9026. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  9027. @end table
  9028. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  9029. following constants:
  9030. @table @option
  9031. @item dar
  9032. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  9033. @item hsub
  9034. @item vsub
  9035. horizontal and vertical chroma subsample values. For example for the
  9036. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9037. @item in_h, ih
  9038. @item in_w, iw
  9039. The input width and height.
  9040. @item sar
  9041. The input sample aspect ratio.
  9042. @item x
  9043. @item y
  9044. The x and y offset coordinates where the box is drawn.
  9045. @item w
  9046. @item h
  9047. The width and height of the drawn box.
  9048. @item box_source
  9049. Box source can be set as side_data_detection_bboxes if you want to use box data in
  9050. detection bboxes of side data.
  9051. If @var{box_source} is set, the @var{x}, @var{y}, @var{width} and @var{height} will be ignored and
  9052. still use box data in detection bboxes of side data. So please do not use this parameter if you were
  9053. not sure about the box source.
  9054. @item t
  9055. The thickness of the drawn box.
  9056. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  9057. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  9058. @end table
  9059. @subsection Examples
  9060. @itemize
  9061. @item
  9062. Draw a black box around the edge of the input image:
  9063. @example
  9064. drawbox
  9065. @end example
  9066. @item
  9067. Draw a box with color red and an opacity of 50%:
  9068. @example
  9069. drawbox=10:20:200:60:red@@0.5
  9070. @end example
  9071. The previous example can be specified as:
  9072. @example
  9073. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  9074. @end example
  9075. @item
  9076. Fill the box with pink color:
  9077. @example
  9078. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  9079. @end example
  9080. @item
  9081. Draw a 2-pixel red 2.40:1 mask:
  9082. @example
  9083. 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
  9084. @end example
  9085. @end itemize
  9086. @subsection Commands
  9087. This filter supports same commands as options.
  9088. The command accepts the same syntax of the corresponding option.
  9089. If the specified expression is not valid, it is kept at its current
  9090. value.
  9091. @anchor{drawgraph}
  9092. @section drawgraph
  9093. Draw a graph using input video metadata.
  9094. It accepts the following parameters:
  9095. @table @option
  9096. @item m1
  9097. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  9098. @item fg1
  9099. Set 1st foreground color expression.
  9100. @item m2
  9101. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  9102. @item fg2
  9103. Set 2nd foreground color expression.
  9104. @item m3
  9105. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  9106. @item fg3
  9107. Set 3rd foreground color expression.
  9108. @item m4
  9109. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  9110. @item fg4
  9111. Set 4th foreground color expression.
  9112. @item min
  9113. Set minimal value of metadata value.
  9114. @item max
  9115. Set maximal value of metadata value.
  9116. @item bg
  9117. Set graph background color. Default is white.
  9118. @item mode
  9119. Set graph mode.
  9120. Available values for mode is:
  9121. @table @samp
  9122. @item bar
  9123. @item dot
  9124. @item line
  9125. @end table
  9126. Default is @code{line}.
  9127. @item slide
  9128. Set slide mode.
  9129. Available values for slide is:
  9130. @table @samp
  9131. @item frame
  9132. Draw new frame when right border is reached.
  9133. @item replace
  9134. Replace old columns with new ones.
  9135. @item scroll
  9136. Scroll from right to left.
  9137. @item rscroll
  9138. Scroll from left to right.
  9139. @item picture
  9140. Draw single picture.
  9141. @end table
  9142. Default is @code{frame}.
  9143. @item size
  9144. Set size of graph video. For the syntax of this option, check the
  9145. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9146. The default value is @code{900x256}.
  9147. @item rate, r
  9148. Set the output frame rate. Default value is @code{25}.
  9149. The foreground color expressions can use the following variables:
  9150. @table @option
  9151. @item MIN
  9152. Minimal value of metadata value.
  9153. @item MAX
  9154. Maximal value of metadata value.
  9155. @item VAL
  9156. Current metadata key value.
  9157. @end table
  9158. The color is defined as 0xAABBGGRR.
  9159. @end table
  9160. Example using metadata from @ref{signalstats} filter:
  9161. @example
  9162. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  9163. @end example
  9164. Example using metadata from @ref{ebur128} filter:
  9165. @example
  9166. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  9167. @end example
  9168. @section drawgrid
  9169. Draw a grid on the input image.
  9170. It accepts the following parameters:
  9171. @table @option
  9172. @item x
  9173. @item y
  9174. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  9175. @item width, w
  9176. @item height, h
  9177. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  9178. input width and height, respectively, minus @code{thickness}, so image gets
  9179. framed. Default to 0.
  9180. @item color, c
  9181. Specify the color of the grid. For the general syntax of this option,
  9182. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  9183. value @code{invert} is used, the grid color is the same as the
  9184. video with inverted luma.
  9185. @item thickness, t
  9186. The expression which sets the thickness of the grid line. Default value is @code{1}.
  9187. See below for the list of accepted constants.
  9188. @item replace
  9189. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  9190. will overwrite the video's color and alpha pixels.
  9191. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  9192. @end table
  9193. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  9194. following constants:
  9195. @table @option
  9196. @item dar
  9197. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  9198. @item hsub
  9199. @item vsub
  9200. horizontal and vertical chroma subsample values. For example for the
  9201. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9202. @item in_h, ih
  9203. @item in_w, iw
  9204. The input grid cell width and height.
  9205. @item sar
  9206. The input sample aspect ratio.
  9207. @item x
  9208. @item y
  9209. The x and y coordinates of some point of grid intersection (meant to configure offset).
  9210. @item w
  9211. @item h
  9212. The width and height of the drawn cell.
  9213. @item t
  9214. The thickness of the drawn cell.
  9215. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  9216. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  9217. @end table
  9218. @subsection Examples
  9219. @itemize
  9220. @item
  9221. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  9222. @example
  9223. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  9224. @end example
  9225. @item
  9226. Draw a white 3x3 grid with an opacity of 50%:
  9227. @example
  9228. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  9229. @end example
  9230. @end itemize
  9231. @subsection Commands
  9232. This filter supports same commands as options.
  9233. The command accepts the same syntax of the corresponding option.
  9234. If the specified expression is not valid, it is kept at its current
  9235. value.
  9236. @anchor{drawtext}
  9237. @section drawtext
  9238. Draw a text string or text from a specified file on top of a video, using the
  9239. libfreetype library.
  9240. To enable compilation of this filter, you need to configure FFmpeg with
  9241. @code{--enable-libfreetype}.
  9242. To enable default font fallback and the @var{font} option you need to
  9243. configure FFmpeg with @code{--enable-libfontconfig}.
  9244. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  9245. @code{--enable-libfribidi}.
  9246. @subsection Syntax
  9247. It accepts the following parameters:
  9248. @table @option
  9249. @item box
  9250. Used to draw a box around text using the background color.
  9251. The value must be either 1 (enable) or 0 (disable).
  9252. The default value of @var{box} is 0.
  9253. @item boxborderw
  9254. Set the width of the border to be drawn around the box using @var{boxcolor}.
  9255. The default value of @var{boxborderw} is 0.
  9256. @item boxcolor
  9257. The color to be used for drawing box around text. For the syntax of this
  9258. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9259. The default value of @var{boxcolor} is "white".
  9260. @item line_spacing
  9261. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  9262. The default value of @var{line_spacing} is 0.
  9263. @item borderw
  9264. Set the width of the border to be drawn around the text using @var{bordercolor}.
  9265. The default value of @var{borderw} is 0.
  9266. @item bordercolor
  9267. Set the color to be used for drawing border around text. For the syntax of this
  9268. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9269. The default value of @var{bordercolor} is "black".
  9270. @item expansion
  9271. Select how the @var{text} is expanded. Can be either @code{none},
  9272. @code{strftime} (deprecated) or
  9273. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  9274. below for details.
  9275. @item basetime
  9276. Set a start time for the count. Value is in microseconds. Only applied
  9277. in the deprecated strftime expansion mode. To emulate in normal expansion
  9278. mode use the @code{pts} function, supplying the start time (in seconds)
  9279. as the second argument.
  9280. @item fix_bounds
  9281. If true, check and fix text coords to avoid clipping.
  9282. @item fontcolor
  9283. The color to be used for drawing fonts. For the syntax of this option, check
  9284. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9285. The default value of @var{fontcolor} is "black".
  9286. @item fontcolor_expr
  9287. String which is expanded the same way as @var{text} to obtain dynamic
  9288. @var{fontcolor} value. By default this option has empty value and is not
  9289. processed. When this option is set, it overrides @var{fontcolor} option.
  9290. @item font
  9291. The font family to be used for drawing text. By default Sans.
  9292. @item fontfile
  9293. The font file to be used for drawing text. The path must be included.
  9294. This parameter is mandatory if the fontconfig support is disabled.
  9295. @item alpha
  9296. Draw the text applying alpha blending. The value can
  9297. be a number between 0.0 and 1.0.
  9298. The expression accepts the same variables @var{x, y} as well.
  9299. The default value is 1.
  9300. Please see @var{fontcolor_expr}.
  9301. @item fontsize
  9302. The font size to be used for drawing text.
  9303. The default value of @var{fontsize} is 16.
  9304. @item text_shaping
  9305. If set to 1, attempt to shape the text (for example, reverse the order of
  9306. right-to-left text and join Arabic characters) before drawing it.
  9307. Otherwise, just draw the text exactly as given.
  9308. By default 1 (if supported).
  9309. @item ft_load_flags
  9310. The flags to be used for loading the fonts.
  9311. The flags map the corresponding flags supported by libfreetype, and are
  9312. a combination of the following values:
  9313. @table @var
  9314. @item default
  9315. @item no_scale
  9316. @item no_hinting
  9317. @item render
  9318. @item no_bitmap
  9319. @item vertical_layout
  9320. @item force_autohint
  9321. @item crop_bitmap
  9322. @item pedantic
  9323. @item ignore_global_advance_width
  9324. @item no_recurse
  9325. @item ignore_transform
  9326. @item monochrome
  9327. @item linear_design
  9328. @item no_autohint
  9329. @end table
  9330. Default value is "default".
  9331. For more information consult the documentation for the FT_LOAD_*
  9332. libfreetype flags.
  9333. @item shadowcolor
  9334. The color to be used for drawing a shadow behind the drawn text. For the
  9335. syntax of this option, check the @ref{color syntax,,"Color" section in the
  9336. ffmpeg-utils manual,ffmpeg-utils}.
  9337. The default value of @var{shadowcolor} is "black".
  9338. @item shadowx
  9339. @item shadowy
  9340. The x and y offsets for the text shadow position with respect to the
  9341. position of the text. They can be either positive or negative
  9342. values. The default value for both is "0".
  9343. @item start_number
  9344. The starting frame number for the n/frame_num variable. The default value
  9345. is "0".
  9346. @item tabsize
  9347. The size in number of spaces to use for rendering the tab.
  9348. Default value is 4.
  9349. @item timecode
  9350. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  9351. format. It can be used with or without text parameter. @var{timecode_rate}
  9352. option must be specified.
  9353. @item timecode_rate, rate, r
  9354. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  9355. integer. Minimum value is "1".
  9356. Drop-frame timecode is supported for frame rates 30 & 60.
  9357. @item tc24hmax
  9358. If set to 1, the output of the timecode option will wrap around at 24 hours.
  9359. Default is 0 (disabled).
  9360. @item text
  9361. The text string to be drawn. The text must be a sequence of UTF-8
  9362. encoded characters.
  9363. This parameter is mandatory if no file is specified with the parameter
  9364. @var{textfile}.
  9365. @item textfile
  9366. A text file containing text to be drawn. The text must be a sequence
  9367. of UTF-8 encoded characters.
  9368. This parameter is mandatory if no text string is specified with the
  9369. parameter @var{text}.
  9370. If both @var{text} and @var{textfile} are specified, an error is thrown.
  9371. @item text_source
  9372. Text source should be set as side_data_detection_bboxes if you want to use text data in
  9373. detection bboxes of side data.
  9374. If text source is set, @var{text} and @var{textfile} will be ignored and still use
  9375. text data in detection bboxes of side data. So please do not use this parameter
  9376. if you are not sure about the text source.
  9377. @item reload
  9378. The @var{textfile} will be reloaded at specified frame interval.
  9379. Be sure to update @var{textfile} atomically, or it may be read partially,
  9380. or even fail.
  9381. Range is 0 to INT_MAX. Default is 0.
  9382. @item x
  9383. @item y
  9384. The expressions which specify the offsets where text will be drawn
  9385. within the video frame. They are relative to the top/left border of the
  9386. output image.
  9387. The default value of @var{x} and @var{y} is "0".
  9388. See below for the list of accepted constants and functions.
  9389. @end table
  9390. The parameters for @var{x} and @var{y} are expressions containing the
  9391. following constants and functions:
  9392. @table @option
  9393. @item dar
  9394. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  9395. @item hsub
  9396. @item vsub
  9397. horizontal and vertical chroma subsample values. For example for the
  9398. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9399. @item line_h, lh
  9400. the height of each text line
  9401. @item main_h, h, H
  9402. the input height
  9403. @item main_w, w, W
  9404. the input width
  9405. @item max_glyph_a, ascent
  9406. the maximum distance from the baseline to the highest/upper grid
  9407. coordinate used to place a glyph outline point, for all the rendered
  9408. glyphs.
  9409. It is a positive value, due to the grid's orientation with the Y axis
  9410. upwards.
  9411. @item max_glyph_d, descent
  9412. the maximum distance from the baseline to the lowest grid coordinate
  9413. used to place a glyph outline point, for all the rendered glyphs.
  9414. This is a negative value, due to the grid's orientation, with the Y axis
  9415. upwards.
  9416. @item max_glyph_h
  9417. maximum glyph height, that is the maximum height for all the glyphs
  9418. contained in the rendered text, it is equivalent to @var{ascent} -
  9419. @var{descent}.
  9420. @item max_glyph_w
  9421. maximum glyph width, that is the maximum width for all the glyphs
  9422. contained in the rendered text
  9423. @item n
  9424. the number of input frame, starting from 0
  9425. @item rand(min, max)
  9426. return a random number included between @var{min} and @var{max}
  9427. @item sar
  9428. The input sample aspect ratio.
  9429. @item t
  9430. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9431. @item text_h, th
  9432. the height of the rendered text
  9433. @item text_w, tw
  9434. the width of the rendered text
  9435. @item x
  9436. @item y
  9437. the x and y offset coordinates where the text is drawn.
  9438. These parameters allow the @var{x} and @var{y} expressions to refer
  9439. to each other, so you can for example specify @code{y=x/dar}.
  9440. @item pict_type
  9441. A one character description of the current frame's picture type.
  9442. @item pkt_pos
  9443. The current packet's position in the input file or stream
  9444. (in bytes, from the start of the input). A value of -1 indicates
  9445. this info is not available.
  9446. @item duration
  9447. The current packet's duration, in seconds.
  9448. @item pkt_size
  9449. The current packet's size (in bytes).
  9450. @end table
  9451. @anchor{drawtext_expansion}
  9452. @subsection Text expansion
  9453. If @option{expansion} is set to @code{strftime},
  9454. the filter recognizes strftime() sequences in the provided text and
  9455. expands them accordingly. Check the documentation of strftime(). This
  9456. feature is deprecated.
  9457. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  9458. If @option{expansion} is set to @code{normal} (which is the default),
  9459. the following expansion mechanism is used.
  9460. The backslash character @samp{\}, followed by any character, always expands to
  9461. the second character.
  9462. Sequences of the form @code{%@{...@}} are expanded. The text between the
  9463. braces is a function name, possibly followed by arguments separated by ':'.
  9464. If the arguments contain special characters or delimiters (':' or '@}'),
  9465. they should be escaped.
  9466. Note that they probably must also be escaped as the value for the
  9467. @option{text} option in the filter argument string and as the filter
  9468. argument in the filtergraph description, and possibly also for the shell,
  9469. that makes up to four levels of escaping; using a text file avoids these
  9470. problems.
  9471. The following functions are available:
  9472. @table @command
  9473. @item expr, e
  9474. The expression evaluation result.
  9475. It must take one argument specifying the expression to be evaluated,
  9476. which accepts the same constants and functions as the @var{x} and
  9477. @var{y} values. Note that not all constants should be used, for
  9478. example the text size is not known when evaluating the expression, so
  9479. the constants @var{text_w} and @var{text_h} will have an undefined
  9480. value.
  9481. @item expr_int_format, eif
  9482. Evaluate the expression's value and output as formatted integer.
  9483. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  9484. The second argument specifies the output format. Allowed values are @samp{x},
  9485. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  9486. @code{printf} function.
  9487. The third parameter is optional and sets the number of positions taken by the output.
  9488. It can be used to add padding with zeros from the left.
  9489. @item gmtime
  9490. The time at which the filter is running, expressed in UTC.
  9491. It can accept an argument: a strftime() format string.
  9492. The format string is extended to support the variable @var{%[1-6]N}
  9493. which prints fractions of the second with optionally specified number of digits.
  9494. @item localtime
  9495. The time at which the filter is running, expressed in the local time zone.
  9496. It can accept an argument: a strftime() format string.
  9497. The format string is extended to support the variable @var{%[1-6]N}
  9498. which prints fractions of the second with optionally specified number of digits.
  9499. @item metadata
  9500. Frame metadata. Takes one or two arguments.
  9501. The first argument is mandatory and specifies the metadata key.
  9502. The second argument is optional and specifies a default value, used when the
  9503. metadata key is not found or empty.
  9504. Available metadata can be identified by inspecting entries
  9505. starting with TAG included within each frame section
  9506. printed by running @code{ffprobe -show_frames}.
  9507. String metadata generated in filters leading to
  9508. the drawtext filter are also available.
  9509. @item n, frame_num
  9510. The frame number, starting from 0.
  9511. @item pict_type
  9512. A one character description of the current picture type.
  9513. @item pts
  9514. The timestamp of the current frame.
  9515. It can take up to three arguments.
  9516. The first argument is the format of the timestamp; it defaults to @code{flt}
  9517. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  9518. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  9519. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  9520. @code{localtime} stands for the timestamp of the frame formatted as
  9521. local time zone time.
  9522. The second argument is an offset added to the timestamp.
  9523. If the format is set to @code{hms}, a third argument @code{24HH} may be
  9524. supplied to present the hour part of the formatted timestamp in 24h format
  9525. (00-23).
  9526. If the format is set to @code{localtime} or @code{gmtime},
  9527. a third argument may be supplied: a strftime() format string.
  9528. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  9529. @end table
  9530. @subsection Commands
  9531. This filter supports altering parameters via commands:
  9532. @table @option
  9533. @item reinit
  9534. Alter existing filter parameters.
  9535. Syntax for the argument is the same as for filter invocation, e.g.
  9536. @example
  9537. fontsize=56:fontcolor=green:text='Hello World'
  9538. @end example
  9539. Full filter invocation with sendcmd would look like this:
  9540. @example
  9541. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  9542. @end example
  9543. @end table
  9544. If the entire argument can't be parsed or applied as valid values then the filter will
  9545. continue with its existing parameters.
  9546. @subsection Examples
  9547. @itemize
  9548. @item
  9549. Draw "Test Text" with font FreeSerif, using the default values for the
  9550. optional parameters.
  9551. @example
  9552. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  9553. @end example
  9554. @item
  9555. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  9556. and y=50 (counting from the top-left corner of the screen), text is
  9557. yellow with a red box around it. Both the text and the box have an
  9558. opacity of 20%.
  9559. @example
  9560. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  9561. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  9562. @end example
  9563. Note that the double quotes are not necessary if spaces are not used
  9564. within the parameter list.
  9565. @item
  9566. Show the text at the center of the video frame:
  9567. @example
  9568. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  9569. @end example
  9570. @item
  9571. Show the text at a random position, switching to a new position every 30 seconds:
  9572. @example
  9573. 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)"
  9574. @end example
  9575. @item
  9576. Show a text line sliding from right to left in the last row of the video
  9577. frame. The file @file{LONG_LINE} is assumed to contain a single line
  9578. with no newlines.
  9579. @example
  9580. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  9581. @end example
  9582. @item
  9583. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  9584. @example
  9585. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  9586. @end example
  9587. @item
  9588. Draw a single green letter "g", at the center of the input video.
  9589. The glyph baseline is placed at half screen height.
  9590. @example
  9591. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  9592. @end example
  9593. @item
  9594. Show text for 1 second every 3 seconds:
  9595. @example
  9596. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  9597. @end example
  9598. @item
  9599. Use fontconfig to set the font. Note that the colons need to be escaped.
  9600. @example
  9601. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  9602. @end example
  9603. @item
  9604. Draw "Test Text" with font size dependent on height of the video.
  9605. @example
  9606. drawtext="text='Test Text': fontsize=h/30: x=(w-text_w)/2: y=(h-text_h*2)"
  9607. @end example
  9608. @item
  9609. Print the date of a real-time encoding (see strftime(3)):
  9610. @example
  9611. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  9612. @end example
  9613. @item
  9614. Show text fading in and out (appearing/disappearing):
  9615. @example
  9616. #!/bin/sh
  9617. DS=1.0 # display start
  9618. DE=10.0 # display end
  9619. FID=1.5 # fade in duration
  9620. FOD=5 # fade out duration
  9621. 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 @}"
  9622. @end example
  9623. @item
  9624. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  9625. and the @option{fontsize} value are included in the @option{y} offset.
  9626. @example
  9627. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  9628. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  9629. @end example
  9630. @item
  9631. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  9632. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  9633. must have option @option{-export_path_metadata 1} for the special metadata fields
  9634. to be available for filters.
  9635. @example
  9636. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  9637. @end example
  9638. @end itemize
  9639. For more information about libfreetype, check:
  9640. @url{http://www.freetype.org/}.
  9641. For more information about fontconfig, check:
  9642. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  9643. For more information about libfribidi, check:
  9644. @url{http://fribidi.org/}.
  9645. @section edgedetect
  9646. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  9647. The filter accepts the following options:
  9648. @table @option
  9649. @item low
  9650. @item high
  9651. Set low and high threshold values used by the Canny thresholding
  9652. algorithm.
  9653. The high threshold selects the "strong" edge pixels, which are then
  9654. connected through 8-connectivity with the "weak" edge pixels selected
  9655. by the low threshold.
  9656. @var{low} and @var{high} threshold values must be chosen in the range
  9657. [0,1], and @var{low} should be lesser or equal to @var{high}.
  9658. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  9659. is @code{50/255}.
  9660. @item mode
  9661. Define the drawing mode.
  9662. @table @samp
  9663. @item wires
  9664. Draw white/gray wires on black background.
  9665. @item colormix
  9666. Mix the colors to create a paint/cartoon effect.
  9667. @item canny
  9668. Apply Canny edge detector on all selected planes.
  9669. @end table
  9670. Default value is @var{wires}.
  9671. @item planes
  9672. Select planes for filtering. By default all available planes are filtered.
  9673. @end table
  9674. @subsection Examples
  9675. @itemize
  9676. @item
  9677. Standard edge detection with custom values for the hysteresis thresholding:
  9678. @example
  9679. edgedetect=low=0.1:high=0.4
  9680. @end example
  9681. @item
  9682. Painting effect without thresholding:
  9683. @example
  9684. edgedetect=mode=colormix:high=0
  9685. @end example
  9686. @end itemize
  9687. @section elbg
  9688. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  9689. For each input image, the filter will compute the optimal mapping from
  9690. the input to the output given the codebook length, that is the number
  9691. of distinct output colors.
  9692. This filter accepts the following options.
  9693. @table @option
  9694. @item codebook_length, l
  9695. Set codebook length. The value must be a positive integer, and
  9696. represents the number of distinct output colors. Default value is 256.
  9697. @item nb_steps, n
  9698. Set the maximum number of iterations to apply for computing the optimal
  9699. mapping. The higher the value the better the result and the higher the
  9700. computation time. Default value is 1.
  9701. @item seed, s
  9702. Set a random seed, must be an integer included between 0 and
  9703. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  9704. will try to use a good random seed on a best effort basis.
  9705. @item pal8
  9706. Set pal8 output pixel format. This option does not work with codebook
  9707. length greater than 256. Default is disabled.
  9708. @item use_alpha
  9709. Include alpha values in the quantization calculation. Allows creating
  9710. palettized output images (e.g. PNG8) with multiple alpha smooth blending.
  9711. @end table
  9712. @section entropy
  9713. Measure graylevel entropy in histogram of color channels of video frames.
  9714. It accepts the following parameters:
  9715. @table @option
  9716. @item mode
  9717. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  9718. @var{diff} mode measures entropy of histogram delta values, absolute differences
  9719. between neighbour histogram values.
  9720. @end table
  9721. @section epx
  9722. Apply the EPX magnification filter which is designed for pixel art.
  9723. It accepts the following option:
  9724. @table @option
  9725. @item n
  9726. Set the scaling dimension: @code{2} for @code{2xEPX}, @code{3} for
  9727. @code{3xEPX}.
  9728. Default is @code{3}.
  9729. @end table
  9730. @section eq
  9731. Set brightness, contrast, saturation and approximate gamma adjustment.
  9732. The filter accepts the following options:
  9733. @table @option
  9734. @item contrast
  9735. Set the contrast expression. The value must be a float value in range
  9736. @code{-1000.0} to @code{1000.0}. The default value is "1".
  9737. @item brightness
  9738. Set the brightness expression. The value must be a float value in
  9739. range @code{-1.0} to @code{1.0}. The default value is "0".
  9740. @item saturation
  9741. Set the saturation expression. The value must be a float in
  9742. range @code{0.0} to @code{3.0}. The default value is "1".
  9743. @item gamma
  9744. Set the gamma expression. The value must be a float in range
  9745. @code{0.1} to @code{10.0}. The default value is "1".
  9746. @item gamma_r
  9747. Set the gamma expression for red. The value must be a float in
  9748. range @code{0.1} to @code{10.0}. The default value is "1".
  9749. @item gamma_g
  9750. Set the gamma expression for green. The value must be a float in range
  9751. @code{0.1} to @code{10.0}. The default value is "1".
  9752. @item gamma_b
  9753. Set the gamma expression for blue. The value must be a float in range
  9754. @code{0.1} to @code{10.0}. The default value is "1".
  9755. @item gamma_weight
  9756. Set the gamma weight expression. It can be used to reduce the effect
  9757. of a high gamma value on bright image areas, e.g. keep them from
  9758. getting overamplified and just plain white. The value must be a float
  9759. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  9760. gamma correction all the way down while @code{1.0} leaves it at its
  9761. full strength. Default is "1".
  9762. @item eval
  9763. Set when the expressions for brightness, contrast, saturation and
  9764. gamma expressions are evaluated.
  9765. It accepts the following values:
  9766. @table @samp
  9767. @item init
  9768. only evaluate expressions once during the filter initialization or
  9769. when a command is processed
  9770. @item frame
  9771. evaluate expressions for each incoming frame
  9772. @end table
  9773. Default value is @samp{init}.
  9774. @end table
  9775. The expressions accept the following parameters:
  9776. @table @option
  9777. @item n
  9778. frame count of the input frame starting from 0
  9779. @item pos
  9780. byte position of the corresponding packet in the input file, NAN if
  9781. unspecified
  9782. @item r
  9783. frame rate of the input video, NAN if the input frame rate is unknown
  9784. @item t
  9785. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9786. @end table
  9787. @subsection Commands
  9788. The filter supports the following commands:
  9789. @table @option
  9790. @item contrast
  9791. Set the contrast expression.
  9792. @item brightness
  9793. Set the brightness expression.
  9794. @item saturation
  9795. Set the saturation expression.
  9796. @item gamma
  9797. Set the gamma expression.
  9798. @item gamma_r
  9799. Set the gamma_r expression.
  9800. @item gamma_g
  9801. Set gamma_g expression.
  9802. @item gamma_b
  9803. Set gamma_b expression.
  9804. @item gamma_weight
  9805. Set gamma_weight expression.
  9806. The command accepts the same syntax of the corresponding option.
  9807. If the specified expression is not valid, it is kept at its current
  9808. value.
  9809. @end table
  9810. @anchor{erosion}
  9811. @section erosion
  9812. Apply erosion effect to the video.
  9813. This filter replaces the pixel by the local(3x3) minimum.
  9814. It accepts the following options:
  9815. @table @option
  9816. @item threshold0
  9817. @item threshold1
  9818. @item threshold2
  9819. @item threshold3
  9820. Limit the maximum change for each plane, default is 65535.
  9821. If 0, plane will remain unchanged.
  9822. @item coordinates
  9823. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  9824. pixels are used.
  9825. Flags to local 3x3 coordinates maps like this:
  9826. 1 2 3
  9827. 4 5
  9828. 6 7 8
  9829. @end table
  9830. @subsection Commands
  9831. This filter supports the all above options as @ref{commands}.
  9832. @section estdif
  9833. Deinterlace the input video ("estdif" stands for "Edge Slope
  9834. Tracing Deinterlacing Filter").
  9835. Spatial only filter that uses edge slope tracing algorithm
  9836. to interpolate missing lines.
  9837. It accepts the following parameters:
  9838. @table @option
  9839. @item mode
  9840. The interlacing mode to adopt. It accepts one of the following values:
  9841. @table @option
  9842. @item frame
  9843. Output one frame for each frame.
  9844. @item field
  9845. Output one frame for each field.
  9846. @end table
  9847. The default value is @code{field}.
  9848. @item parity
  9849. The picture field parity assumed for the input interlaced video. It accepts one
  9850. of the following values:
  9851. @table @option
  9852. @item tff
  9853. Assume the top field is first.
  9854. @item bff
  9855. Assume the bottom field is first.
  9856. @item auto
  9857. Enable automatic detection of field parity.
  9858. @end table
  9859. The default value is @code{auto}.
  9860. If the interlacing is unknown or the decoder does not export this information,
  9861. top field first will be assumed.
  9862. @item deint
  9863. Specify which frames to deinterlace. Accepts one of the following
  9864. values:
  9865. @table @option
  9866. @item all
  9867. Deinterlace all frames.
  9868. @item interlaced
  9869. Only deinterlace frames marked as interlaced.
  9870. @end table
  9871. The default value is @code{all}.
  9872. @item rslope
  9873. Specify the search radius for edge slope tracing. Default value is 1.
  9874. Allowed range is from 1 to 15.
  9875. @item redge
  9876. Specify the search radius for best edge matching. Default value is 2.
  9877. Allowed range is from 0 to 15.
  9878. @item ecost
  9879. Specify the edge cost for edge matching. Default value is 1.0.
  9880. Allowed range is from 0 to 9.
  9881. @item mcost
  9882. Specify the middle cost for edge matching. Default value is 0.5.
  9883. Allowed range is from 0 to 1.
  9884. @item dcost
  9885. Specify the distance cost for edge matching. Default value is 0.5.
  9886. Allowed range is from 0 to 1.
  9887. @item interp
  9888. Specify the interpolation used. Default is 4-point interpolation. It accepts one
  9889. of the following values:
  9890. @table @option
  9891. @item 2p
  9892. Two-point interpolation.
  9893. @item 4p
  9894. Four-point interpolation.
  9895. @item 6p
  9896. Six-point interpolation.
  9897. @end table
  9898. @end table
  9899. @subsection Commands
  9900. This filter supports same @ref{commands} as options.
  9901. @section exposure
  9902. Adjust exposure of the video stream.
  9903. The filter accepts the following options:
  9904. @table @option
  9905. @item exposure
  9906. Set the exposure correction in EV. Allowed range is from -3.0 to 3.0 EV
  9907. Default value is 0 EV.
  9908. @item black
  9909. Set the black level correction. Allowed range is from -1.0 to 1.0.
  9910. Default value is 0.
  9911. @end table
  9912. @subsection Commands
  9913. This filter supports same @ref{commands} as options.
  9914. @section extractplanes
  9915. Extract color channel components from input video stream into
  9916. separate grayscale video streams.
  9917. The filter accepts the following option:
  9918. @table @option
  9919. @item planes
  9920. Set plane(s) to extract.
  9921. Available values for planes are:
  9922. @table @samp
  9923. @item y
  9924. @item u
  9925. @item v
  9926. @item a
  9927. @item r
  9928. @item g
  9929. @item b
  9930. @end table
  9931. Choosing planes not available in the input will result in an error.
  9932. That means you cannot select @code{r}, @code{g}, @code{b} planes
  9933. with @code{y}, @code{u}, @code{v} planes at same time.
  9934. @end table
  9935. @subsection Examples
  9936. @itemize
  9937. @item
  9938. Extract luma, u and v color channel component from input video frame
  9939. into 3 grayscale outputs:
  9940. @example
  9941. 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
  9942. @end example
  9943. @end itemize
  9944. @section fade
  9945. Apply a fade-in/out effect to the input video.
  9946. It accepts the following parameters:
  9947. @table @option
  9948. @item type, t
  9949. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  9950. effect.
  9951. Default is @code{in}.
  9952. @item start_frame, s
  9953. Specify the number of the frame to start applying the fade
  9954. effect at. Default is 0.
  9955. @item nb_frames, n
  9956. The number of frames that the fade effect lasts. At the end of the
  9957. fade-in effect, the output video will have the same intensity as the input video.
  9958. At the end of the fade-out transition, the output video will be filled with the
  9959. selected @option{color}.
  9960. Default is 25.
  9961. @item alpha
  9962. If set to 1, fade only alpha channel, if one exists on the input.
  9963. Default value is 0.
  9964. @item start_time, st
  9965. Specify the timestamp (in seconds) of the frame to start to apply the fade
  9966. effect. If both start_frame and start_time are specified, the fade will start at
  9967. whichever comes last. Default is 0.
  9968. @item duration, d
  9969. The number of seconds for which the fade effect has to last. At the end of the
  9970. fade-in effect the output video will have the same intensity as the input video,
  9971. at the end of the fade-out transition the output video will be filled with the
  9972. selected @option{color}.
  9973. If both duration and nb_frames are specified, duration is used. Default is 0
  9974. (nb_frames is used by default).
  9975. @item color, c
  9976. Specify the color of the fade. Default is "black".
  9977. @end table
  9978. @subsection Examples
  9979. @itemize
  9980. @item
  9981. Fade in the first 30 frames of video:
  9982. @example
  9983. fade=in:0:30
  9984. @end example
  9985. The command above is equivalent to:
  9986. @example
  9987. fade=t=in:s=0:n=30
  9988. @end example
  9989. @item
  9990. Fade out the last 45 frames of a 200-frame video:
  9991. @example
  9992. fade=out:155:45
  9993. fade=type=out:start_frame=155:nb_frames=45
  9994. @end example
  9995. @item
  9996. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  9997. @example
  9998. fade=in:0:25, fade=out:975:25
  9999. @end example
  10000. @item
  10001. Make the first 5 frames yellow, then fade in from frame 5-24:
  10002. @example
  10003. fade=in:5:20:color=yellow
  10004. @end example
  10005. @item
  10006. Fade in alpha over first 25 frames of video:
  10007. @example
  10008. fade=in:0:25:alpha=1
  10009. @end example
  10010. @item
  10011. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  10012. @example
  10013. fade=t=in:st=5.5:d=0.5
  10014. @end example
  10015. @end itemize
  10016. @section feedback
  10017. Apply feedback video filter.
  10018. This filter pass cropped input frames to 2nd output.
  10019. From there it can be filtered with other video filters.
  10020. After filter receives frame from 2nd input, that frame
  10021. is combined on top of original frame from 1st input and passed
  10022. to 1st output.
  10023. The typical usage is filter only part of frame.
  10024. The filter accepts the following options:
  10025. @table @option
  10026. @item x
  10027. @item y
  10028. Set the top left crop position.
  10029. @item w
  10030. @item h
  10031. Set the crop size.
  10032. @end table
  10033. @subsection Examples
  10034. @itemize
  10035. @item
  10036. Blur only top left rectangular part of video frame size 100x100 with gblur filter.
  10037. @example
  10038. [in][blurin]feedback=x=0:y=0:w=100:h=100[out][blurout];[blurout]gblur=8[blurin]
  10039. @end example
  10040. @item
  10041. Draw black box on top left part of video frame of size 100x100 with drawbox filter.
  10042. @example
  10043. [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]
  10044. @end example
  10045. @end itemize
  10046. @section fftdnoiz
  10047. Denoise frames using 3D FFT (frequency domain filtering).
  10048. The filter accepts the following options:
  10049. @table @option
  10050. @item sigma
  10051. Set the noise sigma constant. This sets denoising strength.
  10052. Default value is 1. Allowed range is from 0 to 30.
  10053. Using very high sigma with low overlap may give blocking artifacts.
  10054. @item amount
  10055. Set amount of denoising. By default all detected noise is reduced.
  10056. Default value is 1. Allowed range is from 0 to 1.
  10057. @item block
  10058. Set size of block in pixels, Default is 32, can be 8 to 256.
  10059. @item overlap
  10060. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  10061. @item method
  10062. Set denoising method. Default is @code{wiener}, can also be @code{hard}.
  10063. @item prev
  10064. Set number of previous frames to use for denoising. By default is set to 0.
  10065. @item next
  10066. Set number of next frames to to use for denoising. By default is set to 0.
  10067. @item planes
  10068. Set planes which will be filtered, by default are all available filtered
  10069. except alpha.
  10070. @end table
  10071. @section fftfilt
  10072. Apply arbitrary expressions to samples in frequency domain
  10073. @table @option
  10074. @item dc_Y
  10075. Adjust the dc value (gain) of the luma plane of the image. The filter
  10076. accepts an integer value in range @code{0} to @code{1000}. The default
  10077. value is set to @code{0}.
  10078. @item dc_U
  10079. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  10080. filter accepts an integer value in range @code{0} to @code{1000}. The
  10081. default value is set to @code{0}.
  10082. @item dc_V
  10083. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  10084. filter accepts an integer value in range @code{0} to @code{1000}. The
  10085. default value is set to @code{0}.
  10086. @item weight_Y
  10087. Set the frequency domain weight expression for the luma plane.
  10088. @item weight_U
  10089. Set the frequency domain weight expression for the 1st chroma plane.
  10090. @item weight_V
  10091. Set the frequency domain weight expression for the 2nd chroma plane.
  10092. @item eval
  10093. Set when the expressions are evaluated.
  10094. It accepts the following values:
  10095. @table @samp
  10096. @item init
  10097. Only evaluate expressions once during the filter initialization.
  10098. @item frame
  10099. Evaluate expressions for each incoming frame.
  10100. @end table
  10101. Default value is @samp{init}.
  10102. The filter accepts the following variables:
  10103. @item X
  10104. @item Y
  10105. The coordinates of the current sample.
  10106. @item W
  10107. @item H
  10108. The width and height of the image.
  10109. @item N
  10110. The number of input frame, starting from 0.
  10111. @item WS
  10112. @item HS
  10113. The size of FFT array for horizontal and vertical processing.
  10114. @end table
  10115. @subsection Examples
  10116. @itemize
  10117. @item
  10118. High-pass:
  10119. @example
  10120. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  10121. @end example
  10122. @item
  10123. Low-pass:
  10124. @example
  10125. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  10126. @end example
  10127. @item
  10128. Sharpen:
  10129. @example
  10130. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  10131. @end example
  10132. @item
  10133. Blur:
  10134. @example
  10135. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  10136. @end example
  10137. @end itemize
  10138. @section field
  10139. Extract a single field from an interlaced image using stride
  10140. arithmetic to avoid wasting CPU time. The output frames are marked as
  10141. non-interlaced.
  10142. The filter accepts the following options:
  10143. @table @option
  10144. @item type
  10145. Specify whether to extract the top (if the value is @code{0} or
  10146. @code{top}) or the bottom field (if the value is @code{1} or
  10147. @code{bottom}).
  10148. @end table
  10149. @section fieldhint
  10150. Create new frames by copying the top and bottom fields from surrounding frames
  10151. supplied as numbers by the hint file.
  10152. @table @option
  10153. @item hint
  10154. Set file containing hints: absolute/relative frame numbers.
  10155. There must be one line for each frame in a clip. Each line must contain two
  10156. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  10157. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  10158. is current frame number for @code{absolute} mode or out of [-1, 1] range
  10159. for @code{relative} mode. First number tells from which frame to pick up top
  10160. field and second number tells from which frame to pick up bottom field.
  10161. If optionally followed by @code{+} output frame will be marked as interlaced,
  10162. else if followed by @code{-} output frame will be marked as progressive, else
  10163. it will be marked same as input frame.
  10164. If optionally followed by @code{t} output frame will use only top field, or in
  10165. case of @code{b} it will use only bottom field.
  10166. If line starts with @code{#} or @code{;} that line is skipped.
  10167. @item mode
  10168. Can be item @code{absolute} or @code{relative} or @code{pattern}. Default is @code{absolute}.
  10169. The @code{pattern} mode is same as @code{relative} mode, except at last entry of file if there
  10170. are more frames to process than @code{hint} file is seek back to start.
  10171. @end table
  10172. Example of first several lines of @code{hint} file for @code{relative} mode:
  10173. @example
  10174. 0,0 - # first frame
  10175. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  10176. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  10177. 1,0 -
  10178. 0,0 -
  10179. 0,0 -
  10180. 1,0 -
  10181. 1,0 -
  10182. 1,0 -
  10183. 0,0 -
  10184. 0,0 -
  10185. 1,0 -
  10186. 1,0 -
  10187. 1,0 -
  10188. 0,0 -
  10189. @end example
  10190. @section fieldmatch
  10191. Field matching filter for inverse telecine. It is meant to reconstruct the
  10192. progressive frames from a telecined stream. The filter does not drop duplicated
  10193. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  10194. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  10195. The separation of the field matching and the decimation is notably motivated by
  10196. the possibility of inserting a de-interlacing filter fallback between the two.
  10197. If the source has mixed telecined and real interlaced content,
  10198. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  10199. But these remaining combed frames will be marked as interlaced, and thus can be
  10200. de-interlaced by a later filter such as @ref{yadif} before decimation.
  10201. In addition to the various configuration options, @code{fieldmatch} can take an
  10202. optional second stream, activated through the @option{ppsrc} option. If
  10203. enabled, the frames reconstruction will be based on the fields and frames from
  10204. this second stream. This allows the first input to be pre-processed in order to
  10205. help the various algorithms of the filter, while keeping the output lossless
  10206. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  10207. or brightness/contrast adjustments can help.
  10208. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  10209. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  10210. which @code{fieldmatch} is based on. While the semantic and usage are very
  10211. close, some behaviour and options names can differ.
  10212. The @ref{decimate} filter currently only works for constant frame rate input.
  10213. If your input has mixed telecined (30fps) and progressive content with a lower
  10214. framerate like 24fps use the following filterchain to produce the necessary cfr
  10215. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  10216. The filter accepts the following options:
  10217. @table @option
  10218. @item order
  10219. Specify the assumed field order of the input stream. Available values are:
  10220. @table @samp
  10221. @item auto
  10222. Auto detect parity (use FFmpeg's internal parity value).
  10223. @item bff
  10224. Assume bottom field first.
  10225. @item tff
  10226. Assume top field first.
  10227. @end table
  10228. Note that it is sometimes recommended not to trust the parity announced by the
  10229. stream.
  10230. Default value is @var{auto}.
  10231. @item mode
  10232. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  10233. sense that it won't risk creating jerkiness due to duplicate frames when
  10234. possible, but if there are bad edits or blended fields it will end up
  10235. outputting combed frames when a good match might actually exist. On the other
  10236. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  10237. but will almost always find a good frame if there is one. The other values are
  10238. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  10239. jerkiness and creating duplicate frames versus finding good matches in sections
  10240. with bad edits, orphaned fields, blended fields, etc.
  10241. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  10242. Available values are:
  10243. @table @samp
  10244. @item pc
  10245. 2-way matching (p/c)
  10246. @item pc_n
  10247. 2-way matching, and trying 3rd match if still combed (p/c + n)
  10248. @item pc_u
  10249. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  10250. @item pc_n_ub
  10251. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  10252. still combed (p/c + n + u/b)
  10253. @item pcn
  10254. 3-way matching (p/c/n)
  10255. @item pcn_ub
  10256. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  10257. detected as combed (p/c/n + u/b)
  10258. @end table
  10259. The parenthesis at the end indicate the matches that would be used for that
  10260. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  10261. @var{top}).
  10262. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  10263. the slowest.
  10264. Default value is @var{pc_n}.
  10265. @item ppsrc
  10266. Mark the main input stream as a pre-processed input, and enable the secondary
  10267. input stream as the clean source to pick the fields from. See the filter
  10268. introduction for more details. It is similar to the @option{clip2} feature from
  10269. VFM/TFM.
  10270. Default value is @code{0} (disabled).
  10271. @item field
  10272. Set the field to match from. It is recommended to set this to the same value as
  10273. @option{order} unless you experience matching failures with that setting. In
  10274. certain circumstances changing the field that is used to match from can have a
  10275. large impact on matching performance. Available values are:
  10276. @table @samp
  10277. @item auto
  10278. Automatic (same value as @option{order}).
  10279. @item bottom
  10280. Match from the bottom field.
  10281. @item top
  10282. Match from the top field.
  10283. @end table
  10284. Default value is @var{auto}.
  10285. @item mchroma
  10286. Set whether or not chroma is included during the match comparisons. In most
  10287. cases it is recommended to leave this enabled. You should set this to @code{0}
  10288. only if your clip has bad chroma problems such as heavy rainbowing or other
  10289. artifacts. Setting this to @code{0} could also be used to speed things up at
  10290. the cost of some accuracy.
  10291. Default value is @code{1}.
  10292. @item y0
  10293. @item y1
  10294. These define an exclusion band which excludes the lines between @option{y0} and
  10295. @option{y1} from being included in the field matching decision. An exclusion
  10296. band can be used to ignore subtitles, a logo, or other things that may
  10297. interfere with the matching. @option{y0} sets the starting scan line and
  10298. @option{y1} sets the ending line; all lines in between @option{y0} and
  10299. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  10300. @option{y0} and @option{y1} to the same value will disable the feature.
  10301. @option{y0} and @option{y1} defaults to @code{0}.
  10302. @item scthresh
  10303. Set the scene change detection threshold as a percentage of maximum change on
  10304. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  10305. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  10306. @option{scthresh} is @code{[0.0, 100.0]}.
  10307. Default value is @code{12.0}.
  10308. @item combmatch
  10309. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  10310. account the combed scores of matches when deciding what match to use as the
  10311. final match. Available values are:
  10312. @table @samp
  10313. @item none
  10314. No final matching based on combed scores.
  10315. @item sc
  10316. Combed scores are only used when a scene change is detected.
  10317. @item full
  10318. Use combed scores all the time.
  10319. @end table
  10320. Default is @var{sc}.
  10321. @item combdbg
  10322. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  10323. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  10324. Available values are:
  10325. @table @samp
  10326. @item none
  10327. No forced calculation.
  10328. @item pcn
  10329. Force p/c/n calculations.
  10330. @item pcnub
  10331. Force p/c/n/u/b calculations.
  10332. @end table
  10333. Default value is @var{none}.
  10334. @item cthresh
  10335. This is the area combing threshold used for combed frame detection. This
  10336. essentially controls how "strong" or "visible" combing must be to be detected.
  10337. Larger values mean combing must be more visible and smaller values mean combing
  10338. can be less visible or strong and still be detected. Valid settings are from
  10339. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  10340. be detected as combed). This is basically a pixel difference value. A good
  10341. range is @code{[8, 12]}.
  10342. Default value is @code{9}.
  10343. @item chroma
  10344. Sets whether or not chroma is considered in the combed frame decision. Only
  10345. disable this if your source has chroma problems (rainbowing, etc.) that are
  10346. causing problems for the combed frame detection with chroma enabled. Actually,
  10347. using @option{chroma}=@var{0} is usually more reliable, except for the case
  10348. where there is chroma only combing in the source.
  10349. Default value is @code{0}.
  10350. @item blockx
  10351. @item blocky
  10352. Respectively set the x-axis and y-axis size of the window used during combed
  10353. frame detection. This has to do with the size of the area in which
  10354. @option{combpel} pixels are required to be detected as combed for a frame to be
  10355. declared combed. See the @option{combpel} parameter description for more info.
  10356. Possible values are any number that is a power of 2 starting at 4 and going up
  10357. to 512.
  10358. Default value is @code{16}.
  10359. @item combpel
  10360. The number of combed pixels inside any of the @option{blocky} by
  10361. @option{blockx} size blocks on the frame for the frame to be detected as
  10362. combed. While @option{cthresh} controls how "visible" the combing must be, this
  10363. setting controls "how much" combing there must be in any localized area (a
  10364. window defined by the @option{blockx} and @option{blocky} settings) on the
  10365. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  10366. which point no frames will ever be detected as combed). This setting is known
  10367. as @option{MI} in TFM/VFM vocabulary.
  10368. Default value is @code{80}.
  10369. @end table
  10370. @anchor{p/c/n/u/b meaning}
  10371. @subsection p/c/n/u/b meaning
  10372. @subsubsection p/c/n
  10373. We assume the following telecined stream:
  10374. @example
  10375. Top fields: 1 2 2 3 4
  10376. Bottom fields: 1 2 3 4 4
  10377. @end example
  10378. The numbers correspond to the progressive frame the fields relate to. Here, the
  10379. first two frames are progressive, the 3rd and 4th are combed, and so on.
  10380. When @code{fieldmatch} is configured to run a matching from bottom
  10381. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  10382. @example
  10383. Input stream:
  10384. T 1 2 2 3 4
  10385. B 1 2 3 4 4 <-- matching reference
  10386. Matches: c c n n c
  10387. Output stream:
  10388. T 1 2 3 4 4
  10389. B 1 2 3 4 4
  10390. @end example
  10391. As a result of the field matching, we can see that some frames get duplicated.
  10392. To perform a complete inverse telecine, you need to rely on a decimation filter
  10393. after this operation. See for instance the @ref{decimate} filter.
  10394. The same operation now matching from top fields (@option{field}=@var{top})
  10395. looks like this:
  10396. @example
  10397. Input stream:
  10398. T 1 2 2 3 4 <-- matching reference
  10399. B 1 2 3 4 4
  10400. Matches: c c p p c
  10401. Output stream:
  10402. T 1 2 2 3 4
  10403. B 1 2 2 3 4
  10404. @end example
  10405. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  10406. basically, they refer to the frame and field of the opposite parity:
  10407. @itemize
  10408. @item @var{p} matches the field of the opposite parity in the previous frame
  10409. @item @var{c} matches the field of the opposite parity in the current frame
  10410. @item @var{n} matches the field of the opposite parity in the next frame
  10411. @end itemize
  10412. @subsubsection u/b
  10413. The @var{u} and @var{b} matching are a bit special in the sense that they match
  10414. from the opposite parity flag. In the following examples, we assume that we are
  10415. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  10416. 'x' is placed above and below each matched fields.
  10417. With bottom matching (@option{field}=@var{bottom}):
  10418. @example
  10419. Match: c p n b u
  10420. x x x x x
  10421. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  10422. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  10423. x x x x x
  10424. Output frames:
  10425. 2 1 2 2 2
  10426. 2 2 2 1 3
  10427. @end example
  10428. With top matching (@option{field}=@var{top}):
  10429. @example
  10430. Match: c p n b u
  10431. x x x x x
  10432. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  10433. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  10434. x x x x x
  10435. Output frames:
  10436. 2 2 2 1 2
  10437. 2 1 3 2 2
  10438. @end example
  10439. @subsection Examples
  10440. Simple IVTC of a top field first telecined stream:
  10441. @example
  10442. fieldmatch=order=tff:combmatch=none, decimate
  10443. @end example
  10444. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  10445. @example
  10446. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  10447. @end example
  10448. @section fieldorder
  10449. Transform the field order of the input video.
  10450. It accepts the following parameters:
  10451. @table @option
  10452. @item order
  10453. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  10454. for bottom field first.
  10455. @end table
  10456. The default value is @samp{tff}.
  10457. The transformation is done by shifting the picture content up or down
  10458. by one line, and filling the remaining line with appropriate picture content.
  10459. This method is consistent with most broadcast field order converters.
  10460. If the input video is not flagged as being interlaced, or it is already
  10461. flagged as being of the required output field order, then this filter does
  10462. not alter the incoming video.
  10463. It is very useful when converting to or from PAL DV material,
  10464. which is bottom field first.
  10465. For example:
  10466. @example
  10467. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  10468. @end example
  10469. @section fifo, afifo
  10470. Buffer input images and send them when they are requested.
  10471. It is mainly useful when auto-inserted by the libavfilter
  10472. framework.
  10473. It does not take parameters.
  10474. @section fillborders
  10475. Fill borders of the input video, without changing video stream dimensions.
  10476. Sometimes video can have garbage at the four edges and you may not want to
  10477. crop video input to keep size multiple of some number.
  10478. This filter accepts the following options:
  10479. @table @option
  10480. @item left
  10481. Number of pixels to fill from left border.
  10482. @item right
  10483. Number of pixels to fill from right border.
  10484. @item top
  10485. Number of pixels to fill from top border.
  10486. @item bottom
  10487. Number of pixels to fill from bottom border.
  10488. @item mode
  10489. Set fill mode.
  10490. It accepts the following values:
  10491. @table @samp
  10492. @item smear
  10493. fill pixels using outermost pixels
  10494. @item mirror
  10495. fill pixels using mirroring (half sample symmetric)
  10496. @item fixed
  10497. fill pixels with constant value
  10498. @item reflect
  10499. fill pixels using reflecting (whole sample symmetric)
  10500. @item wrap
  10501. fill pixels using wrapping
  10502. @item fade
  10503. fade pixels to constant value
  10504. @item margins
  10505. fill pixels at top and bottom with weighted averages pixels near borders
  10506. @end table
  10507. Default is @var{smear}.
  10508. @item color
  10509. Set color for pixels in fixed or fade mode. Default is @var{black}.
  10510. @end table
  10511. @subsection Commands
  10512. This filter supports same @ref{commands} as options.
  10513. The command accepts the same syntax of the corresponding option.
  10514. If the specified expression is not valid, it is kept at its current
  10515. value.
  10516. @section find_rect
  10517. Find a rectangular object
  10518. It accepts the following options:
  10519. @table @option
  10520. @item object
  10521. Filepath of the object image, needs to be in gray8.
  10522. @item threshold
  10523. Detection threshold, default is 0.5.
  10524. @item mipmaps
  10525. Number of mipmaps, default is 3.
  10526. @item xmin, ymin, xmax, ymax
  10527. Specifies the rectangle in which to search.
  10528. @item discard
  10529. Discard frames where object is not detected. Default is disabled.
  10530. @end table
  10531. @subsection Examples
  10532. @itemize
  10533. @item
  10534. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  10535. @example
  10536. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  10537. @end example
  10538. @end itemize
  10539. @section floodfill
  10540. Flood area with values of same pixel components with another values.
  10541. It accepts the following options:
  10542. @table @option
  10543. @item x
  10544. Set pixel x coordinate.
  10545. @item y
  10546. Set pixel y coordinate.
  10547. @item s0
  10548. Set source #0 component value.
  10549. @item s1
  10550. Set source #1 component value.
  10551. @item s2
  10552. Set source #2 component value.
  10553. @item s3
  10554. Set source #3 component value.
  10555. @item d0
  10556. Set destination #0 component value.
  10557. @item d1
  10558. Set destination #1 component value.
  10559. @item d2
  10560. Set destination #2 component value.
  10561. @item d3
  10562. Set destination #3 component value.
  10563. @end table
  10564. @anchor{format}
  10565. @section format
  10566. Convert the input video to one of the specified pixel formats.
  10567. Libavfilter will try to pick one that is suitable as input to
  10568. the next filter.
  10569. It accepts the following parameters:
  10570. @table @option
  10571. @item pix_fmts
  10572. A '|'-separated list of pixel format names, such as
  10573. "pix_fmts=yuv420p|monow|rgb24".
  10574. @end table
  10575. @subsection Examples
  10576. @itemize
  10577. @item
  10578. Convert the input video to the @var{yuv420p} format
  10579. @example
  10580. format=pix_fmts=yuv420p
  10581. @end example
  10582. Convert the input video to any of the formats in the list
  10583. @example
  10584. format=pix_fmts=yuv420p|yuv444p|yuv410p
  10585. @end example
  10586. @end itemize
  10587. @anchor{fps}
  10588. @section fps
  10589. Convert the video to specified constant frame rate by duplicating or dropping
  10590. frames as necessary.
  10591. It accepts the following parameters:
  10592. @table @option
  10593. @item fps
  10594. The desired output frame rate. It accepts expressions containing the following
  10595. constants:
  10596. @table @samp
  10597. @item source_fps
  10598. The input's frame rate
  10599. @item ntsc
  10600. NTSC frame rate of @code{30000/1001}
  10601. @item pal
  10602. PAL frame rate of @code{25.0}
  10603. @item film
  10604. Film frame rate of @code{24.0}
  10605. @item ntsc_film
  10606. NTSC-film frame rate of @code{24000/1001}
  10607. @end table
  10608. The default is @code{25}.
  10609. @item start_time
  10610. Assume the first PTS should be the given value, in seconds. This allows for
  10611. padding/trimming at the start of stream. By default, no assumption is made
  10612. about the first frame's expected PTS, so no padding or trimming is done.
  10613. For example, this could be set to 0 to pad the beginning with duplicates of
  10614. the first frame if a video stream starts after the audio stream or to trim any
  10615. frames with a negative PTS.
  10616. @item round
  10617. Timestamp (PTS) rounding method.
  10618. Possible values are:
  10619. @table @option
  10620. @item zero
  10621. round towards 0
  10622. @item inf
  10623. round away from 0
  10624. @item down
  10625. round towards -infinity
  10626. @item up
  10627. round towards +infinity
  10628. @item near
  10629. round to nearest
  10630. @end table
  10631. The default is @code{near}.
  10632. @item eof_action
  10633. Action performed when reading the last frame.
  10634. Possible values are:
  10635. @table @option
  10636. @item round
  10637. Use same timestamp rounding method as used for other frames.
  10638. @item pass
  10639. Pass through last frame if input duration has not been reached yet.
  10640. @end table
  10641. The default is @code{round}.
  10642. @end table
  10643. Alternatively, the options can be specified as a flat string:
  10644. @var{fps}[:@var{start_time}[:@var{round}]].
  10645. See also the @ref{setpts} filter.
  10646. @subsection Examples
  10647. @itemize
  10648. @item
  10649. A typical usage in order to set the fps to 25:
  10650. @example
  10651. fps=fps=25
  10652. @end example
  10653. @item
  10654. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  10655. @example
  10656. fps=fps=film:round=near
  10657. @end example
  10658. @end itemize
  10659. @section framepack
  10660. Pack two different video streams into a stereoscopic video, setting proper
  10661. metadata on supported codecs. The two views should have the same size and
  10662. framerate and processing will stop when the shorter video ends. Please note
  10663. that you may conveniently adjust view properties with the @ref{scale} and
  10664. @ref{fps} filters.
  10665. It accepts the following parameters:
  10666. @table @option
  10667. @item format
  10668. The desired packing format. Supported values are:
  10669. @table @option
  10670. @item sbs
  10671. The views are next to each other (default).
  10672. @item tab
  10673. The views are on top of each other.
  10674. @item lines
  10675. The views are packed by line.
  10676. @item columns
  10677. The views are packed by column.
  10678. @item frameseq
  10679. The views are temporally interleaved.
  10680. @end table
  10681. @end table
  10682. Some examples:
  10683. @example
  10684. # Convert left and right views into a frame-sequential video
  10685. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  10686. # Convert views into a side-by-side video with the same output resolution as the input
  10687. 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
  10688. @end example
  10689. @section framerate
  10690. Change the frame rate by interpolating new video output frames from the source
  10691. frames.
  10692. This filter is not designed to function correctly with interlaced media. If
  10693. you wish to change the frame rate of interlaced media then you are required
  10694. to deinterlace before this filter and re-interlace after this filter.
  10695. A description of the accepted options follows.
  10696. @table @option
  10697. @item fps
  10698. Specify the output frames per second. This option can also be specified
  10699. as a value alone. The default is @code{50}.
  10700. @item interp_start
  10701. Specify the start of a range where the output frame will be created as a
  10702. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  10703. the default is @code{15}.
  10704. @item interp_end
  10705. Specify the end of a range where the output frame will be created as a
  10706. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  10707. the default is @code{240}.
  10708. @item scene
  10709. Specify the level at which a scene change is detected as a value between
  10710. 0 and 100 to indicate a new scene; a low value reflects a low
  10711. probability for the current frame to introduce a new scene, while a higher
  10712. value means the current frame is more likely to be one.
  10713. The default is @code{8.2}.
  10714. @item flags
  10715. Specify flags influencing the filter process.
  10716. Available value for @var{flags} is:
  10717. @table @option
  10718. @item scene_change_detect, scd
  10719. Enable scene change detection using the value of the option @var{scene}.
  10720. This flag is enabled by default.
  10721. @end table
  10722. @end table
  10723. @section framestep
  10724. Select one frame every N-th frame.
  10725. This filter accepts the following option:
  10726. @table @option
  10727. @item step
  10728. Select frame after every @code{step} frames.
  10729. Allowed values are positive integers higher than 0. Default value is @code{1}.
  10730. @end table
  10731. @section freezedetect
  10732. Detect frozen video.
  10733. This filter logs a message and sets frame metadata when it detects that the
  10734. input video has no significant change in content during a specified duration.
  10735. Video freeze detection calculates the mean average absolute difference of all
  10736. the components of video frames and compares it to a noise floor.
  10737. The printed times and duration are expressed in seconds. The
  10738. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  10739. whose timestamp equals or exceeds the detection duration and it contains the
  10740. timestamp of the first frame of the freeze. The
  10741. @code{lavfi.freezedetect.freeze_duration} and
  10742. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  10743. after the freeze.
  10744. The filter accepts the following options:
  10745. @table @option
  10746. @item noise, n
  10747. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  10748. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  10749. 0.001.
  10750. @item duration, d
  10751. Set freeze duration until notification (default is 2 seconds).
  10752. @end table
  10753. @section freezeframes
  10754. Freeze video frames.
  10755. This filter freezes video frames using frame from 2nd input.
  10756. The filter accepts the following options:
  10757. @table @option
  10758. @item first
  10759. Set number of first frame from which to start freeze.
  10760. @item last
  10761. Set number of last frame from which to end freeze.
  10762. @item replace
  10763. Set number of frame from 2nd input which will be used instead of replaced frames.
  10764. @end table
  10765. @anchor{frei0r}
  10766. @section frei0r
  10767. Apply a frei0r effect to the input video.
  10768. To enable the compilation of this filter, you need to install the frei0r
  10769. header and configure FFmpeg with @code{--enable-frei0r}.
  10770. It accepts the following parameters:
  10771. @table @option
  10772. @item filter_name
  10773. The name of the frei0r effect to load. If the environment variable
  10774. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  10775. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  10776. Otherwise, the standard frei0r paths are searched, in this order:
  10777. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  10778. @file{/usr/lib/frei0r-1/}.
  10779. @item filter_params
  10780. A '|'-separated list of parameters to pass to the frei0r effect.
  10781. @end table
  10782. A frei0r effect parameter can be a boolean (its value is either
  10783. "y" or "n"), a double, a color (specified as
  10784. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  10785. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  10786. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  10787. a position (specified as @var{X}/@var{Y}, where
  10788. @var{X} and @var{Y} are floating point numbers) and/or a string.
  10789. The number and types of parameters depend on the loaded effect. If an
  10790. effect parameter is not specified, the default value is set.
  10791. @subsection Examples
  10792. @itemize
  10793. @item
  10794. Apply the distort0r effect, setting the first two double parameters:
  10795. @example
  10796. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  10797. @end example
  10798. @item
  10799. Apply the colordistance effect, taking a color as the first parameter:
  10800. @example
  10801. frei0r=colordistance:0.2/0.3/0.4
  10802. frei0r=colordistance:violet
  10803. frei0r=colordistance:0x112233
  10804. @end example
  10805. @item
  10806. Apply the perspective effect, specifying the top left and top right image
  10807. positions:
  10808. @example
  10809. frei0r=perspective:0.2/0.2|0.8/0.2
  10810. @end example
  10811. @end itemize
  10812. For more information, see
  10813. @url{http://frei0r.dyne.org}
  10814. @subsection Commands
  10815. This filter supports the @option{filter_params} option as @ref{commands}.
  10816. @section fspp
  10817. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  10818. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  10819. processing filter, one of them is performed once per block, not per pixel.
  10820. This allows for much higher speed.
  10821. The filter accepts the following options:
  10822. @table @option
  10823. @item quality
  10824. Set quality. This option defines the number of levels for averaging. It accepts
  10825. an integer in the range 4-5. Default value is @code{4}.
  10826. @item qp
  10827. Force a constant quantization parameter. It accepts an integer in range 0-63.
  10828. If not set, the filter will use the QP from the video stream (if available).
  10829. @item strength
  10830. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  10831. more details but also more artifacts, while higher values make the image smoother
  10832. but also blurrier. Default value is @code{0} − PSNR optimal.
  10833. @item use_bframe_qp
  10834. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  10835. option may cause flicker since the B-Frames have often larger QP. Default is
  10836. @code{0} (not enabled).
  10837. @end table
  10838. @section gblur
  10839. Apply Gaussian blur filter.
  10840. The filter accepts the following options:
  10841. @table @option
  10842. @item sigma
  10843. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  10844. @item steps
  10845. Set number of steps for Gaussian approximation. Default is @code{1}.
  10846. @item planes
  10847. Set which planes to filter. By default all planes are filtered.
  10848. @item sigmaV
  10849. Set vertical sigma, if negative it will be same as @code{sigma}.
  10850. Default is @code{-1}.
  10851. @end table
  10852. @subsection Commands
  10853. This filter supports same commands as options.
  10854. The command accepts the same syntax of the corresponding option.
  10855. If the specified expression is not valid, it is kept at its current
  10856. value.
  10857. @section geq
  10858. Apply generic equation to each pixel.
  10859. The filter accepts the following options:
  10860. @table @option
  10861. @item lum_expr, lum
  10862. Set the luminance expression.
  10863. @item cb_expr, cb
  10864. Set the chrominance blue expression.
  10865. @item cr_expr, cr
  10866. Set the chrominance red expression.
  10867. @item alpha_expr, a
  10868. Set the alpha expression.
  10869. @item red_expr, r
  10870. Set the red expression.
  10871. @item green_expr, g
  10872. Set the green expression.
  10873. @item blue_expr, b
  10874. Set the blue expression.
  10875. @end table
  10876. The colorspace is selected according to the specified options. If one
  10877. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  10878. options is specified, the filter will automatically select a YCbCr
  10879. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  10880. @option{blue_expr} options is specified, it will select an RGB
  10881. colorspace.
  10882. If one of the chrominance expression is not defined, it falls back on the other
  10883. one. If no alpha expression is specified it will evaluate to opaque value.
  10884. If none of chrominance expressions are specified, they will evaluate
  10885. to the luminance expression.
  10886. The expressions can use the following variables and functions:
  10887. @table @option
  10888. @item N
  10889. The sequential number of the filtered frame, starting from @code{0}.
  10890. @item X
  10891. @item Y
  10892. The coordinates of the current sample.
  10893. @item W
  10894. @item H
  10895. The width and height of the image.
  10896. @item SW
  10897. @item SH
  10898. Width and height scale depending on the currently filtered plane. It is the
  10899. ratio between the corresponding luma plane number of pixels and the current
  10900. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  10901. @code{0.5,0.5} for chroma planes.
  10902. @item T
  10903. Time of the current frame, expressed in seconds.
  10904. @item p(x, y)
  10905. Return the value of the pixel at location (@var{x},@var{y}) of the current
  10906. plane.
  10907. @item lum(x, y)
  10908. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  10909. plane.
  10910. @item cb(x, y)
  10911. Return the value of the pixel at location (@var{x},@var{y}) of the
  10912. blue-difference chroma plane. Return 0 if there is no such plane.
  10913. @item cr(x, y)
  10914. Return the value of the pixel at location (@var{x},@var{y}) of the
  10915. red-difference chroma plane. Return 0 if there is no such plane.
  10916. @item r(x, y)
  10917. @item g(x, y)
  10918. @item b(x, y)
  10919. Return the value of the pixel at location (@var{x},@var{y}) of the
  10920. red/green/blue component. Return 0 if there is no such component.
  10921. @item alpha(x, y)
  10922. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  10923. plane. Return 0 if there is no such plane.
  10924. @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)
  10925. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  10926. sums of samples within a rectangle. See the functions without the sum postfix.
  10927. @item interpolation
  10928. Set one of interpolation methods:
  10929. @table @option
  10930. @item nearest, n
  10931. @item bilinear, b
  10932. @end table
  10933. Default is bilinear.
  10934. @end table
  10935. For functions, if @var{x} and @var{y} are outside the area, the value will be
  10936. automatically clipped to the closer edge.
  10937. Please note that this filter can use multiple threads in which case each slice
  10938. will have its own expression state. If you want to use only a single expression
  10939. state because your expressions depend on previous state then you should limit
  10940. the number of filter threads to 1.
  10941. @subsection Examples
  10942. @itemize
  10943. @item
  10944. Flip the image horizontally:
  10945. @example
  10946. geq=p(W-X\,Y)
  10947. @end example
  10948. @item
  10949. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  10950. wavelength of 100 pixels:
  10951. @example
  10952. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  10953. @end example
  10954. @item
  10955. Generate a fancy enigmatic moving light:
  10956. @example
  10957. 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
  10958. @end example
  10959. @item
  10960. Generate a quick emboss effect:
  10961. @example
  10962. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  10963. @end example
  10964. @item
  10965. Modify RGB components depending on pixel position:
  10966. @example
  10967. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  10968. @end example
  10969. @item
  10970. Create a radial gradient that is the same size as the input (also see
  10971. the @ref{vignette} filter):
  10972. @example
  10973. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  10974. @end example
  10975. @end itemize
  10976. @section gradfun
  10977. Fix the banding artifacts that are sometimes introduced into nearly flat
  10978. regions by truncation to 8-bit color depth.
  10979. Interpolate the gradients that should go where the bands are, and
  10980. dither them.
  10981. It is designed for playback only. Do not use it prior to
  10982. lossy compression, because compression tends to lose the dither and
  10983. bring back the bands.
  10984. It accepts the following parameters:
  10985. @table @option
  10986. @item strength
  10987. The maximum amount by which the filter will change any one pixel. This is also
  10988. the threshold for detecting nearly flat regions. Acceptable values range from
  10989. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  10990. valid range.
  10991. @item radius
  10992. The neighborhood to fit the gradient to. A larger radius makes for smoother
  10993. gradients, but also prevents the filter from modifying the pixels near detailed
  10994. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  10995. values will be clipped to the valid range.
  10996. @end table
  10997. Alternatively, the options can be specified as a flat string:
  10998. @var{strength}[:@var{radius}]
  10999. @subsection Examples
  11000. @itemize
  11001. @item
  11002. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  11003. @example
  11004. gradfun=3.5:8
  11005. @end example
  11006. @item
  11007. Specify radius, omitting the strength (which will fall-back to the default
  11008. value):
  11009. @example
  11010. gradfun=radius=8
  11011. @end example
  11012. @end itemize
  11013. @anchor{graphmonitor}
  11014. @section graphmonitor
  11015. Show various filtergraph stats.
  11016. With this filter one can debug complete filtergraph.
  11017. Especially issues with links filling with queued frames.
  11018. The filter accepts the following options:
  11019. @table @option
  11020. @item size, s
  11021. Set video output size. Default is @var{hd720}.
  11022. @item opacity, o
  11023. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  11024. @item mode, m
  11025. Set output mode, can be @var{fulll} or @var{compact}.
  11026. In @var{compact} mode only filters with some queued frames have displayed stats.
  11027. @item flags, f
  11028. Set flags which enable which stats are shown in video.
  11029. Available values for flags are:
  11030. @table @samp
  11031. @item queue
  11032. Display number of queued frames in each link.
  11033. @item frame_count_in
  11034. Display number of frames taken from filter.
  11035. @item frame_count_out
  11036. Display number of frames given out from filter.
  11037. @item frame_count_delta
  11038. Display delta number of frames between above two values.
  11039. @item pts
  11040. Display current filtered frame pts.
  11041. @item pts_delta
  11042. Display pts delta between current and previous frame.
  11043. @item time
  11044. Display current filtered frame time.
  11045. @item time_delta
  11046. Display time delta between current and previous frame.
  11047. @item timebase
  11048. Display time base for filter link.
  11049. @item format
  11050. Display used format for filter link.
  11051. @item size
  11052. Display video size or number of audio channels in case of audio used by filter link.
  11053. @item rate
  11054. Display video frame rate or sample rate in case of audio used by filter link.
  11055. @item eof
  11056. Display link output status.
  11057. @item sample_count_in
  11058. Display number of samples taken from filter.
  11059. @item sample_count_out
  11060. Display number of samples given out from filter.
  11061. @item sample_count_delta
  11062. Display delta number of samples between above two values.
  11063. @end table
  11064. @item rate, r
  11065. Set upper limit for video rate of output stream, Default value is @var{25}.
  11066. This guarantee that output video frame rate will not be higher than this value.
  11067. @end table
  11068. @section grayworld
  11069. A color constancy filter that applies color correction based on the grayworld assumption
  11070. See: @url{https://www.researchgate.net/publication/275213614_A_New_Color_Correction_Method_for_Underwater_Imaging}
  11071. The algorithm uses linear light, so input
  11072. data should be linearized beforehand (and possibly correctly tagged).
  11073. @example
  11074. ffmpeg -i INPUT -vf zscale=transfer=linear,grayworld,zscale=transfer=bt709,format=yuv420p OUTPUT
  11075. @end example
  11076. @section greyedge
  11077. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  11078. and corrects the scene colors accordingly.
  11079. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  11080. The filter accepts the following options:
  11081. @table @option
  11082. @item difford
  11083. The order of differentiation to be applied on the scene. Must be chosen in the range
  11084. [0,2] and default value is 1.
  11085. @item minknorm
  11086. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  11087. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  11088. max value instead of calculating Minkowski distance.
  11089. @item sigma
  11090. The standard deviation of Gaussian blur to be applied on the scene. Must be
  11091. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  11092. can't be equal to 0 if @var{difford} is greater than 0.
  11093. @end table
  11094. @subsection Examples
  11095. @itemize
  11096. @item
  11097. Grey Edge:
  11098. @example
  11099. greyedge=difford=1:minknorm=5:sigma=2
  11100. @end example
  11101. @item
  11102. Max Edge:
  11103. @example
  11104. greyedge=difford=1:minknorm=0:sigma=2
  11105. @end example
  11106. @end itemize
  11107. @section guided
  11108. Apply guided filter for edge-preserving smoothing, dehazing and so on.
  11109. The filter accepts the following options:
  11110. @table @option
  11111. @item radius
  11112. Set the box radius in pixels.
  11113. Allowed range is 1 to 20. Default is 3.
  11114. @item eps
  11115. Set regularization parameter (with square).
  11116. Allowed range is 0 to 1. Default is 0.01.
  11117. @item mode
  11118. Set filter mode. Can be @code{basic} or @code{fast}.
  11119. Default is @code{basic}.
  11120. @item sub
  11121. Set subsampling ratio for @code{fast} mode.
  11122. Range is 2 to 64. Default is 4.
  11123. No subsampling occurs in @code{basic} mode.
  11124. @item guidance
  11125. Set guidance mode. Can be @code{off} or @code{on}. Default is @code{off}.
  11126. If @code{off}, single input is required.
  11127. If @code{on}, two inputs of the same resolution and pixel format are required.
  11128. The second input serves as the guidance.
  11129. @item planes
  11130. Set planes to filter. Default is first only.
  11131. @end table
  11132. @subsection Commands
  11133. This filter supports the all above options as @ref{commands}.
  11134. @subsection Examples
  11135. @itemize
  11136. @item
  11137. Edge-preserving smoothing with guided filter:
  11138. @example
  11139. ffmpeg -i in.png -vf guided out.png
  11140. @end example
  11141. @item
  11142. Dehazing, structure-transferring filtering, detail enhancement with guided filter.
  11143. For the generation of guidance image, refer to paper "Guided Image Filtering".
  11144. See: @url{http://kaiminghe.com/publications/pami12guidedfilter.pdf}.
  11145. @example
  11146. ffmpeg -i in.png -i guidance.png -filter_complex guided=guidance=on out.png
  11147. @end example
  11148. @end itemize
  11149. @anchor{haldclut}
  11150. @section haldclut
  11151. Apply a Hald CLUT to a video stream.
  11152. First input is the video stream to process, and second one is the Hald CLUT.
  11153. The Hald CLUT input can be a simple picture or a complete video stream.
  11154. The filter accepts the following options:
  11155. @table @option
  11156. @item clut
  11157. Set which CLUT video frames will be processed from second input stream,
  11158. can be @var{first} or @var{all}. Default is @var{all}.
  11159. @item shortest
  11160. Force termination when the shortest input terminates. Default is @code{0}.
  11161. @item repeatlast
  11162. Continue applying the last CLUT after the end of the stream. A value of
  11163. @code{0} disable the filter after the last frame of the CLUT is reached.
  11164. Default is @code{1}.
  11165. @end table
  11166. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  11167. filters share the same internals).
  11168. This filter also supports the @ref{framesync} options.
  11169. More information about the Hald CLUT can be found on Eskil Steenberg's website
  11170. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  11171. @subsection Commands
  11172. This filter supports the @code{interp} option as @ref{commands}.
  11173. @subsection Workflow examples
  11174. @subsubsection Hald CLUT video stream
  11175. Generate an identity Hald CLUT stream altered with various effects:
  11176. @example
  11177. 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
  11178. @end example
  11179. Note: make sure you use a lossless codec.
  11180. Then use it with @code{haldclut} to apply it on some random stream:
  11181. @example
  11182. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  11183. @end example
  11184. The Hald CLUT will be applied to the 10 first seconds (duration of
  11185. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  11186. to the remaining frames of the @code{mandelbrot} stream.
  11187. @subsubsection Hald CLUT with preview
  11188. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  11189. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  11190. biggest possible square starting at the top left of the picture. The remaining
  11191. padding pixels (bottom or right) will be ignored. This area can be used to add
  11192. a preview of the Hald CLUT.
  11193. Typically, the following generated Hald CLUT will be supported by the
  11194. @code{haldclut} filter:
  11195. @example
  11196. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  11197. pad=iw+320 [padded_clut];
  11198. smptebars=s=320x256, split [a][b];
  11199. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  11200. [main][b] overlay=W-320" -frames:v 1 clut.png
  11201. @end example
  11202. It contains the original and a preview of the effect of the CLUT: SMPTE color
  11203. bars are displayed on the right-top, and below the same color bars processed by
  11204. the color changes.
  11205. Then, the effect of this Hald CLUT can be visualized with:
  11206. @example
  11207. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  11208. @end example
  11209. @section hflip
  11210. Flip the input video horizontally.
  11211. For example, to horizontally flip the input video with @command{ffmpeg}:
  11212. @example
  11213. ffmpeg -i in.avi -vf "hflip" out.avi
  11214. @end example
  11215. @section histeq
  11216. This filter applies a global color histogram equalization on a
  11217. per-frame basis.
  11218. It can be used to correct video that has a compressed range of pixel
  11219. intensities. The filter redistributes the pixel intensities to
  11220. equalize their distribution across the intensity range. It may be
  11221. viewed as an "automatically adjusting contrast filter". This filter is
  11222. useful only for correcting degraded or poorly captured source
  11223. video.
  11224. The filter accepts the following options:
  11225. @table @option
  11226. @item strength
  11227. Determine the amount of equalization to be applied. As the strength
  11228. is reduced, the distribution of pixel intensities more-and-more
  11229. approaches that of the input frame. The value must be a float number
  11230. in the range [0,1] and defaults to 0.200.
  11231. @item intensity
  11232. Set the maximum intensity that can generated and scale the output
  11233. values appropriately. The strength should be set as desired and then
  11234. the intensity can be limited if needed to avoid washing-out. The value
  11235. must be a float number in the range [0,1] and defaults to 0.210.
  11236. @item antibanding
  11237. Set the antibanding level. If enabled the filter will randomly vary
  11238. the luminance of output pixels by a small amount to avoid banding of
  11239. the histogram. Possible values are @code{none}, @code{weak} or
  11240. @code{strong}. It defaults to @code{none}.
  11241. @end table
  11242. @anchor{histogram}
  11243. @section histogram
  11244. Compute and draw a color distribution histogram for the input video.
  11245. The computed histogram is a representation of the color component
  11246. distribution in an image.
  11247. Standard histogram displays the color components distribution in an image.
  11248. Displays color graph for each color component. Shows distribution of
  11249. the Y, U, V, A or R, G, B components, depending on input format, in the
  11250. current frame. Below each graph a color component scale meter is shown.
  11251. The filter accepts the following options:
  11252. @table @option
  11253. @item level_height
  11254. Set height of level. Default value is @code{200}.
  11255. Allowed range is [50, 2048].
  11256. @item scale_height
  11257. Set height of color scale. Default value is @code{12}.
  11258. Allowed range is [0, 40].
  11259. @item display_mode
  11260. Set display mode.
  11261. It accepts the following values:
  11262. @table @samp
  11263. @item stack
  11264. Per color component graphs are placed below each other.
  11265. @item parade
  11266. Per color component graphs are placed side by side.
  11267. @item overlay
  11268. Presents information identical to that in the @code{parade}, except
  11269. that the graphs representing color components are superimposed directly
  11270. over one another.
  11271. @end table
  11272. Default is @code{stack}.
  11273. @item levels_mode
  11274. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  11275. Default is @code{linear}.
  11276. @item components
  11277. Set what color components to display.
  11278. Default is @code{7}.
  11279. @item fgopacity
  11280. Set foreground opacity. Default is @code{0.7}.
  11281. @item bgopacity
  11282. Set background opacity. Default is @code{0.5}.
  11283. @item colors_mode
  11284. Set colors mode.
  11285. It accepts the following values:
  11286. @table @samp
  11287. @item whiteonblack
  11288. @item blackonwhite
  11289. @item whiteongray
  11290. @item blackongray
  11291. @item coloronblack
  11292. @item coloronwhite
  11293. @item colorongray
  11294. @item blackoncolor
  11295. @item whiteoncolor
  11296. @item grayoncolor
  11297. @end table
  11298. Default is @code{whiteonblack}.
  11299. @end table
  11300. @subsection Examples
  11301. @itemize
  11302. @item
  11303. Calculate and draw histogram:
  11304. @example
  11305. ffplay -i input -vf histogram
  11306. @end example
  11307. @end itemize
  11308. @anchor{hqdn3d}
  11309. @section hqdn3d
  11310. This is a high precision/quality 3d denoise filter. It aims to reduce
  11311. image noise, producing smooth images and making still images really
  11312. still. It should enhance compressibility.
  11313. It accepts the following optional parameters:
  11314. @table @option
  11315. @item luma_spatial
  11316. A non-negative floating point number which specifies spatial luma strength.
  11317. It defaults to 4.0.
  11318. @item chroma_spatial
  11319. A non-negative floating point number which specifies spatial chroma strength.
  11320. It defaults to 3.0*@var{luma_spatial}/4.0.
  11321. @item luma_tmp
  11322. A floating point number which specifies luma temporal strength. It defaults to
  11323. 6.0*@var{luma_spatial}/4.0.
  11324. @item chroma_tmp
  11325. A floating point number which specifies chroma temporal strength. It defaults to
  11326. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  11327. @end table
  11328. @subsection Commands
  11329. This filter supports same @ref{commands} as options.
  11330. The command accepts the same syntax of the corresponding option.
  11331. If the specified expression is not valid, it is kept at its current
  11332. value.
  11333. @anchor{hwdownload}
  11334. @section hwdownload
  11335. Download hardware frames to system memory.
  11336. The input must be in hardware frames, and the output a non-hardware format.
  11337. Not all formats will be supported on the output - it may be necessary to insert
  11338. an additional @option{format} filter immediately following in the graph to get
  11339. the output in a supported format.
  11340. @section hwmap
  11341. Map hardware frames to system memory or to another device.
  11342. This filter has several different modes of operation; which one is used depends
  11343. on the input and output formats:
  11344. @itemize
  11345. @item
  11346. Hardware frame input, normal frame output
  11347. Map the input frames to system memory and pass them to the output. If the
  11348. original hardware frame is later required (for example, after overlaying
  11349. something else on part of it), the @option{hwmap} filter can be used again
  11350. in the next mode to retrieve it.
  11351. @item
  11352. Normal frame input, hardware frame output
  11353. If the input is actually a software-mapped hardware frame, then unmap it -
  11354. that is, return the original hardware frame.
  11355. Otherwise, a device must be provided. Create new hardware surfaces on that
  11356. device for the output, then map them back to the software format at the input
  11357. and give those frames to the preceding filter. This will then act like the
  11358. @option{hwupload} filter, but may be able to avoid an additional copy when
  11359. the input is already in a compatible format.
  11360. @item
  11361. Hardware frame input and output
  11362. A device must be supplied for the output, either directly or with the
  11363. @option{derive_device} option. The input and output devices must be of
  11364. different types and compatible - the exact meaning of this is
  11365. system-dependent, but typically it means that they must refer to the same
  11366. underlying hardware context (for example, refer to the same graphics card).
  11367. If the input frames were originally created on the output device, then unmap
  11368. to retrieve the original frames.
  11369. Otherwise, map the frames to the output device - create new hardware frames
  11370. on the output corresponding to the frames on the input.
  11371. @end itemize
  11372. The following additional parameters are accepted:
  11373. @table @option
  11374. @item mode
  11375. Set the frame mapping mode. Some combination of:
  11376. @table @var
  11377. @item read
  11378. The mapped frame should be readable.
  11379. @item write
  11380. The mapped frame should be writeable.
  11381. @item overwrite
  11382. The mapping will always overwrite the entire frame.
  11383. This may improve performance in some cases, as the original contents of the
  11384. frame need not be loaded.
  11385. @item direct
  11386. The mapping must not involve any copying.
  11387. Indirect mappings to copies of frames are created in some cases where either
  11388. direct mapping is not possible or it would have unexpected properties.
  11389. Setting this flag ensures that the mapping is direct and will fail if that is
  11390. not possible.
  11391. @end table
  11392. Defaults to @var{read+write} if not specified.
  11393. @item derive_device @var{type}
  11394. Rather than using the device supplied at initialisation, instead derive a new
  11395. device of type @var{type} from the device the input frames exist on.
  11396. @item reverse
  11397. In a hardware to hardware mapping, map in reverse - create frames in the sink
  11398. and map them back to the source. This may be necessary in some cases where
  11399. a mapping in one direction is required but only the opposite direction is
  11400. supported by the devices being used.
  11401. This option is dangerous - it may break the preceding filter in undefined
  11402. ways if there are any additional constraints on that filter's output.
  11403. Do not use it without fully understanding the implications of its use.
  11404. @end table
  11405. @anchor{hwupload}
  11406. @section hwupload
  11407. Upload system memory frames to hardware surfaces.
  11408. The device to upload to must be supplied when the filter is initialised. If
  11409. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  11410. option or with the @option{derive_device} option. The input and output devices
  11411. must be of different types and compatible - the exact meaning of this is
  11412. system-dependent, but typically it means that they must refer to the same
  11413. underlying hardware context (for example, refer to the same graphics card).
  11414. The following additional parameters are accepted:
  11415. @table @option
  11416. @item derive_device @var{type}
  11417. Rather than using the device supplied at initialisation, instead derive a new
  11418. device of type @var{type} from the device the input frames exist on.
  11419. @end table
  11420. @anchor{hwupload_cuda}
  11421. @section hwupload_cuda
  11422. Upload system memory frames to a CUDA device.
  11423. It accepts the following optional parameters:
  11424. @table @option
  11425. @item device
  11426. The number of the CUDA device to use
  11427. @end table
  11428. @section hqx
  11429. Apply a high-quality magnification filter designed for pixel art. This filter
  11430. was originally created by Maxim Stepin.
  11431. It accepts the following option:
  11432. @table @option
  11433. @item n
  11434. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  11435. @code{hq3x} and @code{4} for @code{hq4x}.
  11436. Default is @code{3}.
  11437. @end table
  11438. @anchor{hstack}
  11439. @section hstack
  11440. Stack input videos horizontally.
  11441. All streams must be of same pixel format and of same height.
  11442. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  11443. to create same output.
  11444. The filter accepts the following option:
  11445. @table @option
  11446. @item inputs
  11447. Set number of input streams. Default is 2.
  11448. @item shortest
  11449. If set to 1, force the output to terminate when the shortest input
  11450. terminates. Default value is 0.
  11451. @end table
  11452. @section hsvhold
  11453. Turns a certain HSV range into gray values.
  11454. This filter measures color difference between set HSV color in options
  11455. and ones measured in video stream. Depending on options, output
  11456. colors can be changed to be gray or not.
  11457. The filter accepts the following options:
  11458. @table @option
  11459. @item hue
  11460. Set the hue value which will be used in color difference calculation.
  11461. Allowed range is from -360 to 360. Default value is 0.
  11462. @item sat
  11463. Set the saturation value which will be used in color difference calculation.
  11464. Allowed range is from -1 to 1. Default value is 0.
  11465. @item val
  11466. Set the value which will be used in color difference calculation.
  11467. Allowed range is from -1 to 1. Default value is 0.
  11468. @item similarity
  11469. Set similarity percentage with the key color.
  11470. Allowed range is from 0 to 1. Default value is 0.01.
  11471. 0.00001 matches only the exact key color, while 1.0 matches everything.
  11472. @item blend
  11473. Blend percentage.
  11474. Allowed range is from 0 to 1. Default value is 0.
  11475. 0.0 makes pixels either fully gray, or not gray at all.
  11476. Higher values result in more gray pixels, with a higher gray pixel
  11477. the more similar the pixels color is to the key color.
  11478. @end table
  11479. @section hsvkey
  11480. Turns a certain HSV range into transparency.
  11481. This filter measures color difference between set HSV color in options
  11482. and ones measured in video stream. Depending on options, output
  11483. colors can be changed to transparent by adding alpha channel.
  11484. The filter accepts the following options:
  11485. @table @option
  11486. @item hue
  11487. Set the hue value which will be used in color difference calculation.
  11488. Allowed range is from -360 to 360. Default value is 0.
  11489. @item sat
  11490. Set the saturation value which will be used in color difference calculation.
  11491. Allowed range is from -1 to 1. Default value is 0.
  11492. @item val
  11493. Set the value which will be used in color difference calculation.
  11494. Allowed range is from -1 to 1. Default value is 0.
  11495. @item similarity
  11496. Set similarity percentage with the key color.
  11497. Allowed range is from 0 to 1. Default value is 0.01.
  11498. 0.00001 matches only the exact key color, while 1.0 matches everything.
  11499. @item blend
  11500. Blend percentage.
  11501. Allowed range is from 0 to 1. Default value is 0.
  11502. 0.0 makes pixels either fully transparent, or not transparent at all.
  11503. Higher values result in semi-transparent pixels, with a higher transparency
  11504. the more similar the pixels color is to the key color.
  11505. @end table
  11506. @section hue
  11507. Modify the hue and/or the saturation of the input.
  11508. It accepts the following parameters:
  11509. @table @option
  11510. @item h
  11511. Specify the hue angle as a number of degrees. It accepts an expression,
  11512. and defaults to "0".
  11513. @item s
  11514. Specify the saturation in the [-10,10] range. It accepts an expression and
  11515. defaults to "1".
  11516. @item H
  11517. Specify the hue angle as a number of radians. It accepts an
  11518. expression, and defaults to "0".
  11519. @item b
  11520. Specify the brightness in the [-10,10] range. It accepts an expression and
  11521. defaults to "0".
  11522. @end table
  11523. @option{h} and @option{H} are mutually exclusive, and can't be
  11524. specified at the same time.
  11525. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  11526. expressions containing the following constants:
  11527. @table @option
  11528. @item n
  11529. frame count of the input frame starting from 0
  11530. @item pts
  11531. presentation timestamp of the input frame expressed in time base units
  11532. @item r
  11533. frame rate of the input video, NAN if the input frame rate is unknown
  11534. @item t
  11535. timestamp expressed in seconds, NAN if the input timestamp is unknown
  11536. @item tb
  11537. time base of the input video
  11538. @end table
  11539. @subsection Examples
  11540. @itemize
  11541. @item
  11542. Set the hue to 90 degrees and the saturation to 1.0:
  11543. @example
  11544. hue=h=90:s=1
  11545. @end example
  11546. @item
  11547. Same command but expressing the hue in radians:
  11548. @example
  11549. hue=H=PI/2:s=1
  11550. @end example
  11551. @item
  11552. Rotate hue and make the saturation swing between 0
  11553. and 2 over a period of 1 second:
  11554. @example
  11555. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  11556. @end example
  11557. @item
  11558. Apply a 3 seconds saturation fade-in effect starting at 0:
  11559. @example
  11560. hue="s=min(t/3\,1)"
  11561. @end example
  11562. The general fade-in expression can be written as:
  11563. @example
  11564. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  11565. @end example
  11566. @item
  11567. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  11568. @example
  11569. hue="s=max(0\, min(1\, (8-t)/3))"
  11570. @end example
  11571. The general fade-out expression can be written as:
  11572. @example
  11573. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  11574. @end example
  11575. @end itemize
  11576. @subsection Commands
  11577. This filter supports the following commands:
  11578. @table @option
  11579. @item b
  11580. @item s
  11581. @item h
  11582. @item H
  11583. Modify the hue and/or the saturation and/or brightness of the input video.
  11584. The command accepts the same syntax of the corresponding option.
  11585. If the specified expression is not valid, it is kept at its current
  11586. value.
  11587. @end table
  11588. @section huesaturation
  11589. Apply hue-saturation-intensity adjustments to input video stream.
  11590. This filter operates in RGB colorspace.
  11591. This filter accepts the following options:
  11592. @table @option
  11593. @item hue
  11594. Set the hue shift in degrees to apply. Default is 0.
  11595. Allowed range is from -180 to 180.
  11596. @item saturation
  11597. Set the saturation shift. Default is 0.
  11598. Allowed range is from -1 to 1.
  11599. @item intensity
  11600. Set the intensity shift. Default is 0.
  11601. Allowed range is from -1 to 1.
  11602. @item colors
  11603. Set which primary and complementary colors are going to be adjusted.
  11604. This options is set by providing one or multiple values.
  11605. This can select multiple colors at once. By default all colors are selected.
  11606. @table @samp
  11607. @item r
  11608. Adjust reds.
  11609. @item y
  11610. Adjust yellows.
  11611. @item g
  11612. Adjust greens.
  11613. @item c
  11614. Adjust cyans.
  11615. @item b
  11616. Adjust blues.
  11617. @item m
  11618. Adjust magentas.
  11619. @item a
  11620. Adjust all colors.
  11621. @end table
  11622. @item strength
  11623. Set strength of filtering. Allowed range is from 0 to 100.
  11624. Default value is 1.
  11625. @item rw, gw, bw
  11626. Set weight for each RGB component. Allowed range is from 0 to 1.
  11627. By default is set to 0.333, 0.334, 0.333.
  11628. Those options are used in saturation and lightess processing.
  11629. @item lightness
  11630. Set preserving lightness, by default is disabled.
  11631. Adjusting hues can change lightness from original RGB triplet,
  11632. with this option enabled lightness is kept at same value.
  11633. @end table
  11634. @section hysteresis
  11635. Grow first stream into second stream by connecting components.
  11636. This makes it possible to build more robust edge masks.
  11637. This filter accepts the following options:
  11638. @table @option
  11639. @item planes
  11640. Set which planes will be processed as bitmap, unprocessed planes will be
  11641. copied from first stream.
  11642. By default value 0xf, all planes will be processed.
  11643. @item threshold
  11644. Set threshold which is used in filtering. If pixel component value is higher than
  11645. this value filter algorithm for connecting components is activated.
  11646. By default value is 0.
  11647. @end table
  11648. The @code{hysteresis} filter also supports the @ref{framesync} options.
  11649. @section iccdetect
  11650. Detect the colorspace from an embedded ICC profile (if present), and update
  11651. the frame's tags accordingly.
  11652. This filter accepts the following options:
  11653. @table @option
  11654. @item force
  11655. If true, the frame's existing colorspace tags will always be overridden by
  11656. values detected from an ICC profile. Otherwise, they will only be assigned if
  11657. they contain @code{unknown}. Enabled by default.
  11658. @end table
  11659. @section iccgen
  11660. Generate ICC profiles and attach them to frames.
  11661. This filter accepts the following options:
  11662. @table @option
  11663. @item color_primaries
  11664. @item color_trc
  11665. Configure the colorspace that the ICC profile will be generated for. The
  11666. default value of @code{auto} infers the value from the input frame's metadata,
  11667. defaulting to BT.709/sRGB as appropriate.
  11668. See the @ref{setparams} filter for a list of possible values, but note that
  11669. @code{unknown} are not valid values for this filter.
  11670. @item force
  11671. If true, an ICC profile will be generated even if it would overwrite an
  11672. already existing ICC profile. Disabled by default.
  11673. @end table
  11674. @section identity
  11675. Obtain the identity score between two input videos.
  11676. This filter takes two input videos.
  11677. Both input videos must have the same resolution and pixel format for
  11678. this filter to work correctly. Also it assumes that both inputs
  11679. have the same number of frames, which are compared one by one.
  11680. The obtained per component, average, min and max identity score is printed through
  11681. the logging system.
  11682. The filter stores the calculated identity scores of each frame in frame metadata.
  11683. This filter also supports the @ref{framesync} options.
  11684. In the below example the input file @file{main.mpg} being processed is compared
  11685. with the reference file @file{ref.mpg}.
  11686. @example
  11687. ffmpeg -i main.mpg -i ref.mpg -lavfi identity -f null -
  11688. @end example
  11689. @section idet
  11690. Detect video interlacing type.
  11691. This filter tries to detect if the input frames are interlaced, progressive,
  11692. top or bottom field first. It will also try to detect fields that are
  11693. repeated between adjacent frames (a sign of telecine).
  11694. Single frame detection considers only immediately adjacent frames when classifying each frame.
  11695. Multiple frame detection incorporates the classification history of previous frames.
  11696. The filter will log these metadata values:
  11697. @table @option
  11698. @item single.current_frame
  11699. Detected type of current frame using single-frame detection. One of:
  11700. ``tff'' (top field first), ``bff'' (bottom field first),
  11701. ``progressive'', or ``undetermined''
  11702. @item single.tff
  11703. Cumulative number of frames detected as top field first using single-frame detection.
  11704. @item multiple.tff
  11705. Cumulative number of frames detected as top field first using multiple-frame detection.
  11706. @item single.bff
  11707. Cumulative number of frames detected as bottom field first using single-frame detection.
  11708. @item multiple.current_frame
  11709. Detected type of current frame using multiple-frame detection. One of:
  11710. ``tff'' (top field first), ``bff'' (bottom field first),
  11711. ``progressive'', or ``undetermined''
  11712. @item multiple.bff
  11713. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  11714. @item single.progressive
  11715. Cumulative number of frames detected as progressive using single-frame detection.
  11716. @item multiple.progressive
  11717. Cumulative number of frames detected as progressive using multiple-frame detection.
  11718. @item single.undetermined
  11719. Cumulative number of frames that could not be classified using single-frame detection.
  11720. @item multiple.undetermined
  11721. Cumulative number of frames that could not be classified using multiple-frame detection.
  11722. @item repeated.current_frame
  11723. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  11724. @item repeated.neither
  11725. Cumulative number of frames with no repeated field.
  11726. @item repeated.top
  11727. Cumulative number of frames with the top field repeated from the previous frame's top field.
  11728. @item repeated.bottom
  11729. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  11730. @end table
  11731. The filter accepts the following options:
  11732. @table @option
  11733. @item intl_thres
  11734. Set interlacing threshold.
  11735. @item prog_thres
  11736. Set progressive threshold.
  11737. @item rep_thres
  11738. Threshold for repeated field detection.
  11739. @item half_life
  11740. Number of frames after which a given frame's contribution to the
  11741. statistics is halved (i.e., it contributes only 0.5 to its
  11742. classification). The default of 0 means that all frames seen are given
  11743. full weight of 1.0 forever.
  11744. @item analyze_interlaced_flag
  11745. When this is not 0 then idet will use the specified number of frames to determine
  11746. if the interlaced flag is accurate, it will not count undetermined frames.
  11747. If the flag is found to be accurate it will be used without any further
  11748. computations, if it is found to be inaccurate it will be cleared without any
  11749. further computations. This allows inserting the idet filter as a low computational
  11750. method to clean up the interlaced flag
  11751. @end table
  11752. @section il
  11753. Deinterleave or interleave fields.
  11754. This filter allows one to process interlaced images fields without
  11755. deinterlacing them. Deinterleaving splits the input frame into 2
  11756. fields (so called half pictures). Odd lines are moved to the top
  11757. half of the output image, even lines to the bottom half.
  11758. You can process (filter) them independently and then re-interleave them.
  11759. The filter accepts the following options:
  11760. @table @option
  11761. @item luma_mode, l
  11762. @item chroma_mode, c
  11763. @item alpha_mode, a
  11764. Available values for @var{luma_mode}, @var{chroma_mode} and
  11765. @var{alpha_mode} are:
  11766. @table @samp
  11767. @item none
  11768. Do nothing.
  11769. @item deinterleave, d
  11770. Deinterleave fields, placing one above the other.
  11771. @item interleave, i
  11772. Interleave fields. Reverse the effect of deinterleaving.
  11773. @end table
  11774. Default value is @code{none}.
  11775. @item luma_swap, ls
  11776. @item chroma_swap, cs
  11777. @item alpha_swap, as
  11778. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  11779. @end table
  11780. @subsection Commands
  11781. This filter supports the all above options as @ref{commands}.
  11782. @section inflate
  11783. Apply inflate effect to the video.
  11784. This filter replaces the pixel by the local(3x3) average by taking into account
  11785. only values higher than the pixel.
  11786. It accepts the following options:
  11787. @table @option
  11788. @item threshold0
  11789. @item threshold1
  11790. @item threshold2
  11791. @item threshold3
  11792. Limit the maximum change for each plane, default is 65535.
  11793. If 0, plane will remain unchanged.
  11794. @end table
  11795. @subsection Commands
  11796. This filter supports the all above options as @ref{commands}.
  11797. @section interlace
  11798. Simple interlacing filter from progressive contents. This interleaves upper (or
  11799. lower) lines from odd frames with lower (or upper) lines from even frames,
  11800. halving the frame rate and preserving image height.
  11801. @example
  11802. Original Original New Frame
  11803. Frame 'j' Frame 'j+1' (tff)
  11804. ========== =========== ==================
  11805. Line 0 --------------------> Frame 'j' Line 0
  11806. Line 1 Line 1 ----> Frame 'j+1' Line 1
  11807. Line 2 ---------------------> Frame 'j' Line 2
  11808. Line 3 Line 3 ----> Frame 'j+1' Line 3
  11809. ... ... ...
  11810. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  11811. @end example
  11812. It accepts the following optional parameters:
  11813. @table @option
  11814. @item scan
  11815. This determines whether the interlaced frame is taken from the even
  11816. (tff - default) or odd (bff) lines of the progressive frame.
  11817. @item lowpass
  11818. Vertical lowpass filter to avoid twitter interlacing and
  11819. reduce moire patterns.
  11820. @table @samp
  11821. @item 0, off
  11822. Disable vertical lowpass filter
  11823. @item 1, linear
  11824. Enable linear filter (default)
  11825. @item 2, complex
  11826. Enable complex filter. This will slightly less reduce twitter and moire
  11827. but better retain detail and subjective sharpness impression.
  11828. @end table
  11829. @end table
  11830. @section kerndeint
  11831. Deinterlace input video by applying Donald Graft's adaptive kernel
  11832. deinterling. Work on interlaced parts of a video to produce
  11833. progressive frames.
  11834. The description of the accepted parameters follows.
  11835. @table @option
  11836. @item thresh
  11837. Set the threshold which affects the filter's tolerance when
  11838. determining if a pixel line must be processed. It must be an integer
  11839. in the range [0,255] and defaults to 10. A value of 0 will result in
  11840. applying the process on every pixels.
  11841. @item map
  11842. Paint pixels exceeding the threshold value to white if set to 1.
  11843. Default is 0.
  11844. @item order
  11845. Set the fields order. Swap fields if set to 1, leave fields alone if
  11846. 0. Default is 0.
  11847. @item sharp
  11848. Enable additional sharpening if set to 1. Default is 0.
  11849. @item twoway
  11850. Enable twoway sharpening if set to 1. Default is 0.
  11851. @end table
  11852. @subsection Examples
  11853. @itemize
  11854. @item
  11855. Apply default values:
  11856. @example
  11857. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  11858. @end example
  11859. @item
  11860. Enable additional sharpening:
  11861. @example
  11862. kerndeint=sharp=1
  11863. @end example
  11864. @item
  11865. Paint processed pixels in white:
  11866. @example
  11867. kerndeint=map=1
  11868. @end example
  11869. @end itemize
  11870. @section kirsch
  11871. Apply kirsch operator to input video stream.
  11872. The filter accepts the following option:
  11873. @table @option
  11874. @item planes
  11875. Set which planes will be processed, unprocessed planes will be copied.
  11876. By default value 0xf, all planes will be processed.
  11877. @item scale
  11878. Set value which will be multiplied with filtered result.
  11879. @item delta
  11880. Set value which will be added to filtered result.
  11881. @end table
  11882. @subsection Commands
  11883. This filter supports the all above options as @ref{commands}.
  11884. @section lagfun
  11885. Slowly update darker pixels.
  11886. This filter makes short flashes of light appear longer.
  11887. This filter accepts the following options:
  11888. @table @option
  11889. @item decay
  11890. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  11891. @item planes
  11892. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  11893. @end table
  11894. @subsection Commands
  11895. This filter supports the all above options as @ref{commands}.
  11896. @section lenscorrection
  11897. Correct radial lens distortion
  11898. This filter can be used to correct for radial distortion as can result from the use
  11899. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  11900. one can use tools available for example as part of opencv or simply trial-and-error.
  11901. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  11902. and extract the k1 and k2 coefficients from the resulting matrix.
  11903. Note that effectively the same filter is available in the open-source tools Krita and
  11904. Digikam from the KDE project.
  11905. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  11906. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  11907. brightness distribution, so you may want to use both filters together in certain
  11908. cases, though you will have to take care of ordering, i.e. whether vignetting should
  11909. be applied before or after lens correction.
  11910. @subsection Options
  11911. The filter accepts the following options:
  11912. @table @option
  11913. @item cx
  11914. Relative x-coordinate of the focal point of the image, and thereby the center of the
  11915. distortion. This value has a range [0,1] and is expressed as fractions of the image
  11916. width. Default is 0.5.
  11917. @item cy
  11918. Relative y-coordinate of the focal point of the image, and thereby the center of the
  11919. distortion. This value has a range [0,1] and is expressed as fractions of the image
  11920. height. Default is 0.5.
  11921. @item k1
  11922. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  11923. no correction. Default is 0.
  11924. @item k2
  11925. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  11926. 0 means no correction. Default is 0.
  11927. @item i
  11928. Set interpolation type. Can be @code{nearest} or @code{bilinear}.
  11929. Default is @code{nearest}.
  11930. @item fc
  11931. Specify the color of the unmapped pixels. For the syntax of this option,
  11932. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11933. manual,ffmpeg-utils}. Default color is @code{black@@0}.
  11934. @end table
  11935. The formula that generates the correction is:
  11936. @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)
  11937. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  11938. distances from the focal point in the source and target images, respectively.
  11939. @subsection Commands
  11940. This filter supports the all above options as @ref{commands}.
  11941. @section lensfun
  11942. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  11943. The @code{lensfun} filter requires the camera make, camera model, and lens model
  11944. to apply the lens correction. The filter will load the lensfun database and
  11945. query it to find the corresponding camera and lens entries in the database. As
  11946. long as these entries can be found with the given options, the filter can
  11947. perform corrections on frames. Note that incomplete strings will result in the
  11948. filter choosing the best match with the given options, and the filter will
  11949. output the chosen camera and lens models (logged with level "info"). You must
  11950. provide the make, camera model, and lens model as they are required.
  11951. To obtain a list of available makes and models, leave out one or both of @code{make} and
  11952. @code{model} options. The filter will send the full list to the log with level @code{INFO}.
  11953. The first column is the make and the second column is the model.
  11954. To obtain a list of available lenses, set any values for make and model and leave out the
  11955. @code{lens_model} option. The filter will send the full list of lenses in the log with level
  11956. @code{INFO}. The ffmpeg tool will exit after the list is printed.
  11957. The filter accepts the following options:
  11958. @table @option
  11959. @item make
  11960. The make of the camera (for example, "Canon"). This option is required.
  11961. @item model
  11962. The model of the camera (for example, "Canon EOS 100D"). This option is
  11963. required.
  11964. @item lens_model
  11965. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  11966. option is required.
  11967. @item db_path
  11968. The full path to the lens database folder. If not set, the filter will attempt to
  11969. load the database from the install path when the library was built. Default is unset.
  11970. @item mode
  11971. The type of correction to apply. The following values are valid options:
  11972. @table @samp
  11973. @item vignetting
  11974. Enables fixing lens vignetting.
  11975. @item geometry
  11976. Enables fixing lens geometry. This is the default.
  11977. @item subpixel
  11978. Enables fixing chromatic aberrations.
  11979. @item vig_geo
  11980. Enables fixing lens vignetting and lens geometry.
  11981. @item vig_subpixel
  11982. Enables fixing lens vignetting and chromatic aberrations.
  11983. @item distortion
  11984. Enables fixing both lens geometry and chromatic aberrations.
  11985. @item all
  11986. Enables all possible corrections.
  11987. @end table
  11988. @item focal_length
  11989. The focal length of the image/video (zoom; expected constant for video). For
  11990. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  11991. range should be chosen when using that lens. Default 18.
  11992. @item aperture
  11993. The aperture of the image/video (expected constant for video). Note that
  11994. aperture is only used for vignetting correction. Default 3.5.
  11995. @item focus_distance
  11996. The focus distance of the image/video (expected constant for video). Note that
  11997. focus distance is only used for vignetting and only slightly affects the
  11998. vignetting correction process. If unknown, leave it at the default value (which
  11999. is 1000).
  12000. @item scale
  12001. The scale factor which is applied after transformation. After correction the
  12002. video is no longer necessarily rectangular. This parameter controls how much of
  12003. the resulting image is visible. The value 0 means that a value will be chosen
  12004. automatically such that there is little or no unmapped area in the output
  12005. image. 1.0 means that no additional scaling is done. Lower values may result
  12006. in more of the corrected image being visible, while higher values may avoid
  12007. unmapped areas in the output.
  12008. @item target_geometry
  12009. The target geometry of the output image/video. The following values are valid
  12010. options:
  12011. @table @samp
  12012. @item rectilinear (default)
  12013. @item fisheye
  12014. @item panoramic
  12015. @item equirectangular
  12016. @item fisheye_orthographic
  12017. @item fisheye_stereographic
  12018. @item fisheye_equisolid
  12019. @item fisheye_thoby
  12020. @end table
  12021. @item reverse
  12022. Apply the reverse of image correction (instead of correcting distortion, apply
  12023. it).
  12024. @item interpolation
  12025. The type of interpolation used when correcting distortion. The following values
  12026. are valid options:
  12027. @table @samp
  12028. @item nearest
  12029. @item linear (default)
  12030. @item lanczos
  12031. @end table
  12032. @end table
  12033. @subsection Examples
  12034. @itemize
  12035. @item
  12036. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  12037. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  12038. aperture of "8.0".
  12039. @example
  12040. 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
  12041. @end example
  12042. @item
  12043. Apply the same as before, but only for the first 5 seconds of video.
  12044. @example
  12045. 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
  12046. @end example
  12047. @end itemize
  12048. @section libplacebo
  12049. Flexible GPU-accelerated processing filter based on libplacebo
  12050. (@url{https://code.videolan.org/videolan/libplacebo}). Note that this filter
  12051. currently only accepts Vulkan input frames.
  12052. @subsection Options
  12053. The options for this filter are divided into the following sections:
  12054. @subsubsection Output mode
  12055. These options control the overall output mode. By default, libplacebo will try
  12056. to preserve the source colorimetry and size as best as it can, but it will
  12057. apply any embedded film grain, dolby vision metadata or anamorphic SAR present
  12058. in source frames.
  12059. @table @option
  12060. @item w
  12061. @item h
  12062. Set the output video dimension expression. Default value is the input dimension.
  12063. Allows for the same expressions as the @ref{scale} filter.
  12064. @item format
  12065. Set the output format override. If unset (the default), frames will be output
  12066. in the same format as the respective input frames. Otherwise, format conversion
  12067. will be performed.
  12068. @item force_original_aspect_ratio
  12069. @item force_divisible_by
  12070. Work the same as the identical @ref{scale} filter options.
  12071. @item normalize_sar
  12072. If enabled, output frames will always have a pixel aspect ratio of 1:1. This
  12073. will introduce padding/cropping as necessary. If disabled (the default), any
  12074. aspect ratio mismatches, including those from e.g. anamorphic video sources,
  12075. are forwarded to the output pixel aspect ratio.
  12076. @item pad_crop_ratio
  12077. Specifies a ratio (between @code{0.0} and @code{1.0}) between padding and
  12078. cropping when the input aspect ratio does not match the output aspect ratio and
  12079. @option{normalize_sar} is in effect. The default of @code{0.0} always pads the
  12080. content with black borders, while a value of @code{1.0} always crops off parts
  12081. of the content. Intermediate values are possible, leading to a mix of the two
  12082. approaches.
  12083. @item colorspace
  12084. @item color_primaries
  12085. @item color_trc
  12086. @item range
  12087. Configure the colorspace that output frames will be delivered in. The default
  12088. value of @code{auto} outputs frames in the same format as the input frames,
  12089. leading to no change. For any other value, conversion will be performed.
  12090. See the @ref{setparams} filter for a list of possible values.
  12091. @item apply_filmgrain
  12092. Apply film grain (e.g. AV1 or H.274) if present in source frames, and strip
  12093. it from the output. Enabled by default.
  12094. @item apply_dolbyvision
  12095. Apply Dolby Vision RPU metadata if present in source frames, and strip it from
  12096. the output. Enabled by default. Note that Dolby Vision will always output
  12097. BT.2020+PQ, overriding the usual input frame metadata. These will also be
  12098. picked as the values of @code{auto} for the respective frame output options.
  12099. @end table
  12100. @subsubsection Scaling
  12101. The options in this section control how libplacebo performs upscaling and (if
  12102. necessary) downscaling. Note that libplacebo will always internally operate on
  12103. 4:4:4 content, so any sub-sampled chroma formats such as @code{yuv420p} will
  12104. necessarily be upsampled and downsampled as part of the rendering process. That
  12105. means scaling might be in effect even if the source and destination resolution
  12106. are the same.
  12107. @table @option
  12108. @item upscaler
  12109. @item downscaler
  12110. Configure the filter kernel used for upscaling and downscaling. The respective
  12111. defaults are @code{spline36} and @code{mitchell}. For a full list of possible
  12112. values, pass @code{help} to these options. The most important values are:
  12113. @table @samp
  12114. @item none
  12115. Forces the use of built-in GPU texture sampling (typically bilinear). Extremely
  12116. fast but poor quality, especially when downscaling.
  12117. @item bilinear
  12118. Bilinear interpolation. Can generally be done for free on GPUs, except when
  12119. doing so would lead to aliasing. Fast and low quality.
  12120. @item nearest
  12121. Nearest-neighbour interpolation. Sharp but highly aliasing.
  12122. @item oversample
  12123. Algorithm that looks visually similar to nearest-neighbour interpolation but
  12124. tries to preserve pixel aspect ratio. Good for pixel art, since it results in
  12125. minimal distortion of the artistic appearance.
  12126. @item lanczos
  12127. Standard sinc-sinc interpolation kernel.
  12128. @item spline36
  12129. Cubic spline approximation of lanczos. No difference in performance, but has
  12130. very slightly less ringing.
  12131. @item ewa_lanczos
  12132. Elliptically weighted average version of lanczos, based on a jinc-sinc kernel.
  12133. This is also popularly referred to as just "Jinc scaling". Slow but very high
  12134. quality.
  12135. @item gaussian
  12136. Gaussian kernel. Has certain ideal mathematical properties, but subjectively
  12137. very blurry.
  12138. @item mitchell
  12139. Cubic BC spline with parameters recommended by Mitchell and Netravali. Very
  12140. little ringing.
  12141. @end table
  12142. @item lut_entries
  12143. Configures the size of scaler LUTs, ranging from @code{1} to @code{256}. The
  12144. default of @code{0} will pick libplacebo's internal default, typically
  12145. @code{64}.
  12146. @item antiringing
  12147. Enables anti-ringing (for non-EWA filters). The value (between @code{0.0} and
  12148. @code{1.0}) configures the strength of the anti-ringing algorithm. May increase
  12149. aliasing if set too high. Disabled by default.
  12150. @item sigmoid
  12151. Enable sigmoidal compression during upscaling. Reduces ringing slightly.
  12152. Enabled by default.
  12153. @end table
  12154. @subsubsection Debanding
  12155. Libplacebo comes with a built-in debanding filter that is good at counteracting
  12156. many common sources of banding and blocking. Turning this on is highly
  12157. recommended whenever quality is desired.
  12158. @table @option
  12159. @item deband
  12160. Enable (fast) debanding algorithm. Disabled by default.
  12161. @item deband_iterations
  12162. Number of deband iterations of the debanding algorithm. Each iteration is
  12163. performed with progressively increased radius (and diminished threshold).
  12164. Recommended values are in the range @code{1} to @code{4}. Defaults to @code{1}.
  12165. @item deband_threshold
  12166. Debanding filter strength. Higher numbers lead to more aggressive debanding.
  12167. Defaults to @code{4.0}.
  12168. @item deband_radius
  12169. Debanding filter radius. A higher radius is better for slow gradients, while
  12170. a lower radius is better for steep gradients. Defaults to @code{16.0}.
  12171. @item deband_grain
  12172. Amount of extra output grain to add. Helps hide imperfections. Defaults to
  12173. @code{6.0}.
  12174. @end table
  12175. @subsubsection Color adjustment
  12176. A collection of subjective color controls. Not very rigorous, so the exact
  12177. effect will vary somewhat depending on the input primaries and colorspace.
  12178. @table @option
  12179. @item brightness
  12180. Brightness boost, between @code{-1.0} and @code{1.0}. Defaults to @code{0.0}.
  12181. @item contrast
  12182. Contrast gain, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  12183. @item saturation
  12184. Saturation gain, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  12185. @item hue
  12186. Hue shift in radians, between @code{-3.14} and @code{3.14}. Defaults to
  12187. @code{0.0}. This will rotate the UV subvector, defaulting to BT.709
  12188. coefficients for RGB inputs.
  12189. @item gamma
  12190. Gamma adjustment, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  12191. @item cones
  12192. Cone model to use for color blindness simulation. Accepts any combination of
  12193. @code{l}, @code{m} and @code{s}. Here are some examples:
  12194. @table @samp
  12195. @item m
  12196. Deuteranomaly / deuteranopia (affecting 3%-4% of the population)
  12197. @item l
  12198. Protanomaly / protanopia (affecting 1%-2% of the population)
  12199. @item l+m
  12200. Monochromacy (very rare)
  12201. @item l+m+s
  12202. Achromatopsy (complete loss of daytime vision, extremely rare)
  12203. @end table
  12204. @item cone-strength
  12205. Gain factor for the cones specified by @code{cones}, between @code{0.0} and
  12206. @code{10.0}. A value of @code{1.0} results in no change to color vision. A
  12207. value of @code{0.0} (the default) simulates complete loss of those cones. Values
  12208. above @code{1.0} result in exaggerating the differences between cones, which
  12209. may help compensate for reduced color vision.
  12210. @end table
  12211. @subsubsection Peak detection
  12212. To help deal with sources that only have static HDR10 metadata (or no tagging
  12213. whatsoever), libplacebo uses its own internal frame analysis compute shader to
  12214. analyze source frames and adapt the tone mapping function in realtime. If this
  12215. is too slow, or if exactly reproducible frame-perfect results are needed, it's
  12216. recommended to turn this feature off.
  12217. @table @option
  12218. @item peak_detect
  12219. Enable HDR peak detection. Ignores static MaxCLL/MaxFALL values in favor of
  12220. dynamic detection from the input. Note that the detected values do not get
  12221. written back to the output frames, they merely guide the internal tone mapping
  12222. process. Enabled by default.
  12223. @item smoothing_period
  12224. Peak detection smoothing period, between @code{0.0} and @code{1000.0}. Higher
  12225. values result in peak detection becoming less responsive to changes in the
  12226. input. Defaults to @code{100.0}.
  12227. @item minimum_peak
  12228. Lower bound on the detected peak (relative to SDR white), between @code{0.0}
  12229. and @code{100.0}. Defaults to @code{1.0}.
  12230. @item scene_threshold_low
  12231. @item scene_threshold_high
  12232. Lower and upper thresholds for scene change detection. Expressed in a
  12233. logarithmic scale between @code{0.0} and @code{100.0}. Default to @code{5.5}
  12234. and @code{10.0}, respectively. Setting either to a negative value disables
  12235. this functionality.
  12236. @item overshoot
  12237. Peak smoothing overshoot margin, between @code{0.0} and @code{1.0}. Provides a
  12238. safety margin to prevent clipping as a result of peak smoothing. Defaults to
  12239. @code{0.05}, corresponding to a margin of 5%.
  12240. @end table
  12241. @subsubsection Tone mapping
  12242. The options in this section control how libplacebo performs tone-mapping and
  12243. gamut-mapping when dealing with mismatches between wide-gamut or HDR content.
  12244. In general, libplacebo relies on accurate source tagging and mastering display
  12245. gamut information to produce the best results.
  12246. @table @option
  12247. @item intent
  12248. Rendering intent to use when adapting between different primary color gamuts
  12249. (after tone-mapping).
  12250. @table @samp
  12251. @item perceptual
  12252. Perceptual gamut mapping. Currently equivalent to relative colorimetric.
  12253. @item relative
  12254. Relative colorimetric. This is the default.
  12255. @item absolute
  12256. Absolute colorimetric.
  12257. @item saturation
  12258. Saturation mapping. Forcibly stretches the source gamut to the target gamut.
  12259. @end table
  12260. @item gamut_mode
  12261. How to handle out-of-gamut colors that can occur as a result of colorimetric
  12262. gamut mapping.
  12263. @table @samp
  12264. @item clip
  12265. Do nothing, simply clip out-of-range colors to the RGB volume. This is the
  12266. default.
  12267. @item warn
  12268. Highlight out-of-gamut pixels (by coloring them pink).
  12269. @item darken
  12270. Linearly reduces content brightness to preserves saturated details, followed by
  12271. clipping the remaining out-of-gamut colors. As the name implies, this makes
  12272. everything darker, but provides a good balance between preserving details and
  12273. colors.
  12274. @item desaturate
  12275. Hard-desaturates out-of-gamut colors towards white, while preserving the
  12276. luminance. Has a tendency to shift colors.
  12277. @end table
  12278. @item tonemapping
  12279. Tone-mapping algorithm to use. Available values are:
  12280. @table @samp
  12281. @item auto
  12282. Automatic selection based on internal heuristics. This is the default.
  12283. @item clip
  12284. Performs no tone-mapping, just clips out-of-range colors. Retains perfect color
  12285. accuracy for in-range colors but completely destroys out-of-range information.
  12286. Does not perform any black point adaptation. Not configurable.
  12287. @item st2094-40
  12288. EETF from SMPTE ST 2094-40 Annex B, which applies the Bezier curves from HDR10+
  12289. dynamic metadata based on Bezier curves to perform tone-mapping. The OOTF used
  12290. is adjusted based on the ratio between the targeted and actual display peak
  12291. luminances.
  12292. @item st2094-10
  12293. EETF from SMPTE ST 2094-10 Annex B.2, which takes into account the input signal
  12294. average luminance in addition to the maximum/minimum. The configurable contrast
  12295. parameter influences the slope of the linear output segment, defaulting to
  12296. @code{1.0} for no increase/decrease in contrast. Note that this does not
  12297. currently include the subjective gain/offset/gamma controls defined in Annex
  12298. B.3.
  12299. @item bt.2390
  12300. EETF from the ITU-R Report BT.2390, a hermite spline roll-off with linear
  12301. segment. The knee point offset is configurable. Note that this parameter
  12302. defaults to @code{1.0}, rather than the value of @code{0.5} from the ITU-R
  12303. spec.
  12304. @item bt.2446a
  12305. EETF from ITU-R Report BT.2446, method A. Designed for well-mastered HDR
  12306. sources. Can be used for both forward and inverse tone mapping. Not
  12307. configurable.
  12308. @item spline
  12309. Simple spline consisting of two polynomials, joined by a single pivot point.
  12310. The parameter gives the pivot point (in PQ space), defaulting to @code{0.30}.
  12311. Can be used for both forward and inverse tone mapping.
  12312. @item reinhard
  12313. Simple non-linear, global tone mapping algorithm. The parameter specifies the
  12314. local contrast coefficient at the display peak. Essentially, a parameter of
  12315. @code{0.5} implies that the reference white will be about half as bright as
  12316. when clipping. Defaults to @code{0.5}, which results in the simplest
  12317. formulation of this function.
  12318. @item mobius
  12319. Generalization of the reinhard tone mapping algorithm to support an additional
  12320. linear slope near black. The tone mapping parameter indicates the trade-off
  12321. between the linear section and the non-linear section. Essentially, for a given
  12322. parameter @var{x}, every color value below @var{x} will be mapped linearly,
  12323. while higher values get non-linearly tone-mapped. Values near @code{1.0} make
  12324. this curve behave like @code{clip}, while values near @code{0.0} make this
  12325. curve behave like @code{reinhard}. The default value is @code{0.3}, which
  12326. provides a good balance between colorimetric accuracy and preserving
  12327. out-of-gamut details.
  12328. @item hable
  12329. Piece-wise, filmic tone-mapping algorithm developed by John Hable for use in
  12330. Uncharted 2, inspired by a similar tone-mapping algorithm used by Kodak.
  12331. Popularized by its use in video games with HDR rendering. Preserves both dark
  12332. and bright details very well, but comes with the drawback of changing the
  12333. average brightness quite significantly. This is sort of similar to
  12334. @code{reinhard} with parameter @code{0.24}.
  12335. @item gamma
  12336. Fits a gamma (power) function to transfer between the source and target color
  12337. spaces, effectively resulting in a perceptual hard-knee joining two roughly
  12338. linear sections. This preserves details at all scales fairly accurately, but
  12339. can result in an image with a muted or dull appearance. The parameter is used
  12340. as the cutoff point, defaulting to @code{0.5}.
  12341. @item linear
  12342. Linearly stretches the input range to the output range, in PQ space. This will
  12343. preserve all details accurately, but results in a significantly different
  12344. average brightness. Can be used for inverse tone-mapping in addition to regular
  12345. tone-mapping. The parameter can be used as an additional linear gain
  12346. coefficient (defaulting to @code{1.0}).
  12347. @end table
  12348. @item tonemapping_param
  12349. For tunable tone mapping functions, this parameter can be used to fine-tune the
  12350. curve behavior. Refer to the documentation of @code{tonemapping}. The default
  12351. value of @code{0.0} is replaced by the curve's preferred default setting.
  12352. @item tonemapping_mode
  12353. This option determines how the tone mapping function specified by
  12354. @code{tonemapping} is applied to the colors in a scene. Possible values are:
  12355. @table @samp
  12356. @item auto
  12357. Automatic selection based on internal heuristics. This is the default.
  12358. @item rgb
  12359. Apply the function per-channel in the RGB colorspace.
  12360. Per-channel tone-mapping in RGB. Guarantees no clipping and heavily desaturates
  12361. the output, but distorts the colors quite significantly. Very similar to the
  12362. "Hollywood" look and feel.
  12363. @item max
  12364. Tone-mapping is performed on the brightest component found in the signal. Good
  12365. at preserving details in highlights, but has a tendency to crush blacks.
  12366. @item hybrid
  12367. Tone-map per-channel for highlights and linearly (luma-based) for
  12368. midtones/shadows, based on a fixed gamma @code{2.4} coefficient curve.
  12369. @item luma
  12370. Tone-map linearly on the luma component (CIE Y), and adjust (desaturate) the
  12371. chromaticities to compensate using a simple constant factor. This is
  12372. essentially the mode used in ITU-R BT.2446 method A.
  12373. @end table
  12374. @item inverse_tonemapping
  12375. If enabled, this filter will also attempt stretching SDR signals to fill HDR
  12376. output color volumes. Disabled by default.
  12377. @item tonemapping_crosstalk
  12378. Extra tone-mapping crosstalk factor, between @code{0.0} and @code{0.3}. This
  12379. can help reduce issues tone-mapping certain bright spectral colors. Defaults to
  12380. @code{0.04}.
  12381. @item tonemapping_lut_size
  12382. Size of the tone-mapping LUT, between @code{2} and @code{1024}. Defaults to
  12383. @code{256}. Note that this figure is squared when combined with
  12384. @code{peak_detect}.
  12385. @end table
  12386. @subsubsection Dithering
  12387. By default, libplacebo will dither whenever necessary, which includes rendering
  12388. to any integer format below 16-bit precision. It's recommended to always leave
  12389. this on, since not doing so may result in visible banding in the output, even
  12390. if the @code{debanding} filter is enabled. If maximum performance is needed,
  12391. use @code{ordered_fixed} instead of disabling dithering.
  12392. @table @option
  12393. @item dithering
  12394. Dithering method to use. Accepts the following values:
  12395. @table @samp
  12396. @item none
  12397. Disables dithering completely. May result in visible banding.
  12398. @item blue
  12399. Dither with pseudo-blue noise. This is the default.
  12400. @item ordered
  12401. Tunable ordered dither pattern.
  12402. @item ordered_fixed
  12403. Faster ordered dither with a fixed size of @code{6}. Texture-less.
  12404. @item white
  12405. Dither with white noise. Texture-less.
  12406. @end table
  12407. @item dither_lut_size
  12408. Dither LUT size, as log base2 between @code{1} and @code{8}. Defaults to
  12409. @code{6}, corresponding to a LUT size of @code{64x64}.
  12410. @item dither_temporal
  12411. Enables temporal dithering. Disabled by default.
  12412. @end table
  12413. @subsubsection Custom shaders
  12414. libplacebo supports a number of custom shaders based on the mpv .hook GLSL
  12415. syntax. A collection of such shaders can be found here:
  12416. @url{https://github.com/mpv-player/mpv/wiki/User-Scripts#user-shaders}
  12417. A full description of the mpv shader format is beyond the scope of this
  12418. section, but a summary can be found here:
  12419. @url{https://mpv.io/manual/master/#options-glsl-shader}
  12420. @table @option
  12421. @item custom_shader_path
  12422. Specifies a path to a custom shader file to load at runtime.
  12423. @item custom_shader_bin
  12424. Specifies a complete custom shader as a raw string.
  12425. @end table
  12426. @subsubsection Debugging / performance
  12427. All of the options in this section default off. They may be of assistance when
  12428. attempting to squeeze the maximum performance at the cost of quality.
  12429. @table @option
  12430. @item skip_aa
  12431. Disable anti-aliasing when downscaling.
  12432. @item polar_cutoff
  12433. Truncate polar (EWA) scaler kernels below this absolute magnitude, between
  12434. @code{0.0} and @code{1.0}.
  12435. @item disable_linear
  12436. Disable linear light scaling.
  12437. @item disable_builtin
  12438. Disable built-in GPU sampling (forces LUT).
  12439. @item force_icc_lut
  12440. Force the use of a full ICC 3DLUT for gamut mapping.
  12441. @item disable_fbos
  12442. Forcibly disable FBOs, resulting in loss of almost all functionality, but
  12443. offering the maximum possible speed.
  12444. @end table
  12445. @subsection Commands
  12446. This filter supports almost all of the above options as @ref{commands}.
  12447. @subsection Examples
  12448. @itemize
  12449. @item
  12450. Complete example for how to initialize the Vulkan device, upload frames to the
  12451. GPU, perform filter conversion to yuv420p, and download frames back to the CPU
  12452. for output. Note that in specific cases you can get around the need to perform
  12453. format conversion by specifying the correct @code{format} filter option
  12454. corresponding to the input frames.
  12455. @example
  12456. ffmpeg -i $INPUT -init_hw_device vulkan -vf hwupload,libplacebo=format=yuv420p,hwdownload,format=yuv420p $OUTPUT
  12457. @end example
  12458. @item
  12459. Tone-map input to standard gamut BT.709 output:
  12460. @example
  12461. libplacebo=colorspace=bt709:color_primaries=bt709:color_trc=bt709:range=tv
  12462. @end example
  12463. @item
  12464. Rescale input to fit into standard 1080p, with high quality scaling:
  12465. @example
  12466. libplacebo=w=1920:h=1080:force_original_aspect_ratio=decrease:normalize_sar=true:upscaler=ewa_lanczos:downscaler=ewa_lanczos
  12467. @end example
  12468. @item
  12469. Convert input to standard sRGB JPEG:
  12470. @example
  12471. libplacebo=format=yuv420p:colorspace=bt470bg:color_primaries=bt709:color_trc=iec61966-2-1:range=pc
  12472. @end example
  12473. @item
  12474. Use higher quality debanding settings:
  12475. @example
  12476. libplacebo=deband=true:deband_iterations=3:deband_radius=8:deband_threshold=6
  12477. @end example
  12478. @item
  12479. Run this filter on the CPU, on systems with Mesa installed (and with the most
  12480. expensive options disabled):
  12481. @example
  12482. ffmpeg ... -init_hw_device vulkan:llvmpipe ... -vf libplacebo=upscaler=none:downscaler=none:peak_detect=false
  12483. @end example
  12484. @item
  12485. Suppress CPU-based AV1/H.274 film grain application in the decoder, in favor of
  12486. doing it with this filter. Note that this is only a gain if the frames are
  12487. either already on the GPU, or if you're using libplacebo for other purposes,
  12488. since otherwise the VRAM roundtrip will more than offset any expected speedup.
  12489. @example
  12490. ffmpeg -export_side_data +film_grain ... -vf libplacebo=apply_filmgrain=true
  12491. @end example
  12492. @end itemize
  12493. @section libvmaf
  12494. Calulate the VMAF (Video Multi-Method Assessment Fusion) score for a
  12495. reference/distorted pair of input videos.
  12496. The first input is the distorted video, and the second input is the reference video.
  12497. The obtained VMAF score is printed through the logging system.
  12498. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  12499. After installing the library it can be enabled using:
  12500. @code{./configure --enable-libvmaf}.
  12501. The filter has following options:
  12502. @table @option
  12503. @item model
  12504. A `|` delimited list of vmaf models. Each model can be configured with a number of parameters.
  12505. Default value: @code{"version=vmaf_v0.6.1"}
  12506. @item model_path
  12507. Deprecated, use model='path=...'.
  12508. @item enable_transform
  12509. Deprecated, use model='enable_transform=true'.
  12510. @item phone_model
  12511. Deprecated, use model='enable_transform=true'.
  12512. @item enable_conf_interval
  12513. Deprecated, use model='enable_conf_interval=true'.
  12514. @item feature
  12515. A `|` delimited list of features. Each feature can be configured with a number of parameters.
  12516. @item psnr
  12517. Deprecated, use feature='name=psnr'.
  12518. @item ssim
  12519. Deprecated, use feature='name=ssim'.
  12520. @item ms_ssim
  12521. Deprecated, use feature='name=ms_ssim'.
  12522. @item log_path
  12523. Set the file path to be used to store log files.
  12524. @item log_fmt
  12525. Set the format of the log file (xml, json, csv, or sub).
  12526. @item n_threads
  12527. Set number of threads to be used when initializing libvmaf.
  12528. Default value: @code{0}, no threads.
  12529. @item n_subsample
  12530. Set frame subsampling interval to be used.
  12531. @end table
  12532. This filter also supports the @ref{framesync} options.
  12533. @subsection Examples
  12534. @itemize
  12535. @item
  12536. In the examples below, a distorted video @file{distorted.mpg} is
  12537. compared with a reference file @file{reference.mpg}.
  12538. @item
  12539. Basic usage:
  12540. @example
  12541. ffmpeg -i distorted.mpg -i reference.mpg -lavfi libvmaf=log_path=output.xml -f null -
  12542. @end example
  12543. @item
  12544. Example with multiple models:
  12545. @example
  12546. 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 -
  12547. @end example
  12548. @item
  12549. Example with multiple addtional features:
  12550. @example
  12551. ffmpeg -i distorted.mpg -i reference.mpg -lavfi libvmaf='feature=name=psnr|name=ciede' -f null -
  12552. @end example
  12553. @item
  12554. Example with options and different containers:
  12555. @example
  12556. 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 -
  12557. @end example
  12558. @end itemize
  12559. @section limitdiff
  12560. Apply limited difference filter using second and optionally third video stream.
  12561. The filter accepts the following options:
  12562. @table @option
  12563. @item threshold
  12564. Set the threshold to use when allowing certain differences between video streams.
  12565. Any absolute difference value lower or exact than this threshold will pick pixel components from
  12566. first video stream.
  12567. @item elasticity
  12568. Set the elasticity of soft thresholding when processing video streams.
  12569. This value multiplied with first one sets second threshold.
  12570. Any absolute difference value greater or exact than second threshold will pick pixel components
  12571. from second video stream. For values between those two threshold
  12572. linear interpolation between first and second video stream will be used.
  12573. @item reference
  12574. Enable the reference (third) video stream processing. By default is disabled.
  12575. If set, this video stream will be used for calculating absolute difference with first video
  12576. stream.
  12577. @item planes
  12578. Specify which planes will be processed. Defaults to all available.
  12579. @end table
  12580. @subsection Commands
  12581. This filter supports the all above options as @ref{commands} except option @samp{reference}.
  12582. @section limiter
  12583. Limits the pixel components values to the specified range [min, max].
  12584. The filter accepts the following options:
  12585. @table @option
  12586. @item min
  12587. Lower bound. Defaults to the lowest allowed value for the input.
  12588. @item max
  12589. Upper bound. Defaults to the highest allowed value for the input.
  12590. @item planes
  12591. Specify which planes will be processed. Defaults to all available.
  12592. @end table
  12593. @subsection Commands
  12594. This filter supports the all above options as @ref{commands}.
  12595. @section loop
  12596. Loop video frames.
  12597. The filter accepts the following options:
  12598. @table @option
  12599. @item loop
  12600. Set the number of loops. Setting this value to -1 will result in infinite loops.
  12601. Default is 0.
  12602. @item size
  12603. Set maximal size in number of frames. Default is 0.
  12604. @item start
  12605. Set first frame of loop. Default is 0.
  12606. @end table
  12607. @subsection Examples
  12608. @itemize
  12609. @item
  12610. Loop single first frame infinitely:
  12611. @example
  12612. loop=loop=-1:size=1:start=0
  12613. @end example
  12614. @item
  12615. Loop single first frame 10 times:
  12616. @example
  12617. loop=loop=10:size=1:start=0
  12618. @end example
  12619. @item
  12620. Loop 10 first frames 5 times:
  12621. @example
  12622. loop=loop=5:size=10:start=0
  12623. @end example
  12624. @end itemize
  12625. @section lut1d
  12626. Apply a 1D LUT to an input video.
  12627. The filter accepts the following options:
  12628. @table @option
  12629. @item file
  12630. Set the 1D LUT file name.
  12631. Currently supported formats:
  12632. @table @samp
  12633. @item cube
  12634. Iridas
  12635. @item csp
  12636. cineSpace
  12637. @end table
  12638. @item interp
  12639. Select interpolation mode.
  12640. Available values are:
  12641. @table @samp
  12642. @item nearest
  12643. Use values from the nearest defined point.
  12644. @item linear
  12645. Interpolate values using the linear interpolation.
  12646. @item cosine
  12647. Interpolate values using the cosine interpolation.
  12648. @item cubic
  12649. Interpolate values using the cubic interpolation.
  12650. @item spline
  12651. Interpolate values using the spline interpolation.
  12652. @end table
  12653. @end table
  12654. @subsection Commands
  12655. This filter supports the all above options as @ref{commands}.
  12656. @anchor{lut3d}
  12657. @section lut3d
  12658. Apply a 3D LUT to an input video.
  12659. The filter accepts the following options:
  12660. @table @option
  12661. @item file
  12662. Set the 3D LUT file name.
  12663. Currently supported formats:
  12664. @table @samp
  12665. @item 3dl
  12666. AfterEffects
  12667. @item cube
  12668. Iridas
  12669. @item dat
  12670. DaVinci
  12671. @item m3d
  12672. Pandora
  12673. @item csp
  12674. cineSpace
  12675. @end table
  12676. @item interp
  12677. Select interpolation mode.
  12678. Available values are:
  12679. @table @samp
  12680. @item nearest
  12681. Use values from the nearest defined point.
  12682. @item trilinear
  12683. Interpolate values using the 8 points defining a cube.
  12684. @item tetrahedral
  12685. Interpolate values using a tetrahedron.
  12686. @item pyramid
  12687. Interpolate values using a pyramid.
  12688. @item prism
  12689. Interpolate values using a prism.
  12690. @end table
  12691. @end table
  12692. @subsection Commands
  12693. This filter supports the @code{interp} option as @ref{commands}.
  12694. @section lumakey
  12695. Turn certain luma values into transparency.
  12696. The filter accepts the following options:
  12697. @table @option
  12698. @item threshold
  12699. Set the luma which will be used as base for transparency.
  12700. Default value is @code{0}.
  12701. @item tolerance
  12702. Set the range of luma values to be keyed out.
  12703. Default value is @code{0.01}.
  12704. @item softness
  12705. Set the range of softness. Default value is @code{0}.
  12706. Use this to control gradual transition from zero to full transparency.
  12707. @end table
  12708. @subsection Commands
  12709. This filter supports same @ref{commands} as options.
  12710. The command accepts the same syntax of the corresponding option.
  12711. If the specified expression is not valid, it is kept at its current
  12712. value.
  12713. @section lut, lutrgb, lutyuv
  12714. Compute a look-up table for binding each pixel component input value
  12715. to an output value, and apply it to the input video.
  12716. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  12717. to an RGB input video.
  12718. These filters accept the following parameters:
  12719. @table @option
  12720. @item c0
  12721. set first pixel component expression
  12722. @item c1
  12723. set second pixel component expression
  12724. @item c2
  12725. set third pixel component expression
  12726. @item c3
  12727. set fourth pixel component expression, corresponds to the alpha component
  12728. @item r
  12729. set red component expression
  12730. @item g
  12731. set green component expression
  12732. @item b
  12733. set blue component expression
  12734. @item a
  12735. alpha component expression
  12736. @item y
  12737. set Y/luminance component expression
  12738. @item u
  12739. set U/Cb component expression
  12740. @item v
  12741. set V/Cr component expression
  12742. @end table
  12743. Each of them specifies the expression to use for computing the lookup table for
  12744. the corresponding pixel component values.
  12745. The exact component associated to each of the @var{c*} options depends on the
  12746. format in input.
  12747. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  12748. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  12749. The expressions can contain the following constants and functions:
  12750. @table @option
  12751. @item w
  12752. @item h
  12753. The input width and height.
  12754. @item val
  12755. The input value for the pixel component.
  12756. @item clipval
  12757. The input value, clipped to the @var{minval}-@var{maxval} range.
  12758. @item maxval
  12759. The maximum value for the pixel component.
  12760. @item minval
  12761. The minimum value for the pixel component.
  12762. @item negval
  12763. The negated value for the pixel component value, clipped to the
  12764. @var{minval}-@var{maxval} range; it corresponds to the expression
  12765. "maxval-clipval+minval".
  12766. @item clip(val)
  12767. The computed value in @var{val}, clipped to the
  12768. @var{minval}-@var{maxval} range.
  12769. @item gammaval(gamma)
  12770. The computed gamma correction value of the pixel component value,
  12771. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  12772. expression
  12773. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  12774. @end table
  12775. All expressions default to "clipval".
  12776. @subsection Commands
  12777. This filter supports same @ref{commands} as options.
  12778. @subsection Examples
  12779. @itemize
  12780. @item
  12781. Negate input video:
  12782. @example
  12783. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  12784. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  12785. @end example
  12786. The above is the same as:
  12787. @example
  12788. lutrgb="r=negval:g=negval:b=negval"
  12789. lutyuv="y=negval:u=negval:v=negval"
  12790. @end example
  12791. @item
  12792. Negate luminance:
  12793. @example
  12794. lutyuv=y=negval
  12795. @end example
  12796. @item
  12797. Remove chroma components, turning the video into a graytone image:
  12798. @example
  12799. lutyuv="u=128:v=128"
  12800. @end example
  12801. @item
  12802. Apply a luma burning effect:
  12803. @example
  12804. lutyuv="y=2*val"
  12805. @end example
  12806. @item
  12807. Remove green and blue components:
  12808. @example
  12809. lutrgb="g=0:b=0"
  12810. @end example
  12811. @item
  12812. Set a constant alpha channel value on input:
  12813. @example
  12814. format=rgba,lutrgb=a="maxval-minval/2"
  12815. @end example
  12816. @item
  12817. Correct luminance gamma by a factor of 0.5:
  12818. @example
  12819. lutyuv=y=gammaval(0.5)
  12820. @end example
  12821. @item
  12822. Discard least significant bits of luma:
  12823. @example
  12824. lutyuv=y='bitand(val, 128+64+32)'
  12825. @end example
  12826. @item
  12827. Technicolor like effect:
  12828. @example
  12829. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  12830. @end example
  12831. @end itemize
  12832. @section lut2, tlut2
  12833. The @code{lut2} filter takes two input streams and outputs one
  12834. stream.
  12835. The @code{tlut2} (time lut2) filter takes two consecutive frames
  12836. from one single stream.
  12837. This filter accepts the following parameters:
  12838. @table @option
  12839. @item c0
  12840. set first pixel component expression
  12841. @item c1
  12842. set second pixel component expression
  12843. @item c2
  12844. set third pixel component expression
  12845. @item c3
  12846. set fourth pixel component expression, corresponds to the alpha component
  12847. @item d
  12848. set output bit depth, only available for @code{lut2} filter. By default is 0,
  12849. which means bit depth is automatically picked from first input format.
  12850. @end table
  12851. The @code{lut2} filter also supports the @ref{framesync} options.
  12852. Each of them specifies the expression to use for computing the lookup table for
  12853. the corresponding pixel component values.
  12854. The exact component associated to each of the @var{c*} options depends on the
  12855. format in inputs.
  12856. The expressions can contain the following constants:
  12857. @table @option
  12858. @item w
  12859. @item h
  12860. The input width and height.
  12861. @item x
  12862. The first input value for the pixel component.
  12863. @item y
  12864. The second input value for the pixel component.
  12865. @item bdx
  12866. The first input video bit depth.
  12867. @item bdy
  12868. The second input video bit depth.
  12869. @end table
  12870. All expressions default to "x".
  12871. @subsection Commands
  12872. This filter supports the all above options as @ref{commands} except option @code{d}.
  12873. @subsection Examples
  12874. @itemize
  12875. @item
  12876. Highlight differences between two RGB video streams:
  12877. @example
  12878. 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)'
  12879. @end example
  12880. @item
  12881. Highlight differences between two YUV video streams:
  12882. @example
  12883. 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)'
  12884. @end example
  12885. @item
  12886. Show max difference between two video streams:
  12887. @example
  12888. 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)))'
  12889. @end example
  12890. @end itemize
  12891. @section maskedclamp
  12892. Clamp the first input stream with the second input and third input stream.
  12893. Returns the value of first stream to be between second input
  12894. stream - @code{undershoot} and third input stream + @code{overshoot}.
  12895. This filter accepts the following options:
  12896. @table @option
  12897. @item undershoot
  12898. Default value is @code{0}.
  12899. @item overshoot
  12900. Default value is @code{0}.
  12901. @item planes
  12902. Set which planes will be processed as bitmap, unprocessed planes will be
  12903. copied from first stream.
  12904. By default value 0xf, all planes will be processed.
  12905. @end table
  12906. @subsection Commands
  12907. This filter supports the all above options as @ref{commands}.
  12908. @section maskedmax
  12909. Merge the second and third input stream into output stream using absolute differences
  12910. between second input stream and first input stream and absolute difference between
  12911. third input stream and first input stream. The picked value will be from second input
  12912. stream if second absolute difference is greater than first one or from third input stream
  12913. otherwise.
  12914. This filter accepts the following options:
  12915. @table @option
  12916. @item planes
  12917. Set which planes will be processed as bitmap, unprocessed planes will be
  12918. copied from first stream.
  12919. By default value 0xf, all planes will be processed.
  12920. @end table
  12921. @subsection Commands
  12922. This filter supports the all above options as @ref{commands}.
  12923. @section maskedmerge
  12924. Merge the first input stream with the second input stream using per pixel
  12925. weights in the third input stream.
  12926. A value of 0 in the third stream pixel component means that pixel component
  12927. from first stream is returned unchanged, while maximum value (eg. 255 for
  12928. 8-bit videos) means that pixel component from second stream is returned
  12929. unchanged. Intermediate values define the amount of merging between both
  12930. input stream's pixel components.
  12931. This filter accepts the following options:
  12932. @table @option
  12933. @item planes
  12934. Set which planes will be processed as bitmap, unprocessed planes will be
  12935. copied from first stream.
  12936. By default value 0xf, all planes will be processed.
  12937. @end table
  12938. @subsection Commands
  12939. This filter supports the all above options as @ref{commands}.
  12940. @section maskedmin
  12941. Merge the second and third input stream into output stream using absolute differences
  12942. between second input stream and first input stream and absolute difference between
  12943. third input stream and first input stream. The picked value will be from second input
  12944. stream if second absolute difference is less than first one or from third input stream
  12945. otherwise.
  12946. This filter accepts the following options:
  12947. @table @option
  12948. @item planes
  12949. Set which planes will be processed as bitmap, unprocessed planes will be
  12950. copied from first stream.
  12951. By default value 0xf, all planes will be processed.
  12952. @end table
  12953. @subsection Commands
  12954. This filter supports the all above options as @ref{commands}.
  12955. @section maskedthreshold
  12956. Pick pixels comparing absolute difference of two video streams with fixed
  12957. threshold.
  12958. If absolute difference between pixel component of first and second video
  12959. stream is equal or lower than user supplied threshold than pixel component
  12960. from first video stream is picked, otherwise pixel component from second
  12961. video stream is picked.
  12962. This filter accepts the following options:
  12963. @table @option
  12964. @item threshold
  12965. Set threshold used when picking pixels from absolute difference from two input
  12966. video streams.
  12967. @item planes
  12968. Set which planes will be processed as bitmap, unprocessed planes will be
  12969. copied from second stream.
  12970. By default value 0xf, all planes will be processed.
  12971. @item mode
  12972. Set mode of filter operation. Can be @code{abs} or @code{diff}.
  12973. Default is @code{abs}.
  12974. @end table
  12975. @subsection Commands
  12976. This filter supports the all above options as @ref{commands}.
  12977. @section maskfun
  12978. Create mask from input video.
  12979. For example it is useful to create motion masks after @code{tblend} filter.
  12980. This filter accepts the following options:
  12981. @table @option
  12982. @item low
  12983. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  12984. @item high
  12985. Set high threshold. Any pixel component higher than this value will be set to max value
  12986. allowed for current pixel format.
  12987. @item planes
  12988. Set planes to filter, by default all available planes are filtered.
  12989. @item fill
  12990. Fill all frame pixels with this value.
  12991. @item sum
  12992. Set max average pixel value for frame. If sum of all pixel components is higher that this
  12993. average, output frame will be completely filled with value set by @var{fill} option.
  12994. Typically useful for scene changes when used in combination with @code{tblend} filter.
  12995. @end table
  12996. @subsection Commands
  12997. This filter supports the all above options as @ref{commands}.
  12998. @section mcdeint
  12999. Apply motion-compensation deinterlacing.
  13000. It needs one field per frame as input and must thus be used together
  13001. with yadif=1/3 or equivalent.
  13002. This filter is only available in ffmpeg version 4.4 or earlier.
  13003. This filter accepts the following options:
  13004. @table @option
  13005. @item mode
  13006. Set the deinterlacing mode.
  13007. It accepts one of the following values:
  13008. @table @samp
  13009. @item fast
  13010. @item medium
  13011. @item slow
  13012. use iterative motion estimation
  13013. @item extra_slow
  13014. like @samp{slow}, but use multiple reference frames.
  13015. @end table
  13016. Default value is @samp{fast}.
  13017. @item parity
  13018. Set the picture field parity assumed for the input video. It must be
  13019. one of the following values:
  13020. @table @samp
  13021. @item 0, tff
  13022. assume top field first
  13023. @item 1, bff
  13024. assume bottom field first
  13025. @end table
  13026. Default value is @samp{bff}.
  13027. @item qp
  13028. Set per-block quantization parameter (QP) used by the internal
  13029. encoder.
  13030. Higher values should result in a smoother motion vector field but less
  13031. optimal individual vectors. Default value is 1.
  13032. @end table
  13033. @section median
  13034. Pick median pixel from certain rectangle defined by radius.
  13035. This filter accepts the following options:
  13036. @table @option
  13037. @item radius
  13038. Set horizontal radius size. Default value is @code{1}.
  13039. Allowed range is integer from 1 to 127.
  13040. @item planes
  13041. Set which planes to process. Default is @code{15}, which is all available planes.
  13042. @item radiusV
  13043. Set vertical radius size. Default value is @code{0}.
  13044. Allowed range is integer from 0 to 127.
  13045. If it is 0, value will be picked from horizontal @code{radius} option.
  13046. @item percentile
  13047. Set median percentile. Default value is @code{0.5}.
  13048. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  13049. minimum values, and @code{1} maximum values.
  13050. @end table
  13051. @subsection Commands
  13052. This filter supports same @ref{commands} as options.
  13053. The command accepts the same syntax of the corresponding option.
  13054. If the specified expression is not valid, it is kept at its current
  13055. value.
  13056. @section mergeplanes
  13057. Merge color channel components from several video streams.
  13058. The filter accepts up to 4 input streams, and merge selected input
  13059. planes to the output video.
  13060. This filter accepts the following options:
  13061. @table @option
  13062. @item mapping
  13063. Set input to output plane mapping. Default is @code{0}.
  13064. The mappings is specified as a bitmap. It should be specified as a
  13065. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  13066. mapping for the first plane of the output stream. 'A' sets the number of
  13067. the input stream to use (from 0 to 3), and 'a' the plane number of the
  13068. corresponding input to use (from 0 to 3). The rest of the mappings is
  13069. similar, 'Bb' describes the mapping for the output stream second
  13070. plane, 'Cc' describes the mapping for the output stream third plane and
  13071. 'Dd' describes the mapping for the output stream fourth plane.
  13072. @item format
  13073. Set output pixel format. Default is @code{yuva444p}.
  13074. @item map0s
  13075. @item map1s
  13076. @item map2s
  13077. @item map3s
  13078. Set input to output stream mapping for output Nth plane. Default is @code{0}.
  13079. @item map0p
  13080. @item map1p
  13081. @item map2p
  13082. @item map3p
  13083. Set input to output plane mapping for output Nth plane. Default is @code{0}.
  13084. @end table
  13085. @subsection Examples
  13086. @itemize
  13087. @item
  13088. Merge three gray video streams of same width and height into single video stream:
  13089. @example
  13090. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  13091. @end example
  13092. @item
  13093. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  13094. @example
  13095. [a0][a1]mergeplanes=0x00010210:yuva444p
  13096. @end example
  13097. @item
  13098. Swap Y and A plane in yuva444p stream:
  13099. @example
  13100. format=yuva444p,mergeplanes=0x03010200:yuva444p
  13101. @end example
  13102. @item
  13103. Swap U and V plane in yuv420p stream:
  13104. @example
  13105. format=yuv420p,mergeplanes=0x000201:yuv420p
  13106. @end example
  13107. @item
  13108. Cast a rgb24 clip to yuv444p:
  13109. @example
  13110. format=rgb24,mergeplanes=0x000102:yuv444p
  13111. @end example
  13112. @end itemize
  13113. @section mestimate
  13114. Estimate and export motion vectors using block matching algorithms.
  13115. Motion vectors are stored in frame side data to be used by other filters.
  13116. This filter accepts the following options:
  13117. @table @option
  13118. @item method
  13119. Specify the motion estimation method. Accepts one of the following values:
  13120. @table @samp
  13121. @item esa
  13122. Exhaustive search algorithm.
  13123. @item tss
  13124. Three step search algorithm.
  13125. @item tdls
  13126. Two dimensional logarithmic search algorithm.
  13127. @item ntss
  13128. New three step search algorithm.
  13129. @item fss
  13130. Four step search algorithm.
  13131. @item ds
  13132. Diamond search algorithm.
  13133. @item hexbs
  13134. Hexagon-based search algorithm.
  13135. @item epzs
  13136. Enhanced predictive zonal search algorithm.
  13137. @item umh
  13138. Uneven multi-hexagon search algorithm.
  13139. @end table
  13140. Default value is @samp{esa}.
  13141. @item mb_size
  13142. Macroblock size. Default @code{16}.
  13143. @item search_param
  13144. Search parameter. Default @code{7}.
  13145. @end table
  13146. @section midequalizer
  13147. Apply Midway Image Equalization effect using two video streams.
  13148. Midway Image Equalization adjusts a pair of images to have the same
  13149. histogram, while maintaining their dynamics as much as possible. It's
  13150. useful for e.g. matching exposures from a pair of stereo cameras.
  13151. This filter has two inputs and one output, which must be of same pixel format, but
  13152. may be of different sizes. The output of filter is first input adjusted with
  13153. midway histogram of both inputs.
  13154. This filter accepts the following option:
  13155. @table @option
  13156. @item planes
  13157. Set which planes to process. Default is @code{15}, which is all available planes.
  13158. @end table
  13159. @section minterpolate
  13160. Convert the video to specified frame rate using motion interpolation.
  13161. This filter accepts the following options:
  13162. @table @option
  13163. @item fps
  13164. 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}.
  13165. @item mi_mode
  13166. Motion interpolation mode. Following values are accepted:
  13167. @table @samp
  13168. @item dup
  13169. Duplicate previous or next frame for interpolating new ones.
  13170. @item blend
  13171. Blend source frames. Interpolated frame is mean of previous and next frames.
  13172. @item mci
  13173. Motion compensated interpolation. Following options are effective when this mode is selected:
  13174. @table @samp
  13175. @item mc_mode
  13176. Motion compensation mode. Following values are accepted:
  13177. @table @samp
  13178. @item obmc
  13179. Overlapped block motion compensation.
  13180. @item aobmc
  13181. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  13182. @end table
  13183. Default mode is @samp{obmc}.
  13184. @item me_mode
  13185. Motion estimation mode. Following values are accepted:
  13186. @table @samp
  13187. @item bidir
  13188. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  13189. @item bilat
  13190. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  13191. @end table
  13192. Default mode is @samp{bilat}.
  13193. @item me
  13194. The algorithm to be used for motion estimation. Following values are accepted:
  13195. @table @samp
  13196. @item esa
  13197. Exhaustive search algorithm.
  13198. @item tss
  13199. Three step search algorithm.
  13200. @item tdls
  13201. Two dimensional logarithmic search algorithm.
  13202. @item ntss
  13203. New three step search algorithm.
  13204. @item fss
  13205. Four step search algorithm.
  13206. @item ds
  13207. Diamond search algorithm.
  13208. @item hexbs
  13209. Hexagon-based search algorithm.
  13210. @item epzs
  13211. Enhanced predictive zonal search algorithm.
  13212. @item umh
  13213. Uneven multi-hexagon search algorithm.
  13214. @end table
  13215. Default algorithm is @samp{epzs}.
  13216. @item mb_size
  13217. Macroblock size. Default @code{16}.
  13218. @item search_param
  13219. Motion estimation search parameter. Default @code{32}.
  13220. @item vsbmc
  13221. 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).
  13222. @end table
  13223. @end table
  13224. @item scd
  13225. 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:
  13226. @table @samp
  13227. @item none
  13228. Disable scene change detection.
  13229. @item fdiff
  13230. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  13231. @end table
  13232. Default method is @samp{fdiff}.
  13233. @item scd_threshold
  13234. Scene change detection threshold. Default is @code{10.}.
  13235. @end table
  13236. @section mix
  13237. Mix several video input streams into one video stream.
  13238. A description of the accepted options follows.
  13239. @table @option
  13240. @item inputs
  13241. The number of inputs. If unspecified, it defaults to 2.
  13242. @item weights
  13243. Specify weight of each input video stream as sequence.
  13244. Each weight is separated by space. If number of weights
  13245. is smaller than number of @var{frames} last specified
  13246. weight will be used for all remaining unset weights.
  13247. @item scale
  13248. Specify scale, if it is set it will be multiplied with sum
  13249. of each weight multiplied with pixel values to give final destination
  13250. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13251. @item planes
  13252. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  13253. @item duration
  13254. Specify how end of stream is determined.
  13255. @table @samp
  13256. @item longest
  13257. The duration of the longest input. (default)
  13258. @item shortest
  13259. The duration of the shortest input.
  13260. @item first
  13261. The duration of the first input.
  13262. @end table
  13263. @end table
  13264. @subsection Commands
  13265. This filter supports the following commands:
  13266. @table @option
  13267. @item weights
  13268. @item scale
  13269. @item planes
  13270. Syntax is same as option with same name.
  13271. @end table
  13272. @section monochrome
  13273. Convert video to gray using custom color filter.
  13274. A description of the accepted options follows.
  13275. @table @option
  13276. @item cb
  13277. Set the chroma blue spot. Allowed range is from -1 to 1.
  13278. Default value is 0.
  13279. @item cr
  13280. Set the chroma red spot. Allowed range is from -1 to 1.
  13281. Default value is 0.
  13282. @item size
  13283. Set the color filter size. Allowed range is from .1 to 10.
  13284. Default value is 1.
  13285. @item high
  13286. Set the highlights strength. Allowed range is from 0 to 1.
  13287. Default value is 0.
  13288. @end table
  13289. @subsection Commands
  13290. This filter supports the all above options as @ref{commands}.
  13291. @section morpho
  13292. This filter allows to apply main morphological grayscale transforms,
  13293. erode and dilate with arbitrary structures set in second input stream.
  13294. Unlike naive implementation and much slower performance in @ref{erosion}
  13295. and @ref{dilation} filters, when speed is critical @code{morpho} filter
  13296. should be used instead.
  13297. A description of accepted options follows,
  13298. @table @option
  13299. @item mode
  13300. Set morphological transform to apply, can be:
  13301. @table @samp
  13302. @item erode
  13303. @item dilate
  13304. @item open
  13305. @item close
  13306. @item gradient
  13307. @item tophat
  13308. @item blackhat
  13309. @end table
  13310. Default is @code{erode}.
  13311. @item planes
  13312. Set planes to filter, by default all planes except alpha are filtered.
  13313. @item structure
  13314. Set which structure video frames will be processed from second input stream,
  13315. can be @var{first} or @var{all}. Default is @var{all}.
  13316. @end table
  13317. The @code{morpho} filter also supports the @ref{framesync} options.
  13318. @subsection Commands
  13319. This filter supports same @ref{commands} as options.
  13320. @section mpdecimate
  13321. Drop frames that do not differ greatly from the previous frame in
  13322. order to reduce frame rate.
  13323. The main use of this filter is for very-low-bitrate encoding
  13324. (e.g. streaming over dialup modem), but it could in theory be used for
  13325. fixing movies that were inverse-telecined incorrectly.
  13326. A description of the accepted options follows.
  13327. @table @option
  13328. @item max
  13329. Set the maximum number of consecutive frames which can be dropped (if
  13330. positive), or the minimum interval between dropped frames (if
  13331. negative). If the value is 0, the frame is dropped disregarding the
  13332. number of previous sequentially dropped frames.
  13333. Default value is 0.
  13334. @item hi
  13335. @item lo
  13336. @item frac
  13337. Set the dropping threshold values.
  13338. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  13339. represent actual pixel value differences, so a threshold of 64
  13340. corresponds to 1 unit of difference for each pixel, or the same spread
  13341. out differently over the block.
  13342. A frame is a candidate for dropping if no 8x8 blocks differ by more
  13343. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  13344. meaning the whole image) differ by more than a threshold of @option{lo}.
  13345. Default value for @option{hi} is 64*12, default value for @option{lo} is
  13346. 64*5, and default value for @option{frac} is 0.33.
  13347. @end table
  13348. @section msad
  13349. Obtain the MSAD (Mean Sum of Absolute Differences) between two input videos.
  13350. This filter takes two input videos.
  13351. Both input videos must have the same resolution and pixel format for
  13352. this filter to work correctly. Also it assumes that both inputs
  13353. have the same number of frames, which are compared one by one.
  13354. The obtained per component, average, min and max MSAD is printed through
  13355. the logging system.
  13356. The filter stores the calculated MSAD of each frame in frame metadata.
  13357. This filter also supports the @ref{framesync} options.
  13358. In the below example the input file @file{main.mpg} being processed is compared
  13359. with the reference file @file{ref.mpg}.
  13360. @example
  13361. ffmpeg -i main.mpg -i ref.mpg -lavfi msad -f null -
  13362. @end example
  13363. @section multiply
  13364. Multiply first video stream pixels values with second video stream pixels values.
  13365. The filter accepts the following options:
  13366. @table @option
  13367. @item scale
  13368. Set the scale applied to second video stream. By default is @code{1}.
  13369. Allowed range is from @code{0} to @code{9}.
  13370. @item offset
  13371. Set the offset applied to second video stream. By default is @code{0.5}.
  13372. Allowed range is from @code{-1} to @code{1}.
  13373. @item planes
  13374. Specify planes from input video stream that will be processed.
  13375. By default all planes are processed.
  13376. @end table
  13377. @subsection Commands
  13378. This filter supports same @ref{commands} as options.
  13379. @section negate
  13380. Negate (invert) the input video.
  13381. It accepts the following option:
  13382. @table @option
  13383. @item components
  13384. Set components to negate.
  13385. Available values for components are:
  13386. @table @samp
  13387. @item y
  13388. @item u
  13389. @item v
  13390. @item a
  13391. @item r
  13392. @item g
  13393. @item b
  13394. @end table
  13395. @item negate_alpha
  13396. With value 1, it negates the alpha component, if present. Default value is 0.
  13397. @end table
  13398. @subsection Commands
  13399. This filter supports same @ref{commands} as options.
  13400. @anchor{nlmeans}
  13401. @section nlmeans
  13402. Denoise frames using Non-Local Means algorithm.
  13403. Each pixel is adjusted by looking for other pixels with similar contexts. This
  13404. context similarity is defined by comparing their surrounding patches of size
  13405. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  13406. around the pixel.
  13407. Note that the research area defines centers for patches, which means some
  13408. patches will be made of pixels outside that research area.
  13409. The filter accepts the following options.
  13410. @table @option
  13411. @item s
  13412. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  13413. @item p
  13414. Set patch size. Default is 7. Must be odd number in range [0, 99].
  13415. @item pc
  13416. Same as @option{p} but for chroma planes.
  13417. The default value is @var{0} and means automatic.
  13418. @item r
  13419. Set research size. Default is 15. Must be odd number in range [0, 99].
  13420. @item rc
  13421. Same as @option{r} but for chroma planes.
  13422. The default value is @var{0} and means automatic.
  13423. @end table
  13424. @section nnedi
  13425. Deinterlace video using neural network edge directed interpolation.
  13426. This filter accepts the following options:
  13427. @table @option
  13428. @item weights
  13429. Mandatory option, without binary file filter can not work.
  13430. Currently file can be found here:
  13431. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  13432. @item deint
  13433. Set which frames to deinterlace, by default it is @code{all}.
  13434. Can be @code{all} or @code{interlaced}.
  13435. @item field
  13436. Set mode of operation.
  13437. Can be one of the following:
  13438. @table @samp
  13439. @item af
  13440. Use frame flags, both fields.
  13441. @item a
  13442. Use frame flags, single field.
  13443. @item t
  13444. Use top field only.
  13445. @item b
  13446. Use bottom field only.
  13447. @item tf
  13448. Use both fields, top first.
  13449. @item bf
  13450. Use both fields, bottom first.
  13451. @end table
  13452. @item planes
  13453. Set which planes to process, by default filter process all frames.
  13454. @item nsize
  13455. Set size of local neighborhood around each pixel, used by the predictor neural
  13456. network.
  13457. Can be one of the following:
  13458. @table @samp
  13459. @item s8x6
  13460. @item s16x6
  13461. @item s32x6
  13462. @item s48x6
  13463. @item s8x4
  13464. @item s16x4
  13465. @item s32x4
  13466. @end table
  13467. @item nns
  13468. Set the number of neurons in predictor neural network.
  13469. Can be one of the following:
  13470. @table @samp
  13471. @item n16
  13472. @item n32
  13473. @item n64
  13474. @item n128
  13475. @item n256
  13476. @end table
  13477. @item qual
  13478. Controls the number of different neural network predictions that are blended
  13479. together to compute the final output value. Can be @code{fast}, default or
  13480. @code{slow}.
  13481. @item etype
  13482. Set which set of weights to use in the predictor.
  13483. Can be one of the following:
  13484. @table @samp
  13485. @item a, abs
  13486. weights trained to minimize absolute error
  13487. @item s, mse
  13488. weights trained to minimize squared error
  13489. @end table
  13490. @item pscrn
  13491. Controls whether or not the prescreener neural network is used to decide
  13492. which pixels should be processed by the predictor neural network and which
  13493. can be handled by simple cubic interpolation.
  13494. The prescreener is trained to know whether cubic interpolation will be
  13495. sufficient for a pixel or whether it should be predicted by the predictor nn.
  13496. The computational complexity of the prescreener nn is much less than that of
  13497. the predictor nn. Since most pixels can be handled by cubic interpolation,
  13498. using the prescreener generally results in much faster processing.
  13499. The prescreener is pretty accurate, so the difference between using it and not
  13500. using it is almost always unnoticeable.
  13501. Can be one of the following:
  13502. @table @samp
  13503. @item none
  13504. @item original
  13505. @item new
  13506. @item new2
  13507. @item new3
  13508. @end table
  13509. Default is @code{new}.
  13510. @end table
  13511. @subsection Commands
  13512. This filter supports same @ref{commands} as options, excluding @var{weights} option.
  13513. @section noformat
  13514. Force libavfilter not to use any of the specified pixel formats for the
  13515. input to the next filter.
  13516. It accepts the following parameters:
  13517. @table @option
  13518. @item pix_fmts
  13519. A '|'-separated list of pixel format names, such as
  13520. pix_fmts=yuv420p|monow|rgb24".
  13521. @end table
  13522. @subsection Examples
  13523. @itemize
  13524. @item
  13525. Force libavfilter to use a format different from @var{yuv420p} for the
  13526. input to the vflip filter:
  13527. @example
  13528. noformat=pix_fmts=yuv420p,vflip
  13529. @end example
  13530. @item
  13531. Convert the input video to any of the formats not contained in the list:
  13532. @example
  13533. noformat=yuv420p|yuv444p|yuv410p
  13534. @end example
  13535. @end itemize
  13536. @section noise
  13537. Add noise on video input frame.
  13538. The filter accepts the following options:
  13539. @table @option
  13540. @item all_seed
  13541. @item c0_seed
  13542. @item c1_seed
  13543. @item c2_seed
  13544. @item c3_seed
  13545. Set noise seed for specific pixel component or all pixel components in case
  13546. of @var{all_seed}. Default value is @code{123457}.
  13547. @item all_strength, alls
  13548. @item c0_strength, c0s
  13549. @item c1_strength, c1s
  13550. @item c2_strength, c2s
  13551. @item c3_strength, c3s
  13552. Set noise strength for specific pixel component or all pixel components in case
  13553. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  13554. @item all_flags, allf
  13555. @item c0_flags, c0f
  13556. @item c1_flags, c1f
  13557. @item c2_flags, c2f
  13558. @item c3_flags, c3f
  13559. Set pixel component flags or set flags for all components if @var{all_flags}.
  13560. Available values for component flags are:
  13561. @table @samp
  13562. @item a
  13563. averaged temporal noise (smoother)
  13564. @item p
  13565. mix random noise with a (semi)regular pattern
  13566. @item t
  13567. temporal noise (noise pattern changes between frames)
  13568. @item u
  13569. uniform noise (gaussian otherwise)
  13570. @end table
  13571. @end table
  13572. @subsection Examples
  13573. Add temporal and uniform noise to input video:
  13574. @example
  13575. noise=alls=20:allf=t+u
  13576. @end example
  13577. @section normalize
  13578. Normalize RGB video (aka histogram stretching, contrast stretching).
  13579. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  13580. For each channel of each frame, the filter computes the input range and maps
  13581. it linearly to the user-specified output range. The output range defaults
  13582. to the full dynamic range from pure black to pure white.
  13583. Temporal smoothing can be used on the input range to reduce flickering (rapid
  13584. changes in brightness) caused when small dark or bright objects enter or leave
  13585. the scene. This is similar to the auto-exposure (automatic gain control) on a
  13586. video camera, and, like a video camera, it may cause a period of over- or
  13587. under-exposure of the video.
  13588. The R,G,B channels can be normalized independently, which may cause some
  13589. color shifting, or linked together as a single channel, which prevents
  13590. color shifting. Linked normalization preserves hue. Independent normalization
  13591. does not, so it can be used to remove some color casts. Independent and linked
  13592. normalization can be combined in any ratio.
  13593. The normalize filter accepts the following options:
  13594. @table @option
  13595. @item blackpt
  13596. @item whitept
  13597. Colors which define the output range. The minimum input value is mapped to
  13598. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  13599. The defaults are black and white respectively. Specifying white for
  13600. @var{blackpt} and black for @var{whitept} will give color-inverted,
  13601. normalized video. Shades of grey can be used to reduce the dynamic range
  13602. (contrast). Specifying saturated colors here can create some interesting
  13603. effects.
  13604. @item smoothing
  13605. The number of previous frames to use for temporal smoothing. The input range
  13606. of each channel is smoothed using a rolling average over the current frame
  13607. and the @var{smoothing} previous frames. The default is 0 (no temporal
  13608. smoothing).
  13609. @item independence
  13610. Controls the ratio of independent (color shifting) channel normalization to
  13611. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  13612. independent. Defaults to 1.0 (fully independent).
  13613. @item strength
  13614. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  13615. expensive no-op. Defaults to 1.0 (full strength).
  13616. @end table
  13617. @subsection Commands
  13618. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  13619. The command accepts the same syntax of the corresponding option.
  13620. If the specified expression is not valid, it is kept at its current
  13621. value.
  13622. @subsection Examples
  13623. Stretch video contrast to use the full dynamic range, with no temporal
  13624. smoothing; may flicker depending on the source content:
  13625. @example
  13626. normalize=blackpt=black:whitept=white:smoothing=0
  13627. @end example
  13628. As above, but with 50 frames of temporal smoothing; flicker should be
  13629. reduced, depending on the source content:
  13630. @example
  13631. normalize=blackpt=black:whitept=white:smoothing=50
  13632. @end example
  13633. As above, but with hue-preserving linked channel normalization:
  13634. @example
  13635. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  13636. @end example
  13637. As above, but with half strength:
  13638. @example
  13639. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  13640. @end example
  13641. Map the darkest input color to red, the brightest input color to cyan:
  13642. @example
  13643. normalize=blackpt=red:whitept=cyan
  13644. @end example
  13645. @section null
  13646. Pass the video source unchanged to the output.
  13647. @section ocr
  13648. Optical Character Recognition
  13649. This filter uses Tesseract for optical character recognition. To enable
  13650. compilation of this filter, you need to configure FFmpeg with
  13651. @code{--enable-libtesseract}.
  13652. It accepts the following options:
  13653. @table @option
  13654. @item datapath
  13655. Set datapath to tesseract data. Default is to use whatever was
  13656. set at installation.
  13657. @item language
  13658. Set language, default is "eng".
  13659. @item whitelist
  13660. Set character whitelist.
  13661. @item blacklist
  13662. Set character blacklist.
  13663. @end table
  13664. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  13665. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  13666. @section ocv
  13667. Apply a video transform using libopencv.
  13668. To enable this filter, install the libopencv library and headers and
  13669. configure FFmpeg with @code{--enable-libopencv}.
  13670. It accepts the following parameters:
  13671. @table @option
  13672. @item filter_name
  13673. The name of the libopencv filter to apply.
  13674. @item filter_params
  13675. The parameters to pass to the libopencv filter. If not specified, the default
  13676. values are assumed.
  13677. @end table
  13678. Refer to the official libopencv documentation for more precise
  13679. information:
  13680. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  13681. Several libopencv filters are supported; see the following subsections.
  13682. @anchor{dilate}
  13683. @subsection dilate
  13684. Dilate an image by using a specific structuring element.
  13685. It corresponds to the libopencv function @code{cvDilate}.
  13686. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  13687. @var{struct_el} represents a structuring element, and has the syntax:
  13688. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  13689. @var{cols} and @var{rows} represent the number of columns and rows of
  13690. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  13691. point, and @var{shape} the shape for the structuring element. @var{shape}
  13692. must be "rect", "cross", "ellipse", or "custom".
  13693. If the value for @var{shape} is "custom", it must be followed by a
  13694. string of the form "=@var{filename}". The file with name
  13695. @var{filename} is assumed to represent a binary image, with each
  13696. printable character corresponding to a bright pixel. When a custom
  13697. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  13698. or columns and rows of the read file are assumed instead.
  13699. The default value for @var{struct_el} is "3x3+0x0/rect".
  13700. @var{nb_iterations} specifies the number of times the transform is
  13701. applied to the image, and defaults to 1.
  13702. Some examples:
  13703. @example
  13704. # Use the default values
  13705. ocv=dilate
  13706. # Dilate using a structuring element with a 5x5 cross, iterating two times
  13707. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  13708. # Read the shape from the file diamond.shape, iterating two times.
  13709. # The file diamond.shape may contain a pattern of characters like this
  13710. # *
  13711. # ***
  13712. # *****
  13713. # ***
  13714. # *
  13715. # The specified columns and rows are ignored
  13716. # but the anchor point coordinates are not
  13717. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  13718. @end example
  13719. @subsection erode
  13720. Erode an image by using a specific structuring element.
  13721. It corresponds to the libopencv function @code{cvErode}.
  13722. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  13723. with the same syntax and semantics as the @ref{dilate} filter.
  13724. @subsection smooth
  13725. Smooth the input video.
  13726. The filter takes the following parameters:
  13727. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  13728. @var{type} is the type of smooth filter to apply, and must be one of
  13729. the following values: "blur", "blur_no_scale", "median", "gaussian",
  13730. or "bilateral". The default value is "gaussian".
  13731. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  13732. depends on the smooth type. @var{param1} and
  13733. @var{param2} accept integer positive values or 0. @var{param3} and
  13734. @var{param4} accept floating point values.
  13735. The default value for @var{param1} is 3. The default value for the
  13736. other parameters is 0.
  13737. These parameters correspond to the parameters assigned to the
  13738. libopencv function @code{cvSmooth}.
  13739. @section oscilloscope
  13740. 2D Video Oscilloscope.
  13741. Useful to measure spatial impulse, step responses, chroma delays, etc.
  13742. It accepts the following parameters:
  13743. @table @option
  13744. @item x
  13745. Set scope center x position.
  13746. @item y
  13747. Set scope center y position.
  13748. @item s
  13749. Set scope size, relative to frame diagonal.
  13750. @item t
  13751. Set scope tilt/rotation.
  13752. @item o
  13753. Set trace opacity.
  13754. @item tx
  13755. Set trace center x position.
  13756. @item ty
  13757. Set trace center y position.
  13758. @item tw
  13759. Set trace width, relative to width of frame.
  13760. @item th
  13761. Set trace height, relative to height of frame.
  13762. @item c
  13763. Set which components to trace. By default it traces first three components.
  13764. @item g
  13765. Draw trace grid. By default is enabled.
  13766. @item st
  13767. Draw some statistics. By default is enabled.
  13768. @item sc
  13769. Draw scope. By default is enabled.
  13770. @end table
  13771. @subsection Commands
  13772. This filter supports same @ref{commands} as options.
  13773. The command accepts the same syntax of the corresponding option.
  13774. If the specified expression is not valid, it is kept at its current
  13775. value.
  13776. @subsection Examples
  13777. @itemize
  13778. @item
  13779. Inspect full first row of video frame.
  13780. @example
  13781. oscilloscope=x=0.5:y=0:s=1
  13782. @end example
  13783. @item
  13784. Inspect full last row of video frame.
  13785. @example
  13786. oscilloscope=x=0.5:y=1:s=1
  13787. @end example
  13788. @item
  13789. Inspect full 5th line of video frame of height 1080.
  13790. @example
  13791. oscilloscope=x=0.5:y=5/1080:s=1
  13792. @end example
  13793. @item
  13794. Inspect full last column of video frame.
  13795. @example
  13796. oscilloscope=x=1:y=0.5:s=1:t=1
  13797. @end example
  13798. @end itemize
  13799. @anchor{overlay}
  13800. @section overlay
  13801. Overlay one video on top of another.
  13802. It takes two inputs and has one output. The first input is the "main"
  13803. video on which the second input is overlaid.
  13804. It accepts the following parameters:
  13805. A description of the accepted options follows.
  13806. @table @option
  13807. @item x
  13808. @item y
  13809. Set the expression for the x and y coordinates of the overlaid video
  13810. on the main video. Default value is "0" for both expressions. In case
  13811. the expression is invalid, it is set to a huge value (meaning that the
  13812. overlay will not be displayed within the output visible area).
  13813. @item eof_action
  13814. See @ref{framesync}.
  13815. @item eval
  13816. Set when the expressions for @option{x}, and @option{y} are evaluated.
  13817. It accepts the following values:
  13818. @table @samp
  13819. @item init
  13820. only evaluate expressions once during the filter initialization or
  13821. when a command is processed
  13822. @item frame
  13823. evaluate expressions for each incoming frame
  13824. @end table
  13825. Default value is @samp{frame}.
  13826. @item shortest
  13827. See @ref{framesync}.
  13828. @item format
  13829. Set the format for the output video.
  13830. It accepts the following values:
  13831. @table @samp
  13832. @item yuv420
  13833. force YUV420 output
  13834. @item yuv420p10
  13835. force YUV420p10 output
  13836. @item yuv422
  13837. force YUV422 output
  13838. @item yuv422p10
  13839. force YUV422p10 output
  13840. @item yuv444
  13841. force YUV444 output
  13842. @item rgb
  13843. force packed RGB output
  13844. @item gbrp
  13845. force planar RGB output
  13846. @item auto
  13847. automatically pick format
  13848. @end table
  13849. Default value is @samp{yuv420}.
  13850. @item repeatlast
  13851. See @ref{framesync}.
  13852. @item alpha
  13853. Set format of alpha of the overlaid video, it can be @var{straight} or
  13854. @var{premultiplied}. Default is @var{straight}.
  13855. @end table
  13856. The @option{x}, and @option{y} expressions can contain the following
  13857. parameters.
  13858. @table @option
  13859. @item main_w, W
  13860. @item main_h, H
  13861. The main input width and height.
  13862. @item overlay_w, w
  13863. @item overlay_h, h
  13864. The overlay input width and height.
  13865. @item x
  13866. @item y
  13867. The computed values for @var{x} and @var{y}. They are evaluated for
  13868. each new frame.
  13869. @item hsub
  13870. @item vsub
  13871. horizontal and vertical chroma subsample values of the output
  13872. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  13873. @var{vsub} is 1.
  13874. @item n
  13875. the number of input frame, starting from 0
  13876. @item pos
  13877. the position in the file of the input frame, NAN if unknown
  13878. @item t
  13879. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  13880. @end table
  13881. This filter also supports the @ref{framesync} options.
  13882. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  13883. when evaluation is done @emph{per frame}, and will evaluate to NAN
  13884. when @option{eval} is set to @samp{init}.
  13885. Be aware that frames are taken from each input video in timestamp
  13886. order, hence, if their initial timestamps differ, it is a good idea
  13887. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  13888. have them begin in the same zero timestamp, as the example for
  13889. the @var{movie} filter does.
  13890. You can chain together more overlays but you should test the
  13891. efficiency of such approach.
  13892. @subsection Commands
  13893. This filter supports the following commands:
  13894. @table @option
  13895. @item x
  13896. @item y
  13897. Modify the x and y of the overlay input.
  13898. The command accepts the same syntax of the corresponding option.
  13899. If the specified expression is not valid, it is kept at its current
  13900. value.
  13901. @end table
  13902. @subsection Examples
  13903. @itemize
  13904. @item
  13905. Draw the overlay at 10 pixels from the bottom right corner of the main
  13906. video:
  13907. @example
  13908. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  13909. @end example
  13910. Using named options the example above becomes:
  13911. @example
  13912. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  13913. @end example
  13914. @item
  13915. Insert a transparent PNG logo in the bottom left corner of the input,
  13916. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  13917. @example
  13918. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  13919. @end example
  13920. @item
  13921. Insert 2 different transparent PNG logos (second logo on bottom
  13922. right corner) using the @command{ffmpeg} tool:
  13923. @example
  13924. 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
  13925. @end example
  13926. @item
  13927. Add a transparent color layer on top of the main video; @code{WxH}
  13928. must specify the size of the main input to the overlay filter:
  13929. @example
  13930. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  13931. @end example
  13932. @item
  13933. Play an original video and a filtered version (here with the deshake
  13934. filter) side by side using the @command{ffplay} tool:
  13935. @example
  13936. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  13937. @end example
  13938. The above command is the same as:
  13939. @example
  13940. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  13941. @end example
  13942. @item
  13943. Make a sliding overlay appearing from the left to the right top part of the
  13944. screen starting since time 2:
  13945. @example
  13946. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  13947. @end example
  13948. @item
  13949. Compose output by putting two input videos side to side:
  13950. @example
  13951. ffmpeg -i left.avi -i right.avi -filter_complex "
  13952. nullsrc=size=200x100 [background];
  13953. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  13954. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  13955. [background][left] overlay=shortest=1 [background+left];
  13956. [background+left][right] overlay=shortest=1:x=100 [left+right]
  13957. "
  13958. @end example
  13959. @item
  13960. Mask 10-20 seconds of a video by applying the delogo filter to a section
  13961. @example
  13962. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  13963. -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]'
  13964. masked.avi
  13965. @end example
  13966. @item
  13967. Chain several overlays in cascade:
  13968. @example
  13969. nullsrc=s=200x200 [bg];
  13970. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  13971. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  13972. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  13973. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  13974. [in3] null, [mid2] overlay=100:100 [out0]
  13975. @end example
  13976. @end itemize
  13977. @anchor{overlay_cuda}
  13978. @section overlay_cuda
  13979. Overlay one video on top of another.
  13980. This is the CUDA variant of the @ref{overlay} filter.
  13981. It only accepts CUDA frames. The underlying input pixel formats have to match.
  13982. It takes two inputs and has one output. The first input is the "main"
  13983. video on which the second input is overlaid.
  13984. It accepts the following parameters:
  13985. @table @option
  13986. @item x
  13987. @item y
  13988. Set expressions for the x and y coordinates of the overlaid video
  13989. on the main video.
  13990. They can contain the following parameters:
  13991. @table @option
  13992. @item main_w, W
  13993. @item main_h, H
  13994. The main input width and height.
  13995. @item overlay_w, w
  13996. @item overlay_h, h
  13997. The overlay input width and height.
  13998. @item x
  13999. @item y
  14000. The computed values for @var{x} and @var{y}. They are evaluated for
  14001. each new frame.
  14002. @item n
  14003. The ordinal index of the main input frame, starting from 0.
  14004. @item pos
  14005. The byte offset position in the file of the main input frame, NAN if unknown.
  14006. @item t
  14007. The timestamp of the main input frame, expressed in seconds, NAN if unknown.
  14008. @end table
  14009. Default value is "0" for both expressions.
  14010. @item eval
  14011. Set when the expressions for @option{x} and @option{y} are evaluated.
  14012. It accepts the following values:
  14013. @table @option
  14014. @item init
  14015. Evaluate expressions once during filter initialization or
  14016. when a command is processed.
  14017. @item frame
  14018. Evaluate expressions for each incoming frame
  14019. @end table
  14020. Default value is @option{frame}.
  14021. @item eof_action
  14022. See @ref{framesync}.
  14023. @item shortest
  14024. See @ref{framesync}.
  14025. @item repeatlast
  14026. See @ref{framesync}.
  14027. @end table
  14028. This filter also supports the @ref{framesync} options.
  14029. @section owdenoise
  14030. Apply Overcomplete Wavelet denoiser.
  14031. The filter accepts the following options:
  14032. @table @option
  14033. @item depth
  14034. Set depth.
  14035. Larger depth values will denoise lower frequency components more, but
  14036. slow down filtering.
  14037. Must be an int in the range 8-16, default is @code{8}.
  14038. @item luma_strength, ls
  14039. Set luma strength.
  14040. Must be a double value in the range 0-1000, default is @code{1.0}.
  14041. @item chroma_strength, cs
  14042. Set chroma strength.
  14043. Must be a double value in the range 0-1000, default is @code{1.0}.
  14044. @end table
  14045. @anchor{pad}
  14046. @section pad
  14047. Add paddings to the input image, and place the original input at the
  14048. provided @var{x}, @var{y} coordinates.
  14049. It accepts the following parameters:
  14050. @table @option
  14051. @item width, w
  14052. @item height, h
  14053. Specify an expression for the size of the output image with the
  14054. paddings added. If the value for @var{width} or @var{height} is 0, the
  14055. corresponding input size is used for the output.
  14056. The @var{width} expression can reference the value set by the
  14057. @var{height} expression, and vice versa.
  14058. The default value of @var{width} and @var{height} is 0.
  14059. @item x
  14060. @item y
  14061. Specify the offsets to place the input image at within the padded area,
  14062. with respect to the top/left border of the output image.
  14063. The @var{x} expression can reference the value set by the @var{y}
  14064. expression, and vice versa.
  14065. The default value of @var{x} and @var{y} is 0.
  14066. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  14067. so the input image is centered on the padded area.
  14068. @item color
  14069. Specify the color of the padded area. For the syntax of this option,
  14070. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14071. manual,ffmpeg-utils}.
  14072. The default value of @var{color} is "black".
  14073. @item eval
  14074. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  14075. It accepts the following values:
  14076. @table @samp
  14077. @item init
  14078. Only evaluate expressions once during the filter initialization or when
  14079. a command is processed.
  14080. @item frame
  14081. Evaluate expressions for each incoming frame.
  14082. @end table
  14083. Default value is @samp{init}.
  14084. @item aspect
  14085. Pad to aspect instead to a resolution.
  14086. @end table
  14087. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  14088. options are expressions containing the following constants:
  14089. @table @option
  14090. @item in_w
  14091. @item in_h
  14092. The input video width and height.
  14093. @item iw
  14094. @item ih
  14095. These are the same as @var{in_w} and @var{in_h}.
  14096. @item out_w
  14097. @item out_h
  14098. The output width and height (the size of the padded area), as
  14099. specified by the @var{width} and @var{height} expressions.
  14100. @item ow
  14101. @item oh
  14102. These are the same as @var{out_w} and @var{out_h}.
  14103. @item x
  14104. @item y
  14105. The x and y offsets as specified by the @var{x} and @var{y}
  14106. expressions, or NAN if not yet specified.
  14107. @item a
  14108. same as @var{iw} / @var{ih}
  14109. @item sar
  14110. input sample aspect ratio
  14111. @item dar
  14112. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  14113. @item hsub
  14114. @item vsub
  14115. The horizontal and vertical chroma subsample values. For example for the
  14116. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14117. @end table
  14118. @subsection Examples
  14119. @itemize
  14120. @item
  14121. Add paddings with the color "violet" to the input video. The output video
  14122. size is 640x480, and the top-left corner of the input video is placed at
  14123. column 0, row 40
  14124. @example
  14125. pad=640:480:0:40:violet
  14126. @end example
  14127. The example above is equivalent to the following command:
  14128. @example
  14129. pad=width=640:height=480:x=0:y=40:color=violet
  14130. @end example
  14131. @item
  14132. Pad the input to get an output with dimensions increased by 3/2,
  14133. and put the input video at the center of the padded area:
  14134. @example
  14135. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  14136. @end example
  14137. @item
  14138. Pad the input to get a squared output with size equal to the maximum
  14139. value between the input width and height, and put the input video at
  14140. the center of the padded area:
  14141. @example
  14142. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  14143. @end example
  14144. @item
  14145. Pad the input to get a final w/h ratio of 16:9:
  14146. @example
  14147. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  14148. @end example
  14149. @item
  14150. In case of anamorphic video, in order to set the output display aspect
  14151. correctly, it is necessary to use @var{sar} in the expression,
  14152. according to the relation:
  14153. @example
  14154. (ih * X / ih) * sar = output_dar
  14155. X = output_dar / sar
  14156. @end example
  14157. Thus the previous example needs to be modified to:
  14158. @example
  14159. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  14160. @end example
  14161. @item
  14162. Double the output size and put the input video in the bottom-right
  14163. corner of the output padded area:
  14164. @example
  14165. pad="2*iw:2*ih:ow-iw:oh-ih"
  14166. @end example
  14167. @end itemize
  14168. @anchor{palettegen}
  14169. @section palettegen
  14170. Generate one palette for a whole video stream.
  14171. It accepts the following options:
  14172. @table @option
  14173. @item max_colors
  14174. Set the maximum number of colors to quantize in the palette.
  14175. Note: the palette will still contain 256 colors; the unused palette entries
  14176. will be black.
  14177. @item reserve_transparent
  14178. Create a palette of 255 colors maximum and reserve the last one for
  14179. transparency. Reserving the transparency color is useful for GIF optimization.
  14180. If not set, the maximum of colors in the palette will be 256. You probably want
  14181. to disable this option for a standalone image.
  14182. Set by default.
  14183. @item transparency_color
  14184. Set the color that will be used as background for transparency.
  14185. @item stats_mode
  14186. Set statistics mode.
  14187. It accepts the following values:
  14188. @table @samp
  14189. @item full
  14190. Compute full frame histograms.
  14191. @item diff
  14192. Compute histograms only for the part that differs from previous frame. This
  14193. might be relevant to give more importance to the moving part of your input if
  14194. the background is static.
  14195. @item single
  14196. Compute new histogram for each frame.
  14197. @end table
  14198. Default value is @var{full}.
  14199. @end table
  14200. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  14201. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  14202. color quantization of the palette. This information is also visible at
  14203. @var{info} logging level.
  14204. @subsection Examples
  14205. @itemize
  14206. @item
  14207. Generate a representative palette of a given video using @command{ffmpeg}:
  14208. @example
  14209. ffmpeg -i input.mkv -vf palettegen palette.png
  14210. @end example
  14211. @end itemize
  14212. @section paletteuse
  14213. Use a palette to downsample an input video stream.
  14214. The filter takes two inputs: one video stream and a palette. The palette must
  14215. be a 256 pixels image.
  14216. It accepts the following options:
  14217. @table @option
  14218. @item dither
  14219. Select dithering mode. Available algorithms are:
  14220. @table @samp
  14221. @item bayer
  14222. Ordered 8x8 bayer dithering (deterministic)
  14223. @item heckbert
  14224. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  14225. Note: this dithering is sometimes considered "wrong" and is included as a
  14226. reference.
  14227. @item floyd_steinberg
  14228. Floyd and Steingberg dithering (error diffusion)
  14229. @item sierra2
  14230. Frankie Sierra dithering v2 (error diffusion)
  14231. @item sierra2_4a
  14232. Frankie Sierra dithering v2 "Lite" (error diffusion)
  14233. @item sierra3
  14234. Frankie Sierra dithering v3 (error diffusion)
  14235. @item burkes
  14236. Burkes dithering (error diffusion)
  14237. @item atkinson
  14238. Atkinson dithering by Bill Atkinson at Apple Computer (error diffusion)
  14239. @end table
  14240. Default is @var{sierra2_4a}.
  14241. @item bayer_scale
  14242. When @var{bayer} dithering is selected, this option defines the scale of the
  14243. pattern (how much the crosshatch pattern is visible). A low value means more
  14244. visible pattern for less banding, and higher value means less visible pattern
  14245. at the cost of more banding.
  14246. The option must be an integer value in the range [0,5]. Default is @var{2}.
  14247. @item diff_mode
  14248. If set, define the zone to process
  14249. @table @samp
  14250. @item rectangle
  14251. Only the changing rectangle will be reprocessed. This is similar to GIF
  14252. cropping/offsetting compression mechanism. This option can be useful for speed
  14253. if only a part of the image is changing, and has use cases such as limiting the
  14254. scope of the error diffusal @option{dither} to the rectangle that bounds the
  14255. moving scene (it leads to more deterministic output if the scene doesn't change
  14256. much, and as a result less moving noise and better GIF compression).
  14257. @end table
  14258. Default is @var{none}.
  14259. @item new
  14260. Take new palette for each output frame.
  14261. @item alpha_threshold
  14262. Sets the alpha threshold for transparency. Alpha values above this threshold
  14263. will be treated as completely opaque, and values below this threshold will be
  14264. treated as completely transparent.
  14265. The option must be an integer value in the range [0,255]. Default is @var{128}.
  14266. @end table
  14267. @subsection Examples
  14268. @itemize
  14269. @item
  14270. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  14271. using @command{ffmpeg}:
  14272. @example
  14273. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  14274. @end example
  14275. @end itemize
  14276. @section perspective
  14277. Correct perspective of video not recorded perpendicular to the screen.
  14278. A description of the accepted parameters follows.
  14279. @table @option
  14280. @item x0
  14281. @item y0
  14282. @item x1
  14283. @item y1
  14284. @item x2
  14285. @item y2
  14286. @item x3
  14287. @item y3
  14288. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  14289. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  14290. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  14291. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  14292. then the corners of the source will be sent to the specified coordinates.
  14293. The expressions can use the following variables:
  14294. @table @option
  14295. @item W
  14296. @item H
  14297. the width and height of video frame.
  14298. @item in
  14299. Input frame count.
  14300. @item on
  14301. Output frame count.
  14302. @end table
  14303. @item interpolation
  14304. Set interpolation for perspective correction.
  14305. It accepts the following values:
  14306. @table @samp
  14307. @item linear
  14308. @item cubic
  14309. @end table
  14310. Default value is @samp{linear}.
  14311. @item sense
  14312. Set interpretation of coordinate options.
  14313. It accepts the following values:
  14314. @table @samp
  14315. @item 0, source
  14316. Send point in the source specified by the given coordinates to
  14317. the corners of the destination.
  14318. @item 1, destination
  14319. Send the corners of the source to the point in the destination specified
  14320. by the given coordinates.
  14321. Default value is @samp{source}.
  14322. @end table
  14323. @item eval
  14324. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  14325. It accepts the following values:
  14326. @table @samp
  14327. @item init
  14328. only evaluate expressions once during the filter initialization or
  14329. when a command is processed
  14330. @item frame
  14331. evaluate expressions for each incoming frame
  14332. @end table
  14333. Default value is @samp{init}.
  14334. @end table
  14335. @section phase
  14336. Delay interlaced video by one field time so that the field order changes.
  14337. The intended use is to fix PAL movies that have been captured with the
  14338. opposite field order to the film-to-video transfer.
  14339. A description of the accepted parameters follows.
  14340. @table @option
  14341. @item mode
  14342. Set phase mode.
  14343. It accepts the following values:
  14344. @table @samp
  14345. @item t
  14346. Capture field order top-first, transfer bottom-first.
  14347. Filter will delay the bottom field.
  14348. @item b
  14349. Capture field order bottom-first, transfer top-first.
  14350. Filter will delay the top field.
  14351. @item p
  14352. Capture and transfer with the same field order. This mode only exists
  14353. for the documentation of the other options to refer to, but if you
  14354. actually select it, the filter will faithfully do nothing.
  14355. @item a
  14356. Capture field order determined automatically by field flags, transfer
  14357. opposite.
  14358. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  14359. basis using field flags. If no field information is available,
  14360. then this works just like @samp{u}.
  14361. @item u
  14362. Capture unknown or varying, transfer opposite.
  14363. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  14364. analyzing the images and selecting the alternative that produces best
  14365. match between the fields.
  14366. @item T
  14367. Capture top-first, transfer unknown or varying.
  14368. Filter selects among @samp{t} and @samp{p} using image analysis.
  14369. @item B
  14370. Capture bottom-first, transfer unknown or varying.
  14371. Filter selects among @samp{b} and @samp{p} using image analysis.
  14372. @item A
  14373. Capture determined by field flags, transfer unknown or varying.
  14374. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  14375. image analysis. If no field information is available, then this works just
  14376. like @samp{U}. This is the default mode.
  14377. @item U
  14378. Both capture and transfer unknown or varying.
  14379. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  14380. @end table
  14381. @end table
  14382. @subsection Commands
  14383. This filter supports the all above options as @ref{commands}.
  14384. @section photosensitivity
  14385. Reduce various flashes in video, so to help users with epilepsy.
  14386. It accepts the following options:
  14387. @table @option
  14388. @item frames, f
  14389. Set how many frames to use when filtering. Default is 30.
  14390. @item threshold, t
  14391. Set detection threshold factor. Default is 1.
  14392. Lower is stricter.
  14393. @item skip
  14394. Set how many pixels to skip when sampling frames. Default is 1.
  14395. Allowed range is from 1 to 1024.
  14396. @item bypass
  14397. Leave frames unchanged. Default is disabled.
  14398. @end table
  14399. @section pixdesctest
  14400. Pixel format descriptor test filter, mainly useful for internal
  14401. testing. The output video should be equal to the input video.
  14402. For example:
  14403. @example
  14404. format=monow, pixdesctest
  14405. @end example
  14406. can be used to test the monowhite pixel format descriptor definition.
  14407. @section pixelize
  14408. Apply pixelization to video stream.
  14409. The filter accepts the following options:
  14410. @table @option
  14411. @item width, w
  14412. @item height, h
  14413. Set block dimensions that will be used for pixelization.
  14414. Default value is @code{16}.
  14415. @item mode, m
  14416. Set the mode of pixelization used.
  14417. Possible values are:
  14418. @table @samp
  14419. @item avg
  14420. @item min
  14421. @item max
  14422. @end table
  14423. Default value is @code{avg}.
  14424. @item planes, p
  14425. Set what planes to filter. Default is to filter all planes.
  14426. @end table
  14427. @subsection Commands
  14428. This filter supports all options as @ref{commands}.
  14429. @section pixscope
  14430. Display sample values of color channels. Mainly useful for checking color
  14431. and levels. Minimum supported resolution is 640x480.
  14432. The filters accept the following options:
  14433. @table @option
  14434. @item x
  14435. Set scope X position, relative offset on X axis.
  14436. @item y
  14437. Set scope Y position, relative offset on Y axis.
  14438. @item w
  14439. Set scope width.
  14440. @item h
  14441. Set scope height.
  14442. @item o
  14443. Set window opacity. This window also holds statistics about pixel area.
  14444. @item wx
  14445. Set window X position, relative offset on X axis.
  14446. @item wy
  14447. Set window Y position, relative offset on Y axis.
  14448. @end table
  14449. @subsection Commands
  14450. This filter supports same @ref{commands} as options.
  14451. @section pp
  14452. Enable the specified chain of postprocessing subfilters using libpostproc. This
  14453. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  14454. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  14455. Each subfilter and some options have a short and a long name that can be used
  14456. interchangeably, i.e. dr/dering are the same.
  14457. The filters accept the following options:
  14458. @table @option
  14459. @item subfilters
  14460. Set postprocessing subfilters string.
  14461. @end table
  14462. All subfilters share common options to determine their scope:
  14463. @table @option
  14464. @item a/autoq
  14465. Honor the quality commands for this subfilter.
  14466. @item c/chrom
  14467. Do chrominance filtering, too (default).
  14468. @item y/nochrom
  14469. Do luminance filtering only (no chrominance).
  14470. @item n/noluma
  14471. Do chrominance filtering only (no luminance).
  14472. @end table
  14473. These options can be appended after the subfilter name, separated by a '|'.
  14474. Available subfilters are:
  14475. @table @option
  14476. @item hb/hdeblock[|difference[|flatness]]
  14477. Horizontal deblocking filter
  14478. @table @option
  14479. @item difference
  14480. Difference factor where higher values mean more deblocking (default: @code{32}).
  14481. @item flatness
  14482. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  14483. @end table
  14484. @item vb/vdeblock[|difference[|flatness]]
  14485. Vertical deblocking filter
  14486. @table @option
  14487. @item difference
  14488. Difference factor where higher values mean more deblocking (default: @code{32}).
  14489. @item flatness
  14490. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  14491. @end table
  14492. @item ha/hadeblock[|difference[|flatness]]
  14493. Accurate horizontal deblocking filter
  14494. @table @option
  14495. @item difference
  14496. Difference factor where higher values mean more deblocking (default: @code{32}).
  14497. @item flatness
  14498. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  14499. @end table
  14500. @item va/vadeblock[|difference[|flatness]]
  14501. Accurate vertical deblocking filter
  14502. @table @option
  14503. @item difference
  14504. Difference factor where higher values mean more deblocking (default: @code{32}).
  14505. @item flatness
  14506. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  14507. @end table
  14508. @end table
  14509. The horizontal and vertical deblocking filters share the difference and
  14510. flatness values so you cannot set different horizontal and vertical
  14511. thresholds.
  14512. @table @option
  14513. @item h1/x1hdeblock
  14514. Experimental horizontal deblocking filter
  14515. @item v1/x1vdeblock
  14516. Experimental vertical deblocking filter
  14517. @item dr/dering
  14518. Deringing filter
  14519. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  14520. @table @option
  14521. @item threshold1
  14522. larger -> stronger filtering
  14523. @item threshold2
  14524. larger -> stronger filtering
  14525. @item threshold3
  14526. larger -> stronger filtering
  14527. @end table
  14528. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  14529. @table @option
  14530. @item f/fullyrange
  14531. Stretch luminance to @code{0-255}.
  14532. @end table
  14533. @item lb/linblenddeint
  14534. Linear blend deinterlacing filter that deinterlaces the given block by
  14535. filtering all lines with a @code{(1 2 1)} filter.
  14536. @item li/linipoldeint
  14537. Linear interpolating deinterlacing filter that deinterlaces the given block by
  14538. linearly interpolating every second line.
  14539. @item ci/cubicipoldeint
  14540. Cubic interpolating deinterlacing filter deinterlaces the given block by
  14541. cubically interpolating every second line.
  14542. @item md/mediandeint
  14543. Median deinterlacing filter that deinterlaces the given block by applying a
  14544. median filter to every second line.
  14545. @item fd/ffmpegdeint
  14546. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  14547. second line with a @code{(-1 4 2 4 -1)} filter.
  14548. @item l5/lowpass5
  14549. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  14550. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  14551. @item fq/forceQuant[|quantizer]
  14552. Overrides the quantizer table from the input with the constant quantizer you
  14553. specify.
  14554. @table @option
  14555. @item quantizer
  14556. Quantizer to use
  14557. @end table
  14558. @item de/default
  14559. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  14560. @item fa/fast
  14561. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  14562. @item ac
  14563. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  14564. @end table
  14565. @subsection Examples
  14566. @itemize
  14567. @item
  14568. Apply horizontal and vertical deblocking, deringing and automatic
  14569. brightness/contrast:
  14570. @example
  14571. pp=hb/vb/dr/al
  14572. @end example
  14573. @item
  14574. Apply default filters without brightness/contrast correction:
  14575. @example
  14576. pp=de/-al
  14577. @end example
  14578. @item
  14579. Apply default filters and temporal denoiser:
  14580. @example
  14581. pp=default/tmpnoise|1|2|3
  14582. @end example
  14583. @item
  14584. Apply deblocking on luminance only, and switch vertical deblocking on or off
  14585. automatically depending on available CPU time:
  14586. @example
  14587. pp=hb|y/vb|a
  14588. @end example
  14589. @end itemize
  14590. @section pp7
  14591. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  14592. similar to spp = 6 with 7 point DCT, where only the center sample is
  14593. used after IDCT.
  14594. The filter accepts the following options:
  14595. @table @option
  14596. @item qp
  14597. Force a constant quantization parameter. It accepts an integer in range
  14598. 0 to 63. If not set, the filter will use the QP from the video stream
  14599. (if available).
  14600. @item mode
  14601. Set thresholding mode. Available modes are:
  14602. @table @samp
  14603. @item hard
  14604. Set hard thresholding.
  14605. @item soft
  14606. Set soft thresholding (better de-ringing effect, but likely blurrier).
  14607. @item medium
  14608. Set medium thresholding (good results, default).
  14609. @end table
  14610. @end table
  14611. @section premultiply
  14612. Apply alpha premultiply effect to input video stream using first plane
  14613. of second stream as alpha.
  14614. Both streams must have same dimensions and same pixel format.
  14615. The filter accepts the following option:
  14616. @table @option
  14617. @item planes
  14618. Set which planes will be processed, unprocessed planes will be copied.
  14619. By default value 0xf, all planes will be processed.
  14620. @item inplace
  14621. Do not require 2nd input for processing, instead use alpha plane from input stream.
  14622. @end table
  14623. @section prewitt
  14624. Apply prewitt operator to input video stream.
  14625. The filter accepts the following option:
  14626. @table @option
  14627. @item planes
  14628. Set which planes will be processed, unprocessed planes will be copied.
  14629. By default value 0xf, all planes will be processed.
  14630. @item scale
  14631. Set value which will be multiplied with filtered result.
  14632. @item delta
  14633. Set value which will be added to filtered result.
  14634. @end table
  14635. @subsection Commands
  14636. This filter supports the all above options as @ref{commands}.
  14637. @section pseudocolor
  14638. Alter frame colors in video with pseudocolors.
  14639. This filter accepts the following options:
  14640. @table @option
  14641. @item c0
  14642. set pixel first component expression
  14643. @item c1
  14644. set pixel second component expression
  14645. @item c2
  14646. set pixel third component expression
  14647. @item c3
  14648. set pixel fourth component expression, corresponds to the alpha component
  14649. @item index, i
  14650. set component to use as base for altering colors
  14651. @item preset, p
  14652. Pick one of built-in LUTs. By default is set to none.
  14653. Available LUTs:
  14654. @table @samp
  14655. @item magma
  14656. @item inferno
  14657. @item plasma
  14658. @item viridis
  14659. @item turbo
  14660. @item cividis
  14661. @item range1
  14662. @item range2
  14663. @item shadows
  14664. @item highlights
  14665. @item solar
  14666. @item nominal
  14667. @item preferred
  14668. @item total
  14669. @item spectral
  14670. @end table
  14671. @item opacity
  14672. Set opacity of output colors. Allowed range is from 0 to 1.
  14673. Default value is set to 1.
  14674. @end table
  14675. Each of the expression options specifies the expression to use for computing
  14676. the lookup table for the corresponding pixel component values.
  14677. The expressions can contain the following constants and functions:
  14678. @table @option
  14679. @item w
  14680. @item h
  14681. The input width and height.
  14682. @item val
  14683. The input value for the pixel component.
  14684. @item ymin, umin, vmin, amin
  14685. The minimum allowed component value.
  14686. @item ymax, umax, vmax, amax
  14687. The maximum allowed component value.
  14688. @end table
  14689. All expressions default to "val".
  14690. @subsection Commands
  14691. This filter supports the all above options as @ref{commands}.
  14692. @subsection Examples
  14693. @itemize
  14694. @item
  14695. Change too high luma values to gradient:
  14696. @example
  14697. 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'"
  14698. @end example
  14699. @end itemize
  14700. @section psnr
  14701. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  14702. Ratio) between two input videos.
  14703. This filter takes in input two input videos, the first input is
  14704. considered the "main" source and is passed unchanged to the
  14705. output. The second input is used as a "reference" video for computing
  14706. the PSNR.
  14707. Both video inputs must have the same resolution and pixel format for
  14708. this filter to work correctly. Also it assumes that both inputs
  14709. have the same number of frames, which are compared one by one.
  14710. The obtained average PSNR is printed through the logging system.
  14711. The filter stores the accumulated MSE (mean squared error) of each
  14712. frame, and at the end of the processing it is averaged across all frames
  14713. equally, and the following formula is applied to obtain the PSNR:
  14714. @example
  14715. PSNR = 10*log10(MAX^2/MSE)
  14716. @end example
  14717. Where MAX is the average of the maximum values of each component of the
  14718. image.
  14719. The description of the accepted parameters follows.
  14720. @table @option
  14721. @item stats_file, f
  14722. If specified the filter will use the named file to save the PSNR of
  14723. each individual frame. When filename equals "-" the data is sent to
  14724. standard output.
  14725. @item stats_version
  14726. Specifies which version of the stats file format to use. Details of
  14727. each format are written below.
  14728. Default value is 1.
  14729. @item stats_add_max
  14730. Determines whether the max value is output to the stats log.
  14731. Default value is 0.
  14732. Requires stats_version >= 2. If this is set and stats_version < 2,
  14733. the filter will return an error.
  14734. @end table
  14735. This filter also supports the @ref{framesync} options.
  14736. The file printed if @var{stats_file} is selected, contains a sequence of
  14737. key/value pairs of the form @var{key}:@var{value} for each compared
  14738. couple of frames.
  14739. If a @var{stats_version} greater than 1 is specified, a header line precedes
  14740. the list of per-frame-pair stats, with key value pairs following the frame
  14741. format with the following parameters:
  14742. @table @option
  14743. @item psnr_log_version
  14744. The version of the log file format. Will match @var{stats_version}.
  14745. @item fields
  14746. A comma separated list of the per-frame-pair parameters included in
  14747. the log.
  14748. @end table
  14749. A description of each shown per-frame-pair parameter follows:
  14750. @table @option
  14751. @item n
  14752. sequential number of the input frame, starting from 1
  14753. @item mse_avg
  14754. Mean Square Error pixel-by-pixel average difference of the compared
  14755. frames, averaged over all the image components.
  14756. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  14757. Mean Square Error pixel-by-pixel average difference of the compared
  14758. frames for the component specified by the suffix.
  14759. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  14760. Peak Signal to Noise ratio of the compared frames for the component
  14761. specified by the suffix.
  14762. @item max_avg, max_y, max_u, max_v
  14763. Maximum allowed value for each channel, and average over all
  14764. channels.
  14765. @end table
  14766. @subsection Examples
  14767. @itemize
  14768. @item
  14769. For example:
  14770. @example
  14771. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  14772. [main][ref] psnr="stats_file=stats.log" [out]
  14773. @end example
  14774. On this example the input file being processed is compared with the
  14775. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  14776. is stored in @file{stats.log}.
  14777. @item
  14778. Another example with different containers:
  14779. @example
  14780. 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 -
  14781. @end example
  14782. @end itemize
  14783. @anchor{pullup}
  14784. @section pullup
  14785. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  14786. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  14787. content.
  14788. The pullup filter is designed to take advantage of future context in making
  14789. its decisions. This filter is stateless in the sense that it does not lock
  14790. onto a pattern to follow, but it instead looks forward to the following
  14791. fields in order to identify matches and rebuild progressive frames.
  14792. To produce content with an even framerate, insert the fps filter after
  14793. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  14794. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  14795. The filter accepts the following options:
  14796. @table @option
  14797. @item jl
  14798. @item jr
  14799. @item jt
  14800. @item jb
  14801. These options set the amount of "junk" to ignore at the left, right, top, and
  14802. bottom of the image, respectively. Left and right are in units of 8 pixels,
  14803. while top and bottom are in units of 2 lines.
  14804. The default is 8 pixels on each side.
  14805. @item sb
  14806. Set the strict breaks. Setting this option to 1 will reduce the chances of
  14807. filter generating an occasional mismatched frame, but it may also cause an
  14808. excessive number of frames to be dropped during high motion sequences.
  14809. Conversely, setting it to -1 will make filter match fields more easily.
  14810. This may help processing of video where there is slight blurring between
  14811. the fields, but may also cause there to be interlaced frames in the output.
  14812. Default value is @code{0}.
  14813. @item mp
  14814. Set the metric plane to use. It accepts the following values:
  14815. @table @samp
  14816. @item l
  14817. Use luma plane.
  14818. @item u
  14819. Use chroma blue plane.
  14820. @item v
  14821. Use chroma red plane.
  14822. @end table
  14823. This option may be set to use chroma plane instead of the default luma plane
  14824. for doing filter's computations. This may improve accuracy on very clean
  14825. source material, but more likely will decrease accuracy, especially if there
  14826. is chroma noise (rainbow effect) or any grayscale video.
  14827. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  14828. load and make pullup usable in realtime on slow machines.
  14829. @end table
  14830. For best results (without duplicated frames in the output file) it is
  14831. necessary to change the output frame rate. For example, to inverse
  14832. telecine NTSC input:
  14833. @example
  14834. ffmpeg -i input -vf pullup -r 24000/1001 ...
  14835. @end example
  14836. @section qp
  14837. Change video quantization parameters (QP).
  14838. The filter accepts the following option:
  14839. @table @option
  14840. @item qp
  14841. Set expression for quantization parameter.
  14842. @end table
  14843. The expression is evaluated through the eval API and can contain, among others,
  14844. the following constants:
  14845. @table @var
  14846. @item known
  14847. 1 if index is not 129, 0 otherwise.
  14848. @item qp
  14849. Sequential index starting from -129 to 128.
  14850. @end table
  14851. @subsection Examples
  14852. @itemize
  14853. @item
  14854. Some equation like:
  14855. @example
  14856. qp=2+2*sin(PI*qp)
  14857. @end example
  14858. @end itemize
  14859. @section random
  14860. Flush video frames from internal cache of frames into a random order.
  14861. No frame is discarded.
  14862. Inspired by @ref{frei0r} nervous filter.
  14863. @table @option
  14864. @item frames
  14865. Set size in number of frames of internal cache, in range from @code{2} to
  14866. @code{512}. Default is @code{30}.
  14867. @item seed
  14868. Set seed for random number generator, must be an integer included between
  14869. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  14870. less than @code{0}, the filter will try to use a good random seed on a
  14871. best effort basis.
  14872. @end table
  14873. @section readeia608
  14874. Read closed captioning (EIA-608) information from the top lines of a video frame.
  14875. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  14876. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  14877. with EIA-608 data (starting from 0). A description of each metadata value follows:
  14878. @table @option
  14879. @item lavfi.readeia608.X.cc
  14880. The two bytes stored as EIA-608 data (printed in hexadecimal).
  14881. @item lavfi.readeia608.X.line
  14882. The number of the line on which the EIA-608 data was identified and read.
  14883. @end table
  14884. This filter accepts the following options:
  14885. @table @option
  14886. @item scan_min
  14887. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  14888. @item scan_max
  14889. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  14890. @item spw
  14891. Set the ratio of width reserved for sync code detection.
  14892. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  14893. @item chp
  14894. Enable checking the parity bit. In the event of a parity error, the filter will output
  14895. @code{0x00} for that character. Default is false.
  14896. @item lp
  14897. Lowpass lines prior to further processing. Default is enabled.
  14898. @end table
  14899. @subsection Commands
  14900. This filter supports the all above options as @ref{commands}.
  14901. @subsection Examples
  14902. @itemize
  14903. @item
  14904. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  14905. @example
  14906. 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
  14907. @end example
  14908. @end itemize
  14909. @section readvitc
  14910. Read vertical interval timecode (VITC) information from the top lines of a
  14911. video frame.
  14912. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  14913. timecode value, if a valid timecode has been detected. Further metadata key
  14914. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  14915. timecode data has been found or not.
  14916. This filter accepts the following options:
  14917. @table @option
  14918. @item scan_max
  14919. Set the maximum number of lines to scan for VITC data. If the value is set to
  14920. @code{-1} the full video frame is scanned. Default is @code{45}.
  14921. @item thr_b
  14922. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  14923. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  14924. @item thr_w
  14925. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  14926. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  14927. @end table
  14928. @subsection Examples
  14929. @itemize
  14930. @item
  14931. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  14932. draw @code{--:--:--:--} as a placeholder:
  14933. @example
  14934. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  14935. @end example
  14936. @end itemize
  14937. @section remap
  14938. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  14939. Destination pixel at position (X, Y) will be picked from source (x, y) position
  14940. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  14941. value for pixel will be used for destination pixel.
  14942. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  14943. will have Xmap/Ymap video stream dimensions.
  14944. Xmap and Ymap input video streams are 16bit depth, single channel.
  14945. @table @option
  14946. @item format
  14947. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  14948. Default is @code{color}.
  14949. @item fill
  14950. Specify the color of the unmapped pixels. For the syntax of this option,
  14951. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14952. manual,ffmpeg-utils}. Default color is @code{black}.
  14953. @end table
  14954. @section removegrain
  14955. The removegrain filter is a spatial denoiser for progressive video.
  14956. @table @option
  14957. @item m0
  14958. Set mode for the first plane.
  14959. @item m1
  14960. Set mode for the second plane.
  14961. @item m2
  14962. Set mode for the third plane.
  14963. @item m3
  14964. Set mode for the fourth plane.
  14965. @end table
  14966. Range of mode is from 0 to 24. Description of each mode follows:
  14967. @table @var
  14968. @item 0
  14969. Leave input plane unchanged. Default.
  14970. @item 1
  14971. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  14972. @item 2
  14973. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  14974. @item 3
  14975. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  14976. @item 4
  14977. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  14978. This is equivalent to a median filter.
  14979. @item 5
  14980. Line-sensitive clipping giving the minimal change.
  14981. @item 6
  14982. Line-sensitive clipping, intermediate.
  14983. @item 7
  14984. Line-sensitive clipping, intermediate.
  14985. @item 8
  14986. Line-sensitive clipping, intermediate.
  14987. @item 9
  14988. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  14989. @item 10
  14990. Replaces the target pixel with the closest neighbour.
  14991. @item 11
  14992. [1 2 1] horizontal and vertical kernel blur.
  14993. @item 12
  14994. Same as mode 11.
  14995. @item 13
  14996. Bob mode, interpolates top field from the line where the neighbours
  14997. pixels are the closest.
  14998. @item 14
  14999. Bob mode, interpolates bottom field from the line where the neighbours
  15000. pixels are the closest.
  15001. @item 15
  15002. Bob mode, interpolates top field. Same as 13 but with a more complicated
  15003. interpolation formula.
  15004. @item 16
  15005. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  15006. interpolation formula.
  15007. @item 17
  15008. Clips the pixel with the minimum and maximum of respectively the maximum and
  15009. minimum of each pair of opposite neighbour pixels.
  15010. @item 18
  15011. Line-sensitive clipping using opposite neighbours whose greatest distance from
  15012. the current pixel is minimal.
  15013. @item 19
  15014. Replaces the pixel with the average of its 8 neighbours.
  15015. @item 20
  15016. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  15017. @item 21
  15018. Clips pixels using the averages of opposite neighbour.
  15019. @item 22
  15020. Same as mode 21 but simpler and faster.
  15021. @item 23
  15022. Small edge and halo removal, but reputed useless.
  15023. @item 24
  15024. Similar as 23.
  15025. @end table
  15026. @section removelogo
  15027. Suppress a TV station logo, using an image file to determine which
  15028. pixels comprise the logo. It works by filling in the pixels that
  15029. comprise the logo with neighboring pixels.
  15030. The filter accepts the following options:
  15031. @table @option
  15032. @item filename, f
  15033. Set the filter bitmap file, which can be any image format supported by
  15034. libavformat. The width and height of the image file must match those of the
  15035. video stream being processed.
  15036. @end table
  15037. Pixels in the provided bitmap image with a value of zero are not
  15038. considered part of the logo, non-zero pixels are considered part of
  15039. the logo. If you use white (255) for the logo and black (0) for the
  15040. rest, you will be safe. For making the filter bitmap, it is
  15041. recommended to take a screen capture of a black frame with the logo
  15042. visible, and then using a threshold filter followed by the erode
  15043. filter once or twice.
  15044. If needed, little splotches can be fixed manually. Remember that if
  15045. logo pixels are not covered, the filter quality will be much
  15046. reduced. Marking too many pixels as part of the logo does not hurt as
  15047. much, but it will increase the amount of blurring needed to cover over
  15048. the image and will destroy more information than necessary, and extra
  15049. pixels will slow things down on a large logo.
  15050. @section repeatfields
  15051. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  15052. fields based on its value.
  15053. @section reverse
  15054. Reverse a video clip.
  15055. Warning: This filter requires memory to buffer the entire clip, so trimming
  15056. is suggested.
  15057. @subsection Examples
  15058. @itemize
  15059. @item
  15060. Take the first 5 seconds of a clip, and reverse it.
  15061. @example
  15062. trim=end=5,reverse
  15063. @end example
  15064. @end itemize
  15065. @section rgbashift
  15066. Shift R/G/B/A pixels horizontally and/or vertically.
  15067. The filter accepts the following options:
  15068. @table @option
  15069. @item rh
  15070. Set amount to shift red horizontally.
  15071. @item rv
  15072. Set amount to shift red vertically.
  15073. @item gh
  15074. Set amount to shift green horizontally.
  15075. @item gv
  15076. Set amount to shift green vertically.
  15077. @item bh
  15078. Set amount to shift blue horizontally.
  15079. @item bv
  15080. Set amount to shift blue vertically.
  15081. @item ah
  15082. Set amount to shift alpha horizontally.
  15083. @item av
  15084. Set amount to shift alpha vertically.
  15085. @item edge
  15086. Set edge mode, can be @var{smear}, default, or @var{warp}.
  15087. @end table
  15088. @subsection Commands
  15089. This filter supports the all above options as @ref{commands}.
  15090. @section roberts
  15091. Apply roberts cross operator to input video stream.
  15092. The filter accepts the following option:
  15093. @table @option
  15094. @item planes
  15095. Set which planes will be processed, unprocessed planes will be copied.
  15096. By default value 0xf, all planes will be processed.
  15097. @item scale
  15098. Set value which will be multiplied with filtered result.
  15099. @item delta
  15100. Set value which will be added to filtered result.
  15101. @end table
  15102. @subsection Commands
  15103. This filter supports the all above options as @ref{commands}.
  15104. @section rotate
  15105. Rotate video by an arbitrary angle expressed in radians.
  15106. The filter accepts the following options:
  15107. A description of the optional parameters follows.
  15108. @table @option
  15109. @item angle, a
  15110. Set an expression for the angle by which to rotate the input video
  15111. clockwise, expressed as a number of radians. A negative value will
  15112. result in a counter-clockwise rotation. By default it is set to "0".
  15113. This expression is evaluated for each frame.
  15114. @item out_w, ow
  15115. Set the output width expression, default value is "iw".
  15116. This expression is evaluated just once during configuration.
  15117. @item out_h, oh
  15118. Set the output height expression, default value is "ih".
  15119. This expression is evaluated just once during configuration.
  15120. @item bilinear
  15121. Enable bilinear interpolation if set to 1, a value of 0 disables
  15122. it. Default value is 1.
  15123. @item fillcolor, c
  15124. Set the color used to fill the output area not covered by the rotated
  15125. image. For the general syntax of this option, check the
  15126. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15127. If the special value "none" is selected then no
  15128. background is printed (useful for example if the background is never shown).
  15129. Default value is "black".
  15130. @end table
  15131. The expressions for the angle and the output size can contain the
  15132. following constants and functions:
  15133. @table @option
  15134. @item n
  15135. sequential number of the input frame, starting from 0. It is always NAN
  15136. before the first frame is filtered.
  15137. @item t
  15138. time in seconds of the input frame, it is set to 0 when the filter is
  15139. configured. It is always NAN before the first frame is filtered.
  15140. @item hsub
  15141. @item vsub
  15142. horizontal and vertical chroma subsample values. For example for the
  15143. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15144. @item in_w, iw
  15145. @item in_h, ih
  15146. the input video width and height
  15147. @item out_w, ow
  15148. @item out_h, oh
  15149. the output width and height, that is the size of the padded area as
  15150. specified by the @var{width} and @var{height} expressions
  15151. @item rotw(a)
  15152. @item roth(a)
  15153. the minimal width/height required for completely containing the input
  15154. video rotated by @var{a} radians.
  15155. These are only available when computing the @option{out_w} and
  15156. @option{out_h} expressions.
  15157. @end table
  15158. @subsection Examples
  15159. @itemize
  15160. @item
  15161. Rotate the input by PI/6 radians clockwise:
  15162. @example
  15163. rotate=PI/6
  15164. @end example
  15165. @item
  15166. Rotate the input by PI/6 radians counter-clockwise:
  15167. @example
  15168. rotate=-PI/6
  15169. @end example
  15170. @item
  15171. Rotate the input by 45 degrees clockwise:
  15172. @example
  15173. rotate=45*PI/180
  15174. @end example
  15175. @item
  15176. Apply a constant rotation with period T, starting from an angle of PI/3:
  15177. @example
  15178. rotate=PI/3+2*PI*t/T
  15179. @end example
  15180. @item
  15181. Make the input video rotation oscillating with a period of T
  15182. seconds and an amplitude of A radians:
  15183. @example
  15184. rotate=A*sin(2*PI/T*t)
  15185. @end example
  15186. @item
  15187. Rotate the video, output size is chosen so that the whole rotating
  15188. input video is always completely contained in the output:
  15189. @example
  15190. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  15191. @end example
  15192. @item
  15193. Rotate the video, reduce the output size so that no background is ever
  15194. shown:
  15195. @example
  15196. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  15197. @end example
  15198. @end itemize
  15199. @subsection Commands
  15200. The filter supports the following commands:
  15201. @table @option
  15202. @item a, angle
  15203. Set the angle expression.
  15204. The command accepts the same syntax of the corresponding option.
  15205. If the specified expression is not valid, it is kept at its current
  15206. value.
  15207. @end table
  15208. @section sab
  15209. Apply Shape Adaptive Blur.
  15210. The filter accepts the following options:
  15211. @table @option
  15212. @item luma_radius, lr
  15213. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  15214. value is 1.0. A greater value will result in a more blurred image, and
  15215. in slower processing.
  15216. @item luma_pre_filter_radius, lpfr
  15217. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  15218. value is 1.0.
  15219. @item luma_strength, ls
  15220. Set luma maximum difference between pixels to still be considered, must
  15221. be a value in the 0.1-100.0 range, default value is 1.0.
  15222. @item chroma_radius, cr
  15223. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  15224. greater value will result in a more blurred image, and in slower
  15225. processing.
  15226. @item chroma_pre_filter_radius, cpfr
  15227. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  15228. @item chroma_strength, cs
  15229. Set chroma maximum difference between pixels to still be considered,
  15230. must be a value in the -0.9-100.0 range.
  15231. @end table
  15232. Each chroma option value, if not explicitly specified, is set to the
  15233. corresponding luma option value.
  15234. @anchor{scale}
  15235. @section scale
  15236. Scale (resize) the input video, using the libswscale library.
  15237. The scale filter forces the output display aspect ratio to be the same
  15238. of the input, by changing the output sample aspect ratio.
  15239. If the input image format is different from the format requested by
  15240. the next filter, the scale filter will convert the input to the
  15241. requested format.
  15242. @subsection Options
  15243. The filter accepts the following options, or any of the options
  15244. supported by the libswscale scaler.
  15245. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  15246. the complete list of scaler options.
  15247. @table @option
  15248. @item width, w
  15249. @item height, h
  15250. Set the output video dimension expression. Default value is the input
  15251. dimension.
  15252. If the @var{width} or @var{w} value is 0, the input width is used for
  15253. the output. If the @var{height} or @var{h} value is 0, the input height
  15254. is used for the output.
  15255. If one and only one of the values is -n with n >= 1, the scale filter
  15256. will use a value that maintains the aspect ratio of the input image,
  15257. calculated from the other specified dimension. After that it will,
  15258. however, make sure that the calculated dimension is divisible by n and
  15259. adjust the value if necessary.
  15260. If both values are -n with n >= 1, the behavior will be identical to
  15261. both values being set to 0 as previously detailed.
  15262. See below for the list of accepted constants for use in the dimension
  15263. expression.
  15264. @item eval
  15265. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  15266. @table @samp
  15267. @item init
  15268. Only evaluate expressions once during the filter initialization or when a command is processed.
  15269. @item frame
  15270. Evaluate expressions for each incoming frame.
  15271. @end table
  15272. Default value is @samp{init}.
  15273. @item interl
  15274. Set the interlacing mode. It accepts the following values:
  15275. @table @samp
  15276. @item 1
  15277. Force interlaced aware scaling.
  15278. @item 0
  15279. Do not apply interlaced scaling.
  15280. @item -1
  15281. Select interlaced aware scaling depending on whether the source frames
  15282. are flagged as interlaced or not.
  15283. @end table
  15284. Default value is @samp{0}.
  15285. @item flags
  15286. Set libswscale scaling flags. See
  15287. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  15288. complete list of values. If not explicitly specified the filter applies
  15289. the default flags.
  15290. @item param0, param1
  15291. Set libswscale input parameters for scaling algorithms that need them. See
  15292. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  15293. complete documentation. If not explicitly specified the filter applies
  15294. empty parameters.
  15295. @item size, s
  15296. Set the video size. For the syntax of this option, check the
  15297. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15298. @item in_color_matrix
  15299. @item out_color_matrix
  15300. Set in/output YCbCr color space type.
  15301. This allows the autodetected value to be overridden as well as allows forcing
  15302. a specific value used for the output and encoder.
  15303. If not specified, the color space type depends on the pixel format.
  15304. Possible values:
  15305. @table @samp
  15306. @item auto
  15307. Choose automatically.
  15308. @item bt709
  15309. Format conforming to International Telecommunication Union (ITU)
  15310. Recommendation BT.709.
  15311. @item fcc
  15312. Set color space conforming to the United States Federal Communications
  15313. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  15314. @item bt601
  15315. @item bt470
  15316. @item smpte170m
  15317. Set color space conforming to:
  15318. @itemize
  15319. @item
  15320. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  15321. @item
  15322. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  15323. @item
  15324. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  15325. @end itemize
  15326. @item smpte240m
  15327. Set color space conforming to SMPTE ST 240:1999.
  15328. @item bt2020
  15329. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  15330. @end table
  15331. @item in_range
  15332. @item out_range
  15333. Set in/output YCbCr sample range.
  15334. This allows the autodetected value to be overridden as well as allows forcing
  15335. a specific value used for the output and encoder. If not specified, the
  15336. range depends on the pixel format. Possible values:
  15337. @table @samp
  15338. @item auto/unknown
  15339. Choose automatically.
  15340. @item jpeg/full/pc
  15341. Set full range (0-255 in case of 8-bit luma).
  15342. @item mpeg/limited/tv
  15343. Set "MPEG" range (16-235 in case of 8-bit luma).
  15344. @end table
  15345. @item force_original_aspect_ratio
  15346. Enable decreasing or increasing output video width or height if necessary to
  15347. keep the original aspect ratio. Possible values:
  15348. @table @samp
  15349. @item disable
  15350. Scale the video as specified and disable this feature.
  15351. @item decrease
  15352. The output video dimensions will automatically be decreased if needed.
  15353. @item increase
  15354. The output video dimensions will automatically be increased if needed.
  15355. @end table
  15356. One useful instance of this option is that when you know a specific device's
  15357. maximum allowed resolution, you can use this to limit the output video to
  15358. that, while retaining the aspect ratio. For example, device A allows
  15359. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  15360. decrease) and specifying 1280x720 to the command line makes the output
  15361. 1280x533.
  15362. Please note that this is a different thing than specifying -1 for @option{w}
  15363. or @option{h}, you still need to specify the output resolution for this option
  15364. to work.
  15365. @item force_divisible_by
  15366. Ensures that both the output dimensions, width and height, are divisible by the
  15367. given integer when used together with @option{force_original_aspect_ratio}. This
  15368. works similar to using @code{-n} in the @option{w} and @option{h} options.
  15369. This option respects the value set for @option{force_original_aspect_ratio},
  15370. increasing or decreasing the resolution accordingly. The video's aspect ratio
  15371. may be slightly modified.
  15372. This option can be handy if you need to have a video fit within or exceed
  15373. a defined resolution using @option{force_original_aspect_ratio} but also have
  15374. encoder restrictions on width or height divisibility.
  15375. @end table
  15376. The values of the @option{w} and @option{h} options are expressions
  15377. containing the following constants:
  15378. @table @var
  15379. @item in_w
  15380. @item in_h
  15381. The input width and height
  15382. @item iw
  15383. @item ih
  15384. These are the same as @var{in_w} and @var{in_h}.
  15385. @item out_w
  15386. @item out_h
  15387. The output (scaled) width and height
  15388. @item ow
  15389. @item oh
  15390. These are the same as @var{out_w} and @var{out_h}
  15391. @item a
  15392. The same as @var{iw} / @var{ih}
  15393. @item sar
  15394. input sample aspect ratio
  15395. @item dar
  15396. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  15397. @item hsub
  15398. @item vsub
  15399. horizontal and vertical input chroma subsample values. For example for the
  15400. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15401. @item ohsub
  15402. @item ovsub
  15403. horizontal and vertical output chroma subsample values. For example for the
  15404. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15405. @item n
  15406. The (sequential) number of the input frame, starting from 0.
  15407. Only available with @code{eval=frame}.
  15408. @item t
  15409. The presentation timestamp of the input frame, expressed as a number of
  15410. seconds. Only available with @code{eval=frame}.
  15411. @item pos
  15412. The position (byte offset) of the frame in the input stream, or NaN if
  15413. this information is unavailable and/or meaningless (for example in case of synthetic video).
  15414. Only available with @code{eval=frame}.
  15415. @end table
  15416. @subsection Examples
  15417. @itemize
  15418. @item
  15419. Scale the input video to a size of 200x100
  15420. @example
  15421. scale=w=200:h=100
  15422. @end example
  15423. This is equivalent to:
  15424. @example
  15425. scale=200:100
  15426. @end example
  15427. or:
  15428. @example
  15429. scale=200x100
  15430. @end example
  15431. @item
  15432. Specify a size abbreviation for the output size:
  15433. @example
  15434. scale=qcif
  15435. @end example
  15436. which can also be written as:
  15437. @example
  15438. scale=size=qcif
  15439. @end example
  15440. @item
  15441. Scale the input to 2x:
  15442. @example
  15443. scale=w=2*iw:h=2*ih
  15444. @end example
  15445. @item
  15446. The above is the same as:
  15447. @example
  15448. scale=2*in_w:2*in_h
  15449. @end example
  15450. @item
  15451. Scale the input to 2x with forced interlaced scaling:
  15452. @example
  15453. scale=2*iw:2*ih:interl=1
  15454. @end example
  15455. @item
  15456. Scale the input to half size:
  15457. @example
  15458. scale=w=iw/2:h=ih/2
  15459. @end example
  15460. @item
  15461. Increase the width, and set the height to the same size:
  15462. @example
  15463. scale=3/2*iw:ow
  15464. @end example
  15465. @item
  15466. Seek Greek harmony:
  15467. @example
  15468. scale=iw:1/PHI*iw
  15469. scale=ih*PHI:ih
  15470. @end example
  15471. @item
  15472. Increase the height, and set the width to 3/2 of the height:
  15473. @example
  15474. scale=w=3/2*oh:h=3/5*ih
  15475. @end example
  15476. @item
  15477. Increase the size, making the size a multiple of the chroma
  15478. subsample values:
  15479. @example
  15480. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  15481. @end example
  15482. @item
  15483. Increase the width to a maximum of 500 pixels,
  15484. keeping the same aspect ratio as the input:
  15485. @example
  15486. scale=w='min(500\, iw*3/2):h=-1'
  15487. @end example
  15488. @item
  15489. Make pixels square by combining scale and setsar:
  15490. @example
  15491. scale='trunc(ih*dar):ih',setsar=1/1
  15492. @end example
  15493. @item
  15494. Make pixels square by combining scale and setsar,
  15495. making sure the resulting resolution is even (required by some codecs):
  15496. @example
  15497. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  15498. @end example
  15499. @end itemize
  15500. @subsection Commands
  15501. This filter supports the following commands:
  15502. @table @option
  15503. @item width, w
  15504. @item height, h
  15505. Set the output video dimension expression.
  15506. The command accepts the same syntax of the corresponding option.
  15507. If the specified expression is not valid, it is kept at its current
  15508. value.
  15509. @end table
  15510. @section scale_cuda
  15511. Scale (resize) and convert (pixel format) the input video, using accelerated CUDA kernels.
  15512. Setting the output width and height works in the same way as for the @ref{scale} filter.
  15513. The filter accepts the following options:
  15514. @table @option
  15515. @item w
  15516. @item h
  15517. Set the output video dimension expression. Default value is the input dimension.
  15518. Allows for the same expressions as the @ref{scale} filter.
  15519. @item interp_algo
  15520. Sets the algorithm used for scaling:
  15521. @table @var
  15522. @item nearest
  15523. Nearest neighbour
  15524. Used by default if input parameters match the desired output.
  15525. @item bilinear
  15526. Bilinear
  15527. @item bicubic
  15528. Bicubic
  15529. This is the default.
  15530. @item lanczos
  15531. Lanczos
  15532. @end table
  15533. @item format
  15534. Controls the output pixel format. By default, or if none is specified, the input
  15535. pixel format is used.
  15536. The filter does not support converting between YUV and RGB pixel formats.
  15537. @item passthrough
  15538. If set to 0, every frame is processed, even if no conversion is neccesary.
  15539. This mode can be useful to use the filter as a buffer for a downstream
  15540. frame-consumer that exhausts the limited decoder frame pool.
  15541. If set to 1, frames are passed through as-is if they match the desired output
  15542. parameters. This is the default behaviour.
  15543. @item param
  15544. Algorithm-Specific parameter.
  15545. Affects the curves of the bicubic algorithm.
  15546. @item force_original_aspect_ratio
  15547. @item force_divisible_by
  15548. Work the same as the identical @ref{scale} filter options.
  15549. @end table
  15550. @subsection Examples
  15551. @itemize
  15552. @item
  15553. Scale input to 720p, keeping aspect ratio and ensuring the output is yuv420p.
  15554. @example
  15555. scale_cuda=-2:720:format=yuv420p
  15556. @end example
  15557. @item
  15558. Upscale to 4K using nearest neighbour algorithm.
  15559. @example
  15560. scale_cuda=4096:2160:interp_algo=nearest
  15561. @end example
  15562. @item
  15563. Don't do any conversion or scaling, but copy all input frames into newly allocated ones.
  15564. This can be useful to deal with a filter and encode chain that otherwise exhausts the
  15565. decoders frame pool.
  15566. @example
  15567. scale_cuda=passthrough=0
  15568. @end example
  15569. @end itemize
  15570. @anchor{scale_npp}
  15571. @section scale_npp
  15572. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  15573. format conversion on CUDA video frames. Setting the output width and height
  15574. works in the same way as for the @var{scale} filter.
  15575. The following additional options are accepted:
  15576. @table @option
  15577. @item format
  15578. The pixel format of the output CUDA frames. If set to the string "same" (the
  15579. default), the input format will be kept. Note that automatic format negotiation
  15580. and conversion is not yet supported for hardware frames
  15581. @item interp_algo
  15582. The interpolation algorithm used for resizing. One of the following:
  15583. @table @option
  15584. @item nn
  15585. Nearest neighbour.
  15586. @item linear
  15587. @item cubic
  15588. @item cubic2p_bspline
  15589. 2-parameter cubic (B=1, C=0)
  15590. @item cubic2p_catmullrom
  15591. 2-parameter cubic (B=0, C=1/2)
  15592. @item cubic2p_b05c03
  15593. 2-parameter cubic (B=1/2, C=3/10)
  15594. @item super
  15595. Supersampling
  15596. @item lanczos
  15597. @end table
  15598. @item force_original_aspect_ratio
  15599. Enable decreasing or increasing output video width or height if necessary to
  15600. keep the original aspect ratio. Possible values:
  15601. @table @samp
  15602. @item disable
  15603. Scale the video as specified and disable this feature.
  15604. @item decrease
  15605. The output video dimensions will automatically be decreased if needed.
  15606. @item increase
  15607. The output video dimensions will automatically be increased if needed.
  15608. @end table
  15609. One useful instance of this option is that when you know a specific device's
  15610. maximum allowed resolution, you can use this to limit the output video to
  15611. that, while retaining the aspect ratio. For example, device A allows
  15612. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  15613. decrease) and specifying 1280x720 to the command line makes the output
  15614. 1280x533.
  15615. Please note that this is a different thing than specifying -1 for @option{w}
  15616. or @option{h}, you still need to specify the output resolution for this option
  15617. to work.
  15618. @item force_divisible_by
  15619. Ensures that both the output dimensions, width and height, are divisible by the
  15620. given integer when used together with @option{force_original_aspect_ratio}. This
  15621. works similar to using @code{-n} in the @option{w} and @option{h} options.
  15622. This option respects the value set for @option{force_original_aspect_ratio},
  15623. increasing or decreasing the resolution accordingly. The video's aspect ratio
  15624. may be slightly modified.
  15625. This option can be handy if you need to have a video fit within or exceed
  15626. a defined resolution using @option{force_original_aspect_ratio} but also have
  15627. encoder restrictions on width or height divisibility.
  15628. @item eval
  15629. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  15630. @table @samp
  15631. @item init
  15632. Only evaluate expressions once during the filter initialization or when a command is processed.
  15633. @item frame
  15634. Evaluate expressions for each incoming frame.
  15635. @end table
  15636. @end table
  15637. The values of the @option{w} and @option{h} options are expressions
  15638. containing the following constants:
  15639. @table @var
  15640. @item in_w
  15641. @item in_h
  15642. The input width and height
  15643. @item iw
  15644. @item ih
  15645. These are the same as @var{in_w} and @var{in_h}.
  15646. @item out_w
  15647. @item out_h
  15648. The output (scaled) width and height
  15649. @item ow
  15650. @item oh
  15651. These are the same as @var{out_w} and @var{out_h}
  15652. @item a
  15653. The same as @var{iw} / @var{ih}
  15654. @item sar
  15655. input sample aspect ratio
  15656. @item dar
  15657. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  15658. @item n
  15659. The (sequential) number of the input frame, starting from 0.
  15660. Only available with @code{eval=frame}.
  15661. @item t
  15662. The presentation timestamp of the input frame, expressed as a number of
  15663. seconds. Only available with @code{eval=frame}.
  15664. @item pos
  15665. The position (byte offset) of the frame in the input stream, or NaN if
  15666. this information is unavailable and/or meaningless (for example in case of synthetic video).
  15667. Only available with @code{eval=frame}.
  15668. @end table
  15669. @section scale2ref
  15670. Scale (resize) the input video, based on a reference video.
  15671. See the scale filter for available options, scale2ref supports the same but
  15672. uses the reference video instead of the main input as basis. scale2ref also
  15673. supports the following additional constants for the @option{w} and
  15674. @option{h} options:
  15675. @table @var
  15676. @item main_w
  15677. @item main_h
  15678. The main input video's width and height
  15679. @item main_a
  15680. The same as @var{main_w} / @var{main_h}
  15681. @item main_sar
  15682. The main input video's sample aspect ratio
  15683. @item main_dar, mdar
  15684. The main input video's display aspect ratio. Calculated from
  15685. @code{(main_w / main_h) * main_sar}.
  15686. @item main_hsub
  15687. @item main_vsub
  15688. The main input video's horizontal and vertical chroma subsample values.
  15689. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  15690. is 1.
  15691. @item main_n
  15692. The (sequential) number of the main input frame, starting from 0.
  15693. Only available with @code{eval=frame}.
  15694. @item main_t
  15695. The presentation timestamp of the main input frame, expressed as a number of
  15696. seconds. Only available with @code{eval=frame}.
  15697. @item main_pos
  15698. The position (byte offset) of the frame in the main input stream, or NaN if
  15699. this information is unavailable and/or meaningless (for example in case of synthetic video).
  15700. Only available with @code{eval=frame}.
  15701. @end table
  15702. @subsection Examples
  15703. @itemize
  15704. @item
  15705. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  15706. @example
  15707. 'scale2ref[b][a];[a][b]overlay'
  15708. @end example
  15709. @item
  15710. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  15711. @example
  15712. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  15713. @end example
  15714. @end itemize
  15715. @subsection Commands
  15716. This filter supports the following commands:
  15717. @table @option
  15718. @item width, w
  15719. @item height, h
  15720. Set the output video dimension expression.
  15721. The command accepts the same syntax of the corresponding option.
  15722. If the specified expression is not valid, it is kept at its current
  15723. value.
  15724. @end table
  15725. @section scale2ref_npp
  15726. Use the NVIDIA Performance Primitives (libnpp) to scale (resize) the input
  15727. video, based on a reference video.
  15728. See the @ref{scale_npp} filter for available options, scale2ref_npp supports the same
  15729. but uses the reference video instead of the main input as basis. scale2ref_npp
  15730. also supports the following additional constants for the @option{w} and
  15731. @option{h} options:
  15732. @table @var
  15733. @item main_w
  15734. @item main_h
  15735. The main input video's width and height
  15736. @item main_a
  15737. The same as @var{main_w} / @var{main_h}
  15738. @item main_sar
  15739. The main input video's sample aspect ratio
  15740. @item main_dar, mdar
  15741. The main input video's display aspect ratio. Calculated from
  15742. @code{(main_w / main_h) * main_sar}.
  15743. @item main_n
  15744. The (sequential) number of the main input frame, starting from 0.
  15745. Only available with @code{eval=frame}.
  15746. @item main_t
  15747. The presentation timestamp of the main input frame, expressed as a number of
  15748. seconds. Only available with @code{eval=frame}.
  15749. @item main_pos
  15750. The position (byte offset) of the frame in the main input stream, or NaN if
  15751. this information is unavailable and/or meaningless (for example in case of synthetic video).
  15752. Only available with @code{eval=frame}.
  15753. @end table
  15754. @subsection Examples
  15755. @itemize
  15756. @item
  15757. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  15758. @example
  15759. 'scale2ref_npp[b][a];[a][b]overlay_cuda'
  15760. @end example
  15761. @item
  15762. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  15763. @example
  15764. [logo-in][video-in]scale2ref_npp=w=oh*mdar:h=ih/10[logo-out][video-out]
  15765. @end example
  15766. @end itemize
  15767. @section scharr
  15768. Apply scharr operator to input video stream.
  15769. The filter accepts the following option:
  15770. @table @option
  15771. @item planes
  15772. Set which planes will be processed, unprocessed planes will be copied.
  15773. By default value 0xf, all planes will be processed.
  15774. @item scale
  15775. Set value which will be multiplied with filtered result.
  15776. @item delta
  15777. Set value which will be added to filtered result.
  15778. @end table
  15779. @subsection Commands
  15780. This filter supports the all above options as @ref{commands}.
  15781. @section scroll
  15782. Scroll input video horizontally and/or vertically by constant speed.
  15783. The filter accepts the following options:
  15784. @table @option
  15785. @item horizontal, h
  15786. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  15787. Negative values changes scrolling direction.
  15788. @item vertical, v
  15789. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  15790. Negative values changes scrolling direction.
  15791. @item hpos
  15792. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  15793. @item vpos
  15794. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  15795. @end table
  15796. @subsection Commands
  15797. This filter supports the following @ref{commands}:
  15798. @table @option
  15799. @item horizontal, h
  15800. Set the horizontal scrolling speed.
  15801. @item vertical, v
  15802. Set the vertical scrolling speed.
  15803. @end table
  15804. @anchor{scdet}
  15805. @section scdet
  15806. Detect video scene change.
  15807. This filter sets frame metadata with mafd between frame, the scene score, and
  15808. forward the frame to the next filter, so they can use these metadata to detect
  15809. scene change or others.
  15810. In addition, this filter logs a message and sets frame metadata when it detects
  15811. a scene change by @option{threshold}.
  15812. @code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
  15813. @code{lavfi.scd.score} metadata keys are set with scene change score for every frame
  15814. to detect scene change.
  15815. @code{lavfi.scd.time} metadata keys are set with current filtered frame time which
  15816. detect scene change with @option{threshold}.
  15817. The filter accepts the following options:
  15818. @table @option
  15819. @item threshold, t
  15820. Set the scene change detection threshold as a percentage of maximum change. Good
  15821. values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} is
  15822. @code{[0., 100.]}.
  15823. Default value is @code{10.}.
  15824. @item sc_pass, s
  15825. Set the flag to pass scene change frames to the next filter. Default value is @code{0}
  15826. You can enable it if you want to get snapshot of scene change frames only.
  15827. @end table
  15828. @anchor{selectivecolor}
  15829. @section selectivecolor
  15830. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  15831. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  15832. by the "purity" of the color (that is, how saturated it already is).
  15833. This filter is similar to the Adobe Photoshop Selective Color tool.
  15834. The filter accepts the following options:
  15835. @table @option
  15836. @item correction_method
  15837. Select color correction method.
  15838. Available values are:
  15839. @table @samp
  15840. @item absolute
  15841. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  15842. component value).
  15843. @item relative
  15844. Specified adjustments are relative to the original component value.
  15845. @end table
  15846. Default is @code{absolute}.
  15847. @item reds
  15848. Adjustments for red pixels (pixels where the red component is the maximum)
  15849. @item yellows
  15850. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  15851. @item greens
  15852. Adjustments for green pixels (pixels where the green component is the maximum)
  15853. @item cyans
  15854. Adjustments for cyan pixels (pixels where the red component is the minimum)
  15855. @item blues
  15856. Adjustments for blue pixels (pixels where the blue component is the maximum)
  15857. @item magentas
  15858. Adjustments for magenta pixels (pixels where the green component is the minimum)
  15859. @item whites
  15860. Adjustments for white pixels (pixels where all components are greater than 128)
  15861. @item neutrals
  15862. Adjustments for all pixels except pure black and pure white
  15863. @item blacks
  15864. Adjustments for black pixels (pixels where all components are lesser than 128)
  15865. @item psfile
  15866. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  15867. @end table
  15868. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  15869. 4 space separated floating point adjustment values in the [-1,1] range,
  15870. respectively to adjust the amount of cyan, magenta, yellow and black for the
  15871. pixels of its range.
  15872. @subsection Examples
  15873. @itemize
  15874. @item
  15875. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  15876. increase magenta by 27% in blue areas:
  15877. @example
  15878. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  15879. @end example
  15880. @item
  15881. Use a Photoshop selective color preset:
  15882. @example
  15883. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  15884. @end example
  15885. @end itemize
  15886. @anchor{separatefields}
  15887. @section separatefields
  15888. The @code{separatefields} takes a frame-based video input and splits
  15889. each frame into its components fields, producing a new half height clip
  15890. with twice the frame rate and twice the frame count.
  15891. This filter use field-dominance information in frame to decide which
  15892. of each pair of fields to place first in the output.
  15893. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  15894. @section setdar, setsar
  15895. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  15896. output video.
  15897. This is done by changing the specified Sample (aka Pixel) Aspect
  15898. Ratio, according to the following equation:
  15899. @example
  15900. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  15901. @end example
  15902. Keep in mind that the @code{setdar} filter does not modify the pixel
  15903. dimensions of the video frame. Also, the display aspect ratio set by
  15904. this filter may be changed by later filters in the filterchain,
  15905. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  15906. applied.
  15907. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  15908. the filter output video.
  15909. Note that as a consequence of the application of this filter, the
  15910. output display aspect ratio will change according to the equation
  15911. above.
  15912. Keep in mind that the sample aspect ratio set by the @code{setsar}
  15913. filter may be changed by later filters in the filterchain, e.g. if
  15914. another "setsar" or a "setdar" filter is applied.
  15915. It accepts the following parameters:
  15916. @table @option
  15917. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  15918. Set the aspect ratio used by the filter.
  15919. The parameter can be a floating point number string, an expression, or
  15920. a string of the form @var{num}:@var{den}, where @var{num} and
  15921. @var{den} are the numerator and denominator of the aspect ratio. If
  15922. the parameter is not specified, it is assumed the value "0".
  15923. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  15924. should be escaped.
  15925. @item max
  15926. Set the maximum integer value to use for expressing numerator and
  15927. denominator when reducing the expressed aspect ratio to a rational.
  15928. Default value is @code{100}.
  15929. @end table
  15930. The parameter @var{sar} is an expression containing
  15931. the following constants:
  15932. @table @option
  15933. @item E, PI, PHI
  15934. These are approximated values for the mathematical constants e
  15935. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  15936. @item w, h
  15937. The input width and height.
  15938. @item a
  15939. These are the same as @var{w} / @var{h}.
  15940. @item sar
  15941. The input sample aspect ratio.
  15942. @item dar
  15943. The input display aspect ratio. It is the same as
  15944. (@var{w} / @var{h}) * @var{sar}.
  15945. @item hsub, vsub
  15946. Horizontal and vertical chroma subsample values. For example, for the
  15947. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15948. @end table
  15949. @subsection Examples
  15950. @itemize
  15951. @item
  15952. To change the display aspect ratio to 16:9, specify one of the following:
  15953. @example
  15954. setdar=dar=1.77777
  15955. setdar=dar=16/9
  15956. @end example
  15957. @item
  15958. To change the sample aspect ratio to 10:11, specify:
  15959. @example
  15960. setsar=sar=10/11
  15961. @end example
  15962. @item
  15963. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  15964. 1000 in the aspect ratio reduction, use the command:
  15965. @example
  15966. setdar=ratio=16/9:max=1000
  15967. @end example
  15968. @end itemize
  15969. @anchor{setfield}
  15970. @section setfield
  15971. Force field for the output video frame.
  15972. The @code{setfield} filter marks the interlace type field for the
  15973. output frames. It does not change the input frame, but only sets the
  15974. corresponding property, which affects how the frame is treated by
  15975. following filters (e.g. @code{fieldorder} or @code{yadif}).
  15976. The filter accepts the following options:
  15977. @table @option
  15978. @item mode
  15979. Available values are:
  15980. @table @samp
  15981. @item auto
  15982. Keep the same field property.
  15983. @item bff
  15984. Mark the frame as bottom-field-first.
  15985. @item tff
  15986. Mark the frame as top-field-first.
  15987. @item prog
  15988. Mark the frame as progressive.
  15989. @end table
  15990. @end table
  15991. @anchor{setparams}
  15992. @section setparams
  15993. Force frame parameter for the output video frame.
  15994. The @code{setparams} filter marks interlace and color range for the
  15995. output frames. It does not change the input frame, but only sets the
  15996. corresponding property, which affects how the frame is treated by
  15997. filters/encoders.
  15998. @table @option
  15999. @item field_mode
  16000. Available values are:
  16001. @table @samp
  16002. @item auto
  16003. Keep the same field property (default).
  16004. @item bff
  16005. Mark the frame as bottom-field-first.
  16006. @item tff
  16007. Mark the frame as top-field-first.
  16008. @item prog
  16009. Mark the frame as progressive.
  16010. @end table
  16011. @item range
  16012. Available values are:
  16013. @table @samp
  16014. @item auto
  16015. Keep the same color range property (default).
  16016. @item unspecified, unknown
  16017. Mark the frame as unspecified color range.
  16018. @item limited, tv, mpeg
  16019. Mark the frame as limited range.
  16020. @item full, pc, jpeg
  16021. Mark the frame as full range.
  16022. @end table
  16023. @item color_primaries
  16024. Set the color primaries.
  16025. Available values are:
  16026. @table @samp
  16027. @item auto
  16028. Keep the same color primaries property (default).
  16029. @item bt709
  16030. @item unknown
  16031. @item bt470m
  16032. @item bt470bg
  16033. @item smpte170m
  16034. @item smpte240m
  16035. @item film
  16036. @item bt2020
  16037. @item smpte428
  16038. @item smpte431
  16039. @item smpte432
  16040. @item jedec-p22
  16041. @end table
  16042. @item color_trc
  16043. Set the color transfer.
  16044. Available values are:
  16045. @table @samp
  16046. @item auto
  16047. Keep the same color trc property (default).
  16048. @item bt709
  16049. @item unknown
  16050. @item bt470m
  16051. @item bt470bg
  16052. @item smpte170m
  16053. @item smpte240m
  16054. @item linear
  16055. @item log100
  16056. @item log316
  16057. @item iec61966-2-4
  16058. @item bt1361e
  16059. @item iec61966-2-1
  16060. @item bt2020-10
  16061. @item bt2020-12
  16062. @item smpte2084
  16063. @item smpte428
  16064. @item arib-std-b67
  16065. @end table
  16066. @item colorspace
  16067. Set the colorspace.
  16068. Available values are:
  16069. @table @samp
  16070. @item auto
  16071. Keep the same colorspace property (default).
  16072. @item gbr
  16073. @item bt709
  16074. @item unknown
  16075. @item fcc
  16076. @item bt470bg
  16077. @item smpte170m
  16078. @item smpte240m
  16079. @item ycgco
  16080. @item bt2020nc
  16081. @item bt2020c
  16082. @item smpte2085
  16083. @item chroma-derived-nc
  16084. @item chroma-derived-c
  16085. @item ictcp
  16086. @end table
  16087. @end table
  16088. @section sharpen_npp
  16089. Use the NVIDIA Performance Primitives (libnpp) to perform image sharpening with
  16090. border control.
  16091. The following additional options are accepted:
  16092. @table @option
  16093. @item border_type
  16094. Type of sampling to be used ad frame borders. One of the following:
  16095. @table @option
  16096. @item replicate
  16097. Replicate pixel values.
  16098. @end table
  16099. @end table
  16100. @section shear
  16101. Apply shear transform to input video.
  16102. This filter supports the following options:
  16103. @table @option
  16104. @item shx
  16105. Shear factor in X-direction. Default value is 0.
  16106. Allowed range is from -2 to 2.
  16107. @item shy
  16108. Shear factor in Y-direction. Default value is 0.
  16109. Allowed range is from -2 to 2.
  16110. @item fillcolor, c
  16111. Set the color used to fill the output area not covered by the transformed
  16112. video. For the general syntax of this option, check the
  16113. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16114. If the special value "none" is selected then no
  16115. background is printed (useful for example if the background is never shown).
  16116. Default value is "black".
  16117. @item interp
  16118. Set interpolation type. Can be @code{bilinear} or @code{nearest}. Default is @code{bilinear}.
  16119. @end table
  16120. @subsection Commands
  16121. This filter supports the all above options as @ref{commands}.
  16122. @section showinfo
  16123. Show a line containing various information for each input video frame.
  16124. The input video is not modified.
  16125. This filter supports the following options:
  16126. @table @option
  16127. @item checksum
  16128. Calculate checksums of each plane. By default enabled.
  16129. @end table
  16130. The shown line contains a sequence of key/value pairs of the form
  16131. @var{key}:@var{value}.
  16132. The following values are shown in the output:
  16133. @table @option
  16134. @item n
  16135. The (sequential) number of the input frame, starting from 0.
  16136. @item pts
  16137. The Presentation TimeStamp of the input frame, expressed as a number of
  16138. time base units. The time base unit depends on the filter input pad.
  16139. @item pts_time
  16140. The Presentation TimeStamp of the input frame, expressed as a number of
  16141. seconds.
  16142. @item pos
  16143. The position of the frame in the input stream, or -1 if this information is
  16144. unavailable and/or meaningless (for example in case of synthetic video).
  16145. @item fmt
  16146. The pixel format name.
  16147. @item sar
  16148. The sample aspect ratio of the input frame, expressed in the form
  16149. @var{num}/@var{den}.
  16150. @item s
  16151. The size of the input frame. For the syntax of this option, check the
  16152. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16153. @item i
  16154. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  16155. for bottom field first).
  16156. @item iskey
  16157. This is 1 if the frame is a key frame, 0 otherwise.
  16158. @item type
  16159. The picture type of the input frame ("I" for an I-frame, "P" for a
  16160. P-frame, "B" for a B-frame, or "?" for an unknown type).
  16161. Also refer to the documentation of the @code{AVPictureType} enum and of
  16162. the @code{av_get_picture_type_char} function defined in
  16163. @file{libavutil/avutil.h}.
  16164. @item checksum
  16165. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  16166. @item plane_checksum
  16167. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  16168. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  16169. @item mean
  16170. The mean value of pixels in each plane of the input frame, expressed in the form
  16171. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  16172. @item stdev
  16173. The standard deviation of pixel values in each plane of the input frame, expressed
  16174. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  16175. @end table
  16176. @section showpalette
  16177. Displays the 256 colors palette of each frame. This filter is only relevant for
  16178. @var{pal8} pixel format frames.
  16179. It accepts the following option:
  16180. @table @option
  16181. @item s
  16182. Set the size of the box used to represent one palette color entry. Default is
  16183. @code{30} (for a @code{30x30} pixel box).
  16184. @end table
  16185. @section shuffleframes
  16186. Reorder and/or duplicate and/or drop video frames.
  16187. It accepts the following parameters:
  16188. @table @option
  16189. @item mapping
  16190. Set the destination indexes of input frames.
  16191. This is space or '|' separated list of indexes that maps input frames to output
  16192. frames. Number of indexes also sets maximal value that each index may have.
  16193. '-1' index have special meaning and that is to drop frame.
  16194. @end table
  16195. The first frame has the index 0. The default is to keep the input unchanged.
  16196. @subsection Examples
  16197. @itemize
  16198. @item
  16199. Swap second and third frame of every three frames of the input:
  16200. @example
  16201. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  16202. @end example
  16203. @item
  16204. Swap 10th and 1st frame of every ten frames of the input:
  16205. @example
  16206. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  16207. @end example
  16208. @end itemize
  16209. @section shufflepixels
  16210. Reorder pixels in video frames.
  16211. This filter accepts the following options:
  16212. @table @option
  16213. @item direction, d
  16214. Set shuffle direction. Can be forward or inverse direction.
  16215. Default direction is forward.
  16216. @item mode, m
  16217. Set shuffle mode. Can be horizontal, vertical or block mode.
  16218. @item width, w
  16219. @item height, h
  16220. Set shuffle block_size. In case of horizontal shuffle mode only width
  16221. part of size is used, and in case of vertical shuffle mode only height
  16222. part of size is used.
  16223. @item seed, s
  16224. Set random seed used with shuffling pixels. Mainly useful to set to be able
  16225. to reverse filtering process to get original input.
  16226. For example, to reverse forward shuffle you need to use same parameters
  16227. and exact same seed and to set direction to inverse.
  16228. @end table
  16229. @section shuffleplanes
  16230. Reorder and/or duplicate video planes.
  16231. It accepts the following parameters:
  16232. @table @option
  16233. @item map0
  16234. The index of the input plane to be used as the first output plane.
  16235. @item map1
  16236. The index of the input plane to be used as the second output plane.
  16237. @item map2
  16238. The index of the input plane to be used as the third output plane.
  16239. @item map3
  16240. The index of the input plane to be used as the fourth output plane.
  16241. @end table
  16242. The first plane has the index 0. The default is to keep the input unchanged.
  16243. @subsection Examples
  16244. @itemize
  16245. @item
  16246. Swap the second and third planes of the input:
  16247. @example
  16248. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  16249. @end example
  16250. @end itemize
  16251. @anchor{signalstats}
  16252. @section signalstats
  16253. Evaluate various visual metrics that assist in determining issues associated
  16254. with the digitization of analog video media.
  16255. By default the filter will log these metadata values:
  16256. @table @option
  16257. @item YMIN
  16258. Display the minimal Y value contained within the input frame. Expressed in
  16259. range of [0-255].
  16260. @item YLOW
  16261. Display the Y value at the 10% percentile within the input frame. Expressed in
  16262. range of [0-255].
  16263. @item YAVG
  16264. Display the average Y value within the input frame. Expressed in range of
  16265. [0-255].
  16266. @item YHIGH
  16267. Display the Y value at the 90% percentile within the input frame. Expressed in
  16268. range of [0-255].
  16269. @item YMAX
  16270. Display the maximum Y value contained within the input frame. Expressed in
  16271. range of [0-255].
  16272. @item UMIN
  16273. Display the minimal U value contained within the input frame. Expressed in
  16274. range of [0-255].
  16275. @item ULOW
  16276. Display the U value at the 10% percentile within the input frame. Expressed in
  16277. range of [0-255].
  16278. @item UAVG
  16279. Display the average U value within the input frame. Expressed in range of
  16280. [0-255].
  16281. @item UHIGH
  16282. Display the U value at the 90% percentile within the input frame. Expressed in
  16283. range of [0-255].
  16284. @item UMAX
  16285. Display the maximum U value contained within the input frame. Expressed in
  16286. range of [0-255].
  16287. @item VMIN
  16288. Display the minimal V value contained within the input frame. Expressed in
  16289. range of [0-255].
  16290. @item VLOW
  16291. Display the V value at the 10% percentile within the input frame. Expressed in
  16292. range of [0-255].
  16293. @item VAVG
  16294. Display the average V value within the input frame. Expressed in range of
  16295. [0-255].
  16296. @item VHIGH
  16297. Display the V value at the 90% percentile within the input frame. Expressed in
  16298. range of [0-255].
  16299. @item VMAX
  16300. Display the maximum V value contained within the input frame. Expressed in
  16301. range of [0-255].
  16302. @item SATMIN
  16303. Display the minimal saturation value contained within the input frame.
  16304. Expressed in range of [0-~181.02].
  16305. @item SATLOW
  16306. Display the saturation value at the 10% percentile within the input frame.
  16307. Expressed in range of [0-~181.02].
  16308. @item SATAVG
  16309. Display the average saturation value within the input frame. Expressed in range
  16310. of [0-~181.02].
  16311. @item SATHIGH
  16312. Display the saturation value at the 90% percentile within the input frame.
  16313. Expressed in range of [0-~181.02].
  16314. @item SATMAX
  16315. Display the maximum saturation value contained within the input frame.
  16316. Expressed in range of [0-~181.02].
  16317. @item HUEMED
  16318. Display the median value for hue within the input frame. Expressed in range of
  16319. [0-360].
  16320. @item HUEAVG
  16321. Display the average value for hue within the input frame. Expressed in range of
  16322. [0-360].
  16323. @item YDIF
  16324. Display the average of sample value difference between all values of the Y
  16325. plane in the current frame and corresponding values of the previous input frame.
  16326. Expressed in range of [0-255].
  16327. @item UDIF
  16328. Display the average of sample value difference between all values of the U
  16329. plane in the current frame and corresponding values of the previous input frame.
  16330. Expressed in range of [0-255].
  16331. @item VDIF
  16332. Display the average of sample value difference between all values of the V
  16333. plane in the current frame and corresponding values of the previous input frame.
  16334. Expressed in range of [0-255].
  16335. @item YBITDEPTH
  16336. Display bit depth of Y plane in current frame.
  16337. Expressed in range of [0-16].
  16338. @item UBITDEPTH
  16339. Display bit depth of U plane in current frame.
  16340. Expressed in range of [0-16].
  16341. @item VBITDEPTH
  16342. Display bit depth of V plane in current frame.
  16343. Expressed in range of [0-16].
  16344. @end table
  16345. The filter accepts the following options:
  16346. @table @option
  16347. @item stat
  16348. @item out
  16349. @option{stat} specify an additional form of image analysis.
  16350. @option{out} output video with the specified type of pixel highlighted.
  16351. Both options accept the following values:
  16352. @table @samp
  16353. @item tout
  16354. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  16355. unlike the neighboring pixels of the same field. Examples of temporal outliers
  16356. include the results of video dropouts, head clogs, or tape tracking issues.
  16357. @item vrep
  16358. Identify @var{vertical line repetition}. Vertical line repetition includes
  16359. similar rows of pixels within a frame. In born-digital video vertical line
  16360. repetition is common, but this pattern is uncommon in video digitized from an
  16361. analog source. When it occurs in video that results from the digitization of an
  16362. analog source it can indicate concealment from a dropout compensator.
  16363. @item brng
  16364. Identify pixels that fall outside of legal broadcast range.
  16365. @end table
  16366. @item color, c
  16367. Set the highlight color for the @option{out} option. The default color is
  16368. yellow.
  16369. @end table
  16370. @subsection Examples
  16371. @itemize
  16372. @item
  16373. Output data of various video metrics:
  16374. @example
  16375. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  16376. @end example
  16377. @item
  16378. Output specific data about the minimum and maximum values of the Y plane per frame:
  16379. @example
  16380. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  16381. @end example
  16382. @item
  16383. Playback video while highlighting pixels that are outside of broadcast range in red.
  16384. @example
  16385. ffplay example.mov -vf signalstats="out=brng:color=red"
  16386. @end example
  16387. @item
  16388. Playback video with signalstats metadata drawn over the frame.
  16389. @example
  16390. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  16391. @end example
  16392. The contents of signalstat_drawtext.txt used in the command are:
  16393. @example
  16394. time %@{pts:hms@}
  16395. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  16396. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  16397. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  16398. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  16399. @end example
  16400. @end itemize
  16401. @anchor{signature}
  16402. @section signature
  16403. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  16404. input. In this case the matching between the inputs can be calculated additionally.
  16405. The filter always passes through the first input. The signature of each stream can
  16406. be written into a file.
  16407. It accepts the following options:
  16408. @table @option
  16409. @item detectmode
  16410. Enable or disable the matching process.
  16411. Available values are:
  16412. @table @samp
  16413. @item off
  16414. Disable the calculation of a matching (default).
  16415. @item full
  16416. Calculate the matching for the whole video and output whether the whole video
  16417. matches or only parts.
  16418. @item fast
  16419. Calculate only until a matching is found or the video ends. Should be faster in
  16420. some cases.
  16421. @end table
  16422. @item nb_inputs
  16423. Set the number of inputs. The option value must be a non negative integer.
  16424. Default value is 1.
  16425. @item filename
  16426. Set the path to which the output is written. If there is more than one input,
  16427. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  16428. integer), that will be replaced with the input number. If no filename is
  16429. specified, no output will be written. This is the default.
  16430. @item format
  16431. Choose the output format.
  16432. Available values are:
  16433. @table @samp
  16434. @item binary
  16435. Use the specified binary representation (default).
  16436. @item xml
  16437. Use the specified xml representation.
  16438. @end table
  16439. @item th_d
  16440. Set threshold to detect one word as similar. The option value must be an integer
  16441. greater than zero. The default value is 9000.
  16442. @item th_dc
  16443. Set threshold to detect all words as similar. The option value must be an integer
  16444. greater than zero. The default value is 60000.
  16445. @item th_xh
  16446. Set threshold to detect frames as similar. The option value must be an integer
  16447. greater than zero. The default value is 116.
  16448. @item th_di
  16449. Set the minimum length of a sequence in frames to recognize it as matching
  16450. sequence. The option value must be a non negative integer value.
  16451. The default value is 0.
  16452. @item th_it
  16453. Set the minimum relation, that matching frames to all frames must have.
  16454. The option value must be a double value between 0 and 1. The default value is 0.5.
  16455. @end table
  16456. @subsection Examples
  16457. @itemize
  16458. @item
  16459. To calculate the signature of an input video and store it in signature.bin:
  16460. @example
  16461. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  16462. @end example
  16463. @item
  16464. To detect whether two videos match and store the signatures in XML format in
  16465. signature0.xml and signature1.xml:
  16466. @example
  16467. 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 -
  16468. @end example
  16469. @end itemize
  16470. @anchor{siti}
  16471. @section siti
  16472. Calculate Spatial Info (SI) and Temporal Info (TI) scores for a video, as defined
  16473. in ITU-T P.910: Subjective video quality assessment methods for multimedia
  16474. applications. Available PDF at @url{https://www.itu.int/rec/T-REC-P.910-199909-S/en }.
  16475. It accepts the following option:
  16476. @table @option
  16477. @item print_summary
  16478. If set to 1, Summary statistics will be printed to the console. Default 0.
  16479. @end table
  16480. @subsection Examples
  16481. @itemize
  16482. @item
  16483. To calculate SI/TI metrics and print summary:
  16484. @example
  16485. ffmpeg -i input.mp4 -vf siti=print_summary=1 -f null -
  16486. @end example
  16487. @end itemize
  16488. @anchor{smartblur}
  16489. @section smartblur
  16490. Blur the input video without impacting the outlines.
  16491. It accepts the following options:
  16492. @table @option
  16493. @item luma_radius, lr
  16494. Set the luma radius. The option value must be a float number in
  16495. the range [0.1,5.0] that specifies the variance of the gaussian filter
  16496. used to blur the image (slower if larger). Default value is 1.0.
  16497. @item luma_strength, ls
  16498. Set the luma strength. The option value must be a float number
  16499. in the range [-1.0,1.0] that configures the blurring. A value included
  16500. in [0.0,1.0] will blur the image whereas a value included in
  16501. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  16502. @item luma_threshold, lt
  16503. Set the luma threshold used as a coefficient to determine
  16504. whether a pixel should be blurred or not. The option value must be an
  16505. integer in the range [-30,30]. A value of 0 will filter all the image,
  16506. a value included in [0,30] will filter flat areas and a value included
  16507. in [-30,0] will filter edges. Default value is 0.
  16508. @item chroma_radius, cr
  16509. Set the chroma radius. The option value must be a float number in
  16510. the range [0.1,5.0] that specifies the variance of the gaussian filter
  16511. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  16512. @item chroma_strength, cs
  16513. Set the chroma strength. The option value must be a float number
  16514. in the range [-1.0,1.0] that configures the blurring. A value included
  16515. in [0.0,1.0] will blur the image whereas a value included in
  16516. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  16517. @item chroma_threshold, ct
  16518. Set the chroma threshold used as a coefficient to determine
  16519. whether a pixel should be blurred or not. The option value must be an
  16520. integer in the range [-30,30]. A value of 0 will filter all the image,
  16521. a value included in [0,30] will filter flat areas and a value included
  16522. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  16523. @end table
  16524. If a chroma option is not explicitly set, the corresponding luma value
  16525. is set.
  16526. @section sobel
  16527. Apply sobel operator to input video stream.
  16528. The filter accepts the following option:
  16529. @table @option
  16530. @item planes
  16531. Set which planes will be processed, unprocessed planes will be copied.
  16532. By default value 0xf, all planes will be processed.
  16533. @item scale
  16534. Set value which will be multiplied with filtered result.
  16535. @item delta
  16536. Set value which will be added to filtered result.
  16537. @end table
  16538. @subsection Commands
  16539. This filter supports the all above options as @ref{commands}.
  16540. @anchor{spp}
  16541. @section spp
  16542. Apply a simple postprocessing filter that compresses and decompresses the image
  16543. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  16544. and average the results.
  16545. The filter accepts the following options:
  16546. @table @option
  16547. @item quality
  16548. Set quality. This option defines the number of levels for averaging. It accepts
  16549. an integer in the range 0-6. If set to @code{0}, the filter will have no
  16550. effect. A value of @code{6} means the higher quality. For each increment of
  16551. that value the speed drops by a factor of approximately 2. Default value is
  16552. @code{3}.
  16553. @item qp
  16554. Force a constant quantization parameter. If not set, the filter will use the QP
  16555. from the video stream (if available).
  16556. @item mode
  16557. Set thresholding mode. Available modes are:
  16558. @table @samp
  16559. @item hard
  16560. Set hard thresholding (default).
  16561. @item soft
  16562. Set soft thresholding (better de-ringing effect, but likely blurrier).
  16563. @end table
  16564. @item use_bframe_qp
  16565. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  16566. option may cause flicker since the B-Frames have often larger QP. Default is
  16567. @code{0} (not enabled).
  16568. @end table
  16569. @subsection Commands
  16570. This filter supports the following commands:
  16571. @table @option
  16572. @item quality, level
  16573. Set quality level. The value @code{max} can be used to set the maximum level,
  16574. currently @code{6}.
  16575. @end table
  16576. @anchor{sr}
  16577. @section sr
  16578. Scale the input by applying one of the super-resolution methods based on
  16579. convolutional neural networks. Supported models:
  16580. @itemize
  16581. @item
  16582. Super-Resolution Convolutional Neural Network model (SRCNN).
  16583. See @url{https://arxiv.org/abs/1501.00092}.
  16584. @item
  16585. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  16586. See @url{https://arxiv.org/abs/1609.05158}.
  16587. @end itemize
  16588. Training scripts as well as scripts for model file (.pb) saving can be found at
  16589. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  16590. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  16591. Native model files (.model) can be generated from TensorFlow model
  16592. files (.pb) by using tools/python/convert.py
  16593. The filter accepts the following options:
  16594. @table @option
  16595. @item dnn_backend
  16596. Specify which DNN backend to use for model loading and execution. This option accepts
  16597. the following values:
  16598. @table @samp
  16599. @item native
  16600. Native implementation of DNN loading and execution.
  16601. @item tensorflow
  16602. TensorFlow backend. To enable this backend you
  16603. need to install the TensorFlow for C library (see
  16604. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  16605. @code{--enable-libtensorflow}
  16606. @end table
  16607. Default value is @samp{native}.
  16608. @item model
  16609. Set path to model file specifying network architecture and its parameters.
  16610. Note that different backends use different file formats. TensorFlow backend
  16611. can load files for both formats, while native backend can load files for only
  16612. its format.
  16613. @item scale_factor
  16614. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  16615. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  16616. input upscaled using bicubic upscaling with proper scale factor.
  16617. @end table
  16618. To get full functionality (such as async execution), please use the @ref{dnn_processing} filter.
  16619. @section ssim
  16620. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  16621. This filter takes in input two input videos, the first input is
  16622. considered the "main" source and is passed unchanged to the
  16623. output. The second input is used as a "reference" video for computing
  16624. the SSIM.
  16625. Both video inputs must have the same resolution and pixel format for
  16626. this filter to work correctly. Also it assumes that both inputs
  16627. have the same number of frames, which are compared one by one.
  16628. The filter stores the calculated SSIM of each frame.
  16629. The description of the accepted parameters follows.
  16630. @table @option
  16631. @item stats_file, f
  16632. If specified the filter will use the named file to save the SSIM of
  16633. each individual frame. When filename equals "-" the data is sent to
  16634. standard output.
  16635. @end table
  16636. The file printed if @var{stats_file} is selected, contains a sequence of
  16637. key/value pairs of the form @var{key}:@var{value} for each compared
  16638. couple of frames.
  16639. A description of each shown parameter follows:
  16640. @table @option
  16641. @item n
  16642. sequential number of the input frame, starting from 1
  16643. @item Y, U, V, R, G, B
  16644. SSIM of the compared frames for the component specified by the suffix.
  16645. @item All
  16646. SSIM of the compared frames for the whole frame.
  16647. @item dB
  16648. Same as above but in dB representation.
  16649. @end table
  16650. This filter also supports the @ref{framesync} options.
  16651. @subsection Examples
  16652. @itemize
  16653. @item
  16654. For example:
  16655. @example
  16656. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  16657. [main][ref] ssim="stats_file=stats.log" [out]
  16658. @end example
  16659. On this example the input file being processed is compared with the
  16660. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  16661. is stored in @file{stats.log}.
  16662. @item
  16663. Another example with both psnr and ssim at same time:
  16664. @example
  16665. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  16666. @end example
  16667. @item
  16668. Another example with different containers:
  16669. @example
  16670. 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 -
  16671. @end example
  16672. @end itemize
  16673. @section stereo3d
  16674. Convert between different stereoscopic image formats.
  16675. The filters accept the following options:
  16676. @table @option
  16677. @item in
  16678. Set stereoscopic image format of input.
  16679. Available values for input image formats are:
  16680. @table @samp
  16681. @item sbsl
  16682. side by side parallel (left eye left, right eye right)
  16683. @item sbsr
  16684. side by side crosseye (right eye left, left eye right)
  16685. @item sbs2l
  16686. side by side parallel with half width resolution
  16687. (left eye left, right eye right)
  16688. @item sbs2r
  16689. side by side crosseye with half width resolution
  16690. (right eye left, left eye right)
  16691. @item abl
  16692. @item tbl
  16693. above-below (left eye above, right eye below)
  16694. @item abr
  16695. @item tbr
  16696. above-below (right eye above, left eye below)
  16697. @item ab2l
  16698. @item tb2l
  16699. above-below with half height resolution
  16700. (left eye above, right eye below)
  16701. @item ab2r
  16702. @item tb2r
  16703. above-below with half height resolution
  16704. (right eye above, left eye below)
  16705. @item al
  16706. alternating frames (left eye first, right eye second)
  16707. @item ar
  16708. alternating frames (right eye first, left eye second)
  16709. @item irl
  16710. interleaved rows (left eye has top row, right eye starts on next row)
  16711. @item irr
  16712. interleaved rows (right eye has top row, left eye starts on next row)
  16713. @item icl
  16714. interleaved columns, left eye first
  16715. @item icr
  16716. interleaved columns, right eye first
  16717. Default value is @samp{sbsl}.
  16718. @end table
  16719. @item out
  16720. Set stereoscopic image format of output.
  16721. @table @samp
  16722. @item sbsl
  16723. side by side parallel (left eye left, right eye right)
  16724. @item sbsr
  16725. side by side crosseye (right eye left, left eye right)
  16726. @item sbs2l
  16727. side by side parallel with half width resolution
  16728. (left eye left, right eye right)
  16729. @item sbs2r
  16730. side by side crosseye with half width resolution
  16731. (right eye left, left eye right)
  16732. @item abl
  16733. @item tbl
  16734. above-below (left eye above, right eye below)
  16735. @item abr
  16736. @item tbr
  16737. above-below (right eye above, left eye below)
  16738. @item ab2l
  16739. @item tb2l
  16740. above-below with half height resolution
  16741. (left eye above, right eye below)
  16742. @item ab2r
  16743. @item tb2r
  16744. above-below with half height resolution
  16745. (right eye above, left eye below)
  16746. @item al
  16747. alternating frames (left eye first, right eye second)
  16748. @item ar
  16749. alternating frames (right eye first, left eye second)
  16750. @item irl
  16751. interleaved rows (left eye has top row, right eye starts on next row)
  16752. @item irr
  16753. interleaved rows (right eye has top row, left eye starts on next row)
  16754. @item arbg
  16755. anaglyph red/blue gray
  16756. (red filter on left eye, blue filter on right eye)
  16757. @item argg
  16758. anaglyph red/green gray
  16759. (red filter on left eye, green filter on right eye)
  16760. @item arcg
  16761. anaglyph red/cyan gray
  16762. (red filter on left eye, cyan filter on right eye)
  16763. @item arch
  16764. anaglyph red/cyan half colored
  16765. (red filter on left eye, cyan filter on right eye)
  16766. @item arcc
  16767. anaglyph red/cyan color
  16768. (red filter on left eye, cyan filter on right eye)
  16769. @item arcd
  16770. anaglyph red/cyan color optimized with the least squares projection of dubois
  16771. (red filter on left eye, cyan filter on right eye)
  16772. @item agmg
  16773. anaglyph green/magenta gray
  16774. (green filter on left eye, magenta filter on right eye)
  16775. @item agmh
  16776. anaglyph green/magenta half colored
  16777. (green filter on left eye, magenta filter on right eye)
  16778. @item agmc
  16779. anaglyph green/magenta colored
  16780. (green filter on left eye, magenta filter on right eye)
  16781. @item agmd
  16782. anaglyph green/magenta color optimized with the least squares projection of dubois
  16783. (green filter on left eye, magenta filter on right eye)
  16784. @item aybg
  16785. anaglyph yellow/blue gray
  16786. (yellow filter on left eye, blue filter on right eye)
  16787. @item aybh
  16788. anaglyph yellow/blue half colored
  16789. (yellow filter on left eye, blue filter on right eye)
  16790. @item aybc
  16791. anaglyph yellow/blue colored
  16792. (yellow filter on left eye, blue filter on right eye)
  16793. @item aybd
  16794. anaglyph yellow/blue color optimized with the least squares projection of dubois
  16795. (yellow filter on left eye, blue filter on right eye)
  16796. @item ml
  16797. mono output (left eye only)
  16798. @item mr
  16799. mono output (right eye only)
  16800. @item chl
  16801. checkerboard, left eye first
  16802. @item chr
  16803. checkerboard, right eye first
  16804. @item icl
  16805. interleaved columns, left eye first
  16806. @item icr
  16807. interleaved columns, right eye first
  16808. @item hdmi
  16809. HDMI frame pack
  16810. @end table
  16811. Default value is @samp{arcd}.
  16812. @end table
  16813. @subsection Examples
  16814. @itemize
  16815. @item
  16816. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  16817. @example
  16818. stereo3d=sbsl:aybd
  16819. @end example
  16820. @item
  16821. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  16822. @example
  16823. stereo3d=abl:sbsr
  16824. @end example
  16825. @end itemize
  16826. @section streamselect, astreamselect
  16827. Select video or audio streams.
  16828. The filter accepts the following options:
  16829. @table @option
  16830. @item inputs
  16831. Set number of inputs. Default is 2.
  16832. @item map
  16833. Set input indexes to remap to outputs.
  16834. @end table
  16835. @subsection Commands
  16836. The @code{streamselect} and @code{astreamselect} filter supports the following
  16837. commands:
  16838. @table @option
  16839. @item map
  16840. Set input indexes to remap to outputs.
  16841. @end table
  16842. @subsection Examples
  16843. @itemize
  16844. @item
  16845. Select first 5 seconds 1st stream and rest of time 2nd stream:
  16846. @example
  16847. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  16848. @end example
  16849. @item
  16850. Same as above, but for audio:
  16851. @example
  16852. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  16853. @end example
  16854. @end itemize
  16855. @anchor{subtitles}
  16856. @section subtitles
  16857. Draw subtitles on top of input video using the libass library.
  16858. To enable compilation of this filter you need to configure FFmpeg with
  16859. @code{--enable-libass}. This filter also requires a build with libavcodec and
  16860. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  16861. Alpha) subtitles format.
  16862. The filter accepts the following options:
  16863. @table @option
  16864. @item filename, f
  16865. Set the filename of the subtitle file to read. It must be specified.
  16866. @item original_size
  16867. Specify the size of the original video, the video for which the ASS file
  16868. was composed. For the syntax of this option, check the
  16869. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16870. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  16871. correctly scale the fonts if the aspect ratio has been changed.
  16872. @item fontsdir
  16873. Set a directory path containing fonts that can be used by the filter.
  16874. These fonts will be used in addition to whatever the font provider uses.
  16875. @item alpha
  16876. Process alpha channel, by default alpha channel is untouched.
  16877. @item charenc
  16878. Set subtitles input character encoding. @code{subtitles} filter only. Only
  16879. useful if not UTF-8.
  16880. @item stream_index, si
  16881. Set subtitles stream index. @code{subtitles} filter only.
  16882. @item force_style
  16883. Override default style or script info parameters of the subtitles. It accepts a
  16884. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  16885. @end table
  16886. If the first key is not specified, it is assumed that the first value
  16887. specifies the @option{filename}.
  16888. For example, to render the file @file{sub.srt} on top of the input
  16889. video, use the command:
  16890. @example
  16891. subtitles=sub.srt
  16892. @end example
  16893. which is equivalent to:
  16894. @example
  16895. subtitles=filename=sub.srt
  16896. @end example
  16897. To render the default subtitles stream from file @file{video.mkv}, use:
  16898. @example
  16899. subtitles=video.mkv
  16900. @end example
  16901. To render the second subtitles stream from that file, use:
  16902. @example
  16903. subtitles=video.mkv:si=1
  16904. @end example
  16905. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  16906. @code{DejaVu Serif}, use:
  16907. @example
  16908. subtitles=sub.srt:force_style='Fontname=DejaVu Serif,PrimaryColour=&HCCFF0000'
  16909. @end example
  16910. @section super2xsai
  16911. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  16912. Interpolate) pixel art scaling algorithm.
  16913. Useful for enlarging pixel art images without reducing sharpness.
  16914. @section swaprect
  16915. Swap two rectangular objects in video.
  16916. This filter accepts the following options:
  16917. @table @option
  16918. @item w
  16919. Set object width.
  16920. @item h
  16921. Set object height.
  16922. @item x1
  16923. Set 1st rect x coordinate.
  16924. @item y1
  16925. Set 1st rect y coordinate.
  16926. @item x2
  16927. Set 2nd rect x coordinate.
  16928. @item y2
  16929. Set 2nd rect y coordinate.
  16930. All expressions are evaluated once for each frame.
  16931. @end table
  16932. The all options are expressions containing the following constants:
  16933. @table @option
  16934. @item w
  16935. @item h
  16936. The input width and height.
  16937. @item a
  16938. same as @var{w} / @var{h}
  16939. @item sar
  16940. input sample aspect ratio
  16941. @item dar
  16942. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  16943. @item n
  16944. The number of the input frame, starting from 0.
  16945. @item t
  16946. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  16947. @item pos
  16948. the position in the file of the input frame, NAN if unknown
  16949. @end table
  16950. @subsection Commands
  16951. This filter supports the all above options as @ref{commands}.
  16952. @section swapuv
  16953. Swap U & V plane.
  16954. @section tblend
  16955. Blend successive video frames.
  16956. See @ref{blend}
  16957. @section telecine
  16958. Apply telecine process to the video.
  16959. This filter accepts the following options:
  16960. @table @option
  16961. @item first_field
  16962. @table @samp
  16963. @item top, t
  16964. top field first
  16965. @item bottom, b
  16966. bottom field first
  16967. The default value is @code{top}.
  16968. @end table
  16969. @item pattern
  16970. A string of numbers representing the pulldown pattern you wish to apply.
  16971. The default value is @code{23}.
  16972. @end table
  16973. @example
  16974. Some typical patterns:
  16975. NTSC output (30i):
  16976. 27.5p: 32222
  16977. 24p: 23 (classic)
  16978. 24p: 2332 (preferred)
  16979. 20p: 33
  16980. 18p: 334
  16981. 16p: 3444
  16982. PAL output (25i):
  16983. 27.5p: 12222
  16984. 24p: 222222222223 ("Euro pulldown")
  16985. 16.67p: 33
  16986. 16p: 33333334
  16987. @end example
  16988. @section thistogram
  16989. Compute and draw a color distribution histogram for the input video across time.
  16990. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  16991. at certain time, this filter shows also past histograms of number of frames defined
  16992. by @code{width} option.
  16993. The computed histogram is a representation of the color component
  16994. distribution in an image.
  16995. The filter accepts the following options:
  16996. @table @option
  16997. @item width, w
  16998. Set width of single color component output. Default value is @code{0}.
  16999. Value of @code{0} means width will be picked from input video.
  17000. This also set number of passed histograms to keep.
  17001. Allowed range is [0, 8192].
  17002. @item display_mode, d
  17003. Set display mode.
  17004. It accepts the following values:
  17005. @table @samp
  17006. @item stack
  17007. Per color component graphs are placed below each other.
  17008. @item parade
  17009. Per color component graphs are placed side by side.
  17010. @item overlay
  17011. Presents information identical to that in the @code{parade}, except
  17012. that the graphs representing color components are superimposed directly
  17013. over one another.
  17014. @end table
  17015. Default is @code{stack}.
  17016. @item levels_mode, m
  17017. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  17018. Default is @code{linear}.
  17019. @item components, c
  17020. Set what color components to display.
  17021. Default is @code{7}.
  17022. @item bgopacity, b
  17023. Set background opacity. Default is @code{0.9}.
  17024. @item envelope, e
  17025. Show envelope. Default is disabled.
  17026. @item ecolor, ec
  17027. Set envelope color. Default is @code{gold}.
  17028. @item slide
  17029. Set slide mode.
  17030. Available values for slide is:
  17031. @table @samp
  17032. @item frame
  17033. Draw new frame when right border is reached.
  17034. @item replace
  17035. Replace old columns with new ones.
  17036. @item scroll
  17037. Scroll from right to left.
  17038. @item rscroll
  17039. Scroll from left to right.
  17040. @item picture
  17041. Draw single picture.
  17042. @end table
  17043. Default is @code{replace}.
  17044. @end table
  17045. @section threshold
  17046. Apply threshold effect to video stream.
  17047. This filter needs four video streams to perform thresholding.
  17048. First stream is stream we are filtering.
  17049. Second stream is holding threshold values, third stream is holding min values,
  17050. and last, fourth stream is holding max values.
  17051. The filter accepts the following option:
  17052. @table @option
  17053. @item planes
  17054. Set which planes will be processed, unprocessed planes will be copied.
  17055. By default value 0xf, all planes will be processed.
  17056. @end table
  17057. For example if first stream pixel's component value is less then threshold value
  17058. of pixel component from 2nd threshold stream, third stream value will picked,
  17059. otherwise fourth stream pixel component value will be picked.
  17060. Using color source filter one can perform various types of thresholding:
  17061. @subsection Commands
  17062. This filter supports the all options as @ref{commands}.
  17063. @subsection Examples
  17064. @itemize
  17065. @item
  17066. Binary threshold, using gray color as threshold:
  17067. @example
  17068. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  17069. @end example
  17070. @item
  17071. Inverted binary threshold, using gray color as threshold:
  17072. @example
  17073. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  17074. @end example
  17075. @item
  17076. Truncate binary threshold, using gray color as threshold:
  17077. @example
  17078. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  17079. @end example
  17080. @item
  17081. Threshold to zero, using gray color as threshold:
  17082. @example
  17083. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  17084. @end example
  17085. @item
  17086. Inverted threshold to zero, using gray color as threshold:
  17087. @example
  17088. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  17089. @end example
  17090. @end itemize
  17091. @section thumbnail
  17092. Select the most representative frame in a given sequence of consecutive frames.
  17093. The filter accepts the following options:
  17094. @table @option
  17095. @item n
  17096. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  17097. will pick one of them, and then handle the next batch of @var{n} frames until
  17098. the end. Default is @code{100}.
  17099. @item log
  17100. Set the log level to display picked frame stats.
  17101. Default is @code{info}.
  17102. @end table
  17103. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  17104. value will result in a higher memory usage, so a high value is not recommended.
  17105. @subsection Examples
  17106. @itemize
  17107. @item
  17108. Extract one picture each 50 frames:
  17109. @example
  17110. thumbnail=50
  17111. @end example
  17112. @item
  17113. Complete example of a thumbnail creation with @command{ffmpeg}:
  17114. @example
  17115. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  17116. @end example
  17117. @end itemize
  17118. @anchor{tile}
  17119. @section tile
  17120. Tile several successive frames together.
  17121. The @ref{untile} filter can do the reverse.
  17122. The filter accepts the following options:
  17123. @table @option
  17124. @item layout
  17125. Set the grid size in the form @code{COLUMNSxROWS}. Range is upto UINT_MAX cells.
  17126. Default is @code{6x5}.
  17127. @item nb_frames
  17128. Set the maximum number of frames to render in the given area. It must be less
  17129. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  17130. the area will be used.
  17131. @item margin
  17132. Set the outer border margin in pixels. Range is 0 to 1024. Default is @code{0}.
  17133. @item padding
  17134. Set the inner border thickness (i.e. the number of pixels between frames). For
  17135. more advanced padding options (such as having different values for the edges),
  17136. refer to the pad video filter. Range is 0 to 1024. Default is @code{0}.
  17137. @item color
  17138. Specify the color of the unused area. For the syntax of this option, check the
  17139. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17140. The default value of @var{color} is "black".
  17141. @item overlap
  17142. Set the number of frames to overlap when tiling several successive frames together.
  17143. The value must be between @code{0} and @var{nb_frames - 1}. Default is @code{0}.
  17144. @item init_padding
  17145. Set the number of frames to initially be empty before displaying first output frame.
  17146. This controls how soon will one get first output frame.
  17147. The value must be between @code{0} and @var{nb_frames - 1}. Default is @code{0}.
  17148. @end table
  17149. @subsection Examples
  17150. @itemize
  17151. @item
  17152. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  17153. @example
  17154. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  17155. @end example
  17156. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  17157. duplicating each output frame to accommodate the originally detected frame
  17158. rate.
  17159. @item
  17160. Display @code{5} pictures in an area of @code{3x2} frames,
  17161. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  17162. mixed flat and named options:
  17163. @example
  17164. tile=3x2:nb_frames=5:padding=7:margin=2
  17165. @end example
  17166. @end itemize
  17167. @section tinterlace
  17168. Perform various types of temporal field interlacing.
  17169. Frames are counted starting from 1, so the first input frame is
  17170. considered odd.
  17171. The filter accepts the following options:
  17172. @table @option
  17173. @item mode
  17174. Specify the mode of the interlacing. This option can also be specified
  17175. as a value alone. See below for a list of values for this option.
  17176. Available values are:
  17177. @table @samp
  17178. @item merge, 0
  17179. Move odd frames into the upper field, even into the lower field,
  17180. generating a double height frame at half frame rate.
  17181. @example
  17182. ------> time
  17183. Input:
  17184. Frame 1 Frame 2 Frame 3 Frame 4
  17185. 11111 22222 33333 44444
  17186. 11111 22222 33333 44444
  17187. 11111 22222 33333 44444
  17188. 11111 22222 33333 44444
  17189. Output:
  17190. 11111 33333
  17191. 22222 44444
  17192. 11111 33333
  17193. 22222 44444
  17194. 11111 33333
  17195. 22222 44444
  17196. 11111 33333
  17197. 22222 44444
  17198. @end example
  17199. @item drop_even, 1
  17200. Only output odd frames, even frames are dropped, generating a frame with
  17201. unchanged height at half frame rate.
  17202. @example
  17203. ------> time
  17204. Input:
  17205. Frame 1 Frame 2 Frame 3 Frame 4
  17206. 11111 22222 33333 44444
  17207. 11111 22222 33333 44444
  17208. 11111 22222 33333 44444
  17209. 11111 22222 33333 44444
  17210. Output:
  17211. 11111 33333
  17212. 11111 33333
  17213. 11111 33333
  17214. 11111 33333
  17215. @end example
  17216. @item drop_odd, 2
  17217. Only output even frames, odd frames are dropped, generating a frame with
  17218. unchanged height at half frame rate.
  17219. @example
  17220. ------> time
  17221. Input:
  17222. Frame 1 Frame 2 Frame 3 Frame 4
  17223. 11111 22222 33333 44444
  17224. 11111 22222 33333 44444
  17225. 11111 22222 33333 44444
  17226. 11111 22222 33333 44444
  17227. Output:
  17228. 22222 44444
  17229. 22222 44444
  17230. 22222 44444
  17231. 22222 44444
  17232. @end example
  17233. @item pad, 3
  17234. Expand each frame to full height, but pad alternate lines with black,
  17235. generating a frame with double height at the same input frame rate.
  17236. @example
  17237. ------> time
  17238. Input:
  17239. Frame 1 Frame 2 Frame 3 Frame 4
  17240. 11111 22222 33333 44444
  17241. 11111 22222 33333 44444
  17242. 11111 22222 33333 44444
  17243. 11111 22222 33333 44444
  17244. Output:
  17245. 11111 ..... 33333 .....
  17246. ..... 22222 ..... 44444
  17247. 11111 ..... 33333 .....
  17248. ..... 22222 ..... 44444
  17249. 11111 ..... 33333 .....
  17250. ..... 22222 ..... 44444
  17251. 11111 ..... 33333 .....
  17252. ..... 22222 ..... 44444
  17253. @end example
  17254. @item interleave_top, 4
  17255. Interleave the upper field from odd frames with the lower field from
  17256. even frames, generating a frame with unchanged height at half frame rate.
  17257. @example
  17258. ------> time
  17259. Input:
  17260. Frame 1 Frame 2 Frame 3 Frame 4
  17261. 11111<- 22222 33333<- 44444
  17262. 11111 22222<- 33333 44444<-
  17263. 11111<- 22222 33333<- 44444
  17264. 11111 22222<- 33333 44444<-
  17265. Output:
  17266. 11111 33333
  17267. 22222 44444
  17268. 11111 33333
  17269. 22222 44444
  17270. @end example
  17271. @item interleave_bottom, 5
  17272. Interleave the lower field from odd frames with the upper field from
  17273. even frames, generating a frame with unchanged height at half frame rate.
  17274. @example
  17275. ------> time
  17276. Input:
  17277. Frame 1 Frame 2 Frame 3 Frame 4
  17278. 11111 22222<- 33333 44444<-
  17279. 11111<- 22222 33333<- 44444
  17280. 11111 22222<- 33333 44444<-
  17281. 11111<- 22222 33333<- 44444
  17282. Output:
  17283. 22222 44444
  17284. 11111 33333
  17285. 22222 44444
  17286. 11111 33333
  17287. @end example
  17288. @item interlacex2, 6
  17289. Double frame rate with unchanged height. Frames are inserted each
  17290. containing the second temporal field from the previous input frame and
  17291. the first temporal field from the next input frame. This mode relies on
  17292. the top_field_first flag. Useful for interlaced video displays with no
  17293. field synchronisation.
  17294. @example
  17295. ------> time
  17296. Input:
  17297. Frame 1 Frame 2 Frame 3 Frame 4
  17298. 11111 22222 33333 44444
  17299. 11111 22222 33333 44444
  17300. 11111 22222 33333 44444
  17301. 11111 22222 33333 44444
  17302. Output:
  17303. 11111 22222 22222 33333 33333 44444 44444
  17304. 11111 11111 22222 22222 33333 33333 44444
  17305. 11111 22222 22222 33333 33333 44444 44444
  17306. 11111 11111 22222 22222 33333 33333 44444
  17307. @end example
  17308. @item mergex2, 7
  17309. Move odd frames into the upper field, even into the lower field,
  17310. generating a double height frame at same frame rate.
  17311. @example
  17312. ------> time
  17313. Input:
  17314. Frame 1 Frame 2 Frame 3 Frame 4
  17315. 11111 22222 33333 44444
  17316. 11111 22222 33333 44444
  17317. 11111 22222 33333 44444
  17318. 11111 22222 33333 44444
  17319. Output:
  17320. 11111 33333 33333 55555
  17321. 22222 22222 44444 44444
  17322. 11111 33333 33333 55555
  17323. 22222 22222 44444 44444
  17324. 11111 33333 33333 55555
  17325. 22222 22222 44444 44444
  17326. 11111 33333 33333 55555
  17327. 22222 22222 44444 44444
  17328. @end example
  17329. @end table
  17330. Numeric values are deprecated but are accepted for backward
  17331. compatibility reasons.
  17332. Default mode is @code{merge}.
  17333. @item flags
  17334. Specify flags influencing the filter process.
  17335. Available value for @var{flags} is:
  17336. @table @option
  17337. @item low_pass_filter, vlpf
  17338. Enable linear vertical low-pass filtering in the filter.
  17339. Vertical low-pass filtering is required when creating an interlaced
  17340. destination from a progressive source which contains high-frequency
  17341. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  17342. patterning.
  17343. @item complex_filter, cvlpf
  17344. Enable complex vertical low-pass filtering.
  17345. This will slightly less reduce interlace 'twitter' and Moire
  17346. patterning but better retain detail and subjective sharpness impression.
  17347. @item bypass_il
  17348. Bypass already interlaced frames, only adjust the frame rate.
  17349. @end table
  17350. Vertical low-pass filtering and bypassing already interlaced frames can only be
  17351. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  17352. @end table
  17353. @section tmedian
  17354. Pick median pixels from several successive input video frames.
  17355. The filter accepts the following options:
  17356. @table @option
  17357. @item radius
  17358. Set radius of median filter.
  17359. Default is 1. Allowed range is from 1 to 127.
  17360. @item planes
  17361. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  17362. @item percentile
  17363. Set median percentile. Default value is @code{0.5}.
  17364. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  17365. minimum values, and @code{1} maximum values.
  17366. @end table
  17367. @subsection Commands
  17368. This filter supports all above options as @ref{commands}, excluding option @code{radius}.
  17369. @section tmidequalizer
  17370. Apply Temporal Midway Video Equalization effect.
  17371. Midway Video Equalization adjusts a sequence of video frames to have the same
  17372. histograms, while maintaining their dynamics as much as possible. It's
  17373. useful for e.g. matching exposures from a video frames sequence.
  17374. This filter accepts the following option:
  17375. @table @option
  17376. @item radius
  17377. Set filtering radius. Default is @code{5}. Allowed range is from 1 to 127.
  17378. @item sigma
  17379. Set filtering sigma. Default is @code{0.5}. This controls strength of filtering.
  17380. Setting this option to 0 effectively does nothing.
  17381. @item planes
  17382. Set which planes to process. Default is @code{15}, which is all available planes.
  17383. @end table
  17384. @section tmix
  17385. Mix successive video frames.
  17386. A description of the accepted options follows.
  17387. @table @option
  17388. @item frames
  17389. The number of successive frames to mix. If unspecified, it defaults to 3.
  17390. @item weights
  17391. Specify weight of each input video frame.
  17392. Each weight is separated by space. If number of weights is smaller than
  17393. number of @var{frames} last specified weight will be used for all remaining
  17394. unset weights.
  17395. @item scale
  17396. Specify scale, if it is set it will be multiplied with sum
  17397. of each weight multiplied with pixel values to give final destination
  17398. pixel value. By default @var{scale} is auto scaled to sum of weights.
  17399. @item planes
  17400. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  17401. @end table
  17402. @subsection Examples
  17403. @itemize
  17404. @item
  17405. Average 7 successive frames:
  17406. @example
  17407. tmix=frames=7:weights="1 1 1 1 1 1 1"
  17408. @end example
  17409. @item
  17410. Apply simple temporal convolution:
  17411. @example
  17412. tmix=frames=3:weights="-1 3 -1"
  17413. @end example
  17414. @item
  17415. Similar as above but only showing temporal differences:
  17416. @example
  17417. tmix=frames=3:weights="-1 2 -1":scale=1
  17418. @end example
  17419. @end itemize
  17420. @subsection Commands
  17421. This filter supports the following commands:
  17422. @table @option
  17423. @item weights
  17424. @item scale
  17425. @item planes
  17426. Syntax is same as option with same name.
  17427. @end table
  17428. @anchor{tonemap}
  17429. @section tonemap
  17430. Tone map colors from different dynamic ranges.
  17431. This filter expects data in single precision floating point, as it needs to
  17432. operate on (and can output) out-of-range values. Another filter, such as
  17433. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  17434. The tonemapping algorithms implemented only work on linear light, so input
  17435. data should be linearized beforehand (and possibly correctly tagged).
  17436. @example
  17437. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  17438. @end example
  17439. @subsection Options
  17440. The filter accepts the following options.
  17441. @table @option
  17442. @item tonemap
  17443. Set the tone map algorithm to use.
  17444. Possible values are:
  17445. @table @var
  17446. @item none
  17447. Do not apply any tone map, only desaturate overbright pixels.
  17448. @item clip
  17449. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  17450. in-range values, while distorting out-of-range values.
  17451. @item linear
  17452. Stretch the entire reference gamut to a linear multiple of the display.
  17453. @item gamma
  17454. Fit a logarithmic transfer between the tone curves.
  17455. @item reinhard
  17456. Preserve overall image brightness with a simple curve, using nonlinear
  17457. contrast, which results in flattening details and degrading color accuracy.
  17458. @item hable
  17459. Preserve both dark and bright details better than @var{reinhard}, at the cost
  17460. of slightly darkening everything. Use it when detail preservation is more
  17461. important than color and brightness accuracy.
  17462. @item mobius
  17463. Smoothly map out-of-range values, while retaining contrast and colors for
  17464. in-range material as much as possible. Use it when color accuracy is more
  17465. important than detail preservation.
  17466. @end table
  17467. Default is none.
  17468. @item param
  17469. Tune the tone mapping algorithm.
  17470. This affects the following algorithms:
  17471. @table @var
  17472. @item none
  17473. Ignored.
  17474. @item linear
  17475. Specifies the scale factor to use while stretching.
  17476. Default to 1.0.
  17477. @item gamma
  17478. Specifies the exponent of the function.
  17479. Default to 1.8.
  17480. @item clip
  17481. Specify an extra linear coefficient to multiply into the signal before clipping.
  17482. Default to 1.0.
  17483. @item reinhard
  17484. Specify the local contrast coefficient at the display peak.
  17485. Default to 0.5, which means that in-gamut values will be about half as bright
  17486. as when clipping.
  17487. @item hable
  17488. Ignored.
  17489. @item mobius
  17490. Specify the transition point from linear to mobius transform. Every value
  17491. below this point is guaranteed to be mapped 1:1. The higher the value, the
  17492. more accurate the result will be, at the cost of losing bright details.
  17493. Default to 0.3, which due to the steep initial slope still preserves in-range
  17494. colors fairly accurately.
  17495. @end table
  17496. @item desat
  17497. Apply desaturation for highlights that exceed this level of brightness. The
  17498. higher the parameter, the more color information will be preserved. This
  17499. setting helps prevent unnaturally blown-out colors for super-highlights, by
  17500. (smoothly) turning into white instead. This makes images feel more natural,
  17501. at the cost of reducing information about out-of-range colors.
  17502. The default of 2.0 is somewhat conservative and will mostly just apply to
  17503. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  17504. This option works only if the input frame has a supported color tag.
  17505. @item peak
  17506. Override signal/nominal/reference peak with this value. Useful when the
  17507. embedded peak information in display metadata is not reliable or when tone
  17508. mapping from a lower range to a higher range.
  17509. @end table
  17510. @section tpad
  17511. Temporarily pad video frames.
  17512. The filter accepts the following options:
  17513. @table @option
  17514. @item start
  17515. Specify number of delay frames before input video stream. Default is 0.
  17516. @item stop
  17517. Specify number of padding frames after input video stream.
  17518. Set to -1 to pad indefinitely. Default is 0.
  17519. @item start_mode
  17520. Set kind of frames added to beginning of stream.
  17521. Can be either @var{add} or @var{clone}.
  17522. With @var{add} frames of solid-color are added.
  17523. With @var{clone} frames are clones of first frame.
  17524. Default is @var{add}.
  17525. @item stop_mode
  17526. Set kind of frames added to end of stream.
  17527. Can be either @var{add} or @var{clone}.
  17528. With @var{add} frames of solid-color are added.
  17529. With @var{clone} frames are clones of last frame.
  17530. Default is @var{add}.
  17531. @item start_duration, stop_duration
  17532. Specify the duration of the start/stop delay. See
  17533. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17534. for the accepted syntax.
  17535. These options override @var{start} and @var{stop}. Default is 0.
  17536. @item color
  17537. Specify the color of the padded area. For the syntax of this option,
  17538. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  17539. manual,ffmpeg-utils}.
  17540. The default value of @var{color} is "black".
  17541. @end table
  17542. @anchor{transpose}
  17543. @section transpose
  17544. Transpose rows with columns in the input video and optionally flip it.
  17545. It accepts the following parameters:
  17546. @table @option
  17547. @item dir
  17548. Specify the transposition direction.
  17549. Can assume the following values:
  17550. @table @samp
  17551. @item 0, 4, cclock_flip
  17552. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  17553. @example
  17554. L.R L.l
  17555. . . -> . .
  17556. l.r R.r
  17557. @end example
  17558. @item 1, 5, clock
  17559. Rotate by 90 degrees clockwise, that is:
  17560. @example
  17561. L.R l.L
  17562. . . -> . .
  17563. l.r r.R
  17564. @end example
  17565. @item 2, 6, cclock
  17566. Rotate by 90 degrees counterclockwise, that is:
  17567. @example
  17568. L.R R.r
  17569. . . -> . .
  17570. l.r L.l
  17571. @end example
  17572. @item 3, 7, clock_flip
  17573. Rotate by 90 degrees clockwise and vertically flip, that is:
  17574. @example
  17575. L.R r.R
  17576. . . -> . .
  17577. l.r l.L
  17578. @end example
  17579. @end table
  17580. For values between 4-7, the transposition is only done if the input
  17581. video geometry is portrait and not landscape. These values are
  17582. deprecated, the @code{passthrough} option should be used instead.
  17583. Numerical values are deprecated, and should be dropped in favor of
  17584. symbolic constants.
  17585. @item passthrough
  17586. Do not apply the transposition if the input geometry matches the one
  17587. specified by the specified value. It accepts the following values:
  17588. @table @samp
  17589. @item none
  17590. Always apply transposition.
  17591. @item portrait
  17592. Preserve portrait geometry (when @var{height} >= @var{width}).
  17593. @item landscape
  17594. Preserve landscape geometry (when @var{width} >= @var{height}).
  17595. @end table
  17596. Default value is @code{none}.
  17597. @end table
  17598. For example to rotate by 90 degrees clockwise and preserve portrait
  17599. layout:
  17600. @example
  17601. transpose=dir=1:passthrough=portrait
  17602. @end example
  17603. The command above can also be specified as:
  17604. @example
  17605. transpose=1:portrait
  17606. @end example
  17607. @section transpose_npp
  17608. Transpose rows with columns in the input video and optionally flip it.
  17609. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  17610. It accepts the following parameters:
  17611. @table @option
  17612. @item dir
  17613. Specify the transposition direction.
  17614. Can assume the following values:
  17615. @table @samp
  17616. @item cclock_flip
  17617. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  17618. @item clock
  17619. Rotate by 90 degrees clockwise.
  17620. @item cclock
  17621. Rotate by 90 degrees counterclockwise.
  17622. @item clock_flip
  17623. Rotate by 90 degrees clockwise and vertically flip.
  17624. @end table
  17625. @item passthrough
  17626. Do not apply the transposition if the input geometry matches the one
  17627. specified by the specified value. It accepts the following values:
  17628. @table @samp
  17629. @item none
  17630. Always apply transposition. (default)
  17631. @item portrait
  17632. Preserve portrait geometry (when @var{height} >= @var{width}).
  17633. @item landscape
  17634. Preserve landscape geometry (when @var{width} >= @var{height}).
  17635. @end table
  17636. @end table
  17637. @section trim
  17638. Trim the input so that the output contains one continuous subpart of the input.
  17639. It accepts the following parameters:
  17640. @table @option
  17641. @item start
  17642. Specify the time of the start of the kept section, i.e. the frame with the
  17643. timestamp @var{start} will be the first frame in the output.
  17644. @item end
  17645. Specify the time of the first frame that will be dropped, i.e. the frame
  17646. immediately preceding the one with the timestamp @var{end} will be the last
  17647. frame in the output.
  17648. @item start_pts
  17649. This is the same as @var{start}, except this option sets the start timestamp
  17650. in timebase units instead of seconds.
  17651. @item end_pts
  17652. This is the same as @var{end}, except this option sets the end timestamp
  17653. in timebase units instead of seconds.
  17654. @item duration
  17655. The maximum duration of the output in seconds.
  17656. @item start_frame
  17657. The number of the first frame that should be passed to the output.
  17658. @item end_frame
  17659. The number of the first frame that should be dropped.
  17660. @end table
  17661. @option{start}, @option{end}, and @option{duration} are expressed as time
  17662. duration specifications; see
  17663. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17664. for the accepted syntax.
  17665. Note that the first two sets of the start/end options and the @option{duration}
  17666. option look at the frame timestamp, while the _frame variants simply count the
  17667. frames that pass through the filter. Also note that this filter does not modify
  17668. the timestamps. If you wish for the output timestamps to start at zero, insert a
  17669. setpts filter after the trim filter.
  17670. If multiple start or end options are set, this filter tries to be greedy and
  17671. keep all the frames that match at least one of the specified constraints. To keep
  17672. only the part that matches all the constraints at once, chain multiple trim
  17673. filters.
  17674. The defaults are such that all the input is kept. So it is possible to set e.g.
  17675. just the end values to keep everything before the specified time.
  17676. Examples:
  17677. @itemize
  17678. @item
  17679. Drop everything except the second minute of input:
  17680. @example
  17681. ffmpeg -i INPUT -vf trim=60:120
  17682. @end example
  17683. @item
  17684. Keep only the first second:
  17685. @example
  17686. ffmpeg -i INPUT -vf trim=duration=1
  17687. @end example
  17688. @end itemize
  17689. @section unpremultiply
  17690. Apply alpha unpremultiply effect to input video stream using first plane
  17691. of second stream as alpha.
  17692. Both streams must have same dimensions and same pixel format.
  17693. The filter accepts the following option:
  17694. @table @option
  17695. @item planes
  17696. Set which planes will be processed, unprocessed planes will be copied.
  17697. By default value 0xf, all planes will be processed.
  17698. If the format has 1 or 2 components, then luma is bit 0.
  17699. If the format has 3 or 4 components:
  17700. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  17701. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  17702. If present, the alpha channel is always the last bit.
  17703. @item inplace
  17704. Do not require 2nd input for processing, instead use alpha plane from input stream.
  17705. @end table
  17706. @anchor{unsharp}
  17707. @section unsharp
  17708. Sharpen or blur the input video.
  17709. It accepts the following parameters:
  17710. @table @option
  17711. @item luma_msize_x, lx
  17712. Set the luma matrix horizontal size. It must be an odd integer between
  17713. 3 and 23. The default value is 5.
  17714. @item luma_msize_y, ly
  17715. Set the luma matrix vertical size. It must be an odd integer between 3
  17716. and 23. The default value is 5.
  17717. @item luma_amount, la
  17718. Set the luma effect strength. It must be a floating point number, reasonable
  17719. values lay between -1.5 and 1.5.
  17720. Negative values will blur the input video, while positive values will
  17721. sharpen it, a value of zero will disable the effect.
  17722. Default value is 1.0.
  17723. @item chroma_msize_x, cx
  17724. Set the chroma matrix horizontal size. It must be an odd integer
  17725. between 3 and 23. The default value is 5.
  17726. @item chroma_msize_y, cy
  17727. Set the chroma matrix vertical size. It must be an odd integer
  17728. between 3 and 23. The default value is 5.
  17729. @item chroma_amount, ca
  17730. Set the chroma effect strength. It must be a floating point number, reasonable
  17731. values lay between -1.5 and 1.5.
  17732. Negative values will blur the input video, while positive values will
  17733. sharpen it, a value of zero will disable the effect.
  17734. Default value is 0.0.
  17735. @item alpha_msize_x, ax
  17736. Set the alpha matrix horizontal size. It must be an odd integer
  17737. between 3 and 23. The default value is 5.
  17738. @item alpha_msize_y, ay
  17739. Set the alpha matrix vertical size. It must be an odd integer
  17740. between 3 and 23. The default value is 5.
  17741. @item alpha_amount, aa
  17742. Set the alpha effect strength. It must be a floating point number, reasonable
  17743. values lay between -1.5 and 1.5.
  17744. Negative values will blur the input video, while positive values will
  17745. sharpen it, a value of zero will disable the effect.
  17746. Default value is 0.0.
  17747. @end table
  17748. All parameters are optional and default to the equivalent of the
  17749. string '5:5:1.0:5:5:0.0'.
  17750. @subsection Examples
  17751. @itemize
  17752. @item
  17753. Apply strong luma sharpen effect:
  17754. @example
  17755. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  17756. @end example
  17757. @item
  17758. Apply a strong blur of both luma and chroma parameters:
  17759. @example
  17760. unsharp=7:7:-2:7:7:-2
  17761. @end example
  17762. @end itemize
  17763. @anchor{untile}
  17764. @section untile
  17765. Decompose a video made of tiled images into the individual images.
  17766. The frame rate of the output video is the frame rate of the input video
  17767. multiplied by the number of tiles.
  17768. This filter does the reverse of @ref{tile}.
  17769. The filter accepts the following options:
  17770. @table @option
  17771. @item layout
  17772. Set the grid size (i.e. the number of lines and columns). For the syntax of
  17773. this option, check the
  17774. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17775. @end table
  17776. @subsection Examples
  17777. @itemize
  17778. @item
  17779. Produce a 1-second video from a still image file made of 25 frames stacked
  17780. vertically, like an analogic film reel:
  17781. @example
  17782. ffmpeg -r 1 -i image.jpg -vf untile=1x25 movie.mkv
  17783. @end example
  17784. @end itemize
  17785. @section uspp
  17786. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  17787. the image at several (or - in the case of @option{quality} level @code{8} - all)
  17788. shifts and average the results.
  17789. The way this differs from the behavior of spp is that uspp actually encodes &
  17790. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  17791. DCT similar to MJPEG.
  17792. This filter is only available in ffmpeg version 4.4 or earlier.
  17793. The filter accepts the following options:
  17794. @table @option
  17795. @item quality
  17796. Set quality. This option defines the number of levels for averaging. It accepts
  17797. an integer in the range 0-8. If set to @code{0}, the filter will have no
  17798. effect. A value of @code{8} means the higher quality. For each increment of
  17799. that value the speed drops by a factor of approximately 2. Default value is
  17800. @code{3}.
  17801. @item qp
  17802. Force a constant quantization parameter. If not set, the filter will use the QP
  17803. from the video stream (if available).
  17804. @end table
  17805. @section v360
  17806. Convert 360 videos between various formats.
  17807. The filter accepts the following options:
  17808. @table @option
  17809. @item input
  17810. @item output
  17811. Set format of the input/output video.
  17812. Available formats:
  17813. @table @samp
  17814. @item e
  17815. @item equirect
  17816. Equirectangular projection.
  17817. @item c3x2
  17818. @item c6x1
  17819. @item c1x6
  17820. Cubemap with 3x2/6x1/1x6 layout.
  17821. Format specific options:
  17822. @table @option
  17823. @item in_pad
  17824. @item out_pad
  17825. Set padding proportion for the input/output cubemap. Values in decimals.
  17826. Example values:
  17827. @table @samp
  17828. @item 0
  17829. No padding.
  17830. @item 0.01
  17831. 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)
  17832. @end table
  17833. Default value is @b{@samp{0}}.
  17834. Maximum value is @b{@samp{0.1}}.
  17835. @item fin_pad
  17836. @item fout_pad
  17837. Set fixed padding for the input/output cubemap. Values in pixels.
  17838. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  17839. @item in_forder
  17840. @item out_forder
  17841. Set order of faces for the input/output cubemap. Choose one direction for each position.
  17842. Designation of directions:
  17843. @table @samp
  17844. @item r
  17845. right
  17846. @item l
  17847. left
  17848. @item u
  17849. up
  17850. @item d
  17851. down
  17852. @item f
  17853. forward
  17854. @item b
  17855. back
  17856. @end table
  17857. Default value is @b{@samp{rludfb}}.
  17858. @item in_frot
  17859. @item out_frot
  17860. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  17861. Designation of angles:
  17862. @table @samp
  17863. @item 0
  17864. 0 degrees clockwise
  17865. @item 1
  17866. 90 degrees clockwise
  17867. @item 2
  17868. 180 degrees clockwise
  17869. @item 3
  17870. 270 degrees clockwise
  17871. @end table
  17872. Default value is @b{@samp{000000}}.
  17873. @end table
  17874. @item eac
  17875. Equi-Angular Cubemap.
  17876. @item flat
  17877. @item gnomonic
  17878. @item rectilinear
  17879. Regular video.
  17880. Format specific options:
  17881. @table @option
  17882. @item h_fov
  17883. @item v_fov
  17884. @item d_fov
  17885. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17886. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17887. @item ih_fov
  17888. @item iv_fov
  17889. @item id_fov
  17890. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17891. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17892. @end table
  17893. @item dfisheye
  17894. Dual fisheye.
  17895. Format specific options:
  17896. @table @option
  17897. @item h_fov
  17898. @item v_fov
  17899. @item d_fov
  17900. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17901. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17902. @item ih_fov
  17903. @item iv_fov
  17904. @item id_fov
  17905. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17906. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17907. @end table
  17908. @item barrel
  17909. @item fb
  17910. @item barrelsplit
  17911. Facebook's 360 formats.
  17912. @item sg
  17913. Stereographic format.
  17914. Format specific options:
  17915. @table @option
  17916. @item h_fov
  17917. @item v_fov
  17918. @item d_fov
  17919. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17920. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17921. @item ih_fov
  17922. @item iv_fov
  17923. @item id_fov
  17924. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17925. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17926. @end table
  17927. @item mercator
  17928. Mercator format.
  17929. @item ball
  17930. Ball format, gives significant distortion toward the back.
  17931. @item hammer
  17932. Hammer-Aitoff map projection format.
  17933. @item sinusoidal
  17934. Sinusoidal map projection format.
  17935. @item fisheye
  17936. Fisheye projection.
  17937. Format specific options:
  17938. @table @option
  17939. @item h_fov
  17940. @item v_fov
  17941. @item d_fov
  17942. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17943. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17944. @item ih_fov
  17945. @item iv_fov
  17946. @item id_fov
  17947. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17948. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17949. @end table
  17950. @item pannini
  17951. Pannini projection.
  17952. Format specific options:
  17953. @table @option
  17954. @item h_fov
  17955. Set output pannini parameter.
  17956. @item ih_fov
  17957. Set input pannini parameter.
  17958. @end table
  17959. @item cylindrical
  17960. Cylindrical projection.
  17961. Format specific options:
  17962. @table @option
  17963. @item h_fov
  17964. @item v_fov
  17965. @item d_fov
  17966. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17967. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17968. @item ih_fov
  17969. @item iv_fov
  17970. @item id_fov
  17971. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17972. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17973. @end table
  17974. @item perspective
  17975. Perspective projection. @i{(output only)}
  17976. Format specific options:
  17977. @table @option
  17978. @item v_fov
  17979. Set perspective parameter.
  17980. @end table
  17981. @item tetrahedron
  17982. Tetrahedron projection.
  17983. @item tsp
  17984. Truncated square pyramid projection.
  17985. @item he
  17986. @item hequirect
  17987. Half equirectangular projection.
  17988. @item equisolid
  17989. Equisolid format.
  17990. Format specific options:
  17991. @table @option
  17992. @item h_fov
  17993. @item v_fov
  17994. @item d_fov
  17995. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17996. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17997. @item ih_fov
  17998. @item iv_fov
  17999. @item id_fov
  18000. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18001. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18002. @end table
  18003. @item og
  18004. Orthographic format.
  18005. Format specific options:
  18006. @table @option
  18007. @item h_fov
  18008. @item v_fov
  18009. @item d_fov
  18010. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18011. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18012. @item ih_fov
  18013. @item iv_fov
  18014. @item id_fov
  18015. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18016. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18017. @end table
  18018. @item octahedron
  18019. Octahedron projection.
  18020. @item cylindricalea
  18021. Cylindrical Equal Area projection.
  18022. @end table
  18023. @item interp
  18024. Set interpolation method.@*
  18025. @i{Note: more complex interpolation methods require much more memory to run.}
  18026. Available methods:
  18027. @table @samp
  18028. @item near
  18029. @item nearest
  18030. Nearest neighbour.
  18031. @item line
  18032. @item linear
  18033. Bilinear interpolation.
  18034. @item lagrange9
  18035. Lagrange9 interpolation.
  18036. @item cube
  18037. @item cubic
  18038. Bicubic interpolation.
  18039. @item lanc
  18040. @item lanczos
  18041. Lanczos interpolation.
  18042. @item sp16
  18043. @item spline16
  18044. Spline16 interpolation.
  18045. @item gauss
  18046. @item gaussian
  18047. Gaussian interpolation.
  18048. @item mitchell
  18049. Mitchell interpolation.
  18050. @end table
  18051. Default value is @b{@samp{line}}.
  18052. @item w
  18053. @item h
  18054. Set the output video resolution.
  18055. Default resolution depends on formats.
  18056. @item in_stereo
  18057. @item out_stereo
  18058. Set the input/output stereo format.
  18059. @table @samp
  18060. @item 2d
  18061. 2D mono
  18062. @item sbs
  18063. Side by side
  18064. @item tb
  18065. Top bottom
  18066. @end table
  18067. Default value is @b{@samp{2d}} for input and output format.
  18068. @item yaw
  18069. @item pitch
  18070. @item roll
  18071. Set rotation for the output video. Values in degrees.
  18072. @item rorder
  18073. Set rotation order for the output video. Choose one item for each position.
  18074. @table @samp
  18075. @item y, Y
  18076. yaw
  18077. @item p, P
  18078. pitch
  18079. @item r, R
  18080. roll
  18081. @end table
  18082. Default value is @b{@samp{ypr}}.
  18083. @item h_flip
  18084. @item v_flip
  18085. @item d_flip
  18086. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  18087. @item ih_flip
  18088. @item iv_flip
  18089. Set if input video is flipped horizontally/vertically. Boolean values.
  18090. @item in_trans
  18091. Set if input video is transposed. Boolean value, by default disabled.
  18092. @item out_trans
  18093. Set if output video needs to be transposed. Boolean value, by default disabled.
  18094. @item h_offset
  18095. @item v_offset
  18096. Set output horizontal/vertical off-axis offset. Default is set to 0.
  18097. Allowed range is from -1 to 1.
  18098. @item alpha_mask
  18099. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  18100. @item reset_rot
  18101. Reset rotation of output video. Boolean value, by default disabled.
  18102. @end table
  18103. @subsection Examples
  18104. @itemize
  18105. @item
  18106. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  18107. @example
  18108. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  18109. @end example
  18110. @item
  18111. Extract back view of Equi-Angular Cubemap:
  18112. @example
  18113. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  18114. @end example
  18115. @item
  18116. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  18117. @example
  18118. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  18119. @end example
  18120. @end itemize
  18121. @subsection Commands
  18122. This filter supports subset of above options as @ref{commands}.
  18123. @section vaguedenoiser
  18124. Apply a wavelet based denoiser.
  18125. It transforms each frame from the video input into the wavelet domain,
  18126. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  18127. the obtained coefficients. It does an inverse wavelet transform after.
  18128. Due to wavelet properties, it should give a nice smoothed result, and
  18129. reduced noise, without blurring picture features.
  18130. This filter accepts the following options:
  18131. @table @option
  18132. @item threshold
  18133. The filtering strength. The higher, the more filtered the video will be.
  18134. Hard thresholding can use a higher threshold than soft thresholding
  18135. before the video looks overfiltered. Default value is 2.
  18136. @item method
  18137. The filtering method the filter will use.
  18138. It accepts the following values:
  18139. @table @samp
  18140. @item hard
  18141. All values under the threshold will be zeroed.
  18142. @item soft
  18143. All values under the threshold will be zeroed. All values above will be
  18144. reduced by the threshold.
  18145. @item garrote
  18146. Scales or nullifies coefficients - intermediary between (more) soft and
  18147. (less) hard thresholding.
  18148. @end table
  18149. Default is garrote.
  18150. @item nsteps
  18151. Number of times, the wavelet will decompose the picture. Picture can't
  18152. be decomposed beyond a particular point (typically, 8 for a 640x480
  18153. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  18154. @item percent
  18155. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  18156. @item planes
  18157. A list of the planes to process. By default all planes are processed.
  18158. @item type
  18159. The threshold type the filter will use.
  18160. It accepts the following values:
  18161. @table @samp
  18162. @item universal
  18163. Threshold used is same for all decompositions.
  18164. @item bayes
  18165. Threshold used depends also on each decomposition coefficients.
  18166. @end table
  18167. Default is universal.
  18168. @end table
  18169. @section varblur
  18170. Apply variable blur filter by using 2nd video stream to set blur radius.
  18171. The 2nd stream must have the same dimensions.
  18172. This filter accepts the following options:
  18173. @table @option
  18174. @item min_r
  18175. Set min allowed radius. Allowed range is from 0 to 254. Default is 0.
  18176. @item max_r
  18177. Set max allowed radius. Allowed range is from 1 to 255. Default is 8.
  18178. @item planes
  18179. Set which planes to process. By default, all are used.
  18180. @end table
  18181. The @code{varblur} filter also supports the @ref{framesync} options.
  18182. @subsection Commands
  18183. This filter supports all the above options as @ref{commands}.
  18184. @section vectorscope
  18185. Display 2 color component values in the two dimensional graph (which is called
  18186. a vectorscope).
  18187. This filter accepts the following options:
  18188. @table @option
  18189. @item mode, m
  18190. Set vectorscope mode.
  18191. It accepts the following values:
  18192. @table @samp
  18193. @item gray
  18194. @item tint
  18195. Gray values are displayed on graph, higher brightness means more pixels have
  18196. same component color value on location in graph. This is the default mode.
  18197. @item color
  18198. Gray values are displayed on graph. Surrounding pixels values which are not
  18199. present in video frame are drawn in gradient of 2 color components which are
  18200. set by option @code{x} and @code{y}. The 3rd color component is static.
  18201. @item color2
  18202. Actual color components values present in video frame are displayed on graph.
  18203. @item color3
  18204. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  18205. on graph increases value of another color component, which is luminance by
  18206. default values of @code{x} and @code{y}.
  18207. @item color4
  18208. Actual colors present in video frame are displayed on graph. If two different
  18209. colors map to same position on graph then color with higher value of component
  18210. not present in graph is picked.
  18211. @item color5
  18212. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  18213. component picked from radial gradient.
  18214. @end table
  18215. @item x
  18216. Set which color component will be represented on X-axis. Default is @code{1}.
  18217. @item y
  18218. Set which color component will be represented on Y-axis. Default is @code{2}.
  18219. @item intensity, i
  18220. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  18221. of color component which represents frequency of (X, Y) location in graph.
  18222. @item envelope, e
  18223. @table @samp
  18224. @item none
  18225. No envelope, this is default.
  18226. @item instant
  18227. Instant envelope, even darkest single pixel will be clearly highlighted.
  18228. @item peak
  18229. Hold maximum and minimum values presented in graph over time. This way you
  18230. can still spot out of range values without constantly looking at vectorscope.
  18231. @item peak+instant
  18232. Peak and instant envelope combined together.
  18233. @end table
  18234. @item graticule, g
  18235. Set what kind of graticule to draw.
  18236. @table @samp
  18237. @item none
  18238. @item green
  18239. @item color
  18240. @item invert
  18241. @end table
  18242. @item opacity, o
  18243. Set graticule opacity.
  18244. @item flags, f
  18245. Set graticule flags.
  18246. @table @samp
  18247. @item white
  18248. Draw graticule for white point.
  18249. @item black
  18250. Draw graticule for black point.
  18251. @item name
  18252. Draw color points short names.
  18253. @end table
  18254. @item bgopacity, b
  18255. Set background opacity.
  18256. @item lthreshold, l
  18257. Set low threshold for color component not represented on X or Y axis.
  18258. Values lower than this value will be ignored. Default is 0.
  18259. Note this value is multiplied with actual max possible value one pixel component
  18260. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  18261. is 0.1 * 255 = 25.
  18262. @item hthreshold, h
  18263. Set high threshold for color component not represented on X or Y axis.
  18264. Values higher than this value will be ignored. Default is 1.
  18265. Note this value is multiplied with actual max possible value one pixel component
  18266. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  18267. is 0.9 * 255 = 230.
  18268. @item colorspace, c
  18269. Set what kind of colorspace to use when drawing graticule.
  18270. @table @samp
  18271. @item auto
  18272. @item 601
  18273. @item 709
  18274. @end table
  18275. Default is auto.
  18276. @item tint0, t0
  18277. @item tint1, t1
  18278. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  18279. This means no tint, and output will remain gray.
  18280. @end table
  18281. @anchor{vidstabdetect}
  18282. @section vidstabdetect
  18283. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  18284. @ref{vidstabtransform} for pass 2.
  18285. This filter generates a file with relative translation and rotation
  18286. transform information about subsequent frames, which is then used by
  18287. the @ref{vidstabtransform} filter.
  18288. To enable compilation of this filter you need to configure FFmpeg with
  18289. @code{--enable-libvidstab}.
  18290. This filter accepts the following options:
  18291. @table @option
  18292. @item result
  18293. Set the path to the file used to write the transforms information.
  18294. Default value is @file{transforms.trf}.
  18295. @item shakiness
  18296. Set how shaky the video is and how quick the camera is. It accepts an
  18297. integer in the range 1-10, a value of 1 means little shakiness, a
  18298. value of 10 means strong shakiness. Default value is 5.
  18299. @item accuracy
  18300. Set the accuracy of the detection process. It must be a value in the
  18301. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  18302. accuracy. Default value is 15.
  18303. @item stepsize
  18304. Set stepsize of the search process. The region around minimum is
  18305. scanned with 1 pixel resolution. Default value is 6.
  18306. @item mincontrast
  18307. Set minimum contrast. Below this value a local measurement field is
  18308. discarded. Must be a floating point value in the range 0-1. Default
  18309. value is 0.3.
  18310. @item tripod
  18311. Set reference frame number for tripod mode.
  18312. If enabled, the motion of the frames is compared to a reference frame
  18313. in the filtered stream, identified by the specified number. The idea
  18314. is to compensate all movements in a more-or-less static scene and keep
  18315. the camera view absolutely still.
  18316. If set to 0, it is disabled. The frames are counted starting from 1.
  18317. @item show
  18318. Show fields and transforms in the resulting frames. It accepts an
  18319. integer in the range 0-2. Default value is 0, which disables any
  18320. visualization.
  18321. @end table
  18322. @subsection Examples
  18323. @itemize
  18324. @item
  18325. Use default values:
  18326. @example
  18327. vidstabdetect
  18328. @end example
  18329. @item
  18330. Analyze strongly shaky movie and put the results in file
  18331. @file{mytransforms.trf}:
  18332. @example
  18333. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  18334. @end example
  18335. @item
  18336. Visualize the result of internal transformations in the resulting
  18337. video:
  18338. @example
  18339. vidstabdetect=show=1
  18340. @end example
  18341. @item
  18342. Analyze a video with medium shakiness using @command{ffmpeg}:
  18343. @example
  18344. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  18345. @end example
  18346. @end itemize
  18347. @anchor{vidstabtransform}
  18348. @section vidstabtransform
  18349. Video stabilization/deshaking: pass 2 of 2,
  18350. see @ref{vidstabdetect} for pass 1.
  18351. Read a file with transform information for each frame and
  18352. apply/compensate them. Together with the @ref{vidstabdetect}
  18353. filter this can be used to deshake videos. See also
  18354. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  18355. the @ref{unsharp} filter, see below.
  18356. To enable compilation of this filter you need to configure FFmpeg with
  18357. @code{--enable-libvidstab}.
  18358. @subsection Options
  18359. @table @option
  18360. @item input
  18361. Set path to the file used to read the transforms. Default value is
  18362. @file{transforms.trf}.
  18363. @item smoothing
  18364. Set the number of frames (value*2 + 1) used for lowpass filtering the
  18365. camera movements. Default value is 10.
  18366. For example a number of 10 means that 21 frames are used (10 in the
  18367. past and 10 in the future) to smoothen the motion in the video. A
  18368. larger value leads to a smoother video, but limits the acceleration of
  18369. the camera (pan/tilt movements). 0 is a special case where a static
  18370. camera is simulated.
  18371. @item optalgo
  18372. Set the camera path optimization algorithm.
  18373. Accepted values are:
  18374. @table @samp
  18375. @item gauss
  18376. gaussian kernel low-pass filter on camera motion (default)
  18377. @item avg
  18378. averaging on transformations
  18379. @end table
  18380. @item maxshift
  18381. Set maximal number of pixels to translate frames. Default value is -1,
  18382. meaning no limit.
  18383. @item maxangle
  18384. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  18385. value is -1, meaning no limit.
  18386. @item crop
  18387. Specify how to deal with borders that may be visible due to movement
  18388. compensation.
  18389. Available values are:
  18390. @table @samp
  18391. @item keep
  18392. keep image information from previous frame (default)
  18393. @item black
  18394. fill the border black
  18395. @end table
  18396. @item invert
  18397. Invert transforms if set to 1. Default value is 0.
  18398. @item relative
  18399. Consider transforms as relative to previous frame if set to 1,
  18400. absolute if set to 0. Default value is 0.
  18401. @item zoom
  18402. Set percentage to zoom. A positive value will result in a zoom-in
  18403. effect, a negative value in a zoom-out effect. Default value is 0 (no
  18404. zoom).
  18405. @item optzoom
  18406. Set optimal zooming to avoid borders.
  18407. Accepted values are:
  18408. @table @samp
  18409. @item 0
  18410. disabled
  18411. @item 1
  18412. optimal static zoom value is determined (only very strong movements
  18413. will lead to visible borders) (default)
  18414. @item 2
  18415. optimal adaptive zoom value is determined (no borders will be
  18416. visible), see @option{zoomspeed}
  18417. @end table
  18418. Note that the value given at zoom is added to the one calculated here.
  18419. @item zoomspeed
  18420. Set percent to zoom maximally each frame (enabled when
  18421. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  18422. 0.25.
  18423. @item interpol
  18424. Specify type of interpolation.
  18425. Available values are:
  18426. @table @samp
  18427. @item no
  18428. no interpolation
  18429. @item linear
  18430. linear only horizontal
  18431. @item bilinear
  18432. linear in both directions (default)
  18433. @item bicubic
  18434. cubic in both directions (slow)
  18435. @end table
  18436. @item tripod
  18437. Enable virtual tripod mode if set to 1, which is equivalent to
  18438. @code{relative=0:smoothing=0}. Default value is 0.
  18439. Use also @code{tripod} option of @ref{vidstabdetect}.
  18440. @item debug
  18441. Increase log verbosity if set to 1. Also the detected global motions
  18442. are written to the temporary file @file{global_motions.trf}. Default
  18443. value is 0.
  18444. @end table
  18445. @subsection Examples
  18446. @itemize
  18447. @item
  18448. Use @command{ffmpeg} for a typical stabilization with default values:
  18449. @example
  18450. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  18451. @end example
  18452. Note the use of the @ref{unsharp} filter which is always recommended.
  18453. @item
  18454. Zoom in a bit more and load transform data from a given file:
  18455. @example
  18456. vidstabtransform=zoom=5:input="mytransforms.trf"
  18457. @end example
  18458. @item
  18459. Smoothen the video even more:
  18460. @example
  18461. vidstabtransform=smoothing=30
  18462. @end example
  18463. @end itemize
  18464. @section vflip
  18465. Flip the input video vertically.
  18466. For example, to vertically flip a video with @command{ffmpeg}:
  18467. @example
  18468. ffmpeg -i in.avi -vf "vflip" out.avi
  18469. @end example
  18470. @section vfrdet
  18471. Detect variable frame rate video.
  18472. This filter tries to detect if the input is variable or constant frame rate.
  18473. At end it will output number of frames detected as having variable delta pts,
  18474. and ones with constant delta pts.
  18475. If there was frames with variable delta, than it will also show min, max and
  18476. average delta encountered.
  18477. @section vibrance
  18478. Boost or alter saturation.
  18479. The filter accepts the following options:
  18480. @table @option
  18481. @item intensity
  18482. Set strength of boost if positive value or strength of alter if negative value.
  18483. Default is 0. Allowed range is from -2 to 2.
  18484. @item rbal
  18485. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  18486. @item gbal
  18487. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  18488. @item bbal
  18489. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  18490. @item rlum
  18491. Set the red luma coefficient.
  18492. @item glum
  18493. Set the green luma coefficient.
  18494. @item blum
  18495. Set the blue luma coefficient.
  18496. @item alternate
  18497. If @code{intensity} is negative and this is set to 1, colors will change,
  18498. otherwise colors will be less saturated, more towards gray.
  18499. @end table
  18500. @subsection Commands
  18501. This filter supports the all above options as @ref{commands}.
  18502. @section vif
  18503. Obtain the average VIF (Visual Information Fidelity) between two input videos.
  18504. This filter takes two input videos.
  18505. Both input videos must have the same resolution and pixel format for
  18506. this filter to work correctly. Also it assumes that both inputs
  18507. have the same number of frames, which are compared one by one.
  18508. The obtained average VIF score is printed through the logging system.
  18509. The filter stores the calculated VIF score of each frame.
  18510. This filter also supports the @ref{framesync} options.
  18511. In the below example the input file @file{main.mpg} being processed is compared
  18512. with the reference file @file{ref.mpg}.
  18513. @example
  18514. ffmpeg -i main.mpg -i ref.mpg -lavfi vif -f null -
  18515. @end example
  18516. @anchor{vignette}
  18517. @section vignette
  18518. Make or reverse a natural vignetting effect.
  18519. The filter accepts the following options:
  18520. @table @option
  18521. @item angle, a
  18522. Set lens angle expression as a number of radians.
  18523. The value is clipped in the @code{[0,PI/2]} range.
  18524. Default value: @code{"PI/5"}
  18525. @item x0
  18526. @item y0
  18527. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  18528. by default.
  18529. @item mode
  18530. Set forward/backward mode.
  18531. Available modes are:
  18532. @table @samp
  18533. @item forward
  18534. The larger the distance from the central point, the darker the image becomes.
  18535. @item backward
  18536. The larger the distance from the central point, the brighter the image becomes.
  18537. This can be used to reverse a vignette effect, though there is no automatic
  18538. detection to extract the lens @option{angle} and other settings (yet). It can
  18539. also be used to create a burning effect.
  18540. @end table
  18541. Default value is @samp{forward}.
  18542. @item eval
  18543. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  18544. It accepts the following values:
  18545. @table @samp
  18546. @item init
  18547. Evaluate expressions only once during the filter initialization.
  18548. @item frame
  18549. Evaluate expressions for each incoming frame. This is way slower than the
  18550. @samp{init} mode since it requires all the scalers to be re-computed, but it
  18551. allows advanced dynamic expressions.
  18552. @end table
  18553. Default value is @samp{init}.
  18554. @item dither
  18555. Set dithering to reduce the circular banding effects. Default is @code{1}
  18556. (enabled).
  18557. @item aspect
  18558. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  18559. Setting this value to the SAR of the input will make a rectangular vignetting
  18560. following the dimensions of the video.
  18561. Default is @code{1/1}.
  18562. @end table
  18563. @subsection Expressions
  18564. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  18565. following parameters.
  18566. @table @option
  18567. @item w
  18568. @item h
  18569. input width and height
  18570. @item n
  18571. the number of input frame, starting from 0
  18572. @item pts
  18573. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  18574. @var{TB} units, NAN if undefined
  18575. @item r
  18576. frame rate of the input video, NAN if the input frame rate is unknown
  18577. @item t
  18578. the PTS (Presentation TimeStamp) of the filtered video frame,
  18579. expressed in seconds, NAN if undefined
  18580. @item tb
  18581. time base of the input video
  18582. @end table
  18583. @subsection Examples
  18584. @itemize
  18585. @item
  18586. Apply simple strong vignetting effect:
  18587. @example
  18588. vignette=PI/4
  18589. @end example
  18590. @item
  18591. Make a flickering vignetting:
  18592. @example
  18593. vignette='PI/4+random(1)*PI/50':eval=frame
  18594. @end example
  18595. @end itemize
  18596. @section vmafmotion
  18597. Obtain the average VMAF motion score of a video.
  18598. It is one of the component metrics of VMAF.
  18599. The obtained average motion score is printed through the logging system.
  18600. The filter accepts the following options:
  18601. @table @option
  18602. @item stats_file
  18603. If specified, the filter will use the named file to save the motion score of
  18604. each frame with respect to the previous frame.
  18605. When filename equals "-" the data is sent to standard output.
  18606. @end table
  18607. Example:
  18608. @example
  18609. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  18610. @end example
  18611. @anchor{vstack}
  18612. @section vstack
  18613. Stack input videos vertically.
  18614. All streams must be of same pixel format and of same width.
  18615. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  18616. to create same output.
  18617. The filter accepts the following options:
  18618. @table @option
  18619. @item inputs
  18620. Set number of input streams. Default is 2.
  18621. @item shortest
  18622. If set to 1, force the output to terminate when the shortest input
  18623. terminates. Default value is 0.
  18624. @end table
  18625. @section w3fdif
  18626. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  18627. Deinterlacing Filter").
  18628. Based on the process described by Martin Weston for BBC R&D, and
  18629. implemented based on the de-interlace algorithm written by Jim
  18630. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  18631. uses filter coefficients calculated by BBC R&D.
  18632. This filter uses field-dominance information in frame to decide which
  18633. of each pair of fields to place first in the output.
  18634. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  18635. There are two sets of filter coefficients, so called "simple"
  18636. and "complex". Which set of filter coefficients is used can
  18637. be set by passing an optional parameter:
  18638. @table @option
  18639. @item filter
  18640. Set the interlacing filter coefficients. Accepts one of the following values:
  18641. @table @samp
  18642. @item simple
  18643. Simple filter coefficient set.
  18644. @item complex
  18645. More-complex filter coefficient set.
  18646. @end table
  18647. Default value is @samp{complex}.
  18648. @item mode
  18649. The interlacing mode to adopt. It accepts one of the following values:
  18650. @table @option
  18651. @item frame
  18652. Output one frame for each frame.
  18653. @item field
  18654. Output one frame for each field.
  18655. @end table
  18656. The default value is @code{field}.
  18657. @item parity
  18658. The picture field parity assumed for the input interlaced video. It accepts one
  18659. of the following values:
  18660. @table @option
  18661. @item tff
  18662. Assume the top field is first.
  18663. @item bff
  18664. Assume the bottom field is first.
  18665. @item auto
  18666. Enable automatic detection of field parity.
  18667. @end table
  18668. The default value is @code{auto}.
  18669. If the interlacing is unknown or the decoder does not export this information,
  18670. top field first will be assumed.
  18671. @item deint
  18672. Specify which frames to deinterlace. Accepts one of the following values:
  18673. @table @samp
  18674. @item all
  18675. Deinterlace all frames,
  18676. @item interlaced
  18677. Only deinterlace frames marked as interlaced.
  18678. @end table
  18679. Default value is @samp{all}.
  18680. @end table
  18681. @subsection Commands
  18682. This filter supports same @ref{commands} as options.
  18683. @section waveform
  18684. Video waveform monitor.
  18685. The waveform monitor plots color component intensity. By default luminance
  18686. only. Each column of the waveform corresponds to a column of pixels in the
  18687. source video.
  18688. It accepts the following options:
  18689. @table @option
  18690. @item mode, m
  18691. Can be either @code{row}, or @code{column}. Default is @code{column}.
  18692. In row mode, the graph on the left side represents color component value 0 and
  18693. the right side represents value = 255. In column mode, the top side represents
  18694. color component value = 0 and bottom side represents value = 255.
  18695. @item intensity, i
  18696. Set intensity. Smaller values are useful to find out how many values of the same
  18697. luminance are distributed across input rows/columns.
  18698. Default value is @code{0.04}. Allowed range is [0, 1].
  18699. @item mirror, r
  18700. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  18701. In mirrored mode, higher values will be represented on the left
  18702. side for @code{row} mode and at the top for @code{column} mode. Default is
  18703. @code{1} (mirrored).
  18704. @item display, d
  18705. Set display mode.
  18706. It accepts the following values:
  18707. @table @samp
  18708. @item overlay
  18709. Presents information identical to that in the @code{parade}, except
  18710. that the graphs representing color components are superimposed directly
  18711. over one another.
  18712. This display mode makes it easier to spot relative differences or similarities
  18713. in overlapping areas of the color components that are supposed to be identical,
  18714. such as neutral whites, grays, or blacks.
  18715. @item stack
  18716. Display separate graph for the color components side by side in
  18717. @code{row} mode or one below the other in @code{column} mode.
  18718. @item parade
  18719. Display separate graph for the color components side by side in
  18720. @code{column} mode or one below the other in @code{row} mode.
  18721. Using this display mode makes it easy to spot color casts in the highlights
  18722. and shadows of an image, by comparing the contours of the top and the bottom
  18723. graphs of each waveform. Since whites, grays, and blacks are characterized
  18724. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  18725. should display three waveforms of roughly equal width/height. If not, the
  18726. correction is easy to perform by making level adjustments the three waveforms.
  18727. @end table
  18728. Default is @code{stack}.
  18729. @item components, c
  18730. Set which color components to display. Default is 1, which means only luminance
  18731. or red color component if input is in RGB colorspace. If is set for example to
  18732. 7 it will display all 3 (if) available color components.
  18733. @item envelope, e
  18734. @table @samp
  18735. @item none
  18736. No envelope, this is default.
  18737. @item instant
  18738. Instant envelope, minimum and maximum values presented in graph will be easily
  18739. visible even with small @code{step} value.
  18740. @item peak
  18741. Hold minimum and maximum values presented in graph across time. This way you
  18742. can still spot out of range values without constantly looking at waveforms.
  18743. @item peak+instant
  18744. Peak and instant envelope combined together.
  18745. @end table
  18746. @item filter, f
  18747. @table @samp
  18748. @item lowpass
  18749. No filtering, this is default.
  18750. @item flat
  18751. Luma and chroma combined together.
  18752. @item aflat
  18753. Similar as above, but shows difference between blue and red chroma.
  18754. @item xflat
  18755. Similar as above, but use different colors.
  18756. @item yflat
  18757. Similar as above, but again with different colors.
  18758. @item chroma
  18759. Displays only chroma.
  18760. @item color
  18761. Displays actual color value on waveform.
  18762. @item acolor
  18763. Similar as above, but with luma showing frequency of chroma values.
  18764. @end table
  18765. @item graticule, g
  18766. Set which graticule to display.
  18767. @table @samp
  18768. @item none
  18769. Do not display graticule.
  18770. @item green
  18771. Display green graticule showing legal broadcast ranges.
  18772. @item orange
  18773. Display orange graticule showing legal broadcast ranges.
  18774. @item invert
  18775. Display invert graticule showing legal broadcast ranges.
  18776. @end table
  18777. @item opacity, o
  18778. Set graticule opacity.
  18779. @item flags, fl
  18780. Set graticule flags.
  18781. @table @samp
  18782. @item numbers
  18783. Draw numbers above lines. By default enabled.
  18784. @item dots
  18785. Draw dots instead of lines.
  18786. @end table
  18787. @item scale, s
  18788. Set scale used for displaying graticule.
  18789. @table @samp
  18790. @item digital
  18791. @item millivolts
  18792. @item ire
  18793. @end table
  18794. Default is digital.
  18795. @item bgopacity, b
  18796. Set background opacity.
  18797. @item tint0, t0
  18798. @item tint1, t1
  18799. Set tint for output.
  18800. Only used with lowpass filter and when display is not overlay and input
  18801. pixel formats are not RGB.
  18802. @item fitmode, fm
  18803. Set sample aspect ratio of video output frames.
  18804. Can be used to configure waveform so it is not
  18805. streched too much in one of directions.
  18806. @table @samp
  18807. @item none
  18808. Set sample aspect ration to 1/1.
  18809. @item size
  18810. Set sample aspect ratio to match input size of video
  18811. @end table
  18812. Default is @samp{none}.
  18813. @end table
  18814. @section weave, doubleweave
  18815. The @code{weave} takes a field-based video input and join
  18816. each two sequential fields into single frame, producing a new double
  18817. height clip with half the frame rate and half the frame count.
  18818. The @code{doubleweave} works same as @code{weave} but without
  18819. halving frame rate and frame count.
  18820. It accepts the following option:
  18821. @table @option
  18822. @item first_field
  18823. Set first field. Available values are:
  18824. @table @samp
  18825. @item top, t
  18826. Set the frame as top-field-first.
  18827. @item bottom, b
  18828. Set the frame as bottom-field-first.
  18829. @end table
  18830. @end table
  18831. @subsection Examples
  18832. @itemize
  18833. @item
  18834. Interlace video using @ref{select} and @ref{separatefields} filter:
  18835. @example
  18836. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  18837. @end example
  18838. @end itemize
  18839. @section xbr
  18840. Apply the xBR high-quality magnification filter which is designed for pixel
  18841. art. It follows a set of edge-detection rules, see
  18842. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  18843. It accepts the following option:
  18844. @table @option
  18845. @item n
  18846. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  18847. @code{3xBR} and @code{4} for @code{4xBR}.
  18848. Default is @code{3}.
  18849. @end table
  18850. @section xcorrelate
  18851. Apply normalized cross-correlation between first and second input video stream.
  18852. Second input video stream dimensions must be lower than first input video stream.
  18853. The filter accepts the following options:
  18854. @table @option
  18855. @item planes
  18856. Set which planes to process.
  18857. @item secondary
  18858. Set which secondary video frames will be processed from second input video stream,
  18859. can be @var{first} or @var{all}. Default is @var{all}.
  18860. @end table
  18861. The @code{xcorrelate} filter also supports the @ref{framesync} options.
  18862. @section xfade
  18863. Apply cross fade from one input video stream to another input video stream.
  18864. The cross fade is applied for specified duration.
  18865. Both inputs must be constant frame-rate and have the same resolution, pixel format,
  18866. frame rate and timebase.
  18867. The filter accepts the following options:
  18868. @table @option
  18869. @item transition
  18870. Set one of available transition effects:
  18871. @table @samp
  18872. @item custom
  18873. @item fade
  18874. @item wipeleft
  18875. @item wiperight
  18876. @item wipeup
  18877. @item wipedown
  18878. @item slideleft
  18879. @item slideright
  18880. @item slideup
  18881. @item slidedown
  18882. @item circlecrop
  18883. @item rectcrop
  18884. @item distance
  18885. @item fadeblack
  18886. @item fadewhite
  18887. @item radial
  18888. @item smoothleft
  18889. @item smoothright
  18890. @item smoothup
  18891. @item smoothdown
  18892. @item circleopen
  18893. @item circleclose
  18894. @item vertopen
  18895. @item vertclose
  18896. @item horzopen
  18897. @item horzclose
  18898. @item dissolve
  18899. @item pixelize
  18900. @item diagtl
  18901. @item diagtr
  18902. @item diagbl
  18903. @item diagbr
  18904. @item hlslice
  18905. @item hrslice
  18906. @item vuslice
  18907. @item vdslice
  18908. @item hblur
  18909. @item fadegrays
  18910. @item wipetl
  18911. @item wipetr
  18912. @item wipebl
  18913. @item wipebr
  18914. @item squeezeh
  18915. @item squeezev
  18916. @item zoomin
  18917. @item fadefast
  18918. @item fadeslow
  18919. @end table
  18920. Default transition effect is fade.
  18921. @item duration
  18922. Set cross fade duration in seconds.
  18923. Range is 0 to 60 seconds.
  18924. Default duration is 1 second.
  18925. @item offset
  18926. Set cross fade start relative to first input stream in seconds.
  18927. Default offset is 0.
  18928. @item expr
  18929. Set expression for custom transition effect.
  18930. The expressions can use the following variables and functions:
  18931. @table @option
  18932. @item X
  18933. @item Y
  18934. The coordinates of the current sample.
  18935. @item W
  18936. @item H
  18937. The width and height of the image.
  18938. @item P
  18939. Progress of transition effect.
  18940. @item PLANE
  18941. Currently processed plane.
  18942. @item A
  18943. Return value of first input at current location and plane.
  18944. @item B
  18945. Return value of second input at current location and plane.
  18946. @item a0(x, y)
  18947. @item a1(x, y)
  18948. @item a2(x, y)
  18949. @item a3(x, y)
  18950. Return the value of the pixel at location (@var{x},@var{y}) of the
  18951. first/second/third/fourth component of first input.
  18952. @item b0(x, y)
  18953. @item b1(x, y)
  18954. @item b2(x, y)
  18955. @item b3(x, y)
  18956. Return the value of the pixel at location (@var{x},@var{y}) of the
  18957. first/second/third/fourth component of second input.
  18958. @end table
  18959. @end table
  18960. @subsection Examples
  18961. @itemize
  18962. @item
  18963. Cross fade from one input video to another input video, with fade transition and duration of transition
  18964. of 2 seconds starting at offset of 5 seconds:
  18965. @example
  18966. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  18967. @end example
  18968. @end itemize
  18969. @section xmedian
  18970. Pick median pixels from several input videos.
  18971. The filter accepts the following options:
  18972. @table @option
  18973. @item inputs
  18974. Set number of inputs.
  18975. Default is 3. Allowed range is from 3 to 255.
  18976. If number of inputs is even number, than result will be mean value between two median values.
  18977. @item planes
  18978. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  18979. @item percentile
  18980. Set median percentile. Default value is @code{0.5}.
  18981. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  18982. minimum values, and @code{1} maximum values.
  18983. @end table
  18984. @subsection Commands
  18985. This filter supports all above options as @ref{commands}, excluding option @code{inputs}.
  18986. @anchor{xstack}
  18987. @section xstack
  18988. Stack video inputs into custom layout.
  18989. All streams must be of same pixel format.
  18990. The filter accepts the following options:
  18991. @table @option
  18992. @item inputs
  18993. Set number of input streams. Default is 2.
  18994. @item layout
  18995. Specify layout of inputs.
  18996. This option requires the desired layout configuration to be explicitly set by the user.
  18997. This sets position of each video input in output. Each input
  18998. is separated by '|'.
  18999. The first number represents the column, and the second number represents the row.
  19000. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  19001. where X is video input from which to take width or height.
  19002. Multiple values can be used when separated by '+'. In such
  19003. case values are summed together.
  19004. Note that if inputs are of different sizes gaps may appear, as not all of
  19005. the output video frame will be filled. Similarly, videos can overlap each
  19006. other if their position doesn't leave enough space for the full frame of
  19007. adjoining videos.
  19008. For 2 inputs, a default layout of @code{0_0|w0_0} (equivalent to
  19009. @code{grid=2x1}) is set. In all other cases, a layout or a grid must be set by
  19010. the user. Either @code{grid} or @code{layout} can be specified at a time.
  19011. Specifying both will result in an error.
  19012. @item grid
  19013. Specify a fixed size grid of inputs.
  19014. This option is used to create a fixed size grid of the input streams. Set the
  19015. grid size in the form @code{COLUMNSxROWS}. There must be @code{ROWS * COLUMNS}
  19016. input streams and they will be arranged as a grid with @code{ROWS} rows and
  19017. @code{COLUMNS} columns. When using this option, each input stream within a row
  19018. must have the same height and all the rows must have the same width.
  19019. If @code{grid} is set, then @code{inputs} option is ignored and is implicitly
  19020. set to @code{ROWS * COLUMNS}.
  19021. For 2 inputs, a default grid of @code{2x1} (equivalent to
  19022. @code{layout=0_0|w0_0}) is set. In all other cases, a layout or a grid must be
  19023. set by the user. Either @code{grid} or @code{layout} can be specified at a time.
  19024. Specifying both will result in an error.
  19025. @item shortest
  19026. If set to 1, force the output to terminate when the shortest input
  19027. terminates. Default value is 0.
  19028. @item fill
  19029. If set to valid color, all unused pixels will be filled with that color.
  19030. By default fill is set to none, so it is disabled.
  19031. @end table
  19032. @subsection Examples
  19033. @itemize
  19034. @item
  19035. Display 4 inputs into 2x2 grid.
  19036. Layout:
  19037. @example
  19038. input1(0, 0) | input3(w0, 0)
  19039. input2(0, h0) | input4(w0, h0)
  19040. @end example
  19041. @example
  19042. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  19043. @end example
  19044. Note that if inputs are of different sizes, gaps or overlaps may occur.
  19045. @item
  19046. Display 4 inputs into 1x4 grid.
  19047. Layout:
  19048. @example
  19049. input1(0, 0)
  19050. input2(0, h0)
  19051. input3(0, h0+h1)
  19052. input4(0, h0+h1+h2)
  19053. @end example
  19054. @example
  19055. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  19056. @end example
  19057. Note that if inputs are of different widths, unused space will appear.
  19058. @item
  19059. Display 9 inputs into 3x3 grid.
  19060. Layout:
  19061. @example
  19062. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  19063. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  19064. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  19065. @end example
  19066. @example
  19067. 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
  19068. @end example
  19069. Note that if inputs are of different sizes, gaps or overlaps may occur.
  19070. @item
  19071. Display 16 inputs into 4x4 grid.
  19072. Layout:
  19073. @example
  19074. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  19075. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  19076. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  19077. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  19078. @end example
  19079. @example
  19080. 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|
  19081. 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
  19082. @end example
  19083. Note that if inputs are of different sizes, gaps or overlaps may occur.
  19084. @end itemize
  19085. @anchor{yadif}
  19086. @section yadif
  19087. Deinterlace the input video ("yadif" means "yet another deinterlacing
  19088. filter").
  19089. It accepts the following parameters:
  19090. @table @option
  19091. @item mode
  19092. The interlacing mode to adopt. It accepts one of the following values:
  19093. @table @option
  19094. @item 0, send_frame
  19095. Output one frame for each frame.
  19096. @item 1, send_field
  19097. Output one frame for each field.
  19098. @item 2, send_frame_nospatial
  19099. Like @code{send_frame}, but it skips the spatial interlacing check.
  19100. @item 3, send_field_nospatial
  19101. Like @code{send_field}, but it skips the spatial interlacing check.
  19102. @end table
  19103. The default value is @code{send_frame}.
  19104. @item parity
  19105. The picture field parity assumed for the input interlaced video. It accepts one
  19106. of the following values:
  19107. @table @option
  19108. @item 0, tff
  19109. Assume the top field is first.
  19110. @item 1, bff
  19111. Assume the bottom field is first.
  19112. @item -1, auto
  19113. Enable automatic detection of field parity.
  19114. @end table
  19115. The default value is @code{auto}.
  19116. If the interlacing is unknown or the decoder does not export this information,
  19117. top field first will be assumed.
  19118. @item deint
  19119. Specify which frames to deinterlace. Accepts one of the following
  19120. values:
  19121. @table @option
  19122. @item 0, all
  19123. Deinterlace all frames.
  19124. @item 1, interlaced
  19125. Only deinterlace frames marked as interlaced.
  19126. @end table
  19127. The default value is @code{all}.
  19128. @end table
  19129. @section yadif_cuda
  19130. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  19131. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  19132. and/or nvenc.
  19133. It accepts the following parameters:
  19134. @table @option
  19135. @item mode
  19136. The interlacing mode to adopt. It accepts one of the following values:
  19137. @table @option
  19138. @item 0, send_frame
  19139. Output one frame for each frame.
  19140. @item 1, send_field
  19141. Output one frame for each field.
  19142. @item 2, send_frame_nospatial
  19143. Like @code{send_frame}, but it skips the spatial interlacing check.
  19144. @item 3, send_field_nospatial
  19145. Like @code{send_field}, but it skips the spatial interlacing check.
  19146. @end table
  19147. The default value is @code{send_frame}.
  19148. @item parity
  19149. The picture field parity assumed for the input interlaced video. It accepts one
  19150. of the following values:
  19151. @table @option
  19152. @item 0, tff
  19153. Assume the top field is first.
  19154. @item 1, bff
  19155. Assume the bottom field is first.
  19156. @item -1, auto
  19157. Enable automatic detection of field parity.
  19158. @end table
  19159. The default value is @code{auto}.
  19160. If the interlacing is unknown or the decoder does not export this information,
  19161. top field first will be assumed.
  19162. @item deint
  19163. Specify which frames to deinterlace. Accepts one of the following
  19164. values:
  19165. @table @option
  19166. @item 0, all
  19167. Deinterlace all frames.
  19168. @item 1, interlaced
  19169. Only deinterlace frames marked as interlaced.
  19170. @end table
  19171. The default value is @code{all}.
  19172. @end table
  19173. @section yaepblur
  19174. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  19175. The algorithm is described in
  19176. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  19177. It accepts the following parameters:
  19178. @table @option
  19179. @item radius, r
  19180. Set the window radius. Default value is 3.
  19181. @item planes, p
  19182. Set which planes to filter. Default is only the first plane.
  19183. @item sigma, s
  19184. Set blur strength. Default value is 128.
  19185. @end table
  19186. @subsection Commands
  19187. This filter supports same @ref{commands} as options.
  19188. @section zoompan
  19189. Apply Zoom & Pan effect.
  19190. This filter accepts the following options:
  19191. @table @option
  19192. @item zoom, z
  19193. Set the zoom expression. Range is 1-10. Default is 1.
  19194. @item x
  19195. @item y
  19196. Set the x and y expression. Default is 0.
  19197. @item d
  19198. Set the duration expression in number of frames.
  19199. This sets for how many number of frames effect will last for
  19200. single input image. Default is 90.
  19201. @item s
  19202. Set the output image size, default is 'hd720'.
  19203. @item fps
  19204. Set the output frame rate, default is '25'.
  19205. @end table
  19206. Each expression can contain the following constants:
  19207. @table @option
  19208. @item in_w, iw
  19209. Input width.
  19210. @item in_h, ih
  19211. Input height.
  19212. @item out_w, ow
  19213. Output width.
  19214. @item out_h, oh
  19215. Output height.
  19216. @item in
  19217. Input frame count.
  19218. @item on
  19219. Output frame count.
  19220. @item in_time, it
  19221. The input timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  19222. @item out_time, time, ot
  19223. The output timestamp expressed in seconds.
  19224. @item x
  19225. @item y
  19226. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  19227. for current input frame.
  19228. @item px
  19229. @item py
  19230. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  19231. not yet such frame (first input frame).
  19232. @item zoom
  19233. Last calculated zoom from 'z' expression for current input frame.
  19234. @item pzoom
  19235. Last calculated zoom of last output frame of previous input frame.
  19236. @item duration
  19237. Number of output frames for current input frame. Calculated from 'd' expression
  19238. for each input frame.
  19239. @item pduration
  19240. number of output frames created for previous input frame
  19241. @item a
  19242. Rational number: input width / input height
  19243. @item sar
  19244. sample aspect ratio
  19245. @item dar
  19246. display aspect ratio
  19247. @end table
  19248. @subsection Examples
  19249. @itemize
  19250. @item
  19251. Zoom in up to 1.5x and pan at same time to some spot near center of picture:
  19252. @example
  19253. 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
  19254. @end example
  19255. @item
  19256. Zoom in up to 1.5x and pan always at center of picture:
  19257. @example
  19258. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  19259. @end example
  19260. @item
  19261. Same as above but without pausing:
  19262. @example
  19263. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  19264. @end example
  19265. @item
  19266. Zoom in 2x into center of picture only for the first second of the input video:
  19267. @example
  19268. zoompan=z='if(between(in_time,0,1),2,1)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  19269. @end example
  19270. @end itemize
  19271. @anchor{zscale}
  19272. @section zscale
  19273. Scale (resize) the input video, using the z.lib library:
  19274. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  19275. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  19276. The zscale filter forces the output display aspect ratio to be the same
  19277. as the input, by changing the output sample aspect ratio.
  19278. If the input image format is different from the format requested by
  19279. the next filter, the zscale filter will convert the input to the
  19280. requested format.
  19281. @subsection Options
  19282. The filter accepts the following options.
  19283. @table @option
  19284. @item width, w
  19285. @item height, h
  19286. Set the output video dimension expression. Default value is the input
  19287. dimension.
  19288. If the @var{width} or @var{w} value is 0, the input width is used for
  19289. the output. If the @var{height} or @var{h} value is 0, the input height
  19290. is used for the output.
  19291. If one and only one of the values is -n with n >= 1, the zscale filter
  19292. will use a value that maintains the aspect ratio of the input image,
  19293. calculated from the other specified dimension. After that it will,
  19294. however, make sure that the calculated dimension is divisible by n and
  19295. adjust the value if necessary.
  19296. If both values are -n with n >= 1, the behavior will be identical to
  19297. both values being set to 0 as previously detailed.
  19298. See below for the list of accepted constants for use in the dimension
  19299. expression.
  19300. @item size, s
  19301. Set the video size. For the syntax of this option, check the
  19302. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19303. @item dither, d
  19304. Set the dither type.
  19305. Possible values are:
  19306. @table @var
  19307. @item none
  19308. @item ordered
  19309. @item random
  19310. @item error_diffusion
  19311. @end table
  19312. Default is none.
  19313. @item filter, f
  19314. Set the resize filter type.
  19315. Possible values are:
  19316. @table @var
  19317. @item point
  19318. @item bilinear
  19319. @item bicubic
  19320. @item spline16
  19321. @item spline36
  19322. @item lanczos
  19323. @end table
  19324. Default is bilinear.
  19325. @item range, r
  19326. Set the color range.
  19327. Possible values are:
  19328. @table @var
  19329. @item input
  19330. @item limited
  19331. @item full
  19332. @end table
  19333. Default is same as input.
  19334. @item primaries, p
  19335. Set the color primaries.
  19336. Possible values are:
  19337. @table @var
  19338. @item input
  19339. @item 709
  19340. @item unspecified
  19341. @item 170m
  19342. @item 240m
  19343. @item 2020
  19344. @end table
  19345. Default is same as input.
  19346. @item transfer, t
  19347. Set the transfer characteristics.
  19348. Possible values are:
  19349. @table @var
  19350. @item input
  19351. @item 709
  19352. @item unspecified
  19353. @item 601
  19354. @item linear
  19355. @item 2020_10
  19356. @item 2020_12
  19357. @item smpte2084
  19358. @item iec61966-2-1
  19359. @item arib-std-b67
  19360. @end table
  19361. Default is same as input.
  19362. @item matrix, m
  19363. Set the colorspace matrix.
  19364. Possible value are:
  19365. @table @var
  19366. @item input
  19367. @item 709
  19368. @item unspecified
  19369. @item 470bg
  19370. @item 170m
  19371. @item 2020_ncl
  19372. @item 2020_cl
  19373. @end table
  19374. Default is same as input.
  19375. @item rangein, rin
  19376. Set the input color range.
  19377. Possible values are:
  19378. @table @var
  19379. @item input
  19380. @item limited
  19381. @item full
  19382. @end table
  19383. Default is same as input.
  19384. @item primariesin, pin
  19385. Set the input color primaries.
  19386. Possible values are:
  19387. @table @var
  19388. @item input
  19389. @item 709
  19390. @item unspecified
  19391. @item 170m
  19392. @item 240m
  19393. @item 2020
  19394. @end table
  19395. Default is same as input.
  19396. @item transferin, tin
  19397. Set the input transfer characteristics.
  19398. Possible values are:
  19399. @table @var
  19400. @item input
  19401. @item 709
  19402. @item unspecified
  19403. @item 601
  19404. @item linear
  19405. @item 2020_10
  19406. @item 2020_12
  19407. @end table
  19408. Default is same as input.
  19409. @item matrixin, min
  19410. Set the input colorspace matrix.
  19411. Possible value are:
  19412. @table @var
  19413. @item input
  19414. @item 709
  19415. @item unspecified
  19416. @item 470bg
  19417. @item 170m
  19418. @item 2020_ncl
  19419. @item 2020_cl
  19420. @end table
  19421. @item chromal, c
  19422. Set the output chroma location.
  19423. Possible values are:
  19424. @table @var
  19425. @item input
  19426. @item left
  19427. @item center
  19428. @item topleft
  19429. @item top
  19430. @item bottomleft
  19431. @item bottom
  19432. @end table
  19433. @item chromalin, cin
  19434. Set the input chroma location.
  19435. Possible values are:
  19436. @table @var
  19437. @item input
  19438. @item left
  19439. @item center
  19440. @item topleft
  19441. @item top
  19442. @item bottomleft
  19443. @item bottom
  19444. @end table
  19445. @item npl
  19446. Set the nominal peak luminance.
  19447. @item param_a
  19448. Parameter A for scaling filters. Parameter "b" for bicubic, and the number of
  19449. filter taps for lanczos.
  19450. @item param_b
  19451. Parameter B for scaling filters. Parameter "c" for bicubic.
  19452. @end table
  19453. The values of the @option{w} and @option{h} options are expressions
  19454. containing the following constants:
  19455. @table @var
  19456. @item in_w
  19457. @item in_h
  19458. The input width and height
  19459. @item iw
  19460. @item ih
  19461. These are the same as @var{in_w} and @var{in_h}.
  19462. @item out_w
  19463. @item out_h
  19464. The output (scaled) width and height
  19465. @item ow
  19466. @item oh
  19467. These are the same as @var{out_w} and @var{out_h}
  19468. @item a
  19469. The same as @var{iw} / @var{ih}
  19470. @item sar
  19471. input sample aspect ratio
  19472. @item dar
  19473. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  19474. @item hsub
  19475. @item vsub
  19476. horizontal and vertical input chroma subsample values. For example for the
  19477. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  19478. @item ohsub
  19479. @item ovsub
  19480. horizontal and vertical output chroma subsample values. For example for the
  19481. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  19482. @end table
  19483. @subsection Commands
  19484. This filter supports the following commands:
  19485. @table @option
  19486. @item width, w
  19487. @item height, h
  19488. Set the output video dimension expression.
  19489. The command accepts the same syntax of the corresponding option.
  19490. If the specified expression is not valid, it is kept at its current
  19491. value.
  19492. @end table
  19493. @c man end VIDEO FILTERS
  19494. @chapter OpenCL Video Filters
  19495. @c man begin OPENCL VIDEO FILTERS
  19496. Below is a description of the currently available OpenCL video filters.
  19497. To enable compilation of these filters you need to configure FFmpeg with
  19498. @code{--enable-opencl}.
  19499. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  19500. @table @option
  19501. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  19502. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  19503. given device parameters.
  19504. @item -filter_hw_device @var{name}
  19505. Pass the hardware device called @var{name} to all filters in any filter graph.
  19506. @end table
  19507. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  19508. @itemize
  19509. @item
  19510. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  19511. @example
  19512. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  19513. @end example
  19514. @end itemize
  19515. 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.
  19516. @section avgblur_opencl
  19517. Apply average blur filter.
  19518. The filter accepts the following options:
  19519. @table @option
  19520. @item sizeX
  19521. Set horizontal radius size.
  19522. Range is @code{[1, 1024]} and default value is @code{1}.
  19523. @item planes
  19524. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  19525. @item sizeY
  19526. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  19527. @end table
  19528. @subsection Example
  19529. @itemize
  19530. @item
  19531. 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.
  19532. @example
  19533. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  19534. @end example
  19535. @end itemize
  19536. @section boxblur_opencl
  19537. Apply a boxblur algorithm to the input video.
  19538. It accepts the following parameters:
  19539. @table @option
  19540. @item luma_radius, lr
  19541. @item luma_power, lp
  19542. @item chroma_radius, cr
  19543. @item chroma_power, cp
  19544. @item alpha_radius, ar
  19545. @item alpha_power, ap
  19546. @end table
  19547. A description of the accepted options follows.
  19548. @table @option
  19549. @item luma_radius, lr
  19550. @item chroma_radius, cr
  19551. @item alpha_radius, ar
  19552. Set an expression for the box radius in pixels used for blurring the
  19553. corresponding input plane.
  19554. The radius value must be a non-negative number, and must not be
  19555. greater than the value of the expression @code{min(w,h)/2} for the
  19556. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  19557. planes.
  19558. Default value for @option{luma_radius} is "2". If not specified,
  19559. @option{chroma_radius} and @option{alpha_radius} default to the
  19560. corresponding value set for @option{luma_radius}.
  19561. The expressions can contain the following constants:
  19562. @table @option
  19563. @item w
  19564. @item h
  19565. The input width and height in pixels.
  19566. @item cw
  19567. @item ch
  19568. The input chroma image width and height in pixels.
  19569. @item hsub
  19570. @item vsub
  19571. The horizontal and vertical chroma subsample values. For example, for the
  19572. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  19573. @end table
  19574. @item luma_power, lp
  19575. @item chroma_power, cp
  19576. @item alpha_power, ap
  19577. Specify how many times the boxblur filter is applied to the
  19578. corresponding plane.
  19579. Default value for @option{luma_power} is 2. If not specified,
  19580. @option{chroma_power} and @option{alpha_power} default to the
  19581. corresponding value set for @option{luma_power}.
  19582. A value of 0 will disable the effect.
  19583. @end table
  19584. @subsection Examples
  19585. 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.
  19586. @itemize
  19587. @item
  19588. Apply a boxblur filter with the luma, chroma, and alpha radius
  19589. 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.
  19590. @example
  19591. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  19592. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  19593. @end example
  19594. @item
  19595. 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.
  19596. For the luma plane, a 2x2 box radius will be run once.
  19597. For the chroma plane, a 4x4 box radius will be run 5 times.
  19598. For the alpha plane, a 3x3 box radius will be run 7 times.
  19599. @example
  19600. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  19601. @end example
  19602. @end itemize
  19603. @section colorkey_opencl
  19604. RGB colorspace color keying.
  19605. The filter accepts the following options:
  19606. @table @option
  19607. @item color
  19608. The color which will be replaced with transparency.
  19609. @item similarity
  19610. Similarity percentage with the key color.
  19611. 0.01 matches only the exact key color, while 1.0 matches everything.
  19612. @item blend
  19613. Blend percentage.
  19614. 0.0 makes pixels either fully transparent, or not transparent at all.
  19615. Higher values result in semi-transparent pixels, with a higher transparency
  19616. the more similar the pixels color is to the key color.
  19617. @end table
  19618. @subsection Examples
  19619. @itemize
  19620. @item
  19621. Make every semi-green pixel in the input transparent with some slight blending:
  19622. @example
  19623. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  19624. @end example
  19625. @end itemize
  19626. @section convolution_opencl
  19627. Apply convolution of 3x3, 5x5, 7x7 matrix.
  19628. The filter accepts the following options:
  19629. @table @option
  19630. @item 0m
  19631. @item 1m
  19632. @item 2m
  19633. @item 3m
  19634. Set matrix for each plane.
  19635. Matrix is sequence of 9, 25 or 49 signed numbers.
  19636. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  19637. @item 0rdiv
  19638. @item 1rdiv
  19639. @item 2rdiv
  19640. @item 3rdiv
  19641. Set multiplier for calculated value for each plane.
  19642. If unset or 0, it will be sum of all matrix elements.
  19643. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  19644. @item 0bias
  19645. @item 1bias
  19646. @item 2bias
  19647. @item 3bias
  19648. Set bias for each plane. This value is added to the result of the multiplication.
  19649. Useful for making the overall image brighter or darker.
  19650. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  19651. @end table
  19652. @subsection Examples
  19653. @itemize
  19654. @item
  19655. Apply sharpen:
  19656. @example
  19657. -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
  19658. @end example
  19659. @item
  19660. Apply blur:
  19661. @example
  19662. -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
  19663. @end example
  19664. @item
  19665. Apply edge enhance:
  19666. @example
  19667. -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
  19668. @end example
  19669. @item
  19670. Apply edge detect:
  19671. @example
  19672. -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
  19673. @end example
  19674. @item
  19675. Apply laplacian edge detector which includes diagonals:
  19676. @example
  19677. -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
  19678. @end example
  19679. @item
  19680. Apply emboss:
  19681. @example
  19682. -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
  19683. @end example
  19684. @end itemize
  19685. @section erosion_opencl
  19686. Apply erosion effect to the video.
  19687. This filter replaces the pixel by the local(3x3) minimum.
  19688. It accepts the following options:
  19689. @table @option
  19690. @item threshold0
  19691. @item threshold1
  19692. @item threshold2
  19693. @item threshold3
  19694. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  19695. If @code{0}, plane will remain unchanged.
  19696. @item coordinates
  19697. Flag which specifies the pixel to refer to.
  19698. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  19699. Flags to local 3x3 coordinates region centered on @code{x}:
  19700. 1 2 3
  19701. 4 x 5
  19702. 6 7 8
  19703. @end table
  19704. @subsection Example
  19705. @itemize
  19706. @item
  19707. 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.
  19708. @example
  19709. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  19710. @end example
  19711. @end itemize
  19712. @section deshake_opencl
  19713. Feature-point based video stabilization filter.
  19714. The filter accepts the following options:
  19715. @table @option
  19716. @item tripod
  19717. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  19718. @item debug
  19719. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  19720. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  19721. Viewing point matches in the output video is only supported for RGB input.
  19722. Defaults to @code{0}.
  19723. @item adaptive_crop
  19724. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  19725. Defaults to @code{1}.
  19726. @item refine_features
  19727. Whether or not feature points should be refined at a sub-pixel level.
  19728. This can be turned off for a slight performance gain at the cost of precision.
  19729. Defaults to @code{1}.
  19730. @item smooth_strength
  19731. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  19732. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  19733. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  19734. Defaults to @code{0.0}.
  19735. @item smooth_window_multiplier
  19736. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  19737. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  19738. Acceptable values range from @code{0.1} to @code{10.0}.
  19739. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  19740. potentially improving smoothness, but also increase latency and memory usage.
  19741. Defaults to @code{2.0}.
  19742. @end table
  19743. @subsection Examples
  19744. @itemize
  19745. @item
  19746. Stabilize a video with a fixed, medium smoothing strength:
  19747. @example
  19748. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  19749. @end example
  19750. @item
  19751. Stabilize a video with debugging (both in console and in rendered video):
  19752. @example
  19753. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  19754. @end example
  19755. @end itemize
  19756. @section dilation_opencl
  19757. Apply dilation effect to the video.
  19758. This filter replaces the pixel by the local(3x3) maximum.
  19759. It accepts the following options:
  19760. @table @option
  19761. @item threshold0
  19762. @item threshold1
  19763. @item threshold2
  19764. @item threshold3
  19765. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  19766. If @code{0}, plane will remain unchanged.
  19767. @item coordinates
  19768. Flag which specifies the pixel to refer to.
  19769. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  19770. Flags to local 3x3 coordinates region centered on @code{x}:
  19771. 1 2 3
  19772. 4 x 5
  19773. 6 7 8
  19774. @end table
  19775. @subsection Example
  19776. @itemize
  19777. @item
  19778. 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.
  19779. @example
  19780. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  19781. @end example
  19782. @end itemize
  19783. @section nlmeans_opencl
  19784. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  19785. @section overlay_opencl
  19786. Overlay one video on top of another.
  19787. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  19788. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  19789. The filter accepts the following options:
  19790. @table @option
  19791. @item x
  19792. Set the x coordinate of the overlaid video on the main video.
  19793. Default value is @code{0}.
  19794. @item y
  19795. Set the y coordinate of the overlaid video on the main video.
  19796. Default value is @code{0}.
  19797. @end table
  19798. @subsection Examples
  19799. @itemize
  19800. @item
  19801. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  19802. @example
  19803. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  19804. @end example
  19805. @item
  19806. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  19807. @example
  19808. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  19809. @end example
  19810. @end itemize
  19811. @section pad_opencl
  19812. Add paddings to the input image, and place the original input at the
  19813. provided @var{x}, @var{y} coordinates.
  19814. It accepts the following options:
  19815. @table @option
  19816. @item width, w
  19817. @item height, h
  19818. Specify an expression for the size of the output image with the
  19819. paddings added. If the value for @var{width} or @var{height} is 0, the
  19820. corresponding input size is used for the output.
  19821. The @var{width} expression can reference the value set by the
  19822. @var{height} expression, and vice versa.
  19823. The default value of @var{width} and @var{height} is 0.
  19824. @item x
  19825. @item y
  19826. Specify the offsets to place the input image at within the padded area,
  19827. with respect to the top/left border of the output image.
  19828. The @var{x} expression can reference the value set by the @var{y}
  19829. expression, and vice versa.
  19830. The default value of @var{x} and @var{y} is 0.
  19831. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  19832. so the input image is centered on the padded area.
  19833. @item color
  19834. Specify the color of the padded area. For the syntax of this option,
  19835. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  19836. manual,ffmpeg-utils}.
  19837. @item aspect
  19838. Pad to an aspect instead to a resolution.
  19839. @end table
  19840. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  19841. options are expressions containing the following constants:
  19842. @table @option
  19843. @item in_w
  19844. @item in_h
  19845. The input video width and height.
  19846. @item iw
  19847. @item ih
  19848. These are the same as @var{in_w} and @var{in_h}.
  19849. @item out_w
  19850. @item out_h
  19851. The output width and height (the size of the padded area), as
  19852. specified by the @var{width} and @var{height} expressions.
  19853. @item ow
  19854. @item oh
  19855. These are the same as @var{out_w} and @var{out_h}.
  19856. @item x
  19857. @item y
  19858. The x and y offsets as specified by the @var{x} and @var{y}
  19859. expressions, or NAN if not yet specified.
  19860. @item a
  19861. same as @var{iw} / @var{ih}
  19862. @item sar
  19863. input sample aspect ratio
  19864. @item dar
  19865. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  19866. @end table
  19867. @section prewitt_opencl
  19868. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  19869. The filter accepts the following option:
  19870. @table @option
  19871. @item planes
  19872. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  19873. @item scale
  19874. Set value which will be multiplied with filtered result.
  19875. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  19876. @item delta
  19877. Set value which will be added to filtered result.
  19878. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  19879. @end table
  19880. @subsection Example
  19881. @itemize
  19882. @item
  19883. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  19884. @example
  19885. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  19886. @end example
  19887. @end itemize
  19888. @anchor{program_opencl}
  19889. @section program_opencl
  19890. Filter video using an OpenCL program.
  19891. @table @option
  19892. @item source
  19893. OpenCL program source file.
  19894. @item kernel
  19895. Kernel name in program.
  19896. @item inputs
  19897. Number of inputs to the filter. Defaults to 1.
  19898. @item size, s
  19899. Size of output frames. Defaults to the same as the first input.
  19900. @end table
  19901. The @code{program_opencl} filter also supports the @ref{framesync} options.
  19902. The program source file must contain a kernel function with the given name,
  19903. which will be run once for each plane of the output. Each run on a plane
  19904. gets enqueued as a separate 2D global NDRange with one work-item for each
  19905. pixel to be generated. The global ID offset for each work-item is therefore
  19906. the coordinates of a pixel in the destination image.
  19907. The kernel function needs to take the following arguments:
  19908. @itemize
  19909. @item
  19910. Destination image, @var{__write_only image2d_t}.
  19911. This image will become the output; the kernel should write all of it.
  19912. @item
  19913. Frame index, @var{unsigned int}.
  19914. This is a counter starting from zero and increasing by one for each frame.
  19915. @item
  19916. Source images, @var{__read_only image2d_t}.
  19917. These are the most recent images on each input. The kernel may read from
  19918. them to generate the output, but they can't be written to.
  19919. @end itemize
  19920. Example programs:
  19921. @itemize
  19922. @item
  19923. Copy the input to the output (output must be the same size as the input).
  19924. @verbatim
  19925. __kernel void copy(__write_only image2d_t destination,
  19926. unsigned int index,
  19927. __read_only image2d_t source)
  19928. {
  19929. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  19930. int2 location = (int2)(get_global_id(0), get_global_id(1));
  19931. float4 value = read_imagef(source, sampler, location);
  19932. write_imagef(destination, location, value);
  19933. }
  19934. @end verbatim
  19935. @item
  19936. Apply a simple transformation, rotating the input by an amount increasing
  19937. with the index counter. Pixel values are linearly interpolated by the
  19938. sampler, and the output need not have the same dimensions as the input.
  19939. @verbatim
  19940. __kernel void rotate_image(__write_only image2d_t dst,
  19941. unsigned int index,
  19942. __read_only image2d_t src)
  19943. {
  19944. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  19945. CLK_FILTER_LINEAR);
  19946. float angle = (float)index / 100.0f;
  19947. float2 dst_dim = convert_float2(get_image_dim(dst));
  19948. float2 src_dim = convert_float2(get_image_dim(src));
  19949. float2 dst_cen = dst_dim / 2.0f;
  19950. float2 src_cen = src_dim / 2.0f;
  19951. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  19952. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  19953. float2 src_pos = {
  19954. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  19955. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  19956. };
  19957. src_pos = src_pos * src_dim / dst_dim;
  19958. float2 src_loc = src_pos + src_cen;
  19959. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  19960. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  19961. write_imagef(dst, dst_loc, 0.5f);
  19962. else
  19963. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  19964. }
  19965. @end verbatim
  19966. @item
  19967. Blend two inputs together, with the amount of each input used varying
  19968. with the index counter.
  19969. @verbatim
  19970. __kernel void blend_images(__write_only image2d_t dst,
  19971. unsigned int index,
  19972. __read_only image2d_t src1,
  19973. __read_only image2d_t src2)
  19974. {
  19975. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  19976. CLK_FILTER_LINEAR);
  19977. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  19978. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  19979. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  19980. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  19981. float4 val1 = read_imagef(src1, sampler, src1_loc);
  19982. float4 val2 = read_imagef(src2, sampler, src2_loc);
  19983. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  19984. }
  19985. @end verbatim
  19986. @end itemize
  19987. @section remap_opencl
  19988. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  19989. Destination pixel at position (X, Y) will be picked from source (x, y) position
  19990. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  19991. value for pixel will be used for destination pixel.
  19992. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  19993. will have Xmap/Ymap video stream dimensions.
  19994. Xmap and Ymap input video streams are 32bit float pixel format, single channel.
  19995. @table @option
  19996. @item interp
  19997. Specify interpolation used for remapping of pixels.
  19998. Allowed values are @code{near} and @code{linear}.
  19999. Default value is @code{linear}.
  20000. @item fill
  20001. Specify the color of the unmapped pixels. For the syntax of this option,
  20002. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  20003. manual,ffmpeg-utils}. Default color is @code{black}.
  20004. @end table
  20005. @section roberts_opencl
  20006. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  20007. The filter accepts the following option:
  20008. @table @option
  20009. @item planes
  20010. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  20011. @item scale
  20012. Set value which will be multiplied with filtered result.
  20013. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  20014. @item delta
  20015. Set value which will be added to filtered result.
  20016. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  20017. @end table
  20018. @subsection Example
  20019. @itemize
  20020. @item
  20021. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  20022. @example
  20023. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  20024. @end example
  20025. @end itemize
  20026. @section sobel_opencl
  20027. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  20028. The filter accepts the following option:
  20029. @table @option
  20030. @item planes
  20031. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  20032. @item scale
  20033. Set value which will be multiplied with filtered result.
  20034. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  20035. @item delta
  20036. Set value which will be added to filtered result.
  20037. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  20038. @end table
  20039. @subsection Example
  20040. @itemize
  20041. @item
  20042. Apply sobel operator with scale set to 2 and delta set to 10
  20043. @example
  20044. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  20045. @end example
  20046. @end itemize
  20047. @section tonemap_opencl
  20048. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  20049. It accepts the following parameters:
  20050. @table @option
  20051. @item tonemap
  20052. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  20053. @item param
  20054. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  20055. @item desat
  20056. Apply desaturation for highlights that exceed this level of brightness. The
  20057. higher the parameter, the more color information will be preserved. This
  20058. setting helps prevent unnaturally blown-out colors for super-highlights, by
  20059. (smoothly) turning into white instead. This makes images feel more natural,
  20060. at the cost of reducing information about out-of-range colors.
  20061. The default value is 0.5, and the algorithm here is a little different from
  20062. the cpu version tonemap currently. A setting of 0.0 disables this option.
  20063. @item threshold
  20064. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  20065. is used to detect whether the scene has changed or not. If the distance between
  20066. the current frame average brightness and the current running average exceeds
  20067. a threshold value, we would re-calculate scene average and peak brightness.
  20068. The default value is 0.2.
  20069. @item format
  20070. Specify the output pixel format.
  20071. Currently supported formats are:
  20072. @table @var
  20073. @item p010
  20074. @item nv12
  20075. @end table
  20076. @item range, r
  20077. Set the output color range.
  20078. Possible values are:
  20079. @table @var
  20080. @item tv/mpeg
  20081. @item pc/jpeg
  20082. @end table
  20083. Default is same as input.
  20084. @item primaries, p
  20085. Set the output color primaries.
  20086. Possible values are:
  20087. @table @var
  20088. @item bt709
  20089. @item bt2020
  20090. @end table
  20091. Default is same as input.
  20092. @item transfer, t
  20093. Set the output transfer characteristics.
  20094. Possible values are:
  20095. @table @var
  20096. @item bt709
  20097. @item bt2020
  20098. @end table
  20099. Default is bt709.
  20100. @item matrix, m
  20101. Set the output colorspace matrix.
  20102. Possible value are:
  20103. @table @var
  20104. @item bt709
  20105. @item bt2020
  20106. @end table
  20107. Default is same as input.
  20108. @end table
  20109. @subsection Example
  20110. @itemize
  20111. @item
  20112. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  20113. @example
  20114. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  20115. @end example
  20116. @end itemize
  20117. @section unsharp_opencl
  20118. Sharpen or blur the input video.
  20119. It accepts the following parameters:
  20120. @table @option
  20121. @item luma_msize_x, lx
  20122. Set the luma matrix horizontal size.
  20123. Range is @code{[1, 23]} and default value is @code{5}.
  20124. @item luma_msize_y, ly
  20125. Set the luma matrix vertical size.
  20126. Range is @code{[1, 23]} and default value is @code{5}.
  20127. @item luma_amount, la
  20128. Set the luma effect strength.
  20129. Range is @code{[-10, 10]} and default value is @code{1.0}.
  20130. Negative values will blur the input video, while positive values will
  20131. sharpen it, a value of zero will disable the effect.
  20132. @item chroma_msize_x, cx
  20133. Set the chroma matrix horizontal size.
  20134. Range is @code{[1, 23]} and default value is @code{5}.
  20135. @item chroma_msize_y, cy
  20136. Set the chroma matrix vertical size.
  20137. Range is @code{[1, 23]} and default value is @code{5}.
  20138. @item chroma_amount, ca
  20139. Set the chroma effect strength.
  20140. Range is @code{[-10, 10]} and default value is @code{0.0}.
  20141. Negative values will blur the input video, while positive values will
  20142. sharpen it, a value of zero will disable the effect.
  20143. @end table
  20144. All parameters are optional and default to the equivalent of the
  20145. string '5:5:1.0:5:5:0.0'.
  20146. @subsection Examples
  20147. @itemize
  20148. @item
  20149. Apply strong luma sharpen effect:
  20150. @example
  20151. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  20152. @end example
  20153. @item
  20154. Apply a strong blur of both luma and chroma parameters:
  20155. @example
  20156. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  20157. @end example
  20158. @end itemize
  20159. @section xfade_opencl
  20160. Cross fade two videos with custom transition effect by using OpenCL.
  20161. It accepts the following options:
  20162. @table @option
  20163. @item transition
  20164. Set one of possible transition effects.
  20165. @table @option
  20166. @item custom
  20167. Select custom transition effect, the actual transition description
  20168. will be picked from source and kernel options.
  20169. @item fade
  20170. @item wipeleft
  20171. @item wiperight
  20172. @item wipeup
  20173. @item wipedown
  20174. @item slideleft
  20175. @item slideright
  20176. @item slideup
  20177. @item slidedown
  20178. Default transition is fade.
  20179. @end table
  20180. @item source
  20181. OpenCL program source file for custom transition.
  20182. @item kernel
  20183. Set name of kernel to use for custom transition from program source file.
  20184. @item duration
  20185. Set duration of video transition.
  20186. @item offset
  20187. Set time of start of transition relative to first video.
  20188. @end table
  20189. The program source file must contain a kernel function with the given name,
  20190. which will be run once for each plane of the output. Each run on a plane
  20191. gets enqueued as a separate 2D global NDRange with one work-item for each
  20192. pixel to be generated. The global ID offset for each work-item is therefore
  20193. the coordinates of a pixel in the destination image.
  20194. The kernel function needs to take the following arguments:
  20195. @itemize
  20196. @item
  20197. Destination image, @var{__write_only image2d_t}.
  20198. This image will become the output; the kernel should write all of it.
  20199. @item
  20200. First Source image, @var{__read_only image2d_t}.
  20201. Second Source image, @var{__read_only image2d_t}.
  20202. These are the most recent images on each input. The kernel may read from
  20203. them to generate the output, but they can't be written to.
  20204. @item
  20205. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  20206. @end itemize
  20207. Example programs:
  20208. @itemize
  20209. @item
  20210. Apply dots curtain transition effect:
  20211. @verbatim
  20212. __kernel void blend_images(__write_only image2d_t dst,
  20213. __read_only image2d_t src1,
  20214. __read_only image2d_t src2,
  20215. float progress)
  20216. {
  20217. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  20218. CLK_FILTER_LINEAR);
  20219. int2 p = (int2)(get_global_id(0), get_global_id(1));
  20220. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  20221. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  20222. rp = rp / dim;
  20223. float2 dots = (float2)(20.0, 20.0);
  20224. float2 center = (float2)(0,0);
  20225. float2 unused;
  20226. float4 val1 = read_imagef(src1, sampler, p);
  20227. float4 val2 = read_imagef(src2, sampler, p);
  20228. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  20229. write_imagef(dst, p, next ? val1 : val2);
  20230. }
  20231. @end verbatim
  20232. @end itemize
  20233. @c man end OPENCL VIDEO FILTERS
  20234. @chapter VAAPI Video Filters
  20235. @c man begin VAAPI VIDEO FILTERS
  20236. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  20237. To enable compilation of these filters you need to configure FFmpeg with
  20238. @code{--enable-vaapi}.
  20239. 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}
  20240. @section overlay_vaapi
  20241. Overlay one video on the top of another.
  20242. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  20243. The filter accepts the following options:
  20244. @table @option
  20245. @item x
  20246. @item y
  20247. Set expressions for the x and y coordinates of the overlaid video
  20248. on the main video.
  20249. Default value is "0" for both expressions.
  20250. @item w
  20251. @item h
  20252. Set expressions for the width and height the overlaid video
  20253. on the main video.
  20254. Default values are 'overlay_iw' for 'w' and 'overlay_ih*w/overlay_iw' for 'h'.
  20255. The expressions can contain the following parameters:
  20256. @table @option
  20257. @item main_w, W
  20258. @item main_h, H
  20259. The main input width and height.
  20260. @item overlay_iw
  20261. @item overlay_ih
  20262. The overlay input width and height.
  20263. @item overlay_w, w
  20264. @item overlay_h, h
  20265. The overlay output width and height.
  20266. @item overlay_x, x
  20267. @item overlay_y, y
  20268. Position of the overlay layer inside of main
  20269. @end table
  20270. @item alpha
  20271. Set transparency of overlaid video. Allowed range is 0.0 to 1.0.
  20272. Higher value means lower transparency.
  20273. Default value is @code{1.0}.
  20274. @item eof_action
  20275. See @ref{framesync}.
  20276. @item shortest
  20277. See @ref{framesync}.
  20278. @item repeatlast
  20279. See @ref{framesync}.
  20280. @end table
  20281. This filter also supports the @ref{framesync} options.
  20282. @subsection Examples
  20283. @itemize
  20284. @item
  20285. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs for this filter are yuv420p format.
  20286. @example
  20287. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_vaapi" OUTPUT
  20288. @end example
  20289. @item
  20290. Overlay an image LOGO at the offset (200, 100) from the top-left corner of the INPUT video.
  20291. The inputs have same memory layout for color channels, the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  20292. @example
  20293. -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
  20294. @end example
  20295. @end itemize
  20296. @section tonemap_vaapi
  20297. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  20298. It maps the dynamic range of HDR10 content to the SDR content.
  20299. It currently only accepts HDR10 as input.
  20300. It accepts the following parameters:
  20301. @table @option
  20302. @item format
  20303. Specify the output pixel format.
  20304. Currently supported formats are:
  20305. @table @var
  20306. @item p010
  20307. @item nv12
  20308. @end table
  20309. Default is nv12.
  20310. @item primaries, p
  20311. Set the output color primaries.
  20312. Default is same as input.
  20313. @item transfer, t
  20314. Set the output transfer characteristics.
  20315. Default is bt709.
  20316. @item matrix, m
  20317. Set the output colorspace matrix.
  20318. Default is same as input.
  20319. @end table
  20320. @subsection Example
  20321. @itemize
  20322. @item
  20323. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  20324. @example
  20325. tonemap_vaapi=format=p010:t=bt2020-10
  20326. @end example
  20327. @end itemize
  20328. @section hstack_vaapi
  20329. Stack input videos horizontally.
  20330. This is the VA-API variant of the @ref{hstack} filter, each input stream may
  20331. have different height, this filter will scale down/up each input stream while
  20332. keeping the orignal aspect.
  20333. It accepts the following options:
  20334. @table @option
  20335. @item inputs
  20336. See @ref{hstack}.
  20337. @item shortest
  20338. See @ref{hstack}.
  20339. @item height
  20340. Set height of output. If set to 0, this filter will set height of output to
  20341. height of the first input stream. Default value is 0.
  20342. @end table
  20343. @section vstack_vaapi
  20344. Stack input videos vertically.
  20345. This is the VA-API variant of the @ref{vstack} filter, each input stream may
  20346. have different width, this filter will scale down/up each input stream while
  20347. keeping the orignal aspect.
  20348. It accepts the following options:
  20349. @table @option
  20350. @item inputs
  20351. See @ref{vstack}.
  20352. @item shortest
  20353. See @ref{vstack}.
  20354. @item width
  20355. Set width of output. If set to 0, this filter will set width of output to
  20356. width of the first input stream. Default value is 0.
  20357. @end table
  20358. @section xstack_vaapi
  20359. Stack video inputs into custom layout.
  20360. This is the VA-API variant of the @ref{xstack} filter, each input stream may
  20361. have different size, this filter will scale down/up each input stream to the
  20362. given output size, or the size of the first input stream.
  20363. It accepts the following options:
  20364. @table @option
  20365. @item inputs
  20366. See @ref{xstack}.
  20367. @item shortest
  20368. See @ref{xstack}.
  20369. @item layout
  20370. See @ref{xstack}.
  20371. Moreover, this permits the user to supply output size for each input stream.
  20372. @example
  20373. xstack_vaapi=inputs=4:layout=0_0_1920x1080|0_h0_1920x1080|w0_0_1920x1080|w0_h0_1920x1080
  20374. @end example
  20375. @item grid
  20376. See @ref{xstack}.
  20377. @item grid_tile_size
  20378. Set output size for each input stream when @option{grid} is set. If this option
  20379. is not set, this filter will set output size by default to the size of the
  20380. first input stream. For the syntax of this option, check the
  20381. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20382. @item fill
  20383. See @ref{xstack}.
  20384. @end table
  20385. @c man end VAAPI VIDEO FILTERS
  20386. @chapter QSV Video Filters
  20387. @c man begin QSV VIDEO FILTERS
  20388. Below is a description of the currently available QSV video filters.
  20389. To enable compilation of these filters you need to configure FFmpeg with
  20390. @code{--enable-libmfx} or @code{--enable-libvpl}.
  20391. To use QSV filters, you need to setup the QSV device correctly. For more information, please read @url{https://trac.ffmpeg.org/wiki/Hardware/QuickSync}
  20392. @section hstack_qsv
  20393. Stack input videos horizontally.
  20394. This is the QSV variant of the @ref{hstack} filter, each input stream may
  20395. have different height, this filter will scale down/up each input stream while
  20396. keeping the orignal aspect.
  20397. It accepts the following options:
  20398. @table @option
  20399. @item inputs
  20400. See @ref{hstack}.
  20401. @item shortest
  20402. See @ref{hstack}.
  20403. @item height
  20404. Set height of output. If set to 0, this filter will set height of output to
  20405. height of the first input stream. Default value is 0.
  20406. @end table
  20407. @section vstack_qsv
  20408. Stack input videos vertically.
  20409. This is the QSV variant of the @ref{vstack} filter, each input stream may
  20410. have different width, this filter will scale down/up each input stream while
  20411. keeping the orignal aspect.
  20412. It accepts the following options:
  20413. @table @option
  20414. @item inputs
  20415. See @ref{vstack}.
  20416. @item shortest
  20417. See @ref{vstack}.
  20418. @item width
  20419. Set width of output. If set to 0, this filter will set width of output to
  20420. width of the first input stream. Default value is 0.
  20421. @end table
  20422. @section xstack_qsv
  20423. Stack video inputs into custom layout.
  20424. This is the QSV variant of the @ref{xstack} filter.
  20425. It accepts the following options:
  20426. @table @option
  20427. @item inputs
  20428. See @ref{xstack}.
  20429. @item shortest
  20430. See @ref{xstack}.
  20431. @item layout
  20432. See @ref{xstack}.
  20433. Moreover, this permits the user to supply output size for each input stream.
  20434. @example
  20435. xstack_qsv=inputs=4:layout=0_0_1920x1080|0_h0_1920x1080|w0_0_1920x1080|w0_h0_1920x1080
  20436. @end example
  20437. @item grid
  20438. See @ref{xstack}.
  20439. @item grid_tile_size
  20440. Set output size for each input stream when @option{grid} is set. If this option
  20441. is not set, this filter will set output size by default to the size of the
  20442. first input stream. For the syntax of this option, check the
  20443. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20444. @item fill
  20445. See @ref{xstack}.
  20446. @end table
  20447. @c man end QSV VIDEO FILTERS
  20448. @chapter Video Sources
  20449. @c man begin VIDEO SOURCES
  20450. Below is a description of the currently available video sources.
  20451. @section buffer
  20452. Buffer video frames, and make them available to the filter chain.
  20453. This source is mainly intended for a programmatic use, in particular
  20454. through the interface defined in @file{libavfilter/buffersrc.h}.
  20455. It accepts the following parameters:
  20456. @table @option
  20457. @item video_size
  20458. Specify the size (width and height) of the buffered video frames. For the
  20459. syntax of this option, check the
  20460. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20461. @item width
  20462. The input video width.
  20463. @item height
  20464. The input video height.
  20465. @item pix_fmt
  20466. A string representing the pixel format of the buffered video frames.
  20467. It may be a number corresponding to a pixel format, or a pixel format
  20468. name.
  20469. @item time_base
  20470. Specify the timebase assumed by the timestamps of the buffered frames.
  20471. @item frame_rate
  20472. Specify the frame rate expected for the video stream.
  20473. @item pixel_aspect, sar
  20474. The sample (pixel) aspect ratio of the input video.
  20475. @item hw_frames_ctx
  20476. When using a hardware pixel format, this should be a reference to an
  20477. AVHWFramesContext describing input frames.
  20478. @end table
  20479. For example:
  20480. @example
  20481. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  20482. @end example
  20483. will instruct the source to accept video frames with size 320x240 and
  20484. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  20485. square pixels (1:1 sample aspect ratio).
  20486. Since the pixel format with name "yuv410p" corresponds to the number 6
  20487. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  20488. this example corresponds to:
  20489. @example
  20490. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  20491. @end example
  20492. Alternatively, the options can be specified as a flat string, but this
  20493. syntax is deprecated:
  20494. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  20495. @section cellauto
  20496. Create a pattern generated by an elementary cellular automaton.
  20497. The initial state of the cellular automaton can be defined through the
  20498. @option{filename} and @option{pattern} options. If such options are
  20499. not specified an initial state is created randomly.
  20500. At each new frame a new row in the video is filled with the result of
  20501. the cellular automaton next generation. The behavior when the whole
  20502. frame is filled is defined by the @option{scroll} option.
  20503. This source accepts the following options:
  20504. @table @option
  20505. @item filename, f
  20506. Read the initial cellular automaton state, i.e. the starting row, from
  20507. the specified file.
  20508. In the file, each non-whitespace character is considered an alive
  20509. cell, a newline will terminate the row, and further characters in the
  20510. file will be ignored.
  20511. @item pattern, p
  20512. Read the initial cellular automaton state, i.e. the starting row, from
  20513. the specified string.
  20514. Each non-whitespace character in the string is considered an alive
  20515. cell, a newline will terminate the row, and further characters in the
  20516. string will be ignored.
  20517. @item rate, r
  20518. Set the video rate, that is the number of frames generated per second.
  20519. Default is 25.
  20520. @item random_fill_ratio, ratio
  20521. Set the random fill ratio for the initial cellular automaton row. It
  20522. is a floating point number value ranging from 0 to 1, defaults to
  20523. 1/PHI.
  20524. This option is ignored when a file or a pattern is specified.
  20525. @item random_seed, seed
  20526. Set the seed for filling randomly the initial row, must be an integer
  20527. included between 0 and UINT32_MAX. If not specified, or if explicitly
  20528. set to -1, the filter will try to use a good random seed on a best
  20529. effort basis.
  20530. @item rule
  20531. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  20532. Default value is 110.
  20533. @item size, s
  20534. Set the size of the output video. For the syntax of this option, check the
  20535. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20536. If @option{filename} or @option{pattern} is specified, the size is set
  20537. by default to the width of the specified initial state row, and the
  20538. height is set to @var{width} * PHI.
  20539. If @option{size} is set, it must contain the width of the specified
  20540. pattern string, and the specified pattern will be centered in the
  20541. larger row.
  20542. If a filename or a pattern string is not specified, the size value
  20543. defaults to "320x518" (used for a randomly generated initial state).
  20544. @item scroll
  20545. If set to 1, scroll the output upward when all the rows in the output
  20546. have been already filled. If set to 0, the new generated row will be
  20547. written over the top row just after the bottom row is filled.
  20548. Defaults to 1.
  20549. @item start_full, full
  20550. If set to 1, completely fill the output with generated rows before
  20551. outputting the first frame.
  20552. This is the default behavior, for disabling set the value to 0.
  20553. @item stitch
  20554. If set to 1, stitch the left and right row edges together.
  20555. This is the default behavior, for disabling set the value to 0.
  20556. @end table
  20557. @subsection Examples
  20558. @itemize
  20559. @item
  20560. Read the initial state from @file{pattern}, and specify an output of
  20561. size 200x400.
  20562. @example
  20563. cellauto=f=pattern:s=200x400
  20564. @end example
  20565. @item
  20566. Generate a random initial row with a width of 200 cells, with a fill
  20567. ratio of 2/3:
  20568. @example
  20569. cellauto=ratio=2/3:s=200x200
  20570. @end example
  20571. @item
  20572. Create a pattern generated by rule 18 starting by a single alive cell
  20573. centered on an initial row with width 100:
  20574. @example
  20575. cellauto=p=@@:s=100x400:full=0:rule=18
  20576. @end example
  20577. @item
  20578. Specify a more elaborated initial pattern:
  20579. @example
  20580. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  20581. @end example
  20582. @end itemize
  20583. @anchor{coreimagesrc}
  20584. @section coreimagesrc
  20585. Video source generated on GPU using Apple's CoreImage API on OSX.
  20586. This video source is a specialized version of the @ref{coreimage} video filter.
  20587. Use a core image generator at the beginning of the applied filterchain to
  20588. generate the content.
  20589. The coreimagesrc video source accepts the following options:
  20590. @table @option
  20591. @item list_generators
  20592. List all available generators along with all their respective options as well as
  20593. possible minimum and maximum values along with the default values.
  20594. @example
  20595. list_generators=true
  20596. @end example
  20597. @item size, s
  20598. Specify the size of the sourced video. For the syntax of this option, check the
  20599. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20600. The default value is @code{320x240}.
  20601. @item rate, r
  20602. Specify the frame rate of the sourced video, as the number of frames
  20603. generated per second. It has to be a string in the format
  20604. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  20605. number or a valid video frame rate abbreviation. The default value is
  20606. "25".
  20607. @item sar
  20608. Set the sample aspect ratio of the sourced video.
  20609. @item duration, d
  20610. Set the duration of the sourced video. See
  20611. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  20612. for the accepted syntax.
  20613. If not specified, or the expressed duration is negative, the video is
  20614. supposed to be generated forever.
  20615. @end table
  20616. Additionally, all options of the @ref{coreimage} video filter are accepted.
  20617. A complete filterchain can be used for further processing of the
  20618. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  20619. and examples for details.
  20620. @subsection Examples
  20621. @itemize
  20622. @item
  20623. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  20624. given as complete and escaped command-line for Apple's standard bash shell:
  20625. @example
  20626. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  20627. @end example
  20628. This example is equivalent to the QRCode example of @ref{coreimage} without the
  20629. need for a nullsrc video source.
  20630. @end itemize
  20631. @section ddagrab
  20632. Captures the Windows Desktop via Desktop Duplication API.
  20633. The filter exclusively returns D3D11 Hardware Frames, for on-gpu encoding
  20634. or processing. So an explicit @ref{hwdownload} is needed for any kind of
  20635. software processing.
  20636. It accepts the following options:
  20637. @table @option
  20638. @item output_idx
  20639. DXGI Output Index to capture.
  20640. Usually corresponds to the index Windows has given the screen minus one,
  20641. so it's starting at 0.
  20642. Defaults to output 0.
  20643. @item draw_mouse
  20644. Whether to draw the mouse cursor.
  20645. Defaults to true.
  20646. Only affects hardware cursors. If a game or application renders its own cursor,
  20647. it'll always be captured.
  20648. @item framerate
  20649. Framerate at which the desktop will be captured.
  20650. Defaults to 30 FPS.
  20651. @item video_size
  20652. Specify the size of the captured video.
  20653. Defaults to the full size of the screen.
  20654. Cropped from the bottom/right if smaller than screen size.
  20655. @item offset_x
  20656. Horizontal offset of the captured video.
  20657. @item offset_y
  20658. Vertical offset of the captured video.
  20659. @item output_fmt
  20660. Desired filter output format.
  20661. Defaults to 8 Bit BGRA.
  20662. It accepts the following values:
  20663. @table @samp
  20664. @item auto
  20665. Passes all supported output formats to DDA and returns what DDA decides to use.
  20666. @item 8bit
  20667. @item bgra
  20668. 8 Bit formats always work, and DDA will convert to them if neccesary.
  20669. @item 10bit
  20670. @item x2bgr10
  20671. Filter initialization will fail if 10 bit format is requested but unavailable.
  20672. @end table
  20673. @end table
  20674. @subsection Examples
  20675. Capture primary screen and encode using nvenc:
  20676. @example
  20677. ffmpeg -f lavfi -i ddagrab -c:v h264_nvenc -cq 18 output.mp4
  20678. @end example
  20679. You can also skip the lavfi device and directly use the filter.
  20680. Also demonstrates downloading the frame and encoding with libx264.
  20681. Explicit output format specification is required in this case:
  20682. @example
  20683. ffmpeg -filter_complex ddagrab=output_idx=1:framerate=60,hwdownload,format=bgra -c:v libx264 -crf 18 output.mp4
  20684. @end example
  20685. If you want to capture only a subsection of the desktop, this can be achieved
  20686. by specifying a smaller size and its offsets into the screen:
  20687. @example
  20688. ddagrab=video_size=800x600:offset_x=100:offset_y=100
  20689. @end example
  20690. @section gradients
  20691. Generate several gradients.
  20692. @table @option
  20693. @item size, s
  20694. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  20695. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  20696. @item rate, r
  20697. Set frame rate, expressed as number of frames per second. Default
  20698. value is "25".
  20699. @item c0, c1, c2, c3, c4, c5, c6, c7
  20700. Set 8 colors. Default values for colors is to pick random one.
  20701. @item x0, y0, y0, y1
  20702. Set gradient line source and destination points. If negative or out of range, random ones
  20703. are picked.
  20704. @item nb_colors, n
  20705. Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.
  20706. @item seed
  20707. Set seed for picking gradient line points.
  20708. @item duration, d
  20709. Set the duration of the sourced video. See
  20710. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  20711. for the accepted syntax.
  20712. If not specified, or the expressed duration is negative, the video is
  20713. supposed to be generated forever.
  20714. @item speed
  20715. Set speed of gradients rotation.
  20716. @item type, t
  20717. Set type of gradients, can be @code{linear} or @code{radial} or @code{circular} or @code{spiral}.
  20718. @end table
  20719. @section mandelbrot
  20720. Generate a Mandelbrot set fractal, and progressively zoom towards the
  20721. point specified with @var{start_x} and @var{start_y}.
  20722. This source accepts the following options:
  20723. @table @option
  20724. @item end_pts
  20725. Set the terminal pts value. Default value is 400.
  20726. @item end_scale
  20727. Set the terminal scale value.
  20728. Must be a floating point value. Default value is 0.3.
  20729. @item inner
  20730. Set the inner coloring mode, that is the algorithm used to draw the
  20731. Mandelbrot fractal internal region.
  20732. It shall assume one of the following values:
  20733. @table @option
  20734. @item black
  20735. Set black mode.
  20736. @item convergence
  20737. Show time until convergence.
  20738. @item mincol
  20739. Set color based on point closest to the origin of the iterations.
  20740. @item period
  20741. Set period mode.
  20742. @end table
  20743. Default value is @var{mincol}.
  20744. @item bailout
  20745. Set the bailout value. Default value is 10.0.
  20746. @item maxiter
  20747. Set the maximum of iterations performed by the rendering
  20748. algorithm. Default value is 7189.
  20749. @item outer
  20750. Set outer coloring mode.
  20751. It shall assume one of following values:
  20752. @table @option
  20753. @item iteration_count
  20754. Set iteration count mode.
  20755. @item normalized_iteration_count
  20756. set normalized iteration count mode.
  20757. @end table
  20758. Default value is @var{normalized_iteration_count}.
  20759. @item rate, r
  20760. Set frame rate, expressed as number of frames per second. Default
  20761. value is "25".
  20762. @item size, s
  20763. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  20764. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  20765. @item start_scale
  20766. Set the initial scale value. Default value is 3.0.
  20767. @item start_x
  20768. Set the initial x position. Must be a floating point value between
  20769. -100 and 100. Default value is -0.743643887037158704752191506114774.
  20770. @item start_y
  20771. Set the initial y position. Must be a floating point value between
  20772. -100 and 100. Default value is -0.131825904205311970493132056385139.
  20773. @end table
  20774. @section mptestsrc
  20775. Generate various test patterns, as generated by the MPlayer test filter.
  20776. The size of the generated video is fixed, and is 256x256.
  20777. This source is useful in particular for testing encoding features.
  20778. This source accepts the following options:
  20779. @table @option
  20780. @item rate, r
  20781. Specify the frame rate of the sourced video, as the number of frames
  20782. generated per second. It has to be a string in the format
  20783. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  20784. number or a valid video frame rate abbreviation. The default value is
  20785. "25".
  20786. @item duration, d
  20787. Set the duration of the sourced video. See
  20788. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  20789. for the accepted syntax.
  20790. If not specified, or the expressed duration is negative, the video is
  20791. supposed to be generated forever.
  20792. @item test, t
  20793. Set the number or the name of the test to perform. Supported tests are:
  20794. @table @option
  20795. @item dc_luma
  20796. @item dc_chroma
  20797. @item freq_luma
  20798. @item freq_chroma
  20799. @item amp_luma
  20800. @item amp_chroma
  20801. @item cbp
  20802. @item mv
  20803. @item ring1
  20804. @item ring2
  20805. @item all
  20806. @item max_frames, m
  20807. Set the maximum number of frames generated for each test, default value is 30.
  20808. @end table
  20809. Default value is "all", which will cycle through the list of all tests.
  20810. @end table
  20811. Some examples:
  20812. @example
  20813. mptestsrc=t=dc_luma
  20814. @end example
  20815. will generate a "dc_luma" test pattern.
  20816. @section frei0r_src
  20817. Provide a frei0r source.
  20818. To enable compilation of this filter you need to install the frei0r
  20819. header and configure FFmpeg with @code{--enable-frei0r}.
  20820. This source accepts the following parameters:
  20821. @table @option
  20822. @item size
  20823. The size of the video to generate. For the syntax of this option, check the
  20824. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20825. @item framerate
  20826. The framerate of the generated video. It may be a string of the form
  20827. @var{num}/@var{den} or a frame rate abbreviation.
  20828. @item filter_name
  20829. The name to the frei0r source to load. For more information regarding frei0r and
  20830. how to set the parameters, read the @ref{frei0r} section in the video filters
  20831. documentation.
  20832. @item filter_params
  20833. A '|'-separated list of parameters to pass to the frei0r source.
  20834. @end table
  20835. For example, to generate a frei0r partik0l source with size 200x200
  20836. and frame rate 10 which is overlaid on the overlay filter main input:
  20837. @example
  20838. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  20839. @end example
  20840. @section life
  20841. Generate a life pattern.
  20842. This source is based on a generalization of John Conway's life game.
  20843. The sourced input represents a life grid, each pixel represents a cell
  20844. which can be in one of two possible states, alive or dead. Every cell
  20845. interacts with its eight neighbours, which are the cells that are
  20846. horizontally, vertically, or diagonally adjacent.
  20847. At each interaction the grid evolves according to the adopted rule,
  20848. which specifies the number of neighbor alive cells which will make a
  20849. cell stay alive or born. The @option{rule} option allows one to specify
  20850. the rule to adopt.
  20851. This source accepts the following options:
  20852. @table @option
  20853. @item filename, f
  20854. Set the file from which to read the initial grid state. In the file,
  20855. each non-whitespace character is considered an alive cell, and newline
  20856. is used to delimit the end of each row.
  20857. If this option is not specified, the initial grid is generated
  20858. randomly.
  20859. @item rate, r
  20860. Set the video rate, that is the number of frames generated per second.
  20861. Default is 25.
  20862. @item random_fill_ratio, ratio
  20863. Set the random fill ratio for the initial random grid. It is a
  20864. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  20865. It is ignored when a file is specified.
  20866. @item random_seed, seed
  20867. Set the seed for filling the initial random grid, must be an integer
  20868. included between 0 and UINT32_MAX. If not specified, or if explicitly
  20869. set to -1, the filter will try to use a good random seed on a best
  20870. effort basis.
  20871. @item rule
  20872. Set the life rule.
  20873. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  20874. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  20875. @var{NS} specifies the number of alive neighbor cells which make a
  20876. live cell stay alive, and @var{NB} the number of alive neighbor cells
  20877. which make a dead cell to become alive (i.e. to "born").
  20878. "s" and "b" can be used in place of "S" and "B", respectively.
  20879. Alternatively a rule can be specified by an 18-bits integer. The 9
  20880. high order bits are used to encode the next cell state if it is alive
  20881. for each number of neighbor alive cells, the low order bits specify
  20882. the rule for "borning" new cells. Higher order bits encode for an
  20883. higher number of neighbor cells.
  20884. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  20885. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  20886. Default value is "S23/B3", which is the original Conway's game of life
  20887. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  20888. cells, and will born a new cell if there are three alive cells around
  20889. a dead cell.
  20890. @item size, s
  20891. Set the size of the output video. For the syntax of this option, check the
  20892. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20893. If @option{filename} is specified, the size is set by default to the
  20894. same size of the input file. If @option{size} is set, it must contain
  20895. the size specified in the input file, and the initial grid defined in
  20896. that file is centered in the larger resulting area.
  20897. If a filename is not specified, the size value defaults to "320x240"
  20898. (used for a randomly generated initial grid).
  20899. @item stitch
  20900. If set to 1, stitch the left and right grid edges together, and the
  20901. top and bottom edges also. Defaults to 1.
  20902. @item mold
  20903. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  20904. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  20905. value from 0 to 255.
  20906. @item life_color
  20907. Set the color of living (or new born) cells.
  20908. @item death_color
  20909. Set the color of dead cells. If @option{mold} is set, this is the first color
  20910. used to represent a dead cell.
  20911. @item mold_color
  20912. Set mold color, for definitely dead and moldy cells.
  20913. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  20914. ffmpeg-utils manual,ffmpeg-utils}.
  20915. @end table
  20916. @subsection Examples
  20917. @itemize
  20918. @item
  20919. Read a grid from @file{pattern}, and center it on a grid of size
  20920. 300x300 pixels:
  20921. @example
  20922. life=f=pattern:s=300x300
  20923. @end example
  20924. @item
  20925. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  20926. @example
  20927. life=ratio=2/3:s=200x200
  20928. @end example
  20929. @item
  20930. Specify a custom rule for evolving a randomly generated grid:
  20931. @example
  20932. life=rule=S14/B34
  20933. @end example
  20934. @item
  20935. Full example with slow death effect (mold) using @command{ffplay}:
  20936. @example
  20937. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  20938. @end example
  20939. @end itemize
  20940. @anchor{allrgb}
  20941. @anchor{allyuv}
  20942. @anchor{color}
  20943. @anchor{colorchart}
  20944. @anchor{colorspectrum}
  20945. @anchor{haldclutsrc}
  20946. @anchor{nullsrc}
  20947. @anchor{pal75bars}
  20948. @anchor{pal100bars}
  20949. @anchor{rgbtestsrc}
  20950. @anchor{smptebars}
  20951. @anchor{smptehdbars}
  20952. @anchor{testsrc}
  20953. @anchor{testsrc2}
  20954. @anchor{yuvtestsrc}
  20955. @section allrgb, allyuv, color, colorchart, colorspectrum, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  20956. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  20957. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  20958. The @code{color} source provides an uniformly colored input.
  20959. The @code{colorchart} source provides a colors checker chart.
  20960. The @code{colorspectrum} source provides a color spectrum input.
  20961. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  20962. @ref{haldclut} filter.
  20963. The @code{nullsrc} source returns unprocessed video frames. It is
  20964. mainly useful to be employed in analysis / debugging tools, or as the
  20965. source for filters which ignore the input data.
  20966. The @code{pal75bars} source generates a color bars pattern, based on
  20967. EBU PAL recommendations with 75% color levels.
  20968. The @code{pal100bars} source generates a color bars pattern, based on
  20969. EBU PAL recommendations with 100% color levels.
  20970. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  20971. detecting RGB vs BGR issues. You should see a red, green and blue
  20972. stripe from top to bottom.
  20973. The @code{smptebars} source generates a color bars pattern, based on
  20974. the SMPTE Engineering Guideline EG 1-1990.
  20975. The @code{smptehdbars} source generates a color bars pattern, based on
  20976. the SMPTE RP 219-2002.
  20977. The @code{testsrc} source generates a test video pattern, showing a
  20978. color pattern, a scrolling gradient and a timestamp. This is mainly
  20979. intended for testing purposes.
  20980. The @code{testsrc2} source is similar to testsrc, but supports more
  20981. pixel formats instead of just @code{rgb24}. This allows using it as an
  20982. input for other tests without requiring a format conversion.
  20983. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  20984. see a y, cb and cr stripe from top to bottom.
  20985. The sources accept the following parameters:
  20986. @table @option
  20987. @item level
  20988. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  20989. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  20990. pixels to be used as identity matrix for 3D lookup tables. Each component is
  20991. coded on a @code{1/(N*N)} scale.
  20992. @item color, c
  20993. Specify the color of the source, only available in the @code{color}
  20994. source. For the syntax of this option, check the
  20995. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20996. @item size, s
  20997. Specify the size of the sourced video. For the syntax of this option, check the
  20998. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20999. The default value is @code{320x240}.
  21000. This option is not available with the @code{allrgb}, @code{allyuv}, and
  21001. @code{haldclutsrc} filters.
  21002. @item rate, r
  21003. Specify the frame rate of the sourced video, as the number of frames
  21004. generated per second. It has to be a string in the format
  21005. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  21006. number or a valid video frame rate abbreviation. The default value is
  21007. "25".
  21008. @item duration, d
  21009. Set the duration of the sourced video. See
  21010. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  21011. for the accepted syntax.
  21012. If not specified, or the expressed duration is negative, the video is
  21013. supposed to be generated forever.
  21014. Since the frame rate is used as time base, all frames including the last one
  21015. will have their full duration. If the specified duration is not a multiple
  21016. of the frame duration, it will be rounded up.
  21017. @item sar
  21018. Set the sample aspect ratio of the sourced video.
  21019. @item alpha
  21020. Specify the alpha (opacity) of the background, only available in the
  21021. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  21022. 255 (fully opaque, the default).
  21023. @item decimals, n
  21024. Set the number of decimals to show in the timestamp, only available in the
  21025. @code{testsrc} source.
  21026. The displayed timestamp value will correspond to the original
  21027. timestamp value multiplied by the power of 10 of the specified
  21028. value. Default value is 0.
  21029. @item type
  21030. Set the type of the color spectrum, only available in the
  21031. @code{colorspectrum} source. Can be one of the following:
  21032. @table @samp
  21033. @item black
  21034. @item white
  21035. @item all
  21036. @end table
  21037. @item patch_size
  21038. Set patch size of single color patch, only available in the
  21039. @code{colorchart} source. Default is @code{64x64}.
  21040. @item preset
  21041. Set colorchecker colors preset, only available in the
  21042. @code{colorchart} source.
  21043. Available values are:
  21044. @table @samp
  21045. @item reference
  21046. @item skintones
  21047. @end table
  21048. Default value is @code{reference}.
  21049. @end table
  21050. @subsection Examples
  21051. @itemize
  21052. @item
  21053. Generate a video with a duration of 5.3 seconds, with size
  21054. 176x144 and a frame rate of 10 frames per second:
  21055. @example
  21056. testsrc=duration=5.3:size=qcif:rate=10
  21057. @end example
  21058. @item
  21059. The following graph description will generate a red source
  21060. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  21061. frames per second:
  21062. @example
  21063. color=c=red@@0.2:s=qcif:r=10
  21064. @end example
  21065. @item
  21066. If the input content is to be ignored, @code{nullsrc} can be used. The
  21067. following command generates noise in the luminance plane by employing
  21068. the @code{geq} filter:
  21069. @example
  21070. nullsrc=s=256x256, geq=random(1)*255:128:128
  21071. @end example
  21072. @end itemize
  21073. @subsection Commands
  21074. The @code{color} source supports the following commands:
  21075. @table @option
  21076. @item c, color
  21077. Set the color of the created image. Accepts the same syntax of the
  21078. corresponding @option{color} option.
  21079. @end table
  21080. @section openclsrc
  21081. Generate video using an OpenCL program.
  21082. @table @option
  21083. @item source
  21084. OpenCL program source file.
  21085. @item kernel
  21086. Kernel name in program.
  21087. @item size, s
  21088. Size of frames to generate. This must be set.
  21089. @item format
  21090. Pixel format to use for the generated frames. This must be set.
  21091. @item rate, r
  21092. Number of frames generated every second. Default value is '25'.
  21093. @end table
  21094. For details of how the program loading works, see the @ref{program_opencl}
  21095. filter.
  21096. Example programs:
  21097. @itemize
  21098. @item
  21099. Generate a colour ramp by setting pixel values from the position of the pixel
  21100. in the output image. (Note that this will work with all pixel formats, but
  21101. the generated output will not be the same.)
  21102. @verbatim
  21103. __kernel void ramp(__write_only image2d_t dst,
  21104. unsigned int index)
  21105. {
  21106. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  21107. float4 val;
  21108. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  21109. write_imagef(dst, loc, val);
  21110. }
  21111. @end verbatim
  21112. @item
  21113. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  21114. @verbatim
  21115. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  21116. unsigned int index)
  21117. {
  21118. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  21119. float4 value = 0.0f;
  21120. int x = loc.x + index;
  21121. int y = loc.y + index;
  21122. while (x > 0 || y > 0) {
  21123. if (x % 3 == 1 && y % 3 == 1) {
  21124. value = 1.0f;
  21125. break;
  21126. }
  21127. x /= 3;
  21128. y /= 3;
  21129. }
  21130. write_imagef(dst, loc, value);
  21131. }
  21132. @end verbatim
  21133. @end itemize
  21134. @section sierpinski
  21135. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  21136. This source accepts the following options:
  21137. @table @option
  21138. @item size, s
  21139. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  21140. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  21141. @item rate, r
  21142. Set frame rate, expressed as number of frames per second. Default
  21143. value is "25".
  21144. @item seed
  21145. Set seed which is used for random panning.
  21146. @item jump
  21147. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  21148. @item type
  21149. Set fractal type, can be default @code{carpet} or @code{triangle}.
  21150. @end table
  21151. @c man end VIDEO SOURCES
  21152. @chapter Video Sinks
  21153. @c man begin VIDEO SINKS
  21154. Below is a description of the currently available video sinks.
  21155. @section buffersink
  21156. Buffer video frames, and make them available to the end of the filter
  21157. graph.
  21158. This sink is mainly intended for programmatic use, in particular
  21159. through the interface defined in @file{libavfilter/buffersink.h}
  21160. or the options system.
  21161. It accepts a pointer to an AVBufferSinkContext structure, which
  21162. defines the incoming buffers' formats, to be passed as the opaque
  21163. parameter to @code{avfilter_init_filter} for initialization.
  21164. @section nullsink
  21165. Null video sink: do absolutely nothing with the input video. It is
  21166. mainly useful as a template and for use in analysis / debugging
  21167. tools.
  21168. @c man end VIDEO SINKS
  21169. @chapter Multimedia Filters
  21170. @c man begin MULTIMEDIA FILTERS
  21171. Below is a description of the currently available multimedia filters.
  21172. @section a3dscope
  21173. Convert input audio to 3d scope video output.
  21174. The filter accepts the following options:
  21175. @table @option
  21176. @item rate, r
  21177. Set frame rate, expressed as number of frames per second. Default
  21178. value is "25".
  21179. @item size, s
  21180. Specify the video size for the output. For the syntax of this option, check the
  21181. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21182. Default value is @code{hd720}.
  21183. @item fov
  21184. Set the camera field of view. Default is 90 degrees.
  21185. Allowed range is from 40 to 150.
  21186. @item roll
  21187. Set the camera roll.
  21188. @item pitch
  21189. Set the camera pitch.
  21190. @item yaw
  21191. Set the camera yaw.
  21192. @item xzoom
  21193. Set the camera zoom on X-axis.
  21194. @item yzoom
  21195. Set the camera zoom on Y-axis.
  21196. @item zzoom
  21197. Set the camera zoom on Z-axis.
  21198. @item xpos
  21199. Set the camera position on X-axis.
  21200. @item ypos
  21201. Set the camera position on Y-axis.
  21202. @item zpos
  21203. Set the camera position on Z-axis.
  21204. @item length
  21205. Set the length of displayed audio waves in number of frames.
  21206. @end table
  21207. @subsection Commands
  21208. Filter supports the some above options as @ref{commands}.
  21209. @section abitscope
  21210. Convert input audio to a video output, displaying the audio bit scope.
  21211. The filter accepts the following options:
  21212. @table @option
  21213. @item rate, r
  21214. Set frame rate, expressed as number of frames per second. Default
  21215. value is "25".
  21216. @item size, s
  21217. Specify the video size for the output. For the syntax of this option, check the
  21218. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21219. Default value is @code{1024x256}.
  21220. @item colors
  21221. Specify list of colors separated by space or by '|' which will be used to
  21222. draw channels. Unrecognized or missing colors will be replaced
  21223. by white color.
  21224. @item mode, m
  21225. Set output mode. Can be @code{bars} or @code{trace}. Default is @code{bars}.
  21226. @end table
  21227. @section adrawgraph
  21228. Draw a graph using input audio metadata.
  21229. See @ref{drawgraph}
  21230. @section agraphmonitor
  21231. See @ref{graphmonitor}.
  21232. @section ahistogram
  21233. Convert input audio to a video output, displaying the volume histogram.
  21234. The filter accepts the following options:
  21235. @table @option
  21236. @item dmode
  21237. Specify how histogram is calculated.
  21238. It accepts the following values:
  21239. @table @samp
  21240. @item single
  21241. Use single histogram for all channels.
  21242. @item separate
  21243. Use separate histogram for each channel.
  21244. @end table
  21245. Default is @code{single}.
  21246. @item rate, r
  21247. Set frame rate, expressed as number of frames per second. Default
  21248. value is "25".
  21249. @item size, s
  21250. Specify the video size for the output. For the syntax of this option, check the
  21251. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21252. Default value is @code{hd720}.
  21253. @item scale
  21254. Set display scale.
  21255. It accepts the following values:
  21256. @table @samp
  21257. @item log
  21258. logarithmic
  21259. @item sqrt
  21260. square root
  21261. @item cbrt
  21262. cubic root
  21263. @item lin
  21264. linear
  21265. @item rlog
  21266. reverse logarithmic
  21267. @end table
  21268. Default is @code{log}.
  21269. @item ascale
  21270. Set amplitude scale.
  21271. It accepts the following values:
  21272. @table @samp
  21273. @item log
  21274. logarithmic
  21275. @item lin
  21276. linear
  21277. @end table
  21278. Default is @code{log}.
  21279. @item acount
  21280. Set how much frames to accumulate in histogram.
  21281. Default is 1. Setting this to -1 accumulates all frames.
  21282. @item rheight
  21283. Set histogram ratio of window height.
  21284. @item slide
  21285. Set sonogram sliding.
  21286. It accepts the following values:
  21287. @table @samp
  21288. @item replace
  21289. replace old rows with new ones.
  21290. @item scroll
  21291. scroll from top to bottom.
  21292. @end table
  21293. Default is @code{replace}.
  21294. @item hmode
  21295. Set histogram mode.
  21296. It accepts the following values:
  21297. @table @samp
  21298. @item abs
  21299. Use absolute values of samples.
  21300. @item sign
  21301. Use untouched values of samples.
  21302. @end table
  21303. Default is @code{abs}.
  21304. @end table
  21305. @section aphasemeter
  21306. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  21307. representing mean phase of current audio frame. A video output can also be produced and is
  21308. enabled by default. The audio is passed through as first output.
  21309. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  21310. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  21311. and @code{1} means channels are in phase.
  21312. The filter accepts the following options, all related to its video output:
  21313. @table @option
  21314. @item rate, r
  21315. Set the output frame rate. Default value is @code{25}.
  21316. @item size, s
  21317. Set the video size for the output. For the syntax of this option, check the
  21318. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21319. Default value is @code{800x400}.
  21320. @item rc
  21321. @item gc
  21322. @item bc
  21323. Specify the red, green, blue contrast. Default values are @code{2},
  21324. @code{7} and @code{1}.
  21325. Allowed range is @code{[0, 255]}.
  21326. @item mpc
  21327. Set color which will be used for drawing median phase. If color is
  21328. @code{none} which is default, no median phase value will be drawn.
  21329. @item video
  21330. Enable video output. Default is enabled.
  21331. @end table
  21332. @subsection phasing detection
  21333. The filter also detects out of phase and mono sequences in stereo streams.
  21334. It logs the sequence start, end and duration when it lasts longer or as long as the minimum set.
  21335. The filter accepts the following options for this detection:
  21336. @table @option
  21337. @item phasing
  21338. Enable mono and out of phase detection. Default is disabled.
  21339. @item tolerance, t
  21340. Set phase tolerance for mono detection, in amplitude ratio. Default is @code{0}.
  21341. Allowed range is @code{[0, 1]}.
  21342. @item angle, a
  21343. Set angle threshold for out of phase detection, in degree. Default is @code{170}.
  21344. Allowed range is @code{[90, 180]}.
  21345. @item duration, d
  21346. Set mono or out of phase duration until notification, expressed in seconds. Default is @code{2}.
  21347. @end table
  21348. @subsection Examples
  21349. @itemize
  21350. @item
  21351. Complete example with @command{ffmpeg} to detect 1 second of mono with 0.001 phase tolerance:
  21352. @example
  21353. ffmpeg -i stereo.wav -af aphasemeter=video=0:phasing=1:duration=1:tolerance=0.001 -f null -
  21354. @end example
  21355. @end itemize
  21356. @section avectorscope
  21357. Convert input audio to a video output, representing the audio vector
  21358. scope.
  21359. The filter is used to measure the difference between channels of stereo
  21360. audio stream. A monaural signal, consisting of identical left and right
  21361. signal, results in straight vertical line. Any stereo separation is visible
  21362. as a deviation from this line, creating a Lissajous figure.
  21363. If the straight (or deviation from it) but horizontal line appears this
  21364. indicates that the left and right channels are out of phase.
  21365. The filter accepts the following options:
  21366. @table @option
  21367. @item mode, m
  21368. Set the vectorscope mode.
  21369. Available values are:
  21370. @table @samp
  21371. @item lissajous
  21372. Lissajous rotated by 45 degrees.
  21373. @item lissajous_xy
  21374. Same as above but not rotated.
  21375. @item polar
  21376. Shape resembling half of circle.
  21377. @end table
  21378. Default value is @samp{lissajous}.
  21379. @item size, s
  21380. Set the video size for the output. For the syntax of this option, check the
  21381. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21382. Default value is @code{400x400}.
  21383. @item rate, r
  21384. Set the output frame rate. Default value is @code{25}.
  21385. @item rc
  21386. @item gc
  21387. @item bc
  21388. @item ac
  21389. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  21390. @code{160}, @code{80} and @code{255}.
  21391. Allowed range is @code{[0, 255]}.
  21392. @item rf
  21393. @item gf
  21394. @item bf
  21395. @item af
  21396. Specify the red, green, blue and alpha fade. Default values are @code{15},
  21397. @code{10}, @code{5} and @code{5}.
  21398. Allowed range is @code{[0, 255]}.
  21399. @item zoom
  21400. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  21401. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  21402. @item draw
  21403. Set the vectorscope drawing mode.
  21404. Available values are:
  21405. @table @samp
  21406. @item dot
  21407. Draw dot for each sample.
  21408. @item line
  21409. Draw line between previous and current sample.
  21410. @item aaline
  21411. Draw anti-aliased line between previous and current sample.
  21412. @end table
  21413. Default value is @samp{dot}.
  21414. @item scale
  21415. Specify amplitude scale of audio samples.
  21416. Available values are:
  21417. @table @samp
  21418. @item lin
  21419. Linear.
  21420. @item sqrt
  21421. Square root.
  21422. @item cbrt
  21423. Cubic root.
  21424. @item log
  21425. Logarithmic.
  21426. @end table
  21427. @item swap
  21428. Swap left channel axis with right channel axis.
  21429. @item mirror
  21430. Mirror axis.
  21431. @table @samp
  21432. @item none
  21433. No mirror.
  21434. @item x
  21435. Mirror only x axis.
  21436. @item y
  21437. Mirror only y axis.
  21438. @item xy
  21439. Mirror both axis.
  21440. @end table
  21441. @end table
  21442. @subsection Examples
  21443. @itemize
  21444. @item
  21445. Complete example using @command{ffplay}:
  21446. @example
  21447. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  21448. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  21449. @end example
  21450. @end itemize
  21451. @subsection Commands
  21452. This filter supports the all above options as commands except options @code{size} and @code{rate}.
  21453. @section bench, abench
  21454. Benchmark part of a filtergraph.
  21455. The filter accepts the following options:
  21456. @table @option
  21457. @item action
  21458. Start or stop a timer.
  21459. Available values are:
  21460. @table @samp
  21461. @item start
  21462. Get the current time, set it as frame metadata (using the key
  21463. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  21464. @item stop
  21465. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  21466. the input frame metadata to get the time difference. Time difference, average,
  21467. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  21468. @code{min}) are then printed. The timestamps are expressed in seconds.
  21469. @end table
  21470. @end table
  21471. @subsection Examples
  21472. @itemize
  21473. @item
  21474. Benchmark @ref{selectivecolor} filter:
  21475. @example
  21476. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  21477. @end example
  21478. @end itemize
  21479. @section concat
  21480. Concatenate audio and video streams, joining them together one after the
  21481. other.
  21482. The filter works on segments of synchronized video and audio streams. All
  21483. segments must have the same number of streams of each type, and that will
  21484. also be the number of streams at output.
  21485. The filter accepts the following options:
  21486. @table @option
  21487. @item n
  21488. Set the number of segments. Default is 2.
  21489. @item v
  21490. Set the number of output video streams, that is also the number of video
  21491. streams in each segment. Default is 1.
  21492. @item a
  21493. Set the number of output audio streams, that is also the number of audio
  21494. streams in each segment. Default is 0.
  21495. @item unsafe
  21496. Activate unsafe mode: do not fail if segments have a different format.
  21497. @end table
  21498. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  21499. @var{a} audio outputs.
  21500. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  21501. segment, in the same order as the outputs, then the inputs for the second
  21502. segment, etc.
  21503. Related streams do not always have exactly the same duration, for various
  21504. reasons including codec frame size or sloppy authoring. For that reason,
  21505. related synchronized streams (e.g. a video and its audio track) should be
  21506. concatenated at once. The concat filter will use the duration of the longest
  21507. stream in each segment (except the last one), and if necessary pad shorter
  21508. audio streams with silence.
  21509. For this filter to work correctly, all segments must start at timestamp 0.
  21510. All corresponding streams must have the same parameters in all segments; the
  21511. filtering system will automatically select a common pixel format for video
  21512. streams, and a common sample format, sample rate and channel layout for
  21513. audio streams, but other settings, such as resolution, must be converted
  21514. explicitly by the user.
  21515. Different frame rates are acceptable but will result in variable frame rate
  21516. at output; be sure to configure the output file to handle it.
  21517. @subsection Examples
  21518. @itemize
  21519. @item
  21520. Concatenate an opening, an episode and an ending, all in bilingual version
  21521. (video in stream 0, audio in streams 1 and 2):
  21522. @example
  21523. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  21524. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  21525. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  21526. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  21527. @end example
  21528. @item
  21529. Concatenate two parts, handling audio and video separately, using the
  21530. (a)movie sources, and adjusting the resolution:
  21531. @example
  21532. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  21533. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  21534. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  21535. @end example
  21536. Note that a desync will happen at the stitch if the audio and video streams
  21537. do not have exactly the same duration in the first file.
  21538. @end itemize
  21539. @subsection Commands
  21540. This filter supports the following commands:
  21541. @table @option
  21542. @item next
  21543. Close the current segment and step to the next one
  21544. @end table
  21545. @anchor{ebur128}
  21546. @section ebur128
  21547. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  21548. level. By default, it logs a message at a frequency of 10Hz with the
  21549. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  21550. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  21551. The filter can only analyze streams which have
  21552. sample format is double-precision floating point. The input stream will be converted to
  21553. this specification, if needed. Users may need to insert aformat and/or aresample filters
  21554. after this filter to obtain the original parameters.
  21555. The filter also has a video output (see the @var{video} option) with a real
  21556. time graph to observe the loudness evolution. The graphic contains the logged
  21557. message mentioned above, so it is not printed anymore when this option is set,
  21558. unless the verbose logging is set. The main graphing area contains the
  21559. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  21560. the momentary loudness (400 milliseconds), but can optionally be configured
  21561. to instead display short-term loudness (see @var{gauge}).
  21562. The green area marks a +/- 1LU target range around the target loudness
  21563. (-23LUFS by default, unless modified through @var{target}).
  21564. More information about the Loudness Recommendation EBU R128 on
  21565. @url{http://tech.ebu.ch/loudness}.
  21566. The filter accepts the following options:
  21567. @table @option
  21568. @item video
  21569. Activate the video output. The audio stream is passed unchanged whether this
  21570. option is set or no. The video stream will be the first output stream if
  21571. activated. Default is @code{0}.
  21572. @item size
  21573. Set the video size. This option is for video only. For the syntax of this
  21574. option, check the
  21575. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21576. Default and minimum resolution is @code{640x480}.
  21577. @item meter
  21578. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  21579. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  21580. other integer value between this range is allowed.
  21581. @item metadata
  21582. Set metadata injection. If set to @code{1}, the audio input will be segmented
  21583. into 100ms output frames, each of them containing various loudness information
  21584. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  21585. Default is @code{0}.
  21586. @item framelog
  21587. Force the frame logging level.
  21588. Available values are:
  21589. @table @samp
  21590. @item quiet
  21591. logging disabled
  21592. @item info
  21593. information logging level
  21594. @item verbose
  21595. verbose logging level
  21596. @end table
  21597. By default, the logging level is set to @var{info}. If the @option{video} or
  21598. the @option{metadata} options are set, it switches to @var{verbose}.
  21599. @item peak
  21600. Set peak mode(s).
  21601. Available modes can be cumulated (the option is a @code{flag} type). Possible
  21602. values are:
  21603. @table @samp
  21604. @item none
  21605. Disable any peak mode (default).
  21606. @item sample
  21607. Enable sample-peak mode.
  21608. Simple peak mode looking for the higher sample value. It logs a message
  21609. for sample-peak (identified by @code{SPK}).
  21610. @item true
  21611. Enable true-peak mode.
  21612. If enabled, the peak lookup is done on an over-sampled version of the input
  21613. stream for better peak accuracy. It logs a message for true-peak.
  21614. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  21615. This mode requires a build with @code{libswresample}.
  21616. @end table
  21617. @item dualmono
  21618. Treat mono input files as "dual mono". If a mono file is intended for playback
  21619. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  21620. If set to @code{true}, this option will compensate for this effect.
  21621. Multi-channel input files are not affected by this option.
  21622. @item panlaw
  21623. Set a specific pan law to be used for the measurement of dual mono files.
  21624. This parameter is optional, and has a default value of -3.01dB.
  21625. @item target
  21626. Set a specific target level (in LUFS) used as relative zero in the visualization.
  21627. This parameter is optional and has a default value of -23LUFS as specified
  21628. by EBU R128. However, material published online may prefer a level of -16LUFS
  21629. (e.g. for use with podcasts or video platforms).
  21630. @item gauge
  21631. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  21632. @code{shortterm}. By default the momentary value will be used, but in certain
  21633. scenarios it may be more useful to observe the short term value instead (e.g.
  21634. live mixing).
  21635. @item scale
  21636. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  21637. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  21638. video output, not the summary or continuous log output.
  21639. @end table
  21640. @subsection Examples
  21641. @itemize
  21642. @item
  21643. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  21644. @example
  21645. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  21646. @end example
  21647. @item
  21648. Run an analysis with @command{ffmpeg}:
  21649. @example
  21650. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  21651. @end example
  21652. @end itemize
  21653. @section interleave, ainterleave
  21654. Temporally interleave frames from several inputs.
  21655. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  21656. These filters read frames from several inputs and send the oldest
  21657. queued frame to the output.
  21658. Input streams must have well defined, monotonically increasing frame
  21659. timestamp values.
  21660. In order to submit one frame to output, these filters need to enqueue
  21661. at least one frame for each input, so they cannot work in case one
  21662. input is not yet terminated and will not receive incoming frames.
  21663. For example consider the case when one input is a @code{select} filter
  21664. which always drops input frames. The @code{interleave} filter will keep
  21665. reading from that input, but it will never be able to send new frames
  21666. to output until the input sends an end-of-stream signal.
  21667. Also, depending on inputs synchronization, the filters will drop
  21668. frames in case one input receives more frames than the other ones, and
  21669. the queue is already filled.
  21670. These filters accept the following options:
  21671. @table @option
  21672. @item nb_inputs, n
  21673. Set the number of different inputs, it is 2 by default.
  21674. @item duration
  21675. How to determine the end-of-stream.
  21676. @table @option
  21677. @item longest
  21678. The duration of the longest input. (default)
  21679. @item shortest
  21680. The duration of the shortest input.
  21681. @item first
  21682. The duration of the first input.
  21683. @end table
  21684. @end table
  21685. @subsection Examples
  21686. @itemize
  21687. @item
  21688. Interleave frames belonging to different streams using @command{ffmpeg}:
  21689. @example
  21690. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  21691. @end example
  21692. @item
  21693. Add flickering blur effect:
  21694. @example
  21695. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  21696. @end example
  21697. @end itemize
  21698. @section latency, alatency
  21699. Measure filtering latency.
  21700. Report previous filter filtering latency, delay in number of audio samples for audio filters
  21701. or number of video frames for video filters.
  21702. On end of input stream, filter will report min and max measured latency for previous running filter
  21703. in filtergraph.
  21704. @section metadata, ametadata
  21705. Manipulate frame metadata.
  21706. This filter accepts the following options:
  21707. @table @option
  21708. @item mode
  21709. Set mode of operation of the filter.
  21710. Can be one of the following:
  21711. @table @samp
  21712. @item select
  21713. If both @code{value} and @code{key} is set, select frames
  21714. which have such metadata. If only @code{key} is set, select
  21715. every frame that has such key in metadata.
  21716. @item add
  21717. Add new metadata @code{key} and @code{value}. If key is already available
  21718. do nothing.
  21719. @item modify
  21720. Modify value of already present key.
  21721. @item delete
  21722. If @code{value} is set, delete only keys that have such value.
  21723. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  21724. the frame.
  21725. @item print
  21726. Print key and its value if metadata was found. If @code{key} is not set print all
  21727. metadata values available in frame.
  21728. @end table
  21729. @item key
  21730. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  21731. @item value
  21732. Set metadata value which will be used. This option is mandatory for
  21733. @code{modify} and @code{add} mode.
  21734. @item function
  21735. Which function to use when comparing metadata value and @code{value}.
  21736. Can be one of following:
  21737. @table @samp
  21738. @item same_str
  21739. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  21740. @item starts_with
  21741. Values are interpreted as strings, returns true if metadata value starts with
  21742. the @code{value} option string.
  21743. @item less
  21744. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  21745. @item equal
  21746. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  21747. @item greater
  21748. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  21749. @item expr
  21750. Values are interpreted as floats, returns true if expression from option @code{expr}
  21751. evaluates to true.
  21752. @item ends_with
  21753. Values are interpreted as strings, returns true if metadata value ends with
  21754. the @code{value} option string.
  21755. @end table
  21756. @item expr
  21757. Set expression which is used when @code{function} is set to @code{expr}.
  21758. The expression is evaluated through the eval API and can contain the following
  21759. constants:
  21760. @table @option
  21761. @item VALUE1, FRAMEVAL
  21762. Float representation of @code{value} from metadata key.
  21763. @item VALUE2, USERVAL
  21764. Float representation of @code{value} as supplied by user in @code{value} option.
  21765. @end table
  21766. @item file
  21767. If specified in @code{print} mode, output is written to the named file. Instead of
  21768. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  21769. for standard output. If @code{file} option is not set, output is written to the log
  21770. with AV_LOG_INFO loglevel.
  21771. @item direct
  21772. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  21773. @end table
  21774. @subsection Examples
  21775. @itemize
  21776. @item
  21777. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  21778. between 0 and 1.
  21779. @example
  21780. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  21781. @end example
  21782. @item
  21783. Print silencedetect output to file @file{metadata.txt}.
  21784. @example
  21785. silencedetect,ametadata=mode=print:file=metadata.txt
  21786. @end example
  21787. @item
  21788. Direct all metadata to a pipe with file descriptor 4.
  21789. @example
  21790. metadata=mode=print:file='pipe\:4'
  21791. @end example
  21792. @end itemize
  21793. @section perms, aperms
  21794. Set read/write permissions for the output frames.
  21795. These filters are mainly aimed at developers to test direct path in the
  21796. following filter in the filtergraph.
  21797. The filters accept the following options:
  21798. @table @option
  21799. @item mode
  21800. Select the permissions mode.
  21801. It accepts the following values:
  21802. @table @samp
  21803. @item none
  21804. Do nothing. This is the default.
  21805. @item ro
  21806. Set all the output frames read-only.
  21807. @item rw
  21808. Set all the output frames directly writable.
  21809. @item toggle
  21810. Make the frame read-only if writable, and writable if read-only.
  21811. @item random
  21812. Set each output frame read-only or writable randomly.
  21813. @end table
  21814. @item seed
  21815. Set the seed for the @var{random} mode, must be an integer included between
  21816. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  21817. @code{-1}, the filter will try to use a good random seed on a best effort
  21818. basis.
  21819. @end table
  21820. Note: in case of auto-inserted filter between the permission filter and the
  21821. following one, the permission might not be received as expected in that
  21822. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  21823. perms/aperms filter can avoid this problem.
  21824. @section realtime, arealtime
  21825. Slow down filtering to match real time approximately.
  21826. These filters will pause the filtering for a variable amount of time to
  21827. match the output rate with the input timestamps.
  21828. They are similar to the @option{re} option to @code{ffmpeg}.
  21829. They accept the following options:
  21830. @table @option
  21831. @item limit
  21832. Time limit for the pauses. Any pause longer than that will be considered
  21833. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  21834. @item speed
  21835. Speed factor for processing. The value must be a float larger than zero.
  21836. Values larger than 1.0 will result in faster than realtime processing,
  21837. smaller will slow processing down. The @var{limit} is automatically adapted
  21838. accordingly. Default is 1.0.
  21839. A processing speed faster than what is possible without these filters cannot
  21840. be achieved.
  21841. @end table
  21842. @subsection Commands
  21843. Both filters supports the all above options as @ref{commands}.
  21844. @section segment, asegment
  21845. Split single input stream into multiple streams.
  21846. This filter does opposite of concat filters.
  21847. @code{segment} works on video frames, @code{asegment} on audio samples.
  21848. This filter accepts the following options:
  21849. @table @option
  21850. @item timestamps
  21851. Timestamps of output segments separated by '|'. The first segment will run
  21852. from the beginning of the input stream. The last segment will run until
  21853. the end of the input stream
  21854. @item frames, samples
  21855. Exact frame/sample count to split the segments.
  21856. @end table
  21857. In all cases, prefixing an each segment with '+' will make it relative to the
  21858. previous segment.
  21859. @subsection Examples
  21860. @itemize
  21861. @item
  21862. Split input audio stream into three output audio streams, starting at start of input audio stream
  21863. and storing that in 1st output audio stream, then following at 60th second and storing than in 2nd
  21864. output audio stream, and last after 150th second of input audio stream store in 3rd output audio stream:
  21865. @example
  21866. asegment=timestamps="60|150"
  21867. @end example
  21868. @end itemize
  21869. @anchor{select}
  21870. @section select, aselect
  21871. Select frames to pass in output.
  21872. This filter accepts the following options:
  21873. @table @option
  21874. @item expr, e
  21875. Set expression, which is evaluated for each input frame.
  21876. If the expression is evaluated to zero, the frame is discarded.
  21877. If the evaluation result is negative or NaN, the frame is sent to the
  21878. first output; otherwise it is sent to the output with index
  21879. @code{ceil(val)-1}, assuming that the input index starts from 0.
  21880. For example a value of @code{1.2} corresponds to the output with index
  21881. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  21882. @item outputs, n
  21883. Set the number of outputs. The output to which to send the selected
  21884. frame is based on the result of the evaluation. Default value is 1.
  21885. @end table
  21886. The expression can contain the following constants:
  21887. @table @option
  21888. @item n
  21889. The (sequential) number of the filtered frame, starting from 0.
  21890. @item selected_n
  21891. The (sequential) number of the selected frame, starting from 0.
  21892. @item prev_selected_n
  21893. The sequential number of the last selected frame. It's NAN if undefined.
  21894. @item TB
  21895. The timebase of the input timestamps.
  21896. @item pts
  21897. The PTS (Presentation TimeStamp) of the filtered frame,
  21898. expressed in @var{TB} units. It's NAN if undefined.
  21899. @item t
  21900. The PTS of the filtered frame,
  21901. expressed in seconds. It's NAN if undefined.
  21902. @item prev_pts
  21903. The PTS of the previously filtered frame. It's NAN if undefined.
  21904. @item prev_selected_pts
  21905. The PTS of the last previously filtered frame. It's NAN if undefined.
  21906. @item prev_selected_t
  21907. The PTS of the last previously selected frame, expressed in seconds. It's NAN if undefined.
  21908. @item start_pts
  21909. The first PTS in the stream which is not NAN. It remains NAN if not found.
  21910. @item start_t
  21911. The first PTS, in seconds, in the stream which is not NAN. It remains NAN if not found.
  21912. @item pict_type @emph{(video only)}
  21913. The type of the filtered frame. It can assume one of the following
  21914. values:
  21915. @table @option
  21916. @item I
  21917. @item P
  21918. @item B
  21919. @item S
  21920. @item SI
  21921. @item SP
  21922. @item BI
  21923. @end table
  21924. @item interlace_type @emph{(video only)}
  21925. The frame interlace type. It can assume one of the following values:
  21926. @table @option
  21927. @item PROGRESSIVE
  21928. The frame is progressive (not interlaced).
  21929. @item TOPFIRST
  21930. The frame is top-field-first.
  21931. @item BOTTOMFIRST
  21932. The frame is bottom-field-first.
  21933. @end table
  21934. @item consumed_sample_n @emph{(audio only)}
  21935. the number of selected samples before the current frame
  21936. @item samples_n @emph{(audio only)}
  21937. the number of samples in the current frame
  21938. @item sample_rate @emph{(audio only)}
  21939. the input sample rate
  21940. @item key
  21941. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  21942. @item pos
  21943. the position in the file of the filtered frame, -1 if the information
  21944. is not available (e.g. for synthetic video)
  21945. @item scene @emph{(video only)}
  21946. value between 0 and 1 to indicate a new scene; a low value reflects a low
  21947. probability for the current frame to introduce a new scene, while a higher
  21948. value means the current frame is more likely to be one (see the example below)
  21949. @item concatdec_select
  21950. The concat demuxer can select only part of a concat input file by setting an
  21951. inpoint and an outpoint, but the output packets may not be entirely contained
  21952. in the selected interval. By using this variable, it is possible to skip frames
  21953. generated by the concat demuxer which are not exactly contained in the selected
  21954. interval.
  21955. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  21956. and the @var{lavf.concat.duration} packet metadata values which are also
  21957. present in the decoded frames.
  21958. The @var{concatdec_select} variable is -1 if the frame pts is at least
  21959. start_time and either the duration metadata is missing or the frame pts is less
  21960. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  21961. missing.
  21962. That basically means that an input frame is selected if its pts is within the
  21963. interval set by the concat demuxer.
  21964. @end table
  21965. The default value of the select expression is "1".
  21966. @subsection Examples
  21967. @itemize
  21968. @item
  21969. Select all frames in input:
  21970. @example
  21971. select
  21972. @end example
  21973. The example above is the same as:
  21974. @example
  21975. select=1
  21976. @end example
  21977. @item
  21978. Skip all frames:
  21979. @example
  21980. select=0
  21981. @end example
  21982. @item
  21983. Select only I-frames:
  21984. @example
  21985. select='eq(pict_type\,I)'
  21986. @end example
  21987. @item
  21988. Select one frame every 100:
  21989. @example
  21990. select='not(mod(n\,100))'
  21991. @end example
  21992. @item
  21993. Select only frames contained in the 10-20 time interval:
  21994. @example
  21995. select=between(t\,10\,20)
  21996. @end example
  21997. @item
  21998. Select only I-frames contained in the 10-20 time interval:
  21999. @example
  22000. select=between(t\,10\,20)*eq(pict_type\,I)
  22001. @end example
  22002. @item
  22003. Select frames with a minimum distance of 10 seconds:
  22004. @example
  22005. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  22006. @end example
  22007. @item
  22008. Use aselect to select only audio frames with samples number > 100:
  22009. @example
  22010. aselect='gt(samples_n\,100)'
  22011. @end example
  22012. @item
  22013. Create a mosaic of the first scenes:
  22014. @example
  22015. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  22016. @end example
  22017. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  22018. choice.
  22019. @item
  22020. Send even and odd frames to separate outputs, and compose them:
  22021. @example
  22022. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  22023. @end example
  22024. @item
  22025. Select useful frames from an ffconcat file which is using inpoints and
  22026. outpoints but where the source files are not intra frame only.
  22027. @example
  22028. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  22029. @end example
  22030. @end itemize
  22031. @section sendcmd, asendcmd
  22032. Send commands to filters in the filtergraph.
  22033. These filters read commands to be sent to other filters in the
  22034. filtergraph.
  22035. @code{sendcmd} must be inserted between two video filters,
  22036. @code{asendcmd} must be inserted between two audio filters, but apart
  22037. from that they act the same way.
  22038. The specification of commands can be provided in the filter arguments
  22039. with the @var{commands} option, or in a file specified by the
  22040. @var{filename} option.
  22041. These filters accept the following options:
  22042. @table @option
  22043. @item commands, c
  22044. Set the commands to be read and sent to the other filters.
  22045. @item filename, f
  22046. Set the filename of the commands to be read and sent to the other
  22047. filters.
  22048. @end table
  22049. @subsection Commands syntax
  22050. A commands description consists of a sequence of interval
  22051. specifications, comprising a list of commands to be executed when a
  22052. particular event related to that interval occurs. The occurring event
  22053. is typically the current frame time entering or leaving a given time
  22054. interval.
  22055. An interval is specified by the following syntax:
  22056. @example
  22057. @var{START}[-@var{END}] @var{COMMANDS};
  22058. @end example
  22059. The time interval is specified by the @var{START} and @var{END} times.
  22060. @var{END} is optional and defaults to the maximum time.
  22061. The current frame time is considered within the specified interval if
  22062. it is included in the interval [@var{START}, @var{END}), that is when
  22063. the time is greater or equal to @var{START} and is lesser than
  22064. @var{END}.
  22065. @var{COMMANDS} consists of a sequence of one or more command
  22066. specifications, separated by ",", relating to that interval. The
  22067. syntax of a command specification is given by:
  22068. @example
  22069. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  22070. @end example
  22071. @var{FLAGS} is optional and specifies the type of events relating to
  22072. the time interval which enable sending the specified command, and must
  22073. be a non-null sequence of identifier flags separated by "+" or "|" and
  22074. enclosed between "[" and "]".
  22075. The following flags are recognized:
  22076. @table @option
  22077. @item enter
  22078. The command is sent when the current frame timestamp enters the
  22079. specified interval. In other words, the command is sent when the
  22080. previous frame timestamp was not in the given interval, and the
  22081. current is.
  22082. @item leave
  22083. The command is sent when the current frame timestamp leaves the
  22084. specified interval. In other words, the command is sent when the
  22085. previous frame timestamp was in the given interval, and the
  22086. current is not.
  22087. @item expr
  22088. The command @var{ARG} is interpreted as expression and result of
  22089. expression is passed as @var{ARG}.
  22090. The expression is evaluated through the eval API and can contain the following
  22091. constants:
  22092. @table @option
  22093. @item POS
  22094. Original position in the file of the frame, or undefined if undefined
  22095. for the current frame.
  22096. @item PTS
  22097. The presentation timestamp in input.
  22098. @item N
  22099. The count of the input frame for video or audio, starting from 0.
  22100. @item T
  22101. The time in seconds of the current frame.
  22102. @item TS
  22103. The start time in seconds of the current command interval.
  22104. @item TE
  22105. The end time in seconds of the current command interval.
  22106. @item TI
  22107. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  22108. @item W
  22109. The video frame width.
  22110. @item H
  22111. The video frame height.
  22112. @end table
  22113. @end table
  22114. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  22115. assumed.
  22116. @var{TARGET} specifies the target of the command, usually the name of
  22117. the filter class or a specific filter instance name.
  22118. @var{COMMAND} specifies the name of the command for the target filter.
  22119. @var{ARG} is optional and specifies the optional list of argument for
  22120. the given @var{COMMAND}.
  22121. Between one interval specification and another, whitespaces, or
  22122. sequences of characters starting with @code{#} until the end of line,
  22123. are ignored and can be used to annotate comments.
  22124. A simplified BNF description of the commands specification syntax
  22125. follows:
  22126. @example
  22127. @var{COMMAND_FLAG} ::= "enter" | "leave"
  22128. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  22129. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  22130. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  22131. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  22132. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  22133. @end example
  22134. @subsection Examples
  22135. @itemize
  22136. @item
  22137. Specify audio tempo change at second 4:
  22138. @example
  22139. asendcmd=c='4.0 atempo tempo 1.5',atempo
  22140. @end example
  22141. @item
  22142. Target a specific filter instance:
  22143. @example
  22144. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  22145. @end example
  22146. @item
  22147. Specify a list of drawtext and hue commands in a file.
  22148. @example
  22149. # show text in the interval 5-10
  22150. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  22151. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  22152. # desaturate the image in the interval 15-20
  22153. 15.0-20.0 [enter] hue s 0,
  22154. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  22155. [leave] hue s 1,
  22156. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  22157. # apply an exponential saturation fade-out effect, starting from time 25
  22158. 25 [enter] hue s exp(25-t)
  22159. @end example
  22160. A filtergraph allowing to read and process the above command list
  22161. stored in a file @file{test.cmd}, can be specified with:
  22162. @example
  22163. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  22164. @end example
  22165. @end itemize
  22166. @anchor{setpts}
  22167. @section setpts, asetpts
  22168. Change the PTS (presentation timestamp) of the input frames.
  22169. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  22170. This filter accepts the following options:
  22171. @table @option
  22172. @item expr
  22173. The expression which is evaluated for each frame to construct its timestamp.
  22174. @end table
  22175. The expression is evaluated through the eval API and can contain the following
  22176. constants:
  22177. @table @option
  22178. @item FRAME_RATE, FR
  22179. frame rate, only defined for constant frame-rate video
  22180. @item PTS
  22181. The presentation timestamp in input
  22182. @item N
  22183. The count of the input frame for video or the number of consumed samples,
  22184. not including the current frame for audio, starting from 0.
  22185. @item NB_CONSUMED_SAMPLES
  22186. The number of consumed samples, not including the current frame (only
  22187. audio)
  22188. @item NB_SAMPLES, S
  22189. The number of samples in the current frame (only audio)
  22190. @item SAMPLE_RATE, SR
  22191. The audio sample rate.
  22192. @item STARTPTS
  22193. The PTS of the first frame.
  22194. @item STARTT
  22195. the time in seconds of the first frame
  22196. @item INTERLACED
  22197. State whether the current frame is interlaced.
  22198. @item T
  22199. the time in seconds of the current frame
  22200. @item POS
  22201. original position in the file of the frame, or undefined if undefined
  22202. for the current frame
  22203. @item PREV_INPTS
  22204. The previous input PTS.
  22205. @item PREV_INT
  22206. previous input time in seconds
  22207. @item PREV_OUTPTS
  22208. The previous output PTS.
  22209. @item PREV_OUTT
  22210. previous output time in seconds
  22211. @item RTCTIME
  22212. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  22213. instead.
  22214. @item RTCSTART
  22215. The wallclock (RTC) time at the start of the movie in microseconds.
  22216. @item TB
  22217. The timebase of the input timestamps.
  22218. @end table
  22219. @subsection Examples
  22220. @itemize
  22221. @item
  22222. Start counting PTS from zero
  22223. @example
  22224. setpts=PTS-STARTPTS
  22225. @end example
  22226. @item
  22227. Apply fast motion effect:
  22228. @example
  22229. setpts=0.5*PTS
  22230. @end example
  22231. @item
  22232. Apply slow motion effect:
  22233. @example
  22234. setpts=2.0*PTS
  22235. @end example
  22236. @item
  22237. Set fixed rate of 25 frames per second:
  22238. @example
  22239. setpts=N/(25*TB)
  22240. @end example
  22241. @item
  22242. Set fixed rate 25 fps with some jitter:
  22243. @example
  22244. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  22245. @end example
  22246. @item
  22247. Apply an offset of 10 seconds to the input PTS:
  22248. @example
  22249. setpts=PTS+10/TB
  22250. @end example
  22251. @item
  22252. Generate timestamps from a "live source" and rebase onto the current timebase:
  22253. @example
  22254. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  22255. @end example
  22256. @item
  22257. Generate timestamps by counting samples:
  22258. @example
  22259. asetpts=N/SR/TB
  22260. @end example
  22261. @end itemize
  22262. @section setrange
  22263. Force color range for the output video frame.
  22264. The @code{setrange} filter marks the color range property for the
  22265. output frames. It does not change the input frame, but only sets the
  22266. corresponding property, which affects how the frame is treated by
  22267. following filters.
  22268. The filter accepts the following options:
  22269. @table @option
  22270. @item range
  22271. Available values are:
  22272. @table @samp
  22273. @item auto
  22274. Keep the same color range property.
  22275. @item unspecified, unknown
  22276. Set the color range as unspecified.
  22277. @item limited, tv, mpeg
  22278. Set the color range as limited.
  22279. @item full, pc, jpeg
  22280. Set the color range as full.
  22281. @end table
  22282. @end table
  22283. @section settb, asettb
  22284. Set the timebase to use for the output frames timestamps.
  22285. It is mainly useful for testing timebase configuration.
  22286. It accepts the following parameters:
  22287. @table @option
  22288. @item expr, tb
  22289. The expression which is evaluated into the output timebase.
  22290. @end table
  22291. The value for @option{tb} is an arithmetic expression representing a
  22292. rational. The expression can contain the constants "AVTB" (the default
  22293. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  22294. audio only). Default value is "intb".
  22295. @subsection Examples
  22296. @itemize
  22297. @item
  22298. Set the timebase to 1/25:
  22299. @example
  22300. settb=expr=1/25
  22301. @end example
  22302. @item
  22303. Set the timebase to 1/10:
  22304. @example
  22305. settb=expr=0.1
  22306. @end example
  22307. @item
  22308. Set the timebase to 1001/1000:
  22309. @example
  22310. settb=1+0.001
  22311. @end example
  22312. @item
  22313. Set the timebase to 2*intb:
  22314. @example
  22315. settb=2*intb
  22316. @end example
  22317. @item
  22318. Set the default timebase value:
  22319. @example
  22320. settb=AVTB
  22321. @end example
  22322. @end itemize
  22323. @section showcqt
  22324. Convert input audio to a video output representing frequency spectrum
  22325. logarithmically using Brown-Puckette constant Q transform algorithm with
  22326. direct frequency domain coefficient calculation (but the transform itself
  22327. is not really constant Q, instead the Q factor is actually variable/clamped),
  22328. with musical tone scale, from E0 to D#10.
  22329. The filter accepts the following options:
  22330. @table @option
  22331. @item size, s
  22332. Specify the video size for the output. It must be even. For the syntax of this option,
  22333. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22334. Default value is @code{1920x1080}.
  22335. @item fps, rate, r
  22336. Set the output frame rate. Default value is @code{25}.
  22337. @item bar_h
  22338. Set the bargraph height. It must be even. Default value is @code{-1} which
  22339. computes the bargraph height automatically.
  22340. @item axis_h
  22341. Set the axis height. It must be even. Default value is @code{-1} which computes
  22342. the axis height automatically.
  22343. @item sono_h
  22344. Set the sonogram height. It must be even. Default value is @code{-1} which
  22345. computes the sonogram height automatically.
  22346. @item fullhd
  22347. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  22348. instead. Default value is @code{1}.
  22349. @item sono_v, volume
  22350. Specify the sonogram volume expression. It can contain variables:
  22351. @table @option
  22352. @item bar_v
  22353. the @var{bar_v} evaluated expression
  22354. @item frequency, freq, f
  22355. the frequency where it is evaluated
  22356. @item timeclamp, tc
  22357. the value of @var{timeclamp} option
  22358. @end table
  22359. and functions:
  22360. @table @option
  22361. @item a_weighting(f)
  22362. A-weighting of equal loudness
  22363. @item b_weighting(f)
  22364. B-weighting of equal loudness
  22365. @item c_weighting(f)
  22366. C-weighting of equal loudness.
  22367. @end table
  22368. Default value is @code{16}.
  22369. @item bar_v, volume2
  22370. Specify the bargraph volume expression. It can contain variables:
  22371. @table @option
  22372. @item sono_v
  22373. the @var{sono_v} evaluated expression
  22374. @item frequency, freq, f
  22375. the frequency where it is evaluated
  22376. @item timeclamp, tc
  22377. the value of @var{timeclamp} option
  22378. @end table
  22379. and functions:
  22380. @table @option
  22381. @item a_weighting(f)
  22382. A-weighting of equal loudness
  22383. @item b_weighting(f)
  22384. B-weighting of equal loudness
  22385. @item c_weighting(f)
  22386. C-weighting of equal loudness.
  22387. @end table
  22388. Default value is @code{sono_v}.
  22389. @item sono_g, gamma
  22390. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  22391. higher gamma makes the spectrum having more range. Default value is @code{3}.
  22392. Acceptable range is @code{[1, 7]}.
  22393. @item bar_g, gamma2
  22394. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  22395. @code{[1, 7]}.
  22396. @item bar_t
  22397. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  22398. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  22399. @item timeclamp, tc
  22400. Specify the transform timeclamp. At low frequency, there is trade-off between
  22401. accuracy in time domain and frequency domain. If timeclamp is lower,
  22402. event in time domain is represented more accurately (such as fast bass drum),
  22403. otherwise event in frequency domain is represented more accurately
  22404. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  22405. @item attack
  22406. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  22407. limits future samples by applying asymmetric windowing in time domain, useful
  22408. when low latency is required. Accepted range is @code{[0, 1]}.
  22409. @item basefreq
  22410. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  22411. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  22412. @item endfreq
  22413. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  22414. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  22415. @item coeffclamp
  22416. This option is deprecated and ignored.
  22417. @item tlength
  22418. Specify the transform length in time domain. Use this option to control accuracy
  22419. trade-off between time domain and frequency domain at every frequency sample.
  22420. It can contain variables:
  22421. @table @option
  22422. @item frequency, freq, f
  22423. the frequency where it is evaluated
  22424. @item timeclamp, tc
  22425. the value of @var{timeclamp} option.
  22426. @end table
  22427. Default value is @code{384*tc/(384+tc*f)}.
  22428. @item count
  22429. Specify the transform count for every video frame. Default value is @code{6}.
  22430. Acceptable range is @code{[1, 30]}.
  22431. @item fcount
  22432. Specify the transform count for every single pixel. Default value is @code{0},
  22433. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  22434. @item fontfile
  22435. Specify font file for use with freetype to draw the axis. If not specified,
  22436. use embedded font. Note that drawing with font file or embedded font is not
  22437. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  22438. option instead.
  22439. @item font
  22440. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  22441. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  22442. escaping.
  22443. @item fontcolor
  22444. Specify font color expression. This is arithmetic expression that should return
  22445. integer value 0xRRGGBB. It can contain variables:
  22446. @table @option
  22447. @item frequency, freq, f
  22448. the frequency where it is evaluated
  22449. @item timeclamp, tc
  22450. the value of @var{timeclamp} option
  22451. @end table
  22452. and functions:
  22453. @table @option
  22454. @item midi(f)
  22455. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  22456. @item r(x), g(x), b(x)
  22457. red, green, and blue value of intensity x.
  22458. @end table
  22459. Default value is @code{st(0, (midi(f)-59.5)/12);
  22460. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  22461. r(1-ld(1)) + b(ld(1))}.
  22462. @item axisfile
  22463. Specify image file to draw the axis. This option override @var{fontfile} and
  22464. @var{fontcolor} option.
  22465. @item axis, text
  22466. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  22467. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  22468. Default value is @code{1}.
  22469. @item csp
  22470. Set colorspace. The accepted values are:
  22471. @table @samp
  22472. @item unspecified
  22473. Unspecified (default)
  22474. @item bt709
  22475. BT.709
  22476. @item fcc
  22477. FCC
  22478. @item bt470bg
  22479. BT.470BG or BT.601-6 625
  22480. @item smpte170m
  22481. SMPTE-170M or BT.601-6 525
  22482. @item smpte240m
  22483. SMPTE-240M
  22484. @item bt2020ncl
  22485. BT.2020 with non-constant luminance
  22486. @end table
  22487. @item cscheme
  22488. Set spectrogram color scheme. This is list of floating point values with format
  22489. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  22490. The default is @code{1|0.5|0|0|0.5|1}.
  22491. @end table
  22492. @subsection Examples
  22493. @itemize
  22494. @item
  22495. Playing audio while showing the spectrum:
  22496. @example
  22497. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  22498. @end example
  22499. @item
  22500. Same as above, but with frame rate 30 fps:
  22501. @example
  22502. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  22503. @end example
  22504. @item
  22505. Playing at 1280x720:
  22506. @example
  22507. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  22508. @end example
  22509. @item
  22510. Disable sonogram display:
  22511. @example
  22512. sono_h=0
  22513. @end example
  22514. @item
  22515. A1 and its harmonics: A1, A2, (near)E3, A3:
  22516. @example
  22517. 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),
  22518. asplit[a][out1]; [a] showcqt [out0]'
  22519. @end example
  22520. @item
  22521. Same as above, but with more accuracy in frequency domain:
  22522. @example
  22523. 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),
  22524. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  22525. @end example
  22526. @item
  22527. Custom volume:
  22528. @example
  22529. bar_v=10:sono_v=bar_v*a_weighting(f)
  22530. @end example
  22531. @item
  22532. Custom gamma, now spectrum is linear to the amplitude.
  22533. @example
  22534. bar_g=2:sono_g=2
  22535. @end example
  22536. @item
  22537. Custom tlength equation:
  22538. @example
  22539. 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)))'
  22540. @end example
  22541. @item
  22542. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  22543. @example
  22544. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  22545. @end example
  22546. @item
  22547. Custom font using fontconfig:
  22548. @example
  22549. font='Courier New,Monospace,mono|bold'
  22550. @end example
  22551. @item
  22552. Custom frequency range with custom axis using image file:
  22553. @example
  22554. axisfile=myaxis.png:basefreq=40:endfreq=10000
  22555. @end example
  22556. @end itemize
  22557. @section showcwt
  22558. Convert input audio to video output representing frequency spectrum
  22559. using Continuous Wavelet Transform and Morlet wavelet.
  22560. The filter accepts the following options:
  22561. @table @option
  22562. @item size, s
  22563. Specify the video size for the output. For the syntax of this option,
  22564. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22565. Default value is @code{640x512}.
  22566. @item rate, r
  22567. Set the output frame rate. Default value is @code{25}.
  22568. @item scale
  22569. Set the frequency scale used. Allowed values are:
  22570. @table @option
  22571. @item linear
  22572. @item log2
  22573. @item bark
  22574. @item mel
  22575. @item erbs
  22576. @end table
  22577. Default value is @code{linear}.
  22578. @item min
  22579. Set the minimum frequency that will be used in output.
  22580. Default is @code{20} Hz.
  22581. @item max
  22582. Set the maximum frequency that will be used in output.
  22583. Default is @code{20000} Hz. The real frequency upper limit
  22584. depends on input audio's sample rate and such will be enforced
  22585. on this value when it is set to value greater than Nyquist frequency.
  22586. @item logb
  22587. Set the logarithmic basis for brightness strength when
  22588. mapping calculated magnitude values to pixel values.
  22589. Allowed range is from @code{0} to @code{1}.
  22590. Default value is @code{0.0001}.
  22591. @item deviation
  22592. Set the frequency deviation.
  22593. Lower values than @code{1} are more frequency oriented,
  22594. while higher values than @code{1} are more time oriented.
  22595. Allowed range is from @code{0} to @code{10}.
  22596. Default value is @code{1}.
  22597. @item pps
  22598. Set the number of pixel output per each second in one row.
  22599. Allowed range is from @code{1} to @code{1024}.
  22600. Default value is @code{64}.
  22601. @item mode
  22602. Set the output visual mode. Allowed values are:
  22603. @table @option
  22604. @item magnitude
  22605. Show magnitude.
  22606. @item phase
  22607. Show only phase.
  22608. @item magphase
  22609. Show combination of magnitude and phase.
  22610. Magnitude is mapped to brightness and phase to color.
  22611. @item channel
  22612. Show unique color per channel magnitude.
  22613. @item stereo
  22614. Show unique color per stereo difference.
  22615. @end table
  22616. Default value is @code{magnitude}.
  22617. @item slide
  22618. Set the output slide method. Allowed values are:
  22619. @table @option
  22620. @item replace
  22621. @item scroll
  22622. @item frame
  22623. @end table
  22624. @item direction
  22625. Set the direction method for output slide method. Allowed values are:
  22626. @table @option
  22627. @item lr
  22628. Direction from left to right.
  22629. @item rl
  22630. Direction from right to left.
  22631. @item ud
  22632. Direction from up to down.
  22633. @item du
  22634. Direction from down to up.
  22635. @end table
  22636. @end table
  22637. @section showfreqs
  22638. Convert input audio to video output representing the audio power spectrum.
  22639. Audio amplitude is on Y-axis while frequency is on X-axis.
  22640. The filter accepts the following options:
  22641. @table @option
  22642. @item size, s
  22643. Specify size of video. For the syntax of this option, check the
  22644. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22645. Default is @code{1024x512}.
  22646. @item rate, r
  22647. Set video rate. Default is @code{25}.
  22648. @item mode
  22649. Set display mode.
  22650. This set how each frequency bin will be represented.
  22651. It accepts the following values:
  22652. @table @samp
  22653. @item line
  22654. @item bar
  22655. @item dot
  22656. @end table
  22657. Default is @code{bar}.
  22658. @item ascale
  22659. Set amplitude scale.
  22660. It accepts the following values:
  22661. @table @samp
  22662. @item lin
  22663. Linear scale.
  22664. @item sqrt
  22665. Square root scale.
  22666. @item cbrt
  22667. Cubic root scale.
  22668. @item log
  22669. Logarithmic scale.
  22670. @end table
  22671. Default is @code{log}.
  22672. @item fscale
  22673. Set frequency scale.
  22674. It accepts the following values:
  22675. @table @samp
  22676. @item lin
  22677. Linear scale.
  22678. @item log
  22679. Logarithmic scale.
  22680. @item rlog
  22681. Reverse logarithmic scale.
  22682. @end table
  22683. Default is @code{lin}.
  22684. @item win_size
  22685. Set window size. Allowed range is from 16 to 65536.
  22686. Default is @code{2048}
  22687. @item win_func
  22688. Set windowing function.
  22689. It accepts the following values:
  22690. @table @samp
  22691. @item rect
  22692. @item bartlett
  22693. @item hanning
  22694. @item hamming
  22695. @item blackman
  22696. @item welch
  22697. @item flattop
  22698. @item bharris
  22699. @item bnuttall
  22700. @item bhann
  22701. @item sine
  22702. @item nuttall
  22703. @item lanczos
  22704. @item gauss
  22705. @item tukey
  22706. @item dolph
  22707. @item cauchy
  22708. @item parzen
  22709. @item poisson
  22710. @item bohman
  22711. @item kaiser
  22712. @end table
  22713. Default is @code{hanning}.
  22714. @item overlap
  22715. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  22716. which means optimal overlap for selected window function will be picked.
  22717. @item averaging
  22718. Set time averaging. Setting this to 0 will display current maximal peaks.
  22719. Default is @code{1}, which means time averaging is disabled.
  22720. @item colors
  22721. Specify list of colors separated by space or by '|' which will be used to
  22722. draw channel frequencies. Unrecognized or missing colors will be replaced
  22723. by white color.
  22724. @item cmode
  22725. Set channel display mode.
  22726. It accepts the following values:
  22727. @table @samp
  22728. @item combined
  22729. @item separate
  22730. @end table
  22731. Default is @code{combined}.
  22732. @item minamp
  22733. Set minimum amplitude used in @code{log} amplitude scaler.
  22734. @item data
  22735. Set data display mode.
  22736. It accepts the following values:
  22737. @table @samp
  22738. @item magnitude
  22739. @item phase
  22740. @item delay
  22741. @end table
  22742. Default is @code{magnitude}.
  22743. @item channels
  22744. Set channels to use when processing audio. By default all are processed.
  22745. @end table
  22746. @section showspatial
  22747. Convert stereo input audio to a video output, representing the spatial relationship
  22748. between two channels.
  22749. The filter accepts the following options:
  22750. @table @option
  22751. @item size, s
  22752. Specify the video size for the output. For the syntax of this option, check the
  22753. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22754. Default value is @code{512x512}.
  22755. @item win_size
  22756. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  22757. @item win_func
  22758. Set window function.
  22759. It accepts the following values:
  22760. @table @samp
  22761. @item rect
  22762. @item bartlett
  22763. @item hann
  22764. @item hanning
  22765. @item hamming
  22766. @item blackman
  22767. @item welch
  22768. @item flattop
  22769. @item bharris
  22770. @item bnuttall
  22771. @item bhann
  22772. @item sine
  22773. @item nuttall
  22774. @item lanczos
  22775. @item gauss
  22776. @item tukey
  22777. @item dolph
  22778. @item cauchy
  22779. @item parzen
  22780. @item poisson
  22781. @item bohman
  22782. @item kaiser
  22783. @end table
  22784. Default value is @code{hann}.
  22785. @item rate, r
  22786. Set output framerate.
  22787. @end table
  22788. @anchor{showspectrum}
  22789. @section showspectrum
  22790. Convert input audio to a video output, representing the audio frequency
  22791. spectrum.
  22792. The filter accepts the following options:
  22793. @table @option
  22794. @item size, s
  22795. Specify the video size for the output. For the syntax of this option, check the
  22796. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22797. Default value is @code{640x512}.
  22798. @item slide
  22799. Specify how the spectrum should slide along the window.
  22800. It accepts the following values:
  22801. @table @samp
  22802. @item replace
  22803. the samples start again on the left when they reach the right
  22804. @item scroll
  22805. the samples scroll from right to left
  22806. @item fullframe
  22807. frames are only produced when the samples reach the right
  22808. @item rscroll
  22809. the samples scroll from left to right
  22810. @item lreplace
  22811. the samples start again on the right when they reach the left
  22812. @end table
  22813. Default value is @code{replace}.
  22814. @item mode
  22815. Specify display mode.
  22816. It accepts the following values:
  22817. @table @samp
  22818. @item combined
  22819. all channels are displayed in the same row
  22820. @item separate
  22821. all channels are displayed in separate rows
  22822. @end table
  22823. Default value is @samp{combined}.
  22824. @item color
  22825. Specify display color mode.
  22826. It accepts the following values:
  22827. @table @samp
  22828. @item channel
  22829. each channel is displayed in a separate color
  22830. @item intensity
  22831. each channel is displayed using the same color scheme
  22832. @item rainbow
  22833. each channel is displayed using the rainbow color scheme
  22834. @item moreland
  22835. each channel is displayed using the moreland color scheme
  22836. @item nebulae
  22837. each channel is displayed using the nebulae color scheme
  22838. @item fire
  22839. each channel is displayed using the fire color scheme
  22840. @item fiery
  22841. each channel is displayed using the fiery color scheme
  22842. @item fruit
  22843. each channel is displayed using the fruit color scheme
  22844. @item cool
  22845. each channel is displayed using the cool color scheme
  22846. @item magma
  22847. each channel is displayed using the magma color scheme
  22848. @item green
  22849. each channel is displayed using the green color scheme
  22850. @item viridis
  22851. each channel is displayed using the viridis color scheme
  22852. @item plasma
  22853. each channel is displayed using the plasma color scheme
  22854. @item cividis
  22855. each channel is displayed using the cividis color scheme
  22856. @item terrain
  22857. each channel is displayed using the terrain color scheme
  22858. @end table
  22859. Default value is @samp{channel}.
  22860. @item scale
  22861. Specify scale used for calculating intensity color values.
  22862. It accepts the following values:
  22863. @table @samp
  22864. @item lin
  22865. linear
  22866. @item sqrt
  22867. square root, default
  22868. @item cbrt
  22869. cubic root
  22870. @item log
  22871. logarithmic
  22872. @item 4thrt
  22873. 4th root
  22874. @item 5thrt
  22875. 5th root
  22876. @end table
  22877. Default value is @samp{sqrt}.
  22878. @item fscale
  22879. Specify frequency scale.
  22880. It accepts the following values:
  22881. @table @samp
  22882. @item lin
  22883. linear
  22884. @item log
  22885. logarithmic
  22886. @end table
  22887. Default value is @samp{lin}.
  22888. @item saturation
  22889. Set saturation modifier for displayed colors. Negative values provide
  22890. alternative color scheme. @code{0} is no saturation at all.
  22891. Saturation must be in [-10.0, 10.0] range.
  22892. Default value is @code{1}.
  22893. @item win_func
  22894. Set window function.
  22895. It accepts the following values:
  22896. @table @samp
  22897. @item rect
  22898. @item bartlett
  22899. @item hann
  22900. @item hanning
  22901. @item hamming
  22902. @item blackman
  22903. @item welch
  22904. @item flattop
  22905. @item bharris
  22906. @item bnuttall
  22907. @item bhann
  22908. @item sine
  22909. @item nuttall
  22910. @item lanczos
  22911. @item gauss
  22912. @item tukey
  22913. @item dolph
  22914. @item cauchy
  22915. @item parzen
  22916. @item poisson
  22917. @item bohman
  22918. @item kaiser
  22919. @end table
  22920. Default value is @code{hann}.
  22921. @item orientation
  22922. Set orientation of time vs frequency axis. Can be @code{vertical} or
  22923. @code{horizontal}. Default is @code{vertical}.
  22924. @item overlap
  22925. Set ratio of overlap window. Default value is @code{0}.
  22926. When value is @code{1} overlap is set to recommended size for specific
  22927. window function currently used.
  22928. @item gain
  22929. Set scale gain for calculating intensity color values.
  22930. Default value is @code{1}.
  22931. @item data
  22932. Set which data to display. Can be @code{magnitude}, default or @code{phase},
  22933. or unwrapped phase: @code{uphase}.
  22934. @item rotation
  22935. Set color rotation, must be in [-1.0, 1.0] range.
  22936. Default value is @code{0}.
  22937. @item start
  22938. Set start frequency from which to display spectrogram. Default is @code{0}.
  22939. @item stop
  22940. Set stop frequency to which to display spectrogram. Default is @code{0}.
  22941. @item fps
  22942. Set upper frame rate limit. Default is @code{auto}, unlimited.
  22943. @item legend
  22944. Draw time and frequency axes and legends. Default is disabled.
  22945. @item drange
  22946. Set dynamic range used to calculate intensity color values. Default is 120 dBFS.
  22947. Allowed range is from 10 to 200.
  22948. @item limit
  22949. Set upper limit of input audio samples volume in dBFS. Default is 0 dBFS.
  22950. Allowed range is from -100 to 100.
  22951. @item opacity
  22952. Set opacity strength when using pixel format output with alpha component.
  22953. @end table
  22954. The usage is very similar to the showwaves filter; see the examples in that
  22955. section.
  22956. @subsection Examples
  22957. @itemize
  22958. @item
  22959. Large window with logarithmic color scaling:
  22960. @example
  22961. showspectrum=s=1280x480:scale=log
  22962. @end example
  22963. @item
  22964. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  22965. @example
  22966. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  22967. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  22968. @end example
  22969. @end itemize
  22970. @section showspectrumpic
  22971. Convert input audio to a single video frame, representing the audio frequency
  22972. spectrum.
  22973. The filter accepts the following options:
  22974. @table @option
  22975. @item size, s
  22976. Specify the video size for the output. For the syntax of this option, check the
  22977. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22978. Default value is @code{4096x2048}.
  22979. @item mode
  22980. Specify display mode.
  22981. It accepts the following values:
  22982. @table @samp
  22983. @item combined
  22984. all channels are displayed in the same row
  22985. @item separate
  22986. all channels are displayed in separate rows
  22987. @end table
  22988. Default value is @samp{combined}.
  22989. @item color
  22990. Specify display color mode.
  22991. It accepts the following values:
  22992. @table @samp
  22993. @item channel
  22994. each channel is displayed in a separate color
  22995. @item intensity
  22996. each channel is displayed using the same color scheme
  22997. @item rainbow
  22998. each channel is displayed using the rainbow color scheme
  22999. @item moreland
  23000. each channel is displayed using the moreland color scheme
  23001. @item nebulae
  23002. each channel is displayed using the nebulae color scheme
  23003. @item fire
  23004. each channel is displayed using the fire color scheme
  23005. @item fiery
  23006. each channel is displayed using the fiery color scheme
  23007. @item fruit
  23008. each channel is displayed using the fruit color scheme
  23009. @item cool
  23010. each channel is displayed using the cool color scheme
  23011. @item magma
  23012. each channel is displayed using the magma color scheme
  23013. @item green
  23014. each channel is displayed using the green color scheme
  23015. @item viridis
  23016. each channel is displayed using the viridis color scheme
  23017. @item plasma
  23018. each channel is displayed using the plasma color scheme
  23019. @item cividis
  23020. each channel is displayed using the cividis color scheme
  23021. @item terrain
  23022. each channel is displayed using the terrain color scheme
  23023. @end table
  23024. Default value is @samp{intensity}.
  23025. @item scale
  23026. Specify scale used for calculating intensity color values.
  23027. It accepts the following values:
  23028. @table @samp
  23029. @item lin
  23030. linear
  23031. @item sqrt
  23032. square root, default
  23033. @item cbrt
  23034. cubic root
  23035. @item log
  23036. logarithmic
  23037. @item 4thrt
  23038. 4th root
  23039. @item 5thrt
  23040. 5th root
  23041. @end table
  23042. Default value is @samp{log}.
  23043. @item fscale
  23044. Specify frequency scale.
  23045. It accepts the following values:
  23046. @table @samp
  23047. @item lin
  23048. linear
  23049. @item log
  23050. logarithmic
  23051. @end table
  23052. Default value is @samp{lin}.
  23053. @item saturation
  23054. Set saturation modifier for displayed colors. Negative values provide
  23055. alternative color scheme. @code{0} is no saturation at all.
  23056. Saturation must be in [-10.0, 10.0] range.
  23057. Default value is @code{1}.
  23058. @item win_func
  23059. Set window function.
  23060. It accepts the following values:
  23061. @table @samp
  23062. @item rect
  23063. @item bartlett
  23064. @item hann
  23065. @item hanning
  23066. @item hamming
  23067. @item blackman
  23068. @item welch
  23069. @item flattop
  23070. @item bharris
  23071. @item bnuttall
  23072. @item bhann
  23073. @item sine
  23074. @item nuttall
  23075. @item lanczos
  23076. @item gauss
  23077. @item tukey
  23078. @item dolph
  23079. @item cauchy
  23080. @item parzen
  23081. @item poisson
  23082. @item bohman
  23083. @item kaiser
  23084. @end table
  23085. Default value is @code{hann}.
  23086. @item orientation
  23087. Set orientation of time vs frequency axis. Can be @code{vertical} or
  23088. @code{horizontal}. Default is @code{vertical}.
  23089. @item gain
  23090. Set scale gain for calculating intensity color values.
  23091. Default value is @code{1}.
  23092. @item legend
  23093. Draw time and frequency axes and legends. Default is enabled.
  23094. @item rotation
  23095. Set color rotation, must be in [-1.0, 1.0] range.
  23096. Default value is @code{0}.
  23097. @item start
  23098. Set start frequency from which to display spectrogram. Default is @code{0}.
  23099. @item stop
  23100. Set stop frequency to which to display spectrogram. Default is @code{0}.
  23101. @item drange
  23102. Set dynamic range used to calculate intensity color values. Default is 120 dBFS.
  23103. Allowed range is from 10 to 200.
  23104. @item limit
  23105. Set upper limit of input audio samples volume in dBFS. Default is 0 dBFS.
  23106. Allowed range is from -100 to 100.
  23107. @item opacity
  23108. Set opacity strength when using pixel format output with alpha component.
  23109. @end table
  23110. @subsection Examples
  23111. @itemize
  23112. @item
  23113. Extract an audio spectrogram of a whole audio track
  23114. in a 1024x1024 picture using @command{ffmpeg}:
  23115. @example
  23116. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  23117. @end example
  23118. @end itemize
  23119. @section showvolume
  23120. Convert input audio volume to a video output.
  23121. The filter accepts the following options:
  23122. @table @option
  23123. @item rate, r
  23124. Set video rate.
  23125. @item b
  23126. Set border width, allowed range is [0, 5]. Default is 1.
  23127. @item w
  23128. Set channel width, allowed range is [80, 8192]. Default is 400.
  23129. @item h
  23130. Set channel height, allowed range is [1, 900]. Default is 20.
  23131. @item f
  23132. Set fade, allowed range is [0, 1]. Default is 0.95.
  23133. @item c
  23134. Set volume color expression.
  23135. The expression can use the following variables:
  23136. @table @option
  23137. @item VOLUME
  23138. Current max volume of channel in dB.
  23139. @item PEAK
  23140. Current peak.
  23141. @item CHANNEL
  23142. Current channel number, starting from 0.
  23143. @end table
  23144. @item t
  23145. If set, displays channel names. Default is enabled.
  23146. @item v
  23147. If set, displays volume values. Default is enabled.
  23148. @item o
  23149. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  23150. default is @code{h}.
  23151. @item s
  23152. Set step size, allowed range is [0, 5]. Default is 0, which means
  23153. step is disabled.
  23154. @item p
  23155. Set background opacity, allowed range is [0, 1]. Default is 0.
  23156. @item m
  23157. Set metering mode, can be peak: @code{p} or rms: @code{r},
  23158. default is @code{p}.
  23159. @item ds
  23160. Set display scale, can be linear: @code{lin} or log: @code{log},
  23161. default is @code{lin}.
  23162. @item dm
  23163. In second.
  23164. If set to > 0., display a line for the max level
  23165. in the previous seconds.
  23166. default is disabled: @code{0.}
  23167. @item dmc
  23168. The color of the max line. Use when @code{dm} option is set to > 0.
  23169. default is: @code{orange}
  23170. @end table
  23171. @section showwaves
  23172. Convert input audio to a video output, representing the samples waves.
  23173. The filter accepts the following options:
  23174. @table @option
  23175. @item size, s
  23176. Specify the video size for the output. For the syntax of this option, check the
  23177. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23178. Default value is @code{600x240}.
  23179. @item mode
  23180. Set display mode.
  23181. Available values are:
  23182. @table @samp
  23183. @item point
  23184. Draw a point for each sample.
  23185. @item line
  23186. Draw a vertical line for each sample.
  23187. @item p2p
  23188. Draw a point for each sample and a line between them.
  23189. @item cline
  23190. Draw a centered vertical line for each sample.
  23191. @end table
  23192. Default value is @code{point}.
  23193. @item n
  23194. Set the number of samples which are printed on the same column. A
  23195. larger value will decrease the frame rate. Must be a positive
  23196. integer. This option can be set only if the value for @var{rate}
  23197. is not explicitly specified.
  23198. @item rate, r
  23199. Set the (approximate) output frame rate. This is done by setting the
  23200. option @var{n}. Default value is "25".
  23201. @item split_channels
  23202. Set if channels should be drawn separately or overlap. Default value is 0.
  23203. @item colors
  23204. Set colors separated by '|' which are going to be used for drawing of each channel.
  23205. @item scale
  23206. Set amplitude scale.
  23207. Available values are:
  23208. @table @samp
  23209. @item lin
  23210. Linear.
  23211. @item log
  23212. Logarithmic.
  23213. @item sqrt
  23214. Square root.
  23215. @item cbrt
  23216. Cubic root.
  23217. @end table
  23218. Default is linear.
  23219. @item draw
  23220. Set the draw mode. This is mostly useful to set for high @var{n}.
  23221. Available values are:
  23222. @table @samp
  23223. @item scale
  23224. Scale pixel values for each drawn sample.
  23225. @item full
  23226. Draw every sample directly.
  23227. @end table
  23228. Default value is @code{scale}.
  23229. @end table
  23230. @subsection Examples
  23231. @itemize
  23232. @item
  23233. Output the input file audio and the corresponding video representation
  23234. at the same time:
  23235. @example
  23236. amovie=a.mp3,asplit[out0],showwaves[out1]
  23237. @end example
  23238. @item
  23239. Create a synthetic signal and show it with showwaves, forcing a
  23240. frame rate of 30 frames per second:
  23241. @example
  23242. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  23243. @end example
  23244. @end itemize
  23245. @section showwavespic
  23246. Convert input audio to a single video frame, representing the samples waves.
  23247. The filter accepts the following options:
  23248. @table @option
  23249. @item size, s
  23250. Specify the video size for the output. For the syntax of this option, check the
  23251. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23252. Default value is @code{600x240}.
  23253. @item split_channels
  23254. Set if channels should be drawn separately or overlap. Default value is 0.
  23255. @item colors
  23256. Set colors separated by '|' which are going to be used for drawing of each channel.
  23257. @item scale
  23258. Set amplitude scale.
  23259. Available values are:
  23260. @table @samp
  23261. @item lin
  23262. Linear.
  23263. @item log
  23264. Logarithmic.
  23265. @item sqrt
  23266. Square root.
  23267. @item cbrt
  23268. Cubic root.
  23269. @end table
  23270. Default is linear.
  23271. @item draw
  23272. Set the draw mode.
  23273. Available values are:
  23274. @table @samp
  23275. @item scale
  23276. Scale pixel values for each drawn sample.
  23277. @item full
  23278. Draw every sample directly.
  23279. @end table
  23280. Default value is @code{scale}.
  23281. @item filter
  23282. Set the filter mode.
  23283. Available values are:
  23284. @table @samp
  23285. @item average
  23286. Use average samples values for each drawn sample.
  23287. @item peak
  23288. Use peak samples values for each drawn sample.
  23289. @end table
  23290. Default value is @code{average}.
  23291. @end table
  23292. @subsection Examples
  23293. @itemize
  23294. @item
  23295. Extract a channel split representation of the wave form of a whole audio track
  23296. in a 1024x800 picture using @command{ffmpeg}:
  23297. @example
  23298. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  23299. @end example
  23300. @end itemize
  23301. @section sidedata, asidedata
  23302. Delete frame side data, or select frames based on it.
  23303. This filter accepts the following options:
  23304. @table @option
  23305. @item mode
  23306. Set mode of operation of the filter.
  23307. Can be one of the following:
  23308. @table @samp
  23309. @item select
  23310. Select every frame with side data of @code{type}.
  23311. @item delete
  23312. Delete side data of @code{type}. If @code{type} is not set, delete all side
  23313. data in the frame.
  23314. @end table
  23315. @item type
  23316. Set side data type used with all modes. Must be set for @code{select} mode. For
  23317. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  23318. in @file{libavutil/frame.h}. For example, to choose
  23319. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  23320. @end table
  23321. @section spectrumsynth
  23322. Synthesize audio from 2 input video spectrums, first input stream represents
  23323. magnitude across time and second represents phase across time.
  23324. The filter will transform from frequency domain as displayed in videos back
  23325. to time domain as presented in audio output.
  23326. This filter is primarily created for reversing processed @ref{showspectrum}
  23327. filter outputs, but can synthesize sound from other spectrograms too.
  23328. But in such case results are going to be poor if the phase data is not
  23329. available, because in such cases phase data need to be recreated, usually
  23330. it's just recreated from random noise.
  23331. For best results use gray only output (@code{channel} color mode in
  23332. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  23333. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  23334. @code{data} option. Inputs videos should generally use @code{fullframe}
  23335. slide mode as that saves resources needed for decoding video.
  23336. The filter accepts the following options:
  23337. @table @option
  23338. @item sample_rate
  23339. Specify sample rate of output audio, the sample rate of audio from which
  23340. spectrum was generated may differ.
  23341. @item channels
  23342. Set number of channels represented in input video spectrums.
  23343. @item scale
  23344. Set scale which was used when generating magnitude input spectrum.
  23345. Can be @code{lin} or @code{log}. Default is @code{log}.
  23346. @item slide
  23347. Set slide which was used when generating inputs spectrums.
  23348. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  23349. Default is @code{fullframe}.
  23350. @item win_func
  23351. Set window function used for resynthesis.
  23352. @item overlap
  23353. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  23354. which means optimal overlap for selected window function will be picked.
  23355. @item orientation
  23356. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  23357. Default is @code{vertical}.
  23358. @end table
  23359. @subsection Examples
  23360. @itemize
  23361. @item
  23362. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  23363. then resynthesize videos back to audio with spectrumsynth:
  23364. @example
  23365. 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
  23366. 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
  23367. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  23368. @end example
  23369. @end itemize
  23370. @section split, asplit
  23371. Split input into several identical outputs.
  23372. @code{asplit} works with audio input, @code{split} with video.
  23373. The filter accepts a single parameter which specifies the number of outputs. If
  23374. unspecified, it defaults to 2.
  23375. @subsection Examples
  23376. @itemize
  23377. @item
  23378. Create two separate outputs from the same input:
  23379. @example
  23380. [in] split [out0][out1]
  23381. @end example
  23382. @item
  23383. To create 3 or more outputs, you need to specify the number of
  23384. outputs, like in:
  23385. @example
  23386. [in] asplit=3 [out0][out1][out2]
  23387. @end example
  23388. @item
  23389. Create two separate outputs from the same input, one cropped and
  23390. one padded:
  23391. @example
  23392. [in] split [splitout1][splitout2];
  23393. [splitout1] crop=100:100:0:0 [cropout];
  23394. [splitout2] pad=200:200:100:100 [padout];
  23395. @end example
  23396. @item
  23397. Create 5 copies of the input audio with @command{ffmpeg}:
  23398. @example
  23399. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  23400. @end example
  23401. @end itemize
  23402. @section zmq, azmq
  23403. Receive commands sent through a libzmq client, and forward them to
  23404. filters in the filtergraph.
  23405. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  23406. must be inserted between two video filters, @code{azmq} between two
  23407. audio filters. Both are capable to send messages to any filter type.
  23408. To enable these filters you need to install the libzmq library and
  23409. headers and configure FFmpeg with @code{--enable-libzmq}.
  23410. For more information about libzmq see:
  23411. @url{http://www.zeromq.org/}
  23412. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  23413. receives messages sent through a network interface defined by the
  23414. @option{bind_address} (or the abbreviation "@option{b}") option.
  23415. Default value of this option is @file{tcp://localhost:5555}. You may
  23416. want to alter this value to your needs, but do not forget to escape any
  23417. ':' signs (see @ref{filtergraph escaping}).
  23418. The received message must be in the form:
  23419. @example
  23420. @var{TARGET} @var{COMMAND} [@var{ARG}]
  23421. @end example
  23422. @var{TARGET} specifies the target of the command, usually the name of
  23423. the filter class or a specific filter instance name. The default
  23424. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  23425. but you can override this by using the @samp{filter_name@@id} syntax
  23426. (see @ref{Filtergraph syntax}).
  23427. @var{COMMAND} specifies the name of the command for the target filter.
  23428. @var{ARG} is optional and specifies the optional argument list for the
  23429. given @var{COMMAND}.
  23430. Upon reception, the message is processed and the corresponding command
  23431. is injected into the filtergraph. Depending on the result, the filter
  23432. will send a reply to the client, adopting the format:
  23433. @example
  23434. @var{ERROR_CODE} @var{ERROR_REASON}
  23435. @var{MESSAGE}
  23436. @end example
  23437. @var{MESSAGE} is optional.
  23438. @subsection Examples
  23439. Look at @file{tools/zmqsend} for an example of a zmq client which can
  23440. be used to send commands processed by these filters.
  23441. Consider the following filtergraph generated by @command{ffplay}.
  23442. In this example the last overlay filter has an instance name. All other
  23443. filters will have default instance names.
  23444. @example
  23445. ffplay -dumpgraph 1 -f lavfi "
  23446. color=s=100x100:c=red [l];
  23447. color=s=100x100:c=blue [r];
  23448. nullsrc=s=200x100, zmq [bg];
  23449. [bg][l] overlay [bg+l];
  23450. [bg+l][r] overlay@@my=x=100 "
  23451. @end example
  23452. To change the color of the left side of the video, the following
  23453. command can be used:
  23454. @example
  23455. echo Parsed_color_0 c yellow | tools/zmqsend
  23456. @end example
  23457. To change the right side:
  23458. @example
  23459. echo Parsed_color_1 c pink | tools/zmqsend
  23460. @end example
  23461. To change the position of the right side:
  23462. @example
  23463. echo overlay@@my x 150 | tools/zmqsend
  23464. @end example
  23465. @c man end MULTIMEDIA FILTERS
  23466. @chapter Multimedia Sources
  23467. @c man begin MULTIMEDIA SOURCES
  23468. Below is a description of the currently available multimedia sources.
  23469. @section amovie
  23470. This is the same as @ref{movie} source, except it selects an audio
  23471. stream by default.
  23472. @section avsynctest
  23473. Generate an Audio/Video Sync Test.
  23474. Generated stream periodically shows flash video frame and emits beep in audio.
  23475. Useful to inspect A/V sync issues.
  23476. It accepts the following options:
  23477. @table @option
  23478. @item size, s
  23479. Set output video size. Default value is @code{hd720}.
  23480. @item framerate, fr
  23481. Set output video frame rate. Default value is @code{30}.
  23482. @item samplerate, sr
  23483. Set output audio sample rate. Default value is @code{44100}.
  23484. @item amplitude, a
  23485. Set output audio beep amplitude. Default value is @code{0.7}.
  23486. @item period, p
  23487. Set output audio beep period in seconds. Default value is @code{3}.
  23488. @item delay, dl
  23489. Set output video flash delay in number of frames. Default value is @code{0}.
  23490. @item cycle, c
  23491. Enable cycling of video delays, by default is disabled.
  23492. @item duration, d
  23493. Set stream output duration. By default duration is unlimited.
  23494. @item fg, bg, ag
  23495. Set foreground/background/additional color.
  23496. @end table
  23497. @anchor{movie}
  23498. @section movie
  23499. Read audio and/or video stream(s) from a movie container.
  23500. It accepts the following parameters:
  23501. @table @option
  23502. @item filename
  23503. The name of the resource to read (not necessarily a file; it can also be a
  23504. device or a stream accessed through some protocol).
  23505. @item format_name, f
  23506. Specifies the format assumed for the movie to read, and can be either
  23507. the name of a container or an input device. If not specified, the
  23508. format is guessed from @var{movie_name} or by probing.
  23509. @item seek_point, sp
  23510. Specifies the seek point in seconds. The frames will be output
  23511. starting from this seek point. The parameter is evaluated with
  23512. @code{av_strtod}, so the numerical value may be suffixed by an IS
  23513. postfix. The default value is "0".
  23514. @item streams, s
  23515. Specifies the streams to read. Several streams can be specified,
  23516. separated by "+". The source will then have as many outputs, in the
  23517. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  23518. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  23519. respectively the default (best suited) video and audio stream. Default
  23520. is "dv", or "da" if the filter is called as "amovie".
  23521. @item stream_index, si
  23522. Specifies the index of the video stream to read. If the value is -1,
  23523. the most suitable video stream will be automatically selected. The default
  23524. value is "-1". Deprecated. If the filter is called "amovie", it will select
  23525. audio instead of video.
  23526. @item loop
  23527. Specifies how many times to read the stream in sequence.
  23528. If the value is 0, the stream will be looped infinitely.
  23529. Default value is "1".
  23530. Note that when the movie is looped the source timestamps are not
  23531. changed, so it will generate non monotonically increasing timestamps.
  23532. @item discontinuity
  23533. Specifies the time difference between frames above which the point is
  23534. considered a timestamp discontinuity which is removed by adjusting the later
  23535. timestamps.
  23536. @item dec_threads
  23537. Specifies the number of threads for decoding
  23538. @item format_opts
  23539. Specify format options for the opened file. Format options can be specified
  23540. as a list of @var{key}=@var{value} pairs separated by ':'. The following example
  23541. shows how to add protocol_whitelist and protocol_blacklist options:
  23542. @example
  23543. ffplay -f lavfi
  23544. "movie=filename='1.sdp':format_opts='protocol_whitelist=file,rtp,udp\:protocol_blacklist=http'"
  23545. @end example
  23546. @end table
  23547. It allows overlaying a second video on top of the main input of
  23548. a filtergraph, as shown in this graph:
  23549. @example
  23550. input -----------> deltapts0 --> overlay --> output
  23551. ^
  23552. |
  23553. movie --> scale--> deltapts1 -------+
  23554. @end example
  23555. @subsection Examples
  23556. @itemize
  23557. @item
  23558. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  23559. on top of the input labelled "in":
  23560. @example
  23561. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  23562. [in] setpts=PTS-STARTPTS [main];
  23563. [main][over] overlay=16:16 [out]
  23564. @end example
  23565. @item
  23566. Read from a video4linux2 device, and overlay it on top of the input
  23567. labelled "in":
  23568. @example
  23569. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  23570. [in] setpts=PTS-STARTPTS [main];
  23571. [main][over] overlay=16:16 [out]
  23572. @end example
  23573. @item
  23574. Read the first video stream and the audio stream with id 0x81 from
  23575. dvd.vob; the video is connected to the pad named "video" and the audio is
  23576. connected to the pad named "audio":
  23577. @example
  23578. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  23579. @end example
  23580. @end itemize
  23581. @subsection Commands
  23582. Both movie and amovie support the following commands:
  23583. @table @option
  23584. @item seek
  23585. Perform seek using "av_seek_frame".
  23586. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  23587. @itemize
  23588. @item
  23589. @var{stream_index}: If stream_index is -1, a default
  23590. stream is selected, and @var{timestamp} is automatically converted
  23591. from AV_TIME_BASE units to the stream specific time_base.
  23592. @item
  23593. @var{timestamp}: Timestamp in AVStream.time_base units
  23594. or, if no stream is specified, in AV_TIME_BASE units.
  23595. @item
  23596. @var{flags}: Flags which select direction and seeking mode.
  23597. @end itemize
  23598. @item get_duration
  23599. Get movie duration in AV_TIME_BASE units.
  23600. @end table
  23601. @c man end MULTIMEDIA SOURCES