filters.texi 790 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623
  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{commands}
  252. @chapter Changing options at runtime with a command
  253. Some options can be changed during the operation of the filter using
  254. a command. These options are marked 'T' on the output of
  255. @command{ffmpeg} @option{-h filter=<name of filter>}.
  256. The name of the command is the name of the option and the argument is
  257. the new value.
  258. @anchor{framesync}
  259. @chapter Options for filters with several inputs (framesync)
  260. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  261. Some filters with several inputs support a common set of options.
  262. These options can only be set by name, not with the short notation.
  263. @table @option
  264. @item eof_action
  265. The action to take when EOF is encountered on the secondary input; it accepts
  266. one of the following values:
  267. @table @option
  268. @item repeat
  269. Repeat the last frame (the default).
  270. @item endall
  271. End both streams.
  272. @item pass
  273. Pass the main input through.
  274. @end table
  275. @item shortest
  276. If set to 1, force the output to terminate when the shortest input
  277. terminates. Default value is 0.
  278. @item repeatlast
  279. If set to 1, force the filter to extend the last frame of secondary streams
  280. until the end of the primary stream. A value of 0 disables this behavior.
  281. Default value is 1.
  282. @end table
  283. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  284. @chapter Audio Filters
  285. @c man begin AUDIO FILTERS
  286. When you configure your FFmpeg build, you can disable any of the
  287. existing filters using @code{--disable-filters}.
  288. The configure output will show the audio filters included in your
  289. build.
  290. Below is a description of the currently available audio filters.
  291. @section acompressor
  292. A compressor is mainly used to reduce the dynamic range of a signal.
  293. Especially modern music is mostly compressed at a high ratio to
  294. improve the overall loudness. It's done to get the highest attention
  295. of a listener, "fatten" the sound and bring more "power" to the track.
  296. If a signal is compressed too much it may sound dull or "dead"
  297. afterwards or it may start to "pump" (which could be a powerful effect
  298. but can also destroy a track completely).
  299. The right compression is the key to reach a professional sound and is
  300. the high art of mixing and mastering. Because of its complex settings
  301. it may take a long time to get the right feeling for this kind of effect.
  302. Compression is done by detecting the volume above a chosen level
  303. @code{threshold} and dividing it by the factor set with @code{ratio}.
  304. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  305. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  306. the signal would cause distortion of the waveform the reduction can be
  307. levelled over the time. This is done by setting "Attack" and "Release".
  308. @code{attack} determines how long the signal has to rise above the threshold
  309. before any reduction will occur and @code{release} sets the time the signal
  310. has to fall below the threshold to reduce the reduction again. Shorter signals
  311. than the chosen attack time will be left untouched.
  312. The overall reduction of the signal can be made up afterwards with the
  313. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  314. raising the makeup to this level results in a signal twice as loud than the
  315. source. To gain a softer entry in the compression the @code{knee} flattens the
  316. hard edge at the threshold in the range of the chosen decibels.
  317. The filter accepts the following options:
  318. @table @option
  319. @item level_in
  320. Set input gain. Default is 1. Range is between 0.015625 and 64.
  321. @item mode
  322. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  323. Default is @code{downward}.
  324. @item threshold
  325. If a signal of stream rises above this level it will affect the gain
  326. reduction.
  327. By default it is 0.125. Range is between 0.00097563 and 1.
  328. @item ratio
  329. Set a ratio by which the signal is reduced. 1:2 means that if the level
  330. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  331. Default is 2. Range is between 1 and 20.
  332. @item attack
  333. Amount of milliseconds the signal has to rise above the threshold before gain
  334. reduction starts. Default is 20. Range is between 0.01 and 2000.
  335. @item release
  336. Amount of milliseconds the signal has to fall below the threshold before
  337. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  338. @item makeup
  339. Set the amount by how much signal will be amplified after processing.
  340. Default is 1. Range is from 1 to 64.
  341. @item knee
  342. Curve the sharp knee around the threshold to enter gain reduction more softly.
  343. Default is 2.82843. Range is between 1 and 8.
  344. @item link
  345. Choose if the @code{average} level between all channels of input stream
  346. or the louder(@code{maximum}) channel of input stream affects the
  347. reduction. Default is @code{average}.
  348. @item detection
  349. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  350. of @code{rms}. Default is @code{rms} which is mostly smoother.
  351. @item mix
  352. How much to use compressed signal in output. Default is 1.
  353. Range is between 0 and 1.
  354. @end table
  355. @subsection Commands
  356. This filter supports the all above options as @ref{commands}.
  357. @section acontrast
  358. Simple audio dynamic range compression/expansion filter.
  359. The filter accepts the following options:
  360. @table @option
  361. @item contrast
  362. Set contrast. Default is 33. Allowed range is between 0 and 100.
  363. @end table
  364. @section acopy
  365. Copy the input audio source unchanged to the output. This is mainly useful for
  366. testing purposes.
  367. @section acrossfade
  368. Apply cross fade from one input audio stream to another input audio stream.
  369. The cross fade is applied for specified duration near the end of first stream.
  370. The filter accepts the following options:
  371. @table @option
  372. @item nb_samples, ns
  373. Specify the number of samples for which the cross fade effect has to last.
  374. At the end of the cross fade effect the first input audio will be completely
  375. silent. Default is 44100.
  376. @item duration, d
  377. Specify the duration of the cross fade effect. See
  378. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  379. for the accepted syntax.
  380. By default the duration is determined by @var{nb_samples}.
  381. If set this option is used instead of @var{nb_samples}.
  382. @item overlap, o
  383. Should first stream end overlap with second stream start. Default is enabled.
  384. @item curve1
  385. Set curve for cross fade transition for first stream.
  386. @item curve2
  387. Set curve for cross fade transition for second stream.
  388. For description of available curve types see @ref{afade} filter description.
  389. @end table
  390. @subsection Examples
  391. @itemize
  392. @item
  393. Cross fade from one input to another:
  394. @example
  395. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  396. @end example
  397. @item
  398. Cross fade from one input to another but without overlapping:
  399. @example
  400. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  401. @end example
  402. @end itemize
  403. @section acrossover
  404. Split audio stream into several bands.
  405. This filter splits audio stream into two or more frequency ranges.
  406. Summing all streams back will give flat output.
  407. The filter accepts the following options:
  408. @table @option
  409. @item split
  410. Set split frequencies. Those must be positive and increasing.
  411. @item order
  412. Set filter order for each band split. This controls filter roll-off or steepness
  413. of filter transfer function.
  414. Available values are:
  415. @table @samp
  416. @item 2nd
  417. 12 dB per octave.
  418. @item 4th
  419. 24 dB per octave.
  420. @item 6th
  421. 36 dB per octave.
  422. @item 8th
  423. 48 dB per octave.
  424. @item 10th
  425. 60 dB per octave.
  426. @item 12th
  427. 72 dB per octave.
  428. @item 14th
  429. 84 dB per octave.
  430. @item 16th
  431. 96 dB per octave.
  432. @item 18th
  433. 108 dB per octave.
  434. @item 20th
  435. 120 dB per octave.
  436. @end table
  437. Default is @var{4th}.
  438. @item level
  439. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  440. @item gains
  441. Set output gain for each band. Default value is 1 for all bands.
  442. @end table
  443. @subsection Examples
  444. @itemize
  445. @item
  446. Split input audio stream into two bands (low and high) with split frequency of 1500 Hz,
  447. each band will be in separate stream:
  448. @example
  449. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  450. @end example
  451. @item
  452. Same as above, but with higher filter order:
  453. @example
  454. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500:order=8th[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  455. @end example
  456. @item
  457. Same as above, but also with additional middle band (frequencies between 1500 and 8000):
  458. @example
  459. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500 8000:order=8th[LOW][MID][HIGH]' -map '[LOW]' low.wav -map '[MID]' mid.wav -map '[HIGH]' high.wav
  460. @end example
  461. @end itemize
  462. @section acrusher
  463. Reduce audio bit resolution.
  464. This filter is bit crusher with enhanced functionality. A bit crusher
  465. is used to audibly reduce number of bits an audio signal is sampled
  466. with. This doesn't change the bit depth at all, it just produces the
  467. effect. Material reduced in bit depth sounds more harsh and "digital".
  468. This filter is able to even round to continuous values instead of discrete
  469. bit depths.
  470. Additionally it has a D/C offset which results in different crushing of
  471. the lower and the upper half of the signal.
  472. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  473. Another feature of this filter is the logarithmic mode.
  474. This setting switches from linear distances between bits to logarithmic ones.
  475. The result is a much more "natural" sounding crusher which doesn't gate low
  476. signals for example. The human ear has a logarithmic perception,
  477. so this kind of crushing is much more pleasant.
  478. Logarithmic crushing is also able to get anti-aliased.
  479. The filter accepts the following options:
  480. @table @option
  481. @item level_in
  482. Set level in.
  483. @item level_out
  484. Set level out.
  485. @item bits
  486. Set bit reduction.
  487. @item mix
  488. Set mixing amount.
  489. @item mode
  490. Can be linear: @code{lin} or logarithmic: @code{log}.
  491. @item dc
  492. Set DC.
  493. @item aa
  494. Set anti-aliasing.
  495. @item samples
  496. Set sample reduction.
  497. @item lfo
  498. Enable LFO. By default disabled.
  499. @item lforange
  500. Set LFO range.
  501. @item lforate
  502. Set LFO rate.
  503. @end table
  504. @subsection Commands
  505. This filter supports the all above options as @ref{commands}.
  506. @section acue
  507. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  508. filter.
  509. @section adeclick
  510. Remove impulsive noise from input audio.
  511. Samples detected as impulsive noise are replaced by interpolated samples using
  512. autoregressive modelling.
  513. @table @option
  514. @item window, w
  515. Set window size, in milliseconds. Allowed range is from @code{10} to
  516. @code{100}. Default value is @code{55} milliseconds.
  517. This sets size of window which will be processed at once.
  518. @item overlap, o
  519. Set window overlap, in percentage of window size. Allowed range is from
  520. @code{50} to @code{95}. Default value is @code{75} percent.
  521. Setting this to a very high value increases impulsive noise removal but makes
  522. whole process much slower.
  523. @item arorder, a
  524. Set autoregression order, in percentage of window size. Allowed range is from
  525. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  526. controls quality of interpolated samples using neighbour good samples.
  527. @item threshold, t
  528. Set threshold value. Allowed range is from @code{1} to @code{100}.
  529. Default value is @code{2}.
  530. This controls the strength of impulsive noise which is going to be removed.
  531. The lower value, the more samples will be detected as impulsive noise.
  532. @item burst, b
  533. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  534. @code{10}. Default value is @code{2}.
  535. If any two samples detected as noise are spaced less than this value then any
  536. sample between those two samples will be also detected as noise.
  537. @item method, m
  538. Set overlap method.
  539. It accepts the following values:
  540. @table @option
  541. @item add, a
  542. Select overlap-add method. Even not interpolated samples are slightly
  543. changed with this method.
  544. @item save, s
  545. Select overlap-save method. Not interpolated samples remain unchanged.
  546. @end table
  547. Default value is @code{a}.
  548. @end table
  549. @section adeclip
  550. Remove clipped samples from input audio.
  551. Samples detected as clipped are replaced by interpolated samples using
  552. autoregressive modelling.
  553. @table @option
  554. @item window, w
  555. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  556. Default value is @code{55} milliseconds.
  557. This sets size of window which will be processed at once.
  558. @item overlap, o
  559. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  560. to @code{95}. Default value is @code{75} percent.
  561. @item arorder, a
  562. Set autoregression order, in percentage of window size. Allowed range is from
  563. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  564. quality of interpolated samples using neighbour good samples.
  565. @item threshold, t
  566. Set threshold value. Allowed range is from @code{1} to @code{100}.
  567. Default value is @code{10}. Higher values make clip detection less aggressive.
  568. @item hsize, n
  569. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  570. Default value is @code{1000}. Higher values make clip detection less aggressive.
  571. @item method, m
  572. Set overlap method.
  573. It accepts the following values:
  574. @table @option
  575. @item add, a
  576. Select overlap-add method. Even not interpolated samples are slightly changed
  577. with this method.
  578. @item save, s
  579. Select overlap-save method. Not interpolated samples remain unchanged.
  580. @end table
  581. Default value is @code{a}.
  582. @end table
  583. @section adecorrelate
  584. Apply decorrelation to input audio stream.
  585. The filter accepts the following options:
  586. @table @option
  587. @item stages
  588. Set decorrelation stages of filtering. Allowed
  589. range is from 1 to 16. Default value is 6.
  590. @item seed
  591. Set random seed used for setting delay in samples across channels.
  592. @end table
  593. @section adelay
  594. Delay one or more audio channels.
  595. Samples in delayed channel are filled with silence.
  596. The filter accepts the following option:
  597. @table @option
  598. @item delays
  599. Set list of delays in milliseconds for each channel separated by '|'.
  600. Unused delays will be silently ignored. If number of given delays is
  601. smaller than number of channels all remaining channels will not be delayed.
  602. If you want to delay exact number of samples, append 'S' to number.
  603. If you want instead to delay in seconds, append 's' to number.
  604. @item all
  605. Use last set delay for all remaining channels. By default is disabled.
  606. This option if enabled changes how option @code{delays} is interpreted.
  607. @end table
  608. @subsection Examples
  609. @itemize
  610. @item
  611. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  612. the second channel (and any other channels that may be present) unchanged.
  613. @example
  614. adelay=1500|0|500
  615. @end example
  616. @item
  617. Delay second channel by 500 samples, the third channel by 700 samples and leave
  618. the first channel (and any other channels that may be present) unchanged.
  619. @example
  620. adelay=0|500S|700S
  621. @end example
  622. @item
  623. Delay all channels by same number of samples:
  624. @example
  625. adelay=delays=64S:all=1
  626. @end example
  627. @end itemize
  628. @section adenorm
  629. Remedy denormals in audio by adding extremely low-level noise.
  630. This filter shall be placed before any filter that can produce denormals.
  631. A description of the accepted parameters follows.
  632. @table @option
  633. @item level
  634. Set level of added noise in dB. Default is @code{-351}.
  635. Allowed range is from -451 to -90.
  636. @item type
  637. Set type of added noise.
  638. @table @option
  639. @item dc
  640. Add DC signal.
  641. @item ac
  642. Add AC signal.
  643. @item square
  644. Add square signal.
  645. @item pulse
  646. Add pulse signal.
  647. @end table
  648. Default is @code{dc}.
  649. @end table
  650. @subsection Commands
  651. This filter supports the all above options as @ref{commands}.
  652. @section aderivative, aintegral
  653. Compute derivative/integral of audio stream.
  654. Applying both filters one after another produces original audio.
  655. @section adynamicequalizer
  656. Apply dynamic equalization to input audio stream.
  657. A description of the accepted options follows.
  658. @table @option
  659. @item threshold
  660. Set the detection threshold used to trigger equalization.
  661. Threshold detection is using bandpass filter.
  662. Default value is 0. Allowed range is from 0 to 100.
  663. @item dfrequency
  664. Set the detection frequency in Hz used for bandpass filter used to trigger equalization.
  665. Default value is 1000 Hz. Allowed range is between 2 and 1000000 Hz.
  666. @item dqfactor
  667. Set the detection resonance factor for bandpass filter used to trigger equalization.
  668. Default value is 1. Allowed range is from 0.001 to 1000.
  669. @item tfrequency
  670. Set the target frequency of equalization filter.
  671. Default value is 1000 Hz. Allowed range is between 2 and 1000000 Hz.
  672. @item tqfactor
  673. Set the target resonance factor for target equalization filter.
  674. Default value is 1. Allowed range is from 0.001 to 1000.
  675. @item attack
  676. Set the amount of milliseconds the signal from detection has to rise above
  677. the detection threshold before equalization starts.
  678. Default is 20. Allowed range is between 1 and 2000.
  679. @item release
  680. Set the amount of milliseconds the signal from detection has to fall below the
  681. detection threshold before equalization ends.
  682. Default is 200. Allowed range is between 1 and 2000.
  683. @item knee
  684. Curve the sharp knee around the detection threshold to calculate
  685. equalization gain more softly.
  686. Default is 1. Allowed range is between 0 and 8.
  687. @item ratio
  688. Set the ratio by which the equalization gain is raised.
  689. Default is 1. Allowed range is between 1 and 20.
  690. @item makeup
  691. Set the makeup offset in dB by which the equalization gain is raised.
  692. Default is 0. Allowed range is between 0 and 30.
  693. @item range
  694. Set the max allowed cut/boost amount in dB. Default is 0.
  695. Allowed range is from 0 to 200.
  696. @item slew
  697. Set the slew factor. Default is 1. Allowed range is from 1 to 200.
  698. @item mode
  699. Set the mode of filter operation, can be one of the following:
  700. @table @samp
  701. @item listen
  702. Output only isolated bandpass signal.
  703. @item cut
  704. Cut frequencies above detection threshold.
  705. @item boost
  706. Boost frequencies bellow detection threshold.
  707. @end table
  708. Default mode is @samp{cut}.
  709. @end table
  710. @subsection Commands
  711. This filter supports the all above options as @ref{commands}.
  712. @section adynamicsmooth
  713. Apply dynamic smoothing to input audio stream.
  714. A description of the accepted options follows.
  715. @table @option
  716. @item sensitivity
  717. Set an amount of sensitivity to frequency fluctations. Default is 2.
  718. Allowed range is from 0 to 1e+06.
  719. @item basefreq
  720. Set a base frequency for smoothing. Default value is 22050.
  721. Allowed range is from 2 to 1e+06.
  722. @end table
  723. @subsection Commands
  724. This filter supports the all above options as @ref{commands}.
  725. @section aecho
  726. Apply echoing to the input audio.
  727. Echoes are reflected sound and can occur naturally amongst mountains
  728. (and sometimes large buildings) when talking or shouting; digital echo
  729. effects emulate this behaviour and are often used to help fill out the
  730. sound of a single instrument or vocal. The time difference between the
  731. original signal and the reflection is the @code{delay}, and the
  732. loudness of the reflected signal is the @code{decay}.
  733. Multiple echoes can have different delays and decays.
  734. A description of the accepted parameters follows.
  735. @table @option
  736. @item in_gain
  737. Set input gain of reflected signal. Default is @code{0.6}.
  738. @item out_gain
  739. Set output gain of reflected signal. Default is @code{0.3}.
  740. @item delays
  741. Set list of time intervals in milliseconds between original signal and reflections
  742. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  743. Default is @code{1000}.
  744. @item decays
  745. Set list of loudness of reflected signals separated by '|'.
  746. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  747. Default is @code{0.5}.
  748. @end table
  749. @subsection Examples
  750. @itemize
  751. @item
  752. Make it sound as if there are twice as many instruments as are actually playing:
  753. @example
  754. aecho=0.8:0.88:60:0.4
  755. @end example
  756. @item
  757. If delay is very short, then it sounds like a (metallic) robot playing music:
  758. @example
  759. aecho=0.8:0.88:6:0.4
  760. @end example
  761. @item
  762. A longer delay will sound like an open air concert in the mountains:
  763. @example
  764. aecho=0.8:0.9:1000:0.3
  765. @end example
  766. @item
  767. Same as above but with one more mountain:
  768. @example
  769. aecho=0.8:0.9:1000|1800:0.3|0.25
  770. @end example
  771. @end itemize
  772. @section aemphasis
  773. Audio emphasis filter creates or restores material directly taken from LPs or
  774. emphased CDs with different filter curves. E.g. to store music on vinyl the
  775. signal has to be altered by a filter first to even out the disadvantages of
  776. this recording medium.
  777. Once the material is played back the inverse filter has to be applied to
  778. restore the distortion of the frequency response.
  779. The filter accepts the following options:
  780. @table @option
  781. @item level_in
  782. Set input gain.
  783. @item level_out
  784. Set output gain.
  785. @item mode
  786. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  787. use @code{production} mode. Default is @code{reproduction} mode.
  788. @item type
  789. Set filter type. Selects medium. Can be one of the following:
  790. @table @option
  791. @item col
  792. select Columbia.
  793. @item emi
  794. select EMI.
  795. @item bsi
  796. select BSI (78RPM).
  797. @item riaa
  798. select RIAA.
  799. @item cd
  800. select Compact Disc (CD).
  801. @item 50fm
  802. select 50µs (FM).
  803. @item 75fm
  804. select 75µs (FM).
  805. @item 50kf
  806. select 50µs (FM-KF).
  807. @item 75kf
  808. select 75µs (FM-KF).
  809. @end table
  810. @end table
  811. @subsection Commands
  812. This filter supports the all above options as @ref{commands}.
  813. @section aeval
  814. Modify an audio signal according to the specified expressions.
  815. This filter accepts one or more expressions (one for each channel),
  816. which are evaluated and used to modify a corresponding audio signal.
  817. It accepts the following parameters:
  818. @table @option
  819. @item exprs
  820. Set the '|'-separated expressions list for each separate channel. If
  821. the number of input channels is greater than the number of
  822. expressions, the last specified expression is used for the remaining
  823. output channels.
  824. @item channel_layout, c
  825. Set output channel layout. If not specified, the channel layout is
  826. specified by the number of expressions. If set to @samp{same}, it will
  827. use by default the same input channel layout.
  828. @end table
  829. Each expression in @var{exprs} can contain the following constants and functions:
  830. @table @option
  831. @item ch
  832. channel number of the current expression
  833. @item n
  834. number of the evaluated sample, starting from 0
  835. @item s
  836. sample rate
  837. @item t
  838. time of the evaluated sample expressed in seconds
  839. @item nb_in_channels
  840. @item nb_out_channels
  841. input and output number of channels
  842. @item val(CH)
  843. the value of input channel with number @var{CH}
  844. @end table
  845. Note: this filter is slow. For faster processing you should use a
  846. dedicated filter.
  847. @subsection Examples
  848. @itemize
  849. @item
  850. Half volume:
  851. @example
  852. aeval=val(ch)/2:c=same
  853. @end example
  854. @item
  855. Invert phase of the second channel:
  856. @example
  857. aeval=val(0)|-val(1)
  858. @end example
  859. @end itemize
  860. @section aexciter
  861. An exciter is used to produce high sound that is not present in the
  862. original signal. This is done by creating harmonic distortions of the
  863. signal which are restricted in range and added to the original signal.
  864. An Exciter raises the upper end of an audio signal without simply raising
  865. the higher frequencies like an equalizer would do to create a more
  866. "crisp" or "brilliant" sound.
  867. The filter accepts the following options:
  868. @table @option
  869. @item level_in
  870. Set input level prior processing of signal.
  871. Allowed range is from 0 to 64.
  872. Default value is 1.
  873. @item level_out
  874. Set output level after processing of signal.
  875. Allowed range is from 0 to 64.
  876. Default value is 1.
  877. @item amount
  878. Set the amount of harmonics added to original signal.
  879. Allowed range is from 0 to 64.
  880. Default value is 1.
  881. @item drive
  882. Set the amount of newly created harmonics.
  883. Allowed range is from 0.1 to 10.
  884. Default value is 8.5.
  885. @item blend
  886. Set the octave of newly created harmonics.
  887. Allowed range is from -10 to 10.
  888. Default value is 0.
  889. @item freq
  890. Set the lower frequency limit of producing harmonics in Hz.
  891. Allowed range is from 2000 to 12000 Hz.
  892. Default is 7500 Hz.
  893. @item ceil
  894. Set the upper frequency limit of producing harmonics.
  895. Allowed range is from 9999 to 20000 Hz.
  896. If value is lower than 10000 Hz no limit is applied.
  897. @item listen
  898. Mute the original signal and output only added harmonics.
  899. By default is disabled.
  900. @end table
  901. @subsection Commands
  902. This filter supports the all above options as @ref{commands}.
  903. @anchor{afade}
  904. @section afade
  905. Apply fade-in/out effect to input audio.
  906. A description of the accepted parameters follows.
  907. @table @option
  908. @item type, t
  909. Specify the effect type, can be either @code{in} for fade-in, or
  910. @code{out} for a fade-out effect. Default is @code{in}.
  911. @item start_sample, ss
  912. Specify the number of the start sample for starting to apply the fade
  913. effect. Default is 0.
  914. @item nb_samples, ns
  915. Specify the number of samples for which the fade effect has to last. At
  916. the end of the fade-in effect the output audio will have the same
  917. volume as the input audio, at the end of the fade-out transition
  918. the output audio will be silence. Default is 44100.
  919. @item start_time, st
  920. Specify the start time of the fade effect. Default is 0.
  921. The value must be specified as a time duration; see
  922. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  923. for the accepted syntax.
  924. If set this option is used instead of @var{start_sample}.
  925. @item duration, d
  926. Specify the duration of the fade effect. See
  927. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  928. for the accepted syntax.
  929. At the end of the fade-in effect the output audio will have the same
  930. volume as the input audio, at the end of the fade-out transition
  931. the output audio will be silence.
  932. By default the duration is determined by @var{nb_samples}.
  933. If set this option is used instead of @var{nb_samples}.
  934. @item curve
  935. Set curve for fade transition.
  936. It accepts the following values:
  937. @table @option
  938. @item tri
  939. select triangular, linear slope (default)
  940. @item qsin
  941. select quarter of sine wave
  942. @item hsin
  943. select half of sine wave
  944. @item esin
  945. select exponential sine wave
  946. @item log
  947. select logarithmic
  948. @item ipar
  949. select inverted parabola
  950. @item qua
  951. select quadratic
  952. @item cub
  953. select cubic
  954. @item squ
  955. select square root
  956. @item cbr
  957. select cubic root
  958. @item par
  959. select parabola
  960. @item exp
  961. select exponential
  962. @item iqsin
  963. select inverted quarter of sine wave
  964. @item ihsin
  965. select inverted half of sine wave
  966. @item dese
  967. select double-exponential seat
  968. @item desi
  969. select double-exponential sigmoid
  970. @item losi
  971. select logistic sigmoid
  972. @item sinc
  973. select sine cardinal function
  974. @item isinc
  975. select inverted sine cardinal function
  976. @item nofade
  977. no fade applied
  978. @end table
  979. @end table
  980. @subsection Commands
  981. This filter supports the all above options as @ref{commands}.
  982. @subsection Examples
  983. @itemize
  984. @item
  985. Fade in first 15 seconds of audio:
  986. @example
  987. afade=t=in:ss=0:d=15
  988. @end example
  989. @item
  990. Fade out last 25 seconds of a 900 seconds audio:
  991. @example
  992. afade=t=out:st=875:d=25
  993. @end example
  994. @end itemize
  995. @section afftdn
  996. Denoise audio samples with FFT.
  997. A description of the accepted parameters follows.
  998. @table @option
  999. @item noise_reduction, nr
  1000. Set the noise reduction in dB, allowed range is 0.01 to 97.
  1001. Default value is 12 dB.
  1002. @item noise_floor, nf
  1003. Set the noise floor in dB, allowed range is -80 to -20.
  1004. Default value is -50 dB.
  1005. @item noise_type, nt
  1006. Set the noise type.
  1007. It accepts the following values:
  1008. @table @option
  1009. @item white, w
  1010. Select white noise.
  1011. @item vinyl, v
  1012. Select vinyl noise.
  1013. @item shellac, s
  1014. Select shellac noise.
  1015. @item custom, c
  1016. Select custom noise, defined in @code{bn} option.
  1017. Default value is white noise.
  1018. @end table
  1019. @item band_noise, bn
  1020. Set custom band noise profile for every one of 15 bands.
  1021. Bands are separated by ' ' or '|'.
  1022. @item residual_floor, rf
  1023. Set the residual floor in dB, allowed range is -80 to -20.
  1024. Default value is -38 dB.
  1025. @item track_noise, tn
  1026. Enable noise floor tracking. By default is disabled.
  1027. With this enabled, noise floor is automatically adjusted.
  1028. @item track_residual, tr
  1029. Enable residual tracking. By default is disabled.
  1030. @item output_mode, om
  1031. Set the output mode.
  1032. It accepts the following values:
  1033. @table @option
  1034. @item input, i
  1035. Pass input unchanged.
  1036. @item output, o
  1037. Pass noise filtered out.
  1038. @item noise, n
  1039. Pass only noise.
  1040. Default value is @var{output}.
  1041. @end table
  1042. @item adaptivity, ad
  1043. Set the adaptivity factor, used how fast to adapt gains adjustments per
  1044. each frequency bin. Value @var{0} enables instant adaptation, while higher values
  1045. react much slower.
  1046. Allowed range is from @var{0} to @var{1}. Default value is @var{0.5}.
  1047. @item floor_offset, fo
  1048. Set the noise floor offset factor. This option is used to adjust offset applied to measured
  1049. noise floor. It is only effective when noise floor tracking is enabled.
  1050. Allowed range is from @var{-2.0} to @var{2.0}. Default value is @var{1.0}.
  1051. @item noise_link, nl
  1052. Set the noise link used for multichannel audio.
  1053. It accepts the following values:
  1054. @table @option
  1055. @item none
  1056. Use unchanged channel's noise floor.
  1057. @item min
  1058. Use measured min noise floor of all channels.
  1059. @item max
  1060. Use measured max noise floor of all channels.
  1061. @item average
  1062. Use measured average noise floor of all channels.
  1063. Default value is @var{min}.
  1064. @end table
  1065. @item band_multiplier, bm
  1066. Set the band multiplier factor, used how much to spread bands across frequency bins.
  1067. Allowed range is from @var{0.2} to @var{5}. Default value is @var{1.25}.
  1068. @item sample_noise, sn
  1069. Toggle capturing and measurement of noise profile from input audio.
  1070. It accepts the following values:
  1071. @table @option
  1072. @item start, begin
  1073. Start sample noise capture.
  1074. @item stop, end
  1075. Stop sample noise capture and measure new noise band profile.
  1076. Default value is @code{none}.
  1077. @end table
  1078. @item gain_smooth, gs
  1079. Set gain smooth factor, used to lowpass gains applied to each frequency bin.
  1080. Useful to reduce random music noise artefacts.
  1081. Higher values reduce smoothing of gains.
  1082. Default value is @code{1.0}.
  1083. @end table
  1084. @subsection Commands
  1085. This filter supports the some above mentioned options as @ref{commands}.
  1086. @subsection Examples
  1087. @itemize
  1088. @item
  1089. Reduce white noise by 10dB, and use previously measured noise floor of -40dB:
  1090. @example
  1091. afftdn=nr=10:nf=-40
  1092. @end example
  1093. @item
  1094. Reduce white noise by 10dB, also set initial noise floor to -80dB and enable automatic
  1095. tracking of noise floor so noise floor will gradually change during processing:
  1096. @example
  1097. afftdn=nr=10:nf=-80:tn=1
  1098. @end example
  1099. @item
  1100. Reduce noise by 20dB, using noise floor of -40dB and using commands to take noise profile
  1101. of first 0.4 seconds of input audio:
  1102. @example
  1103. asendcmd=0.0 afftdn sn start,asendcmd=0.4 afftdn sn stop,afftdn=nr=20:nf=-40
  1104. @end example
  1105. @end itemize
  1106. @section afftfilt
  1107. Apply arbitrary expressions to samples in frequency domain.
  1108. @table @option
  1109. @item real
  1110. Set frequency domain real expression for each separate channel separated
  1111. by '|'. Default is "re".
  1112. If the number of input channels is greater than the number of
  1113. expressions, the last specified expression is used for the remaining
  1114. output channels.
  1115. @item imag
  1116. Set frequency domain imaginary expression for each separate channel
  1117. separated by '|'. Default is "im".
  1118. Each expression in @var{real} and @var{imag} can contain the following
  1119. constants and functions:
  1120. @table @option
  1121. @item sr
  1122. sample rate
  1123. @item b
  1124. current frequency bin number
  1125. @item nb
  1126. number of available bins
  1127. @item ch
  1128. channel number of the current expression
  1129. @item chs
  1130. number of channels
  1131. @item pts
  1132. current frame pts
  1133. @item re
  1134. current real part of frequency bin of current channel
  1135. @item im
  1136. current imaginary part of frequency bin of current channel
  1137. @item real(b, ch)
  1138. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  1139. @item imag(b, ch)
  1140. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  1141. @end table
  1142. @item win_size
  1143. Set window size. Allowed range is from 16 to 131072.
  1144. Default is @code{4096}
  1145. @item win_func
  1146. Set window function.
  1147. It accepts the following values:
  1148. @table @samp
  1149. @item rect
  1150. @item bartlett
  1151. @item hann, hanning
  1152. @item hamming
  1153. @item blackman
  1154. @item welch
  1155. @item flattop
  1156. @item bharris
  1157. @item bnuttall
  1158. @item bhann
  1159. @item sine
  1160. @item nuttall
  1161. @item lanczos
  1162. @item gauss
  1163. @item tukey
  1164. @item dolph
  1165. @item cauchy
  1166. @item parzen
  1167. @item poisson
  1168. @item bohman
  1169. @end table
  1170. Default is @code{hann}.
  1171. @item overlap
  1172. Set window overlap. If set to 1, the recommended overlap for selected
  1173. window function will be picked. Default is @code{0.75}.
  1174. @end table
  1175. @subsection Examples
  1176. @itemize
  1177. @item
  1178. Leave almost only low frequencies in audio:
  1179. @example
  1180. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  1181. @end example
  1182. @item
  1183. Apply robotize effect:
  1184. @example
  1185. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  1186. @end example
  1187. @item
  1188. Apply whisper effect:
  1189. @example
  1190. 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"
  1191. @end example
  1192. @end itemize
  1193. @anchor{afir}
  1194. @section afir
  1195. Apply an arbitrary Finite Impulse Response filter.
  1196. This filter is designed for applying long FIR filters,
  1197. up to 60 seconds long.
  1198. It can be used as component for digital crossover filters,
  1199. room equalization, cross talk cancellation, wavefield synthesis,
  1200. auralization, ambiophonics, ambisonics and spatialization.
  1201. This filter uses the streams higher than first one as FIR coefficients.
  1202. If the non-first stream holds a single channel, it will be used
  1203. for all input channels in the first stream, otherwise
  1204. the number of channels in the non-first stream must be same as
  1205. the number of channels in the first stream.
  1206. It accepts the following parameters:
  1207. @table @option
  1208. @item dry
  1209. Set dry gain. This sets input gain.
  1210. @item wet
  1211. Set wet gain. This sets final output gain.
  1212. @item length
  1213. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  1214. @item gtype
  1215. Enable applying gain measured from power of IR.
  1216. Set which approach to use for auto gain measurement.
  1217. @table @option
  1218. @item none
  1219. Do not apply any gain.
  1220. @item peak
  1221. select peak gain, very conservative approach. This is default value.
  1222. @item dc
  1223. select DC gain, limited application.
  1224. @item gn
  1225. select gain to noise approach, this is most popular one.
  1226. @end table
  1227. @item irgain
  1228. Set gain to be applied to IR coefficients before filtering.
  1229. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  1230. @item irfmt
  1231. Set format of IR stream. Can be @code{mono} or @code{input}.
  1232. Default is @code{input}.
  1233. @item maxir
  1234. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  1235. Allowed range is 0.1 to 60 seconds.
  1236. @item response
  1237. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1238. By default it is disabled.
  1239. @item channel
  1240. Set for which IR channel to display frequency response. By default is first channel
  1241. displayed. This option is used only when @var{response} is enabled.
  1242. @item size
  1243. Set video stream size. This option is used only when @var{response} is enabled.
  1244. @item rate
  1245. Set video stream frame rate. This option is used only when @var{response} is enabled.
  1246. @item minp
  1247. Set minimal partition size used for convolution. Default is @var{8192}.
  1248. Allowed range is from @var{1} to @var{32768}.
  1249. Lower values decreases latency at cost of higher CPU usage.
  1250. @item maxp
  1251. Set maximal partition size used for convolution. Default is @var{8192}.
  1252. Allowed range is from @var{8} to @var{32768}.
  1253. Lower values may increase CPU usage.
  1254. @item nbirs
  1255. Set number of input impulse responses streams which will be switchable at runtime.
  1256. Allowed range is from @var{1} to @var{32}. Default is @var{1}.
  1257. @item ir
  1258. Set IR stream which will be used for convolution, starting from @var{0}, should always be
  1259. lower than supplied value by @code{nbirs} option. Default is @var{0}.
  1260. This option can be changed at runtime via @ref{commands}.
  1261. @end table
  1262. @subsection Examples
  1263. @itemize
  1264. @item
  1265. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  1266. @example
  1267. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  1268. @end example
  1269. @end itemize
  1270. @anchor{aformat}
  1271. @section aformat
  1272. Set output format constraints for the input audio. The framework will
  1273. negotiate the most appropriate format to minimize conversions.
  1274. It accepts the following parameters:
  1275. @table @option
  1276. @item sample_fmts, f
  1277. A '|'-separated list of requested sample formats.
  1278. @item sample_rates, r
  1279. A '|'-separated list of requested sample rates.
  1280. @item channel_layouts, cl
  1281. A '|'-separated list of requested channel layouts.
  1282. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1283. for the required syntax.
  1284. @end table
  1285. If a parameter is omitted, all values are allowed.
  1286. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1287. @example
  1288. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1289. @end example
  1290. @section afreqshift
  1291. Apply frequency shift to input audio samples.
  1292. The filter accepts the following options:
  1293. @table @option
  1294. @item shift
  1295. Specify frequency shift. Allowed range is -INT_MAX to INT_MAX.
  1296. Default value is 0.0.
  1297. @item level
  1298. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  1299. Default value is 1.0.
  1300. @item order
  1301. Set filter order used for filtering. Allowed range is from 1 to 16.
  1302. Default value is 8.
  1303. @end table
  1304. @subsection Commands
  1305. This filter supports the all above options as @ref{commands}.
  1306. @section afwtdn
  1307. Reduce broadband noise from input samples using Wavelets.
  1308. A description of the accepted options follows.
  1309. @table @option
  1310. @item sigma
  1311. Set the noise sigma, allowed range is from 0 to 1.
  1312. Default value is 0.
  1313. This option controls strength of denoising applied to input samples.
  1314. Most useful way to set this option is via decibels, eg. -45dB.
  1315. @item levels
  1316. Set the number of wavelet levels of decomposition.
  1317. Allowed range is from 1 to 12.
  1318. Default value is 10.
  1319. Setting this too low make denoising performance very poor.
  1320. @item wavet
  1321. Set wavelet type for decomposition of input frame.
  1322. They are sorted by number of coefficients, from lowest to highest.
  1323. More coefficients means worse filtering speed, but overall better quality.
  1324. Available wavelets are:
  1325. @table @samp
  1326. @item sym2
  1327. @item sym4
  1328. @item rbior68
  1329. @item deb10
  1330. @item sym10
  1331. @item coif5
  1332. @item bl3
  1333. @end table
  1334. @item percent
  1335. Set percent of full denoising. Allowed range is from 0 to 100 percent.
  1336. Default value is 85 percent or partial denoising.
  1337. @item profile
  1338. If enabled, first input frame will be used as noise profile.
  1339. If first frame samples contain non-noise performance will be very poor.
  1340. @item adaptive
  1341. If enabled, input frames are analyzed for presence of noise.
  1342. If noise is detected with high possibility then input frame profile will be
  1343. used for processing following frames, until new noise frame is detected.
  1344. @item samples
  1345. Set size of single frame in number of samples. Allowed range is from 512 to
  1346. 65536. Default frame size is 8192 samples.
  1347. @item softness
  1348. Set softness applied inside thresholding function. Allowed range is from 0 to
  1349. 10. Default softness is 1.
  1350. @end table
  1351. @subsection Commands
  1352. This filter supports the all above options as @ref{commands}.
  1353. @section agate
  1354. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1355. processing reduces disturbing noise between useful signals.
  1356. Gating is done by detecting the volume below a chosen level @var{threshold}
  1357. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1358. floor is set via @var{range}. Because an exact manipulation of the signal
  1359. would cause distortion of the waveform the reduction can be levelled over
  1360. time. This is done by setting @var{attack} and @var{release}.
  1361. @var{attack} determines how long the signal has to fall below the threshold
  1362. before any reduction will occur and @var{release} sets the time the signal
  1363. has to rise above the threshold to reduce the reduction again.
  1364. Shorter signals than the chosen attack time will be left untouched.
  1365. @table @option
  1366. @item level_in
  1367. Set input level before filtering.
  1368. Default is 1. Allowed range is from 0.015625 to 64.
  1369. @item mode
  1370. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1371. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1372. will be amplified, expanding dynamic range in upward direction.
  1373. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1374. @item range
  1375. Set the level of gain reduction when the signal is below the threshold.
  1376. Default is 0.06125. Allowed range is from 0 to 1.
  1377. Setting this to 0 disables reduction and then filter behaves like expander.
  1378. @item threshold
  1379. If a signal rises above this level the gain reduction is released.
  1380. Default is 0.125. Allowed range is from 0 to 1.
  1381. @item ratio
  1382. Set a ratio by which the signal is reduced.
  1383. Default is 2. Allowed range is from 1 to 9000.
  1384. @item attack
  1385. Amount of milliseconds the signal has to rise above the threshold before gain
  1386. reduction stops.
  1387. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1388. @item release
  1389. Amount of milliseconds the signal has to fall below the threshold before the
  1390. reduction is increased again. Default is 250 milliseconds.
  1391. Allowed range is from 0.01 to 9000.
  1392. @item makeup
  1393. Set amount of amplification of signal after processing.
  1394. Default is 1. Allowed range is from 1 to 64.
  1395. @item knee
  1396. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1397. Default is 2.828427125. Allowed range is from 1 to 8.
  1398. @item detection
  1399. Choose if exact signal should be taken for detection or an RMS like one.
  1400. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1401. @item link
  1402. Choose if the average level between all channels or the louder channel affects
  1403. the reduction.
  1404. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1405. @end table
  1406. @subsection Commands
  1407. This filter supports the all above options as @ref{commands}.
  1408. @section aiir
  1409. Apply an arbitrary Infinite Impulse Response filter.
  1410. It accepts the following parameters:
  1411. @table @option
  1412. @item zeros, z
  1413. Set B/numerator/zeros/reflection coefficients.
  1414. @item poles, p
  1415. Set A/denominator/poles/ladder coefficients.
  1416. @item gains, k
  1417. Set channels gains.
  1418. @item dry_gain
  1419. Set input gain.
  1420. @item wet_gain
  1421. Set output gain.
  1422. @item format, f
  1423. Set coefficients format.
  1424. @table @samp
  1425. @item ll
  1426. lattice-ladder function
  1427. @item sf
  1428. analog transfer function
  1429. @item tf
  1430. digital transfer function
  1431. @item zp
  1432. Z-plane zeros/poles, cartesian (default)
  1433. @item pr
  1434. Z-plane zeros/poles, polar radians
  1435. @item pd
  1436. Z-plane zeros/poles, polar degrees
  1437. @item sp
  1438. S-plane zeros/poles
  1439. @end table
  1440. @item process, r
  1441. Set type of processing.
  1442. @table @samp
  1443. @item d
  1444. direct processing
  1445. @item s
  1446. serial processing
  1447. @item p
  1448. parallel processing
  1449. @end table
  1450. @item precision, e
  1451. Set filtering precision.
  1452. @table @samp
  1453. @item dbl
  1454. double-precision floating-point (default)
  1455. @item flt
  1456. single-precision floating-point
  1457. @item i32
  1458. 32-bit integers
  1459. @item i16
  1460. 16-bit integers
  1461. @end table
  1462. @item normalize, n
  1463. Normalize filter coefficients, by default is enabled.
  1464. Enabling it will normalize magnitude response at DC to 0dB.
  1465. @item mix
  1466. How much to use filtered signal in output. Default is 1.
  1467. Range is between 0 and 1.
  1468. @item response
  1469. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1470. By default it is disabled.
  1471. @item channel
  1472. Set for which IR channel to display frequency response. By default is first channel
  1473. displayed. This option is used only when @var{response} is enabled.
  1474. @item size
  1475. Set video stream size. This option is used only when @var{response} is enabled.
  1476. @end table
  1477. Coefficients in @code{tf} and @code{sf} format are separated by spaces and are in ascending
  1478. order.
  1479. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1480. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1481. imaginary unit.
  1482. Different coefficients and gains can be provided for every channel, in such case
  1483. use '|' to separate coefficients or gains. Last provided coefficients will be
  1484. used for all remaining channels.
  1485. @subsection Examples
  1486. @itemize
  1487. @item
  1488. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1489. @example
  1490. 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
  1491. @end example
  1492. @item
  1493. Same as above but in @code{zp} format:
  1494. @example
  1495. 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
  1496. @end example
  1497. @item
  1498. Apply 3-rd order analog normalized Butterworth low-pass filter, using analog transfer function format:
  1499. @example
  1500. aiir=z=1.3057 0 0 0:p=1.3057 2.3892 2.1860 1:f=sf:r=d
  1501. @end example
  1502. @end itemize
  1503. @section alimiter
  1504. The limiter prevents an input signal from rising over a desired threshold.
  1505. This limiter uses lookahead technology to prevent your signal from distorting.
  1506. It means that there is a small delay after the signal is processed. Keep in mind
  1507. that the delay it produces is the attack time you set.
  1508. The filter accepts the following options:
  1509. @table @option
  1510. @item level_in
  1511. Set input gain. Default is 1.
  1512. @item level_out
  1513. Set output gain. Default is 1.
  1514. @item limit
  1515. Don't let signals above this level pass the limiter. Default is 1.
  1516. @item attack
  1517. The limiter will reach its attenuation level in this amount of time in
  1518. milliseconds. Default is 5 milliseconds.
  1519. @item release
  1520. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1521. Default is 50 milliseconds.
  1522. @item asc
  1523. When gain reduction is always needed ASC takes care of releasing to an
  1524. average reduction level rather than reaching a reduction of 0 in the release
  1525. time.
  1526. @item asc_level
  1527. Select how much the release time is affected by ASC, 0 means nearly no changes
  1528. in release time while 1 produces higher release times.
  1529. @item level
  1530. Auto level output signal. Default is enabled.
  1531. This normalizes audio back to 0dB if enabled.
  1532. @end table
  1533. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1534. with @ref{aresample} before applying this filter.
  1535. @section allpass
  1536. Apply a two-pole all-pass filter with central frequency (in Hz)
  1537. @var{frequency}, and filter-width @var{width}.
  1538. An all-pass filter changes the audio's frequency to phase relationship
  1539. without changing its frequency to amplitude relationship.
  1540. The filter accepts the following options:
  1541. @table @option
  1542. @item frequency, f
  1543. Set frequency in Hz.
  1544. @item width_type, t
  1545. Set method to specify band-width of filter.
  1546. @table @option
  1547. @item h
  1548. Hz
  1549. @item q
  1550. Q-Factor
  1551. @item o
  1552. octave
  1553. @item s
  1554. slope
  1555. @item k
  1556. kHz
  1557. @end table
  1558. @item width, w
  1559. Specify the band-width of a filter in width_type units.
  1560. @item mix, m
  1561. How much to use filtered signal in output. Default is 1.
  1562. Range is between 0 and 1.
  1563. @item channels, c
  1564. Specify which channels to filter, by default all available are filtered.
  1565. @item normalize, n
  1566. Normalize biquad coefficients, by default is disabled.
  1567. Enabling it will normalize magnitude response at DC to 0dB.
  1568. @item order, o
  1569. Set the filter order, can be 1 or 2. Default is 2.
  1570. @item transform, a
  1571. Set transform type of IIR filter.
  1572. @table @option
  1573. @item di
  1574. @item dii
  1575. @item tdii
  1576. @item latt
  1577. @item svf
  1578. @end table
  1579. @item precision, r
  1580. Set precison of filtering.
  1581. @table @option
  1582. @item auto
  1583. Pick automatic sample format depending on surround filters.
  1584. @item s16
  1585. Always use signed 16-bit.
  1586. @item s32
  1587. Always use signed 32-bit.
  1588. @item f32
  1589. Always use float 32-bit.
  1590. @item f64
  1591. Always use float 64-bit.
  1592. @end table
  1593. @end table
  1594. @subsection Commands
  1595. This filter supports the following commands:
  1596. @table @option
  1597. @item frequency, f
  1598. Change allpass frequency.
  1599. Syntax for the command is : "@var{frequency}"
  1600. @item width_type, t
  1601. Change allpass width_type.
  1602. Syntax for the command is : "@var{width_type}"
  1603. @item width, w
  1604. Change allpass width.
  1605. Syntax for the command is : "@var{width}"
  1606. @item mix, m
  1607. Change allpass mix.
  1608. Syntax for the command is : "@var{mix}"
  1609. @end table
  1610. @section aloop
  1611. Loop audio samples.
  1612. The filter accepts the following options:
  1613. @table @option
  1614. @item loop
  1615. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1616. Default is 0.
  1617. @item size
  1618. Set maximal number of samples. Default is 0.
  1619. @item start
  1620. Set first sample of loop. Default is 0.
  1621. @end table
  1622. @anchor{amerge}
  1623. @section amerge
  1624. Merge two or more audio streams into a single multi-channel stream.
  1625. The filter accepts the following options:
  1626. @table @option
  1627. @item inputs
  1628. Set the number of inputs. Default is 2.
  1629. @end table
  1630. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1631. the channel layout of the output will be set accordingly and the channels
  1632. will be reordered as necessary. If the channel layouts of the inputs are not
  1633. disjoint, the output will have all the channels of the first input then all
  1634. the channels of the second input, in that order, and the channel layout of
  1635. the output will be the default value corresponding to the total number of
  1636. channels.
  1637. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1638. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1639. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1640. first input, b1 is the first channel of the second input).
  1641. On the other hand, if both input are in stereo, the output channels will be
  1642. in the default order: a1, a2, b1, b2, and the channel layout will be
  1643. arbitrarily set to 4.0, which may or may not be the expected value.
  1644. All inputs must have the same sample rate, and format.
  1645. If inputs do not have the same duration, the output will stop with the
  1646. shortest.
  1647. @subsection Examples
  1648. @itemize
  1649. @item
  1650. Merge two mono files into a stereo stream:
  1651. @example
  1652. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1653. @end example
  1654. @item
  1655. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1656. @example
  1657. 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
  1658. @end example
  1659. @end itemize
  1660. @section amix
  1661. Mixes multiple audio inputs into a single output.
  1662. Note that this filter only supports float samples (the @var{amerge}
  1663. and @var{pan} audio filters support many formats). If the @var{amix}
  1664. input has integer samples then @ref{aresample} will be automatically
  1665. inserted to perform the conversion to float samples.
  1666. For example
  1667. @example
  1668. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1669. @end example
  1670. will mix 3 input audio streams to a single output with the same duration as the
  1671. first input and a dropout transition time of 3 seconds.
  1672. It accepts the following parameters:
  1673. @table @option
  1674. @item inputs
  1675. The number of inputs. If unspecified, it defaults to 2.
  1676. @item duration
  1677. How to determine the end-of-stream.
  1678. @table @option
  1679. @item longest
  1680. The duration of the longest input. (default)
  1681. @item shortest
  1682. The duration of the shortest input.
  1683. @item first
  1684. The duration of the first input.
  1685. @end table
  1686. @item dropout_transition
  1687. The transition time, in seconds, for volume renormalization when an input
  1688. stream ends. The default value is 2 seconds.
  1689. @item weights
  1690. Specify weight of each input audio stream as sequence.
  1691. Each weight is separated by space. By default all inputs have same weight.
  1692. @item normalize
  1693. Always scale inputs instead of only doing summation of samples.
  1694. Beware of heavy clipping if inputs are not normalized prior or after filtering
  1695. by this filter if this option is disabled. By default is enabled.
  1696. @end table
  1697. @subsection Commands
  1698. This filter supports the following commands:
  1699. @table @option
  1700. @item weights
  1701. @item normalize
  1702. Syntax is same as option with same name.
  1703. @end table
  1704. @section amultiply
  1705. Multiply first audio stream with second audio stream and store result
  1706. in output audio stream. Multiplication is done by multiplying each
  1707. sample from first stream with sample at same position from second stream.
  1708. With this element-wise multiplication one can create amplitude fades and
  1709. amplitude modulations.
  1710. @section anequalizer
  1711. High-order parametric multiband equalizer for each channel.
  1712. It accepts the following parameters:
  1713. @table @option
  1714. @item params
  1715. This option string is in format:
  1716. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1717. Each equalizer band is separated by '|'.
  1718. @table @option
  1719. @item chn
  1720. Set channel number to which equalization will be applied.
  1721. If input doesn't have that channel the entry is ignored.
  1722. @item f
  1723. Set central frequency for band.
  1724. If input doesn't have that frequency the entry is ignored.
  1725. @item w
  1726. Set band width in Hertz.
  1727. @item g
  1728. Set band gain in dB.
  1729. @item t
  1730. Set filter type for band, optional, can be:
  1731. @table @samp
  1732. @item 0
  1733. Butterworth, this is default.
  1734. @item 1
  1735. Chebyshev type 1.
  1736. @item 2
  1737. Chebyshev type 2.
  1738. @end table
  1739. @end table
  1740. @item curves
  1741. With this option activated frequency response of anequalizer is displayed
  1742. in video stream.
  1743. @item size
  1744. Set video stream size. Only useful if curves option is activated.
  1745. @item mgain
  1746. Set max gain that will be displayed. Only useful if curves option is activated.
  1747. Setting this to a reasonable value makes it possible to display gain which is derived from
  1748. neighbour bands which are too close to each other and thus produce higher gain
  1749. when both are activated.
  1750. @item fscale
  1751. Set frequency scale used to draw frequency response in video output.
  1752. Can be linear or logarithmic. Default is logarithmic.
  1753. @item colors
  1754. Set color for each channel curve which is going to be displayed in video stream.
  1755. This is list of color names separated by space or by '|'.
  1756. Unrecognised or missing colors will be replaced by white color.
  1757. @end table
  1758. @subsection Examples
  1759. @itemize
  1760. @item
  1761. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1762. for first 2 channels using Chebyshev type 1 filter:
  1763. @example
  1764. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1765. @end example
  1766. @end itemize
  1767. @subsection Commands
  1768. This filter supports the following commands:
  1769. @table @option
  1770. @item change
  1771. Alter existing filter parameters.
  1772. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1773. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1774. error is returned.
  1775. @var{freq} set new frequency parameter.
  1776. @var{width} set new width parameter in Hertz.
  1777. @var{gain} set new gain parameter in dB.
  1778. Full filter invocation with asendcmd may look like this:
  1779. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1780. @end table
  1781. @section anlmdn
  1782. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1783. Each sample is adjusted by looking for other samples with similar contexts. This
  1784. context similarity is defined by comparing their surrounding patches of size
  1785. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1786. The filter accepts the following options:
  1787. @table @option
  1788. @item strength, s
  1789. Set denoising strength. Allowed range is from 0.00001 to 10000. Default value is 0.00001.
  1790. @item patch, p
  1791. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1792. Default value is 2 milliseconds.
  1793. @item research, r
  1794. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1795. Default value is 6 milliseconds.
  1796. @item output, o
  1797. Set the output mode.
  1798. It accepts the following values:
  1799. @table @option
  1800. @item i
  1801. Pass input unchanged.
  1802. @item o
  1803. Pass noise filtered out.
  1804. @item n
  1805. Pass only noise.
  1806. Default value is @var{o}.
  1807. @end table
  1808. @item smooth, m
  1809. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{1000}.
  1810. @end table
  1811. @subsection Commands
  1812. This filter supports the all above options as @ref{commands}.
  1813. @section anlmf, anlms
  1814. Apply Normalized Least-Mean-(Squares|Fourth) algorithm to the first audio stream using the second audio stream.
  1815. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1816. relate to producing the least mean square of the error signal (difference between the desired,
  1817. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1818. A description of the accepted options follows.
  1819. @table @option
  1820. @item order
  1821. Set filter order.
  1822. @item mu
  1823. Set filter mu.
  1824. @item eps
  1825. Set the filter eps.
  1826. @item leakage
  1827. Set the filter leakage.
  1828. @item out_mode
  1829. It accepts the following values:
  1830. @table @option
  1831. @item i
  1832. Pass the 1st input.
  1833. @item d
  1834. Pass the 2nd input.
  1835. @item o
  1836. Pass filtered samples.
  1837. @item n
  1838. Pass difference between desired and filtered samples.
  1839. Default value is @var{o}.
  1840. @end table
  1841. @end table
  1842. @subsection Examples
  1843. @itemize
  1844. @item
  1845. One of many usages of this filter is noise reduction, input audio is filtered
  1846. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  1847. @example
  1848. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1849. @end example
  1850. @end itemize
  1851. @subsection Commands
  1852. This filter supports the same commands as options, excluding option @code{order}.
  1853. @section anull
  1854. Pass the audio source unchanged to the output.
  1855. @section apad
  1856. Pad the end of an audio stream with silence.
  1857. This can be used together with @command{ffmpeg} @option{-shortest} to
  1858. extend audio streams to the same length as the video stream.
  1859. A description of the accepted options follows.
  1860. @table @option
  1861. @item packet_size
  1862. Set silence packet size. Default value is 4096.
  1863. @item pad_len
  1864. Set the number of samples of silence to add to the end. After the
  1865. value is reached, the stream is terminated. This option is mutually
  1866. exclusive with @option{whole_len}.
  1867. @item whole_len
  1868. Set the minimum total number of samples in the output audio stream. If
  1869. the value is longer than the input audio length, silence is added to
  1870. the end, until the value is reached. This option is mutually exclusive
  1871. with @option{pad_len}.
  1872. @item pad_dur
  1873. Specify the duration of samples of silence to add. See
  1874. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1875. for the accepted syntax. Used only if set to non-negative value.
  1876. @item whole_dur
  1877. Specify the minimum total duration in the output audio stream. See
  1878. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1879. for the accepted syntax. Used only if set to non-negative value. If the value is longer than
  1880. the input audio length, silence is added to the end, until the value is reached.
  1881. This option is mutually exclusive with @option{pad_dur}
  1882. @end table
  1883. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1884. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1885. the input stream indefinitely.
  1886. Note that for ffmpeg 4.4 and earlier a zero @option{pad_dur} or
  1887. @option{whole_dur} also caused the filter to add silence indefinitely.
  1888. @subsection Examples
  1889. @itemize
  1890. @item
  1891. Add 1024 samples of silence to the end of the input:
  1892. @example
  1893. apad=pad_len=1024
  1894. @end example
  1895. @item
  1896. Make sure the audio output will contain at least 10000 samples, pad
  1897. the input with silence if required:
  1898. @example
  1899. apad=whole_len=10000
  1900. @end example
  1901. @item
  1902. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1903. video stream will always result the shortest and will be converted
  1904. until the end in the output file when using the @option{shortest}
  1905. option:
  1906. @example
  1907. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1908. @end example
  1909. @end itemize
  1910. @section aphaser
  1911. Add a phasing effect to the input audio.
  1912. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1913. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1914. A description of the accepted parameters follows.
  1915. @table @option
  1916. @item in_gain
  1917. Set input gain. Default is 0.4.
  1918. @item out_gain
  1919. Set output gain. Default is 0.74
  1920. @item delay
  1921. Set delay in milliseconds. Default is 3.0.
  1922. @item decay
  1923. Set decay. Default is 0.4.
  1924. @item speed
  1925. Set modulation speed in Hz. Default is 0.5.
  1926. @item type
  1927. Set modulation type. Default is triangular.
  1928. It accepts the following values:
  1929. @table @samp
  1930. @item triangular, t
  1931. @item sinusoidal, s
  1932. @end table
  1933. @end table
  1934. @section aphaseshift
  1935. Apply phase shift to input audio samples.
  1936. The filter accepts the following options:
  1937. @table @option
  1938. @item shift
  1939. Specify phase shift. Allowed range is from -1.0 to 1.0.
  1940. Default value is 0.0.
  1941. @item level
  1942. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  1943. Default value is 1.0.
  1944. @item order
  1945. Set filter order used for filtering. Allowed range is from 1 to 16.
  1946. Default value is 8.
  1947. @end table
  1948. @subsection Commands
  1949. This filter supports the all above options as @ref{commands}.
  1950. @section apsyclip
  1951. Apply Psychoacoustic clipper to input audio stream.
  1952. The filter accepts the following options:
  1953. @table @option
  1954. @item level_in
  1955. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1956. @item level_out
  1957. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1958. @item clip
  1959. Set the clipping start value. Default value is 0dBFS or 1.
  1960. @item diff
  1961. Output only difference samples, useful to hear introduced distortions.
  1962. By default is disabled.
  1963. @item adaptive
  1964. Set strength of adaptive distortion applied. Default value is 0.5.
  1965. Allowed range is from 0 to 1.
  1966. @item iterations
  1967. Set number of iterations of psychoacoustic clipper.
  1968. Allowed range is from 1 to 20. Default value is 10.
  1969. @item level
  1970. Auto level output signal. Default is disabled.
  1971. This normalizes audio back to 0dBFS if enabled.
  1972. @end table
  1973. @subsection Commands
  1974. This filter supports the all above options as @ref{commands}.
  1975. @section apulsator
  1976. Audio pulsator is something between an autopanner and a tremolo.
  1977. But it can produce funny stereo effects as well. Pulsator changes the volume
  1978. of the left and right channel based on a LFO (low frequency oscillator) with
  1979. different waveforms and shifted phases.
  1980. This filter have the ability to define an offset between left and right
  1981. channel. An offset of 0 means that both LFO shapes match each other.
  1982. The left and right channel are altered equally - a conventional tremolo.
  1983. An offset of 50% means that the shape of the right channel is exactly shifted
  1984. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1985. an autopanner. At 1 both curves match again. Every setting in between moves the
  1986. phase shift gapless between all stages and produces some "bypassing" sounds with
  1987. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1988. the 0.5) the faster the signal passes from the left to the right speaker.
  1989. The filter accepts the following options:
  1990. @table @option
  1991. @item level_in
  1992. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1993. @item level_out
  1994. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1995. @item mode
  1996. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1997. sawup or sawdown. Default is sine.
  1998. @item amount
  1999. Set modulation. Define how much of original signal is affected by the LFO.
  2000. @item offset_l
  2001. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  2002. @item offset_r
  2003. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  2004. @item width
  2005. Set pulse width. Default is 1. Allowed range is [0 - 2].
  2006. @item timing
  2007. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  2008. @item bpm
  2009. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  2010. is set to bpm.
  2011. @item ms
  2012. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  2013. is set to ms.
  2014. @item hz
  2015. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  2016. if timing is set to hz.
  2017. @end table
  2018. @anchor{aresample}
  2019. @section aresample
  2020. Resample the input audio to the specified parameters, using the
  2021. libswresample library. If none are specified then the filter will
  2022. automatically convert between its input and output.
  2023. This filter is also able to stretch/squeeze the audio data to make it match
  2024. the timestamps or to inject silence / cut out audio to make it match the
  2025. timestamps, do a combination of both or do neither.
  2026. The filter accepts the syntax
  2027. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  2028. expresses a sample rate and @var{resampler_options} is a list of
  2029. @var{key}=@var{value} pairs, separated by ":". See the
  2030. @ref{Resampler Options,,"Resampler Options" section in the
  2031. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  2032. for the complete list of supported options.
  2033. @subsection Examples
  2034. @itemize
  2035. @item
  2036. Resample the input audio to 44100Hz:
  2037. @example
  2038. aresample=44100
  2039. @end example
  2040. @item
  2041. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  2042. samples per second compensation:
  2043. @example
  2044. aresample=async=1000
  2045. @end example
  2046. @end itemize
  2047. @section areverse
  2048. Reverse an audio clip.
  2049. Warning: This filter requires memory to buffer the entire clip, so trimming
  2050. is suggested.
  2051. @subsection Examples
  2052. @itemize
  2053. @item
  2054. Take the first 5 seconds of a clip, and reverse it.
  2055. @example
  2056. atrim=end=5,areverse
  2057. @end example
  2058. @end itemize
  2059. @section arnndn
  2060. Reduce noise from speech using Recurrent Neural Networks.
  2061. This filter accepts the following options:
  2062. @table @option
  2063. @item model, m
  2064. Set train model file to load. This option is always required.
  2065. @item mix
  2066. Set how much to mix filtered samples into final output.
  2067. Allowed range is from -1 to 1. Default value is 1.
  2068. Negative values are special, they set how much to keep filtered noise
  2069. in the final filter output. Set this option to -1 to hear actual
  2070. noise removed from input signal.
  2071. @end table
  2072. @subsection Commands
  2073. This filter supports the all above options as @ref{commands}.
  2074. @section asdr
  2075. Measure Audio Signal-to-Distortion Ratio.
  2076. This filter takes two audio streams for input, and outputs first
  2077. audio stream.
  2078. Results are in dB per channel at end of either input.
  2079. @section asetnsamples
  2080. Set the number of samples per each output audio frame.
  2081. The last output packet may contain a different number of samples, as
  2082. the filter will flush all the remaining samples when the input audio
  2083. signals its end.
  2084. The filter accepts the following options:
  2085. @table @option
  2086. @item nb_out_samples, n
  2087. Set the number of frames per each output audio frame. The number is
  2088. intended as the number of samples @emph{per each channel}.
  2089. Default value is 1024.
  2090. @item pad, p
  2091. If set to 1, the filter will pad the last audio frame with zeroes, so
  2092. that the last frame will contain the same number of samples as the
  2093. previous ones. Default value is 1.
  2094. @end table
  2095. For example, to set the number of per-frame samples to 1234 and
  2096. disable padding for the last frame, use:
  2097. @example
  2098. asetnsamples=n=1234:p=0
  2099. @end example
  2100. @section asetrate
  2101. Set the sample rate without altering the PCM data.
  2102. This will result in a change of speed and pitch.
  2103. The filter accepts the following options:
  2104. @table @option
  2105. @item sample_rate, r
  2106. Set the output sample rate. Default is 44100 Hz.
  2107. @end table
  2108. @section ashowinfo
  2109. Show a line containing various information for each input audio frame.
  2110. The input audio is not modified.
  2111. The shown line contains a sequence of key/value pairs of the form
  2112. @var{key}:@var{value}.
  2113. The following values are shown in the output:
  2114. @table @option
  2115. @item n
  2116. The (sequential) number of the input frame, starting from 0.
  2117. @item pts
  2118. The presentation timestamp of the input frame, in time base units; the time base
  2119. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  2120. @item pts_time
  2121. The presentation timestamp of the input frame in seconds.
  2122. @item pos
  2123. position of the frame in the input stream, -1 if this information in
  2124. unavailable and/or meaningless (for example in case of synthetic audio)
  2125. @item fmt
  2126. The sample format.
  2127. @item chlayout
  2128. The channel layout.
  2129. @item rate
  2130. The sample rate for the audio frame.
  2131. @item nb_samples
  2132. The number of samples (per channel) in the frame.
  2133. @item checksum
  2134. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  2135. audio, the data is treated as if all the planes were concatenated.
  2136. @item plane_checksums
  2137. A list of Adler-32 checksums for each data plane.
  2138. @end table
  2139. @section asoftclip
  2140. Apply audio soft clipping.
  2141. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  2142. along a smooth curve, rather than the abrupt shape of hard-clipping.
  2143. This filter accepts the following options:
  2144. @table @option
  2145. @item type
  2146. Set type of soft-clipping.
  2147. It accepts the following values:
  2148. @table @option
  2149. @item hard
  2150. @item tanh
  2151. @item atan
  2152. @item cubic
  2153. @item exp
  2154. @item alg
  2155. @item quintic
  2156. @item sin
  2157. @item erf
  2158. @end table
  2159. @item threshold
  2160. Set threshold from where to start clipping. Default value is 0dB or 1.
  2161. @item output
  2162. Set gain applied to output. Default value is 0dB or 1.
  2163. @item param
  2164. Set additional parameter which controls sigmoid function.
  2165. @item oversample
  2166. Set oversampling factor.
  2167. @end table
  2168. @subsection Commands
  2169. This filter supports the all above options as @ref{commands}.
  2170. @section aspectralstats
  2171. Display frequency domain statistical information about the audio channels.
  2172. Statistics are calculated and stored as metadata for each audio channel and for each audio frame.
  2173. It accepts the following option:
  2174. @table @option
  2175. @item win_size
  2176. Set the window length in samples. Default value is 2048.
  2177. Allowed range is from 32 to 65536.
  2178. @item win_func
  2179. Set window function.
  2180. It accepts the following values:
  2181. @table @samp
  2182. @item rect
  2183. @item bartlett
  2184. @item hann, hanning
  2185. @item hamming
  2186. @item blackman
  2187. @item welch
  2188. @item flattop
  2189. @item bharris
  2190. @item bnuttall
  2191. @item bhann
  2192. @item sine
  2193. @item nuttall
  2194. @item lanczos
  2195. @item gauss
  2196. @item tukey
  2197. @item dolph
  2198. @item cauchy
  2199. @item parzen
  2200. @item poisson
  2201. @item bohman
  2202. @end table
  2203. Default is @code{hann}.
  2204. @item overlap
  2205. Set window overlap. Allowed range is from @code{0}
  2206. to @code{1}. Default value is @code{0.5}.
  2207. @end table
  2208. A list of each metadata key follows:
  2209. @table @option
  2210. @item mean
  2211. @item variance
  2212. @item centroid
  2213. @item spread
  2214. @item skewness
  2215. @item kurtosis
  2216. @item entropy
  2217. @item flatness
  2218. @item crest
  2219. @item flux
  2220. @item slope
  2221. @item decrease
  2222. @item rolloff
  2223. @end table
  2224. @section asr
  2225. Automatic Speech Recognition
  2226. This filter uses PocketSphinx for speech recognition. To enable
  2227. compilation of this filter, you need to configure FFmpeg with
  2228. @code{--enable-pocketsphinx}.
  2229. It accepts the following options:
  2230. @table @option
  2231. @item rate
  2232. Set sampling rate of input audio. Defaults is @code{16000}.
  2233. This need to match speech models, otherwise one will get poor results.
  2234. @item hmm
  2235. Set dictionary containing acoustic model files.
  2236. @item dict
  2237. Set pronunciation dictionary.
  2238. @item lm
  2239. Set language model file.
  2240. @item lmctl
  2241. Set language model set.
  2242. @item lmname
  2243. Set which language model to use.
  2244. @item logfn
  2245. Set output for log messages.
  2246. @end table
  2247. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  2248. @anchor{astats}
  2249. @section astats
  2250. Display time domain statistical information about the audio channels.
  2251. Statistics are calculated and displayed for each audio channel and,
  2252. where applicable, an overall figure is also given.
  2253. It accepts the following option:
  2254. @table @option
  2255. @item length
  2256. Short window length in seconds, used for peak and trough RMS measurement.
  2257. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0 - 10]}.
  2258. @item metadata
  2259. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  2260. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  2261. disabled.
  2262. Available keys for each channel are:
  2263. DC_offset
  2264. Min_level
  2265. Max_level
  2266. Min_difference
  2267. Max_difference
  2268. Mean_difference
  2269. RMS_difference
  2270. Peak_level
  2271. RMS_peak
  2272. RMS_trough
  2273. Crest_factor
  2274. Flat_factor
  2275. Peak_count
  2276. Noise_floor
  2277. Noise_floor_count
  2278. Entropy
  2279. Bit_depth
  2280. Dynamic_range
  2281. Zero_crossings
  2282. Zero_crossings_rate
  2283. Number_of_NaNs
  2284. Number_of_Infs
  2285. Number_of_denormals
  2286. and for Overall:
  2287. DC_offset
  2288. Min_level
  2289. Max_level
  2290. Min_difference
  2291. Max_difference
  2292. Mean_difference
  2293. RMS_difference
  2294. Peak_level
  2295. RMS_level
  2296. RMS_peak
  2297. RMS_trough
  2298. Flat_factor
  2299. Peak_count
  2300. Noise_floor
  2301. Noise_floor_count
  2302. Entropy
  2303. Bit_depth
  2304. Number_of_samples
  2305. Number_of_NaNs
  2306. Number_of_Infs
  2307. Number_of_denormals
  2308. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  2309. this @code{lavfi.astats.Overall.Peak_count}.
  2310. For description what each key means read below.
  2311. @item reset
  2312. Set the number of frames over which cumulative stats are calculated before
  2313. being reset
  2314. Default is disabled.
  2315. @item measure_perchannel
  2316. Select the parameters which are measured per channel. The metadata keys can
  2317. be used as flags, default is @option{all} which measures everything.
  2318. @option{none} disables all per channel measurement.
  2319. @item measure_overall
  2320. Select the parameters which are measured overall. The metadata keys can
  2321. be used as flags, default is @option{all} which measures everything.
  2322. @option{none} disables all overall measurement.
  2323. @end table
  2324. A description of each shown parameter follows:
  2325. @table @option
  2326. @item DC offset
  2327. Mean amplitude displacement from zero.
  2328. @item Min level
  2329. Minimal sample level.
  2330. @item Max level
  2331. Maximal sample level.
  2332. @item Min difference
  2333. Minimal difference between two consecutive samples.
  2334. @item Max difference
  2335. Maximal difference between two consecutive samples.
  2336. @item Mean difference
  2337. Mean difference between two consecutive samples.
  2338. The average of each difference between two consecutive samples.
  2339. @item RMS difference
  2340. Root Mean Square difference between two consecutive samples.
  2341. @item Peak level dB
  2342. @item RMS level dB
  2343. Standard peak and RMS level measured in dBFS.
  2344. @item RMS peak dB
  2345. @item RMS trough dB
  2346. Peak and trough values for RMS level measured over a short window.
  2347. @item Crest factor
  2348. Standard ratio of peak to RMS level (note: not in dB).
  2349. @item Flat factor
  2350. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  2351. (i.e. either @var{Min level} or @var{Max level}).
  2352. @item Peak count
  2353. Number of occasions (not the number of samples) that the signal attained either
  2354. @var{Min level} or @var{Max level}.
  2355. @item Noise floor dB
  2356. Minimum local peak measured in dBFS over a short window.
  2357. @item Noise floor count
  2358. Number of occasions (not the number of samples) that the signal attained
  2359. @var{Noise floor}.
  2360. @item Entropy
  2361. Entropy measured across whole audio. Entropy of value near 1.0 is typically measured for white noise.
  2362. @item Bit depth
  2363. Overall bit depth of audio. Number of bits used for each sample.
  2364. @item Dynamic range
  2365. Measured dynamic range of audio in dB.
  2366. @item Zero crossings
  2367. Number of points where the waveform crosses the zero level axis.
  2368. @item Zero crossings rate
  2369. Rate of Zero crossings and number of audio samples.
  2370. @end table
  2371. @section asubboost
  2372. Boost subwoofer frequencies.
  2373. The filter accepts the following options:
  2374. @table @option
  2375. @item dry
  2376. Set dry gain, how much of original signal is kept. Allowed range is from 0 to 1.
  2377. Default value is 0.7.
  2378. @item wet
  2379. Set wet gain, how much of filtered signal is kept. Allowed range is from 0 to 1.
  2380. Default value is 0.7.
  2381. @item decay
  2382. Set delay line decay gain value. Allowed range is from 0 to 1.
  2383. Default value is 0.7.
  2384. @item feedback
  2385. Set delay line feedback gain value. Allowed range is from 0 to 1.
  2386. Default value is 0.9.
  2387. @item cutoff
  2388. Set cutoff frequency in Hertz. Allowed range is 50 to 900.
  2389. Default value is 100.
  2390. @item slope
  2391. Set slope amount for cutoff frequency. Allowed range is 0.0001 to 1.
  2392. Default value is 0.5.
  2393. @item delay
  2394. Set delay. Allowed range is from 1 to 100.
  2395. Default value is 20.
  2396. @end table
  2397. @subsection Commands
  2398. This filter supports the all above options as @ref{commands}.
  2399. @section asubcut
  2400. Cut subwoofer frequencies.
  2401. This filter allows to set custom, steeper
  2402. roll off than highpass filter, and thus is able to more attenuate
  2403. frequency content in stop-band.
  2404. The filter accepts the following options:
  2405. @table @option
  2406. @item cutoff
  2407. Set cutoff frequency in Hertz. Allowed range is 2 to 200.
  2408. Default value is 20.
  2409. @item order
  2410. Set filter order. Available values are from 3 to 20.
  2411. Default value is 10.
  2412. @item level
  2413. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2414. @end table
  2415. @subsection Commands
  2416. This filter supports the all above options as @ref{commands}.
  2417. @section asupercut
  2418. Cut super frequencies.
  2419. The filter accepts the following options:
  2420. @table @option
  2421. @item cutoff
  2422. Set cutoff frequency in Hertz. Allowed range is 20000 to 192000.
  2423. Default value is 20000.
  2424. @item order
  2425. Set filter order. Available values are from 3 to 20.
  2426. Default value is 10.
  2427. @item level
  2428. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2429. @end table
  2430. @subsection Commands
  2431. This filter supports the all above options as @ref{commands}.
  2432. @section asuperpass
  2433. Apply high order Butterworth band-pass filter.
  2434. The filter accepts the following options:
  2435. @table @option
  2436. @item centerf
  2437. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2438. Default value is 1000.
  2439. @item order
  2440. Set filter order. Available values are from 4 to 20.
  2441. Default value is 4.
  2442. @item qfactor
  2443. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2444. @item level
  2445. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2446. @end table
  2447. @subsection Commands
  2448. This filter supports the all above options as @ref{commands}.
  2449. @section asuperstop
  2450. Apply high order Butterworth band-stop filter.
  2451. The filter accepts the following options:
  2452. @table @option
  2453. @item centerf
  2454. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2455. Default value is 1000.
  2456. @item order
  2457. Set filter order. Available values are from 4 to 20.
  2458. Default value is 4.
  2459. @item qfactor
  2460. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2461. @item level
  2462. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2463. @end table
  2464. @subsection Commands
  2465. This filter supports the all above options as @ref{commands}.
  2466. @section atempo
  2467. Adjust audio tempo.
  2468. The filter accepts exactly one parameter, the audio tempo. If not
  2469. specified then the filter will assume nominal 1.0 tempo. Tempo must
  2470. be in the [0.5, 100.0] range.
  2471. Note that tempo greater than 2 will skip some samples rather than
  2472. blend them in. If for any reason this is a concern it is always
  2473. possible to daisy-chain several instances of atempo to achieve the
  2474. desired product tempo.
  2475. @subsection Examples
  2476. @itemize
  2477. @item
  2478. Slow down audio to 80% tempo:
  2479. @example
  2480. atempo=0.8
  2481. @end example
  2482. @item
  2483. To speed up audio to 300% tempo:
  2484. @example
  2485. atempo=3
  2486. @end example
  2487. @item
  2488. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  2489. @example
  2490. atempo=sqrt(3),atempo=sqrt(3)
  2491. @end example
  2492. @end itemize
  2493. @subsection Commands
  2494. This filter supports the following commands:
  2495. @table @option
  2496. @item tempo
  2497. Change filter tempo scale factor.
  2498. Syntax for the command is : "@var{tempo}"
  2499. @end table
  2500. @section atilt
  2501. Apply spectral tilt filter to audio stream.
  2502. This filter apply any spectral roll-off slope over any specified frequency band.
  2503. The filter accepts the following options:
  2504. @table @option
  2505. @item freq
  2506. Set central frequency of tilt in Hz. Default is 10000 Hz.
  2507. @item slope
  2508. Set slope direction of tilt. Default is 0. Allowed range is from -1 to 1.
  2509. @item width
  2510. Set width of tilt. Default is 1000. Allowed range is from 100 to 10000.
  2511. @item order
  2512. Set order of tilt filter.
  2513. @item level
  2514. Set input volume level. Allowed range is from 0 to 4.
  2515. Defalt is 1.
  2516. @end table
  2517. @subsection Commands
  2518. This filter supports the all above options as @ref{commands}.
  2519. @section atrim
  2520. Trim the input so that the output contains one continuous subpart of the input.
  2521. It accepts the following parameters:
  2522. @table @option
  2523. @item start
  2524. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  2525. sample with the timestamp @var{start} will be the first sample in the output.
  2526. @item end
  2527. Specify time of the first audio sample that will be dropped, i.e. the
  2528. audio sample immediately preceding the one with the timestamp @var{end} will be
  2529. the last sample in the output.
  2530. @item start_pts
  2531. Same as @var{start}, except this option sets the start timestamp in samples
  2532. instead of seconds.
  2533. @item end_pts
  2534. Same as @var{end}, except this option sets the end timestamp in samples instead
  2535. of seconds.
  2536. @item duration
  2537. The maximum duration of the output in seconds.
  2538. @item start_sample
  2539. The number of the first sample that should be output.
  2540. @item end_sample
  2541. The number of the first sample that should be dropped.
  2542. @end table
  2543. @option{start}, @option{end}, and @option{duration} are expressed as time
  2544. duration specifications; see
  2545. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  2546. Note that the first two sets of the start/end options and the @option{duration}
  2547. option look at the frame timestamp, while the _sample options simply count the
  2548. samples that pass through the filter. So start/end_pts and start/end_sample will
  2549. give different results when the timestamps are wrong, inexact or do not start at
  2550. zero. Also note that this filter does not modify the timestamps. If you wish
  2551. to have the output timestamps start at zero, insert the asetpts filter after the
  2552. atrim filter.
  2553. If multiple start or end options are set, this filter tries to be greedy and
  2554. keep all samples that match at least one of the specified constraints. To keep
  2555. only the part that matches all the constraints at once, chain multiple atrim
  2556. filters.
  2557. The defaults are such that all the input is kept. So it is possible to set e.g.
  2558. just the end values to keep everything before the specified time.
  2559. Examples:
  2560. @itemize
  2561. @item
  2562. Drop everything except the second minute of input:
  2563. @example
  2564. ffmpeg -i INPUT -af atrim=60:120
  2565. @end example
  2566. @item
  2567. Keep only the first 1000 samples:
  2568. @example
  2569. ffmpeg -i INPUT -af atrim=end_sample=1000
  2570. @end example
  2571. @end itemize
  2572. @section axcorrelate
  2573. Calculate normalized windowed cross-correlation between two input audio streams.
  2574. Resulted samples are always between -1 and 1 inclusive.
  2575. If result is 1 it means two input samples are highly correlated in that selected segment.
  2576. Result 0 means they are not correlated at all.
  2577. If result is -1 it means two input samples are out of phase, which means they cancel each
  2578. other.
  2579. The filter accepts the following options:
  2580. @table @option
  2581. @item size
  2582. Set size of segment over which cross-correlation is calculated.
  2583. Default is 256. Allowed range is from 2 to 131072.
  2584. @item algo
  2585. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast}.
  2586. Default is @code{slow}. Fast algorithm assumes mean values over any given segment
  2587. are always zero and thus need much less calculations to make.
  2588. This is generally not true, but is valid for typical audio streams.
  2589. @end table
  2590. @subsection Examples
  2591. @itemize
  2592. @item
  2593. Calculate correlation between channels in stereo audio stream:
  2594. @example
  2595. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  2596. @end example
  2597. @end itemize
  2598. @section bandpass
  2599. Apply a two-pole Butterworth band-pass filter with central
  2600. frequency @var{frequency}, and (3dB-point) band-width width.
  2601. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  2602. instead of the default: constant 0dB peak gain.
  2603. The filter roll off at 6dB per octave (20dB per decade).
  2604. The filter accepts the following options:
  2605. @table @option
  2606. @item frequency, f
  2607. Set the filter's central frequency. Default is @code{3000}.
  2608. @item csg
  2609. Constant skirt gain if set to 1. Defaults to 0.
  2610. @item width_type, t
  2611. Set method to specify band-width of filter.
  2612. @table @option
  2613. @item h
  2614. Hz
  2615. @item q
  2616. Q-Factor
  2617. @item o
  2618. octave
  2619. @item s
  2620. slope
  2621. @item k
  2622. kHz
  2623. @end table
  2624. @item width, w
  2625. Specify the band-width of a filter in width_type units.
  2626. @item mix, m
  2627. How much to use filtered signal in output. Default is 1.
  2628. Range is between 0 and 1.
  2629. @item channels, c
  2630. Specify which channels to filter, by default all available are filtered.
  2631. @item normalize, n
  2632. Normalize biquad coefficients, by default is disabled.
  2633. Enabling it will normalize magnitude response at DC to 0dB.
  2634. @item transform, a
  2635. Set transform type of IIR filter.
  2636. @table @option
  2637. @item di
  2638. @item dii
  2639. @item tdii
  2640. @item latt
  2641. @item svf
  2642. @end table
  2643. @item precision, r
  2644. Set precison of filtering.
  2645. @table @option
  2646. @item auto
  2647. Pick automatic sample format depending on surround filters.
  2648. @item s16
  2649. Always use signed 16-bit.
  2650. @item s32
  2651. Always use signed 32-bit.
  2652. @item f32
  2653. Always use float 32-bit.
  2654. @item f64
  2655. Always use float 64-bit.
  2656. @end table
  2657. @end table
  2658. @subsection Commands
  2659. This filter supports the following commands:
  2660. @table @option
  2661. @item frequency, f
  2662. Change bandpass frequency.
  2663. Syntax for the command is : "@var{frequency}"
  2664. @item width_type, t
  2665. Change bandpass width_type.
  2666. Syntax for the command is : "@var{width_type}"
  2667. @item width, w
  2668. Change bandpass width.
  2669. Syntax for the command is : "@var{width}"
  2670. @item mix, m
  2671. Change bandpass mix.
  2672. Syntax for the command is : "@var{mix}"
  2673. @end table
  2674. @section bandreject
  2675. Apply a two-pole Butterworth band-reject filter with central
  2676. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2677. The filter roll off at 6dB per octave (20dB per decade).
  2678. The filter accepts the following options:
  2679. @table @option
  2680. @item frequency, f
  2681. Set the filter's central frequency. Default is @code{3000}.
  2682. @item width_type, t
  2683. Set method to specify band-width of filter.
  2684. @table @option
  2685. @item h
  2686. Hz
  2687. @item q
  2688. Q-Factor
  2689. @item o
  2690. octave
  2691. @item s
  2692. slope
  2693. @item k
  2694. kHz
  2695. @end table
  2696. @item width, w
  2697. Specify the band-width of a filter in width_type units.
  2698. @item mix, m
  2699. How much to use filtered signal in output. Default is 1.
  2700. Range is between 0 and 1.
  2701. @item channels, c
  2702. Specify which channels to filter, by default all available are filtered.
  2703. @item normalize, n
  2704. Normalize biquad coefficients, by default is disabled.
  2705. Enabling it will normalize magnitude response at DC to 0dB.
  2706. @item transform, a
  2707. Set transform type of IIR filter.
  2708. @table @option
  2709. @item di
  2710. @item dii
  2711. @item tdii
  2712. @item latt
  2713. @item svf
  2714. @end table
  2715. @item precision, r
  2716. Set precison of filtering.
  2717. @table @option
  2718. @item auto
  2719. Pick automatic sample format depending on surround filters.
  2720. @item s16
  2721. Always use signed 16-bit.
  2722. @item s32
  2723. Always use signed 32-bit.
  2724. @item f32
  2725. Always use float 32-bit.
  2726. @item f64
  2727. Always use float 64-bit.
  2728. @end table
  2729. @end table
  2730. @subsection Commands
  2731. This filter supports the following commands:
  2732. @table @option
  2733. @item frequency, f
  2734. Change bandreject frequency.
  2735. Syntax for the command is : "@var{frequency}"
  2736. @item width_type, t
  2737. Change bandreject width_type.
  2738. Syntax for the command is : "@var{width_type}"
  2739. @item width, w
  2740. Change bandreject width.
  2741. Syntax for the command is : "@var{width}"
  2742. @item mix, m
  2743. Change bandreject mix.
  2744. Syntax for the command is : "@var{mix}"
  2745. @end table
  2746. @section bass, lowshelf
  2747. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2748. shelving filter with a response similar to that of a standard
  2749. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2750. The filter accepts the following options:
  2751. @table @option
  2752. @item gain, g
  2753. Give the gain at 0 Hz. Its useful range is about -20
  2754. (for a large cut) to +20 (for a large boost).
  2755. Beware of clipping when using a positive gain.
  2756. @item frequency, f
  2757. Set the filter's central frequency and so can be used
  2758. to extend or reduce the frequency range to be boosted or cut.
  2759. The default value is @code{100} Hz.
  2760. @item width_type, t
  2761. Set method to specify band-width of filter.
  2762. @table @option
  2763. @item h
  2764. Hz
  2765. @item q
  2766. Q-Factor
  2767. @item o
  2768. octave
  2769. @item s
  2770. slope
  2771. @item k
  2772. kHz
  2773. @end table
  2774. @item width, w
  2775. Determine how steep is the filter's shelf transition.
  2776. @item poles, p
  2777. Set number of poles. Default is 2.
  2778. @item mix, m
  2779. How much to use filtered signal in output. Default is 1.
  2780. Range is between 0 and 1.
  2781. @item channels, c
  2782. Specify which channels to filter, by default all available are filtered.
  2783. @item normalize, n
  2784. Normalize biquad coefficients, by default is disabled.
  2785. Enabling it will normalize magnitude response at DC to 0dB.
  2786. @item transform, a
  2787. Set transform type of IIR filter.
  2788. @table @option
  2789. @item di
  2790. @item dii
  2791. @item tdii
  2792. @item latt
  2793. @item svf
  2794. @end table
  2795. @item precision, r
  2796. Set precison of filtering.
  2797. @table @option
  2798. @item auto
  2799. Pick automatic sample format depending on surround filters.
  2800. @item s16
  2801. Always use signed 16-bit.
  2802. @item s32
  2803. Always use signed 32-bit.
  2804. @item f32
  2805. Always use float 32-bit.
  2806. @item f64
  2807. Always use float 64-bit.
  2808. @end table
  2809. @end table
  2810. @subsection Commands
  2811. This filter supports the following commands:
  2812. @table @option
  2813. @item frequency, f
  2814. Change bass frequency.
  2815. Syntax for the command is : "@var{frequency}"
  2816. @item width_type, t
  2817. Change bass width_type.
  2818. Syntax for the command is : "@var{width_type}"
  2819. @item width, w
  2820. Change bass width.
  2821. Syntax for the command is : "@var{width}"
  2822. @item gain, g
  2823. Change bass gain.
  2824. Syntax for the command is : "@var{gain}"
  2825. @item mix, m
  2826. Change bass mix.
  2827. Syntax for the command is : "@var{mix}"
  2828. @end table
  2829. @section biquad
  2830. Apply a biquad IIR filter with the given coefficients.
  2831. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2832. are the numerator and denominator coefficients respectively.
  2833. and @var{channels}, @var{c} specify which channels to filter, by default all
  2834. available are filtered.
  2835. @subsection Commands
  2836. This filter supports the following commands:
  2837. @table @option
  2838. @item a0
  2839. @item a1
  2840. @item a2
  2841. @item b0
  2842. @item b1
  2843. @item b2
  2844. Change biquad parameter.
  2845. Syntax for the command is : "@var{value}"
  2846. @item mix, m
  2847. How much to use filtered signal in output. Default is 1.
  2848. Range is between 0 and 1.
  2849. @item channels, c
  2850. Specify which channels to filter, by default all available are filtered.
  2851. @item normalize, n
  2852. Normalize biquad coefficients, by default is disabled.
  2853. Enabling it will normalize magnitude response at DC to 0dB.
  2854. @item transform, a
  2855. Set transform type of IIR filter.
  2856. @table @option
  2857. @item di
  2858. @item dii
  2859. @item tdii
  2860. @item latt
  2861. @item svf
  2862. @end table
  2863. @item precision, r
  2864. Set precison of filtering.
  2865. @table @option
  2866. @item auto
  2867. Pick automatic sample format depending on surround filters.
  2868. @item s16
  2869. Always use signed 16-bit.
  2870. @item s32
  2871. Always use signed 32-bit.
  2872. @item f32
  2873. Always use float 32-bit.
  2874. @item f64
  2875. Always use float 64-bit.
  2876. @end table
  2877. @end table
  2878. @section bs2b
  2879. Bauer stereo to binaural transformation, which improves headphone listening of
  2880. stereo audio records.
  2881. To enable compilation of this filter you need to configure FFmpeg with
  2882. @code{--enable-libbs2b}.
  2883. It accepts the following parameters:
  2884. @table @option
  2885. @item profile
  2886. Pre-defined crossfeed level.
  2887. @table @option
  2888. @item default
  2889. Default level (fcut=700, feed=50).
  2890. @item cmoy
  2891. Chu Moy circuit (fcut=700, feed=60).
  2892. @item jmeier
  2893. Jan Meier circuit (fcut=650, feed=95).
  2894. @end table
  2895. @item fcut
  2896. Cut frequency (in Hz).
  2897. @item feed
  2898. Feed level (in Hz).
  2899. @end table
  2900. @section channelmap
  2901. Remap input channels to new locations.
  2902. It accepts the following parameters:
  2903. @table @option
  2904. @item map
  2905. Map channels from input to output. The argument is a '|'-separated list of
  2906. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2907. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2908. channel (e.g. FL for front left) or its index in the input channel layout.
  2909. @var{out_channel} is the name of the output channel or its index in the output
  2910. channel layout. If @var{out_channel} is not given then it is implicitly an
  2911. index, starting with zero and increasing by one for each mapping.
  2912. @item channel_layout
  2913. The channel layout of the output stream.
  2914. @end table
  2915. If no mapping is present, the filter will implicitly map input channels to
  2916. output channels, preserving indices.
  2917. @subsection Examples
  2918. @itemize
  2919. @item
  2920. For example, assuming a 5.1+downmix input MOV file,
  2921. @example
  2922. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2923. @end example
  2924. will create an output WAV file tagged as stereo from the downmix channels of
  2925. the input.
  2926. @item
  2927. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2928. @example
  2929. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2930. @end example
  2931. @end itemize
  2932. @section channelsplit
  2933. Split each channel from an input audio stream into a separate output stream.
  2934. It accepts the following parameters:
  2935. @table @option
  2936. @item channel_layout
  2937. The channel layout of the input stream. The default is "stereo".
  2938. @item channels
  2939. A channel layout describing the channels to be extracted as separate output streams
  2940. or "all" to extract each input channel as a separate stream. The default is "all".
  2941. Choosing channels not present in channel layout in the input will result in an error.
  2942. @end table
  2943. @subsection Examples
  2944. @itemize
  2945. @item
  2946. For example, assuming a stereo input MP3 file,
  2947. @example
  2948. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2949. @end example
  2950. will create an output Matroska file with two audio streams, one containing only
  2951. the left channel and the other the right channel.
  2952. @item
  2953. Split a 5.1 WAV file into per-channel files:
  2954. @example
  2955. ffmpeg -i in.wav -filter_complex
  2956. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2957. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2958. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2959. side_right.wav
  2960. @end example
  2961. @item
  2962. Extract only LFE from a 5.1 WAV file:
  2963. @example
  2964. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2965. -map '[LFE]' lfe.wav
  2966. @end example
  2967. @end itemize
  2968. @section chorus
  2969. Add a chorus effect to the audio.
  2970. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2971. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2972. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2973. The modulation depth defines the range the modulated delay is played before or after
  2974. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2975. sound tuned around the original one, like in a chorus where some vocals are slightly
  2976. off key.
  2977. It accepts the following parameters:
  2978. @table @option
  2979. @item in_gain
  2980. Set input gain. Default is 0.4.
  2981. @item out_gain
  2982. Set output gain. Default is 0.4.
  2983. @item delays
  2984. Set delays. A typical delay is around 40ms to 60ms.
  2985. @item decays
  2986. Set decays.
  2987. @item speeds
  2988. Set speeds.
  2989. @item depths
  2990. Set depths.
  2991. @end table
  2992. @subsection Examples
  2993. @itemize
  2994. @item
  2995. A single delay:
  2996. @example
  2997. chorus=0.7:0.9:55:0.4:0.25:2
  2998. @end example
  2999. @item
  3000. Two delays:
  3001. @example
  3002. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  3003. @end example
  3004. @item
  3005. Fuller sounding chorus with three delays:
  3006. @example
  3007. 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
  3008. @end example
  3009. @end itemize
  3010. @section compand
  3011. Compress or expand the audio's dynamic range.
  3012. It accepts the following parameters:
  3013. @table @option
  3014. @item attacks
  3015. @item decays
  3016. A list of times in seconds for each channel over which the instantaneous level
  3017. of the input signal is averaged to determine its volume. @var{attacks} refers to
  3018. increase of volume and @var{decays} refers to decrease of volume. For most
  3019. situations, the attack time (response to the audio getting louder) should be
  3020. shorter than the decay time, because the human ear is more sensitive to sudden
  3021. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  3022. a typical value for decay is 0.8 seconds.
  3023. If specified number of attacks & decays is lower than number of channels, the last
  3024. set attack/decay will be used for all remaining channels.
  3025. @item points
  3026. A list of points for the transfer function, specified in dB relative to the
  3027. maximum possible signal amplitude. Each key points list must be defined using
  3028. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  3029. @code{x0/y0 x1/y1 x2/y2 ....}
  3030. The input values must be in strictly increasing order but the transfer function
  3031. does not have to be monotonically rising. The point @code{0/0} is assumed but
  3032. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  3033. function are @code{-70/-70|-60/-20|1/0}.
  3034. @item soft-knee
  3035. Set the curve radius in dB for all joints. It defaults to 0.01.
  3036. @item gain
  3037. Set the additional gain in dB to be applied at all points on the transfer
  3038. function. This allows for easy adjustment of the overall gain.
  3039. It defaults to 0.
  3040. @item volume
  3041. Set an initial volume, in dB, to be assumed for each channel when filtering
  3042. starts. This permits the user to supply a nominal level initially, so that, for
  3043. example, a very large gain is not applied to initial signal levels before the
  3044. companding has begun to operate. A typical value for audio which is initially
  3045. quiet is -90 dB. It defaults to 0.
  3046. @item delay
  3047. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  3048. delayed before being fed to the volume adjuster. Specifying a delay
  3049. approximately equal to the attack/decay times allows the filter to effectively
  3050. operate in predictive rather than reactive mode. It defaults to 0.
  3051. @end table
  3052. @subsection Examples
  3053. @itemize
  3054. @item
  3055. Make music with both quiet and loud passages suitable for listening to in a
  3056. noisy environment:
  3057. @example
  3058. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  3059. @end example
  3060. Another example for audio with whisper and explosion parts:
  3061. @example
  3062. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  3063. @end example
  3064. @item
  3065. A noise gate for when the noise is at a lower level than the signal:
  3066. @example
  3067. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  3068. @end example
  3069. @item
  3070. Here is another noise gate, this time for when the noise is at a higher level
  3071. than the signal (making it, in some ways, similar to squelch):
  3072. @example
  3073. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  3074. @end example
  3075. @item
  3076. 2:1 compression starting at -6dB:
  3077. @example
  3078. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  3079. @end example
  3080. @item
  3081. 2:1 compression starting at -9dB:
  3082. @example
  3083. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  3084. @end example
  3085. @item
  3086. 2:1 compression starting at -12dB:
  3087. @example
  3088. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  3089. @end example
  3090. @item
  3091. 2:1 compression starting at -18dB:
  3092. @example
  3093. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  3094. @end example
  3095. @item
  3096. 3:1 compression starting at -15dB:
  3097. @example
  3098. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  3099. @end example
  3100. @item
  3101. Compressor/Gate:
  3102. @example
  3103. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  3104. @end example
  3105. @item
  3106. Expander:
  3107. @example
  3108. 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
  3109. @end example
  3110. @item
  3111. Hard limiter at -6dB:
  3112. @example
  3113. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  3114. @end example
  3115. @item
  3116. Hard limiter at -12dB:
  3117. @example
  3118. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  3119. @end example
  3120. @item
  3121. Hard noise gate at -35 dB:
  3122. @example
  3123. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  3124. @end example
  3125. @item
  3126. Soft limiter:
  3127. @example
  3128. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  3129. @end example
  3130. @end itemize
  3131. @section compensationdelay
  3132. Compensation Delay Line is a metric based delay to compensate differing
  3133. positions of microphones or speakers.
  3134. For example, you have recorded guitar with two microphones placed in
  3135. different locations. Because the front of sound wave has fixed speed in
  3136. normal conditions, the phasing of microphones can vary and depends on
  3137. their location and interposition. The best sound mix can be achieved when
  3138. these microphones are in phase (synchronized). Note that a distance of
  3139. ~30 cm between microphones makes one microphone capture the signal in
  3140. antiphase to the other microphone. That makes the final mix sound moody.
  3141. This filter helps to solve phasing problems by adding different delays
  3142. to each microphone track and make them synchronized.
  3143. The best result can be reached when you take one track as base and
  3144. synchronize other tracks one by one with it.
  3145. Remember that synchronization/delay tolerance depends on sample rate, too.
  3146. Higher sample rates will give more tolerance.
  3147. The filter accepts the following parameters:
  3148. @table @option
  3149. @item mm
  3150. Set millimeters distance. This is compensation distance for fine tuning.
  3151. Default is 0.
  3152. @item cm
  3153. Set cm distance. This is compensation distance for tightening distance setup.
  3154. Default is 0.
  3155. @item m
  3156. Set meters distance. This is compensation distance for hard distance setup.
  3157. Default is 0.
  3158. @item dry
  3159. Set dry amount. Amount of unprocessed (dry) signal.
  3160. Default is 0.
  3161. @item wet
  3162. Set wet amount. Amount of processed (wet) signal.
  3163. Default is 1.
  3164. @item temp
  3165. Set temperature in degrees Celsius. This is the temperature of the environment.
  3166. Default is 20.
  3167. @end table
  3168. @subsection Commands
  3169. This filter supports the all above options as @ref{commands}.
  3170. @section crossfeed
  3171. Apply headphone crossfeed filter.
  3172. Crossfeed is the process of blending the left and right channels of stereo
  3173. audio recording.
  3174. It is mainly used to reduce extreme stereo separation of low frequencies.
  3175. The intent is to produce more speaker like sound to the listener.
  3176. The filter accepts the following options:
  3177. @table @option
  3178. @item strength
  3179. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  3180. This sets gain of low shelf filter for side part of stereo image.
  3181. Default is -6dB. Max allowed is -30db when strength is set to 1.
  3182. @item range
  3183. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  3184. This sets cut off frequency of low shelf filter. Default is cut off near
  3185. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  3186. @item slope
  3187. Set curve slope of low shelf filter. Default is 0.5.
  3188. Allowed range is from 0.01 to 1.
  3189. @item level_in
  3190. Set input gain. Default is 0.9.
  3191. @item level_out
  3192. Set output gain. Default is 1.
  3193. @end table
  3194. @subsection Commands
  3195. This filter supports the all above options as @ref{commands}.
  3196. @section crystalizer
  3197. Simple algorithm for audio noise sharpening.
  3198. This filter linearly increases differences betweeen each audio sample.
  3199. The filter accepts the following options:
  3200. @table @option
  3201. @item i
  3202. Sets the intensity of effect (default: 2.0). Must be in range between -10.0 to 0
  3203. (unchanged sound) to 10.0 (maximum effect).
  3204. To inverse filtering use negative value.
  3205. @item c
  3206. Enable clipping. By default is enabled.
  3207. @end table
  3208. @subsection Commands
  3209. This filter supports the all above options as @ref{commands}.
  3210. @section dcshift
  3211. Apply a DC shift to the audio.
  3212. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  3213. in the recording chain) from the audio. The effect of a DC offset is reduced
  3214. headroom and hence volume. The @ref{astats} filter can be used to determine if
  3215. a signal has a DC offset.
  3216. @table @option
  3217. @item shift
  3218. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  3219. the audio.
  3220. @item limitergain
  3221. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  3222. used to prevent clipping.
  3223. @end table
  3224. @section deesser
  3225. Apply de-essing to the audio samples.
  3226. @table @option
  3227. @item i
  3228. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  3229. Default is 0.
  3230. @item m
  3231. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  3232. Default is 0.5.
  3233. @item f
  3234. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  3235. Default is 0.5.
  3236. @item s
  3237. Set the output mode.
  3238. It accepts the following values:
  3239. @table @option
  3240. @item i
  3241. Pass input unchanged.
  3242. @item o
  3243. Pass ess filtered out.
  3244. @item e
  3245. Pass only ess.
  3246. Default value is @var{o}.
  3247. @end table
  3248. @end table
  3249. @section dialoguenhance
  3250. Enhance dialogue in stereo audio.
  3251. This filter accepts stereo input and produce surround (3.0) channels output.
  3252. The newly produced front center channel have enhanced speech dialogue originally
  3253. available in both stereo channels.
  3254. This filter outputs front left and front right channels same as available in stereo input.
  3255. The filter accepts the following options:
  3256. @table @option
  3257. @item original
  3258. Set the original center factor to keep in front center channel output.
  3259. Allowed range is from 0 to 1. Default value is 1.
  3260. @item enhance
  3261. Set the dialogue enhance factor to put in front center channel output.
  3262. Allowed range is from 0 to 3. Default value is 1.
  3263. @item voice
  3264. Set the voice detection factor.
  3265. Allowed range is from 2 to 32. Default value is 2.
  3266. @end table
  3267. @subsection Commands
  3268. This filter supports the all above options as @ref{commands}.
  3269. @section drmeter
  3270. Measure audio dynamic range.
  3271. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  3272. is found in transition material. And anything less that 8 have very poor dynamics
  3273. and is very compressed.
  3274. The filter accepts the following options:
  3275. @table @option
  3276. @item length
  3277. Set window length in seconds used to split audio into segments of equal length.
  3278. Default is 3 seconds.
  3279. @end table
  3280. @section dynaudnorm
  3281. Dynamic Audio Normalizer.
  3282. This filter applies a certain amount of gain to the input audio in order
  3283. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  3284. contrast to more "simple" normalization algorithms, the Dynamic Audio
  3285. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  3286. This allows for applying extra gain to the "quiet" sections of the audio
  3287. while avoiding distortions or clipping the "loud" sections. In other words:
  3288. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  3289. sections, in the sense that the volume of each section is brought to the
  3290. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  3291. this goal *without* applying "dynamic range compressing". It will retain 100%
  3292. of the dynamic range *within* each section of the audio file.
  3293. @table @option
  3294. @item framelen, f
  3295. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  3296. Default is 500 milliseconds.
  3297. The Dynamic Audio Normalizer processes the input audio in small chunks,
  3298. referred to as frames. This is required, because a peak magnitude has no
  3299. meaning for just a single sample value. Instead, we need to determine the
  3300. peak magnitude for a contiguous sequence of sample values. While a "standard"
  3301. normalizer would simply use the peak magnitude of the complete file, the
  3302. Dynamic Audio Normalizer determines the peak magnitude individually for each
  3303. frame. The length of a frame is specified in milliseconds. By default, the
  3304. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  3305. been found to give good results with most files.
  3306. Note that the exact frame length, in number of samples, will be determined
  3307. automatically, based on the sampling rate of the individual input audio file.
  3308. @item gausssize, g
  3309. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  3310. number. Default is 31.
  3311. Probably the most important parameter of the Dynamic Audio Normalizer is the
  3312. @code{window size} of the Gaussian smoothing filter. The filter's window size
  3313. is specified in frames, centered around the current frame. For the sake of
  3314. simplicity, this must be an odd number. Consequently, the default value of 31
  3315. takes into account the current frame, as well as the 15 preceding frames and
  3316. the 15 subsequent frames. Using a larger window results in a stronger
  3317. smoothing effect and thus in less gain variation, i.e. slower gain
  3318. adaptation. Conversely, using a smaller window results in a weaker smoothing
  3319. effect and thus in more gain variation, i.e. faster gain adaptation.
  3320. In other words, the more you increase this value, the more the Dynamic Audio
  3321. Normalizer will behave like a "traditional" normalization filter. On the
  3322. contrary, the more you decrease this value, the more the Dynamic Audio
  3323. Normalizer will behave like a dynamic range compressor.
  3324. @item peak, p
  3325. Set the target peak value. This specifies the highest permissible magnitude
  3326. level for the normalized audio input. This filter will try to approach the
  3327. target peak magnitude as closely as possible, but at the same time it also
  3328. makes sure that the normalized signal will never exceed the peak magnitude.
  3329. A frame's maximum local gain factor is imposed directly by the target peak
  3330. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  3331. It is not recommended to go above this value.
  3332. @item maxgain, m
  3333. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  3334. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  3335. factor for each input frame, i.e. the maximum gain factor that does not
  3336. result in clipping or distortion. The maximum gain factor is determined by
  3337. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  3338. additionally bounds the frame's maximum gain factor by a predetermined
  3339. (global) maximum gain factor. This is done in order to avoid excessive gain
  3340. factors in "silent" or almost silent frames. By default, the maximum gain
  3341. factor is 10.0, For most inputs the default value should be sufficient and
  3342. it usually is not recommended to increase this value. Though, for input
  3343. with an extremely low overall volume level, it may be necessary to allow even
  3344. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  3345. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  3346. Instead, a "sigmoid" threshold function will be applied. This way, the
  3347. gain factors will smoothly approach the threshold value, but never exceed that
  3348. value.
  3349. @item targetrms, r
  3350. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  3351. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  3352. This means that the maximum local gain factor for each frame is defined
  3353. (only) by the frame's highest magnitude sample. This way, the samples can
  3354. be amplified as much as possible without exceeding the maximum signal
  3355. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  3356. Normalizer can also take into account the frame's root mean square,
  3357. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  3358. determine the power of a time-varying signal. It is therefore considered
  3359. that the RMS is a better approximation of the "perceived loudness" than
  3360. just looking at the signal's peak magnitude. Consequently, by adjusting all
  3361. frames to a constant RMS value, a uniform "perceived loudness" can be
  3362. established. If a target RMS value has been specified, a frame's local gain
  3363. factor is defined as the factor that would result in exactly that RMS value.
  3364. Note, however, that the maximum local gain factor is still restricted by the
  3365. frame's highest magnitude sample, in order to prevent clipping.
  3366. @item coupling, n
  3367. Enable channels coupling. By default is enabled.
  3368. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  3369. amount. This means the same gain factor will be applied to all channels, i.e.
  3370. the maximum possible gain factor is determined by the "loudest" channel.
  3371. However, in some recordings, it may happen that the volume of the different
  3372. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  3373. In this case, this option can be used to disable the channel coupling. This way,
  3374. the gain factor will be determined independently for each channel, depending
  3375. only on the individual channel's highest magnitude sample. This allows for
  3376. harmonizing the volume of the different channels.
  3377. @item correctdc, c
  3378. Enable DC bias correction. By default is disabled.
  3379. An audio signal (in the time domain) is a sequence of sample values.
  3380. In the Dynamic Audio Normalizer these sample values are represented in the
  3381. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  3382. audio signal, or "waveform", should be centered around the zero point.
  3383. That means if we calculate the mean value of all samples in a file, or in a
  3384. single frame, then the result should be 0.0 or at least very close to that
  3385. value. If, however, there is a significant deviation of the mean value from
  3386. 0.0, in either positive or negative direction, this is referred to as a
  3387. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  3388. Audio Normalizer provides optional DC bias correction.
  3389. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  3390. the mean value, or "DC correction" offset, of each input frame and subtract
  3391. that value from all of the frame's sample values which ensures those samples
  3392. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  3393. boundaries, the DC correction offset values will be interpolated smoothly
  3394. between neighbouring frames.
  3395. @item altboundary, b
  3396. Enable alternative boundary mode. By default is disabled.
  3397. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  3398. around each frame. This includes the preceding frames as well as the
  3399. subsequent frames. However, for the "boundary" frames, located at the very
  3400. beginning and at the very end of the audio file, not all neighbouring
  3401. frames are available. In particular, for the first few frames in the audio
  3402. file, the preceding frames are not known. And, similarly, for the last few
  3403. frames in the audio file, the subsequent frames are not known. Thus, the
  3404. question arises which gain factors should be assumed for the missing frames
  3405. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  3406. to deal with this situation. The default boundary mode assumes a gain factor
  3407. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  3408. "fade out" at the beginning and at the end of the input, respectively.
  3409. @item compress, s
  3410. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  3411. By default, the Dynamic Audio Normalizer does not apply "traditional"
  3412. compression. This means that signal peaks will not be pruned and thus the
  3413. full dynamic range will be retained within each local neighbourhood. However,
  3414. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  3415. normalization algorithm with a more "traditional" compression.
  3416. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  3417. (thresholding) function. If (and only if) the compression feature is enabled,
  3418. all input frames will be processed by a soft knee thresholding function prior
  3419. to the actual normalization process. Put simply, the thresholding function is
  3420. going to prune all samples whose magnitude exceeds a certain threshold value.
  3421. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  3422. value. Instead, the threshold value will be adjusted for each individual
  3423. frame.
  3424. In general, smaller parameters result in stronger compression, and vice versa.
  3425. Values below 3.0 are not recommended, because audible distortion may appear.
  3426. @item threshold, t
  3427. Set the target threshold value. This specifies the lowest permissible
  3428. magnitude level for the audio input which will be normalized.
  3429. If input frame volume is above this value frame will be normalized.
  3430. Otherwise frame may not be normalized at all. The default value is set
  3431. to 0, which means all input frames will be normalized.
  3432. This option is mostly useful if digital noise is not wanted to be amplified.
  3433. @item channels, h
  3434. Specify which channels to filter, by default all available channels are filtered.
  3435. @item overlap, o
  3436. Specify overlap for frames. If set to 0 (default) no frame overlapping is done.
  3437. Using >0 and <1 values will make less conservative gain adjustments, like
  3438. when framelen option is set to smaller value, if framelen option value is
  3439. compensated for non-zero overlap then gain adjustments will be smoother across time
  3440. compared to zero overlap case.
  3441. @end table
  3442. @subsection Commands
  3443. This filter supports the all above options as @ref{commands}.
  3444. @section earwax
  3445. Make audio easier to listen to on headphones.
  3446. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  3447. so that when listened to on headphones the stereo image is moved from
  3448. inside your head (standard for headphones) to outside and in front of
  3449. the listener (standard for speakers).
  3450. Ported from SoX.
  3451. @section equalizer
  3452. Apply a two-pole peaking equalisation (EQ) filter. With this
  3453. filter, the signal-level at and around a selected frequency can
  3454. be increased or decreased, whilst (unlike bandpass and bandreject
  3455. filters) that at all other frequencies is unchanged.
  3456. In order to produce complex equalisation curves, this filter can
  3457. be given several times, each with a different central frequency.
  3458. The filter accepts the following options:
  3459. @table @option
  3460. @item frequency, f
  3461. Set the filter's central frequency in Hz.
  3462. @item width_type, t
  3463. Set method to specify band-width of filter.
  3464. @table @option
  3465. @item h
  3466. Hz
  3467. @item q
  3468. Q-Factor
  3469. @item o
  3470. octave
  3471. @item s
  3472. slope
  3473. @item k
  3474. kHz
  3475. @end table
  3476. @item width, w
  3477. Specify the band-width of a filter in width_type units.
  3478. @item gain, g
  3479. Set the required gain or attenuation in dB.
  3480. Beware of clipping when using a positive gain.
  3481. @item mix, m
  3482. How much to use filtered signal in output. Default is 1.
  3483. Range is between 0 and 1.
  3484. @item channels, c
  3485. Specify which channels to filter, by default all available are filtered.
  3486. @item normalize, n
  3487. Normalize biquad coefficients, by default is disabled.
  3488. Enabling it will normalize magnitude response at DC to 0dB.
  3489. @item transform, a
  3490. Set transform type of IIR filter.
  3491. @table @option
  3492. @item di
  3493. @item dii
  3494. @item tdii
  3495. @item latt
  3496. @item svf
  3497. @end table
  3498. @item precision, r
  3499. Set precison of filtering.
  3500. @table @option
  3501. @item auto
  3502. Pick automatic sample format depending on surround filters.
  3503. @item s16
  3504. Always use signed 16-bit.
  3505. @item s32
  3506. Always use signed 32-bit.
  3507. @item f32
  3508. Always use float 32-bit.
  3509. @item f64
  3510. Always use float 64-bit.
  3511. @end table
  3512. @end table
  3513. @subsection Examples
  3514. @itemize
  3515. @item
  3516. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  3517. @example
  3518. equalizer=f=1000:t=h:width=200:g=-10
  3519. @end example
  3520. @item
  3521. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  3522. @example
  3523. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  3524. @end example
  3525. @end itemize
  3526. @subsection Commands
  3527. This filter supports the following commands:
  3528. @table @option
  3529. @item frequency, f
  3530. Change equalizer frequency.
  3531. Syntax for the command is : "@var{frequency}"
  3532. @item width_type, t
  3533. Change equalizer width_type.
  3534. Syntax for the command is : "@var{width_type}"
  3535. @item width, w
  3536. Change equalizer width.
  3537. Syntax for the command is : "@var{width}"
  3538. @item gain, g
  3539. Change equalizer gain.
  3540. Syntax for the command is : "@var{gain}"
  3541. @item mix, m
  3542. Change equalizer mix.
  3543. Syntax for the command is : "@var{mix}"
  3544. @end table
  3545. @section extrastereo
  3546. Linearly increases the difference between left and right channels which
  3547. adds some sort of "live" effect to playback.
  3548. The filter accepts the following options:
  3549. @table @option
  3550. @item m
  3551. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  3552. (average of both channels), with 1.0 sound will be unchanged, with
  3553. -1.0 left and right channels will be swapped.
  3554. @item c
  3555. Enable clipping. By default is enabled.
  3556. @end table
  3557. @subsection Commands
  3558. This filter supports the all above options as @ref{commands}.
  3559. @section firequalizer
  3560. Apply FIR Equalization using arbitrary frequency response.
  3561. The filter accepts the following option:
  3562. @table @option
  3563. @item gain
  3564. Set gain curve equation (in dB). The expression can contain variables:
  3565. @table @option
  3566. @item f
  3567. the evaluated frequency
  3568. @item sr
  3569. sample rate
  3570. @item ch
  3571. channel number, set to 0 when multichannels evaluation is disabled
  3572. @item chid
  3573. channel id, see libavutil/channel_layout.h, set to the first channel id when
  3574. multichannels evaluation is disabled
  3575. @item chs
  3576. number of channels
  3577. @item chlayout
  3578. channel_layout, see libavutil/channel_layout.h
  3579. @end table
  3580. and functions:
  3581. @table @option
  3582. @item gain_interpolate(f)
  3583. interpolate gain on frequency f based on gain_entry
  3584. @item cubic_interpolate(f)
  3585. same as gain_interpolate, but smoother
  3586. @end table
  3587. This option is also available as command. Default is @code{gain_interpolate(f)}.
  3588. @item gain_entry
  3589. Set gain entry for gain_interpolate function. The expression can
  3590. contain functions:
  3591. @table @option
  3592. @item entry(f, g)
  3593. store gain entry at frequency f with value g
  3594. @end table
  3595. This option is also available as command.
  3596. @item delay
  3597. Set filter delay in seconds. Higher value means more accurate.
  3598. Default is @code{0.01}.
  3599. @item accuracy
  3600. Set filter accuracy in Hz. Lower value means more accurate.
  3601. Default is @code{5}.
  3602. @item wfunc
  3603. Set window function. Acceptable values are:
  3604. @table @option
  3605. @item rectangular
  3606. rectangular window, useful when gain curve is already smooth
  3607. @item hann
  3608. hann window (default)
  3609. @item hamming
  3610. hamming window
  3611. @item blackman
  3612. blackman window
  3613. @item nuttall3
  3614. 3-terms continuous 1st derivative nuttall window
  3615. @item mnuttall3
  3616. minimum 3-terms discontinuous nuttall window
  3617. @item nuttall
  3618. 4-terms continuous 1st derivative nuttall window
  3619. @item bnuttall
  3620. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  3621. @item bharris
  3622. blackman-harris window
  3623. @item tukey
  3624. tukey window
  3625. @end table
  3626. @item fixed
  3627. If enabled, use fixed number of audio samples. This improves speed when
  3628. filtering with large delay. Default is disabled.
  3629. @item multi
  3630. Enable multichannels evaluation on gain. Default is disabled.
  3631. @item zero_phase
  3632. Enable zero phase mode by subtracting timestamp to compensate delay.
  3633. Default is disabled.
  3634. @item scale
  3635. Set scale used by gain. Acceptable values are:
  3636. @table @option
  3637. @item linlin
  3638. linear frequency, linear gain
  3639. @item linlog
  3640. linear frequency, logarithmic (in dB) gain (default)
  3641. @item loglin
  3642. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  3643. @item loglog
  3644. logarithmic frequency, logarithmic gain
  3645. @end table
  3646. @item dumpfile
  3647. Set file for dumping, suitable for gnuplot.
  3648. @item dumpscale
  3649. Set scale for dumpfile. Acceptable values are same with scale option.
  3650. Default is linlog.
  3651. @item fft2
  3652. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  3653. Default is disabled.
  3654. @item min_phase
  3655. Enable minimum phase impulse response. Default is disabled.
  3656. @end table
  3657. @subsection Examples
  3658. @itemize
  3659. @item
  3660. lowpass at 1000 Hz:
  3661. @example
  3662. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  3663. @end example
  3664. @item
  3665. lowpass at 1000 Hz with gain_entry:
  3666. @example
  3667. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  3668. @end example
  3669. @item
  3670. custom equalization:
  3671. @example
  3672. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  3673. @end example
  3674. @item
  3675. higher delay with zero phase to compensate delay:
  3676. @example
  3677. firequalizer=delay=0.1:fixed=on:zero_phase=on
  3678. @end example
  3679. @item
  3680. lowpass on left channel, highpass on right channel:
  3681. @example
  3682. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  3683. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  3684. @end example
  3685. @end itemize
  3686. @section flanger
  3687. Apply a flanging effect to the audio.
  3688. The filter accepts the following options:
  3689. @table @option
  3690. @item delay
  3691. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  3692. @item depth
  3693. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  3694. @item regen
  3695. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  3696. Default value is 0.
  3697. @item width
  3698. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  3699. Default value is 71.
  3700. @item speed
  3701. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  3702. @item shape
  3703. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  3704. Default value is @var{sinusoidal}.
  3705. @item phase
  3706. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  3707. Default value is 25.
  3708. @item interp
  3709. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  3710. Default is @var{linear}.
  3711. @end table
  3712. @section haas
  3713. Apply Haas effect to audio.
  3714. Note that this makes most sense to apply on mono signals.
  3715. With this filter applied to mono signals it give some directionality and
  3716. stretches its stereo image.
  3717. The filter accepts the following options:
  3718. @table @option
  3719. @item level_in
  3720. Set input level. By default is @var{1}, or 0dB
  3721. @item level_out
  3722. Set output level. By default is @var{1}, or 0dB.
  3723. @item side_gain
  3724. Set gain applied to side part of signal. By default is @var{1}.
  3725. @item middle_source
  3726. Set kind of middle source. Can be one of the following:
  3727. @table @samp
  3728. @item left
  3729. Pick left channel.
  3730. @item right
  3731. Pick right channel.
  3732. @item mid
  3733. Pick middle part signal of stereo image.
  3734. @item side
  3735. Pick side part signal of stereo image.
  3736. @end table
  3737. @item middle_phase
  3738. Change middle phase. By default is disabled.
  3739. @item left_delay
  3740. Set left channel delay. By default is @var{2.05} milliseconds.
  3741. @item left_balance
  3742. Set left channel balance. By default is @var{-1}.
  3743. @item left_gain
  3744. Set left channel gain. By default is @var{1}.
  3745. @item left_phase
  3746. Change left phase. By default is disabled.
  3747. @item right_delay
  3748. Set right channel delay. By defaults is @var{2.12} milliseconds.
  3749. @item right_balance
  3750. Set right channel balance. By default is @var{1}.
  3751. @item right_gain
  3752. Set right channel gain. By default is @var{1}.
  3753. @item right_phase
  3754. Change right phase. By default is enabled.
  3755. @end table
  3756. @section hdcd
  3757. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  3758. embedded HDCD codes is expanded into a 20-bit PCM stream.
  3759. The filter supports the Peak Extend and Low-level Gain Adjustment features
  3760. of HDCD, and detects the Transient Filter flag.
  3761. @example
  3762. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  3763. @end example
  3764. When using the filter with wav, note the default encoding for wav is 16-bit,
  3765. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  3766. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  3767. @example
  3768. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  3769. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  3770. @end example
  3771. The filter accepts the following options:
  3772. @table @option
  3773. @item disable_autoconvert
  3774. Disable any automatic format conversion or resampling in the filter graph.
  3775. @item process_stereo
  3776. Process the stereo channels together. If target_gain does not match between
  3777. channels, consider it invalid and use the last valid target_gain.
  3778. @item cdt_ms
  3779. Set the code detect timer period in ms.
  3780. @item force_pe
  3781. Always extend peaks above -3dBFS even if PE isn't signaled.
  3782. @item analyze_mode
  3783. Replace audio with a solid tone and adjust the amplitude to signal some
  3784. specific aspect of the decoding process. The output file can be loaded in
  3785. an audio editor alongside the original to aid analysis.
  3786. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  3787. Modes are:
  3788. @table @samp
  3789. @item 0, off
  3790. Disabled
  3791. @item 1, lle
  3792. Gain adjustment level at each sample
  3793. @item 2, pe
  3794. Samples where peak extend occurs
  3795. @item 3, cdt
  3796. Samples where the code detect timer is active
  3797. @item 4, tgm
  3798. Samples where the target gain does not match between channels
  3799. @end table
  3800. @end table
  3801. @section headphone
  3802. Apply head-related transfer functions (HRTFs) to create virtual
  3803. loudspeakers around the user for binaural listening via headphones.
  3804. The HRIRs are provided via additional streams, for each channel
  3805. one stereo input stream is needed.
  3806. The filter accepts the following options:
  3807. @table @option
  3808. @item map
  3809. Set mapping of input streams for convolution.
  3810. The argument is a '|'-separated list of channel names in order as they
  3811. are given as additional stream inputs for filter.
  3812. This also specify number of input streams. Number of input streams
  3813. must be not less than number of channels in first stream plus one.
  3814. @item gain
  3815. Set gain applied to audio. Value is in dB. Default is 0.
  3816. @item type
  3817. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3818. processing audio in time domain which is slow.
  3819. @var{freq} is processing audio in frequency domain which is fast.
  3820. Default is @var{freq}.
  3821. @item lfe
  3822. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3823. @item size
  3824. Set size of frame in number of samples which will be processed at once.
  3825. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  3826. @item hrir
  3827. Set format of hrir stream.
  3828. Default value is @var{stereo}. Alternative value is @var{multich}.
  3829. If value is set to @var{stereo}, number of additional streams should
  3830. be greater or equal to number of input channels in first input stream.
  3831. Also each additional stream should have stereo number of channels.
  3832. If value is set to @var{multich}, number of additional streams should
  3833. be exactly one. Also number of input channels of additional stream
  3834. should be equal or greater than twice number of channels of first input
  3835. stream.
  3836. @end table
  3837. @subsection Examples
  3838. @itemize
  3839. @item
  3840. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3841. each amovie filter use stereo file with IR coefficients as input.
  3842. The files give coefficients for each position of virtual loudspeaker:
  3843. @example
  3844. ffmpeg -i input.wav
  3845. -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"
  3846. output.wav
  3847. @end example
  3848. @item
  3849. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3850. but now in @var{multich} @var{hrir} format.
  3851. @example
  3852. 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"
  3853. output.wav
  3854. @end example
  3855. @end itemize
  3856. @section highpass
  3857. Apply a high-pass filter with 3dB point frequency.
  3858. The filter can be either single-pole, or double-pole (the default).
  3859. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3860. The filter accepts the following options:
  3861. @table @option
  3862. @item frequency, f
  3863. Set frequency in Hz. Default is 3000.
  3864. @item poles, p
  3865. Set number of poles. Default is 2.
  3866. @item width_type, t
  3867. Set method to specify band-width of filter.
  3868. @table @option
  3869. @item h
  3870. Hz
  3871. @item q
  3872. Q-Factor
  3873. @item o
  3874. octave
  3875. @item s
  3876. slope
  3877. @item k
  3878. kHz
  3879. @end table
  3880. @item width, w
  3881. Specify the band-width of a filter in width_type units.
  3882. Applies only to double-pole filter.
  3883. The default is 0.707q and gives a Butterworth response.
  3884. @item mix, m
  3885. How much to use filtered signal in output. Default is 1.
  3886. Range is between 0 and 1.
  3887. @item channels, c
  3888. Specify which channels to filter, by default all available are filtered.
  3889. @item normalize, n
  3890. Normalize biquad coefficients, by default is disabled.
  3891. Enabling it will normalize magnitude response at DC to 0dB.
  3892. @item transform, a
  3893. Set transform type of IIR filter.
  3894. @table @option
  3895. @item di
  3896. @item dii
  3897. @item tdii
  3898. @item latt
  3899. @item svf
  3900. @end table
  3901. @item precision, r
  3902. Set precison of filtering.
  3903. @table @option
  3904. @item auto
  3905. Pick automatic sample format depending on surround filters.
  3906. @item s16
  3907. Always use signed 16-bit.
  3908. @item s32
  3909. Always use signed 32-bit.
  3910. @item f32
  3911. Always use float 32-bit.
  3912. @item f64
  3913. Always use float 64-bit.
  3914. @end table
  3915. @end table
  3916. @subsection Commands
  3917. This filter supports the following commands:
  3918. @table @option
  3919. @item frequency, f
  3920. Change highpass frequency.
  3921. Syntax for the command is : "@var{frequency}"
  3922. @item width_type, t
  3923. Change highpass width_type.
  3924. Syntax for the command is : "@var{width_type}"
  3925. @item width, w
  3926. Change highpass width.
  3927. Syntax for the command is : "@var{width}"
  3928. @item mix, m
  3929. Change highpass mix.
  3930. Syntax for the command is : "@var{mix}"
  3931. @end table
  3932. @section join
  3933. Join multiple input streams into one multi-channel stream.
  3934. It accepts the following parameters:
  3935. @table @option
  3936. @item inputs
  3937. The number of input streams. It defaults to 2.
  3938. @item channel_layout
  3939. The desired output channel layout. It defaults to stereo.
  3940. @item map
  3941. Map channels from inputs to output. The argument is a '|'-separated list of
  3942. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3943. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3944. can be either the name of the input channel (e.g. FL for front left) or its
  3945. index in the specified input stream. @var{out_channel} is the name of the output
  3946. channel.
  3947. @end table
  3948. The filter will attempt to guess the mappings when they are not specified
  3949. explicitly. It does so by first trying to find an unused matching input channel
  3950. and if that fails it picks the first unused input channel.
  3951. Join 3 inputs (with properly set channel layouts):
  3952. @example
  3953. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3954. @end example
  3955. Build a 5.1 output from 6 single-channel streams:
  3956. @example
  3957. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3958. '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'
  3959. out
  3960. @end example
  3961. @section ladspa
  3962. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3963. To enable compilation of this filter you need to configure FFmpeg with
  3964. @code{--enable-ladspa}.
  3965. @table @option
  3966. @item file, f
  3967. Specifies the name of LADSPA plugin library to load. If the environment
  3968. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3969. each one of the directories specified by the colon separated list in
  3970. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3971. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3972. @file{/usr/lib/ladspa/}.
  3973. @item plugin, p
  3974. Specifies the plugin within the library. Some libraries contain only
  3975. one plugin, but others contain many of them. If this is not set filter
  3976. will list all available plugins within the specified library.
  3977. @item controls, c
  3978. Set the '|' separated list of controls which are zero or more floating point
  3979. values that determine the behavior of the loaded plugin (for example delay,
  3980. threshold or gain).
  3981. Controls need to be defined using the following syntax:
  3982. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3983. @var{valuei} is the value set on the @var{i}-th control.
  3984. Alternatively they can be also defined using the following syntax:
  3985. @var{value0}|@var{value1}|@var{value2}|..., where
  3986. @var{valuei} is the value set on the @var{i}-th control.
  3987. If @option{controls} is set to @code{help}, all available controls and
  3988. their valid ranges are printed.
  3989. @item sample_rate, s
  3990. Specify the sample rate, default to 44100. Only used if plugin have
  3991. zero inputs.
  3992. @item nb_samples, n
  3993. Set the number of samples per channel per each output frame, default
  3994. is 1024. Only used if plugin have zero inputs.
  3995. @item duration, d
  3996. Set the minimum duration of the sourced audio. See
  3997. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3998. for the accepted syntax.
  3999. Note that the resulting duration may be greater than the specified duration,
  4000. as the generated audio is always cut at the end of a complete frame.
  4001. If not specified, or the expressed duration is negative, the audio is
  4002. supposed to be generated forever.
  4003. Only used if plugin have zero inputs.
  4004. @item latency, l
  4005. Enable latency compensation, by default is disabled.
  4006. Only used if plugin have inputs.
  4007. @end table
  4008. @subsection Examples
  4009. @itemize
  4010. @item
  4011. List all available plugins within amp (LADSPA example plugin) library:
  4012. @example
  4013. ladspa=file=amp
  4014. @end example
  4015. @item
  4016. List all available controls and their valid ranges for @code{vcf_notch}
  4017. plugin from @code{VCF} library:
  4018. @example
  4019. ladspa=f=vcf:p=vcf_notch:c=help
  4020. @end example
  4021. @item
  4022. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  4023. plugin library:
  4024. @example
  4025. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  4026. @end example
  4027. @item
  4028. Add reverberation to the audio using TAP-plugins
  4029. (Tom's Audio Processing plugins):
  4030. @example
  4031. ladspa=file=tap_reverb:tap_reverb
  4032. @end example
  4033. @item
  4034. Generate white noise, with 0.2 amplitude:
  4035. @example
  4036. ladspa=file=cmt:noise_source_white:c=c0=.2
  4037. @end example
  4038. @item
  4039. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  4040. @code{C* Audio Plugin Suite} (CAPS) library:
  4041. @example
  4042. ladspa=file=caps:Click:c=c1=20'
  4043. @end example
  4044. @item
  4045. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  4046. @example
  4047. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  4048. @end example
  4049. @item
  4050. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  4051. @code{SWH Plugins} collection:
  4052. @example
  4053. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  4054. @end example
  4055. @item
  4056. Attenuate low frequencies using Multiband EQ from Steve Harris
  4057. @code{SWH Plugins} collection:
  4058. @example
  4059. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  4060. @end example
  4061. @item
  4062. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  4063. (CAPS) library:
  4064. @example
  4065. ladspa=caps:Narrower
  4066. @end example
  4067. @item
  4068. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  4069. @example
  4070. ladspa=caps:White:.2
  4071. @end example
  4072. @item
  4073. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  4074. @example
  4075. ladspa=caps:Fractal:c=c1=1
  4076. @end example
  4077. @item
  4078. Dynamic volume normalization using @code{VLevel} plugin:
  4079. @example
  4080. ladspa=vlevel-ladspa:vlevel_mono
  4081. @end example
  4082. @end itemize
  4083. @subsection Commands
  4084. This filter supports the following commands:
  4085. @table @option
  4086. @item cN
  4087. Modify the @var{N}-th control value.
  4088. If the specified value is not valid, it is ignored and prior one is kept.
  4089. @end table
  4090. @section loudnorm
  4091. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  4092. Support for both single pass (livestreams, files) and double pass (files) modes.
  4093. This algorithm can target IL, LRA, and maximum true peak. In dynamic mode, to accurately
  4094. detect true peaks, the audio stream will be upsampled to 192 kHz.
  4095. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  4096. The filter accepts the following options:
  4097. @table @option
  4098. @item I, i
  4099. Set integrated loudness target.
  4100. Range is -70.0 - -5.0. Default value is -24.0.
  4101. @item LRA, lra
  4102. Set loudness range target.
  4103. Range is 1.0 - 50.0. Default value is 7.0.
  4104. @item TP, tp
  4105. Set maximum true peak.
  4106. Range is -9.0 - +0.0. Default value is -2.0.
  4107. @item measured_I, measured_i
  4108. Measured IL of input file.
  4109. Range is -99.0 - +0.0.
  4110. @item measured_LRA, measured_lra
  4111. Measured LRA of input file.
  4112. Range is 0.0 - 99.0.
  4113. @item measured_TP, measured_tp
  4114. Measured true peak of input file.
  4115. Range is -99.0 - +99.0.
  4116. @item measured_thresh
  4117. Measured threshold of input file.
  4118. Range is -99.0 - +0.0.
  4119. @item offset
  4120. Set offset gain. Gain is applied before the true-peak limiter.
  4121. Range is -99.0 - +99.0. Default is +0.0.
  4122. @item linear
  4123. Normalize by linearly scaling the source audio.
  4124. @code{measured_I}, @code{measured_LRA}, @code{measured_TP},
  4125. and @code{measured_thresh} must all be specified. Target LRA shouldn't
  4126. be lower than source LRA and the change in integrated loudness shouldn't
  4127. result in a true peak which exceeds the target TP. If any of these
  4128. conditions aren't met, normalization mode will revert to @var{dynamic}.
  4129. Options are @code{true} or @code{false}. Default is @code{true}.
  4130. @item dual_mono
  4131. Treat mono input files as "dual-mono". If a mono file is intended for playback
  4132. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  4133. If set to @code{true}, this option will compensate for this effect.
  4134. Multi-channel input files are not affected by this option.
  4135. Options are true or false. Default is false.
  4136. @item print_format
  4137. Set print format for stats. Options are summary, json, or none.
  4138. Default value is none.
  4139. @end table
  4140. @section lowpass
  4141. Apply a low-pass filter with 3dB point frequency.
  4142. The filter can be either single-pole or double-pole (the default).
  4143. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  4144. The filter accepts the following options:
  4145. @table @option
  4146. @item frequency, f
  4147. Set frequency in Hz. Default is 500.
  4148. @item poles, p
  4149. Set number of poles. Default is 2.
  4150. @item width_type, t
  4151. Set method to specify band-width of filter.
  4152. @table @option
  4153. @item h
  4154. Hz
  4155. @item q
  4156. Q-Factor
  4157. @item o
  4158. octave
  4159. @item s
  4160. slope
  4161. @item k
  4162. kHz
  4163. @end table
  4164. @item width, w
  4165. Specify the band-width of a filter in width_type units.
  4166. Applies only to double-pole filter.
  4167. The default is 0.707q and gives a Butterworth response.
  4168. @item mix, m
  4169. How much to use filtered signal in output. Default is 1.
  4170. Range is between 0 and 1.
  4171. @item channels, c
  4172. Specify which channels to filter, by default all available are filtered.
  4173. @item normalize, n
  4174. Normalize biquad coefficients, by default is disabled.
  4175. Enabling it will normalize magnitude response at DC to 0dB.
  4176. @item transform, a
  4177. Set transform type of IIR filter.
  4178. @table @option
  4179. @item di
  4180. @item dii
  4181. @item tdii
  4182. @item latt
  4183. @item svf
  4184. @end table
  4185. @item precision, r
  4186. Set precison of filtering.
  4187. @table @option
  4188. @item auto
  4189. Pick automatic sample format depending on surround filters.
  4190. @item s16
  4191. Always use signed 16-bit.
  4192. @item s32
  4193. Always use signed 32-bit.
  4194. @item f32
  4195. Always use float 32-bit.
  4196. @item f64
  4197. Always use float 64-bit.
  4198. @end table
  4199. @end table
  4200. @subsection Examples
  4201. @itemize
  4202. @item
  4203. Lowpass only LFE channel, it LFE is not present it does nothing:
  4204. @example
  4205. lowpass=c=LFE
  4206. @end example
  4207. @end itemize
  4208. @subsection Commands
  4209. This filter supports the following commands:
  4210. @table @option
  4211. @item frequency, f
  4212. Change lowpass frequency.
  4213. Syntax for the command is : "@var{frequency}"
  4214. @item width_type, t
  4215. Change lowpass width_type.
  4216. Syntax for the command is : "@var{width_type}"
  4217. @item width, w
  4218. Change lowpass width.
  4219. Syntax for the command is : "@var{width}"
  4220. @item mix, m
  4221. Change lowpass mix.
  4222. Syntax for the command is : "@var{mix}"
  4223. @end table
  4224. @section lv2
  4225. Load a LV2 (LADSPA Version 2) plugin.
  4226. To enable compilation of this filter you need to configure FFmpeg with
  4227. @code{--enable-lv2}.
  4228. @table @option
  4229. @item plugin, p
  4230. Specifies the plugin URI. You may need to escape ':'.
  4231. @item controls, c
  4232. Set the '|' separated list of controls which are zero or more floating point
  4233. values that determine the behavior of the loaded plugin (for example delay,
  4234. threshold or gain).
  4235. If @option{controls} is set to @code{help}, all available controls and
  4236. their valid ranges are printed.
  4237. @item sample_rate, s
  4238. Specify the sample rate, default to 44100. Only used if plugin have
  4239. zero inputs.
  4240. @item nb_samples, n
  4241. Set the number of samples per channel per each output frame, default
  4242. is 1024. Only used if plugin have zero inputs.
  4243. @item duration, d
  4244. Set the minimum duration of the sourced audio. See
  4245. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4246. for the accepted syntax.
  4247. Note that the resulting duration may be greater than the specified duration,
  4248. as the generated audio is always cut at the end of a complete frame.
  4249. If not specified, or the expressed duration is negative, the audio is
  4250. supposed to be generated forever.
  4251. Only used if plugin have zero inputs.
  4252. @end table
  4253. @subsection Examples
  4254. @itemize
  4255. @item
  4256. Apply bass enhancer plugin from Calf:
  4257. @example
  4258. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  4259. @end example
  4260. @item
  4261. Apply vinyl plugin from Calf:
  4262. @example
  4263. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  4264. @end example
  4265. @item
  4266. Apply bit crusher plugin from ArtyFX:
  4267. @example
  4268. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  4269. @end example
  4270. @end itemize
  4271. @subsection Commands
  4272. This filter supports all options that are exported by plugin as commands.
  4273. @section mcompand
  4274. Multiband Compress or expand the audio's dynamic range.
  4275. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  4276. This is akin to the crossover of a loudspeaker, and results in flat frequency
  4277. response when absent compander action.
  4278. It accepts the following parameters:
  4279. @table @option
  4280. @item args
  4281. This option syntax is:
  4282. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  4283. For explanation of each item refer to compand filter documentation.
  4284. @end table
  4285. @anchor{pan}
  4286. @section pan
  4287. Mix channels with specific gain levels. The filter accepts the output
  4288. channel layout followed by a set of channels definitions.
  4289. This filter is also designed to efficiently remap the channels of an audio
  4290. stream.
  4291. The filter accepts parameters of the form:
  4292. "@var{l}|@var{outdef}|@var{outdef}|..."
  4293. @table @option
  4294. @item l
  4295. output channel layout or number of channels
  4296. @item outdef
  4297. output channel specification, of the form:
  4298. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  4299. @item out_name
  4300. output channel to define, either a channel name (FL, FR, etc.) or a channel
  4301. number (c0, c1, etc.)
  4302. @item gain
  4303. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  4304. @item in_name
  4305. input channel to use, see out_name for details; it is not possible to mix
  4306. named and numbered input channels
  4307. @end table
  4308. If the `=' in a channel specification is replaced by `<', then the gains for
  4309. that specification will be renormalized so that the total is 1, thus
  4310. avoiding clipping noise.
  4311. @subsection Mixing examples
  4312. For example, if you want to down-mix from stereo to mono, but with a bigger
  4313. factor for the left channel:
  4314. @example
  4315. pan=1c|c0=0.9*c0+0.1*c1
  4316. @end example
  4317. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  4318. 7-channels surround:
  4319. @example
  4320. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  4321. @end example
  4322. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  4323. that should be preferred (see "-ac" option) unless you have very specific
  4324. needs.
  4325. @subsection Remapping examples
  4326. The channel remapping will be effective if, and only if:
  4327. @itemize
  4328. @item gain coefficients are zeroes or ones,
  4329. @item only one input per channel output,
  4330. @end itemize
  4331. If all these conditions are satisfied, the filter will notify the user ("Pure
  4332. channel mapping detected"), and use an optimized and lossless method to do the
  4333. remapping.
  4334. For example, if you have a 5.1 source and want a stereo audio stream by
  4335. dropping the extra channels:
  4336. @example
  4337. pan="stereo| c0=FL | c1=FR"
  4338. @end example
  4339. Given the same source, you can also switch front left and front right channels
  4340. and keep the input channel layout:
  4341. @example
  4342. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  4343. @end example
  4344. If the input is a stereo audio stream, you can mute the front left channel (and
  4345. still keep the stereo channel layout) with:
  4346. @example
  4347. pan="stereo|c1=c1"
  4348. @end example
  4349. Still with a stereo audio stream input, you can copy the right channel in both
  4350. front left and right:
  4351. @example
  4352. pan="stereo| c0=FR | c1=FR"
  4353. @end example
  4354. @section replaygain
  4355. ReplayGain scanner filter. This filter takes an audio stream as an input and
  4356. outputs it unchanged.
  4357. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  4358. @section resample
  4359. Convert the audio sample format, sample rate and channel layout. It is
  4360. not meant to be used directly.
  4361. @section rubberband
  4362. Apply time-stretching and pitch-shifting with librubberband.
  4363. To enable compilation of this filter, you need to configure FFmpeg with
  4364. @code{--enable-librubberband}.
  4365. The filter accepts the following options:
  4366. @table @option
  4367. @item tempo
  4368. Set tempo scale factor.
  4369. @item pitch
  4370. Set pitch scale factor.
  4371. @item transients
  4372. Set transients detector.
  4373. Possible values are:
  4374. @table @var
  4375. @item crisp
  4376. @item mixed
  4377. @item smooth
  4378. @end table
  4379. @item detector
  4380. Set detector.
  4381. Possible values are:
  4382. @table @var
  4383. @item compound
  4384. @item percussive
  4385. @item soft
  4386. @end table
  4387. @item phase
  4388. Set phase.
  4389. Possible values are:
  4390. @table @var
  4391. @item laminar
  4392. @item independent
  4393. @end table
  4394. @item window
  4395. Set processing window size.
  4396. Possible values are:
  4397. @table @var
  4398. @item standard
  4399. @item short
  4400. @item long
  4401. @end table
  4402. @item smoothing
  4403. Set smoothing.
  4404. Possible values are:
  4405. @table @var
  4406. @item off
  4407. @item on
  4408. @end table
  4409. @item formant
  4410. Enable formant preservation when shift pitching.
  4411. Possible values are:
  4412. @table @var
  4413. @item shifted
  4414. @item preserved
  4415. @end table
  4416. @item pitchq
  4417. Set pitch quality.
  4418. Possible values are:
  4419. @table @var
  4420. @item quality
  4421. @item speed
  4422. @item consistency
  4423. @end table
  4424. @item channels
  4425. Set channels.
  4426. Possible values are:
  4427. @table @var
  4428. @item apart
  4429. @item together
  4430. @end table
  4431. @end table
  4432. @subsection Commands
  4433. This filter supports the following commands:
  4434. @table @option
  4435. @item tempo
  4436. Change filter tempo scale factor.
  4437. Syntax for the command is : "@var{tempo}"
  4438. @item pitch
  4439. Change filter pitch scale factor.
  4440. Syntax for the command is : "@var{pitch}"
  4441. @end table
  4442. @section sidechaincompress
  4443. This filter acts like normal compressor but has the ability to compress
  4444. detected signal using second input signal.
  4445. It needs two input streams and returns one output stream.
  4446. First input stream will be processed depending on second stream signal.
  4447. The filtered signal then can be filtered with other filters in later stages of
  4448. processing. See @ref{pan} and @ref{amerge} filter.
  4449. The filter accepts the following options:
  4450. @table @option
  4451. @item level_in
  4452. Set input gain. Default is 1. Range is between 0.015625 and 64.
  4453. @item mode
  4454. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  4455. Default is @code{downward}.
  4456. @item threshold
  4457. If a signal of second stream raises above this level it will affect the gain
  4458. reduction of first stream.
  4459. By default is 0.125. Range is between 0.00097563 and 1.
  4460. @item ratio
  4461. Set a ratio about which the signal is reduced. 1:2 means that if the level
  4462. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  4463. Default is 2. Range is between 1 and 20.
  4464. @item attack
  4465. Amount of milliseconds the signal has to rise above the threshold before gain
  4466. reduction starts. Default is 20. Range is between 0.01 and 2000.
  4467. @item release
  4468. Amount of milliseconds the signal has to fall below the threshold before
  4469. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  4470. @item makeup
  4471. Set the amount by how much signal will be amplified after processing.
  4472. Default is 1. Range is from 1 to 64.
  4473. @item knee
  4474. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4475. Default is 2.82843. Range is between 1 and 8.
  4476. @item link
  4477. Choose if the @code{average} level between all channels of side-chain stream
  4478. or the louder(@code{maximum}) channel of side-chain stream affects the
  4479. reduction. Default is @code{average}.
  4480. @item detection
  4481. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  4482. of @code{rms}. Default is @code{rms} which is mainly smoother.
  4483. @item level_sc
  4484. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  4485. @item mix
  4486. How much to use compressed signal in output. Default is 1.
  4487. Range is between 0 and 1.
  4488. @end table
  4489. @subsection Commands
  4490. This filter supports the all above options as @ref{commands}.
  4491. @subsection Examples
  4492. @itemize
  4493. @item
  4494. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  4495. depending on the signal of 2nd input and later compressed signal to be
  4496. merged with 2nd input:
  4497. @example
  4498. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  4499. @end example
  4500. @end itemize
  4501. @section sidechaingate
  4502. A sidechain gate acts like a normal (wideband) gate but has the ability to
  4503. filter the detected signal before sending it to the gain reduction stage.
  4504. Normally a gate uses the full range signal to detect a level above the
  4505. threshold.
  4506. For example: If you cut all lower frequencies from your sidechain signal
  4507. the gate will decrease the volume of your track only if not enough highs
  4508. appear. With this technique you are able to reduce the resonation of a
  4509. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  4510. guitar.
  4511. It needs two input streams and returns one output stream.
  4512. First input stream will be processed depending on second stream signal.
  4513. The filter accepts the following options:
  4514. @table @option
  4515. @item level_in
  4516. Set input level before filtering.
  4517. Default is 1. Allowed range is from 0.015625 to 64.
  4518. @item mode
  4519. Set the mode of operation. Can be @code{upward} or @code{downward}.
  4520. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  4521. will be amplified, expanding dynamic range in upward direction.
  4522. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  4523. @item range
  4524. Set the level of gain reduction when the signal is below the threshold.
  4525. Default is 0.06125. Allowed range is from 0 to 1.
  4526. Setting this to 0 disables reduction and then filter behaves like expander.
  4527. @item threshold
  4528. If a signal rises above this level the gain reduction is released.
  4529. Default is 0.125. Allowed range is from 0 to 1.
  4530. @item ratio
  4531. Set a ratio about which the signal is reduced.
  4532. Default is 2. Allowed range is from 1 to 9000.
  4533. @item attack
  4534. Amount of milliseconds the signal has to rise above the threshold before gain
  4535. reduction stops.
  4536. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  4537. @item release
  4538. Amount of milliseconds the signal has to fall below the threshold before the
  4539. reduction is increased again. Default is 250 milliseconds.
  4540. Allowed range is from 0.01 to 9000.
  4541. @item makeup
  4542. Set amount of amplification of signal after processing.
  4543. Default is 1. Allowed range is from 1 to 64.
  4544. @item knee
  4545. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4546. Default is 2.828427125. Allowed range is from 1 to 8.
  4547. @item detection
  4548. Choose if exact signal should be taken for detection or an RMS like one.
  4549. Default is rms. Can be peak or rms.
  4550. @item link
  4551. Choose if the average level between all channels or the louder channel affects
  4552. the reduction.
  4553. Default is average. Can be average or maximum.
  4554. @item level_sc
  4555. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  4556. @end table
  4557. @subsection Commands
  4558. This filter supports the all above options as @ref{commands}.
  4559. @section silencedetect
  4560. Detect silence in an audio stream.
  4561. This filter logs a message when it detects that the input audio volume is less
  4562. or equal to a noise tolerance value for a duration greater or equal to the
  4563. minimum detected noise duration.
  4564. The printed times and duration are expressed in seconds. The
  4565. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  4566. is set on the first frame whose timestamp equals or exceeds the detection
  4567. duration and it contains the timestamp of the first frame of the silence.
  4568. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  4569. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  4570. keys are set on the first frame after the silence. If @option{mono} is
  4571. enabled, and each channel is evaluated separately, the @code{.X}
  4572. suffixed keys are used, and @code{X} corresponds to the channel number.
  4573. The filter accepts the following options:
  4574. @table @option
  4575. @item noise, n
  4576. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  4577. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  4578. @item duration, d
  4579. Set silence duration until notification (default is 2 seconds). See
  4580. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4581. for the accepted syntax.
  4582. @item mono, m
  4583. Process each channel separately, instead of combined. By default is disabled.
  4584. @end table
  4585. @subsection Examples
  4586. @itemize
  4587. @item
  4588. Detect 5 seconds of silence with -50dB noise tolerance:
  4589. @example
  4590. silencedetect=n=-50dB:d=5
  4591. @end example
  4592. @item
  4593. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  4594. tolerance in @file{silence.mp3}:
  4595. @example
  4596. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  4597. @end example
  4598. @end itemize
  4599. @section silenceremove
  4600. Remove silence from the beginning, middle or end of the audio.
  4601. The filter accepts the following options:
  4602. @table @option
  4603. @item start_periods
  4604. This value is used to indicate if audio should be trimmed at beginning of
  4605. the audio. A value of zero indicates no silence should be trimmed from the
  4606. beginning. When specifying a non-zero value, it trims audio up until it
  4607. finds non-silence. Normally, when trimming silence from beginning of audio
  4608. the @var{start_periods} will be @code{1} but it can be increased to higher
  4609. values to trim all audio up to specific count of non-silence periods.
  4610. Default value is @code{0}.
  4611. @item start_duration
  4612. Specify the amount of time that non-silence must be detected before it stops
  4613. trimming audio. By increasing the duration, bursts of noises can be treated
  4614. as silence and trimmed off. Default value is @code{0}.
  4615. @item start_threshold
  4616. This indicates what sample value should be treated as silence. For digital
  4617. audio, a value of @code{0} may be fine but for audio recorded from analog,
  4618. you may wish to increase the value to account for background noise.
  4619. Can be specified in dB (in case "dB" is appended to the specified value)
  4620. or amplitude ratio. Default value is @code{0}.
  4621. @item start_silence
  4622. Specify max duration of silence at beginning that will be kept after
  4623. trimming. Default is 0, which is equal to trimming all samples detected
  4624. as silence.
  4625. @item start_mode
  4626. Specify mode of detection of silence end in start of multi-channel audio.
  4627. Can be @var{any} or @var{all}. Default is @var{any}.
  4628. With @var{any}, any sample that is detected as non-silence will cause
  4629. stopped trimming of silence.
  4630. With @var{all}, only if all channels are detected as non-silence will cause
  4631. stopped trimming of silence.
  4632. @item stop_periods
  4633. Set the count for trimming silence from the end of audio.
  4634. To remove silence from the middle of a file, specify a @var{stop_periods}
  4635. that is negative. This value is then treated as a positive value and is
  4636. used to indicate the effect should restart processing as specified by
  4637. @var{start_periods}, making it suitable for removing periods of silence
  4638. in the middle of the audio.
  4639. Default value is @code{0}.
  4640. @item stop_duration
  4641. Specify a duration of silence that must exist before audio is not copied any
  4642. more. By specifying a higher duration, silence that is wanted can be left in
  4643. the audio.
  4644. Default value is @code{0}.
  4645. @item stop_threshold
  4646. This is the same as @option{start_threshold} but for trimming silence from
  4647. the end of audio.
  4648. Can be specified in dB (in case "dB" is appended to the specified value)
  4649. or amplitude ratio. Default value is @code{0}.
  4650. @item stop_silence
  4651. Specify max duration of silence at end that will be kept after
  4652. trimming. Default is 0, which is equal to trimming all samples detected
  4653. as silence.
  4654. @item stop_mode
  4655. Specify mode of detection of silence start in end of multi-channel audio.
  4656. Can be @var{any} or @var{all}. Default is @var{any}.
  4657. With @var{any}, any sample that is detected as non-silence will cause
  4658. stopped trimming of silence.
  4659. With @var{all}, only if all channels are detected as non-silence will cause
  4660. stopped trimming of silence.
  4661. @item detection
  4662. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  4663. and works better with digital silence which is exactly 0.
  4664. Default value is @code{rms}.
  4665. @item window
  4666. Set duration in number of seconds used to calculate size of window in number
  4667. of samples for detecting silence.
  4668. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  4669. @end table
  4670. @subsection Examples
  4671. @itemize
  4672. @item
  4673. The following example shows how this filter can be used to start a recording
  4674. that does not contain the delay at the start which usually occurs between
  4675. pressing the record button and the start of the performance:
  4676. @example
  4677. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  4678. @end example
  4679. @item
  4680. Trim all silence encountered from beginning to end where there is more than 1
  4681. second of silence in audio:
  4682. @example
  4683. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  4684. @end example
  4685. @item
  4686. Trim all digital silence samples, using peak detection, from beginning to end
  4687. where there is more than 0 samples of digital silence in audio and digital
  4688. silence is detected in all channels at same positions in stream:
  4689. @example
  4690. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  4691. @end example
  4692. @end itemize
  4693. @section sofalizer
  4694. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  4695. loudspeakers around the user for binaural listening via headphones (audio
  4696. formats up to 9 channels supported).
  4697. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  4698. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  4699. Austrian Academy of Sciences.
  4700. To enable compilation of this filter you need to configure FFmpeg with
  4701. @code{--enable-libmysofa}.
  4702. The filter accepts the following options:
  4703. @table @option
  4704. @item sofa
  4705. Set the SOFA file used for rendering.
  4706. @item gain
  4707. Set gain applied to audio. Value is in dB. Default is 0.
  4708. @item rotation
  4709. Set rotation of virtual loudspeakers in deg. Default is 0.
  4710. @item elevation
  4711. Set elevation of virtual speakers in deg. Default is 0.
  4712. @item radius
  4713. Set distance in meters between loudspeakers and the listener with near-field
  4714. HRTFs. Default is 1.
  4715. @item type
  4716. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  4717. processing audio in time domain which is slow.
  4718. @var{freq} is processing audio in frequency domain which is fast.
  4719. Default is @var{freq}.
  4720. @item speakers
  4721. Set custom positions of virtual loudspeakers. Syntax for this option is:
  4722. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  4723. Each virtual loudspeaker is described with short channel name following with
  4724. azimuth and elevation in degrees.
  4725. Each virtual loudspeaker description is separated by '|'.
  4726. For example to override front left and front right channel positions use:
  4727. 'speakers=FL 45 15|FR 345 15'.
  4728. Descriptions with unrecognised channel names are ignored.
  4729. @item lfegain
  4730. Set custom gain for LFE channels. Value is in dB. Default is 0.
  4731. @item framesize
  4732. Set custom frame size in number of samples. Default is 1024.
  4733. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  4734. is set to @var{freq}.
  4735. @item normalize
  4736. Should all IRs be normalized upon importing SOFA file.
  4737. By default is enabled.
  4738. @item interpolate
  4739. Should nearest IRs be interpolated with neighbor IRs if exact position
  4740. does not match. By default is disabled.
  4741. @item minphase
  4742. Minphase all IRs upon loading of SOFA file. By default is disabled.
  4743. @item anglestep
  4744. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  4745. @item radstep
  4746. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  4747. @end table
  4748. @subsection Examples
  4749. @itemize
  4750. @item
  4751. Using ClubFritz6 sofa file:
  4752. @example
  4753. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  4754. @end example
  4755. @item
  4756. Using ClubFritz12 sofa file and bigger radius with small rotation:
  4757. @example
  4758. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  4759. @end example
  4760. @item
  4761. Similar as above but with custom speaker positions for front left, front right, back left and back right
  4762. and also with custom gain:
  4763. @example
  4764. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  4765. @end example
  4766. @end itemize
  4767. @section speechnorm
  4768. Speech Normalizer.
  4769. This filter expands or compresses each half-cycle of audio samples
  4770. (local set of samples all above or all below zero and between two nearest zero crossings) depending
  4771. on threshold value, so audio reaches target peak value under conditions controlled by below options.
  4772. The filter accepts the following options:
  4773. @table @option
  4774. @item peak, p
  4775. Set the expansion target peak value. This specifies the highest allowed absolute amplitude
  4776. level for the normalized audio input. Default value is 0.95. Allowed range is from 0.0 to 1.0.
  4777. @item expansion, e
  4778. Set the maximum expansion factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  4779. This option controls maximum local half-cycle of samples expansion. The maximum expansion
  4780. would be such that local peak value reaches target peak value but never to surpass it and that
  4781. ratio between new and previous peak value does not surpass this option value.
  4782. @item compression, c
  4783. Set the maximum compression factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  4784. This option controls maximum local half-cycle of samples compression. This option is used
  4785. only if @option{threshold} option is set to value greater than 0.0, then in such cases
  4786. when local peak is lower or same as value set by @option{threshold} all samples belonging to
  4787. that peak's half-cycle will be compressed by current compression factor.
  4788. @item threshold, t
  4789. Set the threshold value. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  4790. This option specifies which half-cycles of samples will be compressed and which will be expanded.
  4791. Any half-cycle samples with their local peak value below or same as this option value will be
  4792. compressed by current compression factor, otherwise, if greater than threshold value they will be
  4793. expanded with expansion factor so that it could reach peak target value but never surpass it.
  4794. @item raise, r
  4795. Set the expansion raising amount per each half-cycle of samples. Default value is 0.001.
  4796. Allowed range is from 0.0 to 1.0. This controls how fast expansion factor is raised per
  4797. each new half-cycle until it reaches @option{expansion} value.
  4798. Setting this options too high may lead to distortions.
  4799. @item fall, f
  4800. Set the compression raising amount per each half-cycle of samples. Default value is 0.001.
  4801. Allowed range is from 0.0 to 1.0. This controls how fast compression factor is raised per
  4802. each new half-cycle until it reaches @option{compression} value.
  4803. @item channels, h
  4804. Specify which channels to filter, by default all available channels are filtered.
  4805. @item invert, i
  4806. Enable inverted filtering, by default is disabled. This inverts interpretation of @option{threshold}
  4807. option. When enabled any half-cycle of samples with their local peak value below or same as
  4808. @option{threshold} option will be expanded otherwise it will be compressed.
  4809. @item link, l
  4810. Link channels when calculating gain applied to each filtered channel sample, by default is disabled.
  4811. When disabled each filtered channel gain calculation is independent, otherwise when this option
  4812. is enabled the minimum of all possible gains for each filtered channel is used.
  4813. @end table
  4814. @subsection Commands
  4815. This filter supports the all above options as @ref{commands}.
  4816. @section stereotools
  4817. This filter has some handy utilities to manage stereo signals, for converting
  4818. M/S stereo recordings to L/R signal while having control over the parameters
  4819. or spreading the stereo image of master track.
  4820. The filter accepts the following options:
  4821. @table @option
  4822. @item level_in
  4823. Set input level before filtering for both channels. Defaults is 1.
  4824. Allowed range is from 0.015625 to 64.
  4825. @item level_out
  4826. Set output level after filtering for both channels. Defaults is 1.
  4827. Allowed range is from 0.015625 to 64.
  4828. @item balance_in
  4829. Set input balance between both channels. Default is 0.
  4830. Allowed range is from -1 to 1.
  4831. @item balance_out
  4832. Set output balance between both channels. Default is 0.
  4833. Allowed range is from -1 to 1.
  4834. @item softclip
  4835. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  4836. clipping. Disabled by default.
  4837. @item mutel
  4838. Mute the left channel. Disabled by default.
  4839. @item muter
  4840. Mute the right channel. Disabled by default.
  4841. @item phasel
  4842. Change the phase of the left channel. Disabled by default.
  4843. @item phaser
  4844. Change the phase of the right channel. Disabled by default.
  4845. @item mode
  4846. Set stereo mode. Available values are:
  4847. @table @samp
  4848. @item lr>lr
  4849. Left/Right to Left/Right, this is default.
  4850. @item lr>ms
  4851. Left/Right to Mid/Side.
  4852. @item ms>lr
  4853. Mid/Side to Left/Right.
  4854. @item lr>ll
  4855. Left/Right to Left/Left.
  4856. @item lr>rr
  4857. Left/Right to Right/Right.
  4858. @item lr>l+r
  4859. Left/Right to Left + Right.
  4860. @item lr>rl
  4861. Left/Right to Right/Left.
  4862. @item ms>ll
  4863. Mid/Side to Left/Left.
  4864. @item ms>rr
  4865. Mid/Side to Right/Right.
  4866. @item ms>rl
  4867. Mid/Side to Right/Left.
  4868. @item lr>l-r
  4869. Left/Right to Left - Right.
  4870. @end table
  4871. @item slev
  4872. Set level of side signal. Default is 1.
  4873. Allowed range is from 0.015625 to 64.
  4874. @item sbal
  4875. Set balance of side signal. Default is 0.
  4876. Allowed range is from -1 to 1.
  4877. @item mlev
  4878. Set level of the middle signal. Default is 1.
  4879. Allowed range is from 0.015625 to 64.
  4880. @item mpan
  4881. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  4882. @item base
  4883. Set stereo base between mono and inversed channels. Default is 0.
  4884. Allowed range is from -1 to 1.
  4885. @item delay
  4886. Set delay in milliseconds how much to delay left from right channel and
  4887. vice versa. Default is 0. Allowed range is from -20 to 20.
  4888. @item sclevel
  4889. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  4890. @item phase
  4891. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  4892. @item bmode_in, bmode_out
  4893. Set balance mode for balance_in/balance_out option.
  4894. Can be one of the following:
  4895. @table @samp
  4896. @item balance
  4897. Classic balance mode. Attenuate one channel at time.
  4898. Gain is raised up to 1.
  4899. @item amplitude
  4900. Similar as classic mode above but gain is raised up to 2.
  4901. @item power
  4902. Equal power distribution, from -6dB to +6dB range.
  4903. @end table
  4904. @end table
  4905. @subsection Commands
  4906. This filter supports the all above options as @ref{commands}.
  4907. @subsection Examples
  4908. @itemize
  4909. @item
  4910. Apply karaoke like effect:
  4911. @example
  4912. stereotools=mlev=0.015625
  4913. @end example
  4914. @item
  4915. Convert M/S signal to L/R:
  4916. @example
  4917. "stereotools=mode=ms>lr"
  4918. @end example
  4919. @end itemize
  4920. @section stereowiden
  4921. This filter enhance the stereo effect by suppressing signal common to both
  4922. channels and by delaying the signal of left into right and vice versa,
  4923. thereby widening the stereo effect.
  4924. The filter accepts the following options:
  4925. @table @option
  4926. @item delay
  4927. Time in milliseconds of the delay of left signal into right and vice versa.
  4928. Default is 20 milliseconds.
  4929. @item feedback
  4930. Amount of gain in delayed signal into right and vice versa. Gives a delay
  4931. effect of left signal in right output and vice versa which gives widening
  4932. effect. Default is 0.3.
  4933. @item crossfeed
  4934. Cross feed of left into right with inverted phase. This helps in suppressing
  4935. the mono. If the value is 1 it will cancel all the signal common to both
  4936. channels. Default is 0.3.
  4937. @item drymix
  4938. Set level of input signal of original channel. Default is 0.8.
  4939. @end table
  4940. @subsection Commands
  4941. This filter supports the all above options except @code{delay} as @ref{commands}.
  4942. @section superequalizer
  4943. Apply 18 band equalizer.
  4944. The filter accepts the following options:
  4945. @table @option
  4946. @item 1b
  4947. Set 65Hz band gain.
  4948. @item 2b
  4949. Set 92Hz band gain.
  4950. @item 3b
  4951. Set 131Hz band gain.
  4952. @item 4b
  4953. Set 185Hz band gain.
  4954. @item 5b
  4955. Set 262Hz band gain.
  4956. @item 6b
  4957. Set 370Hz band gain.
  4958. @item 7b
  4959. Set 523Hz band gain.
  4960. @item 8b
  4961. Set 740Hz band gain.
  4962. @item 9b
  4963. Set 1047Hz band gain.
  4964. @item 10b
  4965. Set 1480Hz band gain.
  4966. @item 11b
  4967. Set 2093Hz band gain.
  4968. @item 12b
  4969. Set 2960Hz band gain.
  4970. @item 13b
  4971. Set 4186Hz band gain.
  4972. @item 14b
  4973. Set 5920Hz band gain.
  4974. @item 15b
  4975. Set 8372Hz band gain.
  4976. @item 16b
  4977. Set 11840Hz band gain.
  4978. @item 17b
  4979. Set 16744Hz band gain.
  4980. @item 18b
  4981. Set 20000Hz band gain.
  4982. @end table
  4983. @section surround
  4984. Apply audio surround upmix filter.
  4985. This filter allows to produce multichannel output from audio stream.
  4986. The filter accepts the following options:
  4987. @table @option
  4988. @item chl_out
  4989. Set output channel layout. By default, this is @var{5.1}.
  4990. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4991. for the required syntax.
  4992. @item chl_in
  4993. Set input channel layout. By default, this is @var{stereo}.
  4994. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4995. for the required syntax.
  4996. @item level_in
  4997. Set input volume level. By default, this is @var{1}.
  4998. @item level_out
  4999. Set output volume level. By default, this is @var{1}.
  5000. @item lfe
  5001. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  5002. @item lfe_low
  5003. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  5004. @item lfe_high
  5005. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  5006. @item lfe_mode
  5007. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  5008. In @var{add} mode, LFE channel is created from input audio and added to output.
  5009. In @var{sub} mode, LFE channel is created from input audio and added to output but
  5010. also all non-LFE output channels are subtracted with output LFE channel.
  5011. @item angle
  5012. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  5013. Default is @var{90}.
  5014. @item fc_in
  5015. Set front center input volume. By default, this is @var{1}.
  5016. @item fc_out
  5017. Set front center output volume. By default, this is @var{1}.
  5018. @item fl_in
  5019. Set front left input volume. By default, this is @var{1}.
  5020. @item fl_out
  5021. Set front left output volume. By default, this is @var{1}.
  5022. @item fr_in
  5023. Set front right input volume. By default, this is @var{1}.
  5024. @item fr_out
  5025. Set front right output volume. By default, this is @var{1}.
  5026. @item sl_in
  5027. Set side left input volume. By default, this is @var{1}.
  5028. @item sl_out
  5029. Set side left output volume. By default, this is @var{1}.
  5030. @item sr_in
  5031. Set side right input volume. By default, this is @var{1}.
  5032. @item sr_out
  5033. Set side right output volume. By default, this is @var{1}.
  5034. @item bl_in
  5035. Set back left input volume. By default, this is @var{1}.
  5036. @item bl_out
  5037. Set back left output volume. By default, this is @var{1}.
  5038. @item br_in
  5039. Set back right input volume. By default, this is @var{1}.
  5040. @item br_out
  5041. Set back right output volume. By default, this is @var{1}.
  5042. @item bc_in
  5043. Set back center input volume. By default, this is @var{1}.
  5044. @item bc_out
  5045. Set back center output volume. By default, this is @var{1}.
  5046. @item lfe_in
  5047. Set LFE input volume. By default, this is @var{1}.
  5048. @item lfe_out
  5049. Set LFE output volume. By default, this is @var{1}.
  5050. @item allx
  5051. Set spread usage of stereo image across X axis for all channels.
  5052. Allowed range is from @var{-1} to @var{15}.
  5053. By default this value is negative @var{-1}, and thus unused.
  5054. @item ally
  5055. Set spread usage of stereo image across Y axis for all channels.
  5056. Allowed range is from @var{-1} to @var{15}.
  5057. By default this value is negative @var{-1}, and thus unused.
  5058. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  5059. Set spread usage of stereo image across X axis for each channel.
  5060. Allowed range is from @var{0.06} to @var{15}.
  5061. By default this value is @var{0.5}.
  5062. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  5063. Set spread usage of stereo image across Y axis for each channel.
  5064. Allowed range is from @var{0.06} to @var{15}.
  5065. By default this value is @var{0.5}.
  5066. @item win_size
  5067. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  5068. @item win_func
  5069. Set window function.
  5070. It accepts the following values:
  5071. @table @samp
  5072. @item rect
  5073. @item bartlett
  5074. @item hann, hanning
  5075. @item hamming
  5076. @item blackman
  5077. @item welch
  5078. @item flattop
  5079. @item bharris
  5080. @item bnuttall
  5081. @item bhann
  5082. @item sine
  5083. @item nuttall
  5084. @item lanczos
  5085. @item gauss
  5086. @item tukey
  5087. @item dolph
  5088. @item cauchy
  5089. @item parzen
  5090. @item poisson
  5091. @item bohman
  5092. @end table
  5093. Default is @code{hann}.
  5094. @item overlap
  5095. Set window overlap. If set to 1, the recommended overlap for selected
  5096. window function will be picked. Default is @code{0.5}.
  5097. @end table
  5098. @section treble, highshelf
  5099. Boost or cut treble (upper) frequencies of the audio using a two-pole
  5100. shelving filter with a response similar to that of a standard
  5101. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  5102. The filter accepts the following options:
  5103. @table @option
  5104. @item gain, g
  5105. Give the gain at whichever is the lower of ~22 kHz and the
  5106. Nyquist frequency. Its useful range is about -20 (for a large cut)
  5107. to +20 (for a large boost). Beware of clipping when using a positive gain.
  5108. @item frequency, f
  5109. Set the filter's central frequency and so can be used
  5110. to extend or reduce the frequency range to be boosted or cut.
  5111. The default value is @code{3000} Hz.
  5112. @item width_type, t
  5113. Set method to specify band-width of filter.
  5114. @table @option
  5115. @item h
  5116. Hz
  5117. @item q
  5118. Q-Factor
  5119. @item o
  5120. octave
  5121. @item s
  5122. slope
  5123. @item k
  5124. kHz
  5125. @end table
  5126. @item width, w
  5127. Determine how steep is the filter's shelf transition.
  5128. @item poles, p
  5129. Set number of poles. Default is 2.
  5130. @item mix, m
  5131. How much to use filtered signal in output. Default is 1.
  5132. Range is between 0 and 1.
  5133. @item channels, c
  5134. Specify which channels to filter, by default all available are filtered.
  5135. @item normalize, n
  5136. Normalize biquad coefficients, by default is disabled.
  5137. Enabling it will normalize magnitude response at DC to 0dB.
  5138. @item transform, a
  5139. Set transform type of IIR filter.
  5140. @table @option
  5141. @item di
  5142. @item dii
  5143. @item tdii
  5144. @item latt
  5145. @item svf
  5146. @end table
  5147. @item precision, r
  5148. Set precison of filtering.
  5149. @table @option
  5150. @item auto
  5151. Pick automatic sample format depending on surround filters.
  5152. @item s16
  5153. Always use signed 16-bit.
  5154. @item s32
  5155. Always use signed 32-bit.
  5156. @item f32
  5157. Always use float 32-bit.
  5158. @item f64
  5159. Always use float 64-bit.
  5160. @end table
  5161. @end table
  5162. @subsection Commands
  5163. This filter supports the following commands:
  5164. @table @option
  5165. @item frequency, f
  5166. Change treble frequency.
  5167. Syntax for the command is : "@var{frequency}"
  5168. @item width_type, t
  5169. Change treble width_type.
  5170. Syntax for the command is : "@var{width_type}"
  5171. @item width, w
  5172. Change treble width.
  5173. Syntax for the command is : "@var{width}"
  5174. @item gain, g
  5175. Change treble gain.
  5176. Syntax for the command is : "@var{gain}"
  5177. @item mix, m
  5178. Change treble mix.
  5179. Syntax for the command is : "@var{mix}"
  5180. @end table
  5181. @section tremolo
  5182. Sinusoidal amplitude modulation.
  5183. The filter accepts the following options:
  5184. @table @option
  5185. @item f
  5186. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  5187. (20 Hz or lower) will result in a tremolo effect.
  5188. This filter may also be used as a ring modulator by specifying
  5189. a modulation frequency higher than 20 Hz.
  5190. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  5191. @item d
  5192. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  5193. Default value is 0.5.
  5194. @end table
  5195. @section vibrato
  5196. Sinusoidal phase modulation.
  5197. The filter accepts the following options:
  5198. @table @option
  5199. @item f
  5200. Modulation frequency in Hertz.
  5201. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  5202. @item d
  5203. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  5204. Default value is 0.5.
  5205. @end table
  5206. @section volume
  5207. Adjust the input audio volume.
  5208. It accepts the following parameters:
  5209. @table @option
  5210. @item volume
  5211. Set audio volume expression.
  5212. Output values are clipped to the maximum value.
  5213. The output audio volume is given by the relation:
  5214. @example
  5215. @var{output_volume} = @var{volume} * @var{input_volume}
  5216. @end example
  5217. The default value for @var{volume} is "1.0".
  5218. @item precision
  5219. This parameter represents the mathematical precision.
  5220. It determines which input sample formats will be allowed, which affects the
  5221. precision of the volume scaling.
  5222. @table @option
  5223. @item fixed
  5224. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  5225. @item float
  5226. 32-bit floating-point; this limits input sample format to FLT. (default)
  5227. @item double
  5228. 64-bit floating-point; this limits input sample format to DBL.
  5229. @end table
  5230. @item replaygain
  5231. Choose the behaviour on encountering ReplayGain side data in input frames.
  5232. @table @option
  5233. @item drop
  5234. Remove ReplayGain side data, ignoring its contents (the default).
  5235. @item ignore
  5236. Ignore ReplayGain side data, but leave it in the frame.
  5237. @item track
  5238. Prefer the track gain, if present.
  5239. @item album
  5240. Prefer the album gain, if present.
  5241. @end table
  5242. @item replaygain_preamp
  5243. Pre-amplification gain in dB to apply to the selected replaygain gain.
  5244. Default value for @var{replaygain_preamp} is 0.0.
  5245. @item replaygain_noclip
  5246. Prevent clipping by limiting the gain applied.
  5247. Default value for @var{replaygain_noclip} is 1.
  5248. @item eval
  5249. Set when the volume expression is evaluated.
  5250. It accepts the following values:
  5251. @table @samp
  5252. @item once
  5253. only evaluate expression once during the filter initialization, or
  5254. when the @samp{volume} command is sent
  5255. @item frame
  5256. evaluate expression for each incoming frame
  5257. @end table
  5258. Default value is @samp{once}.
  5259. @end table
  5260. The volume expression can contain the following parameters.
  5261. @table @option
  5262. @item n
  5263. frame number (starting at zero)
  5264. @item nb_channels
  5265. number of channels
  5266. @item nb_consumed_samples
  5267. number of samples consumed by the filter
  5268. @item nb_samples
  5269. number of samples in the current frame
  5270. @item pos
  5271. original frame position in the file
  5272. @item pts
  5273. frame PTS
  5274. @item sample_rate
  5275. sample rate
  5276. @item startpts
  5277. PTS at start of stream
  5278. @item startt
  5279. time at start of stream
  5280. @item t
  5281. frame time
  5282. @item tb
  5283. timestamp timebase
  5284. @item volume
  5285. last set volume value
  5286. @end table
  5287. Note that when @option{eval} is set to @samp{once} only the
  5288. @var{sample_rate} and @var{tb} variables are available, all other
  5289. variables will evaluate to NAN.
  5290. @subsection Commands
  5291. This filter supports the following commands:
  5292. @table @option
  5293. @item volume
  5294. Modify the volume expression.
  5295. The command accepts the same syntax of the corresponding option.
  5296. If the specified expression is not valid, it is kept at its current
  5297. value.
  5298. @end table
  5299. @subsection Examples
  5300. @itemize
  5301. @item
  5302. Halve the input audio volume:
  5303. @example
  5304. volume=volume=0.5
  5305. volume=volume=1/2
  5306. volume=volume=-6.0206dB
  5307. @end example
  5308. In all the above example the named key for @option{volume} can be
  5309. omitted, for example like in:
  5310. @example
  5311. volume=0.5
  5312. @end example
  5313. @item
  5314. Increase input audio power by 6 decibels using fixed-point precision:
  5315. @example
  5316. volume=volume=6dB:precision=fixed
  5317. @end example
  5318. @item
  5319. Fade volume after time 10 with an annihilation period of 5 seconds:
  5320. @example
  5321. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  5322. @end example
  5323. @end itemize
  5324. @section volumedetect
  5325. Detect the volume of the input video.
  5326. The filter has no parameters. It supports only 16-bit signed integer samples,
  5327. so the input will be converted when needed. Statistics about the volume will
  5328. be printed in the log when the input stream end is reached.
  5329. In particular it will show the mean volume (root mean square), maximum
  5330. volume (on a per-sample basis), and the beginning of a histogram of the
  5331. registered volume values (from the maximum value to a cumulated 1/1000 of
  5332. the samples).
  5333. All volumes are in decibels relative to the maximum PCM value.
  5334. @subsection Examples
  5335. Here is an excerpt of the output:
  5336. @example
  5337. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  5338. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  5339. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  5340. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  5341. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  5342. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  5343. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  5344. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  5345. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  5346. @end example
  5347. It means that:
  5348. @itemize
  5349. @item
  5350. The mean square energy is approximately -27 dB, or 10^-2.7.
  5351. @item
  5352. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  5353. @item
  5354. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  5355. @end itemize
  5356. In other words, raising the volume by +4 dB does not cause any clipping,
  5357. raising it by +5 dB causes clipping for 6 samples, etc.
  5358. @c man end AUDIO FILTERS
  5359. @chapter Audio Sources
  5360. @c man begin AUDIO SOURCES
  5361. Below is a description of the currently available audio sources.
  5362. @section abuffer
  5363. Buffer audio frames, and make them available to the filter chain.
  5364. This source is mainly intended for a programmatic use, in particular
  5365. through the interface defined in @file{libavfilter/buffersrc.h}.
  5366. It accepts the following parameters:
  5367. @table @option
  5368. @item time_base
  5369. The timebase which will be used for timestamps of submitted frames. It must be
  5370. either a floating-point number or in @var{numerator}/@var{denominator} form.
  5371. @item sample_rate
  5372. The sample rate of the incoming audio buffers.
  5373. @item sample_fmt
  5374. The sample format of the incoming audio buffers.
  5375. Either a sample format name or its corresponding integer representation from
  5376. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  5377. @item channel_layout
  5378. The channel layout of the incoming audio buffers.
  5379. Either a channel layout name from channel_layout_map in
  5380. @file{libavutil/channel_layout.c} or its corresponding integer representation
  5381. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  5382. @item channels
  5383. The number of channels of the incoming audio buffers.
  5384. If both @var{channels} and @var{channel_layout} are specified, then they
  5385. must be consistent.
  5386. @end table
  5387. @subsection Examples
  5388. @example
  5389. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  5390. @end example
  5391. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  5392. Since the sample format with name "s16p" corresponds to the number
  5393. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  5394. equivalent to:
  5395. @example
  5396. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  5397. @end example
  5398. @section aevalsrc
  5399. Generate an audio signal specified by an expression.
  5400. This source accepts in input one or more expressions (one for each
  5401. channel), which are evaluated and used to generate a corresponding
  5402. audio signal.
  5403. This source accepts the following options:
  5404. @table @option
  5405. @item exprs
  5406. Set the '|'-separated expressions list for each separate channel. In case the
  5407. @option{channel_layout} option is not specified, the selected channel layout
  5408. depends on the number of provided expressions. Otherwise the last
  5409. specified expression is applied to the remaining output channels.
  5410. @item channel_layout, c
  5411. Set the channel layout. The number of channels in the specified layout
  5412. must be equal to the number of specified expressions.
  5413. @item duration, d
  5414. Set the minimum duration of the sourced audio. See
  5415. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5416. for the accepted syntax.
  5417. Note that the resulting duration may be greater than the specified
  5418. duration, as the generated audio is always cut at the end of a
  5419. complete frame.
  5420. If not specified, or the expressed duration is negative, the audio is
  5421. supposed to be generated forever.
  5422. @item nb_samples, n
  5423. Set the number of samples per channel per each output frame,
  5424. default to 1024.
  5425. @item sample_rate, s
  5426. Specify the sample rate, default to 44100.
  5427. @end table
  5428. Each expression in @var{exprs} can contain the following constants:
  5429. @table @option
  5430. @item n
  5431. number of the evaluated sample, starting from 0
  5432. @item t
  5433. time of the evaluated sample expressed in seconds, starting from 0
  5434. @item s
  5435. sample rate
  5436. @end table
  5437. @subsection Examples
  5438. @itemize
  5439. @item
  5440. Generate silence:
  5441. @example
  5442. aevalsrc=0
  5443. @end example
  5444. @item
  5445. Generate a sin signal with frequency of 440 Hz, set sample rate to
  5446. 8000 Hz:
  5447. @example
  5448. aevalsrc="sin(440*2*PI*t):s=8000"
  5449. @end example
  5450. @item
  5451. Generate a two channels signal, specify the channel layout (Front
  5452. Center + Back Center) explicitly:
  5453. @example
  5454. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  5455. @end example
  5456. @item
  5457. Generate white noise:
  5458. @example
  5459. aevalsrc="-2+random(0)"
  5460. @end example
  5461. @item
  5462. Generate an amplitude modulated signal:
  5463. @example
  5464. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  5465. @end example
  5466. @item
  5467. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  5468. @example
  5469. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  5470. @end example
  5471. @end itemize
  5472. @section afirsrc
  5473. Generate a FIR coefficients using frequency sampling method.
  5474. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  5475. The filter accepts the following options:
  5476. @table @option
  5477. @item taps, t
  5478. Set number of filter coefficents in output audio stream.
  5479. Default value is 1025.
  5480. @item frequency, f
  5481. Set frequency points from where magnitude and phase are set.
  5482. This must be in non decreasing order, and first element must be 0, while last element
  5483. must be 1. Elements are separated by white spaces.
  5484. @item magnitude, m
  5485. Set magnitude value for every frequency point set by @option{frequency}.
  5486. Number of values must be same as number of frequency points.
  5487. Values are separated by white spaces.
  5488. @item phase, p
  5489. Set phase value for every frequency point set by @option{frequency}.
  5490. Number of values must be same as number of frequency points.
  5491. Values are separated by white spaces.
  5492. @item sample_rate, r
  5493. Set sample rate, default is 44100.
  5494. @item nb_samples, n
  5495. Set number of samples per each frame. Default is 1024.
  5496. @item win_func, w
  5497. Set window function. Default is blackman.
  5498. @end table
  5499. @section anullsrc
  5500. The null audio source, return unprocessed audio frames. It is mainly useful
  5501. as a template and to be employed in analysis / debugging tools, or as
  5502. the source for filters which ignore the input data (for example the sox
  5503. synth filter).
  5504. This source accepts the following options:
  5505. @table @option
  5506. @item channel_layout, cl
  5507. Specifies the channel layout, and can be either an integer or a string
  5508. representing a channel layout. The default value of @var{channel_layout}
  5509. is "stereo".
  5510. Check the channel_layout_map definition in
  5511. @file{libavutil/channel_layout.c} for the mapping between strings and
  5512. channel layout values.
  5513. @item sample_rate, r
  5514. Specifies the sample rate, and defaults to 44100.
  5515. @item nb_samples, n
  5516. Set the number of samples per requested frames.
  5517. @item duration, d
  5518. Set the duration of the sourced audio. See
  5519. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5520. for the accepted syntax.
  5521. If not specified, or the expressed duration is negative, the audio is
  5522. supposed to be generated forever.
  5523. @end table
  5524. @subsection Examples
  5525. @itemize
  5526. @item
  5527. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  5528. @example
  5529. anullsrc=r=48000:cl=4
  5530. @end example
  5531. @item
  5532. Do the same operation with a more obvious syntax:
  5533. @example
  5534. anullsrc=r=48000:cl=mono
  5535. @end example
  5536. @end itemize
  5537. All the parameters need to be explicitly defined.
  5538. @section flite
  5539. Synthesize a voice utterance using the libflite library.
  5540. To enable compilation of this filter you need to configure FFmpeg with
  5541. @code{--enable-libflite}.
  5542. Note that versions of the flite library prior to 2.0 are not thread-safe.
  5543. The filter accepts the following options:
  5544. @table @option
  5545. @item list_voices
  5546. If set to 1, list the names of the available voices and exit
  5547. immediately. Default value is 0.
  5548. @item nb_samples, n
  5549. Set the maximum number of samples per frame. Default value is 512.
  5550. @item textfile
  5551. Set the filename containing the text to speak.
  5552. @item text
  5553. Set the text to speak.
  5554. @item voice, v
  5555. Set the voice to use for the speech synthesis. Default value is
  5556. @code{kal}. See also the @var{list_voices} option.
  5557. @end table
  5558. @subsection Examples
  5559. @itemize
  5560. @item
  5561. Read from file @file{speech.txt}, and synthesize the text using the
  5562. standard flite voice:
  5563. @example
  5564. flite=textfile=speech.txt
  5565. @end example
  5566. @item
  5567. Read the specified text selecting the @code{slt} voice:
  5568. @example
  5569. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  5570. @end example
  5571. @item
  5572. Input text to ffmpeg:
  5573. @example
  5574. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  5575. @end example
  5576. @item
  5577. Make @file{ffplay} speak the specified text, using @code{flite} and
  5578. the @code{lavfi} device:
  5579. @example
  5580. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  5581. @end example
  5582. @end itemize
  5583. For more information about libflite, check:
  5584. @url{http://www.festvox.org/flite/}
  5585. @section anoisesrc
  5586. Generate a noise audio signal.
  5587. The filter accepts the following options:
  5588. @table @option
  5589. @item sample_rate, r
  5590. Specify the sample rate. Default value is 48000 Hz.
  5591. @item amplitude, a
  5592. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  5593. is 1.0.
  5594. @item duration, d
  5595. Specify the duration of the generated audio stream. Not specifying this option
  5596. results in noise with an infinite length.
  5597. @item color, colour, c
  5598. Specify the color of noise. Available noise colors are white, pink, brown,
  5599. blue, violet and velvet. Default color is white.
  5600. @item seed, s
  5601. Specify a value used to seed the PRNG.
  5602. @item nb_samples, n
  5603. Set the number of samples per each output frame, default is 1024.
  5604. @end table
  5605. @subsection Examples
  5606. @itemize
  5607. @item
  5608. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  5609. @example
  5610. anoisesrc=d=60:c=pink:r=44100:a=0.5
  5611. @end example
  5612. @end itemize
  5613. @section hilbert
  5614. Generate odd-tap Hilbert transform FIR coefficients.
  5615. The resulting stream can be used with @ref{afir} filter for phase-shifting
  5616. the signal by 90 degrees.
  5617. This is used in many matrix coding schemes and for analytic signal generation.
  5618. The process is often written as a multiplication by i (or j), the imaginary unit.
  5619. The filter accepts the following options:
  5620. @table @option
  5621. @item sample_rate, s
  5622. Set sample rate, default is 44100.
  5623. @item taps, t
  5624. Set length of FIR filter, default is 22051.
  5625. @item nb_samples, n
  5626. Set number of samples per each frame.
  5627. @item win_func, w
  5628. Set window function to be used when generating FIR coefficients.
  5629. @end table
  5630. @section sinc
  5631. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  5632. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  5633. The filter accepts the following options:
  5634. @table @option
  5635. @item sample_rate, r
  5636. Set sample rate, default is 44100.
  5637. @item nb_samples, n
  5638. Set number of samples per each frame. Default is 1024.
  5639. @item hp
  5640. Set high-pass frequency. Default is 0.
  5641. @item lp
  5642. Set low-pass frequency. Default is 0.
  5643. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  5644. is higher than 0 then filter will create band-pass filter coefficients,
  5645. otherwise band-reject filter coefficients.
  5646. @item phase
  5647. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  5648. @item beta
  5649. Set Kaiser window beta.
  5650. @item att
  5651. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  5652. @item round
  5653. Enable rounding, by default is disabled.
  5654. @item hptaps
  5655. Set number of taps for high-pass filter.
  5656. @item lptaps
  5657. Set number of taps for low-pass filter.
  5658. @end table
  5659. @section sine
  5660. Generate an audio signal made of a sine wave with amplitude 1/8.
  5661. The audio signal is bit-exact.
  5662. The filter accepts the following options:
  5663. @table @option
  5664. @item frequency, f
  5665. Set the carrier frequency. Default is 440 Hz.
  5666. @item beep_factor, b
  5667. Enable a periodic beep every second with frequency @var{beep_factor} times
  5668. the carrier frequency. Default is 0, meaning the beep is disabled.
  5669. @item sample_rate, r
  5670. Specify the sample rate, default is 44100.
  5671. @item duration, d
  5672. Specify the duration of the generated audio stream.
  5673. @item samples_per_frame
  5674. Set the number of samples per output frame.
  5675. The expression can contain the following constants:
  5676. @table @option
  5677. @item n
  5678. The (sequential) number of the output audio frame, starting from 0.
  5679. @item pts
  5680. The PTS (Presentation TimeStamp) of the output audio frame,
  5681. expressed in @var{TB} units.
  5682. @item t
  5683. The PTS of the output audio frame, expressed in seconds.
  5684. @item TB
  5685. The timebase of the output audio frames.
  5686. @end table
  5687. Default is @code{1024}.
  5688. @end table
  5689. @subsection Examples
  5690. @itemize
  5691. @item
  5692. Generate a simple 440 Hz sine wave:
  5693. @example
  5694. sine
  5695. @end example
  5696. @item
  5697. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  5698. @example
  5699. sine=220:4:d=5
  5700. sine=f=220:b=4:d=5
  5701. sine=frequency=220:beep_factor=4:duration=5
  5702. @end example
  5703. @item
  5704. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  5705. pattern:
  5706. @example
  5707. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  5708. @end example
  5709. @end itemize
  5710. @c man end AUDIO SOURCES
  5711. @chapter Audio Sinks
  5712. @c man begin AUDIO SINKS
  5713. Below is a description of the currently available audio sinks.
  5714. @section abuffersink
  5715. Buffer audio frames, and make them available to the end of filter chain.
  5716. This sink is mainly intended for programmatic use, in particular
  5717. through the interface defined in @file{libavfilter/buffersink.h}
  5718. or the options system.
  5719. It accepts a pointer to an AVABufferSinkContext structure, which
  5720. defines the incoming buffers' formats, to be passed as the opaque
  5721. parameter to @code{avfilter_init_filter} for initialization.
  5722. @section anullsink
  5723. Null audio sink; do absolutely nothing with the input audio. It is
  5724. mainly useful as a template and for use in analysis / debugging
  5725. tools.
  5726. @c man end AUDIO SINKS
  5727. @chapter Video Filters
  5728. @c man begin VIDEO FILTERS
  5729. When you configure your FFmpeg build, you can disable any of the
  5730. existing filters using @code{--disable-filters}.
  5731. The configure output will show the video filters included in your
  5732. build.
  5733. Below is a description of the currently available video filters.
  5734. @section addroi
  5735. Mark a region of interest in a video frame.
  5736. The frame data is passed through unchanged, but metadata is attached
  5737. to the frame indicating regions of interest which can affect the
  5738. behaviour of later encoding. Multiple regions can be marked by
  5739. applying the filter multiple times.
  5740. @table @option
  5741. @item x
  5742. Region distance in pixels from the left edge of the frame.
  5743. @item y
  5744. Region distance in pixels from the top edge of the frame.
  5745. @item w
  5746. Region width in pixels.
  5747. @item h
  5748. Region height in pixels.
  5749. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  5750. and may contain the following variables:
  5751. @table @option
  5752. @item iw
  5753. Width of the input frame.
  5754. @item ih
  5755. Height of the input frame.
  5756. @end table
  5757. @item qoffset
  5758. Quantisation offset to apply within the region.
  5759. This must be a real value in the range -1 to +1. A value of zero
  5760. indicates no quality change. A negative value asks for better quality
  5761. (less quantisation), while a positive value asks for worse quality
  5762. (greater quantisation).
  5763. The range is calibrated so that the extreme values indicate the
  5764. largest possible offset - if the rest of the frame is encoded with the
  5765. worst possible quality, an offset of -1 indicates that this region
  5766. should be encoded with the best possible quality anyway. Intermediate
  5767. values are then interpolated in some codec-dependent way.
  5768. For example, in 10-bit H.264 the quantisation parameter varies between
  5769. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  5770. this region should be encoded with a QP around one-tenth of the full
  5771. range better than the rest of the frame. So, if most of the frame
  5772. were to be encoded with a QP of around 30, this region would get a QP
  5773. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  5774. An extreme value of -1 would indicate that this region should be
  5775. encoded with the best possible quality regardless of the treatment of
  5776. the rest of the frame - that is, should be encoded at a QP of -12.
  5777. @item clear
  5778. If set to true, remove any existing regions of interest marked on the
  5779. frame before adding the new one.
  5780. @end table
  5781. @subsection Examples
  5782. @itemize
  5783. @item
  5784. Mark the centre quarter of the frame as interesting.
  5785. @example
  5786. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  5787. @end example
  5788. @item
  5789. Mark the 100-pixel-wide region on the left edge of the frame as very
  5790. uninteresting (to be encoded at much lower quality than the rest of
  5791. the frame).
  5792. @example
  5793. addroi=0:0:100:ih:+1/5
  5794. @end example
  5795. @end itemize
  5796. @section alphaextract
  5797. Extract the alpha component from the input as a grayscale video. This
  5798. is especially useful with the @var{alphamerge} filter.
  5799. @section alphamerge
  5800. Add or replace the alpha component of the primary input with the
  5801. grayscale value of a second input. This is intended for use with
  5802. @var{alphaextract} to allow the transmission or storage of frame
  5803. sequences that have alpha in a format that doesn't support an alpha
  5804. channel.
  5805. For example, to reconstruct full frames from a normal YUV-encoded video
  5806. and a separate video created with @var{alphaextract}, you might use:
  5807. @example
  5808. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  5809. @end example
  5810. @section amplify
  5811. Amplify differences between current pixel and pixels of adjacent frames in
  5812. same pixel location.
  5813. This filter accepts the following options:
  5814. @table @option
  5815. @item radius
  5816. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  5817. For example radius of 3 will instruct filter to calculate average of 7 frames.
  5818. @item factor
  5819. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  5820. @item threshold
  5821. Set threshold for difference amplification. Any difference greater or equal to
  5822. this value will not alter source pixel. Default is 10.
  5823. Allowed range is from 0 to 65535.
  5824. @item tolerance
  5825. Set tolerance for difference amplification. Any difference lower to
  5826. this value will not alter source pixel. Default is 0.
  5827. Allowed range is from 0 to 65535.
  5828. @item low
  5829. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5830. This option controls maximum possible value that will decrease source pixel value.
  5831. @item high
  5832. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5833. This option controls maximum possible value that will increase source pixel value.
  5834. @item planes
  5835. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  5836. @end table
  5837. @subsection Commands
  5838. This filter supports the following @ref{commands} that corresponds to option of same name:
  5839. @table @option
  5840. @item factor
  5841. @item threshold
  5842. @item tolerance
  5843. @item low
  5844. @item high
  5845. @item planes
  5846. @end table
  5847. @section ass
  5848. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  5849. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  5850. Substation Alpha) subtitles files.
  5851. This filter accepts the following option in addition to the common options from
  5852. the @ref{subtitles} filter:
  5853. @table @option
  5854. @item shaping
  5855. Set the shaping engine
  5856. Available values are:
  5857. @table @samp
  5858. @item auto
  5859. The default libass shaping engine, which is the best available.
  5860. @item simple
  5861. Fast, font-agnostic shaper that can do only substitutions
  5862. @item complex
  5863. Slower shaper using OpenType for substitutions and positioning
  5864. @end table
  5865. The default is @code{auto}.
  5866. @end table
  5867. @section atadenoise
  5868. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  5869. The filter accepts the following options:
  5870. @table @option
  5871. @item 0a
  5872. Set threshold A for 1st plane. Default is 0.02.
  5873. Valid range is 0 to 0.3.
  5874. @item 0b
  5875. Set threshold B for 1st plane. Default is 0.04.
  5876. Valid range is 0 to 5.
  5877. @item 1a
  5878. Set threshold A for 2nd plane. Default is 0.02.
  5879. Valid range is 0 to 0.3.
  5880. @item 1b
  5881. Set threshold B for 2nd plane. Default is 0.04.
  5882. Valid range is 0 to 5.
  5883. @item 2a
  5884. Set threshold A for 3rd plane. Default is 0.02.
  5885. Valid range is 0 to 0.3.
  5886. @item 2b
  5887. Set threshold B for 3rd plane. Default is 0.04.
  5888. Valid range is 0 to 5.
  5889. Threshold A is designed to react on abrupt changes in the input signal and
  5890. threshold B is designed to react on continuous changes in the input signal.
  5891. @item s
  5892. Set number of frames filter will use for averaging. Default is 9. Must be odd
  5893. number in range [5, 129].
  5894. @item p
  5895. Set what planes of frame filter will use for averaging. Default is all.
  5896. @item a
  5897. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  5898. Alternatively can be set to @code{s} serial.
  5899. Parallel can be faster then serial, while other way around is never true.
  5900. Parallel will abort early on first change being greater then thresholds, while serial
  5901. will continue processing other side of frames if they are equal or below thresholds.
  5902. @item 0s
  5903. @item 1s
  5904. @item 2s
  5905. Set sigma for 1st plane, 2nd plane or 3rd plane. Default is 32767.
  5906. Valid range is from 0 to 32767.
  5907. This options controls weight for each pixel in radius defined by size.
  5908. Default value means every pixel have same weight.
  5909. Setting this option to 0 effectively disables filtering.
  5910. @end table
  5911. @subsection Commands
  5912. This filter supports same @ref{commands} as options except option @code{s}.
  5913. The command accepts the same syntax of the corresponding option.
  5914. @section avgblur
  5915. Apply average blur filter.
  5916. The filter accepts the following options:
  5917. @table @option
  5918. @item sizeX
  5919. Set horizontal radius size.
  5920. @item planes
  5921. Set which planes to filter. By default all planes are filtered.
  5922. @item sizeY
  5923. Set vertical radius size, if zero it will be same as @code{sizeX}.
  5924. Default is @code{0}.
  5925. @end table
  5926. @subsection Commands
  5927. This filter supports same commands as options.
  5928. The command accepts the same syntax of the corresponding option.
  5929. If the specified expression is not valid, it is kept at its current
  5930. value.
  5931. @section bbox
  5932. Compute the bounding box for the non-black pixels in the input frame
  5933. luminance plane.
  5934. This filter computes the bounding box containing all the pixels with a
  5935. luminance value greater than the minimum allowed value.
  5936. The parameters describing the bounding box are printed on the filter
  5937. log.
  5938. The filter accepts the following option:
  5939. @table @option
  5940. @item min_val
  5941. Set the minimal luminance value. Default is @code{16}.
  5942. @end table
  5943. @subsection Commands
  5944. This filter supports the all above options as @ref{commands}.
  5945. @section bilateral
  5946. Apply bilateral filter, spatial smoothing while preserving edges.
  5947. The filter accepts the following options:
  5948. @table @option
  5949. @item sigmaS
  5950. Set sigma of gaussian function to calculate spatial weight.
  5951. Allowed range is 0 to 512. Default is 0.1.
  5952. @item sigmaR
  5953. Set sigma of gaussian function to calculate range weight.
  5954. Allowed range is 0 to 1. Default is 0.1.
  5955. @item planes
  5956. Set planes to filter. Default is first only.
  5957. @end table
  5958. @subsection Commands
  5959. This filter supports the all above options as @ref{commands}.
  5960. @section bitplanenoise
  5961. Show and measure bit plane noise.
  5962. The filter accepts the following options:
  5963. @table @option
  5964. @item bitplane
  5965. Set which plane to analyze. Default is @code{1}.
  5966. @item filter
  5967. Filter out noisy pixels from @code{bitplane} set above.
  5968. Default is disabled.
  5969. @end table
  5970. @section blackdetect
  5971. Detect video intervals that are (almost) completely black. Can be
  5972. useful to detect chapter transitions, commercials, or invalid
  5973. recordings.
  5974. The filter outputs its detection analysis to both the log as well as
  5975. frame metadata. If a black segment of at least the specified minimum
  5976. duration is found, a line with the start and end timestamps as well
  5977. as duration is printed to the log with level @code{info}. In addition,
  5978. a log line with level @code{debug} is printed per frame showing the
  5979. black amount detected for that frame.
  5980. The filter also attaches metadata to the first frame of a black
  5981. segment with key @code{lavfi.black_start} and to the first frame
  5982. after the black segment ends with key @code{lavfi.black_end}. The
  5983. value is the frame's timestamp. This metadata is added regardless
  5984. of the minimum duration specified.
  5985. The filter accepts the following options:
  5986. @table @option
  5987. @item black_min_duration, d
  5988. Set the minimum detected black duration expressed in seconds. It must
  5989. be a non-negative floating point number.
  5990. Default value is 2.0.
  5991. @item picture_black_ratio_th, pic_th
  5992. Set the threshold for considering a picture "black".
  5993. Express the minimum value for the ratio:
  5994. @example
  5995. @var{nb_black_pixels} / @var{nb_pixels}
  5996. @end example
  5997. for which a picture is considered black.
  5998. Default value is 0.98.
  5999. @item pixel_black_th, pix_th
  6000. Set the threshold for considering a pixel "black".
  6001. The threshold expresses the maximum pixel luminance value for which a
  6002. pixel is considered "black". The provided value is scaled according to
  6003. the following equation:
  6004. @example
  6005. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  6006. @end example
  6007. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  6008. the input video format, the range is [0-255] for YUV full-range
  6009. formats and [16-235] for YUV non full-range formats.
  6010. Default value is 0.10.
  6011. @end table
  6012. The following example sets the maximum pixel threshold to the minimum
  6013. value, and detects only black intervals of 2 or more seconds:
  6014. @example
  6015. blackdetect=d=2:pix_th=0.00
  6016. @end example
  6017. @section blackframe
  6018. Detect frames that are (almost) completely black. Can be useful to
  6019. detect chapter transitions or commercials. Output lines consist of
  6020. the frame number of the detected frame, the percentage of blackness,
  6021. the position in the file if known or -1 and the timestamp in seconds.
  6022. In order to display the output lines, you need to set the loglevel at
  6023. least to the AV_LOG_INFO value.
  6024. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  6025. The value represents the percentage of pixels in the picture that
  6026. are below the threshold value.
  6027. It accepts the following parameters:
  6028. @table @option
  6029. @item amount
  6030. The percentage of the pixels that have to be below the threshold; it defaults to
  6031. @code{98}.
  6032. @item threshold, thresh
  6033. The threshold below which a pixel value is considered black; it defaults to
  6034. @code{32}.
  6035. @end table
  6036. @anchor{blend}
  6037. @section blend
  6038. Blend two video frames into each other.
  6039. The @code{blend} filter takes two input streams and outputs one
  6040. stream, the first input is the "top" layer and second input is
  6041. "bottom" layer. By default, the output terminates when the longest input terminates.
  6042. The @code{tblend} (time blend) filter takes two consecutive frames
  6043. from one single stream, and outputs the result obtained by blending
  6044. the new frame on top of the old frame.
  6045. A description of the accepted options follows.
  6046. @table @option
  6047. @item c0_mode
  6048. @item c1_mode
  6049. @item c2_mode
  6050. @item c3_mode
  6051. @item all_mode
  6052. Set blend mode for specific pixel component or all pixel components in case
  6053. of @var{all_mode}. Default value is @code{normal}.
  6054. Available values for component modes are:
  6055. @table @samp
  6056. @item addition
  6057. @item and
  6058. @item average
  6059. @item bleach
  6060. @item burn
  6061. @item darken
  6062. @item difference
  6063. @item divide
  6064. @item dodge
  6065. @item exclusion
  6066. @item extremity
  6067. @item freeze
  6068. @item geometric
  6069. @item glow
  6070. @item grainextract
  6071. @item grainmerge
  6072. @item hardlight
  6073. @item hardmix
  6074. @item hardoverlay
  6075. @item harmonic
  6076. @item heat
  6077. @item interpolate
  6078. @item lighten
  6079. @item linearlight
  6080. @item multiply
  6081. @item multiply128
  6082. @item negation
  6083. @item normal
  6084. @item or
  6085. @item overlay
  6086. @item phoenix
  6087. @item pinlight
  6088. @item reflect
  6089. @item screen
  6090. @item softdifference
  6091. @item softlight
  6092. @item stain
  6093. @item subtract
  6094. @item vividlight
  6095. @item xor
  6096. @end table
  6097. @item c0_opacity
  6098. @item c1_opacity
  6099. @item c2_opacity
  6100. @item c3_opacity
  6101. @item all_opacity
  6102. Set blend opacity for specific pixel component or all pixel components in case
  6103. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  6104. @item c0_expr
  6105. @item c1_expr
  6106. @item c2_expr
  6107. @item c3_expr
  6108. @item all_expr
  6109. Set blend expression for specific pixel component or all pixel components in case
  6110. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  6111. The expressions can use the following variables:
  6112. @table @option
  6113. @item N
  6114. The sequential number of the filtered frame, starting from @code{0}.
  6115. @item X
  6116. @item Y
  6117. the coordinates of the current sample
  6118. @item W
  6119. @item H
  6120. the width and height of currently filtered plane
  6121. @item SW
  6122. @item SH
  6123. Width and height scale for the plane being filtered. It is the
  6124. ratio between the dimensions of the current plane to the luma plane,
  6125. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  6126. the luma plane and @code{0.5,0.5} for the chroma planes.
  6127. @item T
  6128. Time of the current frame, expressed in seconds.
  6129. @item TOP, A
  6130. Value of pixel component at current location for first video frame (top layer).
  6131. @item BOTTOM, B
  6132. Value of pixel component at current location for second video frame (bottom layer).
  6133. @end table
  6134. @end table
  6135. The @code{blend} filter also supports the @ref{framesync} options.
  6136. @subsection Examples
  6137. @itemize
  6138. @item
  6139. Apply transition from bottom layer to top layer in first 10 seconds:
  6140. @example
  6141. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  6142. @end example
  6143. @item
  6144. Apply linear horizontal transition from top layer to bottom layer:
  6145. @example
  6146. blend=all_expr='A*(X/W)+B*(1-X/W)'
  6147. @end example
  6148. @item
  6149. Apply 1x1 checkerboard effect:
  6150. @example
  6151. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  6152. @end example
  6153. @item
  6154. Apply uncover left effect:
  6155. @example
  6156. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  6157. @end example
  6158. @item
  6159. Apply uncover down effect:
  6160. @example
  6161. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  6162. @end example
  6163. @item
  6164. Apply uncover up-left effect:
  6165. @example
  6166. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  6167. @end example
  6168. @item
  6169. Split diagonally video and shows top and bottom layer on each side:
  6170. @example
  6171. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  6172. @end example
  6173. @item
  6174. Display differences between the current and the previous frame:
  6175. @example
  6176. tblend=all_mode=grainextract
  6177. @end example
  6178. @end itemize
  6179. @subsection Commands
  6180. This filter supports same @ref{commands} as options.
  6181. @section bm3d
  6182. Denoise frames using Block-Matching 3D algorithm.
  6183. The filter accepts the following options.
  6184. @table @option
  6185. @item sigma
  6186. Set denoising strength. Default value is 1.
  6187. Allowed range is from 0 to 999.9.
  6188. The denoising algorithm is very sensitive to sigma, so adjust it
  6189. according to the source.
  6190. @item block
  6191. Set local patch size. This sets dimensions in 2D.
  6192. @item bstep
  6193. Set sliding step for processing blocks. Default value is 4.
  6194. Allowed range is from 1 to 64.
  6195. Smaller values allows processing more reference blocks and is slower.
  6196. @item group
  6197. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  6198. When set to 1, no block matching is done. Larger values allows more blocks
  6199. in single group.
  6200. Allowed range is from 1 to 256.
  6201. @item range
  6202. Set radius for search block matching. Default is 9.
  6203. Allowed range is from 1 to INT32_MAX.
  6204. @item mstep
  6205. Set step between two search locations for block matching. Default is 1.
  6206. Allowed range is from 1 to 64. Smaller is slower.
  6207. @item thmse
  6208. Set threshold of mean square error for block matching. Valid range is 0 to
  6209. INT32_MAX.
  6210. @item hdthr
  6211. Set thresholding parameter for hard thresholding in 3D transformed domain.
  6212. Larger values results in stronger hard-thresholding filtering in frequency
  6213. domain.
  6214. @item estim
  6215. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  6216. Default is @code{basic}.
  6217. @item ref
  6218. If enabled, filter will use 2nd stream for block matching.
  6219. Default is disabled for @code{basic} value of @var{estim} option,
  6220. and always enabled if value of @var{estim} is @code{final}.
  6221. @item planes
  6222. Set planes to filter. Default is all available except alpha.
  6223. @end table
  6224. @subsection Examples
  6225. @itemize
  6226. @item
  6227. Basic filtering with bm3d:
  6228. @example
  6229. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  6230. @end example
  6231. @item
  6232. Same as above, but filtering only luma:
  6233. @example
  6234. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  6235. @end example
  6236. @item
  6237. Same as above, but with both estimation modes:
  6238. @example
  6239. 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
  6240. @end example
  6241. @item
  6242. Same as above, but prefilter with @ref{nlmeans} filter instead:
  6243. @example
  6244. 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
  6245. @end example
  6246. @end itemize
  6247. @section boxblur
  6248. Apply a boxblur algorithm to the input video.
  6249. It accepts the following parameters:
  6250. @table @option
  6251. @item luma_radius, lr
  6252. @item luma_power, lp
  6253. @item chroma_radius, cr
  6254. @item chroma_power, cp
  6255. @item alpha_radius, ar
  6256. @item alpha_power, ap
  6257. @end table
  6258. A description of the accepted options follows.
  6259. @table @option
  6260. @item luma_radius, lr
  6261. @item chroma_radius, cr
  6262. @item alpha_radius, ar
  6263. Set an expression for the box radius in pixels used for blurring the
  6264. corresponding input plane.
  6265. The radius value must be a non-negative number, and must not be
  6266. greater than the value of the expression @code{min(w,h)/2} for the
  6267. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  6268. planes.
  6269. Default value for @option{luma_radius} is "2". If not specified,
  6270. @option{chroma_radius} and @option{alpha_radius} default to the
  6271. corresponding value set for @option{luma_radius}.
  6272. The expressions can contain the following constants:
  6273. @table @option
  6274. @item w
  6275. @item h
  6276. The input width and height in pixels.
  6277. @item cw
  6278. @item ch
  6279. The input chroma image width and height in pixels.
  6280. @item hsub
  6281. @item vsub
  6282. The horizontal and vertical chroma subsample values. For example, for the
  6283. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  6284. @end table
  6285. @item luma_power, lp
  6286. @item chroma_power, cp
  6287. @item alpha_power, ap
  6288. Specify how many times the boxblur filter is applied to the
  6289. corresponding plane.
  6290. Default value for @option{luma_power} is 2. If not specified,
  6291. @option{chroma_power} and @option{alpha_power} default to the
  6292. corresponding value set for @option{luma_power}.
  6293. A value of 0 will disable the effect.
  6294. @end table
  6295. @subsection Examples
  6296. @itemize
  6297. @item
  6298. Apply a boxblur filter with the luma, chroma, and alpha radii
  6299. set to 2:
  6300. @example
  6301. boxblur=luma_radius=2:luma_power=1
  6302. boxblur=2:1
  6303. @end example
  6304. @item
  6305. Set the luma radius to 2, and alpha and chroma radius to 0:
  6306. @example
  6307. boxblur=2:1:cr=0:ar=0
  6308. @end example
  6309. @item
  6310. Set the luma and chroma radii to a fraction of the video dimension:
  6311. @example
  6312. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  6313. @end example
  6314. @end itemize
  6315. @section bwdif
  6316. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  6317. Deinterlacing Filter").
  6318. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  6319. interpolation algorithms.
  6320. It accepts the following parameters:
  6321. @table @option
  6322. @item mode
  6323. The interlacing mode to adopt. It accepts one of the following values:
  6324. @table @option
  6325. @item 0, send_frame
  6326. Output one frame for each frame.
  6327. @item 1, send_field
  6328. Output one frame for each field.
  6329. @end table
  6330. The default value is @code{send_field}.
  6331. @item parity
  6332. The picture field parity assumed for the input interlaced video. It accepts one
  6333. of the following values:
  6334. @table @option
  6335. @item 0, tff
  6336. Assume the top field is first.
  6337. @item 1, bff
  6338. Assume the bottom field is first.
  6339. @item -1, auto
  6340. Enable automatic detection of field parity.
  6341. @end table
  6342. The default value is @code{auto}.
  6343. If the interlacing is unknown or the decoder does not export this information,
  6344. top field first will be assumed.
  6345. @item deint
  6346. Specify which frames to deinterlace. Accepts one of the following
  6347. values:
  6348. @table @option
  6349. @item 0, all
  6350. Deinterlace all frames.
  6351. @item 1, interlaced
  6352. Only deinterlace frames marked as interlaced.
  6353. @end table
  6354. The default value is @code{all}.
  6355. @end table
  6356. @section cas
  6357. Apply Contrast Adaptive Sharpen filter to video stream.
  6358. The filter accepts the following options:
  6359. @table @option
  6360. @item strength
  6361. Set the sharpening strength. Default value is 0.
  6362. @item planes
  6363. Set planes to filter. Default value is to filter all
  6364. planes except alpha plane.
  6365. @end table
  6366. @subsection Commands
  6367. This filter supports same @ref{commands} as options.
  6368. @section chromahold
  6369. Remove all color information for all colors except for certain one.
  6370. The filter accepts the following options:
  6371. @table @option
  6372. @item color
  6373. The color which will not be replaced with neutral chroma.
  6374. @item similarity
  6375. Similarity percentage with the above color.
  6376. 0.01 matches only the exact key color, while 1.0 matches everything.
  6377. @item blend
  6378. Blend percentage.
  6379. 0.0 makes pixels either fully gray, or not gray at all.
  6380. Higher values result in more preserved color.
  6381. @item yuv
  6382. Signals that the color passed is already in YUV instead of RGB.
  6383. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  6384. This can be used to pass exact YUV values as hexadecimal numbers.
  6385. @end table
  6386. @subsection Commands
  6387. This filter supports same @ref{commands} as options.
  6388. The command accepts the same syntax of the corresponding option.
  6389. If the specified expression is not valid, it is kept at its current
  6390. value.
  6391. @section chromakey
  6392. YUV colorspace color/chroma keying.
  6393. The filter accepts the following options:
  6394. @table @option
  6395. @item color
  6396. The color which will be replaced with transparency.
  6397. @item similarity
  6398. Similarity percentage with the key color.
  6399. 0.01 matches only the exact key color, while 1.0 matches everything.
  6400. @item blend
  6401. Blend percentage.
  6402. 0.0 makes pixels either fully transparent, or not transparent at all.
  6403. Higher values result in semi-transparent pixels, with a higher transparency
  6404. the more similar the pixels color is to the key color.
  6405. @item yuv
  6406. Signals that the color passed is already in YUV instead of RGB.
  6407. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  6408. This can be used to pass exact YUV values as hexadecimal numbers.
  6409. @end table
  6410. @subsection Commands
  6411. This filter supports same @ref{commands} as options.
  6412. The command accepts the same syntax of the corresponding option.
  6413. If the specified expression is not valid, it is kept at its current
  6414. value.
  6415. @subsection Examples
  6416. @itemize
  6417. @item
  6418. Make every green pixel in the input image transparent:
  6419. @example
  6420. ffmpeg -i input.png -vf chromakey=green out.png
  6421. @end example
  6422. @item
  6423. Overlay a greenscreen-video on top of a static black background.
  6424. @example
  6425. 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
  6426. @end example
  6427. @end itemize
  6428. @section chromanr
  6429. Reduce chrominance noise.
  6430. The filter accepts the following options:
  6431. @table @option
  6432. @item thres
  6433. Set threshold for averaging chrominance values.
  6434. Sum of absolute difference of Y, U and V pixel components of current
  6435. pixel and neighbour pixels lower than this threshold will be used in
  6436. averaging. Luma component is left unchanged and is copied to output.
  6437. Default value is 30. Allowed range is from 1 to 200.
  6438. @item sizew
  6439. Set horizontal radius of rectangle used for averaging.
  6440. Allowed range is from 1 to 100. Default value is 5.
  6441. @item sizeh
  6442. Set vertical radius of rectangle used for averaging.
  6443. Allowed range is from 1 to 100. Default value is 5.
  6444. @item stepw
  6445. Set horizontal step when averaging. Default value is 1.
  6446. Allowed range is from 1 to 50.
  6447. Mostly useful to speed-up filtering.
  6448. @item steph
  6449. Set vertical step when averaging. Default value is 1.
  6450. Allowed range is from 1 to 50.
  6451. Mostly useful to speed-up filtering.
  6452. @item threy
  6453. Set Y threshold for averaging chrominance values.
  6454. Set finer control for max allowed difference between Y components
  6455. of current pixel and neigbour pixels.
  6456. Default value is 200. Allowed range is from 1 to 200.
  6457. @item threu
  6458. Set U threshold for averaging chrominance values.
  6459. Set finer control for max allowed difference between U components
  6460. of current pixel and neigbour pixels.
  6461. Default value is 200. Allowed range is from 1 to 200.
  6462. @item threv
  6463. Set V threshold for averaging chrominance values.
  6464. Set finer control for max allowed difference between V components
  6465. of current pixel and neigbour pixels.
  6466. Default value is 200. Allowed range is from 1 to 200.
  6467. @item distance
  6468. Set distance type used in calculations.
  6469. @table @samp
  6470. @item manhattan
  6471. Absolute difference.
  6472. @item euclidean
  6473. Difference squared.
  6474. @end table
  6475. Default distance type is manhattan.
  6476. @end table
  6477. @subsection Commands
  6478. This filter supports same @ref{commands} as options.
  6479. The command accepts the same syntax of the corresponding option.
  6480. @section chromashift
  6481. Shift chroma pixels horizontally and/or vertically.
  6482. The filter accepts the following options:
  6483. @table @option
  6484. @item cbh
  6485. Set amount to shift chroma-blue horizontally.
  6486. @item cbv
  6487. Set amount to shift chroma-blue vertically.
  6488. @item crh
  6489. Set amount to shift chroma-red horizontally.
  6490. @item crv
  6491. Set amount to shift chroma-red vertically.
  6492. @item edge
  6493. Set edge mode, can be @var{smear}, default, or @var{warp}.
  6494. @end table
  6495. @subsection Commands
  6496. This filter supports the all above options as @ref{commands}.
  6497. @section ciescope
  6498. Display CIE color diagram with pixels overlaid onto it.
  6499. The filter accepts the following options:
  6500. @table @option
  6501. @item system
  6502. Set color system.
  6503. @table @samp
  6504. @item ntsc, 470m
  6505. @item ebu, 470bg
  6506. @item smpte
  6507. @item 240m
  6508. @item apple
  6509. @item widergb
  6510. @item cie1931
  6511. @item rec709, hdtv
  6512. @item uhdtv, rec2020
  6513. @item dcip3
  6514. @end table
  6515. @item cie
  6516. Set CIE system.
  6517. @table @samp
  6518. @item xyy
  6519. @item ucs
  6520. @item luv
  6521. @end table
  6522. @item gamuts
  6523. Set what gamuts to draw.
  6524. See @code{system} option for available values.
  6525. @item size, s
  6526. Set ciescope size, by default set to 512.
  6527. @item intensity, i
  6528. Set intensity used to map input pixel values to CIE diagram.
  6529. @item contrast
  6530. Set contrast used to draw tongue colors that are out of active color system gamut.
  6531. @item corrgamma
  6532. Correct gamma displayed on scope, by default enabled.
  6533. @item showwhite
  6534. Show white point on CIE diagram, by default disabled.
  6535. @item gamma
  6536. Set input gamma. Used only with XYZ input color space.
  6537. @item fill
  6538. Fill with CIE colors. By default is enabled.
  6539. @end table
  6540. @section codecview
  6541. Visualize information exported by some codecs.
  6542. Some codecs can export information through frames using side-data or other
  6543. means. For example, some MPEG based codecs export motion vectors through the
  6544. @var{export_mvs} flag in the codec @option{flags2} option.
  6545. The filter accepts the following option:
  6546. @table @option
  6547. @item block
  6548. Display block partition structure using the luma plane.
  6549. @item mv
  6550. Set motion vectors to visualize.
  6551. Available flags for @var{mv} are:
  6552. @table @samp
  6553. @item pf
  6554. forward predicted MVs of P-frames
  6555. @item bf
  6556. forward predicted MVs of B-frames
  6557. @item bb
  6558. backward predicted MVs of B-frames
  6559. @end table
  6560. @item qp
  6561. Display quantization parameters using the chroma planes.
  6562. @item mv_type, mvt
  6563. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  6564. Available flags for @var{mv_type} are:
  6565. @table @samp
  6566. @item fp
  6567. forward predicted MVs
  6568. @item bp
  6569. backward predicted MVs
  6570. @end table
  6571. @item frame_type, ft
  6572. Set frame type to visualize motion vectors of.
  6573. Available flags for @var{frame_type} are:
  6574. @table @samp
  6575. @item if
  6576. intra-coded frames (I-frames)
  6577. @item pf
  6578. predicted frames (P-frames)
  6579. @item bf
  6580. bi-directionally predicted frames (B-frames)
  6581. @end table
  6582. @end table
  6583. @subsection Examples
  6584. @itemize
  6585. @item
  6586. Visualize forward predicted MVs of all frames using @command{ffplay}:
  6587. @example
  6588. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  6589. @end example
  6590. @item
  6591. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  6592. @example
  6593. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  6594. @end example
  6595. @end itemize
  6596. @section colorbalance
  6597. Modify intensity of primary colors (red, green and blue) of input frames.
  6598. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  6599. regions for the red-cyan, green-magenta or blue-yellow balance.
  6600. A positive adjustment value shifts the balance towards the primary color, a negative
  6601. value towards the complementary color.
  6602. The filter accepts the following options:
  6603. @table @option
  6604. @item rs
  6605. @item gs
  6606. @item bs
  6607. Adjust red, green and blue shadows (darkest pixels).
  6608. @item rm
  6609. @item gm
  6610. @item bm
  6611. Adjust red, green and blue midtones (medium pixels).
  6612. @item rh
  6613. @item gh
  6614. @item bh
  6615. Adjust red, green and blue highlights (brightest pixels).
  6616. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  6617. @item pl
  6618. Preserve lightness when changing color balance. Default is disabled.
  6619. @end table
  6620. @subsection Examples
  6621. @itemize
  6622. @item
  6623. Add red color cast to shadows:
  6624. @example
  6625. colorbalance=rs=.3
  6626. @end example
  6627. @end itemize
  6628. @subsection Commands
  6629. This filter supports the all above options as @ref{commands}.
  6630. @section colorcontrast
  6631. Adjust color contrast between RGB components.
  6632. The filter accepts the following options:
  6633. @table @option
  6634. @item rc
  6635. Set the red-cyan contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  6636. @item gm
  6637. Set the green-magenta contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  6638. @item by
  6639. Set the blue-yellow contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  6640. @item rcw
  6641. @item gmw
  6642. @item byw
  6643. Set the weight of each @code{rc}, @code{gm}, @code{by} option value. Default value is 0.0.
  6644. Allowed range is from 0.0 to 1.0. If all weights are 0.0 filtering is disabled.
  6645. @item pl
  6646. Set the amount of preserving lightness. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  6647. @end table
  6648. @subsection Commands
  6649. This filter supports the all above options as @ref{commands}.
  6650. @section colorcorrect
  6651. Adjust color white balance selectively for blacks and whites.
  6652. This filter operates in YUV colorspace.
  6653. The filter accepts the following options:
  6654. @table @option
  6655. @item rl
  6656. Set the red shadow spot. Allowed range is from -1.0 to 1.0.
  6657. Default value is 0.
  6658. @item bl
  6659. Set the blue shadow spot. Allowed range is from -1.0 to 1.0.
  6660. Default value is 0.
  6661. @item rh
  6662. Set the red highlight spot. Allowed range is from -1.0 to 1.0.
  6663. Default value is 0.
  6664. @item bh
  6665. Set the red highlight spot. Allowed range is from -1.0 to 1.0.
  6666. Default value is 0.
  6667. @item saturation
  6668. Set the amount of saturation. Allowed range is from -3.0 to 3.0.
  6669. Default value is 1.
  6670. @item analyze
  6671. If set to anything other than @code{manual} it will analyze every frame and use derived
  6672. parameters for filtering output frame.
  6673. Possible values are:
  6674. @table @samp
  6675. @item manual
  6676. @item average
  6677. @item minmax
  6678. @item median
  6679. @end table
  6680. Default value is @code{manual}.
  6681. @end table
  6682. @subsection Commands
  6683. This filter supports the all above options as @ref{commands}.
  6684. @section colorchannelmixer
  6685. Adjust video input frames by re-mixing color channels.
  6686. This filter modifies a color channel by adding the values associated to
  6687. the other channels of the same pixels. For example if the value to
  6688. modify is red, the output value will be:
  6689. @example
  6690. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  6691. @end example
  6692. The filter accepts the following options:
  6693. @table @option
  6694. @item rr
  6695. @item rg
  6696. @item rb
  6697. @item ra
  6698. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  6699. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  6700. @item gr
  6701. @item gg
  6702. @item gb
  6703. @item ga
  6704. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  6705. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  6706. @item br
  6707. @item bg
  6708. @item bb
  6709. @item ba
  6710. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  6711. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  6712. @item ar
  6713. @item ag
  6714. @item ab
  6715. @item aa
  6716. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  6717. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  6718. Allowed ranges for options are @code{[-2.0, 2.0]}.
  6719. @item pc
  6720. Set preserve color mode. The accepted values are:
  6721. @table @samp
  6722. @item none
  6723. Disable color preserving, this is default.
  6724. @item lum
  6725. Preserve luminance.
  6726. @item max
  6727. Preserve max value of RGB triplet.
  6728. @item avg
  6729. Preserve average value of RGB triplet.
  6730. @item sum
  6731. Preserve sum value of RGB triplet.
  6732. @item nrm
  6733. Preserve normalized value of RGB triplet.
  6734. @item pwr
  6735. Preserve power value of RGB triplet.
  6736. @end table
  6737. @item pa
  6738. Set the preserve color amount when changing colors. Allowed range is from @code{[0.0, 1.0]}.
  6739. Default is @code{0.0}, thus disabled.
  6740. @end table
  6741. @subsection Examples
  6742. @itemize
  6743. @item
  6744. Convert source to grayscale:
  6745. @example
  6746. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  6747. @end example
  6748. @item
  6749. Simulate sepia tones:
  6750. @example
  6751. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  6752. @end example
  6753. @end itemize
  6754. @subsection Commands
  6755. This filter supports the all above options as @ref{commands}.
  6756. @section colorize
  6757. Overlay a solid color on the video stream.
  6758. The filter accepts the following options:
  6759. @table @option
  6760. @item hue
  6761. Set the color hue. Allowed range is from 0 to 360.
  6762. Default value is 0.
  6763. @item saturation
  6764. Set the color saturation. Allowed range is from 0 to 1.
  6765. Default value is 0.5.
  6766. @item lightness
  6767. Set the color lightness. Allowed range is from 0 to 1.
  6768. Default value is 0.5.
  6769. @item mix
  6770. Set the mix of source lightness. By default is set to 1.0.
  6771. Allowed range is from 0.0 to 1.0.
  6772. @end table
  6773. @subsection Commands
  6774. This filter supports the all above options as @ref{commands}.
  6775. @section colorkey
  6776. RGB colorspace color keying.
  6777. This filter operates on 8-bit RGB format frames by setting the alpha component of each pixel
  6778. which falls within the similarity radius of the key color to 0. The alpha value for pixels outside
  6779. the similarity radius depends on the value of the blend option.
  6780. The filter accepts the following options:
  6781. @table @option
  6782. @item color
  6783. Set the color for which alpha will be set to 0 (full transparency).
  6784. See @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6785. Default is @code{black}.
  6786. @item similarity
  6787. Set the radius from the key color within which other colors also have full transparency.
  6788. The computed distance is related to the unit fractional distance in 3D space between the RGB values
  6789. of the key color and the pixel's color. Range is 0.01 to 1.0. 0.01 matches within a very small radius
  6790. around the exact key color, while 1.0 matches everything.
  6791. Default is @code{0.01}.
  6792. @item blend
  6793. Set how the alpha value for pixels that fall outside the similarity radius is computed.
  6794. 0.0 makes pixels either fully transparent or fully opaque.
  6795. Higher values result in semi-transparent pixels, with greater transparency
  6796. the more similar the pixel color is to the key color.
  6797. Range is 0.0 to 1.0. Default is @code{0.0}.
  6798. @end table
  6799. @subsection Examples
  6800. @itemize
  6801. @item
  6802. Make every green pixel in the input image transparent:
  6803. @example
  6804. ffmpeg -i input.png -vf colorkey=green out.png
  6805. @end example
  6806. @item
  6807. Overlay a greenscreen-video on top of a static background image.
  6808. @example
  6809. 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
  6810. @end example
  6811. @end itemize
  6812. @subsection Commands
  6813. This filter supports same @ref{commands} as options.
  6814. The command accepts the same syntax of the corresponding option.
  6815. If the specified expression is not valid, it is kept at its current
  6816. value.
  6817. @section colorhold
  6818. Remove all color information for all RGB colors except for certain one.
  6819. The filter accepts the following options:
  6820. @table @option
  6821. @item color
  6822. The color which will not be replaced with neutral gray.
  6823. @item similarity
  6824. Similarity percentage with the above color.
  6825. 0.01 matches only the exact key color, while 1.0 matches everything.
  6826. @item blend
  6827. Blend percentage. 0.0 makes pixels fully gray.
  6828. Higher values result in more preserved color.
  6829. @end table
  6830. @subsection Commands
  6831. This filter supports same @ref{commands} as options.
  6832. The command accepts the same syntax of the corresponding option.
  6833. If the specified expression is not valid, it is kept at its current
  6834. value.
  6835. @section colorlevels
  6836. Adjust video input frames using levels.
  6837. The filter accepts the following options:
  6838. @table @option
  6839. @item rimin
  6840. @item gimin
  6841. @item bimin
  6842. @item aimin
  6843. Adjust red, green, blue and alpha input black point.
  6844. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  6845. @item rimax
  6846. @item gimax
  6847. @item bimax
  6848. @item aimax
  6849. Adjust red, green, blue and alpha input white point.
  6850. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  6851. Input levels are used to lighten highlights (bright tones), darken shadows
  6852. (dark tones), change the balance of bright and dark tones.
  6853. @item romin
  6854. @item gomin
  6855. @item bomin
  6856. @item aomin
  6857. Adjust red, green, blue and alpha output black point.
  6858. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  6859. @item romax
  6860. @item gomax
  6861. @item bomax
  6862. @item aomax
  6863. Adjust red, green, blue and alpha output white point.
  6864. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  6865. Output levels allows manual selection of a constrained output level range.
  6866. @item preserve
  6867. Set preserve color mode. The accepted values are:
  6868. @table @samp
  6869. @item none
  6870. Disable color preserving, this is default.
  6871. @item lum
  6872. Preserve luminance.
  6873. @item max
  6874. Preserve max value of RGB triplet.
  6875. @item avg
  6876. Preserve average value of RGB triplet.
  6877. @item sum
  6878. Preserve sum value of RGB triplet.
  6879. @item nrm
  6880. Preserve normalized value of RGB triplet.
  6881. @item pwr
  6882. Preserve power value of RGB triplet.
  6883. @end table
  6884. @end table
  6885. @subsection Examples
  6886. @itemize
  6887. @item
  6888. Make video output darker:
  6889. @example
  6890. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  6891. @end example
  6892. @item
  6893. Increase contrast:
  6894. @example
  6895. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  6896. @end example
  6897. @item
  6898. Make video output lighter:
  6899. @example
  6900. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  6901. @end example
  6902. @item
  6903. Increase brightness:
  6904. @example
  6905. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  6906. @end example
  6907. @end itemize
  6908. @subsection Commands
  6909. This filter supports the all above options as @ref{commands}.
  6910. @section colormap
  6911. Apply custom color maps to video stream.
  6912. This filter needs three input video streams.
  6913. First stream is video stream that is going to be filtered out.
  6914. Second and third video stream specify color patches for source
  6915. color to target color mapping.
  6916. The filter accepts the following options:
  6917. @table @option
  6918. @item patch_size
  6919. Set the source and target video stream patch size in pixels.
  6920. @item nb_patches
  6921. Set the max number of used patches from source and target video stream.
  6922. @item type
  6923. Set the adjustments used for target colors. Can be @code{relative} or @code{absolute}.
  6924. Defaults is @code{absolute}.
  6925. @item kernel
  6926. Set the kernel used to measure color differences between mapped colors.
  6927. The accepted values are:
  6928. @table @samp
  6929. @item euclidean
  6930. @item weuclidean
  6931. @end table
  6932. Default is @code{euclidean}.
  6933. @end table
  6934. @section colormatrix
  6935. Convert color matrix.
  6936. The filter accepts the following options:
  6937. @table @option
  6938. @item src
  6939. @item dst
  6940. Specify the source and destination color matrix. Both values must be
  6941. specified.
  6942. The accepted values are:
  6943. @table @samp
  6944. @item bt709
  6945. BT.709
  6946. @item fcc
  6947. FCC
  6948. @item bt601
  6949. BT.601
  6950. @item bt470
  6951. BT.470
  6952. @item bt470bg
  6953. BT.470BG
  6954. @item smpte170m
  6955. SMPTE-170M
  6956. @item smpte240m
  6957. SMPTE-240M
  6958. @item bt2020
  6959. BT.2020
  6960. @end table
  6961. @end table
  6962. For example to convert from BT.601 to SMPTE-240M, use the command:
  6963. @example
  6964. colormatrix=bt601:smpte240m
  6965. @end example
  6966. @section colorspace
  6967. Convert colorspace, transfer characteristics or color primaries.
  6968. Input video needs to have an even size.
  6969. The filter accepts the following options:
  6970. @table @option
  6971. @anchor{all}
  6972. @item all
  6973. Specify all color properties at once.
  6974. The accepted values are:
  6975. @table @samp
  6976. @item bt470m
  6977. BT.470M
  6978. @item bt470bg
  6979. BT.470BG
  6980. @item bt601-6-525
  6981. BT.601-6 525
  6982. @item bt601-6-625
  6983. BT.601-6 625
  6984. @item bt709
  6985. BT.709
  6986. @item smpte170m
  6987. SMPTE-170M
  6988. @item smpte240m
  6989. SMPTE-240M
  6990. @item bt2020
  6991. BT.2020
  6992. @end table
  6993. @anchor{space}
  6994. @item space
  6995. Specify output colorspace.
  6996. The accepted values are:
  6997. @table @samp
  6998. @item bt709
  6999. BT.709
  7000. @item fcc
  7001. FCC
  7002. @item bt470bg
  7003. BT.470BG or BT.601-6 625
  7004. @item smpte170m
  7005. SMPTE-170M or BT.601-6 525
  7006. @item smpte240m
  7007. SMPTE-240M
  7008. @item ycgco
  7009. YCgCo
  7010. @item bt2020ncl
  7011. BT.2020 with non-constant luminance
  7012. @end table
  7013. @anchor{trc}
  7014. @item trc
  7015. Specify output transfer characteristics.
  7016. The accepted values are:
  7017. @table @samp
  7018. @item bt709
  7019. BT.709
  7020. @item bt470m
  7021. BT.470M
  7022. @item bt470bg
  7023. BT.470BG
  7024. @item gamma22
  7025. Constant gamma of 2.2
  7026. @item gamma28
  7027. Constant gamma of 2.8
  7028. @item smpte170m
  7029. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  7030. @item smpte240m
  7031. SMPTE-240M
  7032. @item srgb
  7033. SRGB
  7034. @item iec61966-2-1
  7035. iec61966-2-1
  7036. @item iec61966-2-4
  7037. iec61966-2-4
  7038. @item xvycc
  7039. xvycc
  7040. @item bt2020-10
  7041. BT.2020 for 10-bits content
  7042. @item bt2020-12
  7043. BT.2020 for 12-bits content
  7044. @end table
  7045. @anchor{primaries}
  7046. @item primaries
  7047. Specify output color primaries.
  7048. The accepted values are:
  7049. @table @samp
  7050. @item bt709
  7051. BT.709
  7052. @item bt470m
  7053. BT.470M
  7054. @item bt470bg
  7055. BT.470BG or BT.601-6 625
  7056. @item smpte170m
  7057. SMPTE-170M or BT.601-6 525
  7058. @item smpte240m
  7059. SMPTE-240M
  7060. @item film
  7061. film
  7062. @item smpte431
  7063. SMPTE-431
  7064. @item smpte432
  7065. SMPTE-432
  7066. @item bt2020
  7067. BT.2020
  7068. @item jedec-p22
  7069. JEDEC P22 phosphors
  7070. @end table
  7071. @anchor{range}
  7072. @item range
  7073. Specify output color range.
  7074. The accepted values are:
  7075. @table @samp
  7076. @item tv
  7077. TV (restricted) range
  7078. @item mpeg
  7079. MPEG (restricted) range
  7080. @item pc
  7081. PC (full) range
  7082. @item jpeg
  7083. JPEG (full) range
  7084. @end table
  7085. @item format
  7086. Specify output color format.
  7087. The accepted values are:
  7088. @table @samp
  7089. @item yuv420p
  7090. YUV 4:2:0 planar 8-bits
  7091. @item yuv420p10
  7092. YUV 4:2:0 planar 10-bits
  7093. @item yuv420p12
  7094. YUV 4:2:0 planar 12-bits
  7095. @item yuv422p
  7096. YUV 4:2:2 planar 8-bits
  7097. @item yuv422p10
  7098. YUV 4:2:2 planar 10-bits
  7099. @item yuv422p12
  7100. YUV 4:2:2 planar 12-bits
  7101. @item yuv444p
  7102. YUV 4:4:4 planar 8-bits
  7103. @item yuv444p10
  7104. YUV 4:4:4 planar 10-bits
  7105. @item yuv444p12
  7106. YUV 4:4:4 planar 12-bits
  7107. @end table
  7108. @item fast
  7109. Do a fast conversion, which skips gamma/primary correction. This will take
  7110. significantly less CPU, but will be mathematically incorrect. To get output
  7111. compatible with that produced by the colormatrix filter, use fast=1.
  7112. @item dither
  7113. Specify dithering mode.
  7114. The accepted values are:
  7115. @table @samp
  7116. @item none
  7117. No dithering
  7118. @item fsb
  7119. Floyd-Steinberg dithering
  7120. @end table
  7121. @item wpadapt
  7122. Whitepoint adaptation mode.
  7123. The accepted values are:
  7124. @table @samp
  7125. @item bradford
  7126. Bradford whitepoint adaptation
  7127. @item vonkries
  7128. von Kries whitepoint adaptation
  7129. @item identity
  7130. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  7131. @end table
  7132. @item iall
  7133. Override all input properties at once. Same accepted values as @ref{all}.
  7134. @item ispace
  7135. Override input colorspace. Same accepted values as @ref{space}.
  7136. @item iprimaries
  7137. Override input color primaries. Same accepted values as @ref{primaries}.
  7138. @item itrc
  7139. Override input transfer characteristics. Same accepted values as @ref{trc}.
  7140. @item irange
  7141. Override input color range. Same accepted values as @ref{range}.
  7142. @end table
  7143. The filter converts the transfer characteristics, color space and color
  7144. primaries to the specified user values. The output value, if not specified,
  7145. is set to a default value based on the "all" property. If that property is
  7146. also not specified, the filter will log an error. The output color range and
  7147. format default to the same value as the input color range and format. The
  7148. input transfer characteristics, color space, color primaries and color range
  7149. should be set on the input data. If any of these are missing, the filter will
  7150. log an error and no conversion will take place.
  7151. For example to convert the input to SMPTE-240M, use the command:
  7152. @example
  7153. colorspace=smpte240m
  7154. @end example
  7155. @section colortemperature
  7156. Adjust color temperature in video to simulate variations in ambient color temperature.
  7157. The filter accepts the following options:
  7158. @table @option
  7159. @item temperature
  7160. Set the temperature in Kelvin. Allowed range is from 1000 to 40000.
  7161. Default value is 6500 K.
  7162. @item mix
  7163. Set mixing with filtered output. Allowed range is from 0 to 1.
  7164. Default value is 1.
  7165. @item pl
  7166. Set the amount of preserving lightness. Allowed range is from 0 to 1.
  7167. Default value is 0.
  7168. @end table
  7169. @subsection Commands
  7170. This filter supports same @ref{commands} as options.
  7171. @section convolution
  7172. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  7173. The filter accepts the following options:
  7174. @table @option
  7175. @item 0m
  7176. @item 1m
  7177. @item 2m
  7178. @item 3m
  7179. Set matrix for each plane.
  7180. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  7181. and from 1 to 49 odd number of signed integers in @var{row} mode.
  7182. @item 0rdiv
  7183. @item 1rdiv
  7184. @item 2rdiv
  7185. @item 3rdiv
  7186. Set multiplier for calculated value for each plane.
  7187. If unset or 0, it will be sum of all matrix elements.
  7188. @item 0bias
  7189. @item 1bias
  7190. @item 2bias
  7191. @item 3bias
  7192. Set bias for each plane. This value is added to the result of the multiplication.
  7193. Useful for making the overall image brighter or darker. Default is 0.0.
  7194. @item 0mode
  7195. @item 1mode
  7196. @item 2mode
  7197. @item 3mode
  7198. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  7199. Default is @var{square}.
  7200. @end table
  7201. @subsection Commands
  7202. This filter supports the all above options as @ref{commands}.
  7203. @subsection Examples
  7204. @itemize
  7205. @item
  7206. Apply sharpen:
  7207. @example
  7208. 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"
  7209. @end example
  7210. @item
  7211. Apply blur:
  7212. @example
  7213. 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"
  7214. @end example
  7215. @item
  7216. Apply edge enhance:
  7217. @example
  7218. 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"
  7219. @end example
  7220. @item
  7221. Apply edge detect:
  7222. @example
  7223. 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"
  7224. @end example
  7225. @item
  7226. Apply laplacian edge detector which includes diagonals:
  7227. @example
  7228. 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"
  7229. @end example
  7230. @item
  7231. Apply emboss:
  7232. @example
  7233. 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"
  7234. @end example
  7235. @end itemize
  7236. @section convolve
  7237. Apply 2D convolution of video stream in frequency domain using second stream
  7238. as impulse.
  7239. The filter accepts the following options:
  7240. @table @option
  7241. @item planes
  7242. Set which planes to process.
  7243. @item impulse
  7244. Set which impulse video frames will be processed, can be @var{first}
  7245. or @var{all}. Default is @var{all}.
  7246. @end table
  7247. The @code{convolve} filter also supports the @ref{framesync} options.
  7248. @section copy
  7249. Copy the input video source unchanged to the output. This is mainly useful for
  7250. testing purposes.
  7251. @anchor{coreimage}
  7252. @section coreimage
  7253. Video filtering on GPU using Apple's CoreImage API on OSX.
  7254. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  7255. processed by video hardware. However, software-based OpenGL implementations
  7256. exist which means there is no guarantee for hardware processing. It depends on
  7257. the respective OSX.
  7258. There are many filters and image generators provided by Apple that come with a
  7259. large variety of options. The filter has to be referenced by its name along
  7260. with its options.
  7261. The coreimage filter accepts the following options:
  7262. @table @option
  7263. @item list_filters
  7264. List all available filters and generators along with all their respective
  7265. options as well as possible minimum and maximum values along with the default
  7266. values.
  7267. @example
  7268. list_filters=true
  7269. @end example
  7270. @item filter
  7271. Specify all filters by their respective name and options.
  7272. Use @var{list_filters} to determine all valid filter names and options.
  7273. Numerical options are specified by a float value and are automatically clamped
  7274. to their respective value range. Vector and color options have to be specified
  7275. by a list of space separated float values. Character escaping has to be done.
  7276. A special option name @code{default} is available to use default options for a
  7277. filter.
  7278. It is required to specify either @code{default} or at least one of the filter options.
  7279. All omitted options are used with their default values.
  7280. The syntax of the filter string is as follows:
  7281. @example
  7282. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  7283. @end example
  7284. @item output_rect
  7285. Specify a rectangle where the output of the filter chain is copied into the
  7286. input image. It is given by a list of space separated float values:
  7287. @example
  7288. output_rect=x\ y\ width\ height
  7289. @end example
  7290. If not given, the output rectangle equals the dimensions of the input image.
  7291. The output rectangle is automatically cropped at the borders of the input
  7292. image. Negative values are valid for each component.
  7293. @example
  7294. output_rect=25\ 25\ 100\ 100
  7295. @end example
  7296. @end table
  7297. Several filters can be chained for successive processing without GPU-HOST
  7298. transfers allowing for fast processing of complex filter chains.
  7299. Currently, only filters with zero (generators) or exactly one (filters) input
  7300. image and one output image are supported. Also, transition filters are not yet
  7301. usable as intended.
  7302. Some filters generate output images with additional padding depending on the
  7303. respective filter kernel. The padding is automatically removed to ensure the
  7304. filter output has the same size as the input image.
  7305. For image generators, the size of the output image is determined by the
  7306. previous output image of the filter chain or the input image of the whole
  7307. filterchain, respectively. The generators do not use the pixel information of
  7308. this image to generate their output. However, the generated output is
  7309. blended onto this image, resulting in partial or complete coverage of the
  7310. output image.
  7311. The @ref{coreimagesrc} video source can be used for generating input images
  7312. which are directly fed into the filter chain. By using it, providing input
  7313. images by another video source or an input video is not required.
  7314. @subsection Examples
  7315. @itemize
  7316. @item
  7317. List all filters available:
  7318. @example
  7319. coreimage=list_filters=true
  7320. @end example
  7321. @item
  7322. Use the CIBoxBlur filter with default options to blur an image:
  7323. @example
  7324. coreimage=filter=CIBoxBlur@@default
  7325. @end example
  7326. @item
  7327. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  7328. its center at 100x100 and a radius of 50 pixels:
  7329. @example
  7330. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  7331. @end example
  7332. @item
  7333. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  7334. given as complete and escaped command-line for Apple's standard bash shell:
  7335. @example
  7336. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  7337. @end example
  7338. @end itemize
  7339. @section cover_rect
  7340. Cover a rectangular object
  7341. It accepts the following options:
  7342. @table @option
  7343. @item cover
  7344. Filepath of the optional cover image, needs to be in yuv420.
  7345. @item mode
  7346. Set covering mode.
  7347. It accepts the following values:
  7348. @table @samp
  7349. @item cover
  7350. cover it by the supplied image
  7351. @item blur
  7352. cover it by interpolating the surrounding pixels
  7353. @end table
  7354. Default value is @var{blur}.
  7355. @end table
  7356. @subsection Examples
  7357. @itemize
  7358. @item
  7359. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  7360. @example
  7361. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7362. @end example
  7363. @end itemize
  7364. @section crop
  7365. Crop the input video to given dimensions.
  7366. It accepts the following parameters:
  7367. @table @option
  7368. @item w, out_w
  7369. The width of the output video. It defaults to @code{iw}.
  7370. This expression is evaluated only once during the filter
  7371. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  7372. @item h, out_h
  7373. The height of the output video. It defaults to @code{ih}.
  7374. This expression is evaluated only once during the filter
  7375. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  7376. @item x
  7377. The horizontal position, in the input video, of the left edge of the output
  7378. video. It defaults to @code{(in_w-out_w)/2}.
  7379. This expression is evaluated per-frame.
  7380. @item y
  7381. The vertical position, in the input video, of the top edge of the output video.
  7382. It defaults to @code{(in_h-out_h)/2}.
  7383. This expression is evaluated per-frame.
  7384. @item keep_aspect
  7385. If set to 1 will force the output display aspect ratio
  7386. to be the same of the input, by changing the output sample aspect
  7387. ratio. It defaults to 0.
  7388. @item exact
  7389. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  7390. width/height/x/y as specified and will not be rounded to nearest smaller value.
  7391. It defaults to 0.
  7392. @end table
  7393. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  7394. expressions containing the following constants:
  7395. @table @option
  7396. @item x
  7397. @item y
  7398. The computed values for @var{x} and @var{y}. They are evaluated for
  7399. each new frame.
  7400. @item in_w
  7401. @item in_h
  7402. The input width and height.
  7403. @item iw
  7404. @item ih
  7405. These are the same as @var{in_w} and @var{in_h}.
  7406. @item out_w
  7407. @item out_h
  7408. The output (cropped) width and height.
  7409. @item ow
  7410. @item oh
  7411. These are the same as @var{out_w} and @var{out_h}.
  7412. @item a
  7413. same as @var{iw} / @var{ih}
  7414. @item sar
  7415. input sample aspect ratio
  7416. @item dar
  7417. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  7418. @item hsub
  7419. @item vsub
  7420. horizontal and vertical chroma subsample values. For example for the
  7421. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7422. @item n
  7423. The number of the input frame, starting from 0.
  7424. @item pos
  7425. the position in the file of the input frame, NAN if unknown
  7426. @item t
  7427. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  7428. @end table
  7429. The expression for @var{out_w} may depend on the value of @var{out_h},
  7430. and the expression for @var{out_h} may depend on @var{out_w}, but they
  7431. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  7432. evaluated after @var{out_w} and @var{out_h}.
  7433. The @var{x} and @var{y} parameters specify the expressions for the
  7434. position of the top-left corner of the output (non-cropped) area. They
  7435. are evaluated for each frame. If the evaluated value is not valid, it
  7436. is approximated to the nearest valid value.
  7437. The expression for @var{x} may depend on @var{y}, and the expression
  7438. for @var{y} may depend on @var{x}.
  7439. @subsection Examples
  7440. @itemize
  7441. @item
  7442. Crop area with size 100x100 at position (12,34).
  7443. @example
  7444. crop=100:100:12:34
  7445. @end example
  7446. Using named options, the example above becomes:
  7447. @example
  7448. crop=w=100:h=100:x=12:y=34
  7449. @end example
  7450. @item
  7451. Crop the central input area with size 100x100:
  7452. @example
  7453. crop=100:100
  7454. @end example
  7455. @item
  7456. Crop the central input area with size 2/3 of the input video:
  7457. @example
  7458. crop=2/3*in_w:2/3*in_h
  7459. @end example
  7460. @item
  7461. Crop the input video central square:
  7462. @example
  7463. crop=out_w=in_h
  7464. crop=in_h
  7465. @end example
  7466. @item
  7467. Delimit the rectangle with the top-left corner placed at position
  7468. 100:100 and the right-bottom corner corresponding to the right-bottom
  7469. corner of the input image.
  7470. @example
  7471. crop=in_w-100:in_h-100:100:100
  7472. @end example
  7473. @item
  7474. Crop 10 pixels from the left and right borders, and 20 pixels from
  7475. the top and bottom borders
  7476. @example
  7477. crop=in_w-2*10:in_h-2*20
  7478. @end example
  7479. @item
  7480. Keep only the bottom right quarter of the input image:
  7481. @example
  7482. crop=in_w/2:in_h/2:in_w/2:in_h/2
  7483. @end example
  7484. @item
  7485. Crop height for getting Greek harmony:
  7486. @example
  7487. crop=in_w:1/PHI*in_w
  7488. @end example
  7489. @item
  7490. Apply trembling effect:
  7491. @example
  7492. 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)
  7493. @end example
  7494. @item
  7495. Apply erratic camera effect depending on timestamp:
  7496. @example
  7497. 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)"
  7498. @end example
  7499. @item
  7500. Set x depending on the value of y:
  7501. @example
  7502. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  7503. @end example
  7504. @end itemize
  7505. @subsection Commands
  7506. This filter supports the following commands:
  7507. @table @option
  7508. @item w, out_w
  7509. @item h, out_h
  7510. @item x
  7511. @item y
  7512. Set width/height of the output video and the horizontal/vertical position
  7513. in the input video.
  7514. The command accepts the same syntax of the corresponding option.
  7515. If the specified expression is not valid, it is kept at its current
  7516. value.
  7517. @end table
  7518. @section cropdetect
  7519. Auto-detect the crop size.
  7520. It calculates the necessary cropping parameters and prints the
  7521. recommended parameters via the logging system. The detected dimensions
  7522. correspond to the non-black area of the input video.
  7523. It accepts the following parameters:
  7524. @table @option
  7525. @item limit
  7526. Set higher black value threshold, which can be optionally specified
  7527. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  7528. value greater to the set value is considered non-black. It defaults to 24.
  7529. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  7530. on the bitdepth of the pixel format.
  7531. @item round
  7532. The value which the width/height should be divisible by. It defaults to
  7533. 16. The offset is automatically adjusted to center the video. Use 2 to
  7534. get only even dimensions (needed for 4:2:2 video). 16 is best when
  7535. encoding to most video codecs.
  7536. @item skip
  7537. Set the number of initial frames for which evaluation is skipped.
  7538. Default is 2. Range is 0 to INT_MAX.
  7539. @item reset_count, reset
  7540. Set the counter that determines after how many frames cropdetect will
  7541. reset the previously detected largest video area and start over to
  7542. detect the current optimal crop area. Default value is 0.
  7543. This can be useful when channel logos distort the video area. 0
  7544. indicates 'never reset', and returns the largest area encountered during
  7545. playback.
  7546. @end table
  7547. @anchor{cue}
  7548. @section cue
  7549. Delay video filtering until a given wallclock timestamp. The filter first
  7550. passes on @option{preroll} amount of frames, then it buffers at most
  7551. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  7552. it forwards the buffered frames and also any subsequent frames coming in its
  7553. input.
  7554. The filter can be used synchronize the output of multiple ffmpeg processes for
  7555. realtime output devices like decklink. By putting the delay in the filtering
  7556. chain and pre-buffering frames the process can pass on data to output almost
  7557. immediately after the target wallclock timestamp is reached.
  7558. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  7559. some use cases.
  7560. @table @option
  7561. @item cue
  7562. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  7563. @item preroll
  7564. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  7565. @item buffer
  7566. The maximum duration of content to buffer before waiting for the cue expressed
  7567. in seconds. Default is 0.
  7568. @end table
  7569. @anchor{curves}
  7570. @section curves
  7571. Apply color adjustments using curves.
  7572. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  7573. component (red, green and blue) has its values defined by @var{N} key points
  7574. tied from each other using a smooth curve. The x-axis represents the pixel
  7575. values from the input frame, and the y-axis the new pixel values to be set for
  7576. the output frame.
  7577. By default, a component curve is defined by the two points @var{(0;0)} and
  7578. @var{(1;1)}. This creates a straight line where each original pixel value is
  7579. "adjusted" to its own value, which means no change to the image.
  7580. The filter allows you to redefine these two points and add some more. A new
  7581. curve (using a natural cubic spline interpolation) will be define to pass
  7582. smoothly through all these new coordinates. The new defined points needs to be
  7583. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  7584. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  7585. the vector spaces, the values will be clipped accordingly.
  7586. The filter accepts the following options:
  7587. @table @option
  7588. @item preset
  7589. Select one of the available color presets. This option can be used in addition
  7590. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  7591. options takes priority on the preset values.
  7592. Available presets are:
  7593. @table @samp
  7594. @item none
  7595. @item color_negative
  7596. @item cross_process
  7597. @item darker
  7598. @item increase_contrast
  7599. @item lighter
  7600. @item linear_contrast
  7601. @item medium_contrast
  7602. @item negative
  7603. @item strong_contrast
  7604. @item vintage
  7605. @end table
  7606. Default is @code{none}.
  7607. @item master, m
  7608. Set the master key points. These points will define a second pass mapping. It
  7609. is sometimes called a "luminance" or "value" mapping. It can be used with
  7610. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  7611. post-processing LUT.
  7612. @item red, r
  7613. Set the key points for the red component.
  7614. @item green, g
  7615. Set the key points for the green component.
  7616. @item blue, b
  7617. Set the key points for the blue component.
  7618. @item all
  7619. Set the key points for all components (not including master).
  7620. Can be used in addition to the other key points component
  7621. options. In this case, the unset component(s) will fallback on this
  7622. @option{all} setting.
  7623. @item psfile
  7624. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  7625. @item plot
  7626. Save Gnuplot script of the curves in specified file.
  7627. @end table
  7628. To avoid some filtergraph syntax conflicts, each key points list need to be
  7629. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  7630. @subsection Commands
  7631. This filter supports same @ref{commands} as options.
  7632. @subsection Examples
  7633. @itemize
  7634. @item
  7635. Increase slightly the middle level of blue:
  7636. @example
  7637. curves=blue='0/0 0.5/0.58 1/1'
  7638. @end example
  7639. @item
  7640. Vintage effect:
  7641. @example
  7642. 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'
  7643. @end example
  7644. Here we obtain the following coordinates for each components:
  7645. @table @var
  7646. @item red
  7647. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  7648. @item green
  7649. @code{(0;0) (0.50;0.48) (1;1)}
  7650. @item blue
  7651. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  7652. @end table
  7653. @item
  7654. The previous example can also be achieved with the associated built-in preset:
  7655. @example
  7656. curves=preset=vintage
  7657. @end example
  7658. @item
  7659. Or simply:
  7660. @example
  7661. curves=vintage
  7662. @end example
  7663. @item
  7664. Use a Photoshop preset and redefine the points of the green component:
  7665. @example
  7666. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  7667. @end example
  7668. @item
  7669. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  7670. and @command{gnuplot}:
  7671. @example
  7672. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  7673. gnuplot -p /tmp/curves.plt
  7674. @end example
  7675. @end itemize
  7676. @section datascope
  7677. Video data analysis filter.
  7678. This filter shows hexadecimal pixel values of part of video.
  7679. The filter accepts the following options:
  7680. @table @option
  7681. @item size, s
  7682. Set output video size.
  7683. @item x
  7684. Set x offset from where to pick pixels.
  7685. @item y
  7686. Set y offset from where to pick pixels.
  7687. @item mode
  7688. Set scope mode, can be one of the following:
  7689. @table @samp
  7690. @item mono
  7691. Draw hexadecimal pixel values with white color on black background.
  7692. @item color
  7693. Draw hexadecimal pixel values with input video pixel color on black
  7694. background.
  7695. @item color2
  7696. Draw hexadecimal pixel values on color background picked from input video,
  7697. the text color is picked in such way so its always visible.
  7698. @end table
  7699. @item axis
  7700. Draw rows and columns numbers on left and top of video.
  7701. @item opacity
  7702. Set background opacity.
  7703. @item format
  7704. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  7705. @item components
  7706. Set pixel components to display. By default all pixel components are displayed.
  7707. @end table
  7708. @subsection Commands
  7709. This filter supports same @ref{commands} as options excluding @code{size} option.
  7710. @section dblur
  7711. Apply Directional blur filter.
  7712. The filter accepts the following options:
  7713. @table @option
  7714. @item angle
  7715. Set angle of directional blur. Default is @code{45}.
  7716. @item radius
  7717. Set radius of directional blur. Default is @code{5}.
  7718. @item planes
  7719. Set which planes to filter. By default all planes are filtered.
  7720. @end table
  7721. @subsection Commands
  7722. This filter supports same @ref{commands} as options.
  7723. The command accepts the same syntax of the corresponding option.
  7724. If the specified expression is not valid, it is kept at its current
  7725. value.
  7726. @section dctdnoiz
  7727. Denoise frames using 2D DCT (frequency domain filtering).
  7728. This filter is not designed for real time.
  7729. The filter accepts the following options:
  7730. @table @option
  7731. @item sigma, s
  7732. Set the noise sigma constant.
  7733. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  7734. coefficient (absolute value) below this threshold with be dropped.
  7735. If you need a more advanced filtering, see @option{expr}.
  7736. Default is @code{0}.
  7737. @item overlap
  7738. Set number overlapping pixels for each block. Since the filter can be slow, you
  7739. may want to reduce this value, at the cost of a less effective filter and the
  7740. risk of various artefacts.
  7741. If the overlapping value doesn't permit processing the whole input width or
  7742. height, a warning will be displayed and according borders won't be denoised.
  7743. Default value is @var{blocksize}-1, which is the best possible setting.
  7744. @item expr, e
  7745. Set the coefficient factor expression.
  7746. For each coefficient of a DCT block, this expression will be evaluated as a
  7747. multiplier value for the coefficient.
  7748. If this is option is set, the @option{sigma} option will be ignored.
  7749. The absolute value of the coefficient can be accessed through the @var{c}
  7750. variable.
  7751. @item n
  7752. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  7753. @var{blocksize}, which is the width and height of the processed blocks.
  7754. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  7755. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  7756. on the speed processing. Also, a larger block size does not necessarily means a
  7757. better de-noising.
  7758. @end table
  7759. @subsection Examples
  7760. Apply a denoise with a @option{sigma} of @code{4.5}:
  7761. @example
  7762. dctdnoiz=4.5
  7763. @end example
  7764. The same operation can be achieved using the expression system:
  7765. @example
  7766. dctdnoiz=e='gte(c, 4.5*3)'
  7767. @end example
  7768. Violent denoise using a block size of @code{16x16}:
  7769. @example
  7770. dctdnoiz=15:n=4
  7771. @end example
  7772. @section deband
  7773. Remove banding artifacts from input video.
  7774. It works by replacing banded pixels with average value of referenced pixels.
  7775. The filter accepts the following options:
  7776. @table @option
  7777. @item 1thr
  7778. @item 2thr
  7779. @item 3thr
  7780. @item 4thr
  7781. Set banding detection threshold for each plane. Default is 0.02.
  7782. Valid range is 0.00003 to 0.5.
  7783. If difference between current pixel and reference pixel is less than threshold,
  7784. it will be considered as banded.
  7785. @item range, r
  7786. Banding detection range in pixels. Default is 16. If positive, random number
  7787. in range 0 to set value will be used. If negative, exact absolute value
  7788. will be used.
  7789. The range defines square of four pixels around current pixel.
  7790. @item direction, d
  7791. Set direction in radians from which four pixel will be compared. If positive,
  7792. random direction from 0 to set direction will be picked. If negative, exact of
  7793. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  7794. will pick only pixels on same row and -PI/2 will pick only pixels on same
  7795. column.
  7796. @item blur, b
  7797. If enabled, current pixel is compared with average value of all four
  7798. surrounding pixels. The default is enabled. If disabled current pixel is
  7799. compared with all four surrounding pixels. The pixel is considered banded
  7800. if only all four differences with surrounding pixels are less than threshold.
  7801. @item coupling, c
  7802. If enabled, current pixel is changed if and only if all pixel components are banded,
  7803. e.g. banding detection threshold is triggered for all color components.
  7804. The default is disabled.
  7805. @end table
  7806. @subsection Commands
  7807. This filter supports the all above options as @ref{commands}.
  7808. @section deblock
  7809. Remove blocking artifacts from input video.
  7810. The filter accepts the following options:
  7811. @table @option
  7812. @item filter
  7813. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  7814. This controls what kind of deblocking is applied.
  7815. @item block
  7816. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  7817. @item alpha
  7818. @item beta
  7819. @item gamma
  7820. @item delta
  7821. Set blocking detection thresholds. Allowed range is 0 to 1.
  7822. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  7823. Using higher threshold gives more deblocking strength.
  7824. Setting @var{alpha} controls threshold detection at exact edge of block.
  7825. Remaining options controls threshold detection near the edge. Each one for
  7826. below/above or left/right. Setting any of those to @var{0} disables
  7827. deblocking.
  7828. @item planes
  7829. Set planes to filter. Default is to filter all available planes.
  7830. @end table
  7831. @subsection Examples
  7832. @itemize
  7833. @item
  7834. Deblock using weak filter and block size of 4 pixels.
  7835. @example
  7836. deblock=filter=weak:block=4
  7837. @end example
  7838. @item
  7839. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  7840. deblocking more edges.
  7841. @example
  7842. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  7843. @end example
  7844. @item
  7845. Similar as above, but filter only first plane.
  7846. @example
  7847. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  7848. @end example
  7849. @item
  7850. Similar as above, but filter only second and third plane.
  7851. @example
  7852. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  7853. @end example
  7854. @end itemize
  7855. @subsection Commands
  7856. This filter supports the all above options as @ref{commands}.
  7857. @anchor{decimate}
  7858. @section decimate
  7859. Drop duplicated frames at regular intervals.
  7860. The filter accepts the following options:
  7861. @table @option
  7862. @item cycle
  7863. Set the number of frames from which one will be dropped. Setting this to
  7864. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  7865. Default is @code{5}.
  7866. @item dupthresh
  7867. Set the threshold for duplicate detection. If the difference metric for a frame
  7868. is less than or equal to this value, then it is declared as duplicate. Default
  7869. is @code{1.1}
  7870. @item scthresh
  7871. Set scene change threshold. Default is @code{15}.
  7872. @item blockx
  7873. @item blocky
  7874. Set the size of the x and y-axis blocks used during metric calculations.
  7875. Larger blocks give better noise suppression, but also give worse detection of
  7876. small movements. Must be a power of two. Default is @code{32}.
  7877. @item ppsrc
  7878. Mark main input as a pre-processed input and activate clean source input
  7879. stream. This allows the input to be pre-processed with various filters to help
  7880. the metrics calculation while keeping the frame selection lossless. When set to
  7881. @code{1}, the first stream is for the pre-processed input, and the second
  7882. stream is the clean source from where the kept frames are chosen. Default is
  7883. @code{0}.
  7884. @item chroma
  7885. Set whether or not chroma is considered in the metric calculations. Default is
  7886. @code{1}.
  7887. @end table
  7888. @section deconvolve
  7889. Apply 2D deconvolution of video stream in frequency domain using second stream
  7890. as impulse.
  7891. The filter accepts the following options:
  7892. @table @option
  7893. @item planes
  7894. Set which planes to process.
  7895. @item impulse
  7896. Set which impulse video frames will be processed, can be @var{first}
  7897. or @var{all}. Default is @var{all}.
  7898. @item noise
  7899. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  7900. and height are not same and not power of 2 or if stream prior to convolving
  7901. had noise.
  7902. @end table
  7903. The @code{deconvolve} filter also supports the @ref{framesync} options.
  7904. @section dedot
  7905. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  7906. It accepts the following options:
  7907. @table @option
  7908. @item m
  7909. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  7910. @var{rainbows} for cross-color reduction.
  7911. @item lt
  7912. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  7913. @item tl
  7914. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  7915. @item tc
  7916. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  7917. @item ct
  7918. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  7919. @end table
  7920. @section deflate
  7921. Apply deflate effect to the video.
  7922. This filter replaces the pixel by the local(3x3) average by taking into account
  7923. only values lower than the pixel.
  7924. It accepts the following options:
  7925. @table @option
  7926. @item threshold0
  7927. @item threshold1
  7928. @item threshold2
  7929. @item threshold3
  7930. Limit the maximum change for each plane, default is 65535.
  7931. If 0, plane will remain unchanged.
  7932. @end table
  7933. @subsection Commands
  7934. This filter supports the all above options as @ref{commands}.
  7935. @section deflicker
  7936. Remove temporal frame luminance variations.
  7937. It accepts the following options:
  7938. @table @option
  7939. @item size, s
  7940. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  7941. @item mode, m
  7942. Set averaging mode to smooth temporal luminance variations.
  7943. Available values are:
  7944. @table @samp
  7945. @item am
  7946. Arithmetic mean
  7947. @item gm
  7948. Geometric mean
  7949. @item hm
  7950. Harmonic mean
  7951. @item qm
  7952. Quadratic mean
  7953. @item cm
  7954. Cubic mean
  7955. @item pm
  7956. Power mean
  7957. @item median
  7958. Median
  7959. @end table
  7960. @item bypass
  7961. Do not actually modify frame. Useful when one only wants metadata.
  7962. @end table
  7963. @section dejudder
  7964. Remove judder produced by partially interlaced telecined content.
  7965. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  7966. source was partially telecined content then the output of @code{pullup,dejudder}
  7967. will have a variable frame rate. May change the recorded frame rate of the
  7968. container. Aside from that change, this filter will not affect constant frame
  7969. rate video.
  7970. The option available in this filter is:
  7971. @table @option
  7972. @item cycle
  7973. Specify the length of the window over which the judder repeats.
  7974. Accepts any integer greater than 1. Useful values are:
  7975. @table @samp
  7976. @item 4
  7977. If the original was telecined from 24 to 30 fps (Film to NTSC).
  7978. @item 5
  7979. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  7980. @item 20
  7981. If a mixture of the two.
  7982. @end table
  7983. The default is @samp{4}.
  7984. @end table
  7985. @section delogo
  7986. Suppress a TV station logo by a simple interpolation of the surrounding
  7987. pixels. Just set a rectangle covering the logo and watch it disappear
  7988. (and sometimes something even uglier appear - your mileage may vary).
  7989. It accepts the following parameters:
  7990. @table @option
  7991. @item x
  7992. @item y
  7993. Specify the top left corner coordinates of the logo. They must be
  7994. specified.
  7995. @item w
  7996. @item h
  7997. Specify the width and height of the logo to clear. They must be
  7998. specified.
  7999. @item show
  8000. When set to 1, a green rectangle is drawn on the screen to simplify
  8001. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  8002. The default value is 0.
  8003. The rectangle is drawn on the outermost pixels which will be (partly)
  8004. replaced with interpolated values. The values of the next pixels
  8005. immediately outside this rectangle in each direction will be used to
  8006. compute the interpolated pixel values inside the rectangle.
  8007. @end table
  8008. @subsection Examples
  8009. @itemize
  8010. @item
  8011. Set a rectangle covering the area with top left corner coordinates 0,0
  8012. and size 100x77:
  8013. @example
  8014. delogo=x=0:y=0:w=100:h=77
  8015. @end example
  8016. @end itemize
  8017. @anchor{derain}
  8018. @section derain
  8019. Remove the rain in the input image/video by applying the derain methods based on
  8020. convolutional neural networks. Supported models:
  8021. @itemize
  8022. @item
  8023. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  8024. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  8025. @end itemize
  8026. Training as well as model generation scripts are provided in
  8027. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  8028. Native model files (.model) can be generated from TensorFlow model
  8029. files (.pb) by using tools/python/convert.py
  8030. The filter accepts the following options:
  8031. @table @option
  8032. @item filter_type
  8033. Specify which filter to use. This option accepts the following values:
  8034. @table @samp
  8035. @item derain
  8036. Derain filter. To conduct derain filter, you need to use a derain model.
  8037. @item dehaze
  8038. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  8039. @end table
  8040. Default value is @samp{derain}.
  8041. @item dnn_backend
  8042. Specify which DNN backend to use for model loading and execution. This option accepts
  8043. the following values:
  8044. @table @samp
  8045. @item native
  8046. Native implementation of DNN loading and execution.
  8047. @item tensorflow
  8048. TensorFlow backend. To enable this backend you
  8049. need to install the TensorFlow for C library (see
  8050. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  8051. @code{--enable-libtensorflow}
  8052. @end table
  8053. Default value is @samp{native}.
  8054. @item model
  8055. Set path to model file specifying network architecture and its parameters.
  8056. Note that different backends use different file formats. TensorFlow and native
  8057. backend can load files for only its format.
  8058. @end table
  8059. To get full functionality (such as async execution), please use the @ref{dnn_processing} filter.
  8060. @section deshake
  8061. Attempt to fix small changes in horizontal and/or vertical shift. This
  8062. filter helps remove camera shake from hand-holding a camera, bumping a
  8063. tripod, moving on a vehicle, etc.
  8064. The filter accepts the following options:
  8065. @table @option
  8066. @item x
  8067. @item y
  8068. @item w
  8069. @item h
  8070. Specify a rectangular area where to limit the search for motion
  8071. vectors.
  8072. If desired the search for motion vectors can be limited to a
  8073. rectangular area of the frame defined by its top left corner, width
  8074. and height. These parameters have the same meaning as the drawbox
  8075. filter which can be used to visualise the position of the bounding
  8076. box.
  8077. This is useful when simultaneous movement of subjects within the frame
  8078. might be confused for camera motion by the motion vector search.
  8079. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  8080. then the full frame is used. This allows later options to be set
  8081. without specifying the bounding box for the motion vector search.
  8082. Default - search the whole frame.
  8083. @item rx
  8084. @item ry
  8085. Specify the maximum extent of movement in x and y directions in the
  8086. range 0-64 pixels. Default 16.
  8087. @item edge
  8088. Specify how to generate pixels to fill blanks at the edge of the
  8089. frame. Available values are:
  8090. @table @samp
  8091. @item blank, 0
  8092. Fill zeroes at blank locations
  8093. @item original, 1
  8094. Original image at blank locations
  8095. @item clamp, 2
  8096. Extruded edge value at blank locations
  8097. @item mirror, 3
  8098. Mirrored edge at blank locations
  8099. @end table
  8100. Default value is @samp{mirror}.
  8101. @item blocksize
  8102. Specify the blocksize to use for motion search. Range 4-128 pixels,
  8103. default 8.
  8104. @item contrast
  8105. Specify the contrast threshold for blocks. Only blocks with more than
  8106. the specified contrast (difference between darkest and lightest
  8107. pixels) will be considered. Range 1-255, default 125.
  8108. @item search
  8109. Specify the search strategy. Available values are:
  8110. @table @samp
  8111. @item exhaustive, 0
  8112. Set exhaustive search
  8113. @item less, 1
  8114. Set less exhaustive search.
  8115. @end table
  8116. Default value is @samp{exhaustive}.
  8117. @item filename
  8118. If set then a detailed log of the motion search is written to the
  8119. specified file.
  8120. @end table
  8121. @section despill
  8122. Remove unwanted contamination of foreground colors, caused by reflected color of
  8123. greenscreen or bluescreen.
  8124. This filter accepts the following options:
  8125. @table @option
  8126. @item type
  8127. Set what type of despill to use.
  8128. @item mix
  8129. Set how spillmap will be generated.
  8130. @item expand
  8131. Set how much to get rid of still remaining spill.
  8132. @item red
  8133. Controls amount of red in spill area.
  8134. @item green
  8135. Controls amount of green in spill area.
  8136. Should be -1 for greenscreen.
  8137. @item blue
  8138. Controls amount of blue in spill area.
  8139. Should be -1 for bluescreen.
  8140. @item brightness
  8141. Controls brightness of spill area, preserving colors.
  8142. @item alpha
  8143. Modify alpha from generated spillmap.
  8144. @end table
  8145. @subsection Commands
  8146. This filter supports the all above options as @ref{commands}.
  8147. @section detelecine
  8148. Apply an exact inverse of the telecine operation. It requires a predefined
  8149. pattern specified using the pattern option which must be the same as that passed
  8150. to the telecine filter.
  8151. This filter accepts the following options:
  8152. @table @option
  8153. @item first_field
  8154. @table @samp
  8155. @item top, t
  8156. top field first
  8157. @item bottom, b
  8158. bottom field first
  8159. The default value is @code{top}.
  8160. @end table
  8161. @item pattern
  8162. A string of numbers representing the pulldown pattern you wish to apply.
  8163. The default value is @code{23}.
  8164. @item start_frame
  8165. A number representing position of the first frame with respect to the telecine
  8166. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  8167. @end table
  8168. @anchor{dilation}
  8169. @section dilation
  8170. Apply dilation effect to the video.
  8171. This filter replaces the pixel by the local(3x3) maximum.
  8172. It accepts the following options:
  8173. @table @option
  8174. @item threshold0
  8175. @item threshold1
  8176. @item threshold2
  8177. @item threshold3
  8178. Limit the maximum change for each plane, default is 65535.
  8179. If 0, plane will remain unchanged.
  8180. @item coordinates
  8181. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  8182. pixels are used.
  8183. Flags to local 3x3 coordinates maps like this:
  8184. 1 2 3
  8185. 4 5
  8186. 6 7 8
  8187. @end table
  8188. @subsection Commands
  8189. This filter supports the all above options as @ref{commands}.
  8190. @section displace
  8191. Displace pixels as indicated by second and third input stream.
  8192. It takes three input streams and outputs one stream, the first input is the
  8193. source, and second and third input are displacement maps.
  8194. The second input specifies how much to displace pixels along the
  8195. x-axis, while the third input specifies how much to displace pixels
  8196. along the y-axis.
  8197. If one of displacement map streams terminates, last frame from that
  8198. displacement map will be used.
  8199. Note that once generated, displacements maps can be reused over and over again.
  8200. A description of the accepted options follows.
  8201. @table @option
  8202. @item edge
  8203. Set displace behavior for pixels that are out of range.
  8204. Available values are:
  8205. @table @samp
  8206. @item blank
  8207. Missing pixels are replaced by black pixels.
  8208. @item smear
  8209. Adjacent pixels will spread out to replace missing pixels.
  8210. @item wrap
  8211. Out of range pixels are wrapped so they point to pixels of other side.
  8212. @item mirror
  8213. Out of range pixels will be replaced with mirrored pixels.
  8214. @end table
  8215. Default is @samp{smear}.
  8216. @end table
  8217. @subsection Examples
  8218. @itemize
  8219. @item
  8220. Add ripple effect to rgb input of video size hd720:
  8221. @example
  8222. 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
  8223. @end example
  8224. @item
  8225. Add wave effect to rgb input of video size hd720:
  8226. @example
  8227. 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
  8228. @end example
  8229. @end itemize
  8230. @section dnn_classify
  8231. Do classification with deep neural networks based on bounding boxes.
  8232. The filter accepts the following options:
  8233. @table @option
  8234. @item dnn_backend
  8235. Specify which DNN backend to use for model loading and execution. This option accepts
  8236. only openvino now, tensorflow backends will be added.
  8237. @item model
  8238. Set path to model file specifying network architecture and its parameters.
  8239. Note that different backends use different file formats.
  8240. @item input
  8241. Set the input name of the dnn network.
  8242. @item output
  8243. Set the output name of the dnn network.
  8244. @item confidence
  8245. Set the confidence threshold (default: 0.5).
  8246. @item labels
  8247. Set path to label file specifying the mapping between label id and name.
  8248. Each label name is written in one line, tailing spaces and empty lines are skipped.
  8249. The first line is the name of label id 0,
  8250. and the second line is the name of label id 1, etc.
  8251. The label id is considered as name if the label file is not provided.
  8252. @item backend_configs
  8253. Set the configs to be passed into backend
  8254. For tensorflow backend, you can set its configs with @option{sess_config} options,
  8255. please use tools/python/tf_sess_config.py to get the configs for your system.
  8256. @end table
  8257. @section dnn_detect
  8258. Do object detection with deep neural networks.
  8259. The filter accepts the following options:
  8260. @table @option
  8261. @item dnn_backend
  8262. Specify which DNN backend to use for model loading and execution. This option accepts
  8263. only openvino now, tensorflow backends will be added.
  8264. @item model
  8265. Set path to model file specifying network architecture and its parameters.
  8266. Note that different backends use different file formats.
  8267. @item input
  8268. Set the input name of the dnn network.
  8269. @item output
  8270. Set the output name of the dnn network.
  8271. @item confidence
  8272. Set the confidence threshold (default: 0.5).
  8273. @item labels
  8274. Set path to label file specifying the mapping between label id and name.
  8275. Each label name is written in one line, tailing spaces and empty lines are skipped.
  8276. The first line is the name of label id 0 (usually it is 'background'),
  8277. and the second line is the name of label id 1, etc.
  8278. The label id is considered as name if the label file is not provided.
  8279. @item backend_configs
  8280. Set the configs to be passed into backend. To use async execution, set async (default: set).
  8281. Roll back to sync execution if the backend does not support async.
  8282. @end table
  8283. @anchor{dnn_processing}
  8284. @section dnn_processing
  8285. Do image processing with deep neural networks. It works together with another filter
  8286. which converts the pixel format of the Frame to what the dnn network requires.
  8287. The filter accepts the following options:
  8288. @table @option
  8289. @item dnn_backend
  8290. Specify which DNN backend to use for model loading and execution. This option accepts
  8291. the following values:
  8292. @table @samp
  8293. @item native
  8294. Native implementation of DNN loading and execution.
  8295. @item tensorflow
  8296. TensorFlow backend. To enable this backend you
  8297. need to install the TensorFlow for C library (see
  8298. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  8299. @code{--enable-libtensorflow}
  8300. @item openvino
  8301. OpenVINO backend. To enable this backend you
  8302. need to build and install the OpenVINO for C library (see
  8303. @url{https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md}) and configure FFmpeg with
  8304. @code{--enable-libopenvino} (--extra-cflags=-I... --extra-ldflags=-L... might
  8305. be needed if the header files and libraries are not installed into system path)
  8306. @end table
  8307. Default value is @samp{native}.
  8308. @item model
  8309. Set path to model file specifying network architecture and its parameters.
  8310. Note that different backends use different file formats. TensorFlow, OpenVINO and native
  8311. backend can load files for only its format.
  8312. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  8313. @item input
  8314. Set the input name of the dnn network.
  8315. @item output
  8316. Set the output name of the dnn network.
  8317. @item backend_configs
  8318. Set the configs to be passed into backend. To use async execution, set async (default: set).
  8319. Roll back to sync execution if the backend does not support async.
  8320. For tensorflow backend, you can set its configs with @option{sess_config} options,
  8321. please use tools/python/tf_sess_config.py to get the configs of TensorFlow backend for your system.
  8322. @end table
  8323. @subsection Examples
  8324. @itemize
  8325. @item
  8326. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  8327. @example
  8328. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  8329. @end example
  8330. @item
  8331. Halve the pixel value of the frame with format gray32f:
  8332. @example
  8333. 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
  8334. @end example
  8335. @item
  8336. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  8337. @example
  8338. ./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
  8339. @end example
  8340. @item
  8341. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported),
  8342. please use tools/python/tf_sess_config.py to get the configs of TensorFlow backend for your system.
  8343. @example
  8344. ./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
  8345. @end example
  8346. @end itemize
  8347. @section drawbox
  8348. Draw a colored box on the input image.
  8349. It accepts the following parameters:
  8350. @table @option
  8351. @item x
  8352. @item y
  8353. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  8354. @item width, w
  8355. @item height, h
  8356. The expressions which specify the width and height of the box; if 0 they are interpreted as
  8357. the input width and height. It defaults to 0.
  8358. @item color, c
  8359. Specify the color of the box to write. For the general syntax of this option,
  8360. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  8361. value @code{invert} is used, the box edge color is the same as the
  8362. video with inverted luma.
  8363. @item thickness, t
  8364. The expression which sets the thickness of the box edge.
  8365. A value of @code{fill} will create a filled box. Default value is @code{3}.
  8366. See below for the list of accepted constants.
  8367. @item replace
  8368. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  8369. will overwrite the video's color and alpha pixels.
  8370. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  8371. @end table
  8372. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  8373. following constants:
  8374. @table @option
  8375. @item dar
  8376. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  8377. @item hsub
  8378. @item vsub
  8379. horizontal and vertical chroma subsample values. For example for the
  8380. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8381. @item in_h, ih
  8382. @item in_w, iw
  8383. The input width and height.
  8384. @item sar
  8385. The input sample aspect ratio.
  8386. @item x
  8387. @item y
  8388. The x and y offset coordinates where the box is drawn.
  8389. @item w
  8390. @item h
  8391. The width and height of the drawn box.
  8392. @item box_source
  8393. Box source can be set as side_data_detection_bboxes if you want to use box data in
  8394. detection bboxes of side data.
  8395. If @var{box_source} is set, the @var{x}, @var{y}, @var{width} and @var{height} will be ignored and
  8396. still use box data in detection bboxes of side data. So please do not use this parameter if you were
  8397. not sure about the box source.
  8398. @item t
  8399. The thickness of the drawn box.
  8400. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  8401. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  8402. @end table
  8403. @subsection Examples
  8404. @itemize
  8405. @item
  8406. Draw a black box around the edge of the input image:
  8407. @example
  8408. drawbox
  8409. @end example
  8410. @item
  8411. Draw a box with color red and an opacity of 50%:
  8412. @example
  8413. drawbox=10:20:200:60:red@@0.5
  8414. @end example
  8415. The previous example can be specified as:
  8416. @example
  8417. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  8418. @end example
  8419. @item
  8420. Fill the box with pink color:
  8421. @example
  8422. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  8423. @end example
  8424. @item
  8425. Draw a 2-pixel red 2.40:1 mask:
  8426. @example
  8427. 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
  8428. @end example
  8429. @end itemize
  8430. @subsection Commands
  8431. This filter supports same commands as options.
  8432. The command accepts the same syntax of the corresponding option.
  8433. If the specified expression is not valid, it is kept at its current
  8434. value.
  8435. @anchor{drawgraph}
  8436. @section drawgraph
  8437. Draw a graph using input video metadata.
  8438. It accepts the following parameters:
  8439. @table @option
  8440. @item m1
  8441. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  8442. @item fg1
  8443. Set 1st foreground color expression.
  8444. @item m2
  8445. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  8446. @item fg2
  8447. Set 2nd foreground color expression.
  8448. @item m3
  8449. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  8450. @item fg3
  8451. Set 3rd foreground color expression.
  8452. @item m4
  8453. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  8454. @item fg4
  8455. Set 4th foreground color expression.
  8456. @item min
  8457. Set minimal value of metadata value.
  8458. @item max
  8459. Set maximal value of metadata value.
  8460. @item bg
  8461. Set graph background color. Default is white.
  8462. @item mode
  8463. Set graph mode.
  8464. Available values for mode is:
  8465. @table @samp
  8466. @item bar
  8467. @item dot
  8468. @item line
  8469. @end table
  8470. Default is @code{line}.
  8471. @item slide
  8472. Set slide mode.
  8473. Available values for slide is:
  8474. @table @samp
  8475. @item frame
  8476. Draw new frame when right border is reached.
  8477. @item replace
  8478. Replace old columns with new ones.
  8479. @item scroll
  8480. Scroll from right to left.
  8481. @item rscroll
  8482. Scroll from left to right.
  8483. @item picture
  8484. Draw single picture.
  8485. @end table
  8486. Default is @code{frame}.
  8487. @item size
  8488. Set size of graph video. For the syntax of this option, check the
  8489. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8490. The default value is @code{900x256}.
  8491. @item rate, r
  8492. Set the output frame rate. Default value is @code{25}.
  8493. The foreground color expressions can use the following variables:
  8494. @table @option
  8495. @item MIN
  8496. Minimal value of metadata value.
  8497. @item MAX
  8498. Maximal value of metadata value.
  8499. @item VAL
  8500. Current metadata key value.
  8501. @end table
  8502. The color is defined as 0xAABBGGRR.
  8503. @end table
  8504. Example using metadata from @ref{signalstats} filter:
  8505. @example
  8506. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  8507. @end example
  8508. Example using metadata from @ref{ebur128} filter:
  8509. @example
  8510. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  8511. @end example
  8512. @section drawgrid
  8513. Draw a grid on the input image.
  8514. It accepts the following parameters:
  8515. @table @option
  8516. @item x
  8517. @item y
  8518. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  8519. @item width, w
  8520. @item height, h
  8521. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  8522. input width and height, respectively, minus @code{thickness}, so image gets
  8523. framed. Default to 0.
  8524. @item color, c
  8525. Specify the color of the grid. For the general syntax of this option,
  8526. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  8527. value @code{invert} is used, the grid color is the same as the
  8528. video with inverted luma.
  8529. @item thickness, t
  8530. The expression which sets the thickness of the grid line. Default value is @code{1}.
  8531. See below for the list of accepted constants.
  8532. @item replace
  8533. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  8534. will overwrite the video's color and alpha pixels.
  8535. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  8536. @end table
  8537. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  8538. following constants:
  8539. @table @option
  8540. @item dar
  8541. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  8542. @item hsub
  8543. @item vsub
  8544. horizontal and vertical chroma subsample values. For example for the
  8545. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8546. @item in_h, ih
  8547. @item in_w, iw
  8548. The input grid cell width and height.
  8549. @item sar
  8550. The input sample aspect ratio.
  8551. @item x
  8552. @item y
  8553. The x and y coordinates of some point of grid intersection (meant to configure offset).
  8554. @item w
  8555. @item h
  8556. The width and height of the drawn cell.
  8557. @item t
  8558. The thickness of the drawn cell.
  8559. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  8560. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  8561. @end table
  8562. @subsection Examples
  8563. @itemize
  8564. @item
  8565. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  8566. @example
  8567. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  8568. @end example
  8569. @item
  8570. Draw a white 3x3 grid with an opacity of 50%:
  8571. @example
  8572. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  8573. @end example
  8574. @end itemize
  8575. @subsection Commands
  8576. This filter supports same commands as options.
  8577. The command accepts the same syntax of the corresponding option.
  8578. If the specified expression is not valid, it is kept at its current
  8579. value.
  8580. @anchor{drawtext}
  8581. @section drawtext
  8582. Draw a text string or text from a specified file on top of a video, using the
  8583. libfreetype library.
  8584. To enable compilation of this filter, you need to configure FFmpeg with
  8585. @code{--enable-libfreetype}.
  8586. To enable default font fallback and the @var{font} option you need to
  8587. configure FFmpeg with @code{--enable-libfontconfig}.
  8588. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  8589. @code{--enable-libfribidi}.
  8590. @subsection Syntax
  8591. It accepts the following parameters:
  8592. @table @option
  8593. @item box
  8594. Used to draw a box around text using the background color.
  8595. The value must be either 1 (enable) or 0 (disable).
  8596. The default value of @var{box} is 0.
  8597. @item boxborderw
  8598. Set the width of the border to be drawn around the box using @var{boxcolor}.
  8599. The default value of @var{boxborderw} is 0.
  8600. @item boxcolor
  8601. The color to be used for drawing box around text. For the syntax of this
  8602. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8603. The default value of @var{boxcolor} is "white".
  8604. @item line_spacing
  8605. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  8606. The default value of @var{line_spacing} is 0.
  8607. @item borderw
  8608. Set the width of the border to be drawn around the text using @var{bordercolor}.
  8609. The default value of @var{borderw} is 0.
  8610. @item bordercolor
  8611. Set the color to be used for drawing border around text. For the syntax of this
  8612. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8613. The default value of @var{bordercolor} is "black".
  8614. @item expansion
  8615. Select how the @var{text} is expanded. Can be either @code{none},
  8616. @code{strftime} (deprecated) or
  8617. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  8618. below for details.
  8619. @item basetime
  8620. Set a start time for the count. Value is in microseconds. Only applied
  8621. in the deprecated strftime expansion mode. To emulate in normal expansion
  8622. mode use the @code{pts} function, supplying the start time (in seconds)
  8623. as the second argument.
  8624. @item fix_bounds
  8625. If true, check and fix text coords to avoid clipping.
  8626. @item fontcolor
  8627. The color to be used for drawing fonts. For the syntax of this option, check
  8628. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8629. The default value of @var{fontcolor} is "black".
  8630. @item fontcolor_expr
  8631. String which is expanded the same way as @var{text} to obtain dynamic
  8632. @var{fontcolor} value. By default this option has empty value and is not
  8633. processed. When this option is set, it overrides @var{fontcolor} option.
  8634. @item font
  8635. The font family to be used for drawing text. By default Sans.
  8636. @item fontfile
  8637. The font file to be used for drawing text. The path must be included.
  8638. This parameter is mandatory if the fontconfig support is disabled.
  8639. @item alpha
  8640. Draw the text applying alpha blending. The value can
  8641. be a number between 0.0 and 1.0.
  8642. The expression accepts the same variables @var{x, y} as well.
  8643. The default value is 1.
  8644. Please see @var{fontcolor_expr}.
  8645. @item fontsize
  8646. The font size to be used for drawing text.
  8647. The default value of @var{fontsize} is 16.
  8648. @item text_shaping
  8649. If set to 1, attempt to shape the text (for example, reverse the order of
  8650. right-to-left text and join Arabic characters) before drawing it.
  8651. Otherwise, just draw the text exactly as given.
  8652. By default 1 (if supported).
  8653. @item ft_load_flags
  8654. The flags to be used for loading the fonts.
  8655. The flags map the corresponding flags supported by libfreetype, and are
  8656. a combination of the following values:
  8657. @table @var
  8658. @item default
  8659. @item no_scale
  8660. @item no_hinting
  8661. @item render
  8662. @item no_bitmap
  8663. @item vertical_layout
  8664. @item force_autohint
  8665. @item crop_bitmap
  8666. @item pedantic
  8667. @item ignore_global_advance_width
  8668. @item no_recurse
  8669. @item ignore_transform
  8670. @item monochrome
  8671. @item linear_design
  8672. @item no_autohint
  8673. @end table
  8674. Default value is "default".
  8675. For more information consult the documentation for the FT_LOAD_*
  8676. libfreetype flags.
  8677. @item shadowcolor
  8678. The color to be used for drawing a shadow behind the drawn text. For the
  8679. syntax of this option, check the @ref{color syntax,,"Color" section in the
  8680. ffmpeg-utils manual,ffmpeg-utils}.
  8681. The default value of @var{shadowcolor} is "black".
  8682. @item shadowx
  8683. @item shadowy
  8684. The x and y offsets for the text shadow position with respect to the
  8685. position of the text. They can be either positive or negative
  8686. values. The default value for both is "0".
  8687. @item start_number
  8688. The starting frame number for the n/frame_num variable. The default value
  8689. is "0".
  8690. @item tabsize
  8691. The size in number of spaces to use for rendering the tab.
  8692. Default value is 4.
  8693. @item timecode
  8694. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  8695. format. It can be used with or without text parameter. @var{timecode_rate}
  8696. option must be specified.
  8697. @item timecode_rate, rate, r
  8698. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  8699. integer. Minimum value is "1".
  8700. Drop-frame timecode is supported for frame rates 30 & 60.
  8701. @item tc24hmax
  8702. If set to 1, the output of the timecode option will wrap around at 24 hours.
  8703. Default is 0 (disabled).
  8704. @item text
  8705. The text string to be drawn. The text must be a sequence of UTF-8
  8706. encoded characters.
  8707. This parameter is mandatory if no file is specified with the parameter
  8708. @var{textfile}.
  8709. @item textfile
  8710. A text file containing text to be drawn. The text must be a sequence
  8711. of UTF-8 encoded characters.
  8712. This parameter is mandatory if no text string is specified with the
  8713. parameter @var{text}.
  8714. If both @var{text} and @var{textfile} are specified, an error is thrown.
  8715. @item text_source
  8716. Text source should be set as side_data_detection_bboxes if you want to use text data in
  8717. detection bboxes of side data.
  8718. If text source is set, @var{text} and @var{textfile} will be ignored and still use
  8719. text data in detection bboxes of side data. So please do not use this parameter
  8720. if you are not sure about the text source.
  8721. @item reload
  8722. The @var{textfile} will be reloaded at specified frame interval.
  8723. Be sure to update @var{textfile} atomically, or it may be read partially,
  8724. or even fail.
  8725. Range is 0 to INT_MAX. Default is 0.
  8726. @item x
  8727. @item y
  8728. The expressions which specify the offsets where text will be drawn
  8729. within the video frame. They are relative to the top/left border of the
  8730. output image.
  8731. The default value of @var{x} and @var{y} is "0".
  8732. See below for the list of accepted constants and functions.
  8733. @end table
  8734. The parameters for @var{x} and @var{y} are expressions containing the
  8735. following constants and functions:
  8736. @table @option
  8737. @item dar
  8738. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  8739. @item hsub
  8740. @item vsub
  8741. horizontal and vertical chroma subsample values. For example for the
  8742. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8743. @item line_h, lh
  8744. the height of each text line
  8745. @item main_h, h, H
  8746. the input height
  8747. @item main_w, w, W
  8748. the input width
  8749. @item max_glyph_a, ascent
  8750. the maximum distance from the baseline to the highest/upper grid
  8751. coordinate used to place a glyph outline point, for all the rendered
  8752. glyphs.
  8753. It is a positive value, due to the grid's orientation with the Y axis
  8754. upwards.
  8755. @item max_glyph_d, descent
  8756. the maximum distance from the baseline to the lowest grid coordinate
  8757. used to place a glyph outline point, for all the rendered glyphs.
  8758. This is a negative value, due to the grid's orientation, with the Y axis
  8759. upwards.
  8760. @item max_glyph_h
  8761. maximum glyph height, that is the maximum height for all the glyphs
  8762. contained in the rendered text, it is equivalent to @var{ascent} -
  8763. @var{descent}.
  8764. @item max_glyph_w
  8765. maximum glyph width, that is the maximum width for all the glyphs
  8766. contained in the rendered text
  8767. @item n
  8768. the number of input frame, starting from 0
  8769. @item rand(min, max)
  8770. return a random number included between @var{min} and @var{max}
  8771. @item sar
  8772. The input sample aspect ratio.
  8773. @item t
  8774. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8775. @item text_h, th
  8776. the height of the rendered text
  8777. @item text_w, tw
  8778. the width of the rendered text
  8779. @item x
  8780. @item y
  8781. the x and y offset coordinates where the text is drawn.
  8782. These parameters allow the @var{x} and @var{y} expressions to refer
  8783. to each other, so you can for example specify @code{y=x/dar}.
  8784. @item pict_type
  8785. A one character description of the current frame's picture type.
  8786. @item pkt_pos
  8787. The current packet's position in the input file or stream
  8788. (in bytes, from the start of the input). A value of -1 indicates
  8789. this info is not available.
  8790. @item pkt_duration
  8791. The current packet's duration, in seconds.
  8792. @item pkt_size
  8793. The current packet's size (in bytes).
  8794. @end table
  8795. @anchor{drawtext_expansion}
  8796. @subsection Text expansion
  8797. If @option{expansion} is set to @code{strftime},
  8798. the filter recognizes strftime() sequences in the provided text and
  8799. expands them accordingly. Check the documentation of strftime(). This
  8800. feature is deprecated.
  8801. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  8802. If @option{expansion} is set to @code{normal} (which is the default),
  8803. the following expansion mechanism is used.
  8804. The backslash character @samp{\}, followed by any character, always expands to
  8805. the second character.
  8806. Sequences of the form @code{%@{...@}} are expanded. The text between the
  8807. braces is a function name, possibly followed by arguments separated by ':'.
  8808. If the arguments contain special characters or delimiters (':' or '@}'),
  8809. they should be escaped.
  8810. Note that they probably must also be escaped as the value for the
  8811. @option{text} option in the filter argument string and as the filter
  8812. argument in the filtergraph description, and possibly also for the shell,
  8813. that makes up to four levels of escaping; using a text file avoids these
  8814. problems.
  8815. The following functions are available:
  8816. @table @command
  8817. @item expr, e
  8818. The expression evaluation result.
  8819. It must take one argument specifying the expression to be evaluated,
  8820. which accepts the same constants and functions as the @var{x} and
  8821. @var{y} values. Note that not all constants should be used, for
  8822. example the text size is not known when evaluating the expression, so
  8823. the constants @var{text_w} and @var{text_h} will have an undefined
  8824. value.
  8825. @item expr_int_format, eif
  8826. Evaluate the expression's value and output as formatted integer.
  8827. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  8828. The second argument specifies the output format. Allowed values are @samp{x},
  8829. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  8830. @code{printf} function.
  8831. The third parameter is optional and sets the number of positions taken by the output.
  8832. It can be used to add padding with zeros from the left.
  8833. @item gmtime
  8834. The time at which the filter is running, expressed in UTC.
  8835. It can accept an argument: a strftime() format string.
  8836. The format string is extended to support the variable @var{%[1-6]N}
  8837. which prints fractions of the second with optionally specified number of digits.
  8838. @item localtime
  8839. The time at which the filter is running, expressed in the local time zone.
  8840. It can accept an argument: a strftime() format string.
  8841. The format string is extended to support the variable @var{%[1-6]N}
  8842. which prints fractions of the second with optionally specified number of digits.
  8843. @item metadata
  8844. Frame metadata. Takes one or two arguments.
  8845. The first argument is mandatory and specifies the metadata key.
  8846. The second argument is optional and specifies a default value, used when the
  8847. metadata key is not found or empty.
  8848. Available metadata can be identified by inspecting entries
  8849. starting with TAG included within each frame section
  8850. printed by running @code{ffprobe -show_frames}.
  8851. String metadata generated in filters leading to
  8852. the drawtext filter are also available.
  8853. @item n, frame_num
  8854. The frame number, starting from 0.
  8855. @item pict_type
  8856. A one character description of the current picture type.
  8857. @item pts
  8858. The timestamp of the current frame.
  8859. It can take up to three arguments.
  8860. The first argument is the format of the timestamp; it defaults to @code{flt}
  8861. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  8862. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  8863. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  8864. @code{localtime} stands for the timestamp of the frame formatted as
  8865. local time zone time.
  8866. The second argument is an offset added to the timestamp.
  8867. If the format is set to @code{hms}, a third argument @code{24HH} may be
  8868. supplied to present the hour part of the formatted timestamp in 24h format
  8869. (00-23).
  8870. If the format is set to @code{localtime} or @code{gmtime},
  8871. a third argument may be supplied: a strftime() format string.
  8872. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  8873. @end table
  8874. @subsection Commands
  8875. This filter supports altering parameters via commands:
  8876. @table @option
  8877. @item reinit
  8878. Alter existing filter parameters.
  8879. Syntax for the argument is the same as for filter invocation, e.g.
  8880. @example
  8881. fontsize=56:fontcolor=green:text='Hello World'
  8882. @end example
  8883. Full filter invocation with sendcmd would look like this:
  8884. @example
  8885. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  8886. @end example
  8887. @end table
  8888. If the entire argument can't be parsed or applied as valid values then the filter will
  8889. continue with its existing parameters.
  8890. @subsection Examples
  8891. @itemize
  8892. @item
  8893. Draw "Test Text" with font FreeSerif, using the default values for the
  8894. optional parameters.
  8895. @example
  8896. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  8897. @end example
  8898. @item
  8899. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  8900. and y=50 (counting from the top-left corner of the screen), text is
  8901. yellow with a red box around it. Both the text and the box have an
  8902. opacity of 20%.
  8903. @example
  8904. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  8905. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  8906. @end example
  8907. Note that the double quotes are not necessary if spaces are not used
  8908. within the parameter list.
  8909. @item
  8910. Show the text at the center of the video frame:
  8911. @example
  8912. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  8913. @end example
  8914. @item
  8915. Show the text at a random position, switching to a new position every 30 seconds:
  8916. @example
  8917. 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)"
  8918. @end example
  8919. @item
  8920. Show a text line sliding from right to left in the last row of the video
  8921. frame. The file @file{LONG_LINE} is assumed to contain a single line
  8922. with no newlines.
  8923. @example
  8924. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  8925. @end example
  8926. @item
  8927. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  8928. @example
  8929. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  8930. @end example
  8931. @item
  8932. Draw a single green letter "g", at the center of the input video.
  8933. The glyph baseline is placed at half screen height.
  8934. @example
  8935. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  8936. @end example
  8937. @item
  8938. Show text for 1 second every 3 seconds:
  8939. @example
  8940. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  8941. @end example
  8942. @item
  8943. Use fontconfig to set the font. Note that the colons need to be escaped.
  8944. @example
  8945. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  8946. @end example
  8947. @item
  8948. Draw "Test Text" with font size dependent on height of the video.
  8949. @example
  8950. drawtext="text='Test Text': fontsize=h/30: x=(w-text_w)/2: y=(h-text_h*2)"
  8951. @end example
  8952. @item
  8953. Print the date of a real-time encoding (see strftime(3)):
  8954. @example
  8955. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  8956. @end example
  8957. @item
  8958. Show text fading in and out (appearing/disappearing):
  8959. @example
  8960. #!/bin/sh
  8961. DS=1.0 # display start
  8962. DE=10.0 # display end
  8963. FID=1.5 # fade in duration
  8964. FOD=5 # fade out duration
  8965. 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 @}"
  8966. @end example
  8967. @item
  8968. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  8969. and the @option{fontsize} value are included in the @option{y} offset.
  8970. @example
  8971. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  8972. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  8973. @end example
  8974. @item
  8975. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  8976. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  8977. must have option @option{-export_path_metadata 1} for the special metadata fields
  8978. to be available for filters.
  8979. @example
  8980. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  8981. @end example
  8982. @end itemize
  8983. For more information about libfreetype, check:
  8984. @url{http://www.freetype.org/}.
  8985. For more information about fontconfig, check:
  8986. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  8987. For more information about libfribidi, check:
  8988. @url{http://fribidi.org/}.
  8989. @section edgedetect
  8990. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  8991. The filter accepts the following options:
  8992. @table @option
  8993. @item low
  8994. @item high
  8995. Set low and high threshold values used by the Canny thresholding
  8996. algorithm.
  8997. The high threshold selects the "strong" edge pixels, which are then
  8998. connected through 8-connectivity with the "weak" edge pixels selected
  8999. by the low threshold.
  9000. @var{low} and @var{high} threshold values must be chosen in the range
  9001. [0,1], and @var{low} should be lesser or equal to @var{high}.
  9002. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  9003. is @code{50/255}.
  9004. @item mode
  9005. Define the drawing mode.
  9006. @table @samp
  9007. @item wires
  9008. Draw white/gray wires on black background.
  9009. @item colormix
  9010. Mix the colors to create a paint/cartoon effect.
  9011. @item canny
  9012. Apply Canny edge detector on all selected planes.
  9013. @end table
  9014. Default value is @var{wires}.
  9015. @item planes
  9016. Select planes for filtering. By default all available planes are filtered.
  9017. @end table
  9018. @subsection Examples
  9019. @itemize
  9020. @item
  9021. Standard edge detection with custom values for the hysteresis thresholding:
  9022. @example
  9023. edgedetect=low=0.1:high=0.4
  9024. @end example
  9025. @item
  9026. Painting effect without thresholding:
  9027. @example
  9028. edgedetect=mode=colormix:high=0
  9029. @end example
  9030. @end itemize
  9031. @section elbg
  9032. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  9033. For each input image, the filter will compute the optimal mapping from
  9034. the input to the output given the codebook length, that is the number
  9035. of distinct output colors.
  9036. This filter accepts the following options.
  9037. @table @option
  9038. @item codebook_length, l
  9039. Set codebook length. The value must be a positive integer, and
  9040. represents the number of distinct output colors. Default value is 256.
  9041. @item nb_steps, n
  9042. Set the maximum number of iterations to apply for computing the optimal
  9043. mapping. The higher the value the better the result and the higher the
  9044. computation time. Default value is 1.
  9045. @item seed, s
  9046. Set a random seed, must be an integer included between 0 and
  9047. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  9048. will try to use a good random seed on a best effort basis.
  9049. @item pal8
  9050. Set pal8 output pixel format. This option does not work with codebook
  9051. length greater than 256. Default is disabled.
  9052. @item use_alpha
  9053. Include alpha values in the quantization calculation. Allows creating
  9054. palettized output images (e.g. PNG8) with multiple alpha smooth blending.
  9055. @end table
  9056. @section entropy
  9057. Measure graylevel entropy in histogram of color channels of video frames.
  9058. It accepts the following parameters:
  9059. @table @option
  9060. @item mode
  9061. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  9062. @var{diff} mode measures entropy of histogram delta values, absolute differences
  9063. between neighbour histogram values.
  9064. @end table
  9065. @section epx
  9066. Apply the EPX magnification filter which is designed for pixel art.
  9067. It accepts the following option:
  9068. @table @option
  9069. @item n
  9070. Set the scaling dimension: @code{2} for @code{2xEPX}, @code{3} for
  9071. @code{3xEPX}.
  9072. Default is @code{3}.
  9073. @end table
  9074. @section eq
  9075. Set brightness, contrast, saturation and approximate gamma adjustment.
  9076. The filter accepts the following options:
  9077. @table @option
  9078. @item contrast
  9079. Set the contrast expression. The value must be a float value in range
  9080. @code{-1000.0} to @code{1000.0}. The default value is "1".
  9081. @item brightness
  9082. Set the brightness expression. The value must be a float value in
  9083. range @code{-1.0} to @code{1.0}. The default value is "0".
  9084. @item saturation
  9085. Set the saturation expression. The value must be a float in
  9086. range @code{0.0} to @code{3.0}. The default value is "1".
  9087. @item gamma
  9088. Set the gamma expression. The value must be a float in range
  9089. @code{0.1} to @code{10.0}. The default value is "1".
  9090. @item gamma_r
  9091. Set the gamma expression for red. The value must be a float in
  9092. range @code{0.1} to @code{10.0}. The default value is "1".
  9093. @item gamma_g
  9094. Set the gamma expression for green. The value must be a float in range
  9095. @code{0.1} to @code{10.0}. The default value is "1".
  9096. @item gamma_b
  9097. Set the gamma expression for blue. The value must be a float in range
  9098. @code{0.1} to @code{10.0}. The default value is "1".
  9099. @item gamma_weight
  9100. Set the gamma weight expression. It can be used to reduce the effect
  9101. of a high gamma value on bright image areas, e.g. keep them from
  9102. getting overamplified and just plain white. The value must be a float
  9103. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  9104. gamma correction all the way down while @code{1.0} leaves it at its
  9105. full strength. Default is "1".
  9106. @item eval
  9107. Set when the expressions for brightness, contrast, saturation and
  9108. gamma expressions are evaluated.
  9109. It accepts the following values:
  9110. @table @samp
  9111. @item init
  9112. only evaluate expressions once during the filter initialization or
  9113. when a command is processed
  9114. @item frame
  9115. evaluate expressions for each incoming frame
  9116. @end table
  9117. Default value is @samp{init}.
  9118. @end table
  9119. The expressions accept the following parameters:
  9120. @table @option
  9121. @item n
  9122. frame count of the input frame starting from 0
  9123. @item pos
  9124. byte position of the corresponding packet in the input file, NAN if
  9125. unspecified
  9126. @item r
  9127. frame rate of the input video, NAN if the input frame rate is unknown
  9128. @item t
  9129. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9130. @end table
  9131. @subsection Commands
  9132. The filter supports the following commands:
  9133. @table @option
  9134. @item contrast
  9135. Set the contrast expression.
  9136. @item brightness
  9137. Set the brightness expression.
  9138. @item saturation
  9139. Set the saturation expression.
  9140. @item gamma
  9141. Set the gamma expression.
  9142. @item gamma_r
  9143. Set the gamma_r expression.
  9144. @item gamma_g
  9145. Set gamma_g expression.
  9146. @item gamma_b
  9147. Set gamma_b expression.
  9148. @item gamma_weight
  9149. Set gamma_weight expression.
  9150. The command accepts the same syntax of the corresponding option.
  9151. If the specified expression is not valid, it is kept at its current
  9152. value.
  9153. @end table
  9154. @anchor{erosion}
  9155. @section erosion
  9156. Apply erosion effect to the video.
  9157. This filter replaces the pixel by the local(3x3) minimum.
  9158. It accepts the following options:
  9159. @table @option
  9160. @item threshold0
  9161. @item threshold1
  9162. @item threshold2
  9163. @item threshold3
  9164. Limit the maximum change for each plane, default is 65535.
  9165. If 0, plane will remain unchanged.
  9166. @item coordinates
  9167. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  9168. pixels are used.
  9169. Flags to local 3x3 coordinates maps like this:
  9170. 1 2 3
  9171. 4 5
  9172. 6 7 8
  9173. @end table
  9174. @subsection Commands
  9175. This filter supports the all above options as @ref{commands}.
  9176. @section estdif
  9177. Deinterlace the input video ("estdif" stands for "Edge Slope
  9178. Tracing Deinterlacing Filter").
  9179. Spatial only filter that uses edge slope tracing algorithm
  9180. to interpolate missing lines.
  9181. It accepts the following parameters:
  9182. @table @option
  9183. @item mode
  9184. The interlacing mode to adopt. It accepts one of the following values:
  9185. @table @option
  9186. @item frame
  9187. Output one frame for each frame.
  9188. @item field
  9189. Output one frame for each field.
  9190. @end table
  9191. The default value is @code{field}.
  9192. @item parity
  9193. The picture field parity assumed for the input interlaced video. It accepts one
  9194. of the following values:
  9195. @table @option
  9196. @item tff
  9197. Assume the top field is first.
  9198. @item bff
  9199. Assume the bottom field is first.
  9200. @item auto
  9201. Enable automatic detection of field parity.
  9202. @end table
  9203. The default value is @code{auto}.
  9204. If the interlacing is unknown or the decoder does not export this information,
  9205. top field first will be assumed.
  9206. @item deint
  9207. Specify which frames to deinterlace. Accepts one of the following
  9208. values:
  9209. @table @option
  9210. @item all
  9211. Deinterlace all frames.
  9212. @item interlaced
  9213. Only deinterlace frames marked as interlaced.
  9214. @end table
  9215. The default value is @code{all}.
  9216. @item rslope
  9217. Specify the search radius for edge slope tracing. Default value is 1.
  9218. Allowed range is from 1 to 15.
  9219. @item redge
  9220. Specify the search radius for best edge matching. Default value is 2.
  9221. Allowed range is from 0 to 15.
  9222. @item ecost
  9223. Specify the edge cost for edge matching. Default value is 0.03125.
  9224. Allowed range is from 0 to 1.
  9225. @item mcost
  9226. Specify the middle cost for edge matching. Default value is 0.5.
  9227. Allowed range is from 0 to 1.
  9228. @item dcost
  9229. Specify the distance cost for edge matching. Default value is 0.5.
  9230. Allowed range is from 0 to 1.
  9231. @item interp
  9232. Specify the interpolation used. Default is 4-point interpolation. It accepts one
  9233. of the following values:
  9234. @table @option
  9235. @item 2p
  9236. Two-point interpolation.
  9237. @item 4p
  9238. Four-point interpolation.
  9239. @item 6p
  9240. Six-point interpolation.
  9241. @end table
  9242. @end table
  9243. @subsection Commands
  9244. This filter supports same @ref{commands} as options.
  9245. @section exposure
  9246. Adjust exposure of the video stream.
  9247. The filter accepts the following options:
  9248. @table @option
  9249. @item exposure
  9250. Set the exposure correction in EV. Allowed range is from -3.0 to 3.0 EV
  9251. Default value is 0 EV.
  9252. @item black
  9253. Set the black level correction. Allowed range is from -1.0 to 1.0.
  9254. Default value is 0.
  9255. @end table
  9256. @subsection Commands
  9257. This filter supports same @ref{commands} as options.
  9258. @section extractplanes
  9259. Extract color channel components from input video stream into
  9260. separate grayscale video streams.
  9261. The filter accepts the following option:
  9262. @table @option
  9263. @item planes
  9264. Set plane(s) to extract.
  9265. Available values for planes are:
  9266. @table @samp
  9267. @item y
  9268. @item u
  9269. @item v
  9270. @item a
  9271. @item r
  9272. @item g
  9273. @item b
  9274. @end table
  9275. Choosing planes not available in the input will result in an error.
  9276. That means you cannot select @code{r}, @code{g}, @code{b} planes
  9277. with @code{y}, @code{u}, @code{v} planes at same time.
  9278. @end table
  9279. @subsection Examples
  9280. @itemize
  9281. @item
  9282. Extract luma, u and v color channel component from input video frame
  9283. into 3 grayscale outputs:
  9284. @example
  9285. 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
  9286. @end example
  9287. @end itemize
  9288. @section fade
  9289. Apply a fade-in/out effect to the input video.
  9290. It accepts the following parameters:
  9291. @table @option
  9292. @item type, t
  9293. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  9294. effect.
  9295. Default is @code{in}.
  9296. @item start_frame, s
  9297. Specify the number of the frame to start applying the fade
  9298. effect at. Default is 0.
  9299. @item nb_frames, n
  9300. The number of frames that the fade effect lasts. At the end of the
  9301. fade-in effect, the output video will have the same intensity as the input video.
  9302. At the end of the fade-out transition, the output video will be filled with the
  9303. selected @option{color}.
  9304. Default is 25.
  9305. @item alpha
  9306. If set to 1, fade only alpha channel, if one exists on the input.
  9307. Default value is 0.
  9308. @item start_time, st
  9309. Specify the timestamp (in seconds) of the frame to start to apply the fade
  9310. effect. If both start_frame and start_time are specified, the fade will start at
  9311. whichever comes last. Default is 0.
  9312. @item duration, d
  9313. The number of seconds for which the fade effect has to last. At the end of the
  9314. fade-in effect the output video will have the same intensity as the input video,
  9315. at the end of the fade-out transition the output video will be filled with the
  9316. selected @option{color}.
  9317. If both duration and nb_frames are specified, duration is used. Default is 0
  9318. (nb_frames is used by default).
  9319. @item color, c
  9320. Specify the color of the fade. Default is "black".
  9321. @end table
  9322. @subsection Examples
  9323. @itemize
  9324. @item
  9325. Fade in the first 30 frames of video:
  9326. @example
  9327. fade=in:0:30
  9328. @end example
  9329. The command above is equivalent to:
  9330. @example
  9331. fade=t=in:s=0:n=30
  9332. @end example
  9333. @item
  9334. Fade out the last 45 frames of a 200-frame video:
  9335. @example
  9336. fade=out:155:45
  9337. fade=type=out:start_frame=155:nb_frames=45
  9338. @end example
  9339. @item
  9340. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  9341. @example
  9342. fade=in:0:25, fade=out:975:25
  9343. @end example
  9344. @item
  9345. Make the first 5 frames yellow, then fade in from frame 5-24:
  9346. @example
  9347. fade=in:5:20:color=yellow
  9348. @end example
  9349. @item
  9350. Fade in alpha over first 25 frames of video:
  9351. @example
  9352. fade=in:0:25:alpha=1
  9353. @end example
  9354. @item
  9355. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  9356. @example
  9357. fade=t=in:st=5.5:d=0.5
  9358. @end example
  9359. @end itemize
  9360. @section feedback
  9361. Apply feedback video filter.
  9362. This filter pass cropped input frames to 2nd output.
  9363. From there it can be filtered with other video filters.
  9364. After filter receives frame from 2nd input, that frame
  9365. is combined on top of original frame from 1st input and passed
  9366. to 1st output.
  9367. The typical usage is filter only part of frame.
  9368. The filter accepts the following options:
  9369. @table @option
  9370. @item x
  9371. @item y
  9372. Set the top left crop position.
  9373. @item w
  9374. @item h
  9375. Set the crop size.
  9376. @end table
  9377. @subsection Examples
  9378. @itemize
  9379. @item
  9380. Blur only top left rectangular part of video frame size 100x100 with gblur filter.
  9381. @example
  9382. [in][blurin]feedback=x=0:y=0:w=100:h=100[out][blurout];[blurout]gblur=8[blurin]
  9383. @end example
  9384. @item
  9385. Draw black box on top left part of video frame of size 100x100 with drawbox filter.
  9386. @example
  9387. [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]
  9388. @end example
  9389. @end itemize
  9390. @section fftdnoiz
  9391. Denoise frames using 3D FFT (frequency domain filtering).
  9392. The filter accepts the following options:
  9393. @table @option
  9394. @item sigma
  9395. Set the noise sigma constant. This sets denoising strength.
  9396. Default value is 1. Allowed range is from 0 to 30.
  9397. Using very high sigma with low overlap may give blocking artifacts.
  9398. @item amount
  9399. Set amount of denoising. By default all detected noise is reduced.
  9400. Default value is 1. Allowed range is from 0 to 1.
  9401. @item block
  9402. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  9403. Actual size of block in pixels is 2 to power of @var{block}, so by default
  9404. block size in pixels is 2^4 which is 16.
  9405. @item overlap
  9406. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  9407. @item prev
  9408. Set number of previous frames to use for denoising. By default is set to 0.
  9409. @item next
  9410. Set number of next frames to to use for denoising. By default is set to 0.
  9411. @item planes
  9412. Set planes which will be filtered, by default are all available filtered
  9413. except alpha.
  9414. @end table
  9415. @section fftfilt
  9416. Apply arbitrary expressions to samples in frequency domain
  9417. @table @option
  9418. @item dc_Y
  9419. Adjust the dc value (gain) of the luma plane of the image. The filter
  9420. accepts an integer value in range @code{0} to @code{1000}. The default
  9421. value is set to @code{0}.
  9422. @item dc_U
  9423. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  9424. filter accepts an integer value in range @code{0} to @code{1000}. The
  9425. default value is set to @code{0}.
  9426. @item dc_V
  9427. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  9428. filter accepts an integer value in range @code{0} to @code{1000}. The
  9429. default value is set to @code{0}.
  9430. @item weight_Y
  9431. Set the frequency domain weight expression for the luma plane.
  9432. @item weight_U
  9433. Set the frequency domain weight expression for the 1st chroma plane.
  9434. @item weight_V
  9435. Set the frequency domain weight expression for the 2nd chroma plane.
  9436. @item eval
  9437. Set when the expressions are evaluated.
  9438. It accepts the following values:
  9439. @table @samp
  9440. @item init
  9441. Only evaluate expressions once during the filter initialization.
  9442. @item frame
  9443. Evaluate expressions for each incoming frame.
  9444. @end table
  9445. Default value is @samp{init}.
  9446. The filter accepts the following variables:
  9447. @item X
  9448. @item Y
  9449. The coordinates of the current sample.
  9450. @item W
  9451. @item H
  9452. The width and height of the image.
  9453. @item N
  9454. The number of input frame, starting from 0.
  9455. @item WS
  9456. @item HS
  9457. The size of FFT array for horizontal and vertical processing.
  9458. @end table
  9459. @subsection Examples
  9460. @itemize
  9461. @item
  9462. High-pass:
  9463. @example
  9464. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  9465. @end example
  9466. @item
  9467. Low-pass:
  9468. @example
  9469. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  9470. @end example
  9471. @item
  9472. Sharpen:
  9473. @example
  9474. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  9475. @end example
  9476. @item
  9477. Blur:
  9478. @example
  9479. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  9480. @end example
  9481. @end itemize
  9482. @section field
  9483. Extract a single field from an interlaced image using stride
  9484. arithmetic to avoid wasting CPU time. The output frames are marked as
  9485. non-interlaced.
  9486. The filter accepts the following options:
  9487. @table @option
  9488. @item type
  9489. Specify whether to extract the top (if the value is @code{0} or
  9490. @code{top}) or the bottom field (if the value is @code{1} or
  9491. @code{bottom}).
  9492. @end table
  9493. @section fieldhint
  9494. Create new frames by copying the top and bottom fields from surrounding frames
  9495. supplied as numbers by the hint file.
  9496. @table @option
  9497. @item hint
  9498. Set file containing hints: absolute/relative frame numbers.
  9499. There must be one line for each frame in a clip. Each line must contain two
  9500. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  9501. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  9502. is current frame number for @code{absolute} mode or out of [-1, 1] range
  9503. for @code{relative} mode. First number tells from which frame to pick up top
  9504. field and second number tells from which frame to pick up bottom field.
  9505. If optionally followed by @code{+} output frame will be marked as interlaced,
  9506. else if followed by @code{-} output frame will be marked as progressive, else
  9507. it will be marked same as input frame.
  9508. If optionally followed by @code{t} output frame will use only top field, or in
  9509. case of @code{b} it will use only bottom field.
  9510. If line starts with @code{#} or @code{;} that line is skipped.
  9511. @item mode
  9512. Can be item @code{absolute} or @code{relative} or @code{pattern}. Default is @code{absolute}.
  9513. The @code{pattern} mode is same as @code{relative} mode, except at last entry of file if there
  9514. are more frames to process than @code{hint} file is seek back to start.
  9515. @end table
  9516. Example of first several lines of @code{hint} file for @code{relative} mode:
  9517. @example
  9518. 0,0 - # first frame
  9519. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  9520. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  9521. 1,0 -
  9522. 0,0 -
  9523. 0,0 -
  9524. 1,0 -
  9525. 1,0 -
  9526. 1,0 -
  9527. 0,0 -
  9528. 0,0 -
  9529. 1,0 -
  9530. 1,0 -
  9531. 1,0 -
  9532. 0,0 -
  9533. @end example
  9534. @section fieldmatch
  9535. Field matching filter for inverse telecine. It is meant to reconstruct the
  9536. progressive frames from a telecined stream. The filter does not drop duplicated
  9537. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  9538. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  9539. The separation of the field matching and the decimation is notably motivated by
  9540. the possibility of inserting a de-interlacing filter fallback between the two.
  9541. If the source has mixed telecined and real interlaced content,
  9542. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  9543. But these remaining combed frames will be marked as interlaced, and thus can be
  9544. de-interlaced by a later filter such as @ref{yadif} before decimation.
  9545. In addition to the various configuration options, @code{fieldmatch} can take an
  9546. optional second stream, activated through the @option{ppsrc} option. If
  9547. enabled, the frames reconstruction will be based on the fields and frames from
  9548. this second stream. This allows the first input to be pre-processed in order to
  9549. help the various algorithms of the filter, while keeping the output lossless
  9550. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  9551. or brightness/contrast adjustments can help.
  9552. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  9553. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  9554. which @code{fieldmatch} is based on. While the semantic and usage are very
  9555. close, some behaviour and options names can differ.
  9556. The @ref{decimate} filter currently only works for constant frame rate input.
  9557. If your input has mixed telecined (30fps) and progressive content with a lower
  9558. framerate like 24fps use the following filterchain to produce the necessary cfr
  9559. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  9560. The filter accepts the following options:
  9561. @table @option
  9562. @item order
  9563. Specify the assumed field order of the input stream. Available values are:
  9564. @table @samp
  9565. @item auto
  9566. Auto detect parity (use FFmpeg's internal parity value).
  9567. @item bff
  9568. Assume bottom field first.
  9569. @item tff
  9570. Assume top field first.
  9571. @end table
  9572. Note that it is sometimes recommended not to trust the parity announced by the
  9573. stream.
  9574. Default value is @var{auto}.
  9575. @item mode
  9576. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  9577. sense that it won't risk creating jerkiness due to duplicate frames when
  9578. possible, but if there are bad edits or blended fields it will end up
  9579. outputting combed frames when a good match might actually exist. On the other
  9580. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  9581. but will almost always find a good frame if there is one. The other values are
  9582. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  9583. jerkiness and creating duplicate frames versus finding good matches in sections
  9584. with bad edits, orphaned fields, blended fields, etc.
  9585. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  9586. Available values are:
  9587. @table @samp
  9588. @item pc
  9589. 2-way matching (p/c)
  9590. @item pc_n
  9591. 2-way matching, and trying 3rd match if still combed (p/c + n)
  9592. @item pc_u
  9593. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  9594. @item pc_n_ub
  9595. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  9596. still combed (p/c + n + u/b)
  9597. @item pcn
  9598. 3-way matching (p/c/n)
  9599. @item pcn_ub
  9600. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  9601. detected as combed (p/c/n + u/b)
  9602. @end table
  9603. The parenthesis at the end indicate the matches that would be used for that
  9604. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  9605. @var{top}).
  9606. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  9607. the slowest.
  9608. Default value is @var{pc_n}.
  9609. @item ppsrc
  9610. Mark the main input stream as a pre-processed input, and enable the secondary
  9611. input stream as the clean source to pick the fields from. See the filter
  9612. introduction for more details. It is similar to the @option{clip2} feature from
  9613. VFM/TFM.
  9614. Default value is @code{0} (disabled).
  9615. @item field
  9616. Set the field to match from. It is recommended to set this to the same value as
  9617. @option{order} unless you experience matching failures with that setting. In
  9618. certain circumstances changing the field that is used to match from can have a
  9619. large impact on matching performance. Available values are:
  9620. @table @samp
  9621. @item auto
  9622. Automatic (same value as @option{order}).
  9623. @item bottom
  9624. Match from the bottom field.
  9625. @item top
  9626. Match from the top field.
  9627. @end table
  9628. Default value is @var{auto}.
  9629. @item mchroma
  9630. Set whether or not chroma is included during the match comparisons. In most
  9631. cases it is recommended to leave this enabled. You should set this to @code{0}
  9632. only if your clip has bad chroma problems such as heavy rainbowing or other
  9633. artifacts. Setting this to @code{0} could also be used to speed things up at
  9634. the cost of some accuracy.
  9635. Default value is @code{1}.
  9636. @item y0
  9637. @item y1
  9638. These define an exclusion band which excludes the lines between @option{y0} and
  9639. @option{y1} from being included in the field matching decision. An exclusion
  9640. band can be used to ignore subtitles, a logo, or other things that may
  9641. interfere with the matching. @option{y0} sets the starting scan line and
  9642. @option{y1} sets the ending line; all lines in between @option{y0} and
  9643. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  9644. @option{y0} and @option{y1} to the same value will disable the feature.
  9645. @option{y0} and @option{y1} defaults to @code{0}.
  9646. @item scthresh
  9647. Set the scene change detection threshold as a percentage of maximum change on
  9648. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  9649. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  9650. @option{scthresh} is @code{[0.0, 100.0]}.
  9651. Default value is @code{12.0}.
  9652. @item combmatch
  9653. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  9654. account the combed scores of matches when deciding what match to use as the
  9655. final match. Available values are:
  9656. @table @samp
  9657. @item none
  9658. No final matching based on combed scores.
  9659. @item sc
  9660. Combed scores are only used when a scene change is detected.
  9661. @item full
  9662. Use combed scores all the time.
  9663. @end table
  9664. Default is @var{sc}.
  9665. @item combdbg
  9666. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  9667. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  9668. Available values are:
  9669. @table @samp
  9670. @item none
  9671. No forced calculation.
  9672. @item pcn
  9673. Force p/c/n calculations.
  9674. @item pcnub
  9675. Force p/c/n/u/b calculations.
  9676. @end table
  9677. Default value is @var{none}.
  9678. @item cthresh
  9679. This is the area combing threshold used for combed frame detection. This
  9680. essentially controls how "strong" or "visible" combing must be to be detected.
  9681. Larger values mean combing must be more visible and smaller values mean combing
  9682. can be less visible or strong and still be detected. Valid settings are from
  9683. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  9684. be detected as combed). This is basically a pixel difference value. A good
  9685. range is @code{[8, 12]}.
  9686. Default value is @code{9}.
  9687. @item chroma
  9688. Sets whether or not chroma is considered in the combed frame decision. Only
  9689. disable this if your source has chroma problems (rainbowing, etc.) that are
  9690. causing problems for the combed frame detection with chroma enabled. Actually,
  9691. using @option{chroma}=@var{0} is usually more reliable, except for the case
  9692. where there is chroma only combing in the source.
  9693. Default value is @code{0}.
  9694. @item blockx
  9695. @item blocky
  9696. Respectively set the x-axis and y-axis size of the window used during combed
  9697. frame detection. This has to do with the size of the area in which
  9698. @option{combpel} pixels are required to be detected as combed for a frame to be
  9699. declared combed. See the @option{combpel} parameter description for more info.
  9700. Possible values are any number that is a power of 2 starting at 4 and going up
  9701. to 512.
  9702. Default value is @code{16}.
  9703. @item combpel
  9704. The number of combed pixels inside any of the @option{blocky} by
  9705. @option{blockx} size blocks on the frame for the frame to be detected as
  9706. combed. While @option{cthresh} controls how "visible" the combing must be, this
  9707. setting controls "how much" combing there must be in any localized area (a
  9708. window defined by the @option{blockx} and @option{blocky} settings) on the
  9709. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  9710. which point no frames will ever be detected as combed). This setting is known
  9711. as @option{MI} in TFM/VFM vocabulary.
  9712. Default value is @code{80}.
  9713. @end table
  9714. @anchor{p/c/n/u/b meaning}
  9715. @subsection p/c/n/u/b meaning
  9716. @subsubsection p/c/n
  9717. We assume the following telecined stream:
  9718. @example
  9719. Top fields: 1 2 2 3 4
  9720. Bottom fields: 1 2 3 4 4
  9721. @end example
  9722. The numbers correspond to the progressive frame the fields relate to. Here, the
  9723. first two frames are progressive, the 3rd and 4th are combed, and so on.
  9724. When @code{fieldmatch} is configured to run a matching from bottom
  9725. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  9726. @example
  9727. Input stream:
  9728. T 1 2 2 3 4
  9729. B 1 2 3 4 4 <-- matching reference
  9730. Matches: c c n n c
  9731. Output stream:
  9732. T 1 2 3 4 4
  9733. B 1 2 3 4 4
  9734. @end example
  9735. As a result of the field matching, we can see that some frames get duplicated.
  9736. To perform a complete inverse telecine, you need to rely on a decimation filter
  9737. after this operation. See for instance the @ref{decimate} filter.
  9738. The same operation now matching from top fields (@option{field}=@var{top})
  9739. looks like this:
  9740. @example
  9741. Input stream:
  9742. T 1 2 2 3 4 <-- matching reference
  9743. B 1 2 3 4 4
  9744. Matches: c c p p c
  9745. Output stream:
  9746. T 1 2 2 3 4
  9747. B 1 2 2 3 4
  9748. @end example
  9749. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  9750. basically, they refer to the frame and field of the opposite parity:
  9751. @itemize
  9752. @item @var{p} matches the field of the opposite parity in the previous frame
  9753. @item @var{c} matches the field of the opposite parity in the current frame
  9754. @item @var{n} matches the field of the opposite parity in the next frame
  9755. @end itemize
  9756. @subsubsection u/b
  9757. The @var{u} and @var{b} matching are a bit special in the sense that they match
  9758. from the opposite parity flag. In the following examples, we assume that we are
  9759. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  9760. 'x' is placed above and below each matched fields.
  9761. With bottom matching (@option{field}=@var{bottom}):
  9762. @example
  9763. Match: c p n b u
  9764. x x x x x
  9765. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  9766. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  9767. x x x x x
  9768. Output frames:
  9769. 2 1 2 2 2
  9770. 2 2 2 1 3
  9771. @end example
  9772. With top matching (@option{field}=@var{top}):
  9773. @example
  9774. Match: c p n b u
  9775. x x x x x
  9776. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  9777. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  9778. x x x x x
  9779. Output frames:
  9780. 2 2 2 1 2
  9781. 2 1 3 2 2
  9782. @end example
  9783. @subsection Examples
  9784. Simple IVTC of a top field first telecined stream:
  9785. @example
  9786. fieldmatch=order=tff:combmatch=none, decimate
  9787. @end example
  9788. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  9789. @example
  9790. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  9791. @end example
  9792. @section fieldorder
  9793. Transform the field order of the input video.
  9794. It accepts the following parameters:
  9795. @table @option
  9796. @item order
  9797. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  9798. for bottom field first.
  9799. @end table
  9800. The default value is @samp{tff}.
  9801. The transformation is done by shifting the picture content up or down
  9802. by one line, and filling the remaining line with appropriate picture content.
  9803. This method is consistent with most broadcast field order converters.
  9804. If the input video is not flagged as being interlaced, or it is already
  9805. flagged as being of the required output field order, then this filter does
  9806. not alter the incoming video.
  9807. It is very useful when converting to or from PAL DV material,
  9808. which is bottom field first.
  9809. For example:
  9810. @example
  9811. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  9812. @end example
  9813. @section fifo, afifo
  9814. Buffer input images and send them when they are requested.
  9815. It is mainly useful when auto-inserted by the libavfilter
  9816. framework.
  9817. It does not take parameters.
  9818. @section fillborders
  9819. Fill borders of the input video, without changing video stream dimensions.
  9820. Sometimes video can have garbage at the four edges and you may not want to
  9821. crop video input to keep size multiple of some number.
  9822. This filter accepts the following options:
  9823. @table @option
  9824. @item left
  9825. Number of pixels to fill from left border.
  9826. @item right
  9827. Number of pixels to fill from right border.
  9828. @item top
  9829. Number of pixels to fill from top border.
  9830. @item bottom
  9831. Number of pixels to fill from bottom border.
  9832. @item mode
  9833. Set fill mode.
  9834. It accepts the following values:
  9835. @table @samp
  9836. @item smear
  9837. fill pixels using outermost pixels
  9838. @item mirror
  9839. fill pixels using mirroring (half sample symmetric)
  9840. @item fixed
  9841. fill pixels with constant value
  9842. @item reflect
  9843. fill pixels using reflecting (whole sample symmetric)
  9844. @item wrap
  9845. fill pixels using wrapping
  9846. @item fade
  9847. fade pixels to constant value
  9848. @item margins
  9849. fill pixels at top and bottom with weighted averages pixels near borders
  9850. @end table
  9851. Default is @var{smear}.
  9852. @item color
  9853. Set color for pixels in fixed or fade mode. Default is @var{black}.
  9854. @end table
  9855. @subsection Commands
  9856. This filter supports same @ref{commands} as options.
  9857. The command accepts the same syntax of the corresponding option.
  9858. If the specified expression is not valid, it is kept at its current
  9859. value.
  9860. @section find_rect
  9861. Find a rectangular object
  9862. It accepts the following options:
  9863. @table @option
  9864. @item object
  9865. Filepath of the object image, needs to be in gray8.
  9866. @item threshold
  9867. Detection threshold, default is 0.5.
  9868. @item mipmaps
  9869. Number of mipmaps, default is 3.
  9870. @item xmin, ymin, xmax, ymax
  9871. Specifies the rectangle in which to search.
  9872. @item discard
  9873. Discard frames where object is not detected. Default is disabled.
  9874. @end table
  9875. @subsection Examples
  9876. @itemize
  9877. @item
  9878. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  9879. @example
  9880. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  9881. @end example
  9882. @end itemize
  9883. @section floodfill
  9884. Flood area with values of same pixel components with another values.
  9885. It accepts the following options:
  9886. @table @option
  9887. @item x
  9888. Set pixel x coordinate.
  9889. @item y
  9890. Set pixel y coordinate.
  9891. @item s0
  9892. Set source #0 component value.
  9893. @item s1
  9894. Set source #1 component value.
  9895. @item s2
  9896. Set source #2 component value.
  9897. @item s3
  9898. Set source #3 component value.
  9899. @item d0
  9900. Set destination #0 component value.
  9901. @item d1
  9902. Set destination #1 component value.
  9903. @item d2
  9904. Set destination #2 component value.
  9905. @item d3
  9906. Set destination #3 component value.
  9907. @end table
  9908. @anchor{format}
  9909. @section format
  9910. Convert the input video to one of the specified pixel formats.
  9911. Libavfilter will try to pick one that is suitable as input to
  9912. the next filter.
  9913. It accepts the following parameters:
  9914. @table @option
  9915. @item pix_fmts
  9916. A '|'-separated list of pixel format names, such as
  9917. "pix_fmts=yuv420p|monow|rgb24".
  9918. @end table
  9919. @subsection Examples
  9920. @itemize
  9921. @item
  9922. Convert the input video to the @var{yuv420p} format
  9923. @example
  9924. format=pix_fmts=yuv420p
  9925. @end example
  9926. Convert the input video to any of the formats in the list
  9927. @example
  9928. format=pix_fmts=yuv420p|yuv444p|yuv410p
  9929. @end example
  9930. @end itemize
  9931. @anchor{fps}
  9932. @section fps
  9933. Convert the video to specified constant frame rate by duplicating or dropping
  9934. frames as necessary.
  9935. It accepts the following parameters:
  9936. @table @option
  9937. @item fps
  9938. The desired output frame rate. It accepts expressions containing the following
  9939. constants:
  9940. @table @samp
  9941. @item source_fps
  9942. The input's frame rate
  9943. @item ntsc
  9944. NTSC frame rate of @code{30000/1001}
  9945. @item pal
  9946. PAL frame rate of @code{25.0}
  9947. @item film
  9948. Film frame rate of @code{24.0}
  9949. @item ntsc_film
  9950. NTSC-film frame rate of @code{24000/1001}
  9951. @end table
  9952. The default is @code{25}.
  9953. @item start_time
  9954. Assume the first PTS should be the given value, in seconds. This allows for
  9955. padding/trimming at the start of stream. By default, no assumption is made
  9956. about the first frame's expected PTS, so no padding or trimming is done.
  9957. For example, this could be set to 0 to pad the beginning with duplicates of
  9958. the first frame if a video stream starts after the audio stream or to trim any
  9959. frames with a negative PTS.
  9960. @item round
  9961. Timestamp (PTS) rounding method.
  9962. Possible values are:
  9963. @table @option
  9964. @item zero
  9965. round towards 0
  9966. @item inf
  9967. round away from 0
  9968. @item down
  9969. round towards -infinity
  9970. @item up
  9971. round towards +infinity
  9972. @item near
  9973. round to nearest
  9974. @end table
  9975. The default is @code{near}.
  9976. @item eof_action
  9977. Action performed when reading the last frame.
  9978. Possible values are:
  9979. @table @option
  9980. @item round
  9981. Use same timestamp rounding method as used for other frames.
  9982. @item pass
  9983. Pass through last frame if input duration has not been reached yet.
  9984. @end table
  9985. The default is @code{round}.
  9986. @end table
  9987. Alternatively, the options can be specified as a flat string:
  9988. @var{fps}[:@var{start_time}[:@var{round}]].
  9989. See also the @ref{setpts} filter.
  9990. @subsection Examples
  9991. @itemize
  9992. @item
  9993. A typical usage in order to set the fps to 25:
  9994. @example
  9995. fps=fps=25
  9996. @end example
  9997. @item
  9998. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  9999. @example
  10000. fps=fps=film:round=near
  10001. @end example
  10002. @end itemize
  10003. @section framepack
  10004. Pack two different video streams into a stereoscopic video, setting proper
  10005. metadata on supported codecs. The two views should have the same size and
  10006. framerate and processing will stop when the shorter video ends. Please note
  10007. that you may conveniently adjust view properties with the @ref{scale} and
  10008. @ref{fps} filters.
  10009. It accepts the following parameters:
  10010. @table @option
  10011. @item format
  10012. The desired packing format. Supported values are:
  10013. @table @option
  10014. @item sbs
  10015. The views are next to each other (default).
  10016. @item tab
  10017. The views are on top of each other.
  10018. @item lines
  10019. The views are packed by line.
  10020. @item columns
  10021. The views are packed by column.
  10022. @item frameseq
  10023. The views are temporally interleaved.
  10024. @end table
  10025. @end table
  10026. Some examples:
  10027. @example
  10028. # Convert left and right views into a frame-sequential video
  10029. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  10030. # Convert views into a side-by-side video with the same output resolution as the input
  10031. 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
  10032. @end example
  10033. @section framerate
  10034. Change the frame rate by interpolating new video output frames from the source
  10035. frames.
  10036. This filter is not designed to function correctly with interlaced media. If
  10037. you wish to change the frame rate of interlaced media then you are required
  10038. to deinterlace before this filter and re-interlace after this filter.
  10039. A description of the accepted options follows.
  10040. @table @option
  10041. @item fps
  10042. Specify the output frames per second. This option can also be specified
  10043. as a value alone. The default is @code{50}.
  10044. @item interp_start
  10045. Specify the start of a range where the output frame will be created as a
  10046. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  10047. the default is @code{15}.
  10048. @item interp_end
  10049. Specify the end of a range where the output frame will be created as a
  10050. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  10051. the default is @code{240}.
  10052. @item scene
  10053. Specify the level at which a scene change is detected as a value between
  10054. 0 and 100 to indicate a new scene; a low value reflects a low
  10055. probability for the current frame to introduce a new scene, while a higher
  10056. value means the current frame is more likely to be one.
  10057. The default is @code{8.2}.
  10058. @item flags
  10059. Specify flags influencing the filter process.
  10060. Available value for @var{flags} is:
  10061. @table @option
  10062. @item scene_change_detect, scd
  10063. Enable scene change detection using the value of the option @var{scene}.
  10064. This flag is enabled by default.
  10065. @end table
  10066. @end table
  10067. @section framestep
  10068. Select one frame every N-th frame.
  10069. This filter accepts the following option:
  10070. @table @option
  10071. @item step
  10072. Select frame after every @code{step} frames.
  10073. Allowed values are positive integers higher than 0. Default value is @code{1}.
  10074. @end table
  10075. @section freezedetect
  10076. Detect frozen video.
  10077. This filter logs a message and sets frame metadata when it detects that the
  10078. input video has no significant change in content during a specified duration.
  10079. Video freeze detection calculates the mean average absolute difference of all
  10080. the components of video frames and compares it to a noise floor.
  10081. The printed times and duration are expressed in seconds. The
  10082. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  10083. whose timestamp equals or exceeds the detection duration and it contains the
  10084. timestamp of the first frame of the freeze. The
  10085. @code{lavfi.freezedetect.freeze_duration} and
  10086. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  10087. after the freeze.
  10088. The filter accepts the following options:
  10089. @table @option
  10090. @item noise, n
  10091. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  10092. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  10093. 0.001.
  10094. @item duration, d
  10095. Set freeze duration until notification (default is 2 seconds).
  10096. @end table
  10097. @section freezeframes
  10098. Freeze video frames.
  10099. This filter freezes video frames using frame from 2nd input.
  10100. The filter accepts the following options:
  10101. @table @option
  10102. @item first
  10103. Set number of first frame from which to start freeze.
  10104. @item last
  10105. Set number of last frame from which to end freeze.
  10106. @item replace
  10107. Set number of frame from 2nd input which will be used instead of replaced frames.
  10108. @end table
  10109. @anchor{frei0r}
  10110. @section frei0r
  10111. Apply a frei0r effect to the input video.
  10112. To enable the compilation of this filter, you need to install the frei0r
  10113. header and configure FFmpeg with @code{--enable-frei0r}.
  10114. It accepts the following parameters:
  10115. @table @option
  10116. @item filter_name
  10117. The name of the frei0r effect to load. If the environment variable
  10118. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  10119. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  10120. Otherwise, the standard frei0r paths are searched, in this order:
  10121. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  10122. @file{/usr/lib/frei0r-1/}.
  10123. @item filter_params
  10124. A '|'-separated list of parameters to pass to the frei0r effect.
  10125. @end table
  10126. A frei0r effect parameter can be a boolean (its value is either
  10127. "y" or "n"), a double, a color (specified as
  10128. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  10129. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  10130. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  10131. a position (specified as @var{X}/@var{Y}, where
  10132. @var{X} and @var{Y} are floating point numbers) and/or a string.
  10133. The number and types of parameters depend on the loaded effect. If an
  10134. effect parameter is not specified, the default value is set.
  10135. @subsection Examples
  10136. @itemize
  10137. @item
  10138. Apply the distort0r effect, setting the first two double parameters:
  10139. @example
  10140. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  10141. @end example
  10142. @item
  10143. Apply the colordistance effect, taking a color as the first parameter:
  10144. @example
  10145. frei0r=colordistance:0.2/0.3/0.4
  10146. frei0r=colordistance:violet
  10147. frei0r=colordistance:0x112233
  10148. @end example
  10149. @item
  10150. Apply the perspective effect, specifying the top left and top right image
  10151. positions:
  10152. @example
  10153. frei0r=perspective:0.2/0.2|0.8/0.2
  10154. @end example
  10155. @end itemize
  10156. For more information, see
  10157. @url{http://frei0r.dyne.org}
  10158. @subsection Commands
  10159. This filter supports the @option{filter_params} option as @ref{commands}.
  10160. @section fspp
  10161. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  10162. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  10163. processing filter, one of them is performed once per block, not per pixel.
  10164. This allows for much higher speed.
  10165. The filter accepts the following options:
  10166. @table @option
  10167. @item quality
  10168. Set quality. This option defines the number of levels for averaging. It accepts
  10169. an integer in the range 4-5. Default value is @code{4}.
  10170. @item qp
  10171. Force a constant quantization parameter. It accepts an integer in range 0-63.
  10172. If not set, the filter will use the QP from the video stream (if available).
  10173. @item strength
  10174. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  10175. more details but also more artifacts, while higher values make the image smoother
  10176. but also blurrier. Default value is @code{0} − PSNR optimal.
  10177. @item use_bframe_qp
  10178. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  10179. option may cause flicker since the B-Frames have often larger QP. Default is
  10180. @code{0} (not enabled).
  10181. @end table
  10182. @section gblur
  10183. Apply Gaussian blur filter.
  10184. The filter accepts the following options:
  10185. @table @option
  10186. @item sigma
  10187. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  10188. @item steps
  10189. Set number of steps for Gaussian approximation. Default is @code{1}.
  10190. @item planes
  10191. Set which planes to filter. By default all planes are filtered.
  10192. @item sigmaV
  10193. Set vertical sigma, if negative it will be same as @code{sigma}.
  10194. Default is @code{-1}.
  10195. @end table
  10196. @subsection Commands
  10197. This filter supports same commands as options.
  10198. The command accepts the same syntax of the corresponding option.
  10199. If the specified expression is not valid, it is kept at its current
  10200. value.
  10201. @section geq
  10202. Apply generic equation to each pixel.
  10203. The filter accepts the following options:
  10204. @table @option
  10205. @item lum_expr, lum
  10206. Set the luminance expression.
  10207. @item cb_expr, cb
  10208. Set the chrominance blue expression.
  10209. @item cr_expr, cr
  10210. Set the chrominance red expression.
  10211. @item alpha_expr, a
  10212. Set the alpha expression.
  10213. @item red_expr, r
  10214. Set the red expression.
  10215. @item green_expr, g
  10216. Set the green expression.
  10217. @item blue_expr, b
  10218. Set the blue expression.
  10219. @end table
  10220. The colorspace is selected according to the specified options. If one
  10221. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  10222. options is specified, the filter will automatically select a YCbCr
  10223. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  10224. @option{blue_expr} options is specified, it will select an RGB
  10225. colorspace.
  10226. If one of the chrominance expression is not defined, it falls back on the other
  10227. one. If no alpha expression is specified it will evaluate to opaque value.
  10228. If none of chrominance expressions are specified, they will evaluate
  10229. to the luminance expression.
  10230. The expressions can use the following variables and functions:
  10231. @table @option
  10232. @item N
  10233. The sequential number of the filtered frame, starting from @code{0}.
  10234. @item X
  10235. @item Y
  10236. The coordinates of the current sample.
  10237. @item W
  10238. @item H
  10239. The width and height of the image.
  10240. @item SW
  10241. @item SH
  10242. Width and height scale depending on the currently filtered plane. It is the
  10243. ratio between the corresponding luma plane number of pixels and the current
  10244. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  10245. @code{0.5,0.5} for chroma planes.
  10246. @item T
  10247. Time of the current frame, expressed in seconds.
  10248. @item p(x, y)
  10249. Return the value of the pixel at location (@var{x},@var{y}) of the current
  10250. plane.
  10251. @item lum(x, y)
  10252. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  10253. plane.
  10254. @item cb(x, y)
  10255. Return the value of the pixel at location (@var{x},@var{y}) of the
  10256. blue-difference chroma plane. Return 0 if there is no such plane.
  10257. @item cr(x, y)
  10258. Return the value of the pixel at location (@var{x},@var{y}) of the
  10259. red-difference chroma plane. Return 0 if there is no such plane.
  10260. @item r(x, y)
  10261. @item g(x, y)
  10262. @item b(x, y)
  10263. Return the value of the pixel at location (@var{x},@var{y}) of the
  10264. red/green/blue component. Return 0 if there is no such component.
  10265. @item alpha(x, y)
  10266. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  10267. plane. Return 0 if there is no such plane.
  10268. @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)
  10269. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  10270. sums of samples within a rectangle. See the functions without the sum postfix.
  10271. @item interpolation
  10272. Set one of interpolation methods:
  10273. @table @option
  10274. @item nearest, n
  10275. @item bilinear, b
  10276. @end table
  10277. Default is bilinear.
  10278. @end table
  10279. For functions, if @var{x} and @var{y} are outside the area, the value will be
  10280. automatically clipped to the closer edge.
  10281. Please note that this filter can use multiple threads in which case each slice
  10282. will have its own expression state. If you want to use only a single expression
  10283. state because your expressions depend on previous state then you should limit
  10284. the number of filter threads to 1.
  10285. @subsection Examples
  10286. @itemize
  10287. @item
  10288. Flip the image horizontally:
  10289. @example
  10290. geq=p(W-X\,Y)
  10291. @end example
  10292. @item
  10293. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  10294. wavelength of 100 pixels:
  10295. @example
  10296. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  10297. @end example
  10298. @item
  10299. Generate a fancy enigmatic moving light:
  10300. @example
  10301. 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
  10302. @end example
  10303. @item
  10304. Generate a quick emboss effect:
  10305. @example
  10306. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  10307. @end example
  10308. @item
  10309. Modify RGB components depending on pixel position:
  10310. @example
  10311. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  10312. @end example
  10313. @item
  10314. Create a radial gradient that is the same size as the input (also see
  10315. the @ref{vignette} filter):
  10316. @example
  10317. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  10318. @end example
  10319. @end itemize
  10320. @section gradfun
  10321. Fix the banding artifacts that are sometimes introduced into nearly flat
  10322. regions by truncation to 8-bit color depth.
  10323. Interpolate the gradients that should go where the bands are, and
  10324. dither them.
  10325. It is designed for playback only. Do not use it prior to
  10326. lossy compression, because compression tends to lose the dither and
  10327. bring back the bands.
  10328. It accepts the following parameters:
  10329. @table @option
  10330. @item strength
  10331. The maximum amount by which the filter will change any one pixel. This is also
  10332. the threshold for detecting nearly flat regions. Acceptable values range from
  10333. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  10334. valid range.
  10335. @item radius
  10336. The neighborhood to fit the gradient to. A larger radius makes for smoother
  10337. gradients, but also prevents the filter from modifying the pixels near detailed
  10338. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  10339. values will be clipped to the valid range.
  10340. @end table
  10341. Alternatively, the options can be specified as a flat string:
  10342. @var{strength}[:@var{radius}]
  10343. @subsection Examples
  10344. @itemize
  10345. @item
  10346. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  10347. @example
  10348. gradfun=3.5:8
  10349. @end example
  10350. @item
  10351. Specify radius, omitting the strength (which will fall-back to the default
  10352. value):
  10353. @example
  10354. gradfun=radius=8
  10355. @end example
  10356. @end itemize
  10357. @anchor{graphmonitor}
  10358. @section graphmonitor
  10359. Show various filtergraph stats.
  10360. With this filter one can debug complete filtergraph.
  10361. Especially issues with links filling with queued frames.
  10362. The filter accepts the following options:
  10363. @table @option
  10364. @item size, s
  10365. Set video output size. Default is @var{hd720}.
  10366. @item opacity, o
  10367. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  10368. @item mode, m
  10369. Set output mode, can be @var{fulll} or @var{compact}.
  10370. In @var{compact} mode only filters with some queued frames have displayed stats.
  10371. @item flags, f
  10372. Set flags which enable which stats are shown in video.
  10373. Available values for flags are:
  10374. @table @samp
  10375. @item queue
  10376. Display number of queued frames in each link.
  10377. @item frame_count_in
  10378. Display number of frames taken from filter.
  10379. @item frame_count_out
  10380. Display number of frames given out from filter.
  10381. @item frame_count_delta
  10382. Display delta number of frames between above two values.
  10383. @item pts
  10384. Display current filtered frame pts.
  10385. @item pts_delta
  10386. Display pts delta between current and previous frame.
  10387. @item time
  10388. Display current filtered frame time.
  10389. @item time_delta
  10390. Display time delta between current and previous frame.
  10391. @item timebase
  10392. Display time base for filter link.
  10393. @item format
  10394. Display used format for filter link.
  10395. @item size
  10396. Display video size or number of audio channels in case of audio used by filter link.
  10397. @item rate
  10398. Display video frame rate or sample rate in case of audio used by filter link.
  10399. @item eof
  10400. Display link output status.
  10401. @item sample_count_in
  10402. Display number of samples taken from filter.
  10403. @item sample_count_out
  10404. Display number of samples given out from filter.
  10405. @item sample_count_delta
  10406. Display delta number of samples between above two values.
  10407. @end table
  10408. @item rate, r
  10409. Set upper limit for video rate of output stream, Default value is @var{25}.
  10410. This guarantee that output video frame rate will not be higher than this value.
  10411. @end table
  10412. @section grayworld
  10413. A color constancy filter that applies color correction based on the grayworld assumption
  10414. See: @url{https://www.researchgate.net/publication/275213614_A_New_Color_Correction_Method_for_Underwater_Imaging}
  10415. The algorithm uses linear light, so input
  10416. data should be linearized beforehand (and possibly correctly tagged).
  10417. @example
  10418. ffmpeg -i INPUT -vf zscale=transfer=linear,grayworld,zscale=transfer=bt709,format=yuv420p OUTPUT
  10419. @end example
  10420. @section greyedge
  10421. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  10422. and corrects the scene colors accordingly.
  10423. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  10424. The filter accepts the following options:
  10425. @table @option
  10426. @item difford
  10427. The order of differentiation to be applied on the scene. Must be chosen in the range
  10428. [0,2] and default value is 1.
  10429. @item minknorm
  10430. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  10431. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  10432. max value instead of calculating Minkowski distance.
  10433. @item sigma
  10434. The standard deviation of Gaussian blur to be applied on the scene. Must be
  10435. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  10436. can't be equal to 0 if @var{difford} is greater than 0.
  10437. @end table
  10438. @subsection Examples
  10439. @itemize
  10440. @item
  10441. Grey Edge:
  10442. @example
  10443. greyedge=difford=1:minknorm=5:sigma=2
  10444. @end example
  10445. @item
  10446. Max Edge:
  10447. @example
  10448. greyedge=difford=1:minknorm=0:sigma=2
  10449. @end example
  10450. @end itemize
  10451. @section guided
  10452. Apply guided filter for edge-preserving smoothing, dehazing and so on.
  10453. The filter accepts the following options:
  10454. @table @option
  10455. @item radius
  10456. Set the box radius in pixels.
  10457. Allowed range is 1 to 20. Default is 3.
  10458. @item eps
  10459. Set regularization parameter (with square).
  10460. Allowed range is 0 to 1. Default is 0.01.
  10461. @item mode
  10462. Set filter mode. Can be @code{basic} or @code{fast}.
  10463. Default is @code{basic}.
  10464. @item sub
  10465. Set subsampling ratio for @code{fast} mode.
  10466. Range is 2 to 64. Default is 4.
  10467. No subsampling occurs in @code{basic} mode.
  10468. @item guidance
  10469. Set guidance mode. Can be @code{off} or @code{on}. Default is @code{off}.
  10470. If @code{off}, single input is required.
  10471. If @code{on}, two inputs of the same resolution and pixel format are required.
  10472. The second input serves as the guidance.
  10473. @item planes
  10474. Set planes to filter. Default is first only.
  10475. @end table
  10476. @subsection Commands
  10477. This filter supports the all above options as @ref{commands}.
  10478. @subsection Examples
  10479. @itemize
  10480. @item
  10481. Edge-preserving smoothing with guided filter:
  10482. @example
  10483. ffmpeg -i in.png -vf guided out.png
  10484. @end example
  10485. @item
  10486. Dehazing, structure-transferring filtering, detail enhancement with guided filter.
  10487. For the generation of guidance image, refer to paper "Guided Image Filtering".
  10488. See: @url{http://kaiminghe.com/publications/pami12guidedfilter.pdf}.
  10489. @example
  10490. ffmpeg -i in.png -i guidance.png -filter_complex guided=guidance=on out.png
  10491. @end example
  10492. @end itemize
  10493. @anchor{haldclut}
  10494. @section haldclut
  10495. Apply a Hald CLUT to a video stream.
  10496. First input is the video stream to process, and second one is the Hald CLUT.
  10497. The Hald CLUT input can be a simple picture or a complete video stream.
  10498. The filter accepts the following options:
  10499. @table @option
  10500. @item shortest
  10501. Force termination when the shortest input terminates. Default is @code{0}.
  10502. @item repeatlast
  10503. Continue applying the last CLUT after the end of the stream. A value of
  10504. @code{0} disable the filter after the last frame of the CLUT is reached.
  10505. Default is @code{1}.
  10506. @end table
  10507. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  10508. filters share the same internals).
  10509. This filter also supports the @ref{framesync} options.
  10510. More information about the Hald CLUT can be found on Eskil Steenberg's website
  10511. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  10512. @subsection Commands
  10513. This filter supports the @code{interp} option as @ref{commands}.
  10514. @subsection Workflow examples
  10515. @subsubsection Hald CLUT video stream
  10516. Generate an identity Hald CLUT stream altered with various effects:
  10517. @example
  10518. 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
  10519. @end example
  10520. Note: make sure you use a lossless codec.
  10521. Then use it with @code{haldclut} to apply it on some random stream:
  10522. @example
  10523. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  10524. @end example
  10525. The Hald CLUT will be applied to the 10 first seconds (duration of
  10526. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  10527. to the remaining frames of the @code{mandelbrot} stream.
  10528. @subsubsection Hald CLUT with preview
  10529. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  10530. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  10531. biggest possible square starting at the top left of the picture. The remaining
  10532. padding pixels (bottom or right) will be ignored. This area can be used to add
  10533. a preview of the Hald CLUT.
  10534. Typically, the following generated Hald CLUT will be supported by the
  10535. @code{haldclut} filter:
  10536. @example
  10537. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  10538. pad=iw+320 [padded_clut];
  10539. smptebars=s=320x256, split [a][b];
  10540. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  10541. [main][b] overlay=W-320" -frames:v 1 clut.png
  10542. @end example
  10543. It contains the original and a preview of the effect of the CLUT: SMPTE color
  10544. bars are displayed on the right-top, and below the same color bars processed by
  10545. the color changes.
  10546. Then, the effect of this Hald CLUT can be visualized with:
  10547. @example
  10548. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  10549. @end example
  10550. @section hflip
  10551. Flip the input video horizontally.
  10552. For example, to horizontally flip the input video with @command{ffmpeg}:
  10553. @example
  10554. ffmpeg -i in.avi -vf "hflip" out.avi
  10555. @end example
  10556. @section histeq
  10557. This filter applies a global color histogram equalization on a
  10558. per-frame basis.
  10559. It can be used to correct video that has a compressed range of pixel
  10560. intensities. The filter redistributes the pixel intensities to
  10561. equalize their distribution across the intensity range. It may be
  10562. viewed as an "automatically adjusting contrast filter". This filter is
  10563. useful only for correcting degraded or poorly captured source
  10564. video.
  10565. The filter accepts the following options:
  10566. @table @option
  10567. @item strength
  10568. Determine the amount of equalization to be applied. As the strength
  10569. is reduced, the distribution of pixel intensities more-and-more
  10570. approaches that of the input frame. The value must be a float number
  10571. in the range [0,1] and defaults to 0.200.
  10572. @item intensity
  10573. Set the maximum intensity that can generated and scale the output
  10574. values appropriately. The strength should be set as desired and then
  10575. the intensity can be limited if needed to avoid washing-out. The value
  10576. must be a float number in the range [0,1] and defaults to 0.210.
  10577. @item antibanding
  10578. Set the antibanding level. If enabled the filter will randomly vary
  10579. the luminance of output pixels by a small amount to avoid banding of
  10580. the histogram. Possible values are @code{none}, @code{weak} or
  10581. @code{strong}. It defaults to @code{none}.
  10582. @end table
  10583. @anchor{histogram}
  10584. @section histogram
  10585. Compute and draw a color distribution histogram for the input video.
  10586. The computed histogram is a representation of the color component
  10587. distribution in an image.
  10588. Standard histogram displays the color components distribution in an image.
  10589. Displays color graph for each color component. Shows distribution of
  10590. the Y, U, V, A or R, G, B components, depending on input format, in the
  10591. current frame. Below each graph a color component scale meter is shown.
  10592. The filter accepts the following options:
  10593. @table @option
  10594. @item level_height
  10595. Set height of level. Default value is @code{200}.
  10596. Allowed range is [50, 2048].
  10597. @item scale_height
  10598. Set height of color scale. Default value is @code{12}.
  10599. Allowed range is [0, 40].
  10600. @item display_mode
  10601. Set display mode.
  10602. It accepts the following values:
  10603. @table @samp
  10604. @item stack
  10605. Per color component graphs are placed below each other.
  10606. @item parade
  10607. Per color component graphs are placed side by side.
  10608. @item overlay
  10609. Presents information identical to that in the @code{parade}, except
  10610. that the graphs representing color components are superimposed directly
  10611. over one another.
  10612. @end table
  10613. Default is @code{stack}.
  10614. @item levels_mode
  10615. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  10616. Default is @code{linear}.
  10617. @item components
  10618. Set what color components to display.
  10619. Default is @code{7}.
  10620. @item fgopacity
  10621. Set foreground opacity. Default is @code{0.7}.
  10622. @item bgopacity
  10623. Set background opacity. Default is @code{0.5}.
  10624. @item colors_mode
  10625. Set colors mode.
  10626. It accepts the following values:
  10627. @table @samp
  10628. @item whiteonblack
  10629. @item blackonwhite
  10630. @item whiteongray
  10631. @item blackongray
  10632. @item coloronblack
  10633. @item coloronwhite
  10634. @item colorongray
  10635. @item blackoncolor
  10636. @item whiteoncolor
  10637. @item grayoncolor
  10638. @end table
  10639. Default is @code{whiteonblack}.
  10640. @end table
  10641. @subsection Examples
  10642. @itemize
  10643. @item
  10644. Calculate and draw histogram:
  10645. @example
  10646. ffplay -i input -vf histogram
  10647. @end example
  10648. @end itemize
  10649. @anchor{hqdn3d}
  10650. @section hqdn3d
  10651. This is a high precision/quality 3d denoise filter. It aims to reduce
  10652. image noise, producing smooth images and making still images really
  10653. still. It should enhance compressibility.
  10654. It accepts the following optional parameters:
  10655. @table @option
  10656. @item luma_spatial
  10657. A non-negative floating point number which specifies spatial luma strength.
  10658. It defaults to 4.0.
  10659. @item chroma_spatial
  10660. A non-negative floating point number which specifies spatial chroma strength.
  10661. It defaults to 3.0*@var{luma_spatial}/4.0.
  10662. @item luma_tmp
  10663. A floating point number which specifies luma temporal strength. It defaults to
  10664. 6.0*@var{luma_spatial}/4.0.
  10665. @item chroma_tmp
  10666. A floating point number which specifies chroma temporal strength. It defaults to
  10667. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  10668. @end table
  10669. @subsection Commands
  10670. This filter supports same @ref{commands} as options.
  10671. The command accepts the same syntax of the corresponding option.
  10672. If the specified expression is not valid, it is kept at its current
  10673. value.
  10674. @anchor{hwdownload}
  10675. @section hwdownload
  10676. Download hardware frames to system memory.
  10677. The input must be in hardware frames, and the output a non-hardware format.
  10678. Not all formats will be supported on the output - it may be necessary to insert
  10679. an additional @option{format} filter immediately following in the graph to get
  10680. the output in a supported format.
  10681. @section hwmap
  10682. Map hardware frames to system memory or to another device.
  10683. This filter has several different modes of operation; which one is used depends
  10684. on the input and output formats:
  10685. @itemize
  10686. @item
  10687. Hardware frame input, normal frame output
  10688. Map the input frames to system memory and pass them to the output. If the
  10689. original hardware frame is later required (for example, after overlaying
  10690. something else on part of it), the @option{hwmap} filter can be used again
  10691. in the next mode to retrieve it.
  10692. @item
  10693. Normal frame input, hardware frame output
  10694. If the input is actually a software-mapped hardware frame, then unmap it -
  10695. that is, return the original hardware frame.
  10696. Otherwise, a device must be provided. Create new hardware surfaces on that
  10697. device for the output, then map them back to the software format at the input
  10698. and give those frames to the preceding filter. This will then act like the
  10699. @option{hwupload} filter, but may be able to avoid an additional copy when
  10700. the input is already in a compatible format.
  10701. @item
  10702. Hardware frame input and output
  10703. A device must be supplied for the output, either directly or with the
  10704. @option{derive_device} option. The input and output devices must be of
  10705. different types and compatible - the exact meaning of this is
  10706. system-dependent, but typically it means that they must refer to the same
  10707. underlying hardware context (for example, refer to the same graphics card).
  10708. If the input frames were originally created on the output device, then unmap
  10709. to retrieve the original frames.
  10710. Otherwise, map the frames to the output device - create new hardware frames
  10711. on the output corresponding to the frames on the input.
  10712. @end itemize
  10713. The following additional parameters are accepted:
  10714. @table @option
  10715. @item mode
  10716. Set the frame mapping mode. Some combination of:
  10717. @table @var
  10718. @item read
  10719. The mapped frame should be readable.
  10720. @item write
  10721. The mapped frame should be writeable.
  10722. @item overwrite
  10723. The mapping will always overwrite the entire frame.
  10724. This may improve performance in some cases, as the original contents of the
  10725. frame need not be loaded.
  10726. @item direct
  10727. The mapping must not involve any copying.
  10728. Indirect mappings to copies of frames are created in some cases where either
  10729. direct mapping is not possible or it would have unexpected properties.
  10730. Setting this flag ensures that the mapping is direct and will fail if that is
  10731. not possible.
  10732. @end table
  10733. Defaults to @var{read+write} if not specified.
  10734. @item derive_device @var{type}
  10735. Rather than using the device supplied at initialisation, instead derive a new
  10736. device of type @var{type} from the device the input frames exist on.
  10737. @item reverse
  10738. In a hardware to hardware mapping, map in reverse - create frames in the sink
  10739. and map them back to the source. This may be necessary in some cases where
  10740. a mapping in one direction is required but only the opposite direction is
  10741. supported by the devices being used.
  10742. This option is dangerous - it may break the preceding filter in undefined
  10743. ways if there are any additional constraints on that filter's output.
  10744. Do not use it without fully understanding the implications of its use.
  10745. @end table
  10746. @anchor{hwupload}
  10747. @section hwupload
  10748. Upload system memory frames to hardware surfaces.
  10749. The device to upload to must be supplied when the filter is initialised. If
  10750. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  10751. option or with the @option{derive_device} option. The input and output devices
  10752. must be of different types and compatible - the exact meaning of this is
  10753. system-dependent, but typically it means that they must refer to the same
  10754. underlying hardware context (for example, refer to the same graphics card).
  10755. The following additional parameters are accepted:
  10756. @table @option
  10757. @item derive_device @var{type}
  10758. Rather than using the device supplied at initialisation, instead derive a new
  10759. device of type @var{type} from the device the input frames exist on.
  10760. @end table
  10761. @anchor{hwupload_cuda}
  10762. @section hwupload_cuda
  10763. Upload system memory frames to a CUDA device.
  10764. It accepts the following optional parameters:
  10765. @table @option
  10766. @item device
  10767. The number of the CUDA device to use
  10768. @end table
  10769. @section hqx
  10770. Apply a high-quality magnification filter designed for pixel art. This filter
  10771. was originally created by Maxim Stepin.
  10772. It accepts the following option:
  10773. @table @option
  10774. @item n
  10775. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  10776. @code{hq3x} and @code{4} for @code{hq4x}.
  10777. Default is @code{3}.
  10778. @end table
  10779. @section hstack
  10780. Stack input videos horizontally.
  10781. All streams must be of same pixel format and of same height.
  10782. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  10783. to create same output.
  10784. The filter accepts the following option:
  10785. @table @option
  10786. @item inputs
  10787. Set number of input streams. Default is 2.
  10788. @item shortest
  10789. If set to 1, force the output to terminate when the shortest input
  10790. terminates. Default value is 0.
  10791. @end table
  10792. @section hsvhold
  10793. Turns a certain HSV range into gray values.
  10794. This filter measures color difference between set HSV color in options
  10795. and ones measured in video stream. Depending on options, output
  10796. colors can be changed to be gray or not.
  10797. The filter accepts the following options:
  10798. @table @option
  10799. @item hue
  10800. Set the hue value which will be used in color difference calculation.
  10801. Allowed range is from -360 to 360. Default value is 0.
  10802. @item sat
  10803. Set the saturation value which will be used in color difference calculation.
  10804. Allowed range is from -1 to 1. Default value is 0.
  10805. @item val
  10806. Set the value which will be used in color difference calculation.
  10807. Allowed range is from -1 to 1. Default value is 0.
  10808. @item similarity
  10809. Set similarity percentage with the key color.
  10810. Allowed range is from 0 to 1. Default value is 0.01.
  10811. 0.00001 matches only the exact key color, while 1.0 matches everything.
  10812. @item blend
  10813. Blend percentage.
  10814. Allowed range is from 0 to 1. Default value is 0.
  10815. 0.0 makes pixels either fully gray, or not gray at all.
  10816. Higher values result in more gray pixels, with a higher gray pixel
  10817. the more similar the pixels color is to the key color.
  10818. @end table
  10819. @section hsvkey
  10820. Turns a certain HSV range into transparency.
  10821. This filter measures color difference between set HSV color in options
  10822. and ones measured in video stream. Depending on options, output
  10823. colors can be changed to transparent by adding alpha channel.
  10824. The filter accepts the following options:
  10825. @table @option
  10826. @item hue
  10827. Set the hue value which will be used in color difference calculation.
  10828. Allowed range is from -360 to 360. Default value is 0.
  10829. @item sat
  10830. Set the saturation value which will be used in color difference calculation.
  10831. Allowed range is from -1 to 1. Default value is 0.
  10832. @item val
  10833. Set the value which will be used in color difference calculation.
  10834. Allowed range is from -1 to 1. Default value is 0.
  10835. @item similarity
  10836. Set similarity percentage with the key color.
  10837. Allowed range is from 0 to 1. Default value is 0.01.
  10838. 0.00001 matches only the exact key color, while 1.0 matches everything.
  10839. @item blend
  10840. Blend percentage.
  10841. Allowed range is from 0 to 1. Default value is 0.
  10842. 0.0 makes pixels either fully transparent, or not transparent at all.
  10843. Higher values result in semi-transparent pixels, with a higher transparency
  10844. the more similar the pixels color is to the key color.
  10845. @end table
  10846. @section hue
  10847. Modify the hue and/or the saturation of the input.
  10848. It accepts the following parameters:
  10849. @table @option
  10850. @item h
  10851. Specify the hue angle as a number of degrees. It accepts an expression,
  10852. and defaults to "0".
  10853. @item s
  10854. Specify the saturation in the [-10,10] range. It accepts an expression and
  10855. defaults to "1".
  10856. @item H
  10857. Specify the hue angle as a number of radians. It accepts an
  10858. expression, and defaults to "0".
  10859. @item b
  10860. Specify the brightness in the [-10,10] range. It accepts an expression and
  10861. defaults to "0".
  10862. @end table
  10863. @option{h} and @option{H} are mutually exclusive, and can't be
  10864. specified at the same time.
  10865. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  10866. expressions containing the following constants:
  10867. @table @option
  10868. @item n
  10869. frame count of the input frame starting from 0
  10870. @item pts
  10871. presentation timestamp of the input frame expressed in time base units
  10872. @item r
  10873. frame rate of the input video, NAN if the input frame rate is unknown
  10874. @item t
  10875. timestamp expressed in seconds, NAN if the input timestamp is unknown
  10876. @item tb
  10877. time base of the input video
  10878. @end table
  10879. @subsection Examples
  10880. @itemize
  10881. @item
  10882. Set the hue to 90 degrees and the saturation to 1.0:
  10883. @example
  10884. hue=h=90:s=1
  10885. @end example
  10886. @item
  10887. Same command but expressing the hue in radians:
  10888. @example
  10889. hue=H=PI/2:s=1
  10890. @end example
  10891. @item
  10892. Rotate hue and make the saturation swing between 0
  10893. and 2 over a period of 1 second:
  10894. @example
  10895. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  10896. @end example
  10897. @item
  10898. Apply a 3 seconds saturation fade-in effect starting at 0:
  10899. @example
  10900. hue="s=min(t/3\,1)"
  10901. @end example
  10902. The general fade-in expression can be written as:
  10903. @example
  10904. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  10905. @end example
  10906. @item
  10907. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  10908. @example
  10909. hue="s=max(0\, min(1\, (8-t)/3))"
  10910. @end example
  10911. The general fade-out expression can be written as:
  10912. @example
  10913. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  10914. @end example
  10915. @end itemize
  10916. @subsection Commands
  10917. This filter supports the following commands:
  10918. @table @option
  10919. @item b
  10920. @item s
  10921. @item h
  10922. @item H
  10923. Modify the hue and/or the saturation and/or brightness of the input video.
  10924. The command accepts the same syntax of the corresponding option.
  10925. If the specified expression is not valid, it is kept at its current
  10926. value.
  10927. @end table
  10928. @section huesaturation
  10929. Apply hue-saturation-intensity adjustments to input video stream.
  10930. This filter operates in RGB colorspace.
  10931. This filter accepts the following options:
  10932. @table @option
  10933. @item hue
  10934. Set the hue shift in degrees to apply. Default is 0.
  10935. Allowed range is from -180 to 180.
  10936. @item saturation
  10937. Set the saturation shift. Default is 0.
  10938. Allowed range is from -1 to 1.
  10939. @item intensity
  10940. Set the intensity shift. Default is 0.
  10941. Allowed range is from -1 to 1.
  10942. @item colors
  10943. Set which primary and complementary colors are going to be adjusted.
  10944. This options is set by providing one or multiple values.
  10945. This can select multiple colors at once. By default all colors are selected.
  10946. @table @samp
  10947. @item r
  10948. Adjust reds.
  10949. @item y
  10950. Adjust yellows.
  10951. @item g
  10952. Adjust greens.
  10953. @item c
  10954. Adjust cyans.
  10955. @item b
  10956. Adjust blues.
  10957. @item m
  10958. Adjust magentas.
  10959. @item a
  10960. Adjust all colors.
  10961. @end table
  10962. @item strength
  10963. Set strength of filtering. Allowed range is from 0 to 100.
  10964. Default value is 1.
  10965. @item rw, gw, bw
  10966. Set weight for each RGB component. Allowed range is from 0 to 1.
  10967. By default is set to 0.333, 0.334, 0.333.
  10968. Those options are used in saturation and lightess processing.
  10969. @item lightness
  10970. Set preserving lightness, by default is disabled.
  10971. Adjusting hues can change lightness from original RGB triplet,
  10972. with this option enabled lightness is kept at same value.
  10973. @end table
  10974. @section hysteresis
  10975. Grow first stream into second stream by connecting components.
  10976. This makes it possible to build more robust edge masks.
  10977. This filter accepts the following options:
  10978. @table @option
  10979. @item planes
  10980. Set which planes will be processed as bitmap, unprocessed planes will be
  10981. copied from first stream.
  10982. By default value 0xf, all planes will be processed.
  10983. @item threshold
  10984. Set threshold which is used in filtering. If pixel component value is higher than
  10985. this value filter algorithm for connecting components is activated.
  10986. By default value is 0.
  10987. @end table
  10988. The @code{hysteresis} filter also supports the @ref{framesync} options.
  10989. @section iccdetect
  10990. Detect the colorspace from an embedded ICC profile (if present), and update
  10991. the frame's tags accordingly.
  10992. This filter accepts the following options:
  10993. @table @option
  10994. @item force
  10995. If true, the frame's existing colorspace tags will always be overridden by
  10996. values detected from an ICC profile. Otherwise, they will only be assigned if
  10997. they contain @code{unknown}. Enabled by default.
  10998. @end table
  10999. @section iccgen
  11000. Generate ICC profiles and attach them to frames.
  11001. This filter accepts the following options:
  11002. @table @option
  11003. @item color_primaries
  11004. @item color_trc
  11005. Configure the colorspace that the ICC profile will be generated for. The
  11006. default value of @code{auto} infers the value from the input frame's metadata,
  11007. defaulting to BT.709/sRGB as appropriate.
  11008. See the @ref{setparams} filter for a list of possible values, but note that
  11009. @code{unknown} are not valid values for this filter.
  11010. @item force
  11011. If true, an ICC profile will be generated even if it would overwrite an
  11012. already existing ICC profile. Disabled by default.
  11013. @end table
  11014. @section identity
  11015. Obtain the identity score between two input videos.
  11016. This filter takes two input videos.
  11017. Both input videos must have the same resolution and pixel format for
  11018. this filter to work correctly. Also it assumes that both inputs
  11019. have the same number of frames, which are compared one by one.
  11020. The obtained per component, average, min and max identity score is printed through
  11021. the logging system.
  11022. The filter stores the calculated identity scores of each frame in frame metadata.
  11023. In the below example the input file @file{main.mpg} being processed is compared
  11024. with the reference file @file{ref.mpg}.
  11025. @example
  11026. ffmpeg -i main.mpg -i ref.mpg -lavfi identity -f null -
  11027. @end example
  11028. @section idet
  11029. Detect video interlacing type.
  11030. This filter tries to detect if the input frames are interlaced, progressive,
  11031. top or bottom field first. It will also try to detect fields that are
  11032. repeated between adjacent frames (a sign of telecine).
  11033. Single frame detection considers only immediately adjacent frames when classifying each frame.
  11034. Multiple frame detection incorporates the classification history of previous frames.
  11035. The filter will log these metadata values:
  11036. @table @option
  11037. @item single.current_frame
  11038. Detected type of current frame using single-frame detection. One of:
  11039. ``tff'' (top field first), ``bff'' (bottom field first),
  11040. ``progressive'', or ``undetermined''
  11041. @item single.tff
  11042. Cumulative number of frames detected as top field first using single-frame detection.
  11043. @item multiple.tff
  11044. Cumulative number of frames detected as top field first using multiple-frame detection.
  11045. @item single.bff
  11046. Cumulative number of frames detected as bottom field first using single-frame detection.
  11047. @item multiple.current_frame
  11048. Detected type of current frame using multiple-frame detection. One of:
  11049. ``tff'' (top field first), ``bff'' (bottom field first),
  11050. ``progressive'', or ``undetermined''
  11051. @item multiple.bff
  11052. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  11053. @item single.progressive
  11054. Cumulative number of frames detected as progressive using single-frame detection.
  11055. @item multiple.progressive
  11056. Cumulative number of frames detected as progressive using multiple-frame detection.
  11057. @item single.undetermined
  11058. Cumulative number of frames that could not be classified using single-frame detection.
  11059. @item multiple.undetermined
  11060. Cumulative number of frames that could not be classified using multiple-frame detection.
  11061. @item repeated.current_frame
  11062. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  11063. @item repeated.neither
  11064. Cumulative number of frames with no repeated field.
  11065. @item repeated.top
  11066. Cumulative number of frames with the top field repeated from the previous frame's top field.
  11067. @item repeated.bottom
  11068. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  11069. @end table
  11070. The filter accepts the following options:
  11071. @table @option
  11072. @item intl_thres
  11073. Set interlacing threshold.
  11074. @item prog_thres
  11075. Set progressive threshold.
  11076. @item rep_thres
  11077. Threshold for repeated field detection.
  11078. @item half_life
  11079. Number of frames after which a given frame's contribution to the
  11080. statistics is halved (i.e., it contributes only 0.5 to its
  11081. classification). The default of 0 means that all frames seen are given
  11082. full weight of 1.0 forever.
  11083. @item analyze_interlaced_flag
  11084. When this is not 0 then idet will use the specified number of frames to determine
  11085. if the interlaced flag is accurate, it will not count undetermined frames.
  11086. If the flag is found to be accurate it will be used without any further
  11087. computations, if it is found to be inaccurate it will be cleared without any
  11088. further computations. This allows inserting the idet filter as a low computational
  11089. method to clean up the interlaced flag
  11090. @end table
  11091. @section il
  11092. Deinterleave or interleave fields.
  11093. This filter allows one to process interlaced images fields without
  11094. deinterlacing them. Deinterleaving splits the input frame into 2
  11095. fields (so called half pictures). Odd lines are moved to the top
  11096. half of the output image, even lines to the bottom half.
  11097. You can process (filter) them independently and then re-interleave them.
  11098. The filter accepts the following options:
  11099. @table @option
  11100. @item luma_mode, l
  11101. @item chroma_mode, c
  11102. @item alpha_mode, a
  11103. Available values for @var{luma_mode}, @var{chroma_mode} and
  11104. @var{alpha_mode} are:
  11105. @table @samp
  11106. @item none
  11107. Do nothing.
  11108. @item deinterleave, d
  11109. Deinterleave fields, placing one above the other.
  11110. @item interleave, i
  11111. Interleave fields. Reverse the effect of deinterleaving.
  11112. @end table
  11113. Default value is @code{none}.
  11114. @item luma_swap, ls
  11115. @item chroma_swap, cs
  11116. @item alpha_swap, as
  11117. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  11118. @end table
  11119. @subsection Commands
  11120. This filter supports the all above options as @ref{commands}.
  11121. @section inflate
  11122. Apply inflate effect to the video.
  11123. This filter replaces the pixel by the local(3x3) average by taking into account
  11124. only values higher than the pixel.
  11125. It accepts the following options:
  11126. @table @option
  11127. @item threshold0
  11128. @item threshold1
  11129. @item threshold2
  11130. @item threshold3
  11131. Limit the maximum change for each plane, default is 65535.
  11132. If 0, plane will remain unchanged.
  11133. @end table
  11134. @subsection Commands
  11135. This filter supports the all above options as @ref{commands}.
  11136. @section interlace
  11137. Simple interlacing filter from progressive contents. This interleaves upper (or
  11138. lower) lines from odd frames with lower (or upper) lines from even frames,
  11139. halving the frame rate and preserving image height.
  11140. @example
  11141. Original Original New Frame
  11142. Frame 'j' Frame 'j+1' (tff)
  11143. ========== =========== ==================
  11144. Line 0 --------------------> Frame 'j' Line 0
  11145. Line 1 Line 1 ----> Frame 'j+1' Line 1
  11146. Line 2 ---------------------> Frame 'j' Line 2
  11147. Line 3 Line 3 ----> Frame 'j+1' Line 3
  11148. ... ... ...
  11149. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  11150. @end example
  11151. It accepts the following optional parameters:
  11152. @table @option
  11153. @item scan
  11154. This determines whether the interlaced frame is taken from the even
  11155. (tff - default) or odd (bff) lines of the progressive frame.
  11156. @item lowpass
  11157. Vertical lowpass filter to avoid twitter interlacing and
  11158. reduce moire patterns.
  11159. @table @samp
  11160. @item 0, off
  11161. Disable vertical lowpass filter
  11162. @item 1, linear
  11163. Enable linear filter (default)
  11164. @item 2, complex
  11165. Enable complex filter. This will slightly less reduce twitter and moire
  11166. but better retain detail and subjective sharpness impression.
  11167. @end table
  11168. @end table
  11169. @section kerndeint
  11170. Deinterlace input video by applying Donald Graft's adaptive kernel
  11171. deinterling. Work on interlaced parts of a video to produce
  11172. progressive frames.
  11173. The description of the accepted parameters follows.
  11174. @table @option
  11175. @item thresh
  11176. Set the threshold which affects the filter's tolerance when
  11177. determining if a pixel line must be processed. It must be an integer
  11178. in the range [0,255] and defaults to 10. A value of 0 will result in
  11179. applying the process on every pixels.
  11180. @item map
  11181. Paint pixels exceeding the threshold value to white if set to 1.
  11182. Default is 0.
  11183. @item order
  11184. Set the fields order. Swap fields if set to 1, leave fields alone if
  11185. 0. Default is 0.
  11186. @item sharp
  11187. Enable additional sharpening if set to 1. Default is 0.
  11188. @item twoway
  11189. Enable twoway sharpening if set to 1. Default is 0.
  11190. @end table
  11191. @subsection Examples
  11192. @itemize
  11193. @item
  11194. Apply default values:
  11195. @example
  11196. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  11197. @end example
  11198. @item
  11199. Enable additional sharpening:
  11200. @example
  11201. kerndeint=sharp=1
  11202. @end example
  11203. @item
  11204. Paint processed pixels in white:
  11205. @example
  11206. kerndeint=map=1
  11207. @end example
  11208. @end itemize
  11209. @section kirsch
  11210. Apply kirsch operator to input video stream.
  11211. The filter accepts the following option:
  11212. @table @option
  11213. @item planes
  11214. Set which planes will be processed, unprocessed planes will be copied.
  11215. By default value 0xf, all planes will be processed.
  11216. @item scale
  11217. Set value which will be multiplied with filtered result.
  11218. @item delta
  11219. Set value which will be added to filtered result.
  11220. @end table
  11221. @subsection Commands
  11222. This filter supports the all above options as @ref{commands}.
  11223. @section lagfun
  11224. Slowly update darker pixels.
  11225. This filter makes short flashes of light appear longer.
  11226. This filter accepts the following options:
  11227. @table @option
  11228. @item decay
  11229. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  11230. @item planes
  11231. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  11232. @end table
  11233. @subsection Commands
  11234. This filter supports the all above options as @ref{commands}.
  11235. @section lenscorrection
  11236. Correct radial lens distortion
  11237. This filter can be used to correct for radial distortion as can result from the use
  11238. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  11239. one can use tools available for example as part of opencv or simply trial-and-error.
  11240. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  11241. and extract the k1 and k2 coefficients from the resulting matrix.
  11242. Note that effectively the same filter is available in the open-source tools Krita and
  11243. Digikam from the KDE project.
  11244. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  11245. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  11246. brightness distribution, so you may want to use both filters together in certain
  11247. cases, though you will have to take care of ordering, i.e. whether vignetting should
  11248. be applied before or after lens correction.
  11249. @subsection Options
  11250. The filter accepts the following options:
  11251. @table @option
  11252. @item cx
  11253. Relative x-coordinate of the focal point of the image, and thereby the center of the
  11254. distortion. This value has a range [0,1] and is expressed as fractions of the image
  11255. width. Default is 0.5.
  11256. @item cy
  11257. Relative y-coordinate of the focal point of the image, and thereby the center of the
  11258. distortion. This value has a range [0,1] and is expressed as fractions of the image
  11259. height. Default is 0.5.
  11260. @item k1
  11261. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  11262. no correction. Default is 0.
  11263. @item k2
  11264. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  11265. 0 means no correction. Default is 0.
  11266. @item i
  11267. Set interpolation type. Can be @code{nearest} or @code{bilinear}.
  11268. Default is @code{nearest}.
  11269. @item fc
  11270. Specify the color of the unmapped pixels. For the syntax of this option,
  11271. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11272. manual,ffmpeg-utils}. Default color is @code{black@@0}.
  11273. @end table
  11274. The formula that generates the correction is:
  11275. @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)
  11276. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  11277. distances from the focal point in the source and target images, respectively.
  11278. @subsection Commands
  11279. This filter supports the all above options as @ref{commands}.
  11280. @section lensfun
  11281. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  11282. The @code{lensfun} filter requires the camera make, camera model, and lens model
  11283. to apply the lens correction. The filter will load the lensfun database and
  11284. query it to find the corresponding camera and lens entries in the database. As
  11285. long as these entries can be found with the given options, the filter can
  11286. perform corrections on frames. Note that incomplete strings will result in the
  11287. filter choosing the best match with the given options, and the filter will
  11288. output the chosen camera and lens models (logged with level "info"). You must
  11289. provide the make, camera model, and lens model as they are required.
  11290. To obtain a list of available makes and models, leave out one or both of @code{make} and
  11291. @code{model} options. The filter will send the full list to the log with level @code{INFO}.
  11292. The first column is the make and the second column is the model.
  11293. To obtain a list of available lenses, set any values for make and model and leave out the
  11294. @code{lens_model} option. The filter will send the full list of lenses in the log with level
  11295. @code{INFO}. The ffmpeg tool will exit after the list is printed.
  11296. The filter accepts the following options:
  11297. @table @option
  11298. @item make
  11299. The make of the camera (for example, "Canon"). This option is required.
  11300. @item model
  11301. The model of the camera (for example, "Canon EOS 100D"). This option is
  11302. required.
  11303. @item lens_model
  11304. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  11305. option is required.
  11306. @item db_path
  11307. The full path to the lens database folder. If not set, the filter will attempt to
  11308. load the database from the install path when the library was built. Default is unset.
  11309. @item mode
  11310. The type of correction to apply. The following values are valid options:
  11311. @table @samp
  11312. @item vignetting
  11313. Enables fixing lens vignetting.
  11314. @item geometry
  11315. Enables fixing lens geometry. This is the default.
  11316. @item subpixel
  11317. Enables fixing chromatic aberrations.
  11318. @item vig_geo
  11319. Enables fixing lens vignetting and lens geometry.
  11320. @item vig_subpixel
  11321. Enables fixing lens vignetting and chromatic aberrations.
  11322. @item distortion
  11323. Enables fixing both lens geometry and chromatic aberrations.
  11324. @item all
  11325. Enables all possible corrections.
  11326. @end table
  11327. @item focal_length
  11328. The focal length of the image/video (zoom; expected constant for video). For
  11329. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  11330. range should be chosen when using that lens. Default 18.
  11331. @item aperture
  11332. The aperture of the image/video (expected constant for video). Note that
  11333. aperture is only used for vignetting correction. Default 3.5.
  11334. @item focus_distance
  11335. The focus distance of the image/video (expected constant for video). Note that
  11336. focus distance is only used for vignetting and only slightly affects the
  11337. vignetting correction process. If unknown, leave it at the default value (which
  11338. is 1000).
  11339. @item scale
  11340. The scale factor which is applied after transformation. After correction the
  11341. video is no longer necessarily rectangular. This parameter controls how much of
  11342. the resulting image is visible. The value 0 means that a value will be chosen
  11343. automatically such that there is little or no unmapped area in the output
  11344. image. 1.0 means that no additional scaling is done. Lower values may result
  11345. in more of the corrected image being visible, while higher values may avoid
  11346. unmapped areas in the output.
  11347. @item target_geometry
  11348. The target geometry of the output image/video. The following values are valid
  11349. options:
  11350. @table @samp
  11351. @item rectilinear (default)
  11352. @item fisheye
  11353. @item panoramic
  11354. @item equirectangular
  11355. @item fisheye_orthographic
  11356. @item fisheye_stereographic
  11357. @item fisheye_equisolid
  11358. @item fisheye_thoby
  11359. @end table
  11360. @item reverse
  11361. Apply the reverse of image correction (instead of correcting distortion, apply
  11362. it).
  11363. @item interpolation
  11364. The type of interpolation used when correcting distortion. The following values
  11365. are valid options:
  11366. @table @samp
  11367. @item nearest
  11368. @item linear (default)
  11369. @item lanczos
  11370. @end table
  11371. @end table
  11372. @subsection Examples
  11373. @itemize
  11374. @item
  11375. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  11376. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  11377. aperture of "8.0".
  11378. @example
  11379. 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
  11380. @end example
  11381. @item
  11382. Apply the same as before, but only for the first 5 seconds of video.
  11383. @example
  11384. 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
  11385. @end example
  11386. @end itemize
  11387. @section libplacebo
  11388. Flexible GPU-accelerated processing filter based on libplacebo
  11389. (@url{https://code.videolan.org/videolan/libplacebo}). Note that this filter
  11390. currently only accepts Vulkan input frames.
  11391. @subsection Options
  11392. The options for this filter are divided into the following sections:
  11393. @subsubsection Output mode
  11394. These options control the overall output mode. By default, libplacebo will try
  11395. to preserve the source colorimetry and size as best as it can, but it will
  11396. apply any embedded film grain, dolby vision metadata or anamorphic SAR present
  11397. in source frames.
  11398. @table @option
  11399. @item w
  11400. @item h
  11401. Set the output video dimension expression. Default value is the input dimension.
  11402. Allows for the same expressions as the @ref{scale} filter.
  11403. @item format
  11404. Set the output format override. If unset (the default), frames will be output
  11405. in the same format as the respective input frames. Otherwise, format conversion
  11406. will be performed.
  11407. @item force_original_aspect_ratio
  11408. @item force_divisible_by
  11409. Work the same as the identical @ref{scale} filter options.
  11410. @item normalize_sar
  11411. If enabled (the default), output frames will always have a pixel aspect ratio
  11412. of 1:1. If disabled, any aspect ratio mismatches, including those from e.g.
  11413. anamorphic video sources, are forwarded to the output pixel aspect ratio.
  11414. @item pad_crop_ratio
  11415. Specifies a ratio (between @code{0.0} and @code{1.0}) between padding and
  11416. cropping when the input aspect ratio does not match the output aspect ratio and
  11417. @option{normalize_sar} is in effect. The default of @code{0.0} always pads the
  11418. content with black borders, while a value of @code{1.0} always crops off parts
  11419. of the content. Intermediate values are possible, leading to a mix of the two
  11420. approaches.
  11421. @item colorspace
  11422. @item color_primaries
  11423. @item color_trc
  11424. @item range
  11425. Configure the colorspace that output frames will be delivered in. The default
  11426. value of @code{auto} outputs frames in the same format as the input frames,
  11427. leading to no change. For any other value, conversion will be performed.
  11428. See the @ref{setparams} filter for a list of possible values.
  11429. @item apply_filmgrain
  11430. Apply film grain (e.g. AV1 or H.274) if present in source frames, and strip
  11431. it from the output. Enabled by default.
  11432. @item apply_dolbyvision
  11433. Apply Dolby Vision RPU metadata if present in source frames, and strip it from
  11434. the output. Enabled by default. Note that Dolby Vision will always output
  11435. BT.2020+PQ, overriding the usual input frame metadata. These will also be
  11436. picked as the values of @code{auto} for the respective frame output options.
  11437. @end table
  11438. @subsubsection Scaling
  11439. The options in this section control how libplacebo performs upscaling and (if
  11440. necessary) downscaling. Note that libplacebo will always internally operate on
  11441. 4:4:4 content, so any sub-sampled chroma formats such as @code{yuv420p} will
  11442. necessarily be upsampled and downsampled as part of the rendering process. That
  11443. means scaling might be in effect even if the source and destination resolution
  11444. are the same.
  11445. @table @option
  11446. @item upscaler
  11447. @item downscaler
  11448. Configure the filter kernel used for upscaling and downscaling. The respective
  11449. defaults are @code{spline36} and @code{mitchell}. For a full list of possible
  11450. values, pass @code{help} to these options. The most important values are:
  11451. @table @samp
  11452. @item none
  11453. Forces the use of built-in GPU texture sampling (typically bilinear). Extremely
  11454. fast but poor quality, especially when downscaling.
  11455. @item bilinear
  11456. Bilinear interpolation. Can generally be done for free on GPUs, except when
  11457. doing so would lead to aliasing. Fast and low quality.
  11458. @item nearest
  11459. Nearest-neighbour interpolation. Sharp but highly aliasing.
  11460. @item oversample
  11461. Algorithm that looks visually similar to nearest-neighbour interpolation but
  11462. tries to preserve pixel aspect ratio. Good for pixel art, since it results in
  11463. minimal distortion of the artistic appearance.
  11464. @item lanczos
  11465. Standard sinc-sinc interpolation kernel.
  11466. @item spline36
  11467. Cubic spline approximation of lanczos. No difference in performance, but has
  11468. very slightly less ringing.
  11469. @item ewa_lanczos
  11470. Elliptically weighted average version of lanczos, based on a jinc-sinc kernel.
  11471. This is also popularly referred to as just "Jinc scaling". Slow but very high
  11472. quality.
  11473. @item gaussian
  11474. Gaussian kernel. Has certain ideal mathematical properties, but subjectively
  11475. very blurry.
  11476. @item mitchell
  11477. Cubic BC spline with parameters recommended by Mitchell and Netravali. Very
  11478. little ringing.
  11479. @end table
  11480. @item lut_entries
  11481. Configures the size of scaler LUTs, ranging from @code{1} to @code{256}. The
  11482. default of @code{0} will pick libplacebo's internal default, typically
  11483. @code{64}.
  11484. @item antiringing
  11485. Enables anti-ringing (for non-EWA filters). The value (between @code{0.0} and
  11486. @code{1.0}) configures the strength of the anti-ringing algorithm. May increase
  11487. aliasing if set too high. Disabled by default.
  11488. @item sigmoid
  11489. Enable sigmoidal compression during upscaling. Reduces ringing slightly.
  11490. Enabled by default.
  11491. @end table
  11492. @subsubsection Debanding
  11493. Libplacebo comes with a built-in debanding filter that is good at counteracting
  11494. many common sources of banding and blocking. Turning this on is highly
  11495. recommended whenever quality is desired.
  11496. @table @option
  11497. @item deband
  11498. Enable (fast) debanding algorithm. Disabled by default.
  11499. @item deband_iterations
  11500. Number of deband iterations of the debanding algorithm. Each iteration is
  11501. performed with progressively increased radius (and diminished threshold).
  11502. Recommended values are in the range @code{1} to @code{4}. Defaults to @code{1}.
  11503. @item deband_threshold
  11504. Debanding filter strength. Higher numbers lead to more aggressive debanding.
  11505. Defaults to @code{4.0}.
  11506. @item deband_radius
  11507. Debanding filter radius. A higher radius is better for slow gradients, while
  11508. a lower radius is better for steep gradients. Defaults to @code{16.0}.
  11509. @item deband_grain
  11510. Amount of extra output grain to add. Helps hide imperfections. Defaults to
  11511. @code{6.0}.
  11512. @end table
  11513. @subsubsection Color adjustment
  11514. A collection of subjective color controls. Not very rigorous, so the exact
  11515. effect will vary somewhat depending on the input primaries and colorspace.
  11516. @table @option
  11517. @item brightness
  11518. Brightness boost, between @code{-1.0} and @code{1.0}. Defaults to @code{0.0}.
  11519. @item contrast
  11520. Contrast gain, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  11521. @item saturation
  11522. Saturation gain, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  11523. @item hue
  11524. Hue shift in radians, between @code{-3.14} and @code{3.14}. Defaults to
  11525. @code{0.0}. This will rotate the UV subvector, defaulting to BT.709
  11526. coefficients for RGB inputs.
  11527. @item gamma
  11528. Gamma adjustment, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  11529. @item cones
  11530. Cone model to use for color blindness simulation. Accepts any combination of
  11531. @code{l}, @code{m} and @code{s}. Here are some examples:
  11532. @table @samp
  11533. @item m
  11534. Deuteranomaly / deuteranopia (affecting 3%-4% of the population)
  11535. @item l
  11536. Protanomaly / protanopia (affecting 1%-2% of the population)
  11537. @item l+m
  11538. Monochromacy (very rare)
  11539. @item l+m+s
  11540. Achromatopsy (complete loss of daytime vision, extremely rare)
  11541. @end table
  11542. @item cone-strength
  11543. Gain factor for the cones specified by @code{cones}, between @code{0.0} and
  11544. @code{10.0}. A value of @code{1.0} results in no change to color vision. A
  11545. value of @code{0.0} (the default) simulates complete loss of those cones. Values
  11546. above @code{1.0} result in exaggerating the differences between cones, which
  11547. may help compensate for reduced color vision.
  11548. @end table
  11549. @subsubsection Peak detection
  11550. To help deal with sources that only have static HDR10 metadata (or no tagging
  11551. whatsoever), libplacebo uses its own internal frame analysis compute shader to
  11552. analyze source frames and adapt the tone mapping function in realtime. If this
  11553. is too slow, or if exactly reproducible frame-perfect results are needed, it's
  11554. recommended to turn this feature off.
  11555. @table @option
  11556. @item peak_detect
  11557. Enable HDR peak detection. Ignores static MaxCLL/MaxFALL values in favor of
  11558. dynamic detection from the input. Note that the detected values do not get
  11559. written back to the output frames, they merely guide the internal tone mapping
  11560. process. Enabled by default.
  11561. @item smoothing_period
  11562. Peak detection smoothing period, between @code{0.0} and @code{1000.0}. Higher
  11563. values result in peak detection becoming less responsive to changes in the
  11564. input. Defaults to @code{100.0}.
  11565. @item minimum_peak
  11566. Lower bound on the detected peak (relative to SDR white), between @code{0.0}
  11567. and @code{100.0}. Defaults to @code{1.0}.
  11568. @item scene_threshold_low
  11569. @item scene_threshold_high
  11570. Lower and upper thresholds for scene change detection. Expressed in a
  11571. logarithmic scale between @code{0.0} and @code{100.0}. Default to @code{5.5}
  11572. and @code{10.0}, respectively. Setting either to a negative value disables
  11573. this functionality.
  11574. @item overshoot
  11575. Peak smoothing overshoot margin, between @code{0.0} and @code{1.0}. Provides a
  11576. safety margin to prevent clipping as a result of peak smoothing. Defaults to
  11577. @code{0.05}, corresponding to a margin of 5%.
  11578. @end table
  11579. @subsubsection Tone mapping
  11580. The options in this section control how libplacebo performs tone-mapping and
  11581. gamut-mapping when dealing with mismatches between wide-gamut or HDR content.
  11582. In general, libplacebo relies on accurate source tagging and mastering display
  11583. gamut information to produce the best results.
  11584. @table @option
  11585. @item intent
  11586. Rendering intent to use when adapting between different primary color gamuts
  11587. (after tone-mapping).
  11588. @table @samp
  11589. @item perceptual
  11590. Perceptual gamut mapping. Currently equivalent to relative colorimetric.
  11591. @item relative
  11592. Relative colorimetric. This is the default.
  11593. @item absolute
  11594. Absolute colorimetric.
  11595. @item saturation
  11596. Saturation mapping. Forcibly stretches the source gamut to the target gamut.
  11597. @end table
  11598. @item gamut_mode
  11599. How to handle out-of-gamut colors that can occur as a result of colorimetric
  11600. gamut mapping.
  11601. @table @samp
  11602. @item clip
  11603. Do nothing, simply clip out-of-range colors to the RGB volume. This is the
  11604. default.
  11605. @item warn
  11606. Highlight out-of-gamut pixels (by coloring them pink).
  11607. @item darken
  11608. Linearly reduces content brightness to preserves saturated details, followed by
  11609. clipping the remaining out-of-gamut colors. As the name implies, this makes
  11610. everything darker, but provides a good balance between preserving details and
  11611. colors.
  11612. @item desaturate
  11613. Hard-desaturates out-of-gamut colors towards white, while preserving the
  11614. luminance. Has a tendency to shift colors.
  11615. @end table
  11616. @item tonemapping
  11617. Tone-mapping algorithm to use. Available values are:
  11618. @table @samp
  11619. @item auto
  11620. Automatic selection based on internal heuristics. This is the default.
  11621. @item clip
  11622. Performs no tone-mapping, just clips out-of-range colors. Retains perfect color
  11623. accuracy for in-range colors but completely destroys out-of-range information.
  11624. Does not perform any black point adaptation. Not configurable.
  11625. @item bt.2390
  11626. EETF from the ITU-R Report BT.2390, a hermite spline roll-off with linear
  11627. segment. The knee point offset is configurable. Note that this parameter
  11628. defaults to @code{1.0}, rather than the value of @code{0.5} from the ITU-R
  11629. spec.
  11630. @item bt.2446a
  11631. EETF from ITU-R Report BT.2446, method A. Designed for well-mastered HDR
  11632. sources. Can be used for both forward and inverse tone mapping. Not
  11633. configurable.
  11634. @item spline
  11635. Simple spline consisting of two polynomials, joined by a single pivot point.
  11636. The parameter gives the pivot point (in PQ space), defaulting to @code{0.30}.
  11637. Can be used for both forward and inverse tone mapping.
  11638. @item reinhard
  11639. Simple non-linear, global tone mapping algorithm. The parameter specifies the
  11640. local contrast coefficient at the display peak. Essentially, a parameter of
  11641. @code{0.5} implies that the reference white will be about half as bright as
  11642. when clipping. Defaults to @code{0.5}, which results in the simplest
  11643. formulation of this function.
  11644. @item mobius
  11645. Generalization of the reinhard tone mapping algorithm to support an additional
  11646. linear slope near black. The tone mapping parameter indicates the trade-off
  11647. between the linear section and the non-linear section. Essentially, for a given
  11648. parameter @var{x}, every color value below @var{x} will be mapped linearly,
  11649. while higher values get non-linearly tone-mapped. Values near @code{1.0} make
  11650. this curve behave like @code{clip}, while values near @code{0.0} make this
  11651. curve behave like @code{reinhard}. The default value is @code{0.3}, which
  11652. provides a good balance between colorimetric accuracy and preserving
  11653. out-of-gamut details.
  11654. @item hable
  11655. Piece-wise, filmic tone-mapping algorithm developed by John Hable for use in
  11656. Uncharted 2, inspired by a similar tone-mapping algorithm used by Kodak.
  11657. Popularized by its use in video games with HDR rendering. Preserves both dark
  11658. and bright details very well, but comes with the drawback of changing the
  11659. average brightness quite significantly. This is sort of similar to
  11660. @code{reinhard} with parameter @code{0.24}.
  11661. @item gamma
  11662. Fits a gamma (power) function to transfer between the source and target color
  11663. spaces, effectively resulting in a perceptual hard-knee joining two roughly
  11664. linear sections. This preserves details at all scales fairly accurately, but
  11665. can result in an image with a muted or dull appearance. The parameter is used
  11666. as the cutoff point, defaulting to @code{0.5}.
  11667. @item linear
  11668. Linearly stretches the input range to the output range, in PQ space. This will
  11669. preserve all details accurately, but results in a significantly different
  11670. average brightness. Can be used for inverse tone-mapping in addition to regular
  11671. tone-mapping. The parameter can be used as an additional linear gain
  11672. coefficient (defaulting to @code{1.0}).
  11673. @end table
  11674. @item tonemapping_param
  11675. For tunable tone mapping functions, this parameter can be used to fine-tune the
  11676. curve behavior. Refer to the documentation of @code{tonemapping}. The default
  11677. value of @code{0.0} is replaced by the curve's preferred default setting.
  11678. @item tonemapping_mode
  11679. This option determines how the tone mapping function specified by
  11680. @code{tonemapping} is applied to the colors in a scene. Possible values are:
  11681. @table @samp
  11682. @item auto
  11683. Automatic selection based on internal heuristics. This is the default.
  11684. @item rgb
  11685. Apply the function per-channel in the RGB colorspace.
  11686. Per-channel tone-mapping in RGB. Guarantees no clipping and heavily desaturates
  11687. the output, but distorts the colors quite significantly. Very similar to the
  11688. "Hollywood" look and feel.
  11689. @item max
  11690. Tone-mapping is performed on the brightest component found in the signal. Good
  11691. at preserving details in highlights, but has a tendency to crush blacks.
  11692. @item hybrid
  11693. Tone-map per-channel for highlights and linearly (luma-based) for
  11694. midtones/shadows, based on a fixed gamma @code{2.4} coefficient curve.
  11695. @item luma
  11696. Tone-map linearly on the luma component (CIE Y), and adjust (desaturate) the
  11697. chromaticities to compensate using a simple constant factor. This is
  11698. essentially the mode used in ITU-R BT.2446 method A.
  11699. @end table
  11700. @item inverse_tonemapping
  11701. If enabled, this filter will also attempt stretching SDR signals to fill HDR
  11702. output color volumes. Disabled by default.
  11703. @item tonemapping_crosstalk
  11704. Extra tone-mapping crosstalk factor, between @code{0.0} and @code{0.3}. This
  11705. can help reduce issues tone-mapping certain bright spectral colors. Defaults to
  11706. @code{0.04}.
  11707. @item tonemapping_lut_size
  11708. Size of the tone-mapping LUT, between @code{2} and @code{1024}. Defaults to
  11709. @code{256}. Note that this figure is squared when combined with
  11710. @code{peak_detect}.
  11711. @end table
  11712. @subsubsection Dithering
  11713. By default, libplacebo will dither whenever necessary, which includes rendering
  11714. to any integer format below 16-bit precision. It's recommended to always leave
  11715. this on, since not doing so may result in visible banding in the output, even
  11716. if the @code{debanding} filter is enabled. If maximum performance is needed,
  11717. use @code{ordered_fixed} instead of disabling dithering.
  11718. @table @option
  11719. @item dithering
  11720. Dithering method to use. Accepts the following values:
  11721. @table @samp
  11722. @item none
  11723. Disables dithering completely. May result in visible banding.
  11724. @item blue
  11725. Dither with pseudo-blue noise. This is the default.
  11726. @item ordered
  11727. Tunable ordered dither pattern.
  11728. @item ordered_fixed
  11729. Faster ordered dither with a fixed size of @code{6}. Texture-less.
  11730. @item white
  11731. Dither with white noise. Texture-less.
  11732. @end table
  11733. @item dither_lut_size
  11734. Dither LUT size, as log base2 between @code{1} and @code{8}. Defaults to
  11735. @code{6}, corresponding to a LUT size of @code{64x64}.
  11736. @item dither_temporal
  11737. Enables temporal dithering. Disabled by default.
  11738. @end table
  11739. @subsubsection Custom shaders
  11740. libplacebo supports a number of custom shaders based on the mpv .hook GLSL
  11741. syntax. A collection of such shaders can be found here:
  11742. @url{https://github.com/mpv-player/mpv/wiki/User-Scripts#user-shaders}
  11743. A full description of the mpv shader format is beyond the scope of this
  11744. section, but a summary can be found here:
  11745. @url{https://mpv.io/manual/master/#options-glsl-shader}
  11746. @table @option
  11747. @item custom_shader_path
  11748. Specifies a path to a custom shader file to load at runtime.
  11749. @item custom_shader_bin
  11750. Specifies a complete custom shader as a raw string.
  11751. @end table
  11752. @subsubsection Debugging / performance
  11753. All of the options in this section default off. They may be of assistance when
  11754. attempting to squeeze the maximum performance at the cost of quality.
  11755. @table @option
  11756. @item skip_aa
  11757. Disable anti-aliasing when downscaling.
  11758. @item polar_cutoff
  11759. Truncate polar (EWA) scaler kernels below this absolute magnitude, between
  11760. @code{0.0} and @code{1.0}.
  11761. @item disable_linear
  11762. Disable linear light scaling.
  11763. @item disable_builtin
  11764. Disable built-in GPU sampling (forces LUT).
  11765. @item force_icc_lut
  11766. Force the use of a full ICC 3DLUT for gamut mapping.
  11767. @item disable_fbos
  11768. Forcibly disable FBOs, resulting in loss of almost all functionality, but
  11769. offering the maximum possible speed.
  11770. @end table
  11771. @subsection Commands
  11772. This filter supports almost all of the above options as @ref{commands}.
  11773. @subsection Examples
  11774. @itemize
  11775. @item
  11776. Complete example for how to initialize the Vulkan device, upload frames to the
  11777. GPU, perform filter conversion to yuv420p, and download frames back to the CPU
  11778. for output. Note that in specific cases you can get around the need to perform
  11779. format conversion by specifying the correct @code{format} filter option
  11780. corresponding to the input frames.
  11781. @example
  11782. ffmpeg -i $INPUT -init_hw_device vulkan -vf hwupload,libplacebo=format=yuv420p,hwdownload,format=yuv420p $OUTPUT
  11783. @end example
  11784. @item
  11785. Tone-map input to standard gamut BT.709 output:
  11786. @example
  11787. libplacebo=colorspace=bt709:color_primaries=bt709:color_trc=bt709:range=tv
  11788. @end example
  11789. @item
  11790. Rescale input to fit into standard 1080p, with high quality scaling:
  11791. @example
  11792. libplacebo=w=1920:h=1080:force_original_aspect_ratio=decrease:normalize_sar=true:upscaler=ewa_lanczos:downscaler=ewa_lanczos
  11793. @end example
  11794. @item
  11795. Convert input to standard sRGB JPEG:
  11796. @example
  11797. libplacebo=format=yuv420p:colorspace=bt470bg:color_primaries=bt709:color_trc=iec61966-2-1:range=pc
  11798. @end example
  11799. @item
  11800. Use higher quality debanding settings:
  11801. @example
  11802. libplacebo=deband=true:deband_iterations=3:deband_radius=8:deband_threshold=6
  11803. @end example
  11804. @item
  11805. Run this filter on the CPU, on systems with Mesa installed (and with the most
  11806. expensive options disabled):
  11807. @example
  11808. ffmpeg ... -init_hw_device vulkan:llvmpipe ... -vf libplacebo=upscaler=none:downscaler=none:peak_detect=false
  11809. @end example
  11810. @item
  11811. Suppress CPU-based AV1/H.274 film grain application in the decoder, in favor of
  11812. doing it with this filter. Note that this is only a gain if the frames are
  11813. either already on the GPU, or if you're using libplacebo for other purposes,
  11814. since otherwise the VRAM roundtrip will more than offset any expected speedup.
  11815. @example
  11816. ffmpeg -export_side_data +film_grain ... -vf libplacebo=apply_filmgrain=true
  11817. @end example
  11818. @end itemize
  11819. @section libvmaf
  11820. Calulate the VMAF (Video Multi-Method Assessment Fusion) score for a
  11821. reference/distorted pair of input videos.
  11822. The first input is the distorted video, and the second input is the reference video.
  11823. The obtained VMAF score is printed through the logging system.
  11824. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  11825. After installing the library it can be enabled using:
  11826. @code{./configure --enable-libvmaf}.
  11827. The filter has following options:
  11828. @table @option
  11829. @item model
  11830. A `|` delimited list of vmaf models. Each model can be configured with a number of parameters.
  11831. Default value: @code{"version=vmaf_v0.6.1"}
  11832. @item model_path
  11833. Deprecated, use model='path=...'.
  11834. @item enable_transform
  11835. Deprecated, use model='enable_transform=true'.
  11836. @item phone_model
  11837. Deprecated, use model='enable_transform=true'.
  11838. @item enable_conf_interval
  11839. Deprecated, use model='enable_conf_interval=true'.
  11840. @item feature
  11841. A `|` delimited list of features. Each feature can be configured with a number of parameters.
  11842. @item psnr
  11843. Deprecated, use feature='name=psnr'.
  11844. @item ssim
  11845. Deprecated, use feature='name=ssim'.
  11846. @item ms_ssim
  11847. Deprecated, use feature='name=ms_ssim'.
  11848. @item log_path
  11849. Set the file path to be used to store log files.
  11850. @item log_fmt
  11851. Set the format of the log file (xml, json, csv, or sub).
  11852. @item n_threads
  11853. Set number of threads to be used when initializing libvmaf.
  11854. Default value: @code{0}, no threads.
  11855. @item n_subsample
  11856. Set frame subsampling interval to be used.
  11857. @end table
  11858. This filter also supports the @ref{framesync} options.
  11859. @subsection Examples
  11860. @itemize
  11861. @item
  11862. In the examples below, a distorted video @file{distorted.mpg} is
  11863. compared with a reference file @file{reference.mpg}.
  11864. @item
  11865. Basic usage:
  11866. @example
  11867. ffmpeg -i distorted.mpg -i reference.mpg -lavfi libvmaf=log_path=output.xml -f null -
  11868. @end example
  11869. @item
  11870. Example with multiple models:
  11871. @example
  11872. 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 -
  11873. @end example
  11874. @item
  11875. Example with multiple addtional features:
  11876. @example
  11877. ffmpeg -i distorted.mpg -i reference.mpg -lavfi libvmaf='feature=name=psnr|name=ciede' -f null -
  11878. @end example
  11879. @item
  11880. Example with options and different containers:
  11881. @example
  11882. 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 -
  11883. @end example
  11884. @end itemize
  11885. @section limitdiff
  11886. Apply limited difference filter using second and optionally third video stream.
  11887. The filter accepts the following options:
  11888. @table @option
  11889. @item threshold
  11890. Set the threshold to use when allowing certain differences between video streams.
  11891. Any absolute difference value lower or exact than this threshold will pick pixel components from
  11892. first video stream.
  11893. @item elasticity
  11894. Set the elasticity of soft thresholding when processing video streams.
  11895. This value multiplied with first one sets second threshold.
  11896. Any absolute difference value greater or exact than second threshold will pick pixel components
  11897. from second video stream. For values between those two threshold
  11898. linear interpolation between first and second video stream will be used.
  11899. @item reference
  11900. Enable the reference (third) video stream processing. By default is disabled.
  11901. If set, this video stream will be used for calculating absolute difference with first video
  11902. stream.
  11903. @item planes
  11904. Specify which planes will be processed. Defaults to all available.
  11905. @end table
  11906. @subsection Commands
  11907. This filter supports the all above options as @ref{commands} except option @samp{reference}.
  11908. @section limiter
  11909. Limits the pixel components values to the specified range [min, max].
  11910. The filter accepts the following options:
  11911. @table @option
  11912. @item min
  11913. Lower bound. Defaults to the lowest allowed value for the input.
  11914. @item max
  11915. Upper bound. Defaults to the highest allowed value for the input.
  11916. @item planes
  11917. Specify which planes will be processed. Defaults to all available.
  11918. @end table
  11919. @subsection Commands
  11920. This filter supports the all above options as @ref{commands}.
  11921. @section loop
  11922. Loop video frames.
  11923. The filter accepts the following options:
  11924. @table @option
  11925. @item loop
  11926. Set the number of loops. Setting this value to -1 will result in infinite loops.
  11927. Default is 0.
  11928. @item size
  11929. Set maximal size in number of frames. Default is 0.
  11930. @item start
  11931. Set first frame of loop. Default is 0.
  11932. @end table
  11933. @subsection Examples
  11934. @itemize
  11935. @item
  11936. Loop single first frame infinitely:
  11937. @example
  11938. loop=loop=-1:size=1:start=0
  11939. @end example
  11940. @item
  11941. Loop single first frame 10 times:
  11942. @example
  11943. loop=loop=10:size=1:start=0
  11944. @end example
  11945. @item
  11946. Loop 10 first frames 5 times:
  11947. @example
  11948. loop=loop=5:size=10:start=0
  11949. @end example
  11950. @end itemize
  11951. @section lut1d
  11952. Apply a 1D LUT to an input video.
  11953. The filter accepts the following options:
  11954. @table @option
  11955. @item file
  11956. Set the 1D LUT file name.
  11957. Currently supported formats:
  11958. @table @samp
  11959. @item cube
  11960. Iridas
  11961. @item csp
  11962. cineSpace
  11963. @end table
  11964. @item interp
  11965. Select interpolation mode.
  11966. Available values are:
  11967. @table @samp
  11968. @item nearest
  11969. Use values from the nearest defined point.
  11970. @item linear
  11971. Interpolate values using the linear interpolation.
  11972. @item cosine
  11973. Interpolate values using the cosine interpolation.
  11974. @item cubic
  11975. Interpolate values using the cubic interpolation.
  11976. @item spline
  11977. Interpolate values using the spline interpolation.
  11978. @end table
  11979. @end table
  11980. @subsection Commands
  11981. This filter supports the all above options as @ref{commands}.
  11982. @anchor{lut3d}
  11983. @section lut3d
  11984. Apply a 3D LUT to an input video.
  11985. The filter accepts the following options:
  11986. @table @option
  11987. @item file
  11988. Set the 3D LUT file name.
  11989. Currently supported formats:
  11990. @table @samp
  11991. @item 3dl
  11992. AfterEffects
  11993. @item cube
  11994. Iridas
  11995. @item dat
  11996. DaVinci
  11997. @item m3d
  11998. Pandora
  11999. @item csp
  12000. cineSpace
  12001. @end table
  12002. @item interp
  12003. Select interpolation mode.
  12004. Available values are:
  12005. @table @samp
  12006. @item nearest
  12007. Use values from the nearest defined point.
  12008. @item trilinear
  12009. Interpolate values using the 8 points defining a cube.
  12010. @item tetrahedral
  12011. Interpolate values using a tetrahedron.
  12012. @item pyramid
  12013. Interpolate values using a pyramid.
  12014. @item prism
  12015. Interpolate values using a prism.
  12016. @end table
  12017. @end table
  12018. @subsection Commands
  12019. This filter supports the @code{interp} option as @ref{commands}.
  12020. @section lumakey
  12021. Turn certain luma values into transparency.
  12022. The filter accepts the following options:
  12023. @table @option
  12024. @item threshold
  12025. Set the luma which will be used as base for transparency.
  12026. Default value is @code{0}.
  12027. @item tolerance
  12028. Set the range of luma values to be keyed out.
  12029. Default value is @code{0.01}.
  12030. @item softness
  12031. Set the range of softness. Default value is @code{0}.
  12032. Use this to control gradual transition from zero to full transparency.
  12033. @end table
  12034. @subsection Commands
  12035. This filter supports same @ref{commands} as options.
  12036. The command accepts the same syntax of the corresponding option.
  12037. If the specified expression is not valid, it is kept at its current
  12038. value.
  12039. @section lut, lutrgb, lutyuv
  12040. Compute a look-up table for binding each pixel component input value
  12041. to an output value, and apply it to the input video.
  12042. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  12043. to an RGB input video.
  12044. These filters accept the following parameters:
  12045. @table @option
  12046. @item c0
  12047. set first pixel component expression
  12048. @item c1
  12049. set second pixel component expression
  12050. @item c2
  12051. set third pixel component expression
  12052. @item c3
  12053. set fourth pixel component expression, corresponds to the alpha component
  12054. @item r
  12055. set red component expression
  12056. @item g
  12057. set green component expression
  12058. @item b
  12059. set blue component expression
  12060. @item a
  12061. alpha component expression
  12062. @item y
  12063. set Y/luminance component expression
  12064. @item u
  12065. set U/Cb component expression
  12066. @item v
  12067. set V/Cr component expression
  12068. @end table
  12069. Each of them specifies the expression to use for computing the lookup table for
  12070. the corresponding pixel component values.
  12071. The exact component associated to each of the @var{c*} options depends on the
  12072. format in input.
  12073. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  12074. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  12075. The expressions can contain the following constants and functions:
  12076. @table @option
  12077. @item w
  12078. @item h
  12079. The input width and height.
  12080. @item val
  12081. The input value for the pixel component.
  12082. @item clipval
  12083. The input value, clipped to the @var{minval}-@var{maxval} range.
  12084. @item maxval
  12085. The maximum value for the pixel component.
  12086. @item minval
  12087. The minimum value for the pixel component.
  12088. @item negval
  12089. The negated value for the pixel component value, clipped to the
  12090. @var{minval}-@var{maxval} range; it corresponds to the expression
  12091. "maxval-clipval+minval".
  12092. @item clip(val)
  12093. The computed value in @var{val}, clipped to the
  12094. @var{minval}-@var{maxval} range.
  12095. @item gammaval(gamma)
  12096. The computed gamma correction value of the pixel component value,
  12097. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  12098. expression
  12099. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  12100. @end table
  12101. All expressions default to "clipval".
  12102. @subsection Commands
  12103. This filter supports same @ref{commands} as options.
  12104. @subsection Examples
  12105. @itemize
  12106. @item
  12107. Negate input video:
  12108. @example
  12109. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  12110. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  12111. @end example
  12112. The above is the same as:
  12113. @example
  12114. lutrgb="r=negval:g=negval:b=negval"
  12115. lutyuv="y=negval:u=negval:v=negval"
  12116. @end example
  12117. @item
  12118. Negate luminance:
  12119. @example
  12120. lutyuv=y=negval
  12121. @end example
  12122. @item
  12123. Remove chroma components, turning the video into a graytone image:
  12124. @example
  12125. lutyuv="u=128:v=128"
  12126. @end example
  12127. @item
  12128. Apply a luma burning effect:
  12129. @example
  12130. lutyuv="y=2*val"
  12131. @end example
  12132. @item
  12133. Remove green and blue components:
  12134. @example
  12135. lutrgb="g=0:b=0"
  12136. @end example
  12137. @item
  12138. Set a constant alpha channel value on input:
  12139. @example
  12140. format=rgba,lutrgb=a="maxval-minval/2"
  12141. @end example
  12142. @item
  12143. Correct luminance gamma by a factor of 0.5:
  12144. @example
  12145. lutyuv=y=gammaval(0.5)
  12146. @end example
  12147. @item
  12148. Discard least significant bits of luma:
  12149. @example
  12150. lutyuv=y='bitand(val, 128+64+32)'
  12151. @end example
  12152. @item
  12153. Technicolor like effect:
  12154. @example
  12155. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  12156. @end example
  12157. @end itemize
  12158. @section lut2, tlut2
  12159. The @code{lut2} filter takes two input streams and outputs one
  12160. stream.
  12161. The @code{tlut2} (time lut2) filter takes two consecutive frames
  12162. from one single stream.
  12163. This filter accepts the following parameters:
  12164. @table @option
  12165. @item c0
  12166. set first pixel component expression
  12167. @item c1
  12168. set second pixel component expression
  12169. @item c2
  12170. set third pixel component expression
  12171. @item c3
  12172. set fourth pixel component expression, corresponds to the alpha component
  12173. @item d
  12174. set output bit depth, only available for @code{lut2} filter. By default is 0,
  12175. which means bit depth is automatically picked from first input format.
  12176. @end table
  12177. The @code{lut2} filter also supports the @ref{framesync} options.
  12178. Each of them specifies the expression to use for computing the lookup table for
  12179. the corresponding pixel component values.
  12180. The exact component associated to each of the @var{c*} options depends on the
  12181. format in inputs.
  12182. The expressions can contain the following constants:
  12183. @table @option
  12184. @item w
  12185. @item h
  12186. The input width and height.
  12187. @item x
  12188. The first input value for the pixel component.
  12189. @item y
  12190. The second input value for the pixel component.
  12191. @item bdx
  12192. The first input video bit depth.
  12193. @item bdy
  12194. The second input video bit depth.
  12195. @end table
  12196. All expressions default to "x".
  12197. @subsection Commands
  12198. This filter supports the all above options as @ref{commands} except option @code{d}.
  12199. @subsection Examples
  12200. @itemize
  12201. @item
  12202. Highlight differences between two RGB video streams:
  12203. @example
  12204. 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)'
  12205. @end example
  12206. @item
  12207. Highlight differences between two YUV video streams:
  12208. @example
  12209. 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)'
  12210. @end example
  12211. @item
  12212. Show max difference between two video streams:
  12213. @example
  12214. 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)))'
  12215. @end example
  12216. @end itemize
  12217. @section maskedclamp
  12218. Clamp the first input stream with the second input and third input stream.
  12219. Returns the value of first stream to be between second input
  12220. stream - @code{undershoot} and third input stream + @code{overshoot}.
  12221. This filter accepts the following options:
  12222. @table @option
  12223. @item undershoot
  12224. Default value is @code{0}.
  12225. @item overshoot
  12226. Default value is @code{0}.
  12227. @item planes
  12228. Set which planes will be processed as bitmap, unprocessed planes will be
  12229. copied from first stream.
  12230. By default value 0xf, all planes will be processed.
  12231. @end table
  12232. @subsection Commands
  12233. This filter supports the all above options as @ref{commands}.
  12234. @section maskedmax
  12235. Merge the second and third input stream into output stream using absolute differences
  12236. between second input stream and first input stream and absolute difference between
  12237. third input stream and first input stream. The picked value will be from second input
  12238. stream if second absolute difference is greater than first one or from third input stream
  12239. otherwise.
  12240. This filter accepts the following options:
  12241. @table @option
  12242. @item planes
  12243. Set which planes will be processed as bitmap, unprocessed planes will be
  12244. copied from first stream.
  12245. By default value 0xf, all planes will be processed.
  12246. @end table
  12247. @subsection Commands
  12248. This filter supports the all above options as @ref{commands}.
  12249. @section maskedmerge
  12250. Merge the first input stream with the second input stream using per pixel
  12251. weights in the third input stream.
  12252. A value of 0 in the third stream pixel component means that pixel component
  12253. from first stream is returned unchanged, while maximum value (eg. 255 for
  12254. 8-bit videos) means that pixel component from second stream is returned
  12255. unchanged. Intermediate values define the amount of merging between both
  12256. input stream's pixel components.
  12257. This filter accepts the following options:
  12258. @table @option
  12259. @item planes
  12260. Set which planes will be processed as bitmap, unprocessed planes will be
  12261. copied from first stream.
  12262. By default value 0xf, all planes will be processed.
  12263. @end table
  12264. @subsection Commands
  12265. This filter supports the all above options as @ref{commands}.
  12266. @section maskedmin
  12267. Merge the second and third input stream into output stream using absolute differences
  12268. between second input stream and first input stream and absolute difference between
  12269. third input stream and first input stream. The picked value will be from second input
  12270. stream if second absolute difference is less than first one or from third input stream
  12271. otherwise.
  12272. This filter accepts the following options:
  12273. @table @option
  12274. @item planes
  12275. Set which planes will be processed as bitmap, unprocessed planes will be
  12276. copied from first stream.
  12277. By default value 0xf, all planes will be processed.
  12278. @end table
  12279. @subsection Commands
  12280. This filter supports the all above options as @ref{commands}.
  12281. @section maskedthreshold
  12282. Pick pixels comparing absolute difference of two video streams with fixed
  12283. threshold.
  12284. If absolute difference between pixel component of first and second video
  12285. stream is equal or lower than user supplied threshold than pixel component
  12286. from first video stream is picked, otherwise pixel component from second
  12287. video stream is picked.
  12288. This filter accepts the following options:
  12289. @table @option
  12290. @item threshold
  12291. Set threshold used when picking pixels from absolute difference from two input
  12292. video streams.
  12293. @item planes
  12294. Set which planes will be processed as bitmap, unprocessed planes will be
  12295. copied from second stream.
  12296. By default value 0xf, all planes will be processed.
  12297. @end table
  12298. @subsection Commands
  12299. This filter supports the all above options as @ref{commands}.
  12300. @section maskfun
  12301. Create mask from input video.
  12302. For example it is useful to create motion masks after @code{tblend} filter.
  12303. This filter accepts the following options:
  12304. @table @option
  12305. @item low
  12306. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  12307. @item high
  12308. Set high threshold. Any pixel component higher than this value will be set to max value
  12309. allowed for current pixel format.
  12310. @item planes
  12311. Set planes to filter, by default all available planes are filtered.
  12312. @item fill
  12313. Fill all frame pixels with this value.
  12314. @item sum
  12315. Set max average pixel value for frame. If sum of all pixel components is higher that this
  12316. average, output frame will be completely filled with value set by @var{fill} option.
  12317. Typically useful for scene changes when used in combination with @code{tblend} filter.
  12318. @end table
  12319. @subsection Commands
  12320. This filter supports the all above options as @ref{commands}.
  12321. @section mcdeint
  12322. Apply motion-compensation deinterlacing.
  12323. It needs one field per frame as input and must thus be used together
  12324. with yadif=1/3 or equivalent.
  12325. This filter is only available in ffmpeg version 4.4 or earlier.
  12326. This filter accepts the following options:
  12327. @table @option
  12328. @item mode
  12329. Set the deinterlacing mode.
  12330. It accepts one of the following values:
  12331. @table @samp
  12332. @item fast
  12333. @item medium
  12334. @item slow
  12335. use iterative motion estimation
  12336. @item extra_slow
  12337. like @samp{slow}, but use multiple reference frames.
  12338. @end table
  12339. Default value is @samp{fast}.
  12340. @item parity
  12341. Set the picture field parity assumed for the input video. It must be
  12342. one of the following values:
  12343. @table @samp
  12344. @item 0, tff
  12345. assume top field first
  12346. @item 1, bff
  12347. assume bottom field first
  12348. @end table
  12349. Default value is @samp{bff}.
  12350. @item qp
  12351. Set per-block quantization parameter (QP) used by the internal
  12352. encoder.
  12353. Higher values should result in a smoother motion vector field but less
  12354. optimal individual vectors. Default value is 1.
  12355. @end table
  12356. @section median
  12357. Pick median pixel from certain rectangle defined by radius.
  12358. This filter accepts the following options:
  12359. @table @option
  12360. @item radius
  12361. Set horizontal radius size. Default value is @code{1}.
  12362. Allowed range is integer from 1 to 127.
  12363. @item planes
  12364. Set which planes to process. Default is @code{15}, which is all available planes.
  12365. @item radiusV
  12366. Set vertical radius size. Default value is @code{0}.
  12367. Allowed range is integer from 0 to 127.
  12368. If it is 0, value will be picked from horizontal @code{radius} option.
  12369. @item percentile
  12370. Set median percentile. Default value is @code{0.5}.
  12371. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  12372. minimum values, and @code{1} maximum values.
  12373. @end table
  12374. @subsection Commands
  12375. This filter supports same @ref{commands} as options.
  12376. The command accepts the same syntax of the corresponding option.
  12377. If the specified expression is not valid, it is kept at its current
  12378. value.
  12379. @section mergeplanes
  12380. Merge color channel components from several video streams.
  12381. The filter accepts up to 4 input streams, and merge selected input
  12382. planes to the output video.
  12383. This filter accepts the following options:
  12384. @table @option
  12385. @item mapping
  12386. Set input to output plane mapping. Default is @code{0}.
  12387. The mappings is specified as a bitmap. It should be specified as a
  12388. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  12389. mapping for the first plane of the output stream. 'A' sets the number of
  12390. the input stream to use (from 0 to 3), and 'a' the plane number of the
  12391. corresponding input to use (from 0 to 3). The rest of the mappings is
  12392. similar, 'Bb' describes the mapping for the output stream second
  12393. plane, 'Cc' describes the mapping for the output stream third plane and
  12394. 'Dd' describes the mapping for the output stream fourth plane.
  12395. @item format
  12396. Set output pixel format. Default is @code{yuva444p}.
  12397. @item map0s
  12398. @item map1s
  12399. @item map2s
  12400. @item map3s
  12401. Set input to output stream mapping for output Nth plane. Default is @code{0}.
  12402. @item map0p
  12403. @item map1p
  12404. @item map2p
  12405. @item map3p
  12406. Set input to output plane mapping for output Nth plane. Default is @code{0}.
  12407. @end table
  12408. @subsection Examples
  12409. @itemize
  12410. @item
  12411. Merge three gray video streams of same width and height into single video stream:
  12412. @example
  12413. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  12414. @end example
  12415. @item
  12416. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  12417. @example
  12418. [a0][a1]mergeplanes=0x00010210:yuva444p
  12419. @end example
  12420. @item
  12421. Swap Y and A plane in yuva444p stream:
  12422. @example
  12423. format=yuva444p,mergeplanes=0x03010200:yuva444p
  12424. @end example
  12425. @item
  12426. Swap U and V plane in yuv420p stream:
  12427. @example
  12428. format=yuv420p,mergeplanes=0x000201:yuv420p
  12429. @end example
  12430. @item
  12431. Cast a rgb24 clip to yuv444p:
  12432. @example
  12433. format=rgb24,mergeplanes=0x000102:yuv444p
  12434. @end example
  12435. @end itemize
  12436. @section mestimate
  12437. Estimate and export motion vectors using block matching algorithms.
  12438. Motion vectors are stored in frame side data to be used by other filters.
  12439. This filter accepts the following options:
  12440. @table @option
  12441. @item method
  12442. Specify the motion estimation method. Accepts one of the following values:
  12443. @table @samp
  12444. @item esa
  12445. Exhaustive search algorithm.
  12446. @item tss
  12447. Three step search algorithm.
  12448. @item tdls
  12449. Two dimensional logarithmic search algorithm.
  12450. @item ntss
  12451. New three step search algorithm.
  12452. @item fss
  12453. Four step search algorithm.
  12454. @item ds
  12455. Diamond search algorithm.
  12456. @item hexbs
  12457. Hexagon-based search algorithm.
  12458. @item epzs
  12459. Enhanced predictive zonal search algorithm.
  12460. @item umh
  12461. Uneven multi-hexagon search algorithm.
  12462. @end table
  12463. Default value is @samp{esa}.
  12464. @item mb_size
  12465. Macroblock size. Default @code{16}.
  12466. @item search_param
  12467. Search parameter. Default @code{7}.
  12468. @end table
  12469. @section midequalizer
  12470. Apply Midway Image Equalization effect using two video streams.
  12471. Midway Image Equalization adjusts a pair of images to have the same
  12472. histogram, while maintaining their dynamics as much as possible. It's
  12473. useful for e.g. matching exposures from a pair of stereo cameras.
  12474. This filter has two inputs and one output, which must be of same pixel format, but
  12475. may be of different sizes. The output of filter is first input adjusted with
  12476. midway histogram of both inputs.
  12477. This filter accepts the following option:
  12478. @table @option
  12479. @item planes
  12480. Set which planes to process. Default is @code{15}, which is all available planes.
  12481. @end table
  12482. @section minterpolate
  12483. Convert the video to specified frame rate using motion interpolation.
  12484. This filter accepts the following options:
  12485. @table @option
  12486. @item fps
  12487. 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}.
  12488. @item mi_mode
  12489. Motion interpolation mode. Following values are accepted:
  12490. @table @samp
  12491. @item dup
  12492. Duplicate previous or next frame for interpolating new ones.
  12493. @item blend
  12494. Blend source frames. Interpolated frame is mean of previous and next frames.
  12495. @item mci
  12496. Motion compensated interpolation. Following options are effective when this mode is selected:
  12497. @table @samp
  12498. @item mc_mode
  12499. Motion compensation mode. Following values are accepted:
  12500. @table @samp
  12501. @item obmc
  12502. Overlapped block motion compensation.
  12503. @item aobmc
  12504. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  12505. @end table
  12506. Default mode is @samp{obmc}.
  12507. @item me_mode
  12508. Motion estimation mode. Following values are accepted:
  12509. @table @samp
  12510. @item bidir
  12511. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  12512. @item bilat
  12513. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  12514. @end table
  12515. Default mode is @samp{bilat}.
  12516. @item me
  12517. The algorithm to be used for motion estimation. Following values are accepted:
  12518. @table @samp
  12519. @item esa
  12520. Exhaustive search algorithm.
  12521. @item tss
  12522. Three step search algorithm.
  12523. @item tdls
  12524. Two dimensional logarithmic search algorithm.
  12525. @item ntss
  12526. New three step search algorithm.
  12527. @item fss
  12528. Four step search algorithm.
  12529. @item ds
  12530. Diamond search algorithm.
  12531. @item hexbs
  12532. Hexagon-based search algorithm.
  12533. @item epzs
  12534. Enhanced predictive zonal search algorithm.
  12535. @item umh
  12536. Uneven multi-hexagon search algorithm.
  12537. @end table
  12538. Default algorithm is @samp{epzs}.
  12539. @item mb_size
  12540. Macroblock size. Default @code{16}.
  12541. @item search_param
  12542. Motion estimation search parameter. Default @code{32}.
  12543. @item vsbmc
  12544. 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).
  12545. @end table
  12546. @end table
  12547. @item scd
  12548. 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:
  12549. @table @samp
  12550. @item none
  12551. Disable scene change detection.
  12552. @item fdiff
  12553. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  12554. @end table
  12555. Default method is @samp{fdiff}.
  12556. @item scd_threshold
  12557. Scene change detection threshold. Default is @code{10.}.
  12558. @end table
  12559. @section mix
  12560. Mix several video input streams into one video stream.
  12561. A description of the accepted options follows.
  12562. @table @option
  12563. @item inputs
  12564. The number of inputs. If unspecified, it defaults to 2.
  12565. @item weights
  12566. Specify weight of each input video stream as sequence.
  12567. Each weight is separated by space. If number of weights
  12568. is smaller than number of @var{frames} last specified
  12569. weight will be used for all remaining unset weights.
  12570. @item scale
  12571. Specify scale, if it is set it will be multiplied with sum
  12572. of each weight multiplied with pixel values to give final destination
  12573. pixel value. By default @var{scale} is auto scaled to sum of weights.
  12574. @item planes
  12575. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  12576. @item duration
  12577. Specify how end of stream is determined.
  12578. @table @samp
  12579. @item longest
  12580. The duration of the longest input. (default)
  12581. @item shortest
  12582. The duration of the shortest input.
  12583. @item first
  12584. The duration of the first input.
  12585. @end table
  12586. @end table
  12587. @subsection Commands
  12588. This filter supports the following commands:
  12589. @table @option
  12590. @item weights
  12591. @item scale
  12592. @item planes
  12593. Syntax is same as option with same name.
  12594. @end table
  12595. @section monochrome
  12596. Convert video to gray using custom color filter.
  12597. A description of the accepted options follows.
  12598. @table @option
  12599. @item cb
  12600. Set the chroma blue spot. Allowed range is from -1 to 1.
  12601. Default value is 0.
  12602. @item cr
  12603. Set the chroma red spot. Allowed range is from -1 to 1.
  12604. Default value is 0.
  12605. @item size
  12606. Set the color filter size. Allowed range is from .1 to 10.
  12607. Default value is 1.
  12608. @item high
  12609. Set the highlights strength. Allowed range is from 0 to 1.
  12610. Default value is 0.
  12611. @end table
  12612. @subsection Commands
  12613. This filter supports the all above options as @ref{commands}.
  12614. @section morpho
  12615. This filter allows to apply main morphological grayscale transforms,
  12616. erode and dilate with arbitrary structures set in second input stream.
  12617. Unlike naive implementation and much slower performance in @ref{erosion}
  12618. and @ref{dilation} filters, when speed is critical @code{morpho} filter
  12619. should be used instead.
  12620. A description of accepted options follows,
  12621. @table @option
  12622. @item mode
  12623. Set morphological transform to apply, can be:
  12624. @table @samp
  12625. @item erode
  12626. @item dilate
  12627. @item open
  12628. @item close
  12629. @item gradient
  12630. @item tophat
  12631. @item blackhat
  12632. @end table
  12633. Default is @code{erode}.
  12634. @item planes
  12635. Set planes to filter, by default all planes except alpha are filtered.
  12636. @item structure
  12637. Set which structure video frames will be processed from second input stream,
  12638. can be @var{first} or @var{all}. Default is @var{all}.
  12639. @end table
  12640. The @code{morpho} filter also supports the @ref{framesync} options.
  12641. @subsection Commands
  12642. This filter supports same @ref{commands} as options.
  12643. @section mpdecimate
  12644. Drop frames that do not differ greatly from the previous frame in
  12645. order to reduce frame rate.
  12646. The main use of this filter is for very-low-bitrate encoding
  12647. (e.g. streaming over dialup modem), but it could in theory be used for
  12648. fixing movies that were inverse-telecined incorrectly.
  12649. A description of the accepted options follows.
  12650. @table @option
  12651. @item max
  12652. Set the maximum number of consecutive frames which can be dropped (if
  12653. positive), or the minimum interval between dropped frames (if
  12654. negative). If the value is 0, the frame is dropped disregarding the
  12655. number of previous sequentially dropped frames.
  12656. Default value is 0.
  12657. @item hi
  12658. @item lo
  12659. @item frac
  12660. Set the dropping threshold values.
  12661. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  12662. represent actual pixel value differences, so a threshold of 64
  12663. corresponds to 1 unit of difference for each pixel, or the same spread
  12664. out differently over the block.
  12665. A frame is a candidate for dropping if no 8x8 blocks differ by more
  12666. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  12667. meaning the whole image) differ by more than a threshold of @option{lo}.
  12668. Default value for @option{hi} is 64*12, default value for @option{lo} is
  12669. 64*5, and default value for @option{frac} is 0.33.
  12670. @end table
  12671. @section msad
  12672. Obtain the MSAD (Mean Sum of Absolute Differences) between two input videos.
  12673. This filter takes two input videos.
  12674. Both input videos must have the same resolution and pixel format for
  12675. this filter to work correctly. Also it assumes that both inputs
  12676. have the same number of frames, which are compared one by one.
  12677. The obtained per component, average, min and max MSAD is printed through
  12678. the logging system.
  12679. The filter stores the calculated MSAD of each frame in frame metadata.
  12680. In the below example the input file @file{main.mpg} being processed is compared
  12681. with the reference file @file{ref.mpg}.
  12682. @example
  12683. ffmpeg -i main.mpg -i ref.mpg -lavfi msad -f null -
  12684. @end example
  12685. @section negate
  12686. Negate (invert) the input video.
  12687. It accepts the following option:
  12688. @table @option
  12689. @item components
  12690. Set components to negate.
  12691. Available values for components are:
  12692. @table @samp
  12693. @item y
  12694. @item u
  12695. @item v
  12696. @item a
  12697. @item r
  12698. @item g
  12699. @item b
  12700. @end table
  12701. @item negate_alpha
  12702. With value 1, it negates the alpha component, if present. Default value is 0.
  12703. @end table
  12704. @subsection Commands
  12705. This filter supports same @ref{commands} as options.
  12706. @anchor{nlmeans}
  12707. @section nlmeans
  12708. Denoise frames using Non-Local Means algorithm.
  12709. Each pixel is adjusted by looking for other pixels with similar contexts. This
  12710. context similarity is defined by comparing their surrounding patches of size
  12711. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  12712. around the pixel.
  12713. Note that the research area defines centers for patches, which means some
  12714. patches will be made of pixels outside that research area.
  12715. The filter accepts the following options.
  12716. @table @option
  12717. @item s
  12718. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  12719. @item p
  12720. Set patch size. Default is 7. Must be odd number in range [0, 99].
  12721. @item pc
  12722. Same as @option{p} but for chroma planes.
  12723. The default value is @var{0} and means automatic.
  12724. @item r
  12725. Set research size. Default is 15. Must be odd number in range [0, 99].
  12726. @item rc
  12727. Same as @option{r} but for chroma planes.
  12728. The default value is @var{0} and means automatic.
  12729. @end table
  12730. @section nnedi
  12731. Deinterlace video using neural network edge directed interpolation.
  12732. This filter accepts the following options:
  12733. @table @option
  12734. @item weights
  12735. Mandatory option, without binary file filter can not work.
  12736. Currently file can be found here:
  12737. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  12738. @item deint
  12739. Set which frames to deinterlace, by default it is @code{all}.
  12740. Can be @code{all} or @code{interlaced}.
  12741. @item field
  12742. Set mode of operation.
  12743. Can be one of the following:
  12744. @table @samp
  12745. @item af
  12746. Use frame flags, both fields.
  12747. @item a
  12748. Use frame flags, single field.
  12749. @item t
  12750. Use top field only.
  12751. @item b
  12752. Use bottom field only.
  12753. @item tf
  12754. Use both fields, top first.
  12755. @item bf
  12756. Use both fields, bottom first.
  12757. @end table
  12758. @item planes
  12759. Set which planes to process, by default filter process all frames.
  12760. @item nsize
  12761. Set size of local neighborhood around each pixel, used by the predictor neural
  12762. network.
  12763. Can be one of the following:
  12764. @table @samp
  12765. @item s8x6
  12766. @item s16x6
  12767. @item s32x6
  12768. @item s48x6
  12769. @item s8x4
  12770. @item s16x4
  12771. @item s32x4
  12772. @end table
  12773. @item nns
  12774. Set the number of neurons in predictor neural network.
  12775. Can be one of the following:
  12776. @table @samp
  12777. @item n16
  12778. @item n32
  12779. @item n64
  12780. @item n128
  12781. @item n256
  12782. @end table
  12783. @item qual
  12784. Controls the number of different neural network predictions that are blended
  12785. together to compute the final output value. Can be @code{fast}, default or
  12786. @code{slow}.
  12787. @item etype
  12788. Set which set of weights to use in the predictor.
  12789. Can be one of the following:
  12790. @table @samp
  12791. @item a, abs
  12792. weights trained to minimize absolute error
  12793. @item s, mse
  12794. weights trained to minimize squared error
  12795. @end table
  12796. @item pscrn
  12797. Controls whether or not the prescreener neural network is used to decide
  12798. which pixels should be processed by the predictor neural network and which
  12799. can be handled by simple cubic interpolation.
  12800. The prescreener is trained to know whether cubic interpolation will be
  12801. sufficient for a pixel or whether it should be predicted by the predictor nn.
  12802. The computational complexity of the prescreener nn is much less than that of
  12803. the predictor nn. Since most pixels can be handled by cubic interpolation,
  12804. using the prescreener generally results in much faster processing.
  12805. The prescreener is pretty accurate, so the difference between using it and not
  12806. using it is almost always unnoticeable.
  12807. Can be one of the following:
  12808. @table @samp
  12809. @item none
  12810. @item original
  12811. @item new
  12812. @item new2
  12813. @item new3
  12814. @end table
  12815. Default is @code{new}.
  12816. @end table
  12817. @subsection Commands
  12818. This filter supports same @ref{commands} as options, excluding @var{weights} option.
  12819. @section noformat
  12820. Force libavfilter not to use any of the specified pixel formats for the
  12821. input to the next filter.
  12822. It accepts the following parameters:
  12823. @table @option
  12824. @item pix_fmts
  12825. A '|'-separated list of pixel format names, such as
  12826. pix_fmts=yuv420p|monow|rgb24".
  12827. @end table
  12828. @subsection Examples
  12829. @itemize
  12830. @item
  12831. Force libavfilter to use a format different from @var{yuv420p} for the
  12832. input to the vflip filter:
  12833. @example
  12834. noformat=pix_fmts=yuv420p,vflip
  12835. @end example
  12836. @item
  12837. Convert the input video to any of the formats not contained in the list:
  12838. @example
  12839. noformat=yuv420p|yuv444p|yuv410p
  12840. @end example
  12841. @end itemize
  12842. @section noise
  12843. Add noise on video input frame.
  12844. The filter accepts the following options:
  12845. @table @option
  12846. @item all_seed
  12847. @item c0_seed
  12848. @item c1_seed
  12849. @item c2_seed
  12850. @item c3_seed
  12851. Set noise seed for specific pixel component or all pixel components in case
  12852. of @var{all_seed}. Default value is @code{123457}.
  12853. @item all_strength, alls
  12854. @item c0_strength, c0s
  12855. @item c1_strength, c1s
  12856. @item c2_strength, c2s
  12857. @item c3_strength, c3s
  12858. Set noise strength for specific pixel component or all pixel components in case
  12859. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  12860. @item all_flags, allf
  12861. @item c0_flags, c0f
  12862. @item c1_flags, c1f
  12863. @item c2_flags, c2f
  12864. @item c3_flags, c3f
  12865. Set pixel component flags or set flags for all components if @var{all_flags}.
  12866. Available values for component flags are:
  12867. @table @samp
  12868. @item a
  12869. averaged temporal noise (smoother)
  12870. @item p
  12871. mix random noise with a (semi)regular pattern
  12872. @item t
  12873. temporal noise (noise pattern changes between frames)
  12874. @item u
  12875. uniform noise (gaussian otherwise)
  12876. @end table
  12877. @end table
  12878. @subsection Examples
  12879. Add temporal and uniform noise to input video:
  12880. @example
  12881. noise=alls=20:allf=t+u
  12882. @end example
  12883. @section normalize
  12884. Normalize RGB video (aka histogram stretching, contrast stretching).
  12885. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  12886. For each channel of each frame, the filter computes the input range and maps
  12887. it linearly to the user-specified output range. The output range defaults
  12888. to the full dynamic range from pure black to pure white.
  12889. Temporal smoothing can be used on the input range to reduce flickering (rapid
  12890. changes in brightness) caused when small dark or bright objects enter or leave
  12891. the scene. This is similar to the auto-exposure (automatic gain control) on a
  12892. video camera, and, like a video camera, it may cause a period of over- or
  12893. under-exposure of the video.
  12894. The R,G,B channels can be normalized independently, which may cause some
  12895. color shifting, or linked together as a single channel, which prevents
  12896. color shifting. Linked normalization preserves hue. Independent normalization
  12897. does not, so it can be used to remove some color casts. Independent and linked
  12898. normalization can be combined in any ratio.
  12899. The normalize filter accepts the following options:
  12900. @table @option
  12901. @item blackpt
  12902. @item whitept
  12903. Colors which define the output range. The minimum input value is mapped to
  12904. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  12905. The defaults are black and white respectively. Specifying white for
  12906. @var{blackpt} and black for @var{whitept} will give color-inverted,
  12907. normalized video. Shades of grey can be used to reduce the dynamic range
  12908. (contrast). Specifying saturated colors here can create some interesting
  12909. effects.
  12910. @item smoothing
  12911. The number of previous frames to use for temporal smoothing. The input range
  12912. of each channel is smoothed using a rolling average over the current frame
  12913. and the @var{smoothing} previous frames. The default is 0 (no temporal
  12914. smoothing).
  12915. @item independence
  12916. Controls the ratio of independent (color shifting) channel normalization to
  12917. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  12918. independent. Defaults to 1.0 (fully independent).
  12919. @item strength
  12920. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  12921. expensive no-op. Defaults to 1.0 (full strength).
  12922. @end table
  12923. @subsection Commands
  12924. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  12925. The command accepts the same syntax of the corresponding option.
  12926. If the specified expression is not valid, it is kept at its current
  12927. value.
  12928. @subsection Examples
  12929. Stretch video contrast to use the full dynamic range, with no temporal
  12930. smoothing; may flicker depending on the source content:
  12931. @example
  12932. normalize=blackpt=black:whitept=white:smoothing=0
  12933. @end example
  12934. As above, but with 50 frames of temporal smoothing; flicker should be
  12935. reduced, depending on the source content:
  12936. @example
  12937. normalize=blackpt=black:whitept=white:smoothing=50
  12938. @end example
  12939. As above, but with hue-preserving linked channel normalization:
  12940. @example
  12941. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  12942. @end example
  12943. As above, but with half strength:
  12944. @example
  12945. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  12946. @end example
  12947. Map the darkest input color to red, the brightest input color to cyan:
  12948. @example
  12949. normalize=blackpt=red:whitept=cyan
  12950. @end example
  12951. @section null
  12952. Pass the video source unchanged to the output.
  12953. @section ocr
  12954. Optical Character Recognition
  12955. This filter uses Tesseract for optical character recognition. To enable
  12956. compilation of this filter, you need to configure FFmpeg with
  12957. @code{--enable-libtesseract}.
  12958. It accepts the following options:
  12959. @table @option
  12960. @item datapath
  12961. Set datapath to tesseract data. Default is to use whatever was
  12962. set at installation.
  12963. @item language
  12964. Set language, default is "eng".
  12965. @item whitelist
  12966. Set character whitelist.
  12967. @item blacklist
  12968. Set character blacklist.
  12969. @end table
  12970. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  12971. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  12972. @section ocv
  12973. Apply a video transform using libopencv.
  12974. To enable this filter, install the libopencv library and headers and
  12975. configure FFmpeg with @code{--enable-libopencv}.
  12976. It accepts the following parameters:
  12977. @table @option
  12978. @item filter_name
  12979. The name of the libopencv filter to apply.
  12980. @item filter_params
  12981. The parameters to pass to the libopencv filter. If not specified, the default
  12982. values are assumed.
  12983. @end table
  12984. Refer to the official libopencv documentation for more precise
  12985. information:
  12986. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  12987. Several libopencv filters are supported; see the following subsections.
  12988. @anchor{dilate}
  12989. @subsection dilate
  12990. Dilate an image by using a specific structuring element.
  12991. It corresponds to the libopencv function @code{cvDilate}.
  12992. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  12993. @var{struct_el} represents a structuring element, and has the syntax:
  12994. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  12995. @var{cols} and @var{rows} represent the number of columns and rows of
  12996. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  12997. point, and @var{shape} the shape for the structuring element. @var{shape}
  12998. must be "rect", "cross", "ellipse", or "custom".
  12999. If the value for @var{shape} is "custom", it must be followed by a
  13000. string of the form "=@var{filename}". The file with name
  13001. @var{filename} is assumed to represent a binary image, with each
  13002. printable character corresponding to a bright pixel. When a custom
  13003. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  13004. or columns and rows of the read file are assumed instead.
  13005. The default value for @var{struct_el} is "3x3+0x0/rect".
  13006. @var{nb_iterations} specifies the number of times the transform is
  13007. applied to the image, and defaults to 1.
  13008. Some examples:
  13009. @example
  13010. # Use the default values
  13011. ocv=dilate
  13012. # Dilate using a structuring element with a 5x5 cross, iterating two times
  13013. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  13014. # Read the shape from the file diamond.shape, iterating two times.
  13015. # The file diamond.shape may contain a pattern of characters like this
  13016. # *
  13017. # ***
  13018. # *****
  13019. # ***
  13020. # *
  13021. # The specified columns and rows are ignored
  13022. # but the anchor point coordinates are not
  13023. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  13024. @end example
  13025. @subsection erode
  13026. Erode an image by using a specific structuring element.
  13027. It corresponds to the libopencv function @code{cvErode}.
  13028. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  13029. with the same syntax and semantics as the @ref{dilate} filter.
  13030. @subsection smooth
  13031. Smooth the input video.
  13032. The filter takes the following parameters:
  13033. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  13034. @var{type} is the type of smooth filter to apply, and must be one of
  13035. the following values: "blur", "blur_no_scale", "median", "gaussian",
  13036. or "bilateral". The default value is "gaussian".
  13037. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  13038. depends on the smooth type. @var{param1} and
  13039. @var{param2} accept integer positive values or 0. @var{param3} and
  13040. @var{param4} accept floating point values.
  13041. The default value for @var{param1} is 3. The default value for the
  13042. other parameters is 0.
  13043. These parameters correspond to the parameters assigned to the
  13044. libopencv function @code{cvSmooth}.
  13045. @section oscilloscope
  13046. 2D Video Oscilloscope.
  13047. Useful to measure spatial impulse, step responses, chroma delays, etc.
  13048. It accepts the following parameters:
  13049. @table @option
  13050. @item x
  13051. Set scope center x position.
  13052. @item y
  13053. Set scope center y position.
  13054. @item s
  13055. Set scope size, relative to frame diagonal.
  13056. @item t
  13057. Set scope tilt/rotation.
  13058. @item o
  13059. Set trace opacity.
  13060. @item tx
  13061. Set trace center x position.
  13062. @item ty
  13063. Set trace center y position.
  13064. @item tw
  13065. Set trace width, relative to width of frame.
  13066. @item th
  13067. Set trace height, relative to height of frame.
  13068. @item c
  13069. Set which components to trace. By default it traces first three components.
  13070. @item g
  13071. Draw trace grid. By default is enabled.
  13072. @item st
  13073. Draw some statistics. By default is enabled.
  13074. @item sc
  13075. Draw scope. By default is enabled.
  13076. @end table
  13077. @subsection Commands
  13078. This filter supports same @ref{commands} as options.
  13079. The command accepts the same syntax of the corresponding option.
  13080. If the specified expression is not valid, it is kept at its current
  13081. value.
  13082. @subsection Examples
  13083. @itemize
  13084. @item
  13085. Inspect full first row of video frame.
  13086. @example
  13087. oscilloscope=x=0.5:y=0:s=1
  13088. @end example
  13089. @item
  13090. Inspect full last row of video frame.
  13091. @example
  13092. oscilloscope=x=0.5:y=1:s=1
  13093. @end example
  13094. @item
  13095. Inspect full 5th line of video frame of height 1080.
  13096. @example
  13097. oscilloscope=x=0.5:y=5/1080:s=1
  13098. @end example
  13099. @item
  13100. Inspect full last column of video frame.
  13101. @example
  13102. oscilloscope=x=1:y=0.5:s=1:t=1
  13103. @end example
  13104. @end itemize
  13105. @anchor{overlay}
  13106. @section overlay
  13107. Overlay one video on top of another.
  13108. It takes two inputs and has one output. The first input is the "main"
  13109. video on which the second input is overlaid.
  13110. It accepts the following parameters:
  13111. A description of the accepted options follows.
  13112. @table @option
  13113. @item x
  13114. @item y
  13115. Set the expression for the x and y coordinates of the overlaid video
  13116. on the main video. Default value is "0" for both expressions. In case
  13117. the expression is invalid, it is set to a huge value (meaning that the
  13118. overlay will not be displayed within the output visible area).
  13119. @item eof_action
  13120. See @ref{framesync}.
  13121. @item eval
  13122. Set when the expressions for @option{x}, and @option{y} are evaluated.
  13123. It accepts the following values:
  13124. @table @samp
  13125. @item init
  13126. only evaluate expressions once during the filter initialization or
  13127. when a command is processed
  13128. @item frame
  13129. evaluate expressions for each incoming frame
  13130. @end table
  13131. Default value is @samp{frame}.
  13132. @item shortest
  13133. See @ref{framesync}.
  13134. @item format
  13135. Set the format for the output video.
  13136. It accepts the following values:
  13137. @table @samp
  13138. @item yuv420
  13139. force YUV420 output
  13140. @item yuv420p10
  13141. force YUV420p10 output
  13142. @item yuv422
  13143. force YUV422 output
  13144. @item yuv422p10
  13145. force YUV422p10 output
  13146. @item yuv444
  13147. force YUV444 output
  13148. @item rgb
  13149. force packed RGB output
  13150. @item gbrp
  13151. force planar RGB output
  13152. @item auto
  13153. automatically pick format
  13154. @end table
  13155. Default value is @samp{yuv420}.
  13156. @item repeatlast
  13157. See @ref{framesync}.
  13158. @item alpha
  13159. Set format of alpha of the overlaid video, it can be @var{straight} or
  13160. @var{premultiplied}. Default is @var{straight}.
  13161. @end table
  13162. The @option{x}, and @option{y} expressions can contain the following
  13163. parameters.
  13164. @table @option
  13165. @item main_w, W
  13166. @item main_h, H
  13167. The main input width and height.
  13168. @item overlay_w, w
  13169. @item overlay_h, h
  13170. The overlay input width and height.
  13171. @item x
  13172. @item y
  13173. The computed values for @var{x} and @var{y}. They are evaluated for
  13174. each new frame.
  13175. @item hsub
  13176. @item vsub
  13177. horizontal and vertical chroma subsample values of the output
  13178. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  13179. @var{vsub} is 1.
  13180. @item n
  13181. the number of input frame, starting from 0
  13182. @item pos
  13183. the position in the file of the input frame, NAN if unknown
  13184. @item t
  13185. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  13186. @end table
  13187. This filter also supports the @ref{framesync} options.
  13188. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  13189. when evaluation is done @emph{per frame}, and will evaluate to NAN
  13190. when @option{eval} is set to @samp{init}.
  13191. Be aware that frames are taken from each input video in timestamp
  13192. order, hence, if their initial timestamps differ, it is a good idea
  13193. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  13194. have them begin in the same zero timestamp, as the example for
  13195. the @var{movie} filter does.
  13196. You can chain together more overlays but you should test the
  13197. efficiency of such approach.
  13198. @subsection Commands
  13199. This filter supports the following commands:
  13200. @table @option
  13201. @item x
  13202. @item y
  13203. Modify the x and y of the overlay input.
  13204. The command accepts the same syntax of the corresponding option.
  13205. If the specified expression is not valid, it is kept at its current
  13206. value.
  13207. @end table
  13208. @subsection Examples
  13209. @itemize
  13210. @item
  13211. Draw the overlay at 10 pixels from the bottom right corner of the main
  13212. video:
  13213. @example
  13214. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  13215. @end example
  13216. Using named options the example above becomes:
  13217. @example
  13218. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  13219. @end example
  13220. @item
  13221. Insert a transparent PNG logo in the bottom left corner of the input,
  13222. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  13223. @example
  13224. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  13225. @end example
  13226. @item
  13227. Insert 2 different transparent PNG logos (second logo on bottom
  13228. right corner) using the @command{ffmpeg} tool:
  13229. @example
  13230. 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
  13231. @end example
  13232. @item
  13233. Add a transparent color layer on top of the main video; @code{WxH}
  13234. must specify the size of the main input to the overlay filter:
  13235. @example
  13236. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  13237. @end example
  13238. @item
  13239. Play an original video and a filtered version (here with the deshake
  13240. filter) side by side using the @command{ffplay} tool:
  13241. @example
  13242. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  13243. @end example
  13244. The above command is the same as:
  13245. @example
  13246. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  13247. @end example
  13248. @item
  13249. Make a sliding overlay appearing from the left to the right top part of the
  13250. screen starting since time 2:
  13251. @example
  13252. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  13253. @end example
  13254. @item
  13255. Compose output by putting two input videos side to side:
  13256. @example
  13257. ffmpeg -i left.avi -i right.avi -filter_complex "
  13258. nullsrc=size=200x100 [background];
  13259. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  13260. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  13261. [background][left] overlay=shortest=1 [background+left];
  13262. [background+left][right] overlay=shortest=1:x=100 [left+right]
  13263. "
  13264. @end example
  13265. @item
  13266. Mask 10-20 seconds of a video by applying the delogo filter to a section
  13267. @example
  13268. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  13269. -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]'
  13270. masked.avi
  13271. @end example
  13272. @item
  13273. Chain several overlays in cascade:
  13274. @example
  13275. nullsrc=s=200x200 [bg];
  13276. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  13277. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  13278. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  13279. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  13280. [in3] null, [mid2] overlay=100:100 [out0]
  13281. @end example
  13282. @end itemize
  13283. @anchor{overlay_cuda}
  13284. @section overlay_cuda
  13285. Overlay one video on top of another.
  13286. This is the CUDA variant of the @ref{overlay} filter.
  13287. It only accepts CUDA frames. The underlying input pixel formats have to match.
  13288. It takes two inputs and has one output. The first input is the "main"
  13289. video on which the second input is overlaid.
  13290. It accepts the following parameters:
  13291. @table @option
  13292. @item x
  13293. @item y
  13294. Set expressions for the x and y coordinates of the overlaid video
  13295. on the main video.
  13296. They can contain the following parameters:
  13297. @table @option
  13298. @item main_w, W
  13299. @item main_h, H
  13300. The main input width and height.
  13301. @item overlay_w, w
  13302. @item overlay_h, h
  13303. The overlay input width and height.
  13304. @item x
  13305. @item y
  13306. The computed values for @var{x} and @var{y}. They are evaluated for
  13307. each new frame.
  13308. @item n
  13309. The ordinal index of the main input frame, starting from 0.
  13310. @item pos
  13311. The byte offset position in the file of the main input frame, NAN if unknown.
  13312. @item t
  13313. The timestamp of the main input frame, expressed in seconds, NAN if unknown.
  13314. @end table
  13315. Default value is "0" for both expressions.
  13316. @item eval
  13317. Set when the expressions for @option{x} and @option{y} are evaluated.
  13318. It accepts the following values:
  13319. @table @option
  13320. @item init
  13321. Evaluate expressions once during filter initialization or
  13322. when a command is processed.
  13323. @item frame
  13324. Evaluate expressions for each incoming frame
  13325. @end table
  13326. Default value is @option{frame}.
  13327. @item eof_action
  13328. See @ref{framesync}.
  13329. @item shortest
  13330. See @ref{framesync}.
  13331. @item repeatlast
  13332. See @ref{framesync}.
  13333. @end table
  13334. This filter also supports the @ref{framesync} options.
  13335. @section owdenoise
  13336. Apply Overcomplete Wavelet denoiser.
  13337. The filter accepts the following options:
  13338. @table @option
  13339. @item depth
  13340. Set depth.
  13341. Larger depth values will denoise lower frequency components more, but
  13342. slow down filtering.
  13343. Must be an int in the range 8-16, default is @code{8}.
  13344. @item luma_strength, ls
  13345. Set luma strength.
  13346. Must be a double value in the range 0-1000, default is @code{1.0}.
  13347. @item chroma_strength, cs
  13348. Set chroma strength.
  13349. Must be a double value in the range 0-1000, default is @code{1.0}.
  13350. @end table
  13351. @anchor{pad}
  13352. @section pad
  13353. Add paddings to the input image, and place the original input at the
  13354. provided @var{x}, @var{y} coordinates.
  13355. It accepts the following parameters:
  13356. @table @option
  13357. @item width, w
  13358. @item height, h
  13359. Specify an expression for the size of the output image with the
  13360. paddings added. If the value for @var{width} or @var{height} is 0, the
  13361. corresponding input size is used for the output.
  13362. The @var{width} expression can reference the value set by the
  13363. @var{height} expression, and vice versa.
  13364. The default value of @var{width} and @var{height} is 0.
  13365. @item x
  13366. @item y
  13367. Specify the offsets to place the input image at within the padded area,
  13368. with respect to the top/left border of the output image.
  13369. The @var{x} expression can reference the value set by the @var{y}
  13370. expression, and vice versa.
  13371. The default value of @var{x} and @var{y} is 0.
  13372. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  13373. so the input image is centered on the padded area.
  13374. @item color
  13375. Specify the color of the padded area. For the syntax of this option,
  13376. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  13377. manual,ffmpeg-utils}.
  13378. The default value of @var{color} is "black".
  13379. @item eval
  13380. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  13381. It accepts the following values:
  13382. @table @samp
  13383. @item init
  13384. Only evaluate expressions once during the filter initialization or when
  13385. a command is processed.
  13386. @item frame
  13387. Evaluate expressions for each incoming frame.
  13388. @end table
  13389. Default value is @samp{init}.
  13390. @item aspect
  13391. Pad to aspect instead to a resolution.
  13392. @end table
  13393. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  13394. options are expressions containing the following constants:
  13395. @table @option
  13396. @item in_w
  13397. @item in_h
  13398. The input video width and height.
  13399. @item iw
  13400. @item ih
  13401. These are the same as @var{in_w} and @var{in_h}.
  13402. @item out_w
  13403. @item out_h
  13404. The output width and height (the size of the padded area), as
  13405. specified by the @var{width} and @var{height} expressions.
  13406. @item ow
  13407. @item oh
  13408. These are the same as @var{out_w} and @var{out_h}.
  13409. @item x
  13410. @item y
  13411. The x and y offsets as specified by the @var{x} and @var{y}
  13412. expressions, or NAN if not yet specified.
  13413. @item a
  13414. same as @var{iw} / @var{ih}
  13415. @item sar
  13416. input sample aspect ratio
  13417. @item dar
  13418. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  13419. @item hsub
  13420. @item vsub
  13421. The horizontal and vertical chroma subsample values. For example for the
  13422. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13423. @end table
  13424. @subsection Examples
  13425. @itemize
  13426. @item
  13427. Add paddings with the color "violet" to the input video. The output video
  13428. size is 640x480, and the top-left corner of the input video is placed at
  13429. column 0, row 40
  13430. @example
  13431. pad=640:480:0:40:violet
  13432. @end example
  13433. The example above is equivalent to the following command:
  13434. @example
  13435. pad=width=640:height=480:x=0:y=40:color=violet
  13436. @end example
  13437. @item
  13438. Pad the input to get an output with dimensions increased by 3/2,
  13439. and put the input video at the center of the padded area:
  13440. @example
  13441. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  13442. @end example
  13443. @item
  13444. Pad the input to get a squared output with size equal to the maximum
  13445. value between the input width and height, and put the input video at
  13446. the center of the padded area:
  13447. @example
  13448. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  13449. @end example
  13450. @item
  13451. Pad the input to get a final w/h ratio of 16:9:
  13452. @example
  13453. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  13454. @end example
  13455. @item
  13456. In case of anamorphic video, in order to set the output display aspect
  13457. correctly, it is necessary to use @var{sar} in the expression,
  13458. according to the relation:
  13459. @example
  13460. (ih * X / ih) * sar = output_dar
  13461. X = output_dar / sar
  13462. @end example
  13463. Thus the previous example needs to be modified to:
  13464. @example
  13465. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  13466. @end example
  13467. @item
  13468. Double the output size and put the input video in the bottom-right
  13469. corner of the output padded area:
  13470. @example
  13471. pad="2*iw:2*ih:ow-iw:oh-ih"
  13472. @end example
  13473. @end itemize
  13474. @anchor{palettegen}
  13475. @section palettegen
  13476. Generate one palette for a whole video stream.
  13477. It accepts the following options:
  13478. @table @option
  13479. @item max_colors
  13480. Set the maximum number of colors to quantize in the palette.
  13481. Note: the palette will still contain 256 colors; the unused palette entries
  13482. will be black.
  13483. @item reserve_transparent
  13484. Create a palette of 255 colors maximum and reserve the last one for
  13485. transparency. Reserving the transparency color is useful for GIF optimization.
  13486. If not set, the maximum of colors in the palette will be 256. You probably want
  13487. to disable this option for a standalone image.
  13488. Set by default.
  13489. @item transparency_color
  13490. Set the color that will be used as background for transparency.
  13491. @item stats_mode
  13492. Set statistics mode.
  13493. It accepts the following values:
  13494. @table @samp
  13495. @item full
  13496. Compute full frame histograms.
  13497. @item diff
  13498. Compute histograms only for the part that differs from previous frame. This
  13499. might be relevant to give more importance to the moving part of your input if
  13500. the background is static.
  13501. @item single
  13502. Compute new histogram for each frame.
  13503. @end table
  13504. Default value is @var{full}.
  13505. @item use_alpha
  13506. Create a palette of colors with alpha components.
  13507. Setting this, will automatically disable 'reserve_transparent'.
  13508. @end table
  13509. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  13510. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  13511. color quantization of the palette. This information is also visible at
  13512. @var{info} logging level.
  13513. @subsection Examples
  13514. @itemize
  13515. @item
  13516. Generate a representative palette of a given video using @command{ffmpeg}:
  13517. @example
  13518. ffmpeg -i input.mkv -vf palettegen palette.png
  13519. @end example
  13520. @end itemize
  13521. @section paletteuse
  13522. Use a palette to downsample an input video stream.
  13523. The filter takes two inputs: one video stream and a palette. The palette must
  13524. be a 256 pixels image.
  13525. It accepts the following options:
  13526. @table @option
  13527. @item dither
  13528. Select dithering mode. Available algorithms are:
  13529. @table @samp
  13530. @item bayer
  13531. Ordered 8x8 bayer dithering (deterministic)
  13532. @item heckbert
  13533. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  13534. Note: this dithering is sometimes considered "wrong" and is included as a
  13535. reference.
  13536. @item floyd_steinberg
  13537. Floyd and Steingberg dithering (error diffusion)
  13538. @item sierra2
  13539. Frankie Sierra dithering v2 (error diffusion)
  13540. @item sierra2_4a
  13541. Frankie Sierra dithering v2 "Lite" (error diffusion)
  13542. @end table
  13543. Default is @var{sierra2_4a}.
  13544. @item bayer_scale
  13545. When @var{bayer} dithering is selected, this option defines the scale of the
  13546. pattern (how much the crosshatch pattern is visible). A low value means more
  13547. visible pattern for less banding, and higher value means less visible pattern
  13548. at the cost of more banding.
  13549. The option must be an integer value in the range [0,5]. Default is @var{2}.
  13550. @item diff_mode
  13551. If set, define the zone to process
  13552. @table @samp
  13553. @item rectangle
  13554. Only the changing rectangle will be reprocessed. This is similar to GIF
  13555. cropping/offsetting compression mechanism. This option can be useful for speed
  13556. if only a part of the image is changing, and has use cases such as limiting the
  13557. scope of the error diffusal @option{dither} to the rectangle that bounds the
  13558. moving scene (it leads to more deterministic output if the scene doesn't change
  13559. much, and as a result less moving noise and better GIF compression).
  13560. @end table
  13561. Default is @var{none}.
  13562. @item new
  13563. Take new palette for each output frame.
  13564. @item alpha_threshold
  13565. Sets the alpha threshold for transparency. Alpha values above this threshold
  13566. will be treated as completely opaque, and values below this threshold will be
  13567. treated as completely transparent.
  13568. The option must be an integer value in the range [0,255]. Default is @var{128}.
  13569. @item use_alpha
  13570. Apply the palette by taking alpha values into account. Only useful with
  13571. palettes that are containing multiple colors with alpha components.
  13572. Setting this will automatically disable 'alpha_treshold'.
  13573. @end table
  13574. @subsection Examples
  13575. @itemize
  13576. @item
  13577. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  13578. using @command{ffmpeg}:
  13579. @example
  13580. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  13581. @end example
  13582. @end itemize
  13583. @section perspective
  13584. Correct perspective of video not recorded perpendicular to the screen.
  13585. A description of the accepted parameters follows.
  13586. @table @option
  13587. @item x0
  13588. @item y0
  13589. @item x1
  13590. @item y1
  13591. @item x2
  13592. @item y2
  13593. @item x3
  13594. @item y3
  13595. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  13596. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  13597. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  13598. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  13599. then the corners of the source will be sent to the specified coordinates.
  13600. The expressions can use the following variables:
  13601. @table @option
  13602. @item W
  13603. @item H
  13604. the width and height of video frame.
  13605. @item in
  13606. Input frame count.
  13607. @item on
  13608. Output frame count.
  13609. @end table
  13610. @item interpolation
  13611. Set interpolation for perspective correction.
  13612. It accepts the following values:
  13613. @table @samp
  13614. @item linear
  13615. @item cubic
  13616. @end table
  13617. Default value is @samp{linear}.
  13618. @item sense
  13619. Set interpretation of coordinate options.
  13620. It accepts the following values:
  13621. @table @samp
  13622. @item 0, source
  13623. Send point in the source specified by the given coordinates to
  13624. the corners of the destination.
  13625. @item 1, destination
  13626. Send the corners of the source to the point in the destination specified
  13627. by the given coordinates.
  13628. Default value is @samp{source}.
  13629. @end table
  13630. @item eval
  13631. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  13632. It accepts the following values:
  13633. @table @samp
  13634. @item init
  13635. only evaluate expressions once during the filter initialization or
  13636. when a command is processed
  13637. @item frame
  13638. evaluate expressions for each incoming frame
  13639. @end table
  13640. Default value is @samp{init}.
  13641. @end table
  13642. @section phase
  13643. Delay interlaced video by one field time so that the field order changes.
  13644. The intended use is to fix PAL movies that have been captured with the
  13645. opposite field order to the film-to-video transfer.
  13646. A description of the accepted parameters follows.
  13647. @table @option
  13648. @item mode
  13649. Set phase mode.
  13650. It accepts the following values:
  13651. @table @samp
  13652. @item t
  13653. Capture field order top-first, transfer bottom-first.
  13654. Filter will delay the bottom field.
  13655. @item b
  13656. Capture field order bottom-first, transfer top-first.
  13657. Filter will delay the top field.
  13658. @item p
  13659. Capture and transfer with the same field order. This mode only exists
  13660. for the documentation of the other options to refer to, but if you
  13661. actually select it, the filter will faithfully do nothing.
  13662. @item a
  13663. Capture field order determined automatically by field flags, transfer
  13664. opposite.
  13665. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  13666. basis using field flags. If no field information is available,
  13667. then this works just like @samp{u}.
  13668. @item u
  13669. Capture unknown or varying, transfer opposite.
  13670. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  13671. analyzing the images and selecting the alternative that produces best
  13672. match between the fields.
  13673. @item T
  13674. Capture top-first, transfer unknown or varying.
  13675. Filter selects among @samp{t} and @samp{p} using image analysis.
  13676. @item B
  13677. Capture bottom-first, transfer unknown or varying.
  13678. Filter selects among @samp{b} and @samp{p} using image analysis.
  13679. @item A
  13680. Capture determined by field flags, transfer unknown or varying.
  13681. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  13682. image analysis. If no field information is available, then this works just
  13683. like @samp{U}. This is the default mode.
  13684. @item U
  13685. Both capture and transfer unknown or varying.
  13686. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  13687. @end table
  13688. @end table
  13689. @subsection Commands
  13690. This filter supports the all above options as @ref{commands}.
  13691. @section photosensitivity
  13692. Reduce various flashes in video, so to help users with epilepsy.
  13693. It accepts the following options:
  13694. @table @option
  13695. @item frames, f
  13696. Set how many frames to use when filtering. Default is 30.
  13697. @item threshold, t
  13698. Set detection threshold factor. Default is 1.
  13699. Lower is stricter.
  13700. @item skip
  13701. Set how many pixels to skip when sampling frames. Default is 1.
  13702. Allowed range is from 1 to 1024.
  13703. @item bypass
  13704. Leave frames unchanged. Default is disabled.
  13705. @end table
  13706. @section pixdesctest
  13707. Pixel format descriptor test filter, mainly useful for internal
  13708. testing. The output video should be equal to the input video.
  13709. For example:
  13710. @example
  13711. format=monow, pixdesctest
  13712. @end example
  13713. can be used to test the monowhite pixel format descriptor definition.
  13714. @section pixelize
  13715. Apply pixelization to video stream.
  13716. The filter accepts the following options:
  13717. @table @option
  13718. @item width, w
  13719. @item height, h
  13720. Set block dimensions that will be used for pixelization.
  13721. Default value is @code{16}.
  13722. @item mode, m
  13723. Set the mode of pixelization used.
  13724. Possible values are:
  13725. @table @samp
  13726. @item avg
  13727. @item min
  13728. @item max
  13729. @end table
  13730. Default value is @code{avg}.
  13731. @item planes, p
  13732. Set what planes to filter. Default is to filter all planes.
  13733. @end table
  13734. @subsection Commands
  13735. This filter supports all options as @ref{commands}.
  13736. @section pixscope
  13737. Display sample values of color channels. Mainly useful for checking color
  13738. and levels. Minimum supported resolution is 640x480.
  13739. The filters accept the following options:
  13740. @table @option
  13741. @item x
  13742. Set scope X position, relative offset on X axis.
  13743. @item y
  13744. Set scope Y position, relative offset on Y axis.
  13745. @item w
  13746. Set scope width.
  13747. @item h
  13748. Set scope height.
  13749. @item o
  13750. Set window opacity. This window also holds statistics about pixel area.
  13751. @item wx
  13752. Set window X position, relative offset on X axis.
  13753. @item wy
  13754. Set window Y position, relative offset on Y axis.
  13755. @end table
  13756. @subsection Commands
  13757. This filter supports same @ref{commands} as options.
  13758. @section pp
  13759. Enable the specified chain of postprocessing subfilters using libpostproc. This
  13760. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  13761. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  13762. Each subfilter and some options have a short and a long name that can be used
  13763. interchangeably, i.e. dr/dering are the same.
  13764. The filters accept the following options:
  13765. @table @option
  13766. @item subfilters
  13767. Set postprocessing subfilters string.
  13768. @end table
  13769. All subfilters share common options to determine their scope:
  13770. @table @option
  13771. @item a/autoq
  13772. Honor the quality commands for this subfilter.
  13773. @item c/chrom
  13774. Do chrominance filtering, too (default).
  13775. @item y/nochrom
  13776. Do luminance filtering only (no chrominance).
  13777. @item n/noluma
  13778. Do chrominance filtering only (no luminance).
  13779. @end table
  13780. These options can be appended after the subfilter name, separated by a '|'.
  13781. Available subfilters are:
  13782. @table @option
  13783. @item hb/hdeblock[|difference[|flatness]]
  13784. Horizontal deblocking filter
  13785. @table @option
  13786. @item difference
  13787. Difference factor where higher values mean more deblocking (default: @code{32}).
  13788. @item flatness
  13789. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  13790. @end table
  13791. @item vb/vdeblock[|difference[|flatness]]
  13792. Vertical deblocking filter
  13793. @table @option
  13794. @item difference
  13795. Difference factor where higher values mean more deblocking (default: @code{32}).
  13796. @item flatness
  13797. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  13798. @end table
  13799. @item ha/hadeblock[|difference[|flatness]]
  13800. Accurate horizontal deblocking filter
  13801. @table @option
  13802. @item difference
  13803. Difference factor where higher values mean more deblocking (default: @code{32}).
  13804. @item flatness
  13805. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  13806. @end table
  13807. @item va/vadeblock[|difference[|flatness]]
  13808. Accurate vertical deblocking filter
  13809. @table @option
  13810. @item difference
  13811. Difference factor where higher values mean more deblocking (default: @code{32}).
  13812. @item flatness
  13813. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  13814. @end table
  13815. @end table
  13816. The horizontal and vertical deblocking filters share the difference and
  13817. flatness values so you cannot set different horizontal and vertical
  13818. thresholds.
  13819. @table @option
  13820. @item h1/x1hdeblock
  13821. Experimental horizontal deblocking filter
  13822. @item v1/x1vdeblock
  13823. Experimental vertical deblocking filter
  13824. @item dr/dering
  13825. Deringing filter
  13826. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  13827. @table @option
  13828. @item threshold1
  13829. larger -> stronger filtering
  13830. @item threshold2
  13831. larger -> stronger filtering
  13832. @item threshold3
  13833. larger -> stronger filtering
  13834. @end table
  13835. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  13836. @table @option
  13837. @item f/fullyrange
  13838. Stretch luminance to @code{0-255}.
  13839. @end table
  13840. @item lb/linblenddeint
  13841. Linear blend deinterlacing filter that deinterlaces the given block by
  13842. filtering all lines with a @code{(1 2 1)} filter.
  13843. @item li/linipoldeint
  13844. Linear interpolating deinterlacing filter that deinterlaces the given block by
  13845. linearly interpolating every second line.
  13846. @item ci/cubicipoldeint
  13847. Cubic interpolating deinterlacing filter deinterlaces the given block by
  13848. cubically interpolating every second line.
  13849. @item md/mediandeint
  13850. Median deinterlacing filter that deinterlaces the given block by applying a
  13851. median filter to every second line.
  13852. @item fd/ffmpegdeint
  13853. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  13854. second line with a @code{(-1 4 2 4 -1)} filter.
  13855. @item l5/lowpass5
  13856. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  13857. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  13858. @item fq/forceQuant[|quantizer]
  13859. Overrides the quantizer table from the input with the constant quantizer you
  13860. specify.
  13861. @table @option
  13862. @item quantizer
  13863. Quantizer to use
  13864. @end table
  13865. @item de/default
  13866. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  13867. @item fa/fast
  13868. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  13869. @item ac
  13870. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  13871. @end table
  13872. @subsection Examples
  13873. @itemize
  13874. @item
  13875. Apply horizontal and vertical deblocking, deringing and automatic
  13876. brightness/contrast:
  13877. @example
  13878. pp=hb/vb/dr/al
  13879. @end example
  13880. @item
  13881. Apply default filters without brightness/contrast correction:
  13882. @example
  13883. pp=de/-al
  13884. @end example
  13885. @item
  13886. Apply default filters and temporal denoiser:
  13887. @example
  13888. pp=default/tmpnoise|1|2|3
  13889. @end example
  13890. @item
  13891. Apply deblocking on luminance only, and switch vertical deblocking on or off
  13892. automatically depending on available CPU time:
  13893. @example
  13894. pp=hb|y/vb|a
  13895. @end example
  13896. @end itemize
  13897. @section pp7
  13898. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  13899. similar to spp = 6 with 7 point DCT, where only the center sample is
  13900. used after IDCT.
  13901. The filter accepts the following options:
  13902. @table @option
  13903. @item qp
  13904. Force a constant quantization parameter. It accepts an integer in range
  13905. 0 to 63. If not set, the filter will use the QP from the video stream
  13906. (if available).
  13907. @item mode
  13908. Set thresholding mode. Available modes are:
  13909. @table @samp
  13910. @item hard
  13911. Set hard thresholding.
  13912. @item soft
  13913. Set soft thresholding (better de-ringing effect, but likely blurrier).
  13914. @item medium
  13915. Set medium thresholding (good results, default).
  13916. @end table
  13917. @end table
  13918. @section premultiply
  13919. Apply alpha premultiply effect to input video stream using first plane
  13920. of second stream as alpha.
  13921. Both streams must have same dimensions and same pixel format.
  13922. The filter accepts the following option:
  13923. @table @option
  13924. @item planes
  13925. Set which planes will be processed, unprocessed planes will be copied.
  13926. By default value 0xf, all planes will be processed.
  13927. @item inplace
  13928. Do not require 2nd input for processing, instead use alpha plane from input stream.
  13929. @end table
  13930. @section prewitt
  13931. Apply prewitt operator to input video stream.
  13932. The filter accepts the following option:
  13933. @table @option
  13934. @item planes
  13935. Set which planes will be processed, unprocessed planes will be copied.
  13936. By default value 0xf, all planes will be processed.
  13937. @item scale
  13938. Set value which will be multiplied with filtered result.
  13939. @item delta
  13940. Set value which will be added to filtered result.
  13941. @end table
  13942. @subsection Commands
  13943. This filter supports the all above options as @ref{commands}.
  13944. @section pseudocolor
  13945. Alter frame colors in video with pseudocolors.
  13946. This filter accepts the following options:
  13947. @table @option
  13948. @item c0
  13949. set pixel first component expression
  13950. @item c1
  13951. set pixel second component expression
  13952. @item c2
  13953. set pixel third component expression
  13954. @item c3
  13955. set pixel fourth component expression, corresponds to the alpha component
  13956. @item index, i
  13957. set component to use as base for altering colors
  13958. @item preset, p
  13959. Pick one of built-in LUTs. By default is set to none.
  13960. Available LUTs:
  13961. @table @samp
  13962. @item magma
  13963. @item inferno
  13964. @item plasma
  13965. @item viridis
  13966. @item turbo
  13967. @item cividis
  13968. @item range1
  13969. @item range2
  13970. @item shadows
  13971. @item highlights
  13972. @item solar
  13973. @item nominal
  13974. @item preferred
  13975. @item total
  13976. @end table
  13977. @item opacity
  13978. Set opacity of output colors. Allowed range is from 0 to 1.
  13979. Default value is set to 1.
  13980. @end table
  13981. Each of the expression options specifies the expression to use for computing
  13982. the lookup table for the corresponding pixel component values.
  13983. The expressions can contain the following constants and functions:
  13984. @table @option
  13985. @item w
  13986. @item h
  13987. The input width and height.
  13988. @item val
  13989. The input value for the pixel component.
  13990. @item ymin, umin, vmin, amin
  13991. The minimum allowed component value.
  13992. @item ymax, umax, vmax, amax
  13993. The maximum allowed component value.
  13994. @end table
  13995. All expressions default to "val".
  13996. @subsection Commands
  13997. This filter supports the all above options as @ref{commands}.
  13998. @subsection Examples
  13999. @itemize
  14000. @item
  14001. Change too high luma values to gradient:
  14002. @example
  14003. 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'"
  14004. @end example
  14005. @end itemize
  14006. @section psnr
  14007. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  14008. Ratio) between two input videos.
  14009. This filter takes in input two input videos, the first input is
  14010. considered the "main" source and is passed unchanged to the
  14011. output. The second input is used as a "reference" video for computing
  14012. the PSNR.
  14013. Both video inputs must have the same resolution and pixel format for
  14014. this filter to work correctly. Also it assumes that both inputs
  14015. have the same number of frames, which are compared one by one.
  14016. The obtained average PSNR is printed through the logging system.
  14017. The filter stores the accumulated MSE (mean squared error) of each
  14018. frame, and at the end of the processing it is averaged across all frames
  14019. equally, and the following formula is applied to obtain the PSNR:
  14020. @example
  14021. PSNR = 10*log10(MAX^2/MSE)
  14022. @end example
  14023. Where MAX is the average of the maximum values of each component of the
  14024. image.
  14025. The description of the accepted parameters follows.
  14026. @table @option
  14027. @item stats_file, f
  14028. If specified the filter will use the named file to save the PSNR of
  14029. each individual frame. When filename equals "-" the data is sent to
  14030. standard output.
  14031. @item stats_version
  14032. Specifies which version of the stats file format to use. Details of
  14033. each format are written below.
  14034. Default value is 1.
  14035. @item stats_add_max
  14036. Determines whether the max value is output to the stats log.
  14037. Default value is 0.
  14038. Requires stats_version >= 2. If this is set and stats_version < 2,
  14039. the filter will return an error.
  14040. @end table
  14041. This filter also supports the @ref{framesync} options.
  14042. The file printed if @var{stats_file} is selected, contains a sequence of
  14043. key/value pairs of the form @var{key}:@var{value} for each compared
  14044. couple of frames.
  14045. If a @var{stats_version} greater than 1 is specified, a header line precedes
  14046. the list of per-frame-pair stats, with key value pairs following the frame
  14047. format with the following parameters:
  14048. @table @option
  14049. @item psnr_log_version
  14050. The version of the log file format. Will match @var{stats_version}.
  14051. @item fields
  14052. A comma separated list of the per-frame-pair parameters included in
  14053. the log.
  14054. @end table
  14055. A description of each shown per-frame-pair parameter follows:
  14056. @table @option
  14057. @item n
  14058. sequential number of the input frame, starting from 1
  14059. @item mse_avg
  14060. Mean Square Error pixel-by-pixel average difference of the compared
  14061. frames, averaged over all the image components.
  14062. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  14063. Mean Square Error pixel-by-pixel average difference of the compared
  14064. frames for the component specified by the suffix.
  14065. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  14066. Peak Signal to Noise ratio of the compared frames for the component
  14067. specified by the suffix.
  14068. @item max_avg, max_y, max_u, max_v
  14069. Maximum allowed value for each channel, and average over all
  14070. channels.
  14071. @end table
  14072. @subsection Examples
  14073. @itemize
  14074. @item
  14075. For example:
  14076. @example
  14077. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  14078. [main][ref] psnr="stats_file=stats.log" [out]
  14079. @end example
  14080. On this example the input file being processed is compared with the
  14081. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  14082. is stored in @file{stats.log}.
  14083. @item
  14084. Another example with different containers:
  14085. @example
  14086. 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 -
  14087. @end example
  14088. @end itemize
  14089. @anchor{pullup}
  14090. @section pullup
  14091. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  14092. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  14093. content.
  14094. The pullup filter is designed to take advantage of future context in making
  14095. its decisions. This filter is stateless in the sense that it does not lock
  14096. onto a pattern to follow, but it instead looks forward to the following
  14097. fields in order to identify matches and rebuild progressive frames.
  14098. To produce content with an even framerate, insert the fps filter after
  14099. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  14100. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  14101. The filter accepts the following options:
  14102. @table @option
  14103. @item jl
  14104. @item jr
  14105. @item jt
  14106. @item jb
  14107. These options set the amount of "junk" to ignore at the left, right, top, and
  14108. bottom of the image, respectively. Left and right are in units of 8 pixels,
  14109. while top and bottom are in units of 2 lines.
  14110. The default is 8 pixels on each side.
  14111. @item sb
  14112. Set the strict breaks. Setting this option to 1 will reduce the chances of
  14113. filter generating an occasional mismatched frame, but it may also cause an
  14114. excessive number of frames to be dropped during high motion sequences.
  14115. Conversely, setting it to -1 will make filter match fields more easily.
  14116. This may help processing of video where there is slight blurring between
  14117. the fields, but may also cause there to be interlaced frames in the output.
  14118. Default value is @code{0}.
  14119. @item mp
  14120. Set the metric plane to use. It accepts the following values:
  14121. @table @samp
  14122. @item l
  14123. Use luma plane.
  14124. @item u
  14125. Use chroma blue plane.
  14126. @item v
  14127. Use chroma red plane.
  14128. @end table
  14129. This option may be set to use chroma plane instead of the default luma plane
  14130. for doing filter's computations. This may improve accuracy on very clean
  14131. source material, but more likely will decrease accuracy, especially if there
  14132. is chroma noise (rainbow effect) or any grayscale video.
  14133. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  14134. load and make pullup usable in realtime on slow machines.
  14135. @end table
  14136. For best results (without duplicated frames in the output file) it is
  14137. necessary to change the output frame rate. For example, to inverse
  14138. telecine NTSC input:
  14139. @example
  14140. ffmpeg -i input -vf pullup -r 24000/1001 ...
  14141. @end example
  14142. @section qp
  14143. Change video quantization parameters (QP).
  14144. The filter accepts the following option:
  14145. @table @option
  14146. @item qp
  14147. Set expression for quantization parameter.
  14148. @end table
  14149. The expression is evaluated through the eval API and can contain, among others,
  14150. the following constants:
  14151. @table @var
  14152. @item known
  14153. 1 if index is not 129, 0 otherwise.
  14154. @item qp
  14155. Sequential index starting from -129 to 128.
  14156. @end table
  14157. @subsection Examples
  14158. @itemize
  14159. @item
  14160. Some equation like:
  14161. @example
  14162. qp=2+2*sin(PI*qp)
  14163. @end example
  14164. @end itemize
  14165. @section random
  14166. Flush video frames from internal cache of frames into a random order.
  14167. No frame is discarded.
  14168. Inspired by @ref{frei0r} nervous filter.
  14169. @table @option
  14170. @item frames
  14171. Set size in number of frames of internal cache, in range from @code{2} to
  14172. @code{512}. Default is @code{30}.
  14173. @item seed
  14174. Set seed for random number generator, must be an integer included between
  14175. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  14176. less than @code{0}, the filter will try to use a good random seed on a
  14177. best effort basis.
  14178. @end table
  14179. @section readeia608
  14180. Read closed captioning (EIA-608) information from the top lines of a video frame.
  14181. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  14182. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  14183. with EIA-608 data (starting from 0). A description of each metadata value follows:
  14184. @table @option
  14185. @item lavfi.readeia608.X.cc
  14186. The two bytes stored as EIA-608 data (printed in hexadecimal).
  14187. @item lavfi.readeia608.X.line
  14188. The number of the line on which the EIA-608 data was identified and read.
  14189. @end table
  14190. This filter accepts the following options:
  14191. @table @option
  14192. @item scan_min
  14193. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  14194. @item scan_max
  14195. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  14196. @item spw
  14197. Set the ratio of width reserved for sync code detection.
  14198. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  14199. @item chp
  14200. Enable checking the parity bit. In the event of a parity error, the filter will output
  14201. @code{0x00} for that character. Default is false.
  14202. @item lp
  14203. Lowpass lines prior to further processing. Default is enabled.
  14204. @end table
  14205. @subsection Commands
  14206. This filter supports the all above options as @ref{commands}.
  14207. @subsection Examples
  14208. @itemize
  14209. @item
  14210. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  14211. @example
  14212. 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
  14213. @end example
  14214. @end itemize
  14215. @section readvitc
  14216. Read vertical interval timecode (VITC) information from the top lines of a
  14217. video frame.
  14218. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  14219. timecode value, if a valid timecode has been detected. Further metadata key
  14220. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  14221. timecode data has been found or not.
  14222. This filter accepts the following options:
  14223. @table @option
  14224. @item scan_max
  14225. Set the maximum number of lines to scan for VITC data. If the value is set to
  14226. @code{-1} the full video frame is scanned. Default is @code{45}.
  14227. @item thr_b
  14228. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  14229. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  14230. @item thr_w
  14231. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  14232. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  14233. @end table
  14234. @subsection Examples
  14235. @itemize
  14236. @item
  14237. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  14238. draw @code{--:--:--:--} as a placeholder:
  14239. @example
  14240. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  14241. @end example
  14242. @end itemize
  14243. @section remap
  14244. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  14245. Destination pixel at position (X, Y) will be picked from source (x, y) position
  14246. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  14247. value for pixel will be used for destination pixel.
  14248. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  14249. will have Xmap/Ymap video stream dimensions.
  14250. Xmap and Ymap input video streams are 16bit depth, single channel.
  14251. @table @option
  14252. @item format
  14253. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  14254. Default is @code{color}.
  14255. @item fill
  14256. Specify the color of the unmapped pixels. For the syntax of this option,
  14257. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14258. manual,ffmpeg-utils}. Default color is @code{black}.
  14259. @end table
  14260. @section removegrain
  14261. The removegrain filter is a spatial denoiser for progressive video.
  14262. @table @option
  14263. @item m0
  14264. Set mode for the first plane.
  14265. @item m1
  14266. Set mode for the second plane.
  14267. @item m2
  14268. Set mode for the third plane.
  14269. @item m3
  14270. Set mode for the fourth plane.
  14271. @end table
  14272. Range of mode is from 0 to 24. Description of each mode follows:
  14273. @table @var
  14274. @item 0
  14275. Leave input plane unchanged. Default.
  14276. @item 1
  14277. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  14278. @item 2
  14279. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  14280. @item 3
  14281. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  14282. @item 4
  14283. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  14284. This is equivalent to a median filter.
  14285. @item 5
  14286. Line-sensitive clipping giving the minimal change.
  14287. @item 6
  14288. Line-sensitive clipping, intermediate.
  14289. @item 7
  14290. Line-sensitive clipping, intermediate.
  14291. @item 8
  14292. Line-sensitive clipping, intermediate.
  14293. @item 9
  14294. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  14295. @item 10
  14296. Replaces the target pixel with the closest neighbour.
  14297. @item 11
  14298. [1 2 1] horizontal and vertical kernel blur.
  14299. @item 12
  14300. Same as mode 11.
  14301. @item 13
  14302. Bob mode, interpolates top field from the line where the neighbours
  14303. pixels are the closest.
  14304. @item 14
  14305. Bob mode, interpolates bottom field from the line where the neighbours
  14306. pixels are the closest.
  14307. @item 15
  14308. Bob mode, interpolates top field. Same as 13 but with a more complicated
  14309. interpolation formula.
  14310. @item 16
  14311. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  14312. interpolation formula.
  14313. @item 17
  14314. Clips the pixel with the minimum and maximum of respectively the maximum and
  14315. minimum of each pair of opposite neighbour pixels.
  14316. @item 18
  14317. Line-sensitive clipping using opposite neighbours whose greatest distance from
  14318. the current pixel is minimal.
  14319. @item 19
  14320. Replaces the pixel with the average of its 8 neighbours.
  14321. @item 20
  14322. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  14323. @item 21
  14324. Clips pixels using the averages of opposite neighbour.
  14325. @item 22
  14326. Same as mode 21 but simpler and faster.
  14327. @item 23
  14328. Small edge and halo removal, but reputed useless.
  14329. @item 24
  14330. Similar as 23.
  14331. @end table
  14332. @section removelogo
  14333. Suppress a TV station logo, using an image file to determine which
  14334. pixels comprise the logo. It works by filling in the pixels that
  14335. comprise the logo with neighboring pixels.
  14336. The filter accepts the following options:
  14337. @table @option
  14338. @item filename, f
  14339. Set the filter bitmap file, which can be any image format supported by
  14340. libavformat. The width and height of the image file must match those of the
  14341. video stream being processed.
  14342. @end table
  14343. Pixels in the provided bitmap image with a value of zero are not
  14344. considered part of the logo, non-zero pixels are considered part of
  14345. the logo. If you use white (255) for the logo and black (0) for the
  14346. rest, you will be safe. For making the filter bitmap, it is
  14347. recommended to take a screen capture of a black frame with the logo
  14348. visible, and then using a threshold filter followed by the erode
  14349. filter once or twice.
  14350. If needed, little splotches can be fixed manually. Remember that if
  14351. logo pixels are not covered, the filter quality will be much
  14352. reduced. Marking too many pixels as part of the logo does not hurt as
  14353. much, but it will increase the amount of blurring needed to cover over
  14354. the image and will destroy more information than necessary, and extra
  14355. pixels will slow things down on a large logo.
  14356. @section repeatfields
  14357. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  14358. fields based on its value.
  14359. @section reverse
  14360. Reverse a video clip.
  14361. Warning: This filter requires memory to buffer the entire clip, so trimming
  14362. is suggested.
  14363. @subsection Examples
  14364. @itemize
  14365. @item
  14366. Take the first 5 seconds of a clip, and reverse it.
  14367. @example
  14368. trim=end=5,reverse
  14369. @end example
  14370. @end itemize
  14371. @section rgbashift
  14372. Shift R/G/B/A pixels horizontally and/or vertically.
  14373. The filter accepts the following options:
  14374. @table @option
  14375. @item rh
  14376. Set amount to shift red horizontally.
  14377. @item rv
  14378. Set amount to shift red vertically.
  14379. @item gh
  14380. Set amount to shift green horizontally.
  14381. @item gv
  14382. Set amount to shift green vertically.
  14383. @item bh
  14384. Set amount to shift blue horizontally.
  14385. @item bv
  14386. Set amount to shift blue vertically.
  14387. @item ah
  14388. Set amount to shift alpha horizontally.
  14389. @item av
  14390. Set amount to shift alpha vertically.
  14391. @item edge
  14392. Set edge mode, can be @var{smear}, default, or @var{warp}.
  14393. @end table
  14394. @subsection Commands
  14395. This filter supports the all above options as @ref{commands}.
  14396. @section roberts
  14397. Apply roberts cross operator to input video stream.
  14398. The filter accepts the following option:
  14399. @table @option
  14400. @item planes
  14401. Set which planes will be processed, unprocessed planes will be copied.
  14402. By default value 0xf, all planes will be processed.
  14403. @item scale
  14404. Set value which will be multiplied with filtered result.
  14405. @item delta
  14406. Set value which will be added to filtered result.
  14407. @end table
  14408. @subsection Commands
  14409. This filter supports the all above options as @ref{commands}.
  14410. @section rotate
  14411. Rotate video by an arbitrary angle expressed in radians.
  14412. The filter accepts the following options:
  14413. A description of the optional parameters follows.
  14414. @table @option
  14415. @item angle, a
  14416. Set an expression for the angle by which to rotate the input video
  14417. clockwise, expressed as a number of radians. A negative value will
  14418. result in a counter-clockwise rotation. By default it is set to "0".
  14419. This expression is evaluated for each frame.
  14420. @item out_w, ow
  14421. Set the output width expression, default value is "iw".
  14422. This expression is evaluated just once during configuration.
  14423. @item out_h, oh
  14424. Set the output height expression, default value is "ih".
  14425. This expression is evaluated just once during configuration.
  14426. @item bilinear
  14427. Enable bilinear interpolation if set to 1, a value of 0 disables
  14428. it. Default value is 1.
  14429. @item fillcolor, c
  14430. Set the color used to fill the output area not covered by the rotated
  14431. image. For the general syntax of this option, check the
  14432. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14433. If the special value "none" is selected then no
  14434. background is printed (useful for example if the background is never shown).
  14435. Default value is "black".
  14436. @end table
  14437. The expressions for the angle and the output size can contain the
  14438. following constants and functions:
  14439. @table @option
  14440. @item n
  14441. sequential number of the input frame, starting from 0. It is always NAN
  14442. before the first frame is filtered.
  14443. @item t
  14444. time in seconds of the input frame, it is set to 0 when the filter is
  14445. configured. It is always NAN before the first frame is filtered.
  14446. @item hsub
  14447. @item vsub
  14448. horizontal and vertical chroma subsample values. For example for the
  14449. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14450. @item in_w, iw
  14451. @item in_h, ih
  14452. the input video width and height
  14453. @item out_w, ow
  14454. @item out_h, oh
  14455. the output width and height, that is the size of the padded area as
  14456. specified by the @var{width} and @var{height} expressions
  14457. @item rotw(a)
  14458. @item roth(a)
  14459. the minimal width/height required for completely containing the input
  14460. video rotated by @var{a} radians.
  14461. These are only available when computing the @option{out_w} and
  14462. @option{out_h} expressions.
  14463. @end table
  14464. @subsection Examples
  14465. @itemize
  14466. @item
  14467. Rotate the input by PI/6 radians clockwise:
  14468. @example
  14469. rotate=PI/6
  14470. @end example
  14471. @item
  14472. Rotate the input by PI/6 radians counter-clockwise:
  14473. @example
  14474. rotate=-PI/6
  14475. @end example
  14476. @item
  14477. Rotate the input by 45 degrees clockwise:
  14478. @example
  14479. rotate=45*PI/180
  14480. @end example
  14481. @item
  14482. Apply a constant rotation with period T, starting from an angle of PI/3:
  14483. @example
  14484. rotate=PI/3+2*PI*t/T
  14485. @end example
  14486. @item
  14487. Make the input video rotation oscillating with a period of T
  14488. seconds and an amplitude of A radians:
  14489. @example
  14490. rotate=A*sin(2*PI/T*t)
  14491. @end example
  14492. @item
  14493. Rotate the video, output size is chosen so that the whole rotating
  14494. input video is always completely contained in the output:
  14495. @example
  14496. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  14497. @end example
  14498. @item
  14499. Rotate the video, reduce the output size so that no background is ever
  14500. shown:
  14501. @example
  14502. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  14503. @end example
  14504. @end itemize
  14505. @subsection Commands
  14506. The filter supports the following commands:
  14507. @table @option
  14508. @item a, angle
  14509. Set the angle expression.
  14510. The command accepts the same syntax of the corresponding option.
  14511. If the specified expression is not valid, it is kept at its current
  14512. value.
  14513. @end table
  14514. @section sab
  14515. Apply Shape Adaptive Blur.
  14516. The filter accepts the following options:
  14517. @table @option
  14518. @item luma_radius, lr
  14519. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  14520. value is 1.0. A greater value will result in a more blurred image, and
  14521. in slower processing.
  14522. @item luma_pre_filter_radius, lpfr
  14523. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  14524. value is 1.0.
  14525. @item luma_strength, ls
  14526. Set luma maximum difference between pixels to still be considered, must
  14527. be a value in the 0.1-100.0 range, default value is 1.0.
  14528. @item chroma_radius, cr
  14529. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  14530. greater value will result in a more blurred image, and in slower
  14531. processing.
  14532. @item chroma_pre_filter_radius, cpfr
  14533. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  14534. @item chroma_strength, cs
  14535. Set chroma maximum difference between pixels to still be considered,
  14536. must be a value in the -0.9-100.0 range.
  14537. @end table
  14538. Each chroma option value, if not explicitly specified, is set to the
  14539. corresponding luma option value.
  14540. @anchor{scale}
  14541. @section scale
  14542. Scale (resize) the input video, using the libswscale library.
  14543. The scale filter forces the output display aspect ratio to be the same
  14544. of the input, by changing the output sample aspect ratio.
  14545. If the input image format is different from the format requested by
  14546. the next filter, the scale filter will convert the input to the
  14547. requested format.
  14548. @subsection Options
  14549. The filter accepts the following options, or any of the options
  14550. supported by the libswscale scaler.
  14551. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  14552. the complete list of scaler options.
  14553. @table @option
  14554. @item width, w
  14555. @item height, h
  14556. Set the output video dimension expression. Default value is the input
  14557. dimension.
  14558. If the @var{width} or @var{w} value is 0, the input width is used for
  14559. the output. If the @var{height} or @var{h} value is 0, the input height
  14560. is used for the output.
  14561. If one and only one of the values is -n with n >= 1, the scale filter
  14562. will use a value that maintains the aspect ratio of the input image,
  14563. calculated from the other specified dimension. After that it will,
  14564. however, make sure that the calculated dimension is divisible by n and
  14565. adjust the value if necessary.
  14566. If both values are -n with n >= 1, the behavior will be identical to
  14567. both values being set to 0 as previously detailed.
  14568. See below for the list of accepted constants for use in the dimension
  14569. expression.
  14570. @item eval
  14571. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  14572. @table @samp
  14573. @item init
  14574. Only evaluate expressions once during the filter initialization or when a command is processed.
  14575. @item frame
  14576. Evaluate expressions for each incoming frame.
  14577. @end table
  14578. Default value is @samp{init}.
  14579. @item interl
  14580. Set the interlacing mode. It accepts the following values:
  14581. @table @samp
  14582. @item 1
  14583. Force interlaced aware scaling.
  14584. @item 0
  14585. Do not apply interlaced scaling.
  14586. @item -1
  14587. Select interlaced aware scaling depending on whether the source frames
  14588. are flagged as interlaced or not.
  14589. @end table
  14590. Default value is @samp{0}.
  14591. @item flags
  14592. Set libswscale scaling flags. See
  14593. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  14594. complete list of values. If not explicitly specified the filter applies
  14595. the default flags.
  14596. @item param0, param1
  14597. Set libswscale input parameters for scaling algorithms that need them. See
  14598. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  14599. complete documentation. If not explicitly specified the filter applies
  14600. empty parameters.
  14601. @item size, s
  14602. Set the video size. For the syntax of this option, check the
  14603. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14604. @item in_color_matrix
  14605. @item out_color_matrix
  14606. Set in/output YCbCr color space type.
  14607. This allows the autodetected value to be overridden as well as allows forcing
  14608. a specific value used for the output and encoder.
  14609. If not specified, the color space type depends on the pixel format.
  14610. Possible values:
  14611. @table @samp
  14612. @item auto
  14613. Choose automatically.
  14614. @item bt709
  14615. Format conforming to International Telecommunication Union (ITU)
  14616. Recommendation BT.709.
  14617. @item fcc
  14618. Set color space conforming to the United States Federal Communications
  14619. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  14620. @item bt601
  14621. @item bt470
  14622. @item smpte170m
  14623. Set color space conforming to:
  14624. @itemize
  14625. @item
  14626. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  14627. @item
  14628. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  14629. @item
  14630. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  14631. @end itemize
  14632. @item smpte240m
  14633. Set color space conforming to SMPTE ST 240:1999.
  14634. @item bt2020
  14635. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  14636. @end table
  14637. @item in_range
  14638. @item out_range
  14639. Set in/output YCbCr sample range.
  14640. This allows the autodetected value to be overridden as well as allows forcing
  14641. a specific value used for the output and encoder. If not specified, the
  14642. range depends on the pixel format. Possible values:
  14643. @table @samp
  14644. @item auto/unknown
  14645. Choose automatically.
  14646. @item jpeg/full/pc
  14647. Set full range (0-255 in case of 8-bit luma).
  14648. @item mpeg/limited/tv
  14649. Set "MPEG" range (16-235 in case of 8-bit luma).
  14650. @end table
  14651. @item force_original_aspect_ratio
  14652. Enable decreasing or increasing output video width or height if necessary to
  14653. keep the original aspect ratio. Possible values:
  14654. @table @samp
  14655. @item disable
  14656. Scale the video as specified and disable this feature.
  14657. @item decrease
  14658. The output video dimensions will automatically be decreased if needed.
  14659. @item increase
  14660. The output video dimensions will automatically be increased if needed.
  14661. @end table
  14662. One useful instance of this option is that when you know a specific device's
  14663. maximum allowed resolution, you can use this to limit the output video to
  14664. that, while retaining the aspect ratio. For example, device A allows
  14665. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  14666. decrease) and specifying 1280x720 to the command line makes the output
  14667. 1280x533.
  14668. Please note that this is a different thing than specifying -1 for @option{w}
  14669. or @option{h}, you still need to specify the output resolution for this option
  14670. to work.
  14671. @item force_divisible_by
  14672. Ensures that both the output dimensions, width and height, are divisible by the
  14673. given integer when used together with @option{force_original_aspect_ratio}. This
  14674. works similar to using @code{-n} in the @option{w} and @option{h} options.
  14675. This option respects the value set for @option{force_original_aspect_ratio},
  14676. increasing or decreasing the resolution accordingly. The video's aspect ratio
  14677. may be slightly modified.
  14678. This option can be handy if you need to have a video fit within or exceed
  14679. a defined resolution using @option{force_original_aspect_ratio} but also have
  14680. encoder restrictions on width or height divisibility.
  14681. @end table
  14682. The values of the @option{w} and @option{h} options are expressions
  14683. containing the following constants:
  14684. @table @var
  14685. @item in_w
  14686. @item in_h
  14687. The input width and height
  14688. @item iw
  14689. @item ih
  14690. These are the same as @var{in_w} and @var{in_h}.
  14691. @item out_w
  14692. @item out_h
  14693. The output (scaled) width and height
  14694. @item ow
  14695. @item oh
  14696. These are the same as @var{out_w} and @var{out_h}
  14697. @item a
  14698. The same as @var{iw} / @var{ih}
  14699. @item sar
  14700. input sample aspect ratio
  14701. @item dar
  14702. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  14703. @item hsub
  14704. @item vsub
  14705. horizontal and vertical input chroma subsample values. For example for the
  14706. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14707. @item ohsub
  14708. @item ovsub
  14709. horizontal and vertical output chroma subsample values. For example for the
  14710. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14711. @item n
  14712. The (sequential) number of the input frame, starting from 0.
  14713. Only available with @code{eval=frame}.
  14714. @item t
  14715. The presentation timestamp of the input frame, expressed as a number of
  14716. seconds. Only available with @code{eval=frame}.
  14717. @item pos
  14718. The position (byte offset) of the frame in the input stream, or NaN if
  14719. this information is unavailable and/or meaningless (for example in case of synthetic video).
  14720. Only available with @code{eval=frame}.
  14721. @end table
  14722. @subsection Examples
  14723. @itemize
  14724. @item
  14725. Scale the input video to a size of 200x100
  14726. @example
  14727. scale=w=200:h=100
  14728. @end example
  14729. This is equivalent to:
  14730. @example
  14731. scale=200:100
  14732. @end example
  14733. or:
  14734. @example
  14735. scale=200x100
  14736. @end example
  14737. @item
  14738. Specify a size abbreviation for the output size:
  14739. @example
  14740. scale=qcif
  14741. @end example
  14742. which can also be written as:
  14743. @example
  14744. scale=size=qcif
  14745. @end example
  14746. @item
  14747. Scale the input to 2x:
  14748. @example
  14749. scale=w=2*iw:h=2*ih
  14750. @end example
  14751. @item
  14752. The above is the same as:
  14753. @example
  14754. scale=2*in_w:2*in_h
  14755. @end example
  14756. @item
  14757. Scale the input to 2x with forced interlaced scaling:
  14758. @example
  14759. scale=2*iw:2*ih:interl=1
  14760. @end example
  14761. @item
  14762. Scale the input to half size:
  14763. @example
  14764. scale=w=iw/2:h=ih/2
  14765. @end example
  14766. @item
  14767. Increase the width, and set the height to the same size:
  14768. @example
  14769. scale=3/2*iw:ow
  14770. @end example
  14771. @item
  14772. Seek Greek harmony:
  14773. @example
  14774. scale=iw:1/PHI*iw
  14775. scale=ih*PHI:ih
  14776. @end example
  14777. @item
  14778. Increase the height, and set the width to 3/2 of the height:
  14779. @example
  14780. scale=w=3/2*oh:h=3/5*ih
  14781. @end example
  14782. @item
  14783. Increase the size, making the size a multiple of the chroma
  14784. subsample values:
  14785. @example
  14786. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  14787. @end example
  14788. @item
  14789. Increase the width to a maximum of 500 pixels,
  14790. keeping the same aspect ratio as the input:
  14791. @example
  14792. scale=w='min(500\, iw*3/2):h=-1'
  14793. @end example
  14794. @item
  14795. Make pixels square by combining scale and setsar:
  14796. @example
  14797. scale='trunc(ih*dar):ih',setsar=1/1
  14798. @end example
  14799. @item
  14800. Make pixels square by combining scale and setsar,
  14801. making sure the resulting resolution is even (required by some codecs):
  14802. @example
  14803. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  14804. @end example
  14805. @end itemize
  14806. @subsection Commands
  14807. This filter supports the following commands:
  14808. @table @option
  14809. @item width, w
  14810. @item height, h
  14811. Set the output video dimension expression.
  14812. The command accepts the same syntax of the corresponding option.
  14813. If the specified expression is not valid, it is kept at its current
  14814. value.
  14815. @end table
  14816. @section scale_cuda
  14817. Scale (resize) and convert (pixel format) the input video, using accelerated CUDA kernels.
  14818. Setting the output width and height works in the same way as for the @ref{scale} filter.
  14819. The filter accepts the following options:
  14820. @table @option
  14821. @item w
  14822. @item h
  14823. Set the output video dimension expression. Default value is the input dimension.
  14824. Allows for the same expressions as the @ref{scale} filter.
  14825. @item interp_algo
  14826. Sets the algorithm used for scaling:
  14827. @table @var
  14828. @item nearest
  14829. Nearest neighbour
  14830. Used by default if input parameters match the desired output.
  14831. @item bilinear
  14832. Bilinear
  14833. @item bicubic
  14834. Bicubic
  14835. This is the default.
  14836. @item lanczos
  14837. Lanczos
  14838. @end table
  14839. @item format
  14840. Controls the output pixel format. By default, or if none is specified, the input
  14841. pixel format is used.
  14842. The filter does not support converting between YUV and RGB pixel formats.
  14843. @item passthrough
  14844. If set to 0, every frame is processed, even if no conversion is neccesary.
  14845. This mode can be useful to use the filter as a buffer for a downstream
  14846. frame-consumer that exhausts the limited decoder frame pool.
  14847. If set to 1, frames are passed through as-is if they match the desired output
  14848. parameters. This is the default behaviour.
  14849. @item param
  14850. Algorithm-Specific parameter.
  14851. Affects the curves of the bicubic algorithm.
  14852. @item force_original_aspect_ratio
  14853. @item force_divisible_by
  14854. Work the same as the identical @ref{scale} filter options.
  14855. @end table
  14856. @subsection Examples
  14857. @itemize
  14858. @item
  14859. Scale input to 720p, keeping aspect ratio and ensuring the output is yuv420p.
  14860. @example
  14861. scale_cuda=-2:720:format=yuv420p
  14862. @end example
  14863. @item
  14864. Upscale to 4K using nearest neighbour algorithm.
  14865. @example
  14866. scale_cuda=4096:2160:interp_algo=nearest
  14867. @end example
  14868. @item
  14869. Don't do any conversion or scaling, but copy all input frames into newly allocated ones.
  14870. This can be useful to deal with a filter and encode chain that otherwise exhausts the
  14871. decoders frame pool.
  14872. @example
  14873. scale_cuda=passthrough=0
  14874. @end example
  14875. @end itemize
  14876. @anchor{scale_npp}
  14877. @section scale_npp
  14878. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  14879. format conversion on CUDA video frames. Setting the output width and height
  14880. works in the same way as for the @var{scale} filter.
  14881. The following additional options are accepted:
  14882. @table @option
  14883. @item format
  14884. The pixel format of the output CUDA frames. If set to the string "same" (the
  14885. default), the input format will be kept. Note that automatic format negotiation
  14886. and conversion is not yet supported for hardware frames
  14887. @item interp_algo
  14888. The interpolation algorithm used for resizing. One of the following:
  14889. @table @option
  14890. @item nn
  14891. Nearest neighbour.
  14892. @item linear
  14893. @item cubic
  14894. @item cubic2p_bspline
  14895. 2-parameter cubic (B=1, C=0)
  14896. @item cubic2p_catmullrom
  14897. 2-parameter cubic (B=0, C=1/2)
  14898. @item cubic2p_b05c03
  14899. 2-parameter cubic (B=1/2, C=3/10)
  14900. @item super
  14901. Supersampling
  14902. @item lanczos
  14903. @end table
  14904. @item force_original_aspect_ratio
  14905. Enable decreasing or increasing output video width or height if necessary to
  14906. keep the original aspect ratio. Possible values:
  14907. @table @samp
  14908. @item disable
  14909. Scale the video as specified and disable this feature.
  14910. @item decrease
  14911. The output video dimensions will automatically be decreased if needed.
  14912. @item increase
  14913. The output video dimensions will automatically be increased if needed.
  14914. @end table
  14915. One useful instance of this option is that when you know a specific device's
  14916. maximum allowed resolution, you can use this to limit the output video to
  14917. that, while retaining the aspect ratio. For example, device A allows
  14918. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  14919. decrease) and specifying 1280x720 to the command line makes the output
  14920. 1280x533.
  14921. Please note that this is a different thing than specifying -1 for @option{w}
  14922. or @option{h}, you still need to specify the output resolution for this option
  14923. to work.
  14924. @item force_divisible_by
  14925. Ensures that both the output dimensions, width and height, are divisible by the
  14926. given integer when used together with @option{force_original_aspect_ratio}. This
  14927. works similar to using @code{-n} in the @option{w} and @option{h} options.
  14928. This option respects the value set for @option{force_original_aspect_ratio},
  14929. increasing or decreasing the resolution accordingly. The video's aspect ratio
  14930. may be slightly modified.
  14931. This option can be handy if you need to have a video fit within or exceed
  14932. a defined resolution using @option{force_original_aspect_ratio} but also have
  14933. encoder restrictions on width or height divisibility.
  14934. @item eval
  14935. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  14936. @table @samp
  14937. @item init
  14938. Only evaluate expressions once during the filter initialization or when a command is processed.
  14939. @item frame
  14940. Evaluate expressions for each incoming frame.
  14941. @end table
  14942. @end table
  14943. The values of the @option{w} and @option{h} options are expressions
  14944. containing the following constants:
  14945. @table @var
  14946. @item in_w
  14947. @item in_h
  14948. The input width and height
  14949. @item iw
  14950. @item ih
  14951. These are the same as @var{in_w} and @var{in_h}.
  14952. @item out_w
  14953. @item out_h
  14954. The output (scaled) width and height
  14955. @item ow
  14956. @item oh
  14957. These are the same as @var{out_w} and @var{out_h}
  14958. @item a
  14959. The same as @var{iw} / @var{ih}
  14960. @item sar
  14961. input sample aspect ratio
  14962. @item dar
  14963. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  14964. @item n
  14965. The (sequential) number of the input frame, starting from 0.
  14966. Only available with @code{eval=frame}.
  14967. @item t
  14968. The presentation timestamp of the input frame, expressed as a number of
  14969. seconds. Only available with @code{eval=frame}.
  14970. @item pos
  14971. The position (byte offset) of the frame in the input stream, or NaN if
  14972. this information is unavailable and/or meaningless (for example in case of synthetic video).
  14973. Only available with @code{eval=frame}.
  14974. @end table
  14975. @section scale2ref
  14976. Scale (resize) the input video, based on a reference video.
  14977. See the scale filter for available options, scale2ref supports the same but
  14978. uses the reference video instead of the main input as basis. scale2ref also
  14979. supports the following additional constants for the @option{w} and
  14980. @option{h} options:
  14981. @table @var
  14982. @item main_w
  14983. @item main_h
  14984. The main input video's width and height
  14985. @item main_a
  14986. The same as @var{main_w} / @var{main_h}
  14987. @item main_sar
  14988. The main input video's sample aspect ratio
  14989. @item main_dar, mdar
  14990. The main input video's display aspect ratio. Calculated from
  14991. @code{(main_w / main_h) * main_sar}.
  14992. @item main_hsub
  14993. @item main_vsub
  14994. The main input video's horizontal and vertical chroma subsample values.
  14995. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  14996. is 1.
  14997. @item main_n
  14998. The (sequential) number of the main input frame, starting from 0.
  14999. Only available with @code{eval=frame}.
  15000. @item main_t
  15001. The presentation timestamp of the main input frame, expressed as a number of
  15002. seconds. Only available with @code{eval=frame}.
  15003. @item main_pos
  15004. The position (byte offset) of the frame in the main input stream, or NaN if
  15005. this information is unavailable and/or meaningless (for example in case of synthetic video).
  15006. Only available with @code{eval=frame}.
  15007. @end table
  15008. @subsection Examples
  15009. @itemize
  15010. @item
  15011. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  15012. @example
  15013. 'scale2ref[b][a];[a][b]overlay'
  15014. @end example
  15015. @item
  15016. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  15017. @example
  15018. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  15019. @end example
  15020. @end itemize
  15021. @subsection Commands
  15022. This filter supports the following commands:
  15023. @table @option
  15024. @item width, w
  15025. @item height, h
  15026. Set the output video dimension expression.
  15027. The command accepts the same syntax of the corresponding option.
  15028. If the specified expression is not valid, it is kept at its current
  15029. value.
  15030. @end table
  15031. @section scale2ref_npp
  15032. Use the NVIDIA Performance Primitives (libnpp) to scale (resize) the input
  15033. video, based on a reference video.
  15034. See the @ref{scale_npp} filter for available options, scale2ref_npp supports the same
  15035. but uses the reference video instead of the main input as basis. scale2ref_npp
  15036. also supports the following additional constants for the @option{w} and
  15037. @option{h} options:
  15038. @table @var
  15039. @item main_w
  15040. @item main_h
  15041. The main input video's width and height
  15042. @item main_a
  15043. The same as @var{main_w} / @var{main_h}
  15044. @item main_sar
  15045. The main input video's sample aspect ratio
  15046. @item main_dar, mdar
  15047. The main input video's display aspect ratio. Calculated from
  15048. @code{(main_w / main_h) * main_sar}.
  15049. @item main_n
  15050. The (sequential) number of the main input frame, starting from 0.
  15051. Only available with @code{eval=frame}.
  15052. @item main_t
  15053. The presentation timestamp of the main input frame, expressed as a number of
  15054. seconds. Only available with @code{eval=frame}.
  15055. @item main_pos
  15056. The position (byte offset) of the frame in the main input stream, or NaN if
  15057. this information is unavailable and/or meaningless (for example in case of synthetic video).
  15058. Only available with @code{eval=frame}.
  15059. @end table
  15060. @subsection Examples
  15061. @itemize
  15062. @item
  15063. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  15064. @example
  15065. 'scale2ref_npp[b][a];[a][b]overlay_cuda'
  15066. @end example
  15067. @item
  15068. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  15069. @example
  15070. [logo-in][video-in]scale2ref_npp=w=oh*mdar:h=ih/10[logo-out][video-out]
  15071. @end example
  15072. @end itemize
  15073. @section scharr
  15074. Apply scharr operator to input video stream.
  15075. The filter accepts the following option:
  15076. @table @option
  15077. @item planes
  15078. Set which planes will be processed, unprocessed planes will be copied.
  15079. By default value 0xf, all planes will be processed.
  15080. @item scale
  15081. Set value which will be multiplied with filtered result.
  15082. @item delta
  15083. Set value which will be added to filtered result.
  15084. @end table
  15085. @subsection Commands
  15086. This filter supports the all above options as @ref{commands}.
  15087. @section scroll
  15088. Scroll input video horizontally and/or vertically by constant speed.
  15089. The filter accepts the following options:
  15090. @table @option
  15091. @item horizontal, h
  15092. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  15093. Negative values changes scrolling direction.
  15094. @item vertical, v
  15095. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  15096. Negative values changes scrolling direction.
  15097. @item hpos
  15098. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  15099. @item vpos
  15100. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  15101. @end table
  15102. @subsection Commands
  15103. This filter supports the following @ref{commands}:
  15104. @table @option
  15105. @item horizontal, h
  15106. Set the horizontal scrolling speed.
  15107. @item vertical, v
  15108. Set the vertical scrolling speed.
  15109. @end table
  15110. @anchor{scdet}
  15111. @section scdet
  15112. Detect video scene change.
  15113. This filter sets frame metadata with mafd between frame, the scene score, and
  15114. forward the frame to the next filter, so they can use these metadata to detect
  15115. scene change or others.
  15116. In addition, this filter logs a message and sets frame metadata when it detects
  15117. a scene change by @option{threshold}.
  15118. @code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
  15119. @code{lavfi.scd.score} metadata keys are set with scene change score for every frame
  15120. to detect scene change.
  15121. @code{lavfi.scd.time} metadata keys are set with current filtered frame time which
  15122. detect scene change with @option{threshold}.
  15123. The filter accepts the following options:
  15124. @table @option
  15125. @item threshold, t
  15126. Set the scene change detection threshold as a percentage of maximum change. Good
  15127. values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} is
  15128. @code{[0., 100.]}.
  15129. Default value is @code{10.}.
  15130. @item sc_pass, s
  15131. Set the flag to pass scene change frames to the next filter. Default value is @code{0}
  15132. You can enable it if you want to get snapshot of scene change frames only.
  15133. @end table
  15134. @anchor{selectivecolor}
  15135. @section selectivecolor
  15136. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  15137. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  15138. by the "purity" of the color (that is, how saturated it already is).
  15139. This filter is similar to the Adobe Photoshop Selective Color tool.
  15140. The filter accepts the following options:
  15141. @table @option
  15142. @item correction_method
  15143. Select color correction method.
  15144. Available values are:
  15145. @table @samp
  15146. @item absolute
  15147. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  15148. component value).
  15149. @item relative
  15150. Specified adjustments are relative to the original component value.
  15151. @end table
  15152. Default is @code{absolute}.
  15153. @item reds
  15154. Adjustments for red pixels (pixels where the red component is the maximum)
  15155. @item yellows
  15156. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  15157. @item greens
  15158. Adjustments for green pixels (pixels where the green component is the maximum)
  15159. @item cyans
  15160. Adjustments for cyan pixels (pixels where the red component is the minimum)
  15161. @item blues
  15162. Adjustments for blue pixels (pixels where the blue component is the maximum)
  15163. @item magentas
  15164. Adjustments for magenta pixels (pixels where the green component is the minimum)
  15165. @item whites
  15166. Adjustments for white pixels (pixels where all components are greater than 128)
  15167. @item neutrals
  15168. Adjustments for all pixels except pure black and pure white
  15169. @item blacks
  15170. Adjustments for black pixels (pixels where all components are lesser than 128)
  15171. @item psfile
  15172. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  15173. @end table
  15174. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  15175. 4 space separated floating point adjustment values in the [-1,1] range,
  15176. respectively to adjust the amount of cyan, magenta, yellow and black for the
  15177. pixels of its range.
  15178. @subsection Examples
  15179. @itemize
  15180. @item
  15181. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  15182. increase magenta by 27% in blue areas:
  15183. @example
  15184. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  15185. @end example
  15186. @item
  15187. Use a Photoshop selective color preset:
  15188. @example
  15189. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  15190. @end example
  15191. @end itemize
  15192. @anchor{separatefields}
  15193. @section separatefields
  15194. The @code{separatefields} takes a frame-based video input and splits
  15195. each frame into its components fields, producing a new half height clip
  15196. with twice the frame rate and twice the frame count.
  15197. This filter use field-dominance information in frame to decide which
  15198. of each pair of fields to place first in the output.
  15199. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  15200. @section setdar, setsar
  15201. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  15202. output video.
  15203. This is done by changing the specified Sample (aka Pixel) Aspect
  15204. Ratio, according to the following equation:
  15205. @example
  15206. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  15207. @end example
  15208. Keep in mind that the @code{setdar} filter does not modify the pixel
  15209. dimensions of the video frame. Also, the display aspect ratio set by
  15210. this filter may be changed by later filters in the filterchain,
  15211. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  15212. applied.
  15213. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  15214. the filter output video.
  15215. Note that as a consequence of the application of this filter, the
  15216. output display aspect ratio will change according to the equation
  15217. above.
  15218. Keep in mind that the sample aspect ratio set by the @code{setsar}
  15219. filter may be changed by later filters in the filterchain, e.g. if
  15220. another "setsar" or a "setdar" filter is applied.
  15221. It accepts the following parameters:
  15222. @table @option
  15223. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  15224. Set the aspect ratio used by the filter.
  15225. The parameter can be a floating point number string, an expression, or
  15226. a string of the form @var{num}:@var{den}, where @var{num} and
  15227. @var{den} are the numerator and denominator of the aspect ratio. If
  15228. the parameter is not specified, it is assumed the value "0".
  15229. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  15230. should be escaped.
  15231. @item max
  15232. Set the maximum integer value to use for expressing numerator and
  15233. denominator when reducing the expressed aspect ratio to a rational.
  15234. Default value is @code{100}.
  15235. @end table
  15236. The parameter @var{sar} is an expression containing
  15237. the following constants:
  15238. @table @option
  15239. @item E, PI, PHI
  15240. These are approximated values for the mathematical constants e
  15241. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  15242. @item w, h
  15243. The input width and height.
  15244. @item a
  15245. These are the same as @var{w} / @var{h}.
  15246. @item sar
  15247. The input sample aspect ratio.
  15248. @item dar
  15249. The input display aspect ratio. It is the same as
  15250. (@var{w} / @var{h}) * @var{sar}.
  15251. @item hsub, vsub
  15252. Horizontal and vertical chroma subsample values. For example, for the
  15253. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15254. @end table
  15255. @subsection Examples
  15256. @itemize
  15257. @item
  15258. To change the display aspect ratio to 16:9, specify one of the following:
  15259. @example
  15260. setdar=dar=1.77777
  15261. setdar=dar=16/9
  15262. @end example
  15263. @item
  15264. To change the sample aspect ratio to 10:11, specify:
  15265. @example
  15266. setsar=sar=10/11
  15267. @end example
  15268. @item
  15269. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  15270. 1000 in the aspect ratio reduction, use the command:
  15271. @example
  15272. setdar=ratio=16/9:max=1000
  15273. @end example
  15274. @end itemize
  15275. @anchor{setfield}
  15276. @section setfield
  15277. Force field for the output video frame.
  15278. The @code{setfield} filter marks the interlace type field for the
  15279. output frames. It does not change the input frame, but only sets the
  15280. corresponding property, which affects how the frame is treated by
  15281. following filters (e.g. @code{fieldorder} or @code{yadif}).
  15282. The filter accepts the following options:
  15283. @table @option
  15284. @item mode
  15285. Available values are:
  15286. @table @samp
  15287. @item auto
  15288. Keep the same field property.
  15289. @item bff
  15290. Mark the frame as bottom-field-first.
  15291. @item tff
  15292. Mark the frame as top-field-first.
  15293. @item prog
  15294. Mark the frame as progressive.
  15295. @end table
  15296. @end table
  15297. @anchor{setparams}
  15298. @section setparams
  15299. Force frame parameter for the output video frame.
  15300. The @code{setparams} filter marks interlace and color range for the
  15301. output frames. It does not change the input frame, but only sets the
  15302. corresponding property, which affects how the frame is treated by
  15303. filters/encoders.
  15304. @table @option
  15305. @item field_mode
  15306. Available values are:
  15307. @table @samp
  15308. @item auto
  15309. Keep the same field property (default).
  15310. @item bff
  15311. Mark the frame as bottom-field-first.
  15312. @item tff
  15313. Mark the frame as top-field-first.
  15314. @item prog
  15315. Mark the frame as progressive.
  15316. @end table
  15317. @item range
  15318. Available values are:
  15319. @table @samp
  15320. @item auto
  15321. Keep the same color range property (default).
  15322. @item unspecified, unknown
  15323. Mark the frame as unspecified color range.
  15324. @item limited, tv, mpeg
  15325. Mark the frame as limited range.
  15326. @item full, pc, jpeg
  15327. Mark the frame as full range.
  15328. @end table
  15329. @item color_primaries
  15330. Set the color primaries.
  15331. Available values are:
  15332. @table @samp
  15333. @item auto
  15334. Keep the same color primaries property (default).
  15335. @item bt709
  15336. @item unknown
  15337. @item bt470m
  15338. @item bt470bg
  15339. @item smpte170m
  15340. @item smpte240m
  15341. @item film
  15342. @item bt2020
  15343. @item smpte428
  15344. @item smpte431
  15345. @item smpte432
  15346. @item jedec-p22
  15347. @end table
  15348. @item color_trc
  15349. Set the color transfer.
  15350. Available values are:
  15351. @table @samp
  15352. @item auto
  15353. Keep the same color trc property (default).
  15354. @item bt709
  15355. @item unknown
  15356. @item bt470m
  15357. @item bt470bg
  15358. @item smpte170m
  15359. @item smpte240m
  15360. @item linear
  15361. @item log100
  15362. @item log316
  15363. @item iec61966-2-4
  15364. @item bt1361e
  15365. @item iec61966-2-1
  15366. @item bt2020-10
  15367. @item bt2020-12
  15368. @item smpte2084
  15369. @item smpte428
  15370. @item arib-std-b67
  15371. @end table
  15372. @item colorspace
  15373. Set the colorspace.
  15374. Available values are:
  15375. @table @samp
  15376. @item auto
  15377. Keep the same colorspace property (default).
  15378. @item gbr
  15379. @item bt709
  15380. @item unknown
  15381. @item fcc
  15382. @item bt470bg
  15383. @item smpte170m
  15384. @item smpte240m
  15385. @item ycgco
  15386. @item bt2020nc
  15387. @item bt2020c
  15388. @item smpte2085
  15389. @item chroma-derived-nc
  15390. @item chroma-derived-c
  15391. @item ictcp
  15392. @end table
  15393. @end table
  15394. @section sharpen_npp
  15395. Use the NVIDIA Performance Primitives (libnpp) to perform image sharpening with
  15396. border control.
  15397. The following additional options are accepted:
  15398. @table @option
  15399. @item border_type
  15400. Type of sampling to be used ad frame borders. One of the following:
  15401. @table @option
  15402. @item replicate
  15403. Replicate pixel values.
  15404. @end table
  15405. @end table
  15406. @section shear
  15407. Apply shear transform to input video.
  15408. This filter supports the following options:
  15409. @table @option
  15410. @item shx
  15411. Shear factor in X-direction. Default value is 0.
  15412. Allowed range is from -2 to 2.
  15413. @item shy
  15414. Shear factor in Y-direction. Default value is 0.
  15415. Allowed range is from -2 to 2.
  15416. @item fillcolor, c
  15417. Set the color used to fill the output area not covered by the transformed
  15418. video. For the general syntax of this option, check the
  15419. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15420. If the special value "none" is selected then no
  15421. background is printed (useful for example if the background is never shown).
  15422. Default value is "black".
  15423. @item interp
  15424. Set interpolation type. Can be @code{bilinear} or @code{nearest}. Default is @code{bilinear}.
  15425. @end table
  15426. @subsection Commands
  15427. This filter supports the all above options as @ref{commands}.
  15428. @section showinfo
  15429. Show a line containing various information for each input video frame.
  15430. The input video is not modified.
  15431. This filter supports the following options:
  15432. @table @option
  15433. @item checksum
  15434. Calculate checksums of each plane. By default enabled.
  15435. @end table
  15436. The shown line contains a sequence of key/value pairs of the form
  15437. @var{key}:@var{value}.
  15438. The following values are shown in the output:
  15439. @table @option
  15440. @item n
  15441. The (sequential) number of the input frame, starting from 0.
  15442. @item pts
  15443. The Presentation TimeStamp of the input frame, expressed as a number of
  15444. time base units. The time base unit depends on the filter input pad.
  15445. @item pts_time
  15446. The Presentation TimeStamp of the input frame, expressed as a number of
  15447. seconds.
  15448. @item pos
  15449. The position of the frame in the input stream, or -1 if this information is
  15450. unavailable and/or meaningless (for example in case of synthetic video).
  15451. @item fmt
  15452. The pixel format name.
  15453. @item sar
  15454. The sample aspect ratio of the input frame, expressed in the form
  15455. @var{num}/@var{den}.
  15456. @item s
  15457. The size of the input frame. For the syntax of this option, check the
  15458. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15459. @item i
  15460. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  15461. for bottom field first).
  15462. @item iskey
  15463. This is 1 if the frame is a key frame, 0 otherwise.
  15464. @item type
  15465. The picture type of the input frame ("I" for an I-frame, "P" for a
  15466. P-frame, "B" for a B-frame, or "?" for an unknown type).
  15467. Also refer to the documentation of the @code{AVPictureType} enum and of
  15468. the @code{av_get_picture_type_char} function defined in
  15469. @file{libavutil/avutil.h}.
  15470. @item checksum
  15471. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  15472. @item plane_checksum
  15473. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  15474. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  15475. @item mean
  15476. The mean value of pixels in each plane of the input frame, expressed in the form
  15477. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  15478. @item stdev
  15479. The standard deviation of pixel values in each plane of the input frame, expressed
  15480. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  15481. @end table
  15482. @section showpalette
  15483. Displays the 256 colors palette of each frame. This filter is only relevant for
  15484. @var{pal8} pixel format frames.
  15485. It accepts the following option:
  15486. @table @option
  15487. @item s
  15488. Set the size of the box used to represent one palette color entry. Default is
  15489. @code{30} (for a @code{30x30} pixel box).
  15490. @end table
  15491. @section shuffleframes
  15492. Reorder and/or duplicate and/or drop video frames.
  15493. It accepts the following parameters:
  15494. @table @option
  15495. @item mapping
  15496. Set the destination indexes of input frames.
  15497. This is space or '|' separated list of indexes that maps input frames to output
  15498. frames. Number of indexes also sets maximal value that each index may have.
  15499. '-1' index have special meaning and that is to drop frame.
  15500. @end table
  15501. The first frame has the index 0. The default is to keep the input unchanged.
  15502. @subsection Examples
  15503. @itemize
  15504. @item
  15505. Swap second and third frame of every three frames of the input:
  15506. @example
  15507. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  15508. @end example
  15509. @item
  15510. Swap 10th and 1st frame of every ten frames of the input:
  15511. @example
  15512. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  15513. @end example
  15514. @end itemize
  15515. @section shufflepixels
  15516. Reorder pixels in video frames.
  15517. This filter accepts the following options:
  15518. @table @option
  15519. @item direction, d
  15520. Set shuffle direction. Can be forward or inverse direction.
  15521. Default direction is forward.
  15522. @item mode, m
  15523. Set shuffle mode. Can be horizontal, vertical or block mode.
  15524. @item width, w
  15525. @item height, h
  15526. Set shuffle block_size. In case of horizontal shuffle mode only width
  15527. part of size is used, and in case of vertical shuffle mode only height
  15528. part of size is used.
  15529. @item seed, s
  15530. Set random seed used with shuffling pixels. Mainly useful to set to be able
  15531. to reverse filtering process to get original input.
  15532. For example, to reverse forward shuffle you need to use same parameters
  15533. and exact same seed and to set direction to inverse.
  15534. @end table
  15535. @section shuffleplanes
  15536. Reorder and/or duplicate video planes.
  15537. It accepts the following parameters:
  15538. @table @option
  15539. @item map0
  15540. The index of the input plane to be used as the first output plane.
  15541. @item map1
  15542. The index of the input plane to be used as the second output plane.
  15543. @item map2
  15544. The index of the input plane to be used as the third output plane.
  15545. @item map3
  15546. The index of the input plane to be used as the fourth output plane.
  15547. @end table
  15548. The first plane has the index 0. The default is to keep the input unchanged.
  15549. @subsection Examples
  15550. @itemize
  15551. @item
  15552. Swap the second and third planes of the input:
  15553. @example
  15554. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  15555. @end example
  15556. @end itemize
  15557. @anchor{signalstats}
  15558. @section signalstats
  15559. Evaluate various visual metrics that assist in determining issues associated
  15560. with the digitization of analog video media.
  15561. By default the filter will log these metadata values:
  15562. @table @option
  15563. @item YMIN
  15564. Display the minimal Y value contained within the input frame. Expressed in
  15565. range of [0-255].
  15566. @item YLOW
  15567. Display the Y value at the 10% percentile within the input frame. Expressed in
  15568. range of [0-255].
  15569. @item YAVG
  15570. Display the average Y value within the input frame. Expressed in range of
  15571. [0-255].
  15572. @item YHIGH
  15573. Display the Y value at the 90% percentile within the input frame. Expressed in
  15574. range of [0-255].
  15575. @item YMAX
  15576. Display the maximum Y value contained within the input frame. Expressed in
  15577. range of [0-255].
  15578. @item UMIN
  15579. Display the minimal U value contained within the input frame. Expressed in
  15580. range of [0-255].
  15581. @item ULOW
  15582. Display the U value at the 10% percentile within the input frame. Expressed in
  15583. range of [0-255].
  15584. @item UAVG
  15585. Display the average U value within the input frame. Expressed in range of
  15586. [0-255].
  15587. @item UHIGH
  15588. Display the U value at the 90% percentile within the input frame. Expressed in
  15589. range of [0-255].
  15590. @item UMAX
  15591. Display the maximum U value contained within the input frame. Expressed in
  15592. range of [0-255].
  15593. @item VMIN
  15594. Display the minimal V value contained within the input frame. Expressed in
  15595. range of [0-255].
  15596. @item VLOW
  15597. Display the V value at the 10% percentile within the input frame. Expressed in
  15598. range of [0-255].
  15599. @item VAVG
  15600. Display the average V value within the input frame. Expressed in range of
  15601. [0-255].
  15602. @item VHIGH
  15603. Display the V value at the 90% percentile within the input frame. Expressed in
  15604. range of [0-255].
  15605. @item VMAX
  15606. Display the maximum V value contained within the input frame. Expressed in
  15607. range of [0-255].
  15608. @item SATMIN
  15609. Display the minimal saturation value contained within the input frame.
  15610. Expressed in range of [0-~181.02].
  15611. @item SATLOW
  15612. Display the saturation value at the 10% percentile within the input frame.
  15613. Expressed in range of [0-~181.02].
  15614. @item SATAVG
  15615. Display the average saturation value within the input frame. Expressed in range
  15616. of [0-~181.02].
  15617. @item SATHIGH
  15618. Display the saturation value at the 90% percentile within the input frame.
  15619. Expressed in range of [0-~181.02].
  15620. @item SATMAX
  15621. Display the maximum saturation value contained within the input frame.
  15622. Expressed in range of [0-~181.02].
  15623. @item HUEMED
  15624. Display the median value for hue within the input frame. Expressed in range of
  15625. [0-360].
  15626. @item HUEAVG
  15627. Display the average value for hue within the input frame. Expressed in range of
  15628. [0-360].
  15629. @item YDIF
  15630. Display the average of sample value difference between all values of the Y
  15631. plane in the current frame and corresponding values of the previous input frame.
  15632. Expressed in range of [0-255].
  15633. @item UDIF
  15634. Display the average of sample value difference between all values of the U
  15635. plane in the current frame and corresponding values of the previous input frame.
  15636. Expressed in range of [0-255].
  15637. @item VDIF
  15638. Display the average of sample value difference between all values of the V
  15639. plane in the current frame and corresponding values of the previous input frame.
  15640. Expressed in range of [0-255].
  15641. @item YBITDEPTH
  15642. Display bit depth of Y plane in current frame.
  15643. Expressed in range of [0-16].
  15644. @item UBITDEPTH
  15645. Display bit depth of U plane in current frame.
  15646. Expressed in range of [0-16].
  15647. @item VBITDEPTH
  15648. Display bit depth of V plane in current frame.
  15649. Expressed in range of [0-16].
  15650. @end table
  15651. The filter accepts the following options:
  15652. @table @option
  15653. @item stat
  15654. @item out
  15655. @option{stat} specify an additional form of image analysis.
  15656. @option{out} output video with the specified type of pixel highlighted.
  15657. Both options accept the following values:
  15658. @table @samp
  15659. @item tout
  15660. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  15661. unlike the neighboring pixels of the same field. Examples of temporal outliers
  15662. include the results of video dropouts, head clogs, or tape tracking issues.
  15663. @item vrep
  15664. Identify @var{vertical line repetition}. Vertical line repetition includes
  15665. similar rows of pixels within a frame. In born-digital video vertical line
  15666. repetition is common, but this pattern is uncommon in video digitized from an
  15667. analog source. When it occurs in video that results from the digitization of an
  15668. analog source it can indicate concealment from a dropout compensator.
  15669. @item brng
  15670. Identify pixels that fall outside of legal broadcast range.
  15671. @end table
  15672. @item color, c
  15673. Set the highlight color for the @option{out} option. The default color is
  15674. yellow.
  15675. @end table
  15676. @subsection Examples
  15677. @itemize
  15678. @item
  15679. Output data of various video metrics:
  15680. @example
  15681. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  15682. @end example
  15683. @item
  15684. Output specific data about the minimum and maximum values of the Y plane per frame:
  15685. @example
  15686. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  15687. @end example
  15688. @item
  15689. Playback video while highlighting pixels that are outside of broadcast range in red.
  15690. @example
  15691. ffplay example.mov -vf signalstats="out=brng:color=red"
  15692. @end example
  15693. @item
  15694. Playback video with signalstats metadata drawn over the frame.
  15695. @example
  15696. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  15697. @end example
  15698. The contents of signalstat_drawtext.txt used in the command are:
  15699. @example
  15700. time %@{pts:hms@}
  15701. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  15702. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  15703. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  15704. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  15705. @end example
  15706. @end itemize
  15707. @anchor{signature}
  15708. @section signature
  15709. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  15710. input. In this case the matching between the inputs can be calculated additionally.
  15711. The filter always passes through the first input. The signature of each stream can
  15712. be written into a file.
  15713. It accepts the following options:
  15714. @table @option
  15715. @item detectmode
  15716. Enable or disable the matching process.
  15717. Available values are:
  15718. @table @samp
  15719. @item off
  15720. Disable the calculation of a matching (default).
  15721. @item full
  15722. Calculate the matching for the whole video and output whether the whole video
  15723. matches or only parts.
  15724. @item fast
  15725. Calculate only until a matching is found or the video ends. Should be faster in
  15726. some cases.
  15727. @end table
  15728. @item nb_inputs
  15729. Set the number of inputs. The option value must be a non negative integer.
  15730. Default value is 1.
  15731. @item filename
  15732. Set the path to which the output is written. If there is more than one input,
  15733. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  15734. integer), that will be replaced with the input number. If no filename is
  15735. specified, no output will be written. This is the default.
  15736. @item format
  15737. Choose the output format.
  15738. Available values are:
  15739. @table @samp
  15740. @item binary
  15741. Use the specified binary representation (default).
  15742. @item xml
  15743. Use the specified xml representation.
  15744. @end table
  15745. @item th_d
  15746. Set threshold to detect one word as similar. The option value must be an integer
  15747. greater than zero. The default value is 9000.
  15748. @item th_dc
  15749. Set threshold to detect all words as similar. The option value must be an integer
  15750. greater than zero. The default value is 60000.
  15751. @item th_xh
  15752. Set threshold to detect frames as similar. The option value must be an integer
  15753. greater than zero. The default value is 116.
  15754. @item th_di
  15755. Set the minimum length of a sequence in frames to recognize it as matching
  15756. sequence. The option value must be a non negative integer value.
  15757. The default value is 0.
  15758. @item th_it
  15759. Set the minimum relation, that matching frames to all frames must have.
  15760. The option value must be a double value between 0 and 1. The default value is 0.5.
  15761. @end table
  15762. @subsection Examples
  15763. @itemize
  15764. @item
  15765. To calculate the signature of an input video and store it in signature.bin:
  15766. @example
  15767. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  15768. @end example
  15769. @item
  15770. To detect whether two videos match and store the signatures in XML format in
  15771. signature0.xml and signature1.xml:
  15772. @example
  15773. 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 -
  15774. @end example
  15775. @end itemize
  15776. @anchor{siti}
  15777. @section siti
  15778. Calculate Spatial Info (SI) and Temporal Info (TI) scores for a video, as defined
  15779. in ITU-T P.910: Subjective video quality assessment methods for multimedia
  15780. applications. Available PDF at @url{https://www.itu.int/rec/T-REC-P.910-199909-S/en }.
  15781. It accepts the following option:
  15782. @table @option
  15783. @item print_summary
  15784. If set to 1, Summary statistics will be printed to the console. Default 0.
  15785. @end table
  15786. @subsection Examples
  15787. @itemize
  15788. @item
  15789. To calculate SI/TI metrics and print summary:
  15790. @example
  15791. ffmpeg -i input.mp4 -vf siti=print_summary=1 -f null -
  15792. @end example
  15793. @end itemize
  15794. @anchor{smartblur}
  15795. @section smartblur
  15796. Blur the input video without impacting the outlines.
  15797. It accepts the following options:
  15798. @table @option
  15799. @item luma_radius, lr
  15800. Set the luma radius. The option value must be a float number in
  15801. the range [0.1,5.0] that specifies the variance of the gaussian filter
  15802. used to blur the image (slower if larger). Default value is 1.0.
  15803. @item luma_strength, ls
  15804. Set the luma strength. The option value must be a float number
  15805. in the range [-1.0,1.0] that configures the blurring. A value included
  15806. in [0.0,1.0] will blur the image whereas a value included in
  15807. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  15808. @item luma_threshold, lt
  15809. Set the luma threshold used as a coefficient to determine
  15810. whether a pixel should be blurred or not. The option value must be an
  15811. integer in the range [-30,30]. A value of 0 will filter all the image,
  15812. a value included in [0,30] will filter flat areas and a value included
  15813. in [-30,0] will filter edges. Default value is 0.
  15814. @item chroma_radius, cr
  15815. Set the chroma radius. The option value must be a float number in
  15816. the range [0.1,5.0] that specifies the variance of the gaussian filter
  15817. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  15818. @item chroma_strength, cs
  15819. Set the chroma strength. The option value must be a float number
  15820. in the range [-1.0,1.0] that configures the blurring. A value included
  15821. in [0.0,1.0] will blur the image whereas a value included in
  15822. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  15823. @item chroma_threshold, ct
  15824. Set the chroma threshold used as a coefficient to determine
  15825. whether a pixel should be blurred or not. The option value must be an
  15826. integer in the range [-30,30]. A value of 0 will filter all the image,
  15827. a value included in [0,30] will filter flat areas and a value included
  15828. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  15829. @end table
  15830. If a chroma option is not explicitly set, the corresponding luma value
  15831. is set.
  15832. @section sobel
  15833. Apply sobel operator to input video stream.
  15834. The filter accepts the following option:
  15835. @table @option
  15836. @item planes
  15837. Set which planes will be processed, unprocessed planes will be copied.
  15838. By default value 0xf, all planes will be processed.
  15839. @item scale
  15840. Set value which will be multiplied with filtered result.
  15841. @item delta
  15842. Set value which will be added to filtered result.
  15843. @end table
  15844. @subsection Commands
  15845. This filter supports the all above options as @ref{commands}.
  15846. @anchor{spp}
  15847. @section spp
  15848. Apply a simple postprocessing filter that compresses and decompresses the image
  15849. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  15850. and average the results.
  15851. The filter accepts the following options:
  15852. @table @option
  15853. @item quality
  15854. Set quality. This option defines the number of levels for averaging. It accepts
  15855. an integer in the range 0-6. If set to @code{0}, the filter will have no
  15856. effect. A value of @code{6} means the higher quality. For each increment of
  15857. that value the speed drops by a factor of approximately 2. Default value is
  15858. @code{3}.
  15859. @item qp
  15860. Force a constant quantization parameter. If not set, the filter will use the QP
  15861. from the video stream (if available).
  15862. @item mode
  15863. Set thresholding mode. Available modes are:
  15864. @table @samp
  15865. @item hard
  15866. Set hard thresholding (default).
  15867. @item soft
  15868. Set soft thresholding (better de-ringing effect, but likely blurrier).
  15869. @end table
  15870. @item use_bframe_qp
  15871. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  15872. option may cause flicker since the B-Frames have often larger QP. Default is
  15873. @code{0} (not enabled).
  15874. @end table
  15875. @subsection Commands
  15876. This filter supports the following commands:
  15877. @table @option
  15878. @item quality, level
  15879. Set quality level. The value @code{max} can be used to set the maximum level,
  15880. currently @code{6}.
  15881. @end table
  15882. @anchor{sr}
  15883. @section sr
  15884. Scale the input by applying one of the super-resolution methods based on
  15885. convolutional neural networks. Supported models:
  15886. @itemize
  15887. @item
  15888. Super-Resolution Convolutional Neural Network model (SRCNN).
  15889. See @url{https://arxiv.org/abs/1501.00092}.
  15890. @item
  15891. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  15892. See @url{https://arxiv.org/abs/1609.05158}.
  15893. @end itemize
  15894. Training scripts as well as scripts for model file (.pb) saving can be found at
  15895. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  15896. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  15897. Native model files (.model) can be generated from TensorFlow model
  15898. files (.pb) by using tools/python/convert.py
  15899. The filter accepts the following options:
  15900. @table @option
  15901. @item dnn_backend
  15902. Specify which DNN backend to use for model loading and execution. This option accepts
  15903. the following values:
  15904. @table @samp
  15905. @item native
  15906. Native implementation of DNN loading and execution.
  15907. @item tensorflow
  15908. TensorFlow backend. To enable this backend you
  15909. need to install the TensorFlow for C library (see
  15910. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  15911. @code{--enable-libtensorflow}
  15912. @end table
  15913. Default value is @samp{native}.
  15914. @item model
  15915. Set path to model file specifying network architecture and its parameters.
  15916. Note that different backends use different file formats. TensorFlow backend
  15917. can load files for both formats, while native backend can load files for only
  15918. its format.
  15919. @item scale_factor
  15920. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  15921. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  15922. input upscaled using bicubic upscaling with proper scale factor.
  15923. @end table
  15924. To get full functionality (such as async execution), please use the @ref{dnn_processing} filter.
  15925. @section ssim
  15926. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  15927. This filter takes in input two input videos, the first input is
  15928. considered the "main" source and is passed unchanged to the
  15929. output. The second input is used as a "reference" video for computing
  15930. the SSIM.
  15931. Both video inputs must have the same resolution and pixel format for
  15932. this filter to work correctly. Also it assumes that both inputs
  15933. have the same number of frames, which are compared one by one.
  15934. The filter stores the calculated SSIM of each frame.
  15935. The description of the accepted parameters follows.
  15936. @table @option
  15937. @item stats_file, f
  15938. If specified the filter will use the named file to save the SSIM of
  15939. each individual frame. When filename equals "-" the data is sent to
  15940. standard output.
  15941. @end table
  15942. The file printed if @var{stats_file} is selected, contains a sequence of
  15943. key/value pairs of the form @var{key}:@var{value} for each compared
  15944. couple of frames.
  15945. A description of each shown parameter follows:
  15946. @table @option
  15947. @item n
  15948. sequential number of the input frame, starting from 1
  15949. @item Y, U, V, R, G, B
  15950. SSIM of the compared frames for the component specified by the suffix.
  15951. @item All
  15952. SSIM of the compared frames for the whole frame.
  15953. @item dB
  15954. Same as above but in dB representation.
  15955. @end table
  15956. This filter also supports the @ref{framesync} options.
  15957. @subsection Examples
  15958. @itemize
  15959. @item
  15960. For example:
  15961. @example
  15962. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  15963. [main][ref] ssim="stats_file=stats.log" [out]
  15964. @end example
  15965. On this example the input file being processed is compared with the
  15966. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  15967. is stored in @file{stats.log}.
  15968. @item
  15969. Another example with both psnr and ssim at same time:
  15970. @example
  15971. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  15972. @end example
  15973. @item
  15974. Another example with different containers:
  15975. @example
  15976. 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 -
  15977. @end example
  15978. @end itemize
  15979. @section stereo3d
  15980. Convert between different stereoscopic image formats.
  15981. The filters accept the following options:
  15982. @table @option
  15983. @item in
  15984. Set stereoscopic image format of input.
  15985. Available values for input image formats are:
  15986. @table @samp
  15987. @item sbsl
  15988. side by side parallel (left eye left, right eye right)
  15989. @item sbsr
  15990. side by side crosseye (right eye left, left eye right)
  15991. @item sbs2l
  15992. side by side parallel with half width resolution
  15993. (left eye left, right eye right)
  15994. @item sbs2r
  15995. side by side crosseye with half width resolution
  15996. (right eye left, left eye right)
  15997. @item abl
  15998. @item tbl
  15999. above-below (left eye above, right eye below)
  16000. @item abr
  16001. @item tbr
  16002. above-below (right eye above, left eye below)
  16003. @item ab2l
  16004. @item tb2l
  16005. above-below with half height resolution
  16006. (left eye above, right eye below)
  16007. @item ab2r
  16008. @item tb2r
  16009. above-below with half height resolution
  16010. (right eye above, left eye below)
  16011. @item al
  16012. alternating frames (left eye first, right eye second)
  16013. @item ar
  16014. alternating frames (right eye first, left eye second)
  16015. @item irl
  16016. interleaved rows (left eye has top row, right eye starts on next row)
  16017. @item irr
  16018. interleaved rows (right eye has top row, left eye starts on next row)
  16019. @item icl
  16020. interleaved columns, left eye first
  16021. @item icr
  16022. interleaved columns, right eye first
  16023. Default value is @samp{sbsl}.
  16024. @end table
  16025. @item out
  16026. Set stereoscopic image format of output.
  16027. @table @samp
  16028. @item sbsl
  16029. side by side parallel (left eye left, right eye right)
  16030. @item sbsr
  16031. side by side crosseye (right eye left, left eye right)
  16032. @item sbs2l
  16033. side by side parallel with half width resolution
  16034. (left eye left, right eye right)
  16035. @item sbs2r
  16036. side by side crosseye with half width resolution
  16037. (right eye left, left eye right)
  16038. @item abl
  16039. @item tbl
  16040. above-below (left eye above, right eye below)
  16041. @item abr
  16042. @item tbr
  16043. above-below (right eye above, left eye below)
  16044. @item ab2l
  16045. @item tb2l
  16046. above-below with half height resolution
  16047. (left eye above, right eye below)
  16048. @item ab2r
  16049. @item tb2r
  16050. above-below with half height resolution
  16051. (right eye above, left eye below)
  16052. @item al
  16053. alternating frames (left eye first, right eye second)
  16054. @item ar
  16055. alternating frames (right eye first, left eye second)
  16056. @item irl
  16057. interleaved rows (left eye has top row, right eye starts on next row)
  16058. @item irr
  16059. interleaved rows (right eye has top row, left eye starts on next row)
  16060. @item arbg
  16061. anaglyph red/blue gray
  16062. (red filter on left eye, blue filter on right eye)
  16063. @item argg
  16064. anaglyph red/green gray
  16065. (red filter on left eye, green filter on right eye)
  16066. @item arcg
  16067. anaglyph red/cyan gray
  16068. (red filter on left eye, cyan filter on right eye)
  16069. @item arch
  16070. anaglyph red/cyan half colored
  16071. (red filter on left eye, cyan filter on right eye)
  16072. @item arcc
  16073. anaglyph red/cyan color
  16074. (red filter on left eye, cyan filter on right eye)
  16075. @item arcd
  16076. anaglyph red/cyan color optimized with the least squares projection of dubois
  16077. (red filter on left eye, cyan filter on right eye)
  16078. @item agmg
  16079. anaglyph green/magenta gray
  16080. (green filter on left eye, magenta filter on right eye)
  16081. @item agmh
  16082. anaglyph green/magenta half colored
  16083. (green filter on left eye, magenta filter on right eye)
  16084. @item agmc
  16085. anaglyph green/magenta colored
  16086. (green filter on left eye, magenta filter on right eye)
  16087. @item agmd
  16088. anaglyph green/magenta color optimized with the least squares projection of dubois
  16089. (green filter on left eye, magenta filter on right eye)
  16090. @item aybg
  16091. anaglyph yellow/blue gray
  16092. (yellow filter on left eye, blue filter on right eye)
  16093. @item aybh
  16094. anaglyph yellow/blue half colored
  16095. (yellow filter on left eye, blue filter on right eye)
  16096. @item aybc
  16097. anaglyph yellow/blue colored
  16098. (yellow filter on left eye, blue filter on right eye)
  16099. @item aybd
  16100. anaglyph yellow/blue color optimized with the least squares projection of dubois
  16101. (yellow filter on left eye, blue filter on right eye)
  16102. @item ml
  16103. mono output (left eye only)
  16104. @item mr
  16105. mono output (right eye only)
  16106. @item chl
  16107. checkerboard, left eye first
  16108. @item chr
  16109. checkerboard, right eye first
  16110. @item icl
  16111. interleaved columns, left eye first
  16112. @item icr
  16113. interleaved columns, right eye first
  16114. @item hdmi
  16115. HDMI frame pack
  16116. @end table
  16117. Default value is @samp{arcd}.
  16118. @end table
  16119. @subsection Examples
  16120. @itemize
  16121. @item
  16122. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  16123. @example
  16124. stereo3d=sbsl:aybd
  16125. @end example
  16126. @item
  16127. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  16128. @example
  16129. stereo3d=abl:sbsr
  16130. @end example
  16131. @end itemize
  16132. @section streamselect, astreamselect
  16133. Select video or audio streams.
  16134. The filter accepts the following options:
  16135. @table @option
  16136. @item inputs
  16137. Set number of inputs. Default is 2.
  16138. @item map
  16139. Set input indexes to remap to outputs.
  16140. @end table
  16141. @subsection Commands
  16142. The @code{streamselect} and @code{astreamselect} filter supports the following
  16143. commands:
  16144. @table @option
  16145. @item map
  16146. Set input indexes to remap to outputs.
  16147. @end table
  16148. @subsection Examples
  16149. @itemize
  16150. @item
  16151. Select first 5 seconds 1st stream and rest of time 2nd stream:
  16152. @example
  16153. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  16154. @end example
  16155. @item
  16156. Same as above, but for audio:
  16157. @example
  16158. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  16159. @end example
  16160. @end itemize
  16161. @anchor{subtitles}
  16162. @section subtitles
  16163. Draw subtitles on top of input video using the libass library.
  16164. To enable compilation of this filter you need to configure FFmpeg with
  16165. @code{--enable-libass}. This filter also requires a build with libavcodec and
  16166. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  16167. Alpha) subtitles format.
  16168. The filter accepts the following options:
  16169. @table @option
  16170. @item filename, f
  16171. Set the filename of the subtitle file to read. It must be specified.
  16172. @item original_size
  16173. Specify the size of the original video, the video for which the ASS file
  16174. was composed. For the syntax of this option, check the
  16175. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16176. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  16177. correctly scale the fonts if the aspect ratio has been changed.
  16178. @item fontsdir
  16179. Set a directory path containing fonts that can be used by the filter.
  16180. These fonts will be used in addition to whatever the font provider uses.
  16181. @item alpha
  16182. Process alpha channel, by default alpha channel is untouched.
  16183. @item charenc
  16184. Set subtitles input character encoding. @code{subtitles} filter only. Only
  16185. useful if not UTF-8.
  16186. @item stream_index, si
  16187. Set subtitles stream index. @code{subtitles} filter only.
  16188. @item force_style
  16189. Override default style or script info parameters of the subtitles. It accepts a
  16190. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  16191. @end table
  16192. If the first key is not specified, it is assumed that the first value
  16193. specifies the @option{filename}.
  16194. For example, to render the file @file{sub.srt} on top of the input
  16195. video, use the command:
  16196. @example
  16197. subtitles=sub.srt
  16198. @end example
  16199. which is equivalent to:
  16200. @example
  16201. subtitles=filename=sub.srt
  16202. @end example
  16203. To render the default subtitles stream from file @file{video.mkv}, use:
  16204. @example
  16205. subtitles=video.mkv
  16206. @end example
  16207. To render the second subtitles stream from that file, use:
  16208. @example
  16209. subtitles=video.mkv:si=1
  16210. @end example
  16211. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  16212. @code{DejaVu Serif}, use:
  16213. @example
  16214. subtitles=sub.srt:force_style='Fontname=DejaVu Serif,PrimaryColour=&HCCFF0000'
  16215. @end example
  16216. @section super2xsai
  16217. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  16218. Interpolate) pixel art scaling algorithm.
  16219. Useful for enlarging pixel art images without reducing sharpness.
  16220. @section swaprect
  16221. Swap two rectangular objects in video.
  16222. This filter accepts the following options:
  16223. @table @option
  16224. @item w
  16225. Set object width.
  16226. @item h
  16227. Set object height.
  16228. @item x1
  16229. Set 1st rect x coordinate.
  16230. @item y1
  16231. Set 1st rect y coordinate.
  16232. @item x2
  16233. Set 2nd rect x coordinate.
  16234. @item y2
  16235. Set 2nd rect y coordinate.
  16236. All expressions are evaluated once for each frame.
  16237. @end table
  16238. The all options are expressions containing the following constants:
  16239. @table @option
  16240. @item w
  16241. @item h
  16242. The input width and height.
  16243. @item a
  16244. same as @var{w} / @var{h}
  16245. @item sar
  16246. input sample aspect ratio
  16247. @item dar
  16248. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  16249. @item n
  16250. The number of the input frame, starting from 0.
  16251. @item t
  16252. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  16253. @item pos
  16254. the position in the file of the input frame, NAN if unknown
  16255. @end table
  16256. @subsection Commands
  16257. This filter supports the all above options as @ref{commands}.
  16258. @section swapuv
  16259. Swap U & V plane.
  16260. @section tblend
  16261. Blend successive video frames.
  16262. See @ref{blend}
  16263. @section telecine
  16264. Apply telecine process to the video.
  16265. This filter accepts the following options:
  16266. @table @option
  16267. @item first_field
  16268. @table @samp
  16269. @item top, t
  16270. top field first
  16271. @item bottom, b
  16272. bottom field first
  16273. The default value is @code{top}.
  16274. @end table
  16275. @item pattern
  16276. A string of numbers representing the pulldown pattern you wish to apply.
  16277. The default value is @code{23}.
  16278. @end table
  16279. @example
  16280. Some typical patterns:
  16281. NTSC output (30i):
  16282. 27.5p: 32222
  16283. 24p: 23 (classic)
  16284. 24p: 2332 (preferred)
  16285. 20p: 33
  16286. 18p: 334
  16287. 16p: 3444
  16288. PAL output (25i):
  16289. 27.5p: 12222
  16290. 24p: 222222222223 ("Euro pulldown")
  16291. 16.67p: 33
  16292. 16p: 33333334
  16293. @end example
  16294. @section thistogram
  16295. Compute and draw a color distribution histogram for the input video across time.
  16296. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  16297. at certain time, this filter shows also past histograms of number of frames defined
  16298. by @code{width} option.
  16299. The computed histogram is a representation of the color component
  16300. distribution in an image.
  16301. The filter accepts the following options:
  16302. @table @option
  16303. @item width, w
  16304. Set width of single color component output. Default value is @code{0}.
  16305. Value of @code{0} means width will be picked from input video.
  16306. This also set number of passed histograms to keep.
  16307. Allowed range is [0, 8192].
  16308. @item display_mode, d
  16309. Set display mode.
  16310. It accepts the following values:
  16311. @table @samp
  16312. @item stack
  16313. Per color component graphs are placed below each other.
  16314. @item parade
  16315. Per color component graphs are placed side by side.
  16316. @item overlay
  16317. Presents information identical to that in the @code{parade}, except
  16318. that the graphs representing color components are superimposed directly
  16319. over one another.
  16320. @end table
  16321. Default is @code{stack}.
  16322. @item levels_mode, m
  16323. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  16324. Default is @code{linear}.
  16325. @item components, c
  16326. Set what color components to display.
  16327. Default is @code{7}.
  16328. @item bgopacity, b
  16329. Set background opacity. Default is @code{0.9}.
  16330. @item envelope, e
  16331. Show envelope. Default is disabled.
  16332. @item ecolor, ec
  16333. Set envelope color. Default is @code{gold}.
  16334. @item slide
  16335. Set slide mode.
  16336. Available values for slide is:
  16337. @table @samp
  16338. @item frame
  16339. Draw new frame when right border is reached.
  16340. @item replace
  16341. Replace old columns with new ones.
  16342. @item scroll
  16343. Scroll from right to left.
  16344. @item rscroll
  16345. Scroll from left to right.
  16346. @item picture
  16347. Draw single picture.
  16348. @end table
  16349. Default is @code{replace}.
  16350. @end table
  16351. @section threshold
  16352. Apply threshold effect to video stream.
  16353. This filter needs four video streams to perform thresholding.
  16354. First stream is stream we are filtering.
  16355. Second stream is holding threshold values, third stream is holding min values,
  16356. and last, fourth stream is holding max values.
  16357. The filter accepts the following option:
  16358. @table @option
  16359. @item planes
  16360. Set which planes will be processed, unprocessed planes will be copied.
  16361. By default value 0xf, all planes will be processed.
  16362. @end table
  16363. For example if first stream pixel's component value is less then threshold value
  16364. of pixel component from 2nd threshold stream, third stream value will picked,
  16365. otherwise fourth stream pixel component value will be picked.
  16366. Using color source filter one can perform various types of thresholding:
  16367. @subsection Commands
  16368. This filter supports the all options as @ref{commands}.
  16369. @subsection Examples
  16370. @itemize
  16371. @item
  16372. Binary threshold, using gray color as threshold:
  16373. @example
  16374. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  16375. @end example
  16376. @item
  16377. Inverted binary threshold, using gray color as threshold:
  16378. @example
  16379. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  16380. @end example
  16381. @item
  16382. Truncate binary threshold, using gray color as threshold:
  16383. @example
  16384. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  16385. @end example
  16386. @item
  16387. Threshold to zero, using gray color as threshold:
  16388. @example
  16389. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  16390. @end example
  16391. @item
  16392. Inverted threshold to zero, using gray color as threshold:
  16393. @example
  16394. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  16395. @end example
  16396. @end itemize
  16397. @section thumbnail
  16398. Select the most representative frame in a given sequence of consecutive frames.
  16399. The filter accepts the following options:
  16400. @table @option
  16401. @item n
  16402. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  16403. will pick one of them, and then handle the next batch of @var{n} frames until
  16404. the end. Default is @code{100}.
  16405. @end table
  16406. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  16407. value will result in a higher memory usage, so a high value is not recommended.
  16408. @subsection Examples
  16409. @itemize
  16410. @item
  16411. Extract one picture each 50 frames:
  16412. @example
  16413. thumbnail=50
  16414. @end example
  16415. @item
  16416. Complete example of a thumbnail creation with @command{ffmpeg}:
  16417. @example
  16418. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  16419. @end example
  16420. @end itemize
  16421. @anchor{tile}
  16422. @section tile
  16423. Tile several successive frames together.
  16424. The @ref{untile} filter can do the reverse.
  16425. The filter accepts the following options:
  16426. @table @option
  16427. @item layout
  16428. Set the grid size in the form @code{COLUMNSxROWS}. Range is upto UINT_MAX cells.
  16429. Default is @code{6x5}.
  16430. @item nb_frames
  16431. Set the maximum number of frames to render in the given area. It must be less
  16432. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  16433. the area will be used.
  16434. @item margin
  16435. Set the outer border margin in pixels. Range is 0 to 1024. Default is @code{0}.
  16436. @item padding
  16437. Set the inner border thickness (i.e. the number of pixels between frames). For
  16438. more advanced padding options (such as having different values for the edges),
  16439. refer to the pad video filter. Range is 0 to 1024. Default is @code{0}.
  16440. @item color
  16441. Specify the color of the unused area. For the syntax of this option, check the
  16442. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16443. The default value of @var{color} is "black".
  16444. @item overlap
  16445. Set the number of frames to overlap when tiling several successive frames together.
  16446. The value must be between @code{0} and @var{nb_frames - 1}. Default is @code{0}.
  16447. @item init_padding
  16448. Set the number of frames to initially be empty before displaying first output frame.
  16449. This controls how soon will one get first output frame.
  16450. The value must be between @code{0} and @var{nb_frames - 1}. Default is @code{0}.
  16451. @end table
  16452. @subsection Examples
  16453. @itemize
  16454. @item
  16455. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  16456. @example
  16457. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  16458. @end example
  16459. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  16460. duplicating each output frame to accommodate the originally detected frame
  16461. rate.
  16462. @item
  16463. Display @code{5} pictures in an area of @code{3x2} frames,
  16464. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  16465. mixed flat and named options:
  16466. @example
  16467. tile=3x2:nb_frames=5:padding=7:margin=2
  16468. @end example
  16469. @end itemize
  16470. @section tinterlace
  16471. Perform various types of temporal field interlacing.
  16472. Frames are counted starting from 1, so the first input frame is
  16473. considered odd.
  16474. The filter accepts the following options:
  16475. @table @option
  16476. @item mode
  16477. Specify the mode of the interlacing. This option can also be specified
  16478. as a value alone. See below for a list of values for this option.
  16479. Available values are:
  16480. @table @samp
  16481. @item merge, 0
  16482. Move odd frames into the upper field, even into the lower field,
  16483. generating a double height frame at half frame rate.
  16484. @example
  16485. ------> time
  16486. Input:
  16487. Frame 1 Frame 2 Frame 3 Frame 4
  16488. 11111 22222 33333 44444
  16489. 11111 22222 33333 44444
  16490. 11111 22222 33333 44444
  16491. 11111 22222 33333 44444
  16492. Output:
  16493. 11111 33333
  16494. 22222 44444
  16495. 11111 33333
  16496. 22222 44444
  16497. 11111 33333
  16498. 22222 44444
  16499. 11111 33333
  16500. 22222 44444
  16501. @end example
  16502. @item drop_even, 1
  16503. Only output odd frames, even frames are dropped, generating a frame with
  16504. unchanged height at half frame rate.
  16505. @example
  16506. ------> time
  16507. Input:
  16508. Frame 1 Frame 2 Frame 3 Frame 4
  16509. 11111 22222 33333 44444
  16510. 11111 22222 33333 44444
  16511. 11111 22222 33333 44444
  16512. 11111 22222 33333 44444
  16513. Output:
  16514. 11111 33333
  16515. 11111 33333
  16516. 11111 33333
  16517. 11111 33333
  16518. @end example
  16519. @item drop_odd, 2
  16520. Only output even frames, odd frames are dropped, generating a frame with
  16521. unchanged height at half frame rate.
  16522. @example
  16523. ------> time
  16524. Input:
  16525. Frame 1 Frame 2 Frame 3 Frame 4
  16526. 11111 22222 33333 44444
  16527. 11111 22222 33333 44444
  16528. 11111 22222 33333 44444
  16529. 11111 22222 33333 44444
  16530. Output:
  16531. 22222 44444
  16532. 22222 44444
  16533. 22222 44444
  16534. 22222 44444
  16535. @end example
  16536. @item pad, 3
  16537. Expand each frame to full height, but pad alternate lines with black,
  16538. generating a frame with double height at the same input frame rate.
  16539. @example
  16540. ------> time
  16541. Input:
  16542. Frame 1 Frame 2 Frame 3 Frame 4
  16543. 11111 22222 33333 44444
  16544. 11111 22222 33333 44444
  16545. 11111 22222 33333 44444
  16546. 11111 22222 33333 44444
  16547. Output:
  16548. 11111 ..... 33333 .....
  16549. ..... 22222 ..... 44444
  16550. 11111 ..... 33333 .....
  16551. ..... 22222 ..... 44444
  16552. 11111 ..... 33333 .....
  16553. ..... 22222 ..... 44444
  16554. 11111 ..... 33333 .....
  16555. ..... 22222 ..... 44444
  16556. @end example
  16557. @item interleave_top, 4
  16558. Interleave the upper field from odd frames with the lower field from
  16559. even frames, generating a frame with unchanged height at half frame rate.
  16560. @example
  16561. ------> time
  16562. Input:
  16563. Frame 1 Frame 2 Frame 3 Frame 4
  16564. 11111<- 22222 33333<- 44444
  16565. 11111 22222<- 33333 44444<-
  16566. 11111<- 22222 33333<- 44444
  16567. 11111 22222<- 33333 44444<-
  16568. Output:
  16569. 11111 33333
  16570. 22222 44444
  16571. 11111 33333
  16572. 22222 44444
  16573. @end example
  16574. @item interleave_bottom, 5
  16575. Interleave the lower field from odd frames with the upper field from
  16576. even frames, generating a frame with unchanged height at half frame rate.
  16577. @example
  16578. ------> time
  16579. Input:
  16580. Frame 1 Frame 2 Frame 3 Frame 4
  16581. 11111 22222<- 33333 44444<-
  16582. 11111<- 22222 33333<- 44444
  16583. 11111 22222<- 33333 44444<-
  16584. 11111<- 22222 33333<- 44444
  16585. Output:
  16586. 22222 44444
  16587. 11111 33333
  16588. 22222 44444
  16589. 11111 33333
  16590. @end example
  16591. @item interlacex2, 6
  16592. Double frame rate with unchanged height. Frames are inserted each
  16593. containing the second temporal field from the previous input frame and
  16594. the first temporal field from the next input frame. This mode relies on
  16595. the top_field_first flag. Useful for interlaced video displays with no
  16596. field synchronisation.
  16597. @example
  16598. ------> time
  16599. Input:
  16600. Frame 1 Frame 2 Frame 3 Frame 4
  16601. 11111 22222 33333 44444
  16602. 11111 22222 33333 44444
  16603. 11111 22222 33333 44444
  16604. 11111 22222 33333 44444
  16605. Output:
  16606. 11111 22222 22222 33333 33333 44444 44444
  16607. 11111 11111 22222 22222 33333 33333 44444
  16608. 11111 22222 22222 33333 33333 44444 44444
  16609. 11111 11111 22222 22222 33333 33333 44444
  16610. @end example
  16611. @item mergex2, 7
  16612. Move odd frames into the upper field, even into the lower field,
  16613. generating a double height frame at same frame rate.
  16614. @example
  16615. ------> time
  16616. Input:
  16617. Frame 1 Frame 2 Frame 3 Frame 4
  16618. 11111 22222 33333 44444
  16619. 11111 22222 33333 44444
  16620. 11111 22222 33333 44444
  16621. 11111 22222 33333 44444
  16622. Output:
  16623. 11111 33333 33333 55555
  16624. 22222 22222 44444 44444
  16625. 11111 33333 33333 55555
  16626. 22222 22222 44444 44444
  16627. 11111 33333 33333 55555
  16628. 22222 22222 44444 44444
  16629. 11111 33333 33333 55555
  16630. 22222 22222 44444 44444
  16631. @end example
  16632. @end table
  16633. Numeric values are deprecated but are accepted for backward
  16634. compatibility reasons.
  16635. Default mode is @code{merge}.
  16636. @item flags
  16637. Specify flags influencing the filter process.
  16638. Available value for @var{flags} is:
  16639. @table @option
  16640. @item low_pass_filter, vlpf
  16641. Enable linear vertical low-pass filtering in the filter.
  16642. Vertical low-pass filtering is required when creating an interlaced
  16643. destination from a progressive source which contains high-frequency
  16644. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  16645. patterning.
  16646. @item complex_filter, cvlpf
  16647. Enable complex vertical low-pass filtering.
  16648. This will slightly less reduce interlace 'twitter' and Moire
  16649. patterning but better retain detail and subjective sharpness impression.
  16650. @item bypass_il
  16651. Bypass already interlaced frames, only adjust the frame rate.
  16652. @end table
  16653. Vertical low-pass filtering and bypassing already interlaced frames can only be
  16654. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  16655. @end table
  16656. @section tmedian
  16657. Pick median pixels from several successive input video frames.
  16658. The filter accepts the following options:
  16659. @table @option
  16660. @item radius
  16661. Set radius of median filter.
  16662. Default is 1. Allowed range is from 1 to 127.
  16663. @item planes
  16664. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  16665. @item percentile
  16666. Set median percentile. Default value is @code{0.5}.
  16667. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  16668. minimum values, and @code{1} maximum values.
  16669. @end table
  16670. @subsection Commands
  16671. This filter supports all above options as @ref{commands}, excluding option @code{radius}.
  16672. @section tmidequalizer
  16673. Apply Temporal Midway Video Equalization effect.
  16674. Midway Video Equalization adjusts a sequence of video frames to have the same
  16675. histograms, while maintaining their dynamics as much as possible. It's
  16676. useful for e.g. matching exposures from a video frames sequence.
  16677. This filter accepts the following option:
  16678. @table @option
  16679. @item radius
  16680. Set filtering radius. Default is @code{5}. Allowed range is from 1 to 127.
  16681. @item sigma
  16682. Set filtering sigma. Default is @code{0.5}. This controls strength of filtering.
  16683. Setting this option to 0 effectively does nothing.
  16684. @item planes
  16685. Set which planes to process. Default is @code{15}, which is all available planes.
  16686. @end table
  16687. @section tmix
  16688. Mix successive video frames.
  16689. A description of the accepted options follows.
  16690. @table @option
  16691. @item frames
  16692. The number of successive frames to mix. If unspecified, it defaults to 3.
  16693. @item weights
  16694. Specify weight of each input video frame.
  16695. Each weight is separated by space. If number of weights is smaller than
  16696. number of @var{frames} last specified weight will be used for all remaining
  16697. unset weights.
  16698. @item scale
  16699. Specify scale, if it is set it will be multiplied with sum
  16700. of each weight multiplied with pixel values to give final destination
  16701. pixel value. By default @var{scale} is auto scaled to sum of weights.
  16702. @item planes
  16703. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  16704. @end table
  16705. @subsection Examples
  16706. @itemize
  16707. @item
  16708. Average 7 successive frames:
  16709. @example
  16710. tmix=frames=7:weights="1 1 1 1 1 1 1"
  16711. @end example
  16712. @item
  16713. Apply simple temporal convolution:
  16714. @example
  16715. tmix=frames=3:weights="-1 3 -1"
  16716. @end example
  16717. @item
  16718. Similar as above but only showing temporal differences:
  16719. @example
  16720. tmix=frames=3:weights="-1 2 -1":scale=1
  16721. @end example
  16722. @end itemize
  16723. @subsection Commands
  16724. This filter supports the following commands:
  16725. @table @option
  16726. @item weights
  16727. @item scale
  16728. @item planes
  16729. Syntax is same as option with same name.
  16730. @end table
  16731. @anchor{tonemap}
  16732. @section tonemap
  16733. Tone map colors from different dynamic ranges.
  16734. This filter expects data in single precision floating point, as it needs to
  16735. operate on (and can output) out-of-range values. Another filter, such as
  16736. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  16737. The tonemapping algorithms implemented only work on linear light, so input
  16738. data should be linearized beforehand (and possibly correctly tagged).
  16739. @example
  16740. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  16741. @end example
  16742. @subsection Options
  16743. The filter accepts the following options.
  16744. @table @option
  16745. @item tonemap
  16746. Set the tone map algorithm to use.
  16747. Possible values are:
  16748. @table @var
  16749. @item none
  16750. Do not apply any tone map, only desaturate overbright pixels.
  16751. @item clip
  16752. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  16753. in-range values, while distorting out-of-range values.
  16754. @item linear
  16755. Stretch the entire reference gamut to a linear multiple of the display.
  16756. @item gamma
  16757. Fit a logarithmic transfer between the tone curves.
  16758. @item reinhard
  16759. Preserve overall image brightness with a simple curve, using nonlinear
  16760. contrast, which results in flattening details and degrading color accuracy.
  16761. @item hable
  16762. Preserve both dark and bright details better than @var{reinhard}, at the cost
  16763. of slightly darkening everything. Use it when detail preservation is more
  16764. important than color and brightness accuracy.
  16765. @item mobius
  16766. Smoothly map out-of-range values, while retaining contrast and colors for
  16767. in-range material as much as possible. Use it when color accuracy is more
  16768. important than detail preservation.
  16769. @end table
  16770. Default is none.
  16771. @item param
  16772. Tune the tone mapping algorithm.
  16773. This affects the following algorithms:
  16774. @table @var
  16775. @item none
  16776. Ignored.
  16777. @item linear
  16778. Specifies the scale factor to use while stretching.
  16779. Default to 1.0.
  16780. @item gamma
  16781. Specifies the exponent of the function.
  16782. Default to 1.8.
  16783. @item clip
  16784. Specify an extra linear coefficient to multiply into the signal before clipping.
  16785. Default to 1.0.
  16786. @item reinhard
  16787. Specify the local contrast coefficient at the display peak.
  16788. Default to 0.5, which means that in-gamut values will be about half as bright
  16789. as when clipping.
  16790. @item hable
  16791. Ignored.
  16792. @item mobius
  16793. Specify the transition point from linear to mobius transform. Every value
  16794. below this point is guaranteed to be mapped 1:1. The higher the value, the
  16795. more accurate the result will be, at the cost of losing bright details.
  16796. Default to 0.3, which due to the steep initial slope still preserves in-range
  16797. colors fairly accurately.
  16798. @end table
  16799. @item desat
  16800. Apply desaturation for highlights that exceed this level of brightness. The
  16801. higher the parameter, the more color information will be preserved. This
  16802. setting helps prevent unnaturally blown-out colors for super-highlights, by
  16803. (smoothly) turning into white instead. This makes images feel more natural,
  16804. at the cost of reducing information about out-of-range colors.
  16805. The default of 2.0 is somewhat conservative and will mostly just apply to
  16806. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  16807. This option works only if the input frame has a supported color tag.
  16808. @item peak
  16809. Override signal/nominal/reference peak with this value. Useful when the
  16810. embedded peak information in display metadata is not reliable or when tone
  16811. mapping from a lower range to a higher range.
  16812. @end table
  16813. @section tpad
  16814. Temporarily pad video frames.
  16815. The filter accepts the following options:
  16816. @table @option
  16817. @item start
  16818. Specify number of delay frames before input video stream. Default is 0.
  16819. @item stop
  16820. Specify number of padding frames after input video stream.
  16821. Set to -1 to pad indefinitely. Default is 0.
  16822. @item start_mode
  16823. Set kind of frames added to beginning of stream.
  16824. Can be either @var{add} or @var{clone}.
  16825. With @var{add} frames of solid-color are added.
  16826. With @var{clone} frames are clones of first frame.
  16827. Default is @var{add}.
  16828. @item stop_mode
  16829. Set kind of frames added to end of stream.
  16830. Can be either @var{add} or @var{clone}.
  16831. With @var{add} frames of solid-color are added.
  16832. With @var{clone} frames are clones of last frame.
  16833. Default is @var{add}.
  16834. @item start_duration, stop_duration
  16835. Specify the duration of the start/stop delay. See
  16836. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  16837. for the accepted syntax.
  16838. These options override @var{start} and @var{stop}. Default is 0.
  16839. @item color
  16840. Specify the color of the padded area. For the syntax of this option,
  16841. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  16842. manual,ffmpeg-utils}.
  16843. The default value of @var{color} is "black".
  16844. @end table
  16845. @anchor{transpose}
  16846. @section transpose
  16847. Transpose rows with columns in the input video and optionally flip it.
  16848. It accepts the following parameters:
  16849. @table @option
  16850. @item dir
  16851. Specify the transposition direction.
  16852. Can assume the following values:
  16853. @table @samp
  16854. @item 0, 4, cclock_flip
  16855. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  16856. @example
  16857. L.R L.l
  16858. . . -> . .
  16859. l.r R.r
  16860. @end example
  16861. @item 1, 5, clock
  16862. Rotate by 90 degrees clockwise, that is:
  16863. @example
  16864. L.R l.L
  16865. . . -> . .
  16866. l.r r.R
  16867. @end example
  16868. @item 2, 6, cclock
  16869. Rotate by 90 degrees counterclockwise, that is:
  16870. @example
  16871. L.R R.r
  16872. . . -> . .
  16873. l.r L.l
  16874. @end example
  16875. @item 3, 7, clock_flip
  16876. Rotate by 90 degrees clockwise and vertically flip, that is:
  16877. @example
  16878. L.R r.R
  16879. . . -> . .
  16880. l.r l.L
  16881. @end example
  16882. @end table
  16883. For values between 4-7, the transposition is only done if the input
  16884. video geometry is portrait and not landscape. These values are
  16885. deprecated, the @code{passthrough} option should be used instead.
  16886. Numerical values are deprecated, and should be dropped in favor of
  16887. symbolic constants.
  16888. @item passthrough
  16889. Do not apply the transposition if the input geometry matches the one
  16890. specified by the specified value. It accepts the following values:
  16891. @table @samp
  16892. @item none
  16893. Always apply transposition.
  16894. @item portrait
  16895. Preserve portrait geometry (when @var{height} >= @var{width}).
  16896. @item landscape
  16897. Preserve landscape geometry (when @var{width} >= @var{height}).
  16898. @end table
  16899. Default value is @code{none}.
  16900. @end table
  16901. For example to rotate by 90 degrees clockwise and preserve portrait
  16902. layout:
  16903. @example
  16904. transpose=dir=1:passthrough=portrait
  16905. @end example
  16906. The command above can also be specified as:
  16907. @example
  16908. transpose=1:portrait
  16909. @end example
  16910. @section transpose_npp
  16911. Transpose rows with columns in the input video and optionally flip it.
  16912. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  16913. It accepts the following parameters:
  16914. @table @option
  16915. @item dir
  16916. Specify the transposition direction.
  16917. Can assume the following values:
  16918. @table @samp
  16919. @item cclock_flip
  16920. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  16921. @item clock
  16922. Rotate by 90 degrees clockwise.
  16923. @item cclock
  16924. Rotate by 90 degrees counterclockwise.
  16925. @item clock_flip
  16926. Rotate by 90 degrees clockwise and vertically flip.
  16927. @end table
  16928. @item passthrough
  16929. Do not apply the transposition if the input geometry matches the one
  16930. specified by the specified value. It accepts the following values:
  16931. @table @samp
  16932. @item none
  16933. Always apply transposition. (default)
  16934. @item portrait
  16935. Preserve portrait geometry (when @var{height} >= @var{width}).
  16936. @item landscape
  16937. Preserve landscape geometry (when @var{width} >= @var{height}).
  16938. @end table
  16939. @end table
  16940. @section trim
  16941. Trim the input so that the output contains one continuous subpart of the input.
  16942. It accepts the following parameters:
  16943. @table @option
  16944. @item start
  16945. Specify the time of the start of the kept section, i.e. the frame with the
  16946. timestamp @var{start} will be the first frame in the output.
  16947. @item end
  16948. Specify the time of the first frame that will be dropped, i.e. the frame
  16949. immediately preceding the one with the timestamp @var{end} will be the last
  16950. frame in the output.
  16951. @item start_pts
  16952. This is the same as @var{start}, except this option sets the start timestamp
  16953. in timebase units instead of seconds.
  16954. @item end_pts
  16955. This is the same as @var{end}, except this option sets the end timestamp
  16956. in timebase units instead of seconds.
  16957. @item duration
  16958. The maximum duration of the output in seconds.
  16959. @item start_frame
  16960. The number of the first frame that should be passed to the output.
  16961. @item end_frame
  16962. The number of the first frame that should be dropped.
  16963. @end table
  16964. @option{start}, @option{end}, and @option{duration} are expressed as time
  16965. duration specifications; see
  16966. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  16967. for the accepted syntax.
  16968. Note that the first two sets of the start/end options and the @option{duration}
  16969. option look at the frame timestamp, while the _frame variants simply count the
  16970. frames that pass through the filter. Also note that this filter does not modify
  16971. the timestamps. If you wish for the output timestamps to start at zero, insert a
  16972. setpts filter after the trim filter.
  16973. If multiple start or end options are set, this filter tries to be greedy and
  16974. keep all the frames that match at least one of the specified constraints. To keep
  16975. only the part that matches all the constraints at once, chain multiple trim
  16976. filters.
  16977. The defaults are such that all the input is kept. So it is possible to set e.g.
  16978. just the end values to keep everything before the specified time.
  16979. Examples:
  16980. @itemize
  16981. @item
  16982. Drop everything except the second minute of input:
  16983. @example
  16984. ffmpeg -i INPUT -vf trim=60:120
  16985. @end example
  16986. @item
  16987. Keep only the first second:
  16988. @example
  16989. ffmpeg -i INPUT -vf trim=duration=1
  16990. @end example
  16991. @end itemize
  16992. @section unpremultiply
  16993. Apply alpha unpremultiply effect to input video stream using first plane
  16994. of second stream as alpha.
  16995. Both streams must have same dimensions and same pixel format.
  16996. The filter accepts the following option:
  16997. @table @option
  16998. @item planes
  16999. Set which planes will be processed, unprocessed planes will be copied.
  17000. By default value 0xf, all planes will be processed.
  17001. If the format has 1 or 2 components, then luma is bit 0.
  17002. If the format has 3 or 4 components:
  17003. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  17004. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  17005. If present, the alpha channel is always the last bit.
  17006. @item inplace
  17007. Do not require 2nd input for processing, instead use alpha plane from input stream.
  17008. @end table
  17009. @anchor{unsharp}
  17010. @section unsharp
  17011. Sharpen or blur the input video.
  17012. It accepts the following parameters:
  17013. @table @option
  17014. @item luma_msize_x, lx
  17015. Set the luma matrix horizontal size. It must be an odd integer between
  17016. 3 and 23. The default value is 5.
  17017. @item luma_msize_y, ly
  17018. Set the luma matrix vertical size. It must be an odd integer between 3
  17019. and 23. The default value is 5.
  17020. @item luma_amount, la
  17021. Set the luma effect strength. It must be a floating point number, reasonable
  17022. values lay between -1.5 and 1.5.
  17023. Negative values will blur the input video, while positive values will
  17024. sharpen it, a value of zero will disable the effect.
  17025. Default value is 1.0.
  17026. @item chroma_msize_x, cx
  17027. Set the chroma matrix horizontal size. It must be an odd integer
  17028. between 3 and 23. The default value is 5.
  17029. @item chroma_msize_y, cy
  17030. Set the chroma matrix vertical size. It must be an odd integer
  17031. between 3 and 23. The default value is 5.
  17032. @item chroma_amount, ca
  17033. Set the chroma effect strength. It must be a floating point number, reasonable
  17034. values lay between -1.5 and 1.5.
  17035. Negative values will blur the input video, while positive values will
  17036. sharpen it, a value of zero will disable the effect.
  17037. Default value is 0.0.
  17038. @item alpha_msize_x, ax
  17039. Set the alpha matrix horizontal size. It must be an odd integer
  17040. between 3 and 23. The default value is 5.
  17041. @item alpha_msize_y, ay
  17042. Set the alpha matrix vertical size. It must be an odd integer
  17043. between 3 and 23. The default value is 5.
  17044. @item alpha_amount, aa
  17045. Set the alpha effect strength. It must be a floating point number, reasonable
  17046. values lay between -1.5 and 1.5.
  17047. Negative values will blur the input video, while positive values will
  17048. sharpen it, a value of zero will disable the effect.
  17049. Default value is 0.0.
  17050. @end table
  17051. All parameters are optional and default to the equivalent of the
  17052. string '5:5:1.0:5:5:0.0'.
  17053. @subsection Examples
  17054. @itemize
  17055. @item
  17056. Apply strong luma sharpen effect:
  17057. @example
  17058. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  17059. @end example
  17060. @item
  17061. Apply a strong blur of both luma and chroma parameters:
  17062. @example
  17063. unsharp=7:7:-2:7:7:-2
  17064. @end example
  17065. @end itemize
  17066. @anchor{untile}
  17067. @section untile
  17068. Decompose a video made of tiled images into the individual images.
  17069. The frame rate of the output video is the frame rate of the input video
  17070. multiplied by the number of tiles.
  17071. This filter does the reverse of @ref{tile}.
  17072. The filter accepts the following options:
  17073. @table @option
  17074. @item layout
  17075. Set the grid size (i.e. the number of lines and columns). For the syntax of
  17076. this option, check the
  17077. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17078. @end table
  17079. @subsection Examples
  17080. @itemize
  17081. @item
  17082. Produce a 1-second video from a still image file made of 25 frames stacked
  17083. vertically, like an analogic film reel:
  17084. @example
  17085. ffmpeg -r 1 -i image.jpg -vf untile=1x25 movie.mkv
  17086. @end example
  17087. @end itemize
  17088. @section uspp
  17089. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  17090. the image at several (or - in the case of @option{quality} level @code{8} - all)
  17091. shifts and average the results.
  17092. The way this differs from the behavior of spp is that uspp actually encodes &
  17093. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  17094. DCT similar to MJPEG.
  17095. This filter is only available in ffmpeg version 4.4 or earlier.
  17096. The filter accepts the following options:
  17097. @table @option
  17098. @item quality
  17099. Set quality. This option defines the number of levels for averaging. It accepts
  17100. an integer in the range 0-8. If set to @code{0}, the filter will have no
  17101. effect. A value of @code{8} means the higher quality. For each increment of
  17102. that value the speed drops by a factor of approximately 2. Default value is
  17103. @code{3}.
  17104. @item qp
  17105. Force a constant quantization parameter. If not set, the filter will use the QP
  17106. from the video stream (if available).
  17107. @end table
  17108. @section v360
  17109. Convert 360 videos between various formats.
  17110. The filter accepts the following options:
  17111. @table @option
  17112. @item input
  17113. @item output
  17114. Set format of the input/output video.
  17115. Available formats:
  17116. @table @samp
  17117. @item e
  17118. @item equirect
  17119. Equirectangular projection.
  17120. @item c3x2
  17121. @item c6x1
  17122. @item c1x6
  17123. Cubemap with 3x2/6x1/1x6 layout.
  17124. Format specific options:
  17125. @table @option
  17126. @item in_pad
  17127. @item out_pad
  17128. Set padding proportion for the input/output cubemap. Values in decimals.
  17129. Example values:
  17130. @table @samp
  17131. @item 0
  17132. No padding.
  17133. @item 0.01
  17134. 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)
  17135. @end table
  17136. Default value is @b{@samp{0}}.
  17137. Maximum value is @b{@samp{0.1}}.
  17138. @item fin_pad
  17139. @item fout_pad
  17140. Set fixed padding for the input/output cubemap. Values in pixels.
  17141. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  17142. @item in_forder
  17143. @item out_forder
  17144. Set order of faces for the input/output cubemap. Choose one direction for each position.
  17145. Designation of directions:
  17146. @table @samp
  17147. @item r
  17148. right
  17149. @item l
  17150. left
  17151. @item u
  17152. up
  17153. @item d
  17154. down
  17155. @item f
  17156. forward
  17157. @item b
  17158. back
  17159. @end table
  17160. Default value is @b{@samp{rludfb}}.
  17161. @item in_frot
  17162. @item out_frot
  17163. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  17164. Designation of angles:
  17165. @table @samp
  17166. @item 0
  17167. 0 degrees clockwise
  17168. @item 1
  17169. 90 degrees clockwise
  17170. @item 2
  17171. 180 degrees clockwise
  17172. @item 3
  17173. 270 degrees clockwise
  17174. @end table
  17175. Default value is @b{@samp{000000}}.
  17176. @end table
  17177. @item eac
  17178. Equi-Angular Cubemap.
  17179. @item flat
  17180. @item gnomonic
  17181. @item rectilinear
  17182. Regular video.
  17183. Format specific options:
  17184. @table @option
  17185. @item h_fov
  17186. @item v_fov
  17187. @item d_fov
  17188. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17189. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17190. @item ih_fov
  17191. @item iv_fov
  17192. @item id_fov
  17193. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17194. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17195. @end table
  17196. @item dfisheye
  17197. Dual fisheye.
  17198. Format specific options:
  17199. @table @option
  17200. @item h_fov
  17201. @item v_fov
  17202. @item d_fov
  17203. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17204. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17205. @item ih_fov
  17206. @item iv_fov
  17207. @item id_fov
  17208. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17209. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17210. @end table
  17211. @item barrel
  17212. @item fb
  17213. @item barrelsplit
  17214. Facebook's 360 formats.
  17215. @item sg
  17216. Stereographic format.
  17217. Format specific options:
  17218. @table @option
  17219. @item h_fov
  17220. @item v_fov
  17221. @item d_fov
  17222. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17223. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17224. @item ih_fov
  17225. @item iv_fov
  17226. @item id_fov
  17227. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17228. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17229. @end table
  17230. @item mercator
  17231. Mercator format.
  17232. @item ball
  17233. Ball format, gives significant distortion toward the back.
  17234. @item hammer
  17235. Hammer-Aitoff map projection format.
  17236. @item sinusoidal
  17237. Sinusoidal map projection format.
  17238. @item fisheye
  17239. Fisheye projection.
  17240. Format specific options:
  17241. @table @option
  17242. @item h_fov
  17243. @item v_fov
  17244. @item d_fov
  17245. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17246. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17247. @item ih_fov
  17248. @item iv_fov
  17249. @item id_fov
  17250. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17251. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17252. @end table
  17253. @item pannini
  17254. Pannini projection.
  17255. Format specific options:
  17256. @table @option
  17257. @item h_fov
  17258. Set output pannini parameter.
  17259. @item ih_fov
  17260. Set input pannini parameter.
  17261. @end table
  17262. @item cylindrical
  17263. Cylindrical projection.
  17264. Format specific options:
  17265. @table @option
  17266. @item h_fov
  17267. @item v_fov
  17268. @item d_fov
  17269. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17270. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17271. @item ih_fov
  17272. @item iv_fov
  17273. @item id_fov
  17274. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17275. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17276. @end table
  17277. @item perspective
  17278. Perspective projection. @i{(output only)}
  17279. Format specific options:
  17280. @table @option
  17281. @item v_fov
  17282. Set perspective parameter.
  17283. @end table
  17284. @item tetrahedron
  17285. Tetrahedron projection.
  17286. @item tsp
  17287. Truncated square pyramid projection.
  17288. @item he
  17289. @item hequirect
  17290. Half equirectangular projection.
  17291. @item equisolid
  17292. Equisolid format.
  17293. Format specific options:
  17294. @table @option
  17295. @item h_fov
  17296. @item v_fov
  17297. @item d_fov
  17298. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17299. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17300. @item ih_fov
  17301. @item iv_fov
  17302. @item id_fov
  17303. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17304. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17305. @end table
  17306. @item og
  17307. Orthographic format.
  17308. Format specific options:
  17309. @table @option
  17310. @item h_fov
  17311. @item v_fov
  17312. @item d_fov
  17313. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  17314. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17315. @item ih_fov
  17316. @item iv_fov
  17317. @item id_fov
  17318. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  17319. If diagonal field of view is set it overrides horizontal and vertical field of view.
  17320. @end table
  17321. @item octahedron
  17322. Octahedron projection.
  17323. @item cylindricalea
  17324. Cylindrical Equal Area projection.
  17325. @end table
  17326. @item interp
  17327. Set interpolation method.@*
  17328. @i{Note: more complex interpolation methods require much more memory to run.}
  17329. Available methods:
  17330. @table @samp
  17331. @item near
  17332. @item nearest
  17333. Nearest neighbour.
  17334. @item line
  17335. @item linear
  17336. Bilinear interpolation.
  17337. @item lagrange9
  17338. Lagrange9 interpolation.
  17339. @item cube
  17340. @item cubic
  17341. Bicubic interpolation.
  17342. @item lanc
  17343. @item lanczos
  17344. Lanczos interpolation.
  17345. @item sp16
  17346. @item spline16
  17347. Spline16 interpolation.
  17348. @item gauss
  17349. @item gaussian
  17350. Gaussian interpolation.
  17351. @item mitchell
  17352. Mitchell interpolation.
  17353. @end table
  17354. Default value is @b{@samp{line}}.
  17355. @item w
  17356. @item h
  17357. Set the output video resolution.
  17358. Default resolution depends on formats.
  17359. @item in_stereo
  17360. @item out_stereo
  17361. Set the input/output stereo format.
  17362. @table @samp
  17363. @item 2d
  17364. 2D mono
  17365. @item sbs
  17366. Side by side
  17367. @item tb
  17368. Top bottom
  17369. @end table
  17370. Default value is @b{@samp{2d}} for input and output format.
  17371. @item yaw
  17372. @item pitch
  17373. @item roll
  17374. Set rotation for the output video. Values in degrees.
  17375. @item rorder
  17376. Set rotation order for the output video. Choose one item for each position.
  17377. @table @samp
  17378. @item y, Y
  17379. yaw
  17380. @item p, P
  17381. pitch
  17382. @item r, R
  17383. roll
  17384. @end table
  17385. Default value is @b{@samp{ypr}}.
  17386. @item h_flip
  17387. @item v_flip
  17388. @item d_flip
  17389. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  17390. @item ih_flip
  17391. @item iv_flip
  17392. Set if input video is flipped horizontally/vertically. Boolean values.
  17393. @item in_trans
  17394. Set if input video is transposed. Boolean value, by default disabled.
  17395. @item out_trans
  17396. Set if output video needs to be transposed. Boolean value, by default disabled.
  17397. @item h_offset
  17398. @item v_offset
  17399. Set output horizontal/vertical off-axis offset. Default is set to 0.
  17400. Allowed range is from -1 to 1.
  17401. @item alpha_mask
  17402. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  17403. @item reset_rot
  17404. Reset rotation of output video. Boolean value, by default disabled.
  17405. @end table
  17406. @subsection Examples
  17407. @itemize
  17408. @item
  17409. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  17410. @example
  17411. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  17412. @end example
  17413. @item
  17414. Extract back view of Equi-Angular Cubemap:
  17415. @example
  17416. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  17417. @end example
  17418. @item
  17419. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  17420. @example
  17421. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  17422. @end example
  17423. @end itemize
  17424. @subsection Commands
  17425. This filter supports subset of above options as @ref{commands}.
  17426. @section vaguedenoiser
  17427. Apply a wavelet based denoiser.
  17428. It transforms each frame from the video input into the wavelet domain,
  17429. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  17430. the obtained coefficients. It does an inverse wavelet transform after.
  17431. Due to wavelet properties, it should give a nice smoothed result, and
  17432. reduced noise, without blurring picture features.
  17433. This filter accepts the following options:
  17434. @table @option
  17435. @item threshold
  17436. The filtering strength. The higher, the more filtered the video will be.
  17437. Hard thresholding can use a higher threshold than soft thresholding
  17438. before the video looks overfiltered. Default value is 2.
  17439. @item method
  17440. The filtering method the filter will use.
  17441. It accepts the following values:
  17442. @table @samp
  17443. @item hard
  17444. All values under the threshold will be zeroed.
  17445. @item soft
  17446. All values under the threshold will be zeroed. All values above will be
  17447. reduced by the threshold.
  17448. @item garrote
  17449. Scales or nullifies coefficients - intermediary between (more) soft and
  17450. (less) hard thresholding.
  17451. @end table
  17452. Default is garrote.
  17453. @item nsteps
  17454. Number of times, the wavelet will decompose the picture. Picture can't
  17455. be decomposed beyond a particular point (typically, 8 for a 640x480
  17456. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  17457. @item percent
  17458. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  17459. @item planes
  17460. A list of the planes to process. By default all planes are processed.
  17461. @item type
  17462. The threshold type the filter will use.
  17463. It accepts the following values:
  17464. @table @samp
  17465. @item universal
  17466. Threshold used is same for all decompositions.
  17467. @item bayes
  17468. Threshold used depends also on each decomposition coefficients.
  17469. @end table
  17470. Default is universal.
  17471. @end table
  17472. @section varblur
  17473. Apply variable blur filter by using 2nd video stream to set blur radius.
  17474. The 2nd stream must have the same dimensions.
  17475. This filter accepts the following options:
  17476. @table @option
  17477. @item min_r
  17478. Set min allowed radius. Allowed range is from 0 to 254. Default is 0.
  17479. @item max_r
  17480. Set max allowed radius. Allowed range is from 1 to 255. Default is 8.
  17481. @item planes
  17482. Set which planes to process. By default, all are used.
  17483. @end table
  17484. The @code{varblur} filter also supports the @ref{framesync} options.
  17485. @subsection Commands
  17486. This filter supports all the above options as @ref{commands}.
  17487. @section vectorscope
  17488. Display 2 color component values in the two dimensional graph (which is called
  17489. a vectorscope).
  17490. This filter accepts the following options:
  17491. @table @option
  17492. @item mode, m
  17493. Set vectorscope mode.
  17494. It accepts the following values:
  17495. @table @samp
  17496. @item gray
  17497. @item tint
  17498. Gray values are displayed on graph, higher brightness means more pixels have
  17499. same component color value on location in graph. This is the default mode.
  17500. @item color
  17501. Gray values are displayed on graph. Surrounding pixels values which are not
  17502. present in video frame are drawn in gradient of 2 color components which are
  17503. set by option @code{x} and @code{y}. The 3rd color component is static.
  17504. @item color2
  17505. Actual color components values present in video frame are displayed on graph.
  17506. @item color3
  17507. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  17508. on graph increases value of another color component, which is luminance by
  17509. default values of @code{x} and @code{y}.
  17510. @item color4
  17511. Actual colors present in video frame are displayed on graph. If two different
  17512. colors map to same position on graph then color with higher value of component
  17513. not present in graph is picked.
  17514. @item color5
  17515. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  17516. component picked from radial gradient.
  17517. @end table
  17518. @item x
  17519. Set which color component will be represented on X-axis. Default is @code{1}.
  17520. @item y
  17521. Set which color component will be represented on Y-axis. Default is @code{2}.
  17522. @item intensity, i
  17523. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  17524. of color component which represents frequency of (X, Y) location in graph.
  17525. @item envelope, e
  17526. @table @samp
  17527. @item none
  17528. No envelope, this is default.
  17529. @item instant
  17530. Instant envelope, even darkest single pixel will be clearly highlighted.
  17531. @item peak
  17532. Hold maximum and minimum values presented in graph over time. This way you
  17533. can still spot out of range values without constantly looking at vectorscope.
  17534. @item peak+instant
  17535. Peak and instant envelope combined together.
  17536. @end table
  17537. @item graticule, g
  17538. Set what kind of graticule to draw.
  17539. @table @samp
  17540. @item none
  17541. @item green
  17542. @item color
  17543. @item invert
  17544. @end table
  17545. @item opacity, o
  17546. Set graticule opacity.
  17547. @item flags, f
  17548. Set graticule flags.
  17549. @table @samp
  17550. @item white
  17551. Draw graticule for white point.
  17552. @item black
  17553. Draw graticule for black point.
  17554. @item name
  17555. Draw color points short names.
  17556. @end table
  17557. @item bgopacity, b
  17558. Set background opacity.
  17559. @item lthreshold, l
  17560. Set low threshold for color component not represented on X or Y axis.
  17561. Values lower than this value will be ignored. Default is 0.
  17562. Note this value is multiplied with actual max possible value one pixel component
  17563. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  17564. is 0.1 * 255 = 25.
  17565. @item hthreshold, h
  17566. Set high threshold for color component not represented on X or Y axis.
  17567. Values higher than this value will be ignored. Default is 1.
  17568. Note this value is multiplied with actual max possible value one pixel component
  17569. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  17570. is 0.9 * 255 = 230.
  17571. @item colorspace, c
  17572. Set what kind of colorspace to use when drawing graticule.
  17573. @table @samp
  17574. @item auto
  17575. @item 601
  17576. @item 709
  17577. @end table
  17578. Default is auto.
  17579. @item tint0, t0
  17580. @item tint1, t1
  17581. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  17582. This means no tint, and output will remain gray.
  17583. @end table
  17584. @anchor{vidstabdetect}
  17585. @section vidstabdetect
  17586. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  17587. @ref{vidstabtransform} for pass 2.
  17588. This filter generates a file with relative translation and rotation
  17589. transform information about subsequent frames, which is then used by
  17590. the @ref{vidstabtransform} filter.
  17591. To enable compilation of this filter you need to configure FFmpeg with
  17592. @code{--enable-libvidstab}.
  17593. This filter accepts the following options:
  17594. @table @option
  17595. @item result
  17596. Set the path to the file used to write the transforms information.
  17597. Default value is @file{transforms.trf}.
  17598. @item shakiness
  17599. Set how shaky the video is and how quick the camera is. It accepts an
  17600. integer in the range 1-10, a value of 1 means little shakiness, a
  17601. value of 10 means strong shakiness. Default value is 5.
  17602. @item accuracy
  17603. Set the accuracy of the detection process. It must be a value in the
  17604. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  17605. accuracy. Default value is 15.
  17606. @item stepsize
  17607. Set stepsize of the search process. The region around minimum is
  17608. scanned with 1 pixel resolution. Default value is 6.
  17609. @item mincontrast
  17610. Set minimum contrast. Below this value a local measurement field is
  17611. discarded. Must be a floating point value in the range 0-1. Default
  17612. value is 0.3.
  17613. @item tripod
  17614. Set reference frame number for tripod mode.
  17615. If enabled, the motion of the frames is compared to a reference frame
  17616. in the filtered stream, identified by the specified number. The idea
  17617. is to compensate all movements in a more-or-less static scene and keep
  17618. the camera view absolutely still.
  17619. If set to 0, it is disabled. The frames are counted starting from 1.
  17620. @item show
  17621. Show fields and transforms in the resulting frames. It accepts an
  17622. integer in the range 0-2. Default value is 0, which disables any
  17623. visualization.
  17624. @end table
  17625. @subsection Examples
  17626. @itemize
  17627. @item
  17628. Use default values:
  17629. @example
  17630. vidstabdetect
  17631. @end example
  17632. @item
  17633. Analyze strongly shaky movie and put the results in file
  17634. @file{mytransforms.trf}:
  17635. @example
  17636. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  17637. @end example
  17638. @item
  17639. Visualize the result of internal transformations in the resulting
  17640. video:
  17641. @example
  17642. vidstabdetect=show=1
  17643. @end example
  17644. @item
  17645. Analyze a video with medium shakiness using @command{ffmpeg}:
  17646. @example
  17647. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  17648. @end example
  17649. @end itemize
  17650. @anchor{vidstabtransform}
  17651. @section vidstabtransform
  17652. Video stabilization/deshaking: pass 2 of 2,
  17653. see @ref{vidstabdetect} for pass 1.
  17654. Read a file with transform information for each frame and
  17655. apply/compensate them. Together with the @ref{vidstabdetect}
  17656. filter this can be used to deshake videos. See also
  17657. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  17658. the @ref{unsharp} filter, see below.
  17659. To enable compilation of this filter you need to configure FFmpeg with
  17660. @code{--enable-libvidstab}.
  17661. @subsection Options
  17662. @table @option
  17663. @item input
  17664. Set path to the file used to read the transforms. Default value is
  17665. @file{transforms.trf}.
  17666. @item smoothing
  17667. Set the number of frames (value*2 + 1) used for lowpass filtering the
  17668. camera movements. Default value is 10.
  17669. For example a number of 10 means that 21 frames are used (10 in the
  17670. past and 10 in the future) to smoothen the motion in the video. A
  17671. larger value leads to a smoother video, but limits the acceleration of
  17672. the camera (pan/tilt movements). 0 is a special case where a static
  17673. camera is simulated.
  17674. @item optalgo
  17675. Set the camera path optimization algorithm.
  17676. Accepted values are:
  17677. @table @samp
  17678. @item gauss
  17679. gaussian kernel low-pass filter on camera motion (default)
  17680. @item avg
  17681. averaging on transformations
  17682. @end table
  17683. @item maxshift
  17684. Set maximal number of pixels to translate frames. Default value is -1,
  17685. meaning no limit.
  17686. @item maxangle
  17687. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  17688. value is -1, meaning no limit.
  17689. @item crop
  17690. Specify how to deal with borders that may be visible due to movement
  17691. compensation.
  17692. Available values are:
  17693. @table @samp
  17694. @item keep
  17695. keep image information from previous frame (default)
  17696. @item black
  17697. fill the border black
  17698. @end table
  17699. @item invert
  17700. Invert transforms if set to 1. Default value is 0.
  17701. @item relative
  17702. Consider transforms as relative to previous frame if set to 1,
  17703. absolute if set to 0. Default value is 0.
  17704. @item zoom
  17705. Set percentage to zoom. A positive value will result in a zoom-in
  17706. effect, a negative value in a zoom-out effect. Default value is 0 (no
  17707. zoom).
  17708. @item optzoom
  17709. Set optimal zooming to avoid borders.
  17710. Accepted values are:
  17711. @table @samp
  17712. @item 0
  17713. disabled
  17714. @item 1
  17715. optimal static zoom value is determined (only very strong movements
  17716. will lead to visible borders) (default)
  17717. @item 2
  17718. optimal adaptive zoom value is determined (no borders will be
  17719. visible), see @option{zoomspeed}
  17720. @end table
  17721. Note that the value given at zoom is added to the one calculated here.
  17722. @item zoomspeed
  17723. Set percent to zoom maximally each frame (enabled when
  17724. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  17725. 0.25.
  17726. @item interpol
  17727. Specify type of interpolation.
  17728. Available values are:
  17729. @table @samp
  17730. @item no
  17731. no interpolation
  17732. @item linear
  17733. linear only horizontal
  17734. @item bilinear
  17735. linear in both directions (default)
  17736. @item bicubic
  17737. cubic in both directions (slow)
  17738. @end table
  17739. @item tripod
  17740. Enable virtual tripod mode if set to 1, which is equivalent to
  17741. @code{relative=0:smoothing=0}. Default value is 0.
  17742. Use also @code{tripod} option of @ref{vidstabdetect}.
  17743. @item debug
  17744. Increase log verbosity if set to 1. Also the detected global motions
  17745. are written to the temporary file @file{global_motions.trf}. Default
  17746. value is 0.
  17747. @end table
  17748. @subsection Examples
  17749. @itemize
  17750. @item
  17751. Use @command{ffmpeg} for a typical stabilization with default values:
  17752. @example
  17753. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  17754. @end example
  17755. Note the use of the @ref{unsharp} filter which is always recommended.
  17756. @item
  17757. Zoom in a bit more and load transform data from a given file:
  17758. @example
  17759. vidstabtransform=zoom=5:input="mytransforms.trf"
  17760. @end example
  17761. @item
  17762. Smoothen the video even more:
  17763. @example
  17764. vidstabtransform=smoothing=30
  17765. @end example
  17766. @end itemize
  17767. @section vflip
  17768. Flip the input video vertically.
  17769. For example, to vertically flip a video with @command{ffmpeg}:
  17770. @example
  17771. ffmpeg -i in.avi -vf "vflip" out.avi
  17772. @end example
  17773. @section vfrdet
  17774. Detect variable frame rate video.
  17775. This filter tries to detect if the input is variable or constant frame rate.
  17776. At end it will output number of frames detected as having variable delta pts,
  17777. and ones with constant delta pts.
  17778. If there was frames with variable delta, than it will also show min, max and
  17779. average delta encountered.
  17780. @section vibrance
  17781. Boost or alter saturation.
  17782. The filter accepts the following options:
  17783. @table @option
  17784. @item intensity
  17785. Set strength of boost if positive value or strength of alter if negative value.
  17786. Default is 0. Allowed range is from -2 to 2.
  17787. @item rbal
  17788. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  17789. @item gbal
  17790. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  17791. @item bbal
  17792. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  17793. @item rlum
  17794. Set the red luma coefficient.
  17795. @item glum
  17796. Set the green luma coefficient.
  17797. @item blum
  17798. Set the blue luma coefficient.
  17799. @item alternate
  17800. If @code{intensity} is negative and this is set to 1, colors will change,
  17801. otherwise colors will be less saturated, more towards gray.
  17802. @end table
  17803. @subsection Commands
  17804. This filter supports the all above options as @ref{commands}.
  17805. @section vif
  17806. Obtain the average VIF (Visual Information Fidelity) between two input videos.
  17807. This filter takes two input videos.
  17808. Both input videos must have the same resolution and pixel format for
  17809. this filter to work correctly. Also it assumes that both inputs
  17810. have the same number of frames, which are compared one by one.
  17811. The obtained average VIF score is printed through the logging system.
  17812. The filter stores the calculated VIF score of each frame.
  17813. In the below example the input file @file{main.mpg} being processed is compared
  17814. with the reference file @file{ref.mpg}.
  17815. @example
  17816. ffmpeg -i main.mpg -i ref.mpg -lavfi vif -f null -
  17817. @end example
  17818. @anchor{vignette}
  17819. @section vignette
  17820. Make or reverse a natural vignetting effect.
  17821. The filter accepts the following options:
  17822. @table @option
  17823. @item angle, a
  17824. Set lens angle expression as a number of radians.
  17825. The value is clipped in the @code{[0,PI/2]} range.
  17826. Default value: @code{"PI/5"}
  17827. @item x0
  17828. @item y0
  17829. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  17830. by default.
  17831. @item mode
  17832. Set forward/backward mode.
  17833. Available modes are:
  17834. @table @samp
  17835. @item forward
  17836. The larger the distance from the central point, the darker the image becomes.
  17837. @item backward
  17838. The larger the distance from the central point, the brighter the image becomes.
  17839. This can be used to reverse a vignette effect, though there is no automatic
  17840. detection to extract the lens @option{angle} and other settings (yet). It can
  17841. also be used to create a burning effect.
  17842. @end table
  17843. Default value is @samp{forward}.
  17844. @item eval
  17845. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  17846. It accepts the following values:
  17847. @table @samp
  17848. @item init
  17849. Evaluate expressions only once during the filter initialization.
  17850. @item frame
  17851. Evaluate expressions for each incoming frame. This is way slower than the
  17852. @samp{init} mode since it requires all the scalers to be re-computed, but it
  17853. allows advanced dynamic expressions.
  17854. @end table
  17855. Default value is @samp{init}.
  17856. @item dither
  17857. Set dithering to reduce the circular banding effects. Default is @code{1}
  17858. (enabled).
  17859. @item aspect
  17860. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  17861. Setting this value to the SAR of the input will make a rectangular vignetting
  17862. following the dimensions of the video.
  17863. Default is @code{1/1}.
  17864. @end table
  17865. @subsection Expressions
  17866. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  17867. following parameters.
  17868. @table @option
  17869. @item w
  17870. @item h
  17871. input width and height
  17872. @item n
  17873. the number of input frame, starting from 0
  17874. @item pts
  17875. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  17876. @var{TB} units, NAN if undefined
  17877. @item r
  17878. frame rate of the input video, NAN if the input frame rate is unknown
  17879. @item t
  17880. the PTS (Presentation TimeStamp) of the filtered video frame,
  17881. expressed in seconds, NAN if undefined
  17882. @item tb
  17883. time base of the input video
  17884. @end table
  17885. @subsection Examples
  17886. @itemize
  17887. @item
  17888. Apply simple strong vignetting effect:
  17889. @example
  17890. vignette=PI/4
  17891. @end example
  17892. @item
  17893. Make a flickering vignetting:
  17894. @example
  17895. vignette='PI/4+random(1)*PI/50':eval=frame
  17896. @end example
  17897. @end itemize
  17898. @section vmafmotion
  17899. Obtain the average VMAF motion score of a video.
  17900. It is one of the component metrics of VMAF.
  17901. The obtained average motion score is printed through the logging system.
  17902. The filter accepts the following options:
  17903. @table @option
  17904. @item stats_file
  17905. If specified, the filter will use the named file to save the motion score of
  17906. each frame with respect to the previous frame.
  17907. When filename equals "-" the data is sent to standard output.
  17908. @end table
  17909. Example:
  17910. @example
  17911. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  17912. @end example
  17913. @section vstack
  17914. Stack input videos vertically.
  17915. All streams must be of same pixel format and of same width.
  17916. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  17917. to create same output.
  17918. The filter accepts the following options:
  17919. @table @option
  17920. @item inputs
  17921. Set number of input streams. Default is 2.
  17922. @item shortest
  17923. If set to 1, force the output to terminate when the shortest input
  17924. terminates. Default value is 0.
  17925. @end table
  17926. @section w3fdif
  17927. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  17928. Deinterlacing Filter").
  17929. Based on the process described by Martin Weston for BBC R&D, and
  17930. implemented based on the de-interlace algorithm written by Jim
  17931. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  17932. uses filter coefficients calculated by BBC R&D.
  17933. This filter uses field-dominance information in frame to decide which
  17934. of each pair of fields to place first in the output.
  17935. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  17936. There are two sets of filter coefficients, so called "simple"
  17937. and "complex". Which set of filter coefficients is used can
  17938. be set by passing an optional parameter:
  17939. @table @option
  17940. @item filter
  17941. Set the interlacing filter coefficients. Accepts one of the following values:
  17942. @table @samp
  17943. @item simple
  17944. Simple filter coefficient set.
  17945. @item complex
  17946. More-complex filter coefficient set.
  17947. @end table
  17948. Default value is @samp{complex}.
  17949. @item mode
  17950. The interlacing mode to adopt. It accepts one of the following values:
  17951. @table @option
  17952. @item frame
  17953. Output one frame for each frame.
  17954. @item field
  17955. Output one frame for each field.
  17956. @end table
  17957. The default value is @code{field}.
  17958. @item parity
  17959. The picture field parity assumed for the input interlaced video. It accepts one
  17960. of the following values:
  17961. @table @option
  17962. @item tff
  17963. Assume the top field is first.
  17964. @item bff
  17965. Assume the bottom field is first.
  17966. @item auto
  17967. Enable automatic detection of field parity.
  17968. @end table
  17969. The default value is @code{auto}.
  17970. If the interlacing is unknown or the decoder does not export this information,
  17971. top field first will be assumed.
  17972. @item deint
  17973. Specify which frames to deinterlace. Accepts one of the following values:
  17974. @table @samp
  17975. @item all
  17976. Deinterlace all frames,
  17977. @item interlaced
  17978. Only deinterlace frames marked as interlaced.
  17979. @end table
  17980. Default value is @samp{all}.
  17981. @end table
  17982. @subsection Commands
  17983. This filter supports same @ref{commands} as options.
  17984. @section waveform
  17985. Video waveform monitor.
  17986. The waveform monitor plots color component intensity. By default luminance
  17987. only. Each column of the waveform corresponds to a column of pixels in the
  17988. source video.
  17989. It accepts the following options:
  17990. @table @option
  17991. @item mode, m
  17992. Can be either @code{row}, or @code{column}. Default is @code{column}.
  17993. In row mode, the graph on the left side represents color component value 0 and
  17994. the right side represents value = 255. In column mode, the top side represents
  17995. color component value = 0 and bottom side represents value = 255.
  17996. @item intensity, i
  17997. Set intensity. Smaller values are useful to find out how many values of the same
  17998. luminance are distributed across input rows/columns.
  17999. Default value is @code{0.04}. Allowed range is [0, 1].
  18000. @item mirror, r
  18001. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  18002. In mirrored mode, higher values will be represented on the left
  18003. side for @code{row} mode and at the top for @code{column} mode. Default is
  18004. @code{1} (mirrored).
  18005. @item display, d
  18006. Set display mode.
  18007. It accepts the following values:
  18008. @table @samp
  18009. @item overlay
  18010. Presents information identical to that in the @code{parade}, except
  18011. that the graphs representing color components are superimposed directly
  18012. over one another.
  18013. This display mode makes it easier to spot relative differences or similarities
  18014. in overlapping areas of the color components that are supposed to be identical,
  18015. such as neutral whites, grays, or blacks.
  18016. @item stack
  18017. Display separate graph for the color components side by side in
  18018. @code{row} mode or one below the other in @code{column} mode.
  18019. @item parade
  18020. Display separate graph for the color components side by side in
  18021. @code{column} mode or one below the other in @code{row} mode.
  18022. Using this display mode makes it easy to spot color casts in the highlights
  18023. and shadows of an image, by comparing the contours of the top and the bottom
  18024. graphs of each waveform. Since whites, grays, and blacks are characterized
  18025. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  18026. should display three waveforms of roughly equal width/height. If not, the
  18027. correction is easy to perform by making level adjustments the three waveforms.
  18028. @end table
  18029. Default is @code{stack}.
  18030. @item components, c
  18031. Set which color components to display. Default is 1, which means only luminance
  18032. or red color component if input is in RGB colorspace. If is set for example to
  18033. 7 it will display all 3 (if) available color components.
  18034. @item envelope, e
  18035. @table @samp
  18036. @item none
  18037. No envelope, this is default.
  18038. @item instant
  18039. Instant envelope, minimum and maximum values presented in graph will be easily
  18040. visible even with small @code{step} value.
  18041. @item peak
  18042. Hold minimum and maximum values presented in graph across time. This way you
  18043. can still spot out of range values without constantly looking at waveforms.
  18044. @item peak+instant
  18045. Peak and instant envelope combined together.
  18046. @end table
  18047. @item filter, f
  18048. @table @samp
  18049. @item lowpass
  18050. No filtering, this is default.
  18051. @item flat
  18052. Luma and chroma combined together.
  18053. @item aflat
  18054. Similar as above, but shows difference between blue and red chroma.
  18055. @item xflat
  18056. Similar as above, but use different colors.
  18057. @item yflat
  18058. Similar as above, but again with different colors.
  18059. @item chroma
  18060. Displays only chroma.
  18061. @item color
  18062. Displays actual color value on waveform.
  18063. @item acolor
  18064. Similar as above, but with luma showing frequency of chroma values.
  18065. @end table
  18066. @item graticule, g
  18067. Set which graticule to display.
  18068. @table @samp
  18069. @item none
  18070. Do not display graticule.
  18071. @item green
  18072. Display green graticule showing legal broadcast ranges.
  18073. @item orange
  18074. Display orange graticule showing legal broadcast ranges.
  18075. @item invert
  18076. Display invert graticule showing legal broadcast ranges.
  18077. @end table
  18078. @item opacity, o
  18079. Set graticule opacity.
  18080. @item flags, fl
  18081. Set graticule flags.
  18082. @table @samp
  18083. @item numbers
  18084. Draw numbers above lines. By default enabled.
  18085. @item dots
  18086. Draw dots instead of lines.
  18087. @end table
  18088. @item scale, s
  18089. Set scale used for displaying graticule.
  18090. @table @samp
  18091. @item digital
  18092. @item millivolts
  18093. @item ire
  18094. @end table
  18095. Default is digital.
  18096. @item bgopacity, b
  18097. Set background opacity.
  18098. @item tint0, t0
  18099. @item tint1, t1
  18100. Set tint for output.
  18101. Only used with lowpass filter and when display is not overlay and input
  18102. pixel formats are not RGB.
  18103. @item fitmode, fm
  18104. Set sample aspect ratio of video output frames.
  18105. Can be used to configure waveform so it is not
  18106. streched too much in one of directions.
  18107. @table @samp
  18108. @item none
  18109. Set sample aspect ration to 1/1.
  18110. @item size
  18111. Set sample aspect ratio to match input size of video
  18112. @end table
  18113. Default is @samp{none}.
  18114. @end table
  18115. @section weave, doubleweave
  18116. The @code{weave} takes a field-based video input and join
  18117. each two sequential fields into single frame, producing a new double
  18118. height clip with half the frame rate and half the frame count.
  18119. The @code{doubleweave} works same as @code{weave} but without
  18120. halving frame rate and frame count.
  18121. It accepts the following option:
  18122. @table @option
  18123. @item first_field
  18124. Set first field. Available values are:
  18125. @table @samp
  18126. @item top, t
  18127. Set the frame as top-field-first.
  18128. @item bottom, b
  18129. Set the frame as bottom-field-first.
  18130. @end table
  18131. @end table
  18132. @subsection Examples
  18133. @itemize
  18134. @item
  18135. Interlace video using @ref{select} and @ref{separatefields} filter:
  18136. @example
  18137. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  18138. @end example
  18139. @end itemize
  18140. @section xbr
  18141. Apply the xBR high-quality magnification filter which is designed for pixel
  18142. art. It follows a set of edge-detection rules, see
  18143. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  18144. It accepts the following option:
  18145. @table @option
  18146. @item n
  18147. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  18148. @code{3xBR} and @code{4} for @code{4xBR}.
  18149. Default is @code{3}.
  18150. @end table
  18151. @section xcorrelate
  18152. Apply normalized cross-correlation between first and second input video stream.
  18153. Second input video stream dimensions must be lower than first input video stream.
  18154. The filter accepts the following options:
  18155. @table @option
  18156. @item planes
  18157. Set which planes to process.
  18158. @item secondary
  18159. Set which secondary video frames will be processed from second input video stream,
  18160. can be @var{first} or @var{all}. Default is @var{all}.
  18161. @end table
  18162. The @code{xcorrelate} filter also supports the @ref{framesync} options.
  18163. @section xfade
  18164. Apply cross fade from one input video stream to another input video stream.
  18165. The cross fade is applied for specified duration.
  18166. Both inputs must be constant frame-rate and have the same resolution, pixel format,
  18167. frame rate and timebase.
  18168. The filter accepts the following options:
  18169. @table @option
  18170. @item transition
  18171. Set one of available transition effects:
  18172. @table @samp
  18173. @item custom
  18174. @item fade
  18175. @item wipeleft
  18176. @item wiperight
  18177. @item wipeup
  18178. @item wipedown
  18179. @item slideleft
  18180. @item slideright
  18181. @item slideup
  18182. @item slidedown
  18183. @item circlecrop
  18184. @item rectcrop
  18185. @item distance
  18186. @item fadeblack
  18187. @item fadewhite
  18188. @item radial
  18189. @item smoothleft
  18190. @item smoothright
  18191. @item smoothup
  18192. @item smoothdown
  18193. @item circleopen
  18194. @item circleclose
  18195. @item vertopen
  18196. @item vertclose
  18197. @item horzopen
  18198. @item horzclose
  18199. @item dissolve
  18200. @item pixelize
  18201. @item diagtl
  18202. @item diagtr
  18203. @item diagbl
  18204. @item diagbr
  18205. @item hlslice
  18206. @item hrslice
  18207. @item vuslice
  18208. @item vdslice
  18209. @item hblur
  18210. @item fadegrays
  18211. @item wipetl
  18212. @item wipetr
  18213. @item wipebl
  18214. @item wipebr
  18215. @item squeezeh
  18216. @item squeezev
  18217. @item zoomin
  18218. @end table
  18219. Default transition effect is fade.
  18220. @item duration
  18221. Set cross fade duration in seconds.
  18222. Range is 0 to 60 seconds.
  18223. Default duration is 1 second.
  18224. @item offset
  18225. Set cross fade start relative to first input stream in seconds.
  18226. Default offset is 0.
  18227. @item expr
  18228. Set expression for custom transition effect.
  18229. The expressions can use the following variables and functions:
  18230. @table @option
  18231. @item X
  18232. @item Y
  18233. The coordinates of the current sample.
  18234. @item W
  18235. @item H
  18236. The width and height of the image.
  18237. @item P
  18238. Progress of transition effect.
  18239. @item PLANE
  18240. Currently processed plane.
  18241. @item A
  18242. Return value of first input at current location and plane.
  18243. @item B
  18244. Return value of second input at current location and plane.
  18245. @item a0(x, y)
  18246. @item a1(x, y)
  18247. @item a2(x, y)
  18248. @item a3(x, y)
  18249. Return the value of the pixel at location (@var{x},@var{y}) of the
  18250. first/second/third/fourth component of first input.
  18251. @item b0(x, y)
  18252. @item b1(x, y)
  18253. @item b2(x, y)
  18254. @item b3(x, y)
  18255. Return the value of the pixel at location (@var{x},@var{y}) of the
  18256. first/second/third/fourth component of second input.
  18257. @end table
  18258. @end table
  18259. @subsection Examples
  18260. @itemize
  18261. @item
  18262. Cross fade from one input video to another input video, with fade transition and duration of transition
  18263. of 2 seconds starting at offset of 5 seconds:
  18264. @example
  18265. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  18266. @end example
  18267. @end itemize
  18268. @section xmedian
  18269. Pick median pixels from several input videos.
  18270. The filter accepts the following options:
  18271. @table @option
  18272. @item inputs
  18273. Set number of inputs.
  18274. Default is 3. Allowed range is from 3 to 255.
  18275. If number of inputs is even number, than result will be mean value between two median values.
  18276. @item planes
  18277. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  18278. @item percentile
  18279. Set median percentile. Default value is @code{0.5}.
  18280. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  18281. minimum values, and @code{1} maximum values.
  18282. @end table
  18283. @subsection Commands
  18284. This filter supports all above options as @ref{commands}, excluding option @code{inputs}.
  18285. @section xstack
  18286. Stack video inputs into custom layout.
  18287. All streams must be of same pixel format.
  18288. The filter accepts the following options:
  18289. @table @option
  18290. @item inputs
  18291. Set number of input streams. Default is 2.
  18292. @item layout
  18293. Specify layout of inputs.
  18294. This option requires the desired layout configuration to be explicitly set by the user.
  18295. This sets position of each video input in output. Each input
  18296. is separated by '|'.
  18297. The first number represents the column, and the second number represents the row.
  18298. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  18299. where X is video input from which to take width or height.
  18300. Multiple values can be used when separated by '+'. In such
  18301. case values are summed together.
  18302. Note that if inputs are of different sizes gaps may appear, as not all of
  18303. the output video frame will be filled. Similarly, videos can overlap each
  18304. other if their position doesn't leave enough space for the full frame of
  18305. adjoining videos.
  18306. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  18307. a layout must be set by the user.
  18308. @item shortest
  18309. If set to 1, force the output to terminate when the shortest input
  18310. terminates. Default value is 0.
  18311. @item fill
  18312. If set to valid color, all unused pixels will be filled with that color.
  18313. By default fill is set to none, so it is disabled.
  18314. @end table
  18315. @subsection Examples
  18316. @itemize
  18317. @item
  18318. Display 4 inputs into 2x2 grid.
  18319. Layout:
  18320. @example
  18321. input1(0, 0) | input3(w0, 0)
  18322. input2(0, h0) | input4(w0, h0)
  18323. @end example
  18324. @example
  18325. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  18326. @end example
  18327. Note that if inputs are of different sizes, gaps or overlaps may occur.
  18328. @item
  18329. Display 4 inputs into 1x4 grid.
  18330. Layout:
  18331. @example
  18332. input1(0, 0)
  18333. input2(0, h0)
  18334. input3(0, h0+h1)
  18335. input4(0, h0+h1+h2)
  18336. @end example
  18337. @example
  18338. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  18339. @end example
  18340. Note that if inputs are of different widths, unused space will appear.
  18341. @item
  18342. Display 9 inputs into 3x3 grid.
  18343. Layout:
  18344. @example
  18345. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  18346. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  18347. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  18348. @end example
  18349. @example
  18350. 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
  18351. @end example
  18352. Note that if inputs are of different sizes, gaps or overlaps may occur.
  18353. @item
  18354. Display 16 inputs into 4x4 grid.
  18355. Layout:
  18356. @example
  18357. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  18358. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  18359. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  18360. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  18361. @end example
  18362. @example
  18363. 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|
  18364. 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
  18365. @end example
  18366. Note that if inputs are of different sizes, gaps or overlaps may occur.
  18367. @end itemize
  18368. @anchor{yadif}
  18369. @section yadif
  18370. Deinterlace the input video ("yadif" means "yet another deinterlacing
  18371. filter").
  18372. It accepts the following parameters:
  18373. @table @option
  18374. @item mode
  18375. The interlacing mode to adopt. It accepts one of the following values:
  18376. @table @option
  18377. @item 0, send_frame
  18378. Output one frame for each frame.
  18379. @item 1, send_field
  18380. Output one frame for each field.
  18381. @item 2, send_frame_nospatial
  18382. Like @code{send_frame}, but it skips the spatial interlacing check.
  18383. @item 3, send_field_nospatial
  18384. Like @code{send_field}, but it skips the spatial interlacing check.
  18385. @end table
  18386. The default value is @code{send_frame}.
  18387. @item parity
  18388. The picture field parity assumed for the input interlaced video. It accepts one
  18389. of the following values:
  18390. @table @option
  18391. @item 0, tff
  18392. Assume the top field is first.
  18393. @item 1, bff
  18394. Assume the bottom field is first.
  18395. @item -1, auto
  18396. Enable automatic detection of field parity.
  18397. @end table
  18398. The default value is @code{auto}.
  18399. If the interlacing is unknown or the decoder does not export this information,
  18400. top field first will be assumed.
  18401. @item deint
  18402. Specify which frames to deinterlace. Accepts one of the following
  18403. values:
  18404. @table @option
  18405. @item 0, all
  18406. Deinterlace all frames.
  18407. @item 1, interlaced
  18408. Only deinterlace frames marked as interlaced.
  18409. @end table
  18410. The default value is @code{all}.
  18411. @end table
  18412. @section yadif_cuda
  18413. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  18414. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  18415. and/or nvenc.
  18416. It accepts the following parameters:
  18417. @table @option
  18418. @item mode
  18419. The interlacing mode to adopt. It accepts one of the following values:
  18420. @table @option
  18421. @item 0, send_frame
  18422. Output one frame for each frame.
  18423. @item 1, send_field
  18424. Output one frame for each field.
  18425. @item 2, send_frame_nospatial
  18426. Like @code{send_frame}, but it skips the spatial interlacing check.
  18427. @item 3, send_field_nospatial
  18428. Like @code{send_field}, but it skips the spatial interlacing check.
  18429. @end table
  18430. The default value is @code{send_frame}.
  18431. @item parity
  18432. The picture field parity assumed for the input interlaced video. It accepts one
  18433. of the following values:
  18434. @table @option
  18435. @item 0, tff
  18436. Assume the top field is first.
  18437. @item 1, bff
  18438. Assume the bottom field is first.
  18439. @item -1, auto
  18440. Enable automatic detection of field parity.
  18441. @end table
  18442. The default value is @code{auto}.
  18443. If the interlacing is unknown or the decoder does not export this information,
  18444. top field first will be assumed.
  18445. @item deint
  18446. Specify which frames to deinterlace. Accepts one of the following
  18447. values:
  18448. @table @option
  18449. @item 0, all
  18450. Deinterlace all frames.
  18451. @item 1, interlaced
  18452. Only deinterlace frames marked as interlaced.
  18453. @end table
  18454. The default value is @code{all}.
  18455. @end table
  18456. @section yaepblur
  18457. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  18458. The algorithm is described in
  18459. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  18460. It accepts the following parameters:
  18461. @table @option
  18462. @item radius, r
  18463. Set the window radius. Default value is 3.
  18464. @item planes, p
  18465. Set which planes to filter. Default is only the first plane.
  18466. @item sigma, s
  18467. Set blur strength. Default value is 128.
  18468. @end table
  18469. @subsection Commands
  18470. This filter supports same @ref{commands} as options.
  18471. @section zoompan
  18472. Apply Zoom & Pan effect.
  18473. This filter accepts the following options:
  18474. @table @option
  18475. @item zoom, z
  18476. Set the zoom expression. Range is 1-10. Default is 1.
  18477. @item x
  18478. @item y
  18479. Set the x and y expression. Default is 0.
  18480. @item d
  18481. Set the duration expression in number of frames.
  18482. This sets for how many number of frames effect will last for
  18483. single input image. Default is 90.
  18484. @item s
  18485. Set the output image size, default is 'hd720'.
  18486. @item fps
  18487. Set the output frame rate, default is '25'.
  18488. @end table
  18489. Each expression can contain the following constants:
  18490. @table @option
  18491. @item in_w, iw
  18492. Input width.
  18493. @item in_h, ih
  18494. Input height.
  18495. @item out_w, ow
  18496. Output width.
  18497. @item out_h, oh
  18498. Output height.
  18499. @item in
  18500. Input frame count.
  18501. @item on
  18502. Output frame count.
  18503. @item in_time, it
  18504. The input timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  18505. @item out_time, time, ot
  18506. The output timestamp expressed in seconds.
  18507. @item x
  18508. @item y
  18509. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  18510. for current input frame.
  18511. @item px
  18512. @item py
  18513. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  18514. not yet such frame (first input frame).
  18515. @item zoom
  18516. Last calculated zoom from 'z' expression for current input frame.
  18517. @item pzoom
  18518. Last calculated zoom of last output frame of previous input frame.
  18519. @item duration
  18520. Number of output frames for current input frame. Calculated from 'd' expression
  18521. for each input frame.
  18522. @item pduration
  18523. number of output frames created for previous input frame
  18524. @item a
  18525. Rational number: input width / input height
  18526. @item sar
  18527. sample aspect ratio
  18528. @item dar
  18529. display aspect ratio
  18530. @end table
  18531. @subsection Examples
  18532. @itemize
  18533. @item
  18534. Zoom in up to 1.5x and pan at same time to some spot near center of picture:
  18535. @example
  18536. 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
  18537. @end example
  18538. @item
  18539. Zoom in up to 1.5x and pan always at center of picture:
  18540. @example
  18541. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  18542. @end example
  18543. @item
  18544. Same as above but without pausing:
  18545. @example
  18546. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  18547. @end example
  18548. @item
  18549. Zoom in 2x into center of picture only for the first second of the input video:
  18550. @example
  18551. zoompan=z='if(between(in_time,0,1),2,1)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  18552. @end example
  18553. @end itemize
  18554. @anchor{zscale}
  18555. @section zscale
  18556. Scale (resize) the input video, using the z.lib library:
  18557. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  18558. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  18559. The zscale filter forces the output display aspect ratio to be the same
  18560. as the input, by changing the output sample aspect ratio.
  18561. If the input image format is different from the format requested by
  18562. the next filter, the zscale filter will convert the input to the
  18563. requested format.
  18564. @subsection Options
  18565. The filter accepts the following options.
  18566. @table @option
  18567. @item width, w
  18568. @item height, h
  18569. Set the output video dimension expression. Default value is the input
  18570. dimension.
  18571. If the @var{width} or @var{w} value is 0, the input width is used for
  18572. the output. If the @var{height} or @var{h} value is 0, the input height
  18573. is used for the output.
  18574. If one and only one of the values is -n with n >= 1, the zscale filter
  18575. will use a value that maintains the aspect ratio of the input image,
  18576. calculated from the other specified dimension. After that it will,
  18577. however, make sure that the calculated dimension is divisible by n and
  18578. adjust the value if necessary.
  18579. If both values are -n with n >= 1, the behavior will be identical to
  18580. both values being set to 0 as previously detailed.
  18581. See below for the list of accepted constants for use in the dimension
  18582. expression.
  18583. @item size, s
  18584. Set the video size. For the syntax of this option, check the
  18585. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18586. @item dither, d
  18587. Set the dither type.
  18588. Possible values are:
  18589. @table @var
  18590. @item none
  18591. @item ordered
  18592. @item random
  18593. @item error_diffusion
  18594. @end table
  18595. Default is none.
  18596. @item filter, f
  18597. Set the resize filter type.
  18598. Possible values are:
  18599. @table @var
  18600. @item point
  18601. @item bilinear
  18602. @item bicubic
  18603. @item spline16
  18604. @item spline36
  18605. @item lanczos
  18606. @end table
  18607. Default is bilinear.
  18608. @item range, r
  18609. Set the color range.
  18610. Possible values are:
  18611. @table @var
  18612. @item input
  18613. @item limited
  18614. @item full
  18615. @end table
  18616. Default is same as input.
  18617. @item primaries, p
  18618. Set the color primaries.
  18619. Possible values are:
  18620. @table @var
  18621. @item input
  18622. @item 709
  18623. @item unspecified
  18624. @item 170m
  18625. @item 240m
  18626. @item 2020
  18627. @end table
  18628. Default is same as input.
  18629. @item transfer, t
  18630. Set the transfer characteristics.
  18631. Possible values are:
  18632. @table @var
  18633. @item input
  18634. @item 709
  18635. @item unspecified
  18636. @item 601
  18637. @item linear
  18638. @item 2020_10
  18639. @item 2020_12
  18640. @item smpte2084
  18641. @item iec61966-2-1
  18642. @item arib-std-b67
  18643. @end table
  18644. Default is same as input.
  18645. @item matrix, m
  18646. Set the colorspace matrix.
  18647. Possible value are:
  18648. @table @var
  18649. @item input
  18650. @item 709
  18651. @item unspecified
  18652. @item 470bg
  18653. @item 170m
  18654. @item 2020_ncl
  18655. @item 2020_cl
  18656. @end table
  18657. Default is same as input.
  18658. @item rangein, rin
  18659. Set the input color range.
  18660. Possible values are:
  18661. @table @var
  18662. @item input
  18663. @item limited
  18664. @item full
  18665. @end table
  18666. Default is same as input.
  18667. @item primariesin, pin
  18668. Set the input color primaries.
  18669. Possible values are:
  18670. @table @var
  18671. @item input
  18672. @item 709
  18673. @item unspecified
  18674. @item 170m
  18675. @item 240m
  18676. @item 2020
  18677. @end table
  18678. Default is same as input.
  18679. @item transferin, tin
  18680. Set the input transfer characteristics.
  18681. Possible values are:
  18682. @table @var
  18683. @item input
  18684. @item 709
  18685. @item unspecified
  18686. @item 601
  18687. @item linear
  18688. @item 2020_10
  18689. @item 2020_12
  18690. @end table
  18691. Default is same as input.
  18692. @item matrixin, min
  18693. Set the input colorspace matrix.
  18694. Possible value are:
  18695. @table @var
  18696. @item input
  18697. @item 709
  18698. @item unspecified
  18699. @item 470bg
  18700. @item 170m
  18701. @item 2020_ncl
  18702. @item 2020_cl
  18703. @end table
  18704. @item chromal, c
  18705. Set the output chroma location.
  18706. Possible values are:
  18707. @table @var
  18708. @item input
  18709. @item left
  18710. @item center
  18711. @item topleft
  18712. @item top
  18713. @item bottomleft
  18714. @item bottom
  18715. @end table
  18716. @item chromalin, cin
  18717. Set the input chroma location.
  18718. Possible values are:
  18719. @table @var
  18720. @item input
  18721. @item left
  18722. @item center
  18723. @item topleft
  18724. @item top
  18725. @item bottomleft
  18726. @item bottom
  18727. @end table
  18728. @item npl
  18729. Set the nominal peak luminance.
  18730. @item param_a
  18731. Parameter A for scaling filters. Parameter "b" for bicubic, and the number of
  18732. filter taps for lanczos.
  18733. @item param_b
  18734. Parameter B for scaling filters. Parameter "c" for bicubic.
  18735. @end table
  18736. The values of the @option{w} and @option{h} options are expressions
  18737. containing the following constants:
  18738. @table @var
  18739. @item in_w
  18740. @item in_h
  18741. The input width and height
  18742. @item iw
  18743. @item ih
  18744. These are the same as @var{in_w} and @var{in_h}.
  18745. @item out_w
  18746. @item out_h
  18747. The output (scaled) width and height
  18748. @item ow
  18749. @item oh
  18750. These are the same as @var{out_w} and @var{out_h}
  18751. @item a
  18752. The same as @var{iw} / @var{ih}
  18753. @item sar
  18754. input sample aspect ratio
  18755. @item dar
  18756. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  18757. @item hsub
  18758. @item vsub
  18759. horizontal and vertical input chroma subsample values. For example for the
  18760. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  18761. @item ohsub
  18762. @item ovsub
  18763. horizontal and vertical output chroma subsample values. For example for the
  18764. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  18765. @end table
  18766. @subsection Commands
  18767. This filter supports the following commands:
  18768. @table @option
  18769. @item width, w
  18770. @item height, h
  18771. Set the output video dimension expression.
  18772. The command accepts the same syntax of the corresponding option.
  18773. If the specified expression is not valid, it is kept at its current
  18774. value.
  18775. @end table
  18776. @c man end VIDEO FILTERS
  18777. @chapter OpenCL Video Filters
  18778. @c man begin OPENCL VIDEO FILTERS
  18779. Below is a description of the currently available OpenCL video filters.
  18780. To enable compilation of these filters you need to configure FFmpeg with
  18781. @code{--enable-opencl}.
  18782. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  18783. @table @option
  18784. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  18785. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  18786. given device parameters.
  18787. @item -filter_hw_device @var{name}
  18788. Pass the hardware device called @var{name} to all filters in any filter graph.
  18789. @end table
  18790. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  18791. @itemize
  18792. @item
  18793. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  18794. @example
  18795. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  18796. @end example
  18797. @end itemize
  18798. 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.
  18799. @section avgblur_opencl
  18800. Apply average blur filter.
  18801. The filter accepts the following options:
  18802. @table @option
  18803. @item sizeX
  18804. Set horizontal radius size.
  18805. Range is @code{[1, 1024]} and default value is @code{1}.
  18806. @item planes
  18807. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  18808. @item sizeY
  18809. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  18810. @end table
  18811. @subsection Example
  18812. @itemize
  18813. @item
  18814. 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.
  18815. @example
  18816. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  18817. @end example
  18818. @end itemize
  18819. @section boxblur_opencl
  18820. Apply a boxblur algorithm to the input video.
  18821. It accepts the following parameters:
  18822. @table @option
  18823. @item luma_radius, lr
  18824. @item luma_power, lp
  18825. @item chroma_radius, cr
  18826. @item chroma_power, cp
  18827. @item alpha_radius, ar
  18828. @item alpha_power, ap
  18829. @end table
  18830. A description of the accepted options follows.
  18831. @table @option
  18832. @item luma_radius, lr
  18833. @item chroma_radius, cr
  18834. @item alpha_radius, ar
  18835. Set an expression for the box radius in pixels used for blurring the
  18836. corresponding input plane.
  18837. The radius value must be a non-negative number, and must not be
  18838. greater than the value of the expression @code{min(w,h)/2} for the
  18839. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  18840. planes.
  18841. Default value for @option{luma_radius} is "2". If not specified,
  18842. @option{chroma_radius} and @option{alpha_radius} default to the
  18843. corresponding value set for @option{luma_radius}.
  18844. The expressions can contain the following constants:
  18845. @table @option
  18846. @item w
  18847. @item h
  18848. The input width and height in pixels.
  18849. @item cw
  18850. @item ch
  18851. The input chroma image width and height in pixels.
  18852. @item hsub
  18853. @item vsub
  18854. The horizontal and vertical chroma subsample values. For example, for the
  18855. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  18856. @end table
  18857. @item luma_power, lp
  18858. @item chroma_power, cp
  18859. @item alpha_power, ap
  18860. Specify how many times the boxblur filter is applied to the
  18861. corresponding plane.
  18862. Default value for @option{luma_power} is 2. If not specified,
  18863. @option{chroma_power} and @option{alpha_power} default to the
  18864. corresponding value set for @option{luma_power}.
  18865. A value of 0 will disable the effect.
  18866. @end table
  18867. @subsection Examples
  18868. 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.
  18869. @itemize
  18870. @item
  18871. Apply a boxblur filter with the luma, chroma, and alpha radius
  18872. 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.
  18873. @example
  18874. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  18875. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  18876. @end example
  18877. @item
  18878. 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.
  18879. For the luma plane, a 2x2 box radius will be run once.
  18880. For the chroma plane, a 4x4 box radius will be run 5 times.
  18881. For the alpha plane, a 3x3 box radius will be run 7 times.
  18882. @example
  18883. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  18884. @end example
  18885. @end itemize
  18886. @section colorkey_opencl
  18887. RGB colorspace color keying.
  18888. The filter accepts the following options:
  18889. @table @option
  18890. @item color
  18891. The color which will be replaced with transparency.
  18892. @item similarity
  18893. Similarity percentage with the key color.
  18894. 0.01 matches only the exact key color, while 1.0 matches everything.
  18895. @item blend
  18896. Blend percentage.
  18897. 0.0 makes pixels either fully transparent, or not transparent at all.
  18898. Higher values result in semi-transparent pixels, with a higher transparency
  18899. the more similar the pixels color is to the key color.
  18900. @end table
  18901. @subsection Examples
  18902. @itemize
  18903. @item
  18904. Make every semi-green pixel in the input transparent with some slight blending:
  18905. @example
  18906. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  18907. @end example
  18908. @end itemize
  18909. @section convolution_opencl
  18910. Apply convolution of 3x3, 5x5, 7x7 matrix.
  18911. The filter accepts the following options:
  18912. @table @option
  18913. @item 0m
  18914. @item 1m
  18915. @item 2m
  18916. @item 3m
  18917. Set matrix for each plane.
  18918. Matrix is sequence of 9, 25 or 49 signed numbers.
  18919. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  18920. @item 0rdiv
  18921. @item 1rdiv
  18922. @item 2rdiv
  18923. @item 3rdiv
  18924. Set multiplier for calculated value for each plane.
  18925. If unset or 0, it will be sum of all matrix elements.
  18926. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  18927. @item 0bias
  18928. @item 1bias
  18929. @item 2bias
  18930. @item 3bias
  18931. Set bias for each plane. This value is added to the result of the multiplication.
  18932. Useful for making the overall image brighter or darker.
  18933. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  18934. @end table
  18935. @subsection Examples
  18936. @itemize
  18937. @item
  18938. Apply sharpen:
  18939. @example
  18940. -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
  18941. @end example
  18942. @item
  18943. Apply blur:
  18944. @example
  18945. -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
  18946. @end example
  18947. @item
  18948. Apply edge enhance:
  18949. @example
  18950. -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
  18951. @end example
  18952. @item
  18953. Apply edge detect:
  18954. @example
  18955. -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
  18956. @end example
  18957. @item
  18958. Apply laplacian edge detector which includes diagonals:
  18959. @example
  18960. -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
  18961. @end example
  18962. @item
  18963. Apply emboss:
  18964. @example
  18965. -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
  18966. @end example
  18967. @end itemize
  18968. @section erosion_opencl
  18969. Apply erosion effect to the video.
  18970. This filter replaces the pixel by the local(3x3) minimum.
  18971. It accepts the following options:
  18972. @table @option
  18973. @item threshold0
  18974. @item threshold1
  18975. @item threshold2
  18976. @item threshold3
  18977. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  18978. If @code{0}, plane will remain unchanged.
  18979. @item coordinates
  18980. Flag which specifies the pixel to refer to.
  18981. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  18982. Flags to local 3x3 coordinates region centered on @code{x}:
  18983. 1 2 3
  18984. 4 x 5
  18985. 6 7 8
  18986. @end table
  18987. @subsection Example
  18988. @itemize
  18989. @item
  18990. 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.
  18991. @example
  18992. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  18993. @end example
  18994. @end itemize
  18995. @section deshake_opencl
  18996. Feature-point based video stabilization filter.
  18997. The filter accepts the following options:
  18998. @table @option
  18999. @item tripod
  19000. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  19001. @item debug
  19002. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  19003. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  19004. Viewing point matches in the output video is only supported for RGB input.
  19005. Defaults to @code{0}.
  19006. @item adaptive_crop
  19007. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  19008. Defaults to @code{1}.
  19009. @item refine_features
  19010. Whether or not feature points should be refined at a sub-pixel level.
  19011. This can be turned off for a slight performance gain at the cost of precision.
  19012. Defaults to @code{1}.
  19013. @item smooth_strength
  19014. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  19015. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  19016. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  19017. Defaults to @code{0.0}.
  19018. @item smooth_window_multiplier
  19019. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  19020. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  19021. Acceptable values range from @code{0.1} to @code{10.0}.
  19022. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  19023. potentially improving smoothness, but also increase latency and memory usage.
  19024. Defaults to @code{2.0}.
  19025. @end table
  19026. @subsection Examples
  19027. @itemize
  19028. @item
  19029. Stabilize a video with a fixed, medium smoothing strength:
  19030. @example
  19031. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  19032. @end example
  19033. @item
  19034. Stabilize a video with debugging (both in console and in rendered video):
  19035. @example
  19036. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  19037. @end example
  19038. @end itemize
  19039. @section dilation_opencl
  19040. Apply dilation effect to the video.
  19041. This filter replaces the pixel by the local(3x3) maximum.
  19042. It accepts the following options:
  19043. @table @option
  19044. @item threshold0
  19045. @item threshold1
  19046. @item threshold2
  19047. @item threshold3
  19048. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  19049. If @code{0}, plane will remain unchanged.
  19050. @item coordinates
  19051. Flag which specifies the pixel to refer to.
  19052. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  19053. Flags to local 3x3 coordinates region centered on @code{x}:
  19054. 1 2 3
  19055. 4 x 5
  19056. 6 7 8
  19057. @end table
  19058. @subsection Example
  19059. @itemize
  19060. @item
  19061. 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.
  19062. @example
  19063. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  19064. @end example
  19065. @end itemize
  19066. @section nlmeans_opencl
  19067. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  19068. @section overlay_opencl
  19069. Overlay one video on top of another.
  19070. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  19071. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  19072. The filter accepts the following options:
  19073. @table @option
  19074. @item x
  19075. Set the x coordinate of the overlaid video on the main video.
  19076. Default value is @code{0}.
  19077. @item y
  19078. Set the y coordinate of the overlaid video on the main video.
  19079. Default value is @code{0}.
  19080. @end table
  19081. @subsection Examples
  19082. @itemize
  19083. @item
  19084. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  19085. @example
  19086. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  19087. @end example
  19088. @item
  19089. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  19090. @example
  19091. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  19092. @end example
  19093. @end itemize
  19094. @section pad_opencl
  19095. Add paddings to the input image, and place the original input at the
  19096. provided @var{x}, @var{y} coordinates.
  19097. It accepts the following options:
  19098. @table @option
  19099. @item width, w
  19100. @item height, h
  19101. Specify an expression for the size of the output image with the
  19102. paddings added. If the value for @var{width} or @var{height} is 0, the
  19103. corresponding input size is used for the output.
  19104. The @var{width} expression can reference the value set by the
  19105. @var{height} expression, and vice versa.
  19106. The default value of @var{width} and @var{height} is 0.
  19107. @item x
  19108. @item y
  19109. Specify the offsets to place the input image at within the padded area,
  19110. with respect to the top/left border of the output image.
  19111. The @var{x} expression can reference the value set by the @var{y}
  19112. expression, and vice versa.
  19113. The default value of @var{x} and @var{y} is 0.
  19114. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  19115. so the input image is centered on the padded area.
  19116. @item color
  19117. Specify the color of the padded area. For the syntax of this option,
  19118. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  19119. manual,ffmpeg-utils}.
  19120. @item aspect
  19121. Pad to an aspect instead to a resolution.
  19122. @end table
  19123. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  19124. options are expressions containing the following constants:
  19125. @table @option
  19126. @item in_w
  19127. @item in_h
  19128. The input video width and height.
  19129. @item iw
  19130. @item ih
  19131. These are the same as @var{in_w} and @var{in_h}.
  19132. @item out_w
  19133. @item out_h
  19134. The output width and height (the size of the padded area), as
  19135. specified by the @var{width} and @var{height} expressions.
  19136. @item ow
  19137. @item oh
  19138. These are the same as @var{out_w} and @var{out_h}.
  19139. @item x
  19140. @item y
  19141. The x and y offsets as specified by the @var{x} and @var{y}
  19142. expressions, or NAN if not yet specified.
  19143. @item a
  19144. same as @var{iw} / @var{ih}
  19145. @item sar
  19146. input sample aspect ratio
  19147. @item dar
  19148. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  19149. @end table
  19150. @section prewitt_opencl
  19151. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  19152. The filter accepts the following option:
  19153. @table @option
  19154. @item planes
  19155. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  19156. @item scale
  19157. Set value which will be multiplied with filtered result.
  19158. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  19159. @item delta
  19160. Set value which will be added to filtered result.
  19161. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  19162. @end table
  19163. @subsection Example
  19164. @itemize
  19165. @item
  19166. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  19167. @example
  19168. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  19169. @end example
  19170. @end itemize
  19171. @anchor{program_opencl}
  19172. @section program_opencl
  19173. Filter video using an OpenCL program.
  19174. @table @option
  19175. @item source
  19176. OpenCL program source file.
  19177. @item kernel
  19178. Kernel name in program.
  19179. @item inputs
  19180. Number of inputs to the filter. Defaults to 1.
  19181. @item size, s
  19182. Size of output frames. Defaults to the same as the first input.
  19183. @end table
  19184. The @code{program_opencl} filter also supports the @ref{framesync} options.
  19185. The program source file must contain a kernel function with the given name,
  19186. which will be run once for each plane of the output. Each run on a plane
  19187. gets enqueued as a separate 2D global NDRange with one work-item for each
  19188. pixel to be generated. The global ID offset for each work-item is therefore
  19189. the coordinates of a pixel in the destination image.
  19190. The kernel function needs to take the following arguments:
  19191. @itemize
  19192. @item
  19193. Destination image, @var{__write_only image2d_t}.
  19194. This image will become the output; the kernel should write all of it.
  19195. @item
  19196. Frame index, @var{unsigned int}.
  19197. This is a counter starting from zero and increasing by one for each frame.
  19198. @item
  19199. Source images, @var{__read_only image2d_t}.
  19200. These are the most recent images on each input. The kernel may read from
  19201. them to generate the output, but they can't be written to.
  19202. @end itemize
  19203. Example programs:
  19204. @itemize
  19205. @item
  19206. Copy the input to the output (output must be the same size as the input).
  19207. @verbatim
  19208. __kernel void copy(__write_only image2d_t destination,
  19209. unsigned int index,
  19210. __read_only image2d_t source)
  19211. {
  19212. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  19213. int2 location = (int2)(get_global_id(0), get_global_id(1));
  19214. float4 value = read_imagef(source, sampler, location);
  19215. write_imagef(destination, location, value);
  19216. }
  19217. @end verbatim
  19218. @item
  19219. Apply a simple transformation, rotating the input by an amount increasing
  19220. with the index counter. Pixel values are linearly interpolated by the
  19221. sampler, and the output need not have the same dimensions as the input.
  19222. @verbatim
  19223. __kernel void rotate_image(__write_only image2d_t dst,
  19224. unsigned int index,
  19225. __read_only image2d_t src)
  19226. {
  19227. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  19228. CLK_FILTER_LINEAR);
  19229. float angle = (float)index / 100.0f;
  19230. float2 dst_dim = convert_float2(get_image_dim(dst));
  19231. float2 src_dim = convert_float2(get_image_dim(src));
  19232. float2 dst_cen = dst_dim / 2.0f;
  19233. float2 src_cen = src_dim / 2.0f;
  19234. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  19235. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  19236. float2 src_pos = {
  19237. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  19238. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  19239. };
  19240. src_pos = src_pos * src_dim / dst_dim;
  19241. float2 src_loc = src_pos + src_cen;
  19242. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  19243. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  19244. write_imagef(dst, dst_loc, 0.5f);
  19245. else
  19246. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  19247. }
  19248. @end verbatim
  19249. @item
  19250. Blend two inputs together, with the amount of each input used varying
  19251. with the index counter.
  19252. @verbatim
  19253. __kernel void blend_images(__write_only image2d_t dst,
  19254. unsigned int index,
  19255. __read_only image2d_t src1,
  19256. __read_only image2d_t src2)
  19257. {
  19258. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  19259. CLK_FILTER_LINEAR);
  19260. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  19261. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  19262. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  19263. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  19264. float4 val1 = read_imagef(src1, sampler, src1_loc);
  19265. float4 val2 = read_imagef(src2, sampler, src2_loc);
  19266. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  19267. }
  19268. @end verbatim
  19269. @end itemize
  19270. @section roberts_opencl
  19271. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  19272. The filter accepts the following option:
  19273. @table @option
  19274. @item planes
  19275. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  19276. @item scale
  19277. Set value which will be multiplied with filtered result.
  19278. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  19279. @item delta
  19280. Set value which will be added to filtered result.
  19281. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  19282. @end table
  19283. @subsection Example
  19284. @itemize
  19285. @item
  19286. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  19287. @example
  19288. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  19289. @end example
  19290. @end itemize
  19291. @section sobel_opencl
  19292. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  19293. The filter accepts the following option:
  19294. @table @option
  19295. @item planes
  19296. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  19297. @item scale
  19298. Set value which will be multiplied with filtered result.
  19299. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  19300. @item delta
  19301. Set value which will be added to filtered result.
  19302. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  19303. @end table
  19304. @subsection Example
  19305. @itemize
  19306. @item
  19307. Apply sobel operator with scale set to 2 and delta set to 10
  19308. @example
  19309. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  19310. @end example
  19311. @end itemize
  19312. @section tonemap_opencl
  19313. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  19314. It accepts the following parameters:
  19315. @table @option
  19316. @item tonemap
  19317. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  19318. @item param
  19319. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  19320. @item desat
  19321. Apply desaturation for highlights that exceed this level of brightness. The
  19322. higher the parameter, the more color information will be preserved. This
  19323. setting helps prevent unnaturally blown-out colors for super-highlights, by
  19324. (smoothly) turning into white instead. This makes images feel more natural,
  19325. at the cost of reducing information about out-of-range colors.
  19326. The default value is 0.5, and the algorithm here is a little different from
  19327. the cpu version tonemap currently. A setting of 0.0 disables this option.
  19328. @item threshold
  19329. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  19330. is used to detect whether the scene has changed or not. If the distance between
  19331. the current frame average brightness and the current running average exceeds
  19332. a threshold value, we would re-calculate scene average and peak brightness.
  19333. The default value is 0.2.
  19334. @item format
  19335. Specify the output pixel format.
  19336. Currently supported formats are:
  19337. @table @var
  19338. @item p010
  19339. @item nv12
  19340. @end table
  19341. @item range, r
  19342. Set the output color range.
  19343. Possible values are:
  19344. @table @var
  19345. @item tv/mpeg
  19346. @item pc/jpeg
  19347. @end table
  19348. Default is same as input.
  19349. @item primaries, p
  19350. Set the output color primaries.
  19351. Possible values are:
  19352. @table @var
  19353. @item bt709
  19354. @item bt2020
  19355. @end table
  19356. Default is same as input.
  19357. @item transfer, t
  19358. Set the output transfer characteristics.
  19359. Possible values are:
  19360. @table @var
  19361. @item bt709
  19362. @item bt2020
  19363. @end table
  19364. Default is bt709.
  19365. @item matrix, m
  19366. Set the output colorspace matrix.
  19367. Possible value are:
  19368. @table @var
  19369. @item bt709
  19370. @item bt2020
  19371. @end table
  19372. Default is same as input.
  19373. @end table
  19374. @subsection Example
  19375. @itemize
  19376. @item
  19377. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  19378. @example
  19379. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  19380. @end example
  19381. @end itemize
  19382. @section unsharp_opencl
  19383. Sharpen or blur the input video.
  19384. It accepts the following parameters:
  19385. @table @option
  19386. @item luma_msize_x, lx
  19387. Set the luma matrix horizontal size.
  19388. Range is @code{[1, 23]} and default value is @code{5}.
  19389. @item luma_msize_y, ly
  19390. Set the luma matrix vertical size.
  19391. Range is @code{[1, 23]} and default value is @code{5}.
  19392. @item luma_amount, la
  19393. Set the luma effect strength.
  19394. Range is @code{[-10, 10]} and default value is @code{1.0}.
  19395. Negative values will blur the input video, while positive values will
  19396. sharpen it, a value of zero will disable the effect.
  19397. @item chroma_msize_x, cx
  19398. Set the chroma matrix horizontal size.
  19399. Range is @code{[1, 23]} and default value is @code{5}.
  19400. @item chroma_msize_y, cy
  19401. Set the chroma matrix vertical size.
  19402. Range is @code{[1, 23]} and default value is @code{5}.
  19403. @item chroma_amount, ca
  19404. Set the chroma effect strength.
  19405. Range is @code{[-10, 10]} and default value is @code{0.0}.
  19406. Negative values will blur the input video, while positive values will
  19407. sharpen it, a value of zero will disable the effect.
  19408. @end table
  19409. All parameters are optional and default to the equivalent of the
  19410. string '5:5:1.0:5:5:0.0'.
  19411. @subsection Examples
  19412. @itemize
  19413. @item
  19414. Apply strong luma sharpen effect:
  19415. @example
  19416. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  19417. @end example
  19418. @item
  19419. Apply a strong blur of both luma and chroma parameters:
  19420. @example
  19421. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  19422. @end example
  19423. @end itemize
  19424. @section xfade_opencl
  19425. Cross fade two videos with custom transition effect by using OpenCL.
  19426. It accepts the following options:
  19427. @table @option
  19428. @item transition
  19429. Set one of possible transition effects.
  19430. @table @option
  19431. @item custom
  19432. Select custom transition effect, the actual transition description
  19433. will be picked from source and kernel options.
  19434. @item fade
  19435. @item wipeleft
  19436. @item wiperight
  19437. @item wipeup
  19438. @item wipedown
  19439. @item slideleft
  19440. @item slideright
  19441. @item slideup
  19442. @item slidedown
  19443. Default transition is fade.
  19444. @end table
  19445. @item source
  19446. OpenCL program source file for custom transition.
  19447. @item kernel
  19448. Set name of kernel to use for custom transition from program source file.
  19449. @item duration
  19450. Set duration of video transition.
  19451. @item offset
  19452. Set time of start of transition relative to first video.
  19453. @end table
  19454. The program source file must contain a kernel function with the given name,
  19455. which will be run once for each plane of the output. Each run on a plane
  19456. gets enqueued as a separate 2D global NDRange with one work-item for each
  19457. pixel to be generated. The global ID offset for each work-item is therefore
  19458. the coordinates of a pixel in the destination image.
  19459. The kernel function needs to take the following arguments:
  19460. @itemize
  19461. @item
  19462. Destination image, @var{__write_only image2d_t}.
  19463. This image will become the output; the kernel should write all of it.
  19464. @item
  19465. First Source image, @var{__read_only image2d_t}.
  19466. Second Source image, @var{__read_only image2d_t}.
  19467. These are the most recent images on each input. The kernel may read from
  19468. them to generate the output, but they can't be written to.
  19469. @item
  19470. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  19471. @end itemize
  19472. Example programs:
  19473. @itemize
  19474. @item
  19475. Apply dots curtain transition effect:
  19476. @verbatim
  19477. __kernel void blend_images(__write_only image2d_t dst,
  19478. __read_only image2d_t src1,
  19479. __read_only image2d_t src2,
  19480. float progress)
  19481. {
  19482. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  19483. CLK_FILTER_LINEAR);
  19484. int2 p = (int2)(get_global_id(0), get_global_id(1));
  19485. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  19486. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  19487. rp = rp / dim;
  19488. float2 dots = (float2)(20.0, 20.0);
  19489. float2 center = (float2)(0,0);
  19490. float2 unused;
  19491. float4 val1 = read_imagef(src1, sampler, p);
  19492. float4 val2 = read_imagef(src2, sampler, p);
  19493. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  19494. write_imagef(dst, p, next ? val1 : val2);
  19495. }
  19496. @end verbatim
  19497. @end itemize
  19498. @c man end OPENCL VIDEO FILTERS
  19499. @chapter VAAPI Video Filters
  19500. @c man begin VAAPI VIDEO FILTERS
  19501. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  19502. To enable compilation of these filters you need to configure FFmpeg with
  19503. @code{--enable-vaapi}.
  19504. 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}
  19505. @section overlay_vaapi
  19506. Overlay one video on the top of another.
  19507. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  19508. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  19509. The filter accepts the following options:
  19510. @table @option
  19511. @item x
  19512. Set the x coordinate of the overlaid video on the main video.
  19513. Default value is @code{0}.
  19514. @item y
  19515. Set the y coordinate of the overlaid video on the main video.
  19516. Default value is @code{0}.
  19517. @item w
  19518. Set the width of the overlaid video on the main video.
  19519. Default value is the width of input overlay video.
  19520. @item h
  19521. Set the height of the overlaid video on the main video.
  19522. Default value is the height of input overlay video.
  19523. @item alpha
  19524. Set blocking detection thresholds. Allowed range is 0.0 to 1.0, it
  19525. requires an input video with alpha channel.
  19526. Default value is @code{0.0}.
  19527. @end table
  19528. @subsection Examples
  19529. @itemize
  19530. @item
  19531. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs for this filter are yuv420p format.
  19532. @example
  19533. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_vaapi" OUTPUT
  19534. @end example
  19535. @item
  19536. Overlay an image LOGO at the offset (200, 100) from the top-left corner of the INPUT video.
  19537. The inputs have same memory layout for color channels, the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  19538. @example
  19539. -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
  19540. @end example
  19541. @end itemize
  19542. @section tonemap_vaapi
  19543. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  19544. It maps the dynamic range of HDR10 content to the SDR content.
  19545. It currently only accepts HDR10 as input.
  19546. It accepts the following parameters:
  19547. @table @option
  19548. @item format
  19549. Specify the output pixel format.
  19550. Currently supported formats are:
  19551. @table @var
  19552. @item p010
  19553. @item nv12
  19554. @end table
  19555. Default is nv12.
  19556. @item primaries, p
  19557. Set the output color primaries.
  19558. Default is same as input.
  19559. @item transfer, t
  19560. Set the output transfer characteristics.
  19561. Default is bt709.
  19562. @item matrix, m
  19563. Set the output colorspace matrix.
  19564. Default is same as input.
  19565. @end table
  19566. @subsection Example
  19567. @itemize
  19568. @item
  19569. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  19570. @example
  19571. tonemap_vaapi=format=p010:t=bt2020-10
  19572. @end example
  19573. @end itemize
  19574. @c man end VAAPI VIDEO FILTERS
  19575. @chapter Video Sources
  19576. @c man begin VIDEO SOURCES
  19577. Below is a description of the currently available video sources.
  19578. @section buffer
  19579. Buffer video frames, and make them available to the filter chain.
  19580. This source is mainly intended for a programmatic use, in particular
  19581. through the interface defined in @file{libavfilter/buffersrc.h}.
  19582. It accepts the following parameters:
  19583. @table @option
  19584. @item video_size
  19585. Specify the size (width and height) of the buffered video frames. For the
  19586. syntax of this option, check the
  19587. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19588. @item width
  19589. The input video width.
  19590. @item height
  19591. The input video height.
  19592. @item pix_fmt
  19593. A string representing the pixel format of the buffered video frames.
  19594. It may be a number corresponding to a pixel format, or a pixel format
  19595. name.
  19596. @item time_base
  19597. Specify the timebase assumed by the timestamps of the buffered frames.
  19598. @item frame_rate
  19599. Specify the frame rate expected for the video stream.
  19600. @item pixel_aspect, sar
  19601. The sample (pixel) aspect ratio of the input video.
  19602. @item sws_param
  19603. This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};}
  19604. to the filtergraph description to specify swscale flags for automatically
  19605. inserted scalers. See @ref{Filtergraph syntax}.
  19606. @item hw_frames_ctx
  19607. When using a hardware pixel format, this should be a reference to an
  19608. AVHWFramesContext describing input frames.
  19609. @end table
  19610. For example:
  19611. @example
  19612. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  19613. @end example
  19614. will instruct the source to accept video frames with size 320x240 and
  19615. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  19616. square pixels (1:1 sample aspect ratio).
  19617. Since the pixel format with name "yuv410p" corresponds to the number 6
  19618. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  19619. this example corresponds to:
  19620. @example
  19621. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  19622. @end example
  19623. Alternatively, the options can be specified as a flat string, but this
  19624. syntax is deprecated:
  19625. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  19626. @section cellauto
  19627. Create a pattern generated by an elementary cellular automaton.
  19628. The initial state of the cellular automaton can be defined through the
  19629. @option{filename} and @option{pattern} options. If such options are
  19630. not specified an initial state is created randomly.
  19631. At each new frame a new row in the video is filled with the result of
  19632. the cellular automaton next generation. The behavior when the whole
  19633. frame is filled is defined by the @option{scroll} option.
  19634. This source accepts the following options:
  19635. @table @option
  19636. @item filename, f
  19637. Read the initial cellular automaton state, i.e. the starting row, from
  19638. the specified file.
  19639. In the file, each non-whitespace character is considered an alive
  19640. cell, a newline will terminate the row, and further characters in the
  19641. file will be ignored.
  19642. @item pattern, p
  19643. Read the initial cellular automaton state, i.e. the starting row, from
  19644. the specified string.
  19645. Each non-whitespace character in the string is considered an alive
  19646. cell, a newline will terminate the row, and further characters in the
  19647. string will be ignored.
  19648. @item rate, r
  19649. Set the video rate, that is the number of frames generated per second.
  19650. Default is 25.
  19651. @item random_fill_ratio, ratio
  19652. Set the random fill ratio for the initial cellular automaton row. It
  19653. is a floating point number value ranging from 0 to 1, defaults to
  19654. 1/PHI.
  19655. This option is ignored when a file or a pattern is specified.
  19656. @item random_seed, seed
  19657. Set the seed for filling randomly the initial row, must be an integer
  19658. included between 0 and UINT32_MAX. If not specified, or if explicitly
  19659. set to -1, the filter will try to use a good random seed on a best
  19660. effort basis.
  19661. @item rule
  19662. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  19663. Default value is 110.
  19664. @item size, s
  19665. Set the size of the output video. For the syntax of this option, check the
  19666. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19667. If @option{filename} or @option{pattern} is specified, the size is set
  19668. by default to the width of the specified initial state row, and the
  19669. height is set to @var{width} * PHI.
  19670. If @option{size} is set, it must contain the width of the specified
  19671. pattern string, and the specified pattern will be centered in the
  19672. larger row.
  19673. If a filename or a pattern string is not specified, the size value
  19674. defaults to "320x518" (used for a randomly generated initial state).
  19675. @item scroll
  19676. If set to 1, scroll the output upward when all the rows in the output
  19677. have been already filled. If set to 0, the new generated row will be
  19678. written over the top row just after the bottom row is filled.
  19679. Defaults to 1.
  19680. @item start_full, full
  19681. If set to 1, completely fill the output with generated rows before
  19682. outputting the first frame.
  19683. This is the default behavior, for disabling set the value to 0.
  19684. @item stitch
  19685. If set to 1, stitch the left and right row edges together.
  19686. This is the default behavior, for disabling set the value to 0.
  19687. @end table
  19688. @subsection Examples
  19689. @itemize
  19690. @item
  19691. Read the initial state from @file{pattern}, and specify an output of
  19692. size 200x400.
  19693. @example
  19694. cellauto=f=pattern:s=200x400
  19695. @end example
  19696. @item
  19697. Generate a random initial row with a width of 200 cells, with a fill
  19698. ratio of 2/3:
  19699. @example
  19700. cellauto=ratio=2/3:s=200x200
  19701. @end example
  19702. @item
  19703. Create a pattern generated by rule 18 starting by a single alive cell
  19704. centered on an initial row with width 100:
  19705. @example
  19706. cellauto=p=@@:s=100x400:full=0:rule=18
  19707. @end example
  19708. @item
  19709. Specify a more elaborated initial pattern:
  19710. @example
  19711. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  19712. @end example
  19713. @end itemize
  19714. @anchor{coreimagesrc}
  19715. @section coreimagesrc
  19716. Video source generated on GPU using Apple's CoreImage API on OSX.
  19717. This video source is a specialized version of the @ref{coreimage} video filter.
  19718. Use a core image generator at the beginning of the applied filterchain to
  19719. generate the content.
  19720. The coreimagesrc video source accepts the following options:
  19721. @table @option
  19722. @item list_generators
  19723. List all available generators along with all their respective options as well as
  19724. possible minimum and maximum values along with the default values.
  19725. @example
  19726. list_generators=true
  19727. @end example
  19728. @item size, s
  19729. Specify the size of the sourced video. For the syntax of this option, check the
  19730. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19731. The default value is @code{320x240}.
  19732. @item rate, r
  19733. Specify the frame rate of the sourced video, as the number of frames
  19734. generated per second. It has to be a string in the format
  19735. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  19736. number or a valid video frame rate abbreviation. The default value is
  19737. "25".
  19738. @item sar
  19739. Set the sample aspect ratio of the sourced video.
  19740. @item duration, d
  19741. Set the duration of the sourced video. See
  19742. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  19743. for the accepted syntax.
  19744. If not specified, or the expressed duration is negative, the video is
  19745. supposed to be generated forever.
  19746. @end table
  19747. Additionally, all options of the @ref{coreimage} video filter are accepted.
  19748. A complete filterchain can be used for further processing of the
  19749. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  19750. and examples for details.
  19751. @subsection Examples
  19752. @itemize
  19753. @item
  19754. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  19755. given as complete and escaped command-line for Apple's standard bash shell:
  19756. @example
  19757. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  19758. @end example
  19759. This example is equivalent to the QRCode example of @ref{coreimage} without the
  19760. need for a nullsrc video source.
  19761. @end itemize
  19762. @section gradients
  19763. Generate several gradients.
  19764. @table @option
  19765. @item size, s
  19766. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  19767. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  19768. @item rate, r
  19769. Set frame rate, expressed as number of frames per second. Default
  19770. value is "25".
  19771. @item c0, c1, c2, c3, c4, c5, c6, c7
  19772. Set 8 colors. Default values for colors is to pick random one.
  19773. @item x0, y0, y0, y1
  19774. Set gradient line source and destination points. If negative or out of range, random ones
  19775. are picked.
  19776. @item nb_colors, n
  19777. Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.
  19778. @item seed
  19779. Set seed for picking gradient line points.
  19780. @item duration, d
  19781. Set the duration of the sourced video. See
  19782. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  19783. for the accepted syntax.
  19784. If not specified, or the expressed duration is negative, the video is
  19785. supposed to be generated forever.
  19786. @item speed
  19787. Set speed of gradients rotation.
  19788. @item type, t
  19789. Set type of gradients, can be @code{linear} or @code{radial} or @code{circular} or @code{spiral}.
  19790. @end table
  19791. @section mandelbrot
  19792. Generate a Mandelbrot set fractal, and progressively zoom towards the
  19793. point specified with @var{start_x} and @var{start_y}.
  19794. This source accepts the following options:
  19795. @table @option
  19796. @item end_pts
  19797. Set the terminal pts value. Default value is 400.
  19798. @item end_scale
  19799. Set the terminal scale value.
  19800. Must be a floating point value. Default value is 0.3.
  19801. @item inner
  19802. Set the inner coloring mode, that is the algorithm used to draw the
  19803. Mandelbrot fractal internal region.
  19804. It shall assume one of the following values:
  19805. @table @option
  19806. @item black
  19807. Set black mode.
  19808. @item convergence
  19809. Show time until convergence.
  19810. @item mincol
  19811. Set color based on point closest to the origin of the iterations.
  19812. @item period
  19813. Set period mode.
  19814. @end table
  19815. Default value is @var{mincol}.
  19816. @item bailout
  19817. Set the bailout value. Default value is 10.0.
  19818. @item maxiter
  19819. Set the maximum of iterations performed by the rendering
  19820. algorithm. Default value is 7189.
  19821. @item outer
  19822. Set outer coloring mode.
  19823. It shall assume one of following values:
  19824. @table @option
  19825. @item iteration_count
  19826. Set iteration count mode.
  19827. @item normalized_iteration_count
  19828. set normalized iteration count mode.
  19829. @end table
  19830. Default value is @var{normalized_iteration_count}.
  19831. @item rate, r
  19832. Set frame rate, expressed as number of frames per second. Default
  19833. value is "25".
  19834. @item size, s
  19835. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  19836. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  19837. @item start_scale
  19838. Set the initial scale value. Default value is 3.0.
  19839. @item start_x
  19840. Set the initial x position. Must be a floating point value between
  19841. -100 and 100. Default value is -0.743643887037158704752191506114774.
  19842. @item start_y
  19843. Set the initial y position. Must be a floating point value between
  19844. -100 and 100. Default value is -0.131825904205311970493132056385139.
  19845. @end table
  19846. @section mptestsrc
  19847. Generate various test patterns, as generated by the MPlayer test filter.
  19848. The size of the generated video is fixed, and is 256x256.
  19849. This source is useful in particular for testing encoding features.
  19850. This source accepts the following options:
  19851. @table @option
  19852. @item rate, r
  19853. Specify the frame rate of the sourced video, as the number of frames
  19854. generated per second. It has to be a string in the format
  19855. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  19856. number or a valid video frame rate abbreviation. The default value is
  19857. "25".
  19858. @item duration, d
  19859. Set the duration of the sourced video. See
  19860. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  19861. for the accepted syntax.
  19862. If not specified, or the expressed duration is negative, the video is
  19863. supposed to be generated forever.
  19864. @item test, t
  19865. Set the number or the name of the test to perform. Supported tests are:
  19866. @table @option
  19867. @item dc_luma
  19868. @item dc_chroma
  19869. @item freq_luma
  19870. @item freq_chroma
  19871. @item amp_luma
  19872. @item amp_chroma
  19873. @item cbp
  19874. @item mv
  19875. @item ring1
  19876. @item ring2
  19877. @item all
  19878. @item max_frames, m
  19879. Set the maximum number of frames generated for each test, default value is 30.
  19880. @end table
  19881. Default value is "all", which will cycle through the list of all tests.
  19882. @end table
  19883. Some examples:
  19884. @example
  19885. mptestsrc=t=dc_luma
  19886. @end example
  19887. will generate a "dc_luma" test pattern.
  19888. @section frei0r_src
  19889. Provide a frei0r source.
  19890. To enable compilation of this filter you need to install the frei0r
  19891. header and configure FFmpeg with @code{--enable-frei0r}.
  19892. This source accepts the following parameters:
  19893. @table @option
  19894. @item size
  19895. The size of the video to generate. For the syntax of this option, check the
  19896. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19897. @item framerate
  19898. The framerate of the generated video. It may be a string of the form
  19899. @var{num}/@var{den} or a frame rate abbreviation.
  19900. @item filter_name
  19901. The name to the frei0r source to load. For more information regarding frei0r and
  19902. how to set the parameters, read the @ref{frei0r} section in the video filters
  19903. documentation.
  19904. @item filter_params
  19905. A '|'-separated list of parameters to pass to the frei0r source.
  19906. @end table
  19907. For example, to generate a frei0r partik0l source with size 200x200
  19908. and frame rate 10 which is overlaid on the overlay filter main input:
  19909. @example
  19910. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  19911. @end example
  19912. @section life
  19913. Generate a life pattern.
  19914. This source is based on a generalization of John Conway's life game.
  19915. The sourced input represents a life grid, each pixel represents a cell
  19916. which can be in one of two possible states, alive or dead. Every cell
  19917. interacts with its eight neighbours, which are the cells that are
  19918. horizontally, vertically, or diagonally adjacent.
  19919. At each interaction the grid evolves according to the adopted rule,
  19920. which specifies the number of neighbor alive cells which will make a
  19921. cell stay alive or born. The @option{rule} option allows one to specify
  19922. the rule to adopt.
  19923. This source accepts the following options:
  19924. @table @option
  19925. @item filename, f
  19926. Set the file from which to read the initial grid state. In the file,
  19927. each non-whitespace character is considered an alive cell, and newline
  19928. is used to delimit the end of each row.
  19929. If this option is not specified, the initial grid is generated
  19930. randomly.
  19931. @item rate, r
  19932. Set the video rate, that is the number of frames generated per second.
  19933. Default is 25.
  19934. @item random_fill_ratio, ratio
  19935. Set the random fill ratio for the initial random grid. It is a
  19936. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  19937. It is ignored when a file is specified.
  19938. @item random_seed, seed
  19939. Set the seed for filling the initial random grid, must be an integer
  19940. included between 0 and UINT32_MAX. If not specified, or if explicitly
  19941. set to -1, the filter will try to use a good random seed on a best
  19942. effort basis.
  19943. @item rule
  19944. Set the life rule.
  19945. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  19946. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  19947. @var{NS} specifies the number of alive neighbor cells which make a
  19948. live cell stay alive, and @var{NB} the number of alive neighbor cells
  19949. which make a dead cell to become alive (i.e. to "born").
  19950. "s" and "b" can be used in place of "S" and "B", respectively.
  19951. Alternatively a rule can be specified by an 18-bits integer. The 9
  19952. high order bits are used to encode the next cell state if it is alive
  19953. for each number of neighbor alive cells, the low order bits specify
  19954. the rule for "borning" new cells. Higher order bits encode for an
  19955. higher number of neighbor cells.
  19956. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  19957. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  19958. Default value is "S23/B3", which is the original Conway's game of life
  19959. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  19960. cells, and will born a new cell if there are three alive cells around
  19961. a dead cell.
  19962. @item size, s
  19963. Set the size of the output video. For the syntax of this option, check the
  19964. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19965. If @option{filename} is specified, the size is set by default to the
  19966. same size of the input file. If @option{size} is set, it must contain
  19967. the size specified in the input file, and the initial grid defined in
  19968. that file is centered in the larger resulting area.
  19969. If a filename is not specified, the size value defaults to "320x240"
  19970. (used for a randomly generated initial grid).
  19971. @item stitch
  19972. If set to 1, stitch the left and right grid edges together, and the
  19973. top and bottom edges also. Defaults to 1.
  19974. @item mold
  19975. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  19976. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  19977. value from 0 to 255.
  19978. @item life_color
  19979. Set the color of living (or new born) cells.
  19980. @item death_color
  19981. Set the color of dead cells. If @option{mold} is set, this is the first color
  19982. used to represent a dead cell.
  19983. @item mold_color
  19984. Set mold color, for definitely dead and moldy cells.
  19985. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  19986. ffmpeg-utils manual,ffmpeg-utils}.
  19987. @end table
  19988. @subsection Examples
  19989. @itemize
  19990. @item
  19991. Read a grid from @file{pattern}, and center it on a grid of size
  19992. 300x300 pixels:
  19993. @example
  19994. life=f=pattern:s=300x300
  19995. @end example
  19996. @item
  19997. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  19998. @example
  19999. life=ratio=2/3:s=200x200
  20000. @end example
  20001. @item
  20002. Specify a custom rule for evolving a randomly generated grid:
  20003. @example
  20004. life=rule=S14/B34
  20005. @end example
  20006. @item
  20007. Full example with slow death effect (mold) using @command{ffplay}:
  20008. @example
  20009. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  20010. @end example
  20011. @end itemize
  20012. @anchor{allrgb}
  20013. @anchor{allyuv}
  20014. @anchor{color}
  20015. @anchor{colorchart}
  20016. @anchor{colorspectrum}
  20017. @anchor{haldclutsrc}
  20018. @anchor{nullsrc}
  20019. @anchor{pal75bars}
  20020. @anchor{pal100bars}
  20021. @anchor{rgbtestsrc}
  20022. @anchor{smptebars}
  20023. @anchor{smptehdbars}
  20024. @anchor{testsrc}
  20025. @anchor{testsrc2}
  20026. @anchor{yuvtestsrc}
  20027. @section allrgb, allyuv, color, colorspectrum, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  20028. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  20029. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  20030. The @code{color} source provides an uniformly colored input.
  20031. The @code{colorchart} source provides a colors checker chart.
  20032. The @code{colorspectrum} source provides a color spectrum input.
  20033. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  20034. @ref{haldclut} filter.
  20035. The @code{nullsrc} source returns unprocessed video frames. It is
  20036. mainly useful to be employed in analysis / debugging tools, or as the
  20037. source for filters which ignore the input data.
  20038. The @code{pal75bars} source generates a color bars pattern, based on
  20039. EBU PAL recommendations with 75% color levels.
  20040. The @code{pal100bars} source generates a color bars pattern, based on
  20041. EBU PAL recommendations with 100% color levels.
  20042. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  20043. detecting RGB vs BGR issues. You should see a red, green and blue
  20044. stripe from top to bottom.
  20045. The @code{smptebars} source generates a color bars pattern, based on
  20046. the SMPTE Engineering Guideline EG 1-1990.
  20047. The @code{smptehdbars} source generates a color bars pattern, based on
  20048. the SMPTE RP 219-2002.
  20049. The @code{testsrc} source generates a test video pattern, showing a
  20050. color pattern, a scrolling gradient and a timestamp. This is mainly
  20051. intended for testing purposes.
  20052. The @code{testsrc2} source is similar to testsrc, but supports more
  20053. pixel formats instead of just @code{rgb24}. This allows using it as an
  20054. input for other tests without requiring a format conversion.
  20055. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  20056. see a y, cb and cr stripe from top to bottom.
  20057. The sources accept the following parameters:
  20058. @table @option
  20059. @item level
  20060. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  20061. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  20062. pixels to be used as identity matrix for 3D lookup tables. Each component is
  20063. coded on a @code{1/(N*N)} scale.
  20064. @item color, c
  20065. Specify the color of the source, only available in the @code{color}
  20066. source. For the syntax of this option, check the
  20067. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20068. @item size, s
  20069. Specify the size of the sourced video. For the syntax of this option, check the
  20070. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20071. The default value is @code{320x240}.
  20072. This option is not available with the @code{allrgb}, @code{allyuv}, and
  20073. @code{haldclutsrc} filters.
  20074. @item rate, r
  20075. Specify the frame rate of the sourced video, as the number of frames
  20076. generated per second. It has to be a string in the format
  20077. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  20078. number or a valid video frame rate abbreviation. The default value is
  20079. "25".
  20080. @item duration, d
  20081. Set the duration of the sourced video. See
  20082. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  20083. for the accepted syntax.
  20084. If not specified, or the expressed duration is negative, the video is
  20085. supposed to be generated forever.
  20086. Since the frame rate is used as time base, all frames including the last one
  20087. will have their full duration. If the specified duration is not a multiple
  20088. of the frame duration, it will be rounded up.
  20089. @item sar
  20090. Set the sample aspect ratio of the sourced video.
  20091. @item alpha
  20092. Specify the alpha (opacity) of the background, only available in the
  20093. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  20094. 255 (fully opaque, the default).
  20095. @item decimals, n
  20096. Set the number of decimals to show in the timestamp, only available in the
  20097. @code{testsrc} source.
  20098. The displayed timestamp value will correspond to the original
  20099. timestamp value multiplied by the power of 10 of the specified
  20100. value. Default value is 0.
  20101. @item type
  20102. Set the type of the color spectrum, only available in the
  20103. @code{colorspectrum} source. Can be one of the following:
  20104. @table @samp
  20105. @item black
  20106. @item white
  20107. @item all
  20108. @end table
  20109. @item patch_size
  20110. Set patch size of single color patch, only available in the
  20111. @code{colorchart} source. Default is @code{64x64}.
  20112. @item preset
  20113. Set colorchecker colors preset, only available in the
  20114. @code{colorchart} source.
  20115. Available values are:
  20116. @table @samp
  20117. @item reference
  20118. @item skintones
  20119. @end table
  20120. Default value is @code{reference}.
  20121. @end table
  20122. @subsection Examples
  20123. @itemize
  20124. @item
  20125. Generate a video with a duration of 5.3 seconds, with size
  20126. 176x144 and a frame rate of 10 frames per second:
  20127. @example
  20128. testsrc=duration=5.3:size=qcif:rate=10
  20129. @end example
  20130. @item
  20131. The following graph description will generate a red source
  20132. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  20133. frames per second:
  20134. @example
  20135. color=c=red@@0.2:s=qcif:r=10
  20136. @end example
  20137. @item
  20138. If the input content is to be ignored, @code{nullsrc} can be used. The
  20139. following command generates noise in the luminance plane by employing
  20140. the @code{geq} filter:
  20141. @example
  20142. nullsrc=s=256x256, geq=random(1)*255:128:128
  20143. @end example
  20144. @end itemize
  20145. @subsection Commands
  20146. The @code{color} source supports the following commands:
  20147. @table @option
  20148. @item c, color
  20149. Set the color of the created image. Accepts the same syntax of the
  20150. corresponding @option{color} option.
  20151. @end table
  20152. @section openclsrc
  20153. Generate video using an OpenCL program.
  20154. @table @option
  20155. @item source
  20156. OpenCL program source file.
  20157. @item kernel
  20158. Kernel name in program.
  20159. @item size, s
  20160. Size of frames to generate. This must be set.
  20161. @item format
  20162. Pixel format to use for the generated frames. This must be set.
  20163. @item rate, r
  20164. Number of frames generated every second. Default value is '25'.
  20165. @end table
  20166. For details of how the program loading works, see the @ref{program_opencl}
  20167. filter.
  20168. Example programs:
  20169. @itemize
  20170. @item
  20171. Generate a colour ramp by setting pixel values from the position of the pixel
  20172. in the output image. (Note that this will work with all pixel formats, but
  20173. the generated output will not be the same.)
  20174. @verbatim
  20175. __kernel void ramp(__write_only image2d_t dst,
  20176. unsigned int index)
  20177. {
  20178. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  20179. float4 val;
  20180. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  20181. write_imagef(dst, loc, val);
  20182. }
  20183. @end verbatim
  20184. @item
  20185. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  20186. @verbatim
  20187. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  20188. unsigned int index)
  20189. {
  20190. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  20191. float4 value = 0.0f;
  20192. int x = loc.x + index;
  20193. int y = loc.y + index;
  20194. while (x > 0 || y > 0) {
  20195. if (x % 3 == 1 && y % 3 == 1) {
  20196. value = 1.0f;
  20197. break;
  20198. }
  20199. x /= 3;
  20200. y /= 3;
  20201. }
  20202. write_imagef(dst, loc, value);
  20203. }
  20204. @end verbatim
  20205. @end itemize
  20206. @section sierpinski
  20207. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  20208. This source accepts the following options:
  20209. @table @option
  20210. @item size, s
  20211. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  20212. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  20213. @item rate, r
  20214. Set frame rate, expressed as number of frames per second. Default
  20215. value is "25".
  20216. @item seed
  20217. Set seed which is used for random panning.
  20218. @item jump
  20219. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  20220. @item type
  20221. Set fractal type, can be default @code{carpet} or @code{triangle}.
  20222. @end table
  20223. @c man end VIDEO SOURCES
  20224. @chapter Video Sinks
  20225. @c man begin VIDEO SINKS
  20226. Below is a description of the currently available video sinks.
  20227. @section buffersink
  20228. Buffer video frames, and make them available to the end of the filter
  20229. graph.
  20230. This sink is mainly intended for programmatic use, in particular
  20231. through the interface defined in @file{libavfilter/buffersink.h}
  20232. or the options system.
  20233. It accepts a pointer to an AVBufferSinkContext structure, which
  20234. defines the incoming buffers' formats, to be passed as the opaque
  20235. parameter to @code{avfilter_init_filter} for initialization.
  20236. @section nullsink
  20237. Null video sink: do absolutely nothing with the input video. It is
  20238. mainly useful as a template and for use in analysis / debugging
  20239. tools.
  20240. @c man end VIDEO SINKS
  20241. @chapter Multimedia Filters
  20242. @c man begin MULTIMEDIA FILTERS
  20243. Below is a description of the currently available multimedia filters.
  20244. @section abitscope
  20245. Convert input audio to a video output, displaying the audio bit scope.
  20246. The filter accepts the following options:
  20247. @table @option
  20248. @item rate, r
  20249. Set frame rate, expressed as number of frames per second. Default
  20250. value is "25".
  20251. @item size, s
  20252. Specify the video size for the output. For the syntax of this option, check the
  20253. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20254. Default value is @code{1024x256}.
  20255. @item colors
  20256. Specify list of colors separated by space or by '|' which will be used to
  20257. draw channels. Unrecognized or missing colors will be replaced
  20258. by white color.
  20259. @item mode, m
  20260. Set output mode. Can be @code{bars} or @code{trace}. Default is @code{bars}.
  20261. @end table
  20262. @section adrawgraph
  20263. Draw a graph using input audio metadata.
  20264. See @ref{drawgraph}
  20265. @section agraphmonitor
  20266. See @ref{graphmonitor}.
  20267. @section ahistogram
  20268. Convert input audio to a video output, displaying the volume histogram.
  20269. The filter accepts the following options:
  20270. @table @option
  20271. @item dmode
  20272. Specify how histogram is calculated.
  20273. It accepts the following values:
  20274. @table @samp
  20275. @item single
  20276. Use single histogram for all channels.
  20277. @item separate
  20278. Use separate histogram for each channel.
  20279. @end table
  20280. Default is @code{single}.
  20281. @item rate, r
  20282. Set frame rate, expressed as number of frames per second. Default
  20283. value is "25".
  20284. @item size, s
  20285. Specify the video size for the output. For the syntax of this option, check the
  20286. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20287. Default value is @code{hd720}.
  20288. @item scale
  20289. Set display scale.
  20290. It accepts the following values:
  20291. @table @samp
  20292. @item log
  20293. logarithmic
  20294. @item sqrt
  20295. square root
  20296. @item cbrt
  20297. cubic root
  20298. @item lin
  20299. linear
  20300. @item rlog
  20301. reverse logarithmic
  20302. @end table
  20303. Default is @code{log}.
  20304. @item ascale
  20305. Set amplitude scale.
  20306. It accepts the following values:
  20307. @table @samp
  20308. @item log
  20309. logarithmic
  20310. @item lin
  20311. linear
  20312. @end table
  20313. Default is @code{log}.
  20314. @item acount
  20315. Set how much frames to accumulate in histogram.
  20316. Default is 1. Setting this to -1 accumulates all frames.
  20317. @item rheight
  20318. Set histogram ratio of window height.
  20319. @item slide
  20320. Set sonogram sliding.
  20321. It accepts the following values:
  20322. @table @samp
  20323. @item replace
  20324. replace old rows with new ones.
  20325. @item scroll
  20326. scroll from top to bottom.
  20327. @end table
  20328. Default is @code{replace}.
  20329. @item hmode
  20330. Set histogram mode.
  20331. It accepts the following values:
  20332. @table @samp
  20333. @item abs
  20334. Use absolute values of samples.
  20335. @item sign
  20336. Use untouched values of samples.
  20337. @end table
  20338. Default is @code{abs}.
  20339. @end table
  20340. @section aphasemeter
  20341. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  20342. representing mean phase of current audio frame. A video output can also be produced and is
  20343. enabled by default. The audio is passed through as first output.
  20344. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  20345. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  20346. and @code{1} means channels are in phase.
  20347. The filter accepts the following options, all related to its video output:
  20348. @table @option
  20349. @item rate, r
  20350. Set the output frame rate. Default value is @code{25}.
  20351. @item size, s
  20352. Set the video size for the output. For the syntax of this option, check the
  20353. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20354. Default value is @code{800x400}.
  20355. @item rc
  20356. @item gc
  20357. @item bc
  20358. Specify the red, green, blue contrast. Default values are @code{2},
  20359. @code{7} and @code{1}.
  20360. Allowed range is @code{[0, 255]}.
  20361. @item mpc
  20362. Set color which will be used for drawing median phase. If color is
  20363. @code{none} which is default, no median phase value will be drawn.
  20364. @item video
  20365. Enable video output. Default is enabled.
  20366. @end table
  20367. @subsection phasing detection
  20368. The filter also detects out of phase and mono sequences in stereo streams.
  20369. It logs the sequence start, end and duration when it lasts longer or as long as the minimum set.
  20370. The filter accepts the following options for this detection:
  20371. @table @option
  20372. @item phasing
  20373. Enable mono and out of phase detection. Default is disabled.
  20374. @item tolerance, t
  20375. Set phase tolerance for mono detection, in amplitude ratio. Default is @code{0}.
  20376. Allowed range is @code{[0, 1]}.
  20377. @item angle, a
  20378. Set angle threshold for out of phase detection, in degree. Default is @code{170}.
  20379. Allowed range is @code{[90, 180]}.
  20380. @item duration, d
  20381. Set mono or out of phase duration until notification, expressed in seconds. Default is @code{2}.
  20382. @end table
  20383. @subsection Examples
  20384. @itemize
  20385. @item
  20386. Complete example with @command{ffmpeg} to detect 1 second of mono with 0.001 phase tolerance:
  20387. @example
  20388. ffmpeg -i stereo.wav -af aphasemeter=video=0:phasing=1:duration=1:tolerance=0.001 -f null -
  20389. @end example
  20390. @end itemize
  20391. @section avectorscope
  20392. Convert input audio to a video output, representing the audio vector
  20393. scope.
  20394. The filter is used to measure the difference between channels of stereo
  20395. audio stream. A monaural signal, consisting of identical left and right
  20396. signal, results in straight vertical line. Any stereo separation is visible
  20397. as a deviation from this line, creating a Lissajous figure.
  20398. If the straight (or deviation from it) but horizontal line appears this
  20399. indicates that the left and right channels are out of phase.
  20400. The filter accepts the following options:
  20401. @table @option
  20402. @item mode, m
  20403. Set the vectorscope mode.
  20404. Available values are:
  20405. @table @samp
  20406. @item lissajous
  20407. Lissajous rotated by 45 degrees.
  20408. @item lissajous_xy
  20409. Same as above but not rotated.
  20410. @item polar
  20411. Shape resembling half of circle.
  20412. @end table
  20413. Default value is @samp{lissajous}.
  20414. @item size, s
  20415. Set the video size for the output. For the syntax of this option, check the
  20416. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20417. Default value is @code{400x400}.
  20418. @item rate, r
  20419. Set the output frame rate. Default value is @code{25}.
  20420. @item rc
  20421. @item gc
  20422. @item bc
  20423. @item ac
  20424. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  20425. @code{160}, @code{80} and @code{255}.
  20426. Allowed range is @code{[0, 255]}.
  20427. @item rf
  20428. @item gf
  20429. @item bf
  20430. @item af
  20431. Specify the red, green, blue and alpha fade. Default values are @code{15},
  20432. @code{10}, @code{5} and @code{5}.
  20433. Allowed range is @code{[0, 255]}.
  20434. @item zoom
  20435. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  20436. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  20437. @item draw
  20438. Set the vectorscope drawing mode.
  20439. Available values are:
  20440. @table @samp
  20441. @item dot
  20442. Draw dot for each sample.
  20443. @item line
  20444. Draw line between previous and current sample.
  20445. @end table
  20446. Default value is @samp{dot}.
  20447. @item scale
  20448. Specify amplitude scale of audio samples.
  20449. Available values are:
  20450. @table @samp
  20451. @item lin
  20452. Linear.
  20453. @item sqrt
  20454. Square root.
  20455. @item cbrt
  20456. Cubic root.
  20457. @item log
  20458. Logarithmic.
  20459. @end table
  20460. @item swap
  20461. Swap left channel axis with right channel axis.
  20462. @item mirror
  20463. Mirror axis.
  20464. @table @samp
  20465. @item none
  20466. No mirror.
  20467. @item x
  20468. Mirror only x axis.
  20469. @item y
  20470. Mirror only y axis.
  20471. @item xy
  20472. Mirror both axis.
  20473. @end table
  20474. @end table
  20475. @subsection Examples
  20476. @itemize
  20477. @item
  20478. Complete example using @command{ffplay}:
  20479. @example
  20480. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  20481. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  20482. @end example
  20483. @end itemize
  20484. @subsection Commands
  20485. This filter supports the all above options as commands except options @code{size} and @code{rate}.
  20486. @section bench, abench
  20487. Benchmark part of a filtergraph.
  20488. The filter accepts the following options:
  20489. @table @option
  20490. @item action
  20491. Start or stop a timer.
  20492. Available values are:
  20493. @table @samp
  20494. @item start
  20495. Get the current time, set it as frame metadata (using the key
  20496. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  20497. @item stop
  20498. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  20499. the input frame metadata to get the time difference. Time difference, average,
  20500. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  20501. @code{min}) are then printed. The timestamps are expressed in seconds.
  20502. @end table
  20503. @end table
  20504. @subsection Examples
  20505. @itemize
  20506. @item
  20507. Benchmark @ref{selectivecolor} filter:
  20508. @example
  20509. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  20510. @end example
  20511. @end itemize
  20512. @section concat
  20513. Concatenate audio and video streams, joining them together one after the
  20514. other.
  20515. The filter works on segments of synchronized video and audio streams. All
  20516. segments must have the same number of streams of each type, and that will
  20517. also be the number of streams at output.
  20518. The filter accepts the following options:
  20519. @table @option
  20520. @item n
  20521. Set the number of segments. Default is 2.
  20522. @item v
  20523. Set the number of output video streams, that is also the number of video
  20524. streams in each segment. Default is 1.
  20525. @item a
  20526. Set the number of output audio streams, that is also the number of audio
  20527. streams in each segment. Default is 0.
  20528. @item unsafe
  20529. Activate unsafe mode: do not fail if segments have a different format.
  20530. @end table
  20531. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  20532. @var{a} audio outputs.
  20533. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  20534. segment, in the same order as the outputs, then the inputs for the second
  20535. segment, etc.
  20536. Related streams do not always have exactly the same duration, for various
  20537. reasons including codec frame size or sloppy authoring. For that reason,
  20538. related synchronized streams (e.g. a video and its audio track) should be
  20539. concatenated at once. The concat filter will use the duration of the longest
  20540. stream in each segment (except the last one), and if necessary pad shorter
  20541. audio streams with silence.
  20542. For this filter to work correctly, all segments must start at timestamp 0.
  20543. All corresponding streams must have the same parameters in all segments; the
  20544. filtering system will automatically select a common pixel format for video
  20545. streams, and a common sample format, sample rate and channel layout for
  20546. audio streams, but other settings, such as resolution, must be converted
  20547. explicitly by the user.
  20548. Different frame rates are acceptable but will result in variable frame rate
  20549. at output; be sure to configure the output file to handle it.
  20550. @subsection Examples
  20551. @itemize
  20552. @item
  20553. Concatenate an opening, an episode and an ending, all in bilingual version
  20554. (video in stream 0, audio in streams 1 and 2):
  20555. @example
  20556. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  20557. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  20558. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  20559. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  20560. @end example
  20561. @item
  20562. Concatenate two parts, handling audio and video separately, using the
  20563. (a)movie sources, and adjusting the resolution:
  20564. @example
  20565. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  20566. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  20567. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  20568. @end example
  20569. Note that a desync will happen at the stitch if the audio and video streams
  20570. do not have exactly the same duration in the first file.
  20571. @end itemize
  20572. @subsection Commands
  20573. This filter supports the following commands:
  20574. @table @option
  20575. @item next
  20576. Close the current segment and step to the next one
  20577. @end table
  20578. @anchor{ebur128}
  20579. @section ebur128
  20580. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  20581. level. By default, it logs a message at a frequency of 10Hz with the
  20582. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  20583. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  20584. The filter can only analyze streams which have
  20585. sample format is double-precision floating point. The input stream will be converted to
  20586. this specification, if needed. Users may need to insert aformat and/or aresample filters
  20587. after this filter to obtain the original parameters.
  20588. The filter also has a video output (see the @var{video} option) with a real
  20589. time graph to observe the loudness evolution. The graphic contains the logged
  20590. message mentioned above, so it is not printed anymore when this option is set,
  20591. unless the verbose logging is set. The main graphing area contains the
  20592. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  20593. the momentary loudness (400 milliseconds), but can optionally be configured
  20594. to instead display short-term loudness (see @var{gauge}).
  20595. The green area marks a +/- 1LU target range around the target loudness
  20596. (-23LUFS by default, unless modified through @var{target}).
  20597. More information about the Loudness Recommendation EBU R128 on
  20598. @url{http://tech.ebu.ch/loudness}.
  20599. The filter accepts the following options:
  20600. @table @option
  20601. @item video
  20602. Activate the video output. The audio stream is passed unchanged whether this
  20603. option is set or no. The video stream will be the first output stream if
  20604. activated. Default is @code{0}.
  20605. @item size
  20606. Set the video size. This option is for video only. For the syntax of this
  20607. option, check the
  20608. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20609. Default and minimum resolution is @code{640x480}.
  20610. @item meter
  20611. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  20612. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  20613. other integer value between this range is allowed.
  20614. @item metadata
  20615. Set metadata injection. If set to @code{1}, the audio input will be segmented
  20616. into 100ms output frames, each of them containing various loudness information
  20617. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  20618. Default is @code{0}.
  20619. @item framelog
  20620. Force the frame logging level.
  20621. Available values are:
  20622. @table @samp
  20623. @item info
  20624. information logging level
  20625. @item verbose
  20626. verbose logging level
  20627. @end table
  20628. By default, the logging level is set to @var{info}. If the @option{video} or
  20629. the @option{metadata} options are set, it switches to @var{verbose}.
  20630. @item peak
  20631. Set peak mode(s).
  20632. Available modes can be cumulated (the option is a @code{flag} type). Possible
  20633. values are:
  20634. @table @samp
  20635. @item none
  20636. Disable any peak mode (default).
  20637. @item sample
  20638. Enable sample-peak mode.
  20639. Simple peak mode looking for the higher sample value. It logs a message
  20640. for sample-peak (identified by @code{SPK}).
  20641. @item true
  20642. Enable true-peak mode.
  20643. If enabled, the peak lookup is done on an over-sampled version of the input
  20644. stream for better peak accuracy. It logs a message for true-peak.
  20645. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  20646. This mode requires a build with @code{libswresample}.
  20647. @end table
  20648. @item dualmono
  20649. Treat mono input files as "dual mono". If a mono file is intended for playback
  20650. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  20651. If set to @code{true}, this option will compensate for this effect.
  20652. Multi-channel input files are not affected by this option.
  20653. @item panlaw
  20654. Set a specific pan law to be used for the measurement of dual mono files.
  20655. This parameter is optional, and has a default value of -3.01dB.
  20656. @item target
  20657. Set a specific target level (in LUFS) used as relative zero in the visualization.
  20658. This parameter is optional and has a default value of -23LUFS as specified
  20659. by EBU R128. However, material published online may prefer a level of -16LUFS
  20660. (e.g. for use with podcasts or video platforms).
  20661. @item gauge
  20662. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  20663. @code{shortterm}. By default the momentary value will be used, but in certain
  20664. scenarios it may be more useful to observe the short term value instead (e.g.
  20665. live mixing).
  20666. @item scale
  20667. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  20668. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  20669. video output, not the summary or continuous log output.
  20670. @end table
  20671. @subsection Examples
  20672. @itemize
  20673. @item
  20674. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  20675. @example
  20676. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  20677. @end example
  20678. @item
  20679. Run an analysis with @command{ffmpeg}:
  20680. @example
  20681. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  20682. @end example
  20683. @end itemize
  20684. @section interleave, ainterleave
  20685. Temporally interleave frames from several inputs.
  20686. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  20687. These filters read frames from several inputs and send the oldest
  20688. queued frame to the output.
  20689. Input streams must have well defined, monotonically increasing frame
  20690. timestamp values.
  20691. In order to submit one frame to output, these filters need to enqueue
  20692. at least one frame for each input, so they cannot work in case one
  20693. input is not yet terminated and will not receive incoming frames.
  20694. For example consider the case when one input is a @code{select} filter
  20695. which always drops input frames. The @code{interleave} filter will keep
  20696. reading from that input, but it will never be able to send new frames
  20697. to output until the input sends an end-of-stream signal.
  20698. Also, depending on inputs synchronization, the filters will drop
  20699. frames in case one input receives more frames than the other ones, and
  20700. the queue is already filled.
  20701. These filters accept the following options:
  20702. @table @option
  20703. @item nb_inputs, n
  20704. Set the number of different inputs, it is 2 by default.
  20705. @item duration
  20706. How to determine the end-of-stream.
  20707. @table @option
  20708. @item longest
  20709. The duration of the longest input. (default)
  20710. @item shortest
  20711. The duration of the shortest input.
  20712. @item first
  20713. The duration of the first input.
  20714. @end table
  20715. @end table
  20716. @subsection Examples
  20717. @itemize
  20718. @item
  20719. Interleave frames belonging to different streams using @command{ffmpeg}:
  20720. @example
  20721. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  20722. @end example
  20723. @item
  20724. Add flickering blur effect:
  20725. @example
  20726. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  20727. @end example
  20728. @end itemize
  20729. @section latency, alatency
  20730. Measure filtering latency.
  20731. Report previous filter filtering latency, delay in number of audio samples for audio filters
  20732. or number of video frames for video filters.
  20733. On end of input stream, filter will report min and max measured latency for previous running filter
  20734. in filtergraph.
  20735. @section metadata, ametadata
  20736. Manipulate frame metadata.
  20737. This filter accepts the following options:
  20738. @table @option
  20739. @item mode
  20740. Set mode of operation of the filter.
  20741. Can be one of the following:
  20742. @table @samp
  20743. @item select
  20744. If both @code{value} and @code{key} is set, select frames
  20745. which have such metadata. If only @code{key} is set, select
  20746. every frame that has such key in metadata.
  20747. @item add
  20748. Add new metadata @code{key} and @code{value}. If key is already available
  20749. do nothing.
  20750. @item modify
  20751. Modify value of already present key.
  20752. @item delete
  20753. If @code{value} is set, delete only keys that have such value.
  20754. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  20755. the frame.
  20756. @item print
  20757. Print key and its value if metadata was found. If @code{key} is not set print all
  20758. metadata values available in frame.
  20759. @end table
  20760. @item key
  20761. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  20762. @item value
  20763. Set metadata value which will be used. This option is mandatory for
  20764. @code{modify} and @code{add} mode.
  20765. @item function
  20766. Which function to use when comparing metadata value and @code{value}.
  20767. Can be one of following:
  20768. @table @samp
  20769. @item same_str
  20770. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  20771. @item starts_with
  20772. Values are interpreted as strings, returns true if metadata value starts with
  20773. the @code{value} option string.
  20774. @item less
  20775. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  20776. @item equal
  20777. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  20778. @item greater
  20779. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  20780. @item expr
  20781. Values are interpreted as floats, returns true if expression from option @code{expr}
  20782. evaluates to true.
  20783. @item ends_with
  20784. Values are interpreted as strings, returns true if metadata value ends with
  20785. the @code{value} option string.
  20786. @end table
  20787. @item expr
  20788. Set expression which is used when @code{function} is set to @code{expr}.
  20789. The expression is evaluated through the eval API and can contain the following
  20790. constants:
  20791. @table @option
  20792. @item VALUE1, FRAMEVAL
  20793. Float representation of @code{value} from metadata key.
  20794. @item VALUE2, USERVAL
  20795. Float representation of @code{value} as supplied by user in @code{value} option.
  20796. @end table
  20797. @item file
  20798. If specified in @code{print} mode, output is written to the named file. Instead of
  20799. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  20800. for standard output. If @code{file} option is not set, output is written to the log
  20801. with AV_LOG_INFO loglevel.
  20802. @item direct
  20803. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  20804. @end table
  20805. @subsection Examples
  20806. @itemize
  20807. @item
  20808. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  20809. between 0 and 1.
  20810. @example
  20811. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  20812. @end example
  20813. @item
  20814. Print silencedetect output to file @file{metadata.txt}.
  20815. @example
  20816. silencedetect,ametadata=mode=print:file=metadata.txt
  20817. @end example
  20818. @item
  20819. Direct all metadata to a pipe with file descriptor 4.
  20820. @example
  20821. metadata=mode=print:file='pipe\:4'
  20822. @end example
  20823. @end itemize
  20824. @section perms, aperms
  20825. Set read/write permissions for the output frames.
  20826. These filters are mainly aimed at developers to test direct path in the
  20827. following filter in the filtergraph.
  20828. The filters accept the following options:
  20829. @table @option
  20830. @item mode
  20831. Select the permissions mode.
  20832. It accepts the following values:
  20833. @table @samp
  20834. @item none
  20835. Do nothing. This is the default.
  20836. @item ro
  20837. Set all the output frames read-only.
  20838. @item rw
  20839. Set all the output frames directly writable.
  20840. @item toggle
  20841. Make the frame read-only if writable, and writable if read-only.
  20842. @item random
  20843. Set each output frame read-only or writable randomly.
  20844. @end table
  20845. @item seed
  20846. Set the seed for the @var{random} mode, must be an integer included between
  20847. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  20848. @code{-1}, the filter will try to use a good random seed on a best effort
  20849. basis.
  20850. @end table
  20851. Note: in case of auto-inserted filter between the permission filter and the
  20852. following one, the permission might not be received as expected in that
  20853. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  20854. perms/aperms filter can avoid this problem.
  20855. @section realtime, arealtime
  20856. Slow down filtering to match real time approximately.
  20857. These filters will pause the filtering for a variable amount of time to
  20858. match the output rate with the input timestamps.
  20859. They are similar to the @option{re} option to @code{ffmpeg}.
  20860. They accept the following options:
  20861. @table @option
  20862. @item limit
  20863. Time limit for the pauses. Any pause longer than that will be considered
  20864. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  20865. @item speed
  20866. Speed factor for processing. The value must be a float larger than zero.
  20867. Values larger than 1.0 will result in faster than realtime processing,
  20868. smaller will slow processing down. The @var{limit} is automatically adapted
  20869. accordingly. Default is 1.0.
  20870. A processing speed faster than what is possible without these filters cannot
  20871. be achieved.
  20872. @end table
  20873. @subsection Commands
  20874. Both filters supports the all above options as @ref{commands}.
  20875. @section segment, asegment
  20876. Split single input stream into multiple streams.
  20877. This filter does opposite of concat filters.
  20878. @code{segment} works on video frames, @code{asegment} on audio samples.
  20879. This filter accepts the following options:
  20880. @table @option
  20881. @item timestamps
  20882. Timestamps of output segments separated by '|'. The first segment will run
  20883. from the beginning of the input stream. The last segment will run until
  20884. the end of the input stream
  20885. @item frames, samples
  20886. Exact frame/sample count to split the segments.
  20887. @end table
  20888. In all cases, prefixing an each segment with '+' will make it relative to the
  20889. previous segment.
  20890. @subsection Examples
  20891. @itemize
  20892. @item
  20893. Split input audio stream into three output audio streams, starting at start of input audio stream
  20894. and storing that in 1st output audio stream, then following at 60th second and storing than in 2nd
  20895. output audio stream, and last after 150th second of input audio stream store in 3rd output audio stream:
  20896. @example
  20897. asegment=timestamps="60|150"
  20898. @end example
  20899. @end itemize
  20900. @anchor{select}
  20901. @section select, aselect
  20902. Select frames to pass in output.
  20903. This filter accepts the following options:
  20904. @table @option
  20905. @item expr, e
  20906. Set expression, which is evaluated for each input frame.
  20907. If the expression is evaluated to zero, the frame is discarded.
  20908. If the evaluation result is negative or NaN, the frame is sent to the
  20909. first output; otherwise it is sent to the output with index
  20910. @code{ceil(val)-1}, assuming that the input index starts from 0.
  20911. For example a value of @code{1.2} corresponds to the output with index
  20912. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  20913. @item outputs, n
  20914. Set the number of outputs. The output to which to send the selected
  20915. frame is based on the result of the evaluation. Default value is 1.
  20916. @end table
  20917. The expression can contain the following constants:
  20918. @table @option
  20919. @item n
  20920. The (sequential) number of the filtered frame, starting from 0.
  20921. @item selected_n
  20922. The (sequential) number of the selected frame, starting from 0.
  20923. @item prev_selected_n
  20924. The sequential number of the last selected frame. It's NAN if undefined.
  20925. @item TB
  20926. The timebase of the input timestamps.
  20927. @item pts
  20928. The PTS (Presentation TimeStamp) of the filtered frame,
  20929. expressed in @var{TB} units. It's NAN if undefined.
  20930. @item t
  20931. The PTS of the filtered frame,
  20932. expressed in seconds. It's NAN if undefined.
  20933. @item prev_pts
  20934. The PTS of the previously filtered frame. It's NAN if undefined.
  20935. @item prev_selected_pts
  20936. The PTS of the last previously filtered frame. It's NAN if undefined.
  20937. @item prev_selected_t
  20938. The PTS of the last previously selected frame, expressed in seconds. It's NAN if undefined.
  20939. @item start_pts
  20940. The first PTS in the stream which is not NAN. It remains NAN if not found.
  20941. @item start_t
  20942. The first PTS, in seconds, in the stream which is not NAN. It remains NAN if not found.
  20943. @item pict_type @emph{(video only)}
  20944. The type of the filtered frame. It can assume one of the following
  20945. values:
  20946. @table @option
  20947. @item I
  20948. @item P
  20949. @item B
  20950. @item S
  20951. @item SI
  20952. @item SP
  20953. @item BI
  20954. @end table
  20955. @item interlace_type @emph{(video only)}
  20956. The frame interlace type. It can assume one of the following values:
  20957. @table @option
  20958. @item PROGRESSIVE
  20959. The frame is progressive (not interlaced).
  20960. @item TOPFIRST
  20961. The frame is top-field-first.
  20962. @item BOTTOMFIRST
  20963. The frame is bottom-field-first.
  20964. @end table
  20965. @item consumed_sample_n @emph{(audio only)}
  20966. the number of selected samples before the current frame
  20967. @item samples_n @emph{(audio only)}
  20968. the number of samples in the current frame
  20969. @item sample_rate @emph{(audio only)}
  20970. the input sample rate
  20971. @item key
  20972. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  20973. @item pos
  20974. the position in the file of the filtered frame, -1 if the information
  20975. is not available (e.g. for synthetic video)
  20976. @item scene @emph{(video only)}
  20977. value between 0 and 1 to indicate a new scene; a low value reflects a low
  20978. probability for the current frame to introduce a new scene, while a higher
  20979. value means the current frame is more likely to be one (see the example below)
  20980. @item concatdec_select
  20981. The concat demuxer can select only part of a concat input file by setting an
  20982. inpoint and an outpoint, but the output packets may not be entirely contained
  20983. in the selected interval. By using this variable, it is possible to skip frames
  20984. generated by the concat demuxer which are not exactly contained in the selected
  20985. interval.
  20986. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  20987. and the @var{lavf.concat.duration} packet metadata values which are also
  20988. present in the decoded frames.
  20989. The @var{concatdec_select} variable is -1 if the frame pts is at least
  20990. start_time and either the duration metadata is missing or the frame pts is less
  20991. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  20992. missing.
  20993. That basically means that an input frame is selected if its pts is within the
  20994. interval set by the concat demuxer.
  20995. @end table
  20996. The default value of the select expression is "1".
  20997. @subsection Examples
  20998. @itemize
  20999. @item
  21000. Select all frames in input:
  21001. @example
  21002. select
  21003. @end example
  21004. The example above is the same as:
  21005. @example
  21006. select=1
  21007. @end example
  21008. @item
  21009. Skip all frames:
  21010. @example
  21011. select=0
  21012. @end example
  21013. @item
  21014. Select only I-frames:
  21015. @example
  21016. select='eq(pict_type\,I)'
  21017. @end example
  21018. @item
  21019. Select one frame every 100:
  21020. @example
  21021. select='not(mod(n\,100))'
  21022. @end example
  21023. @item
  21024. Select only frames contained in the 10-20 time interval:
  21025. @example
  21026. select=between(t\,10\,20)
  21027. @end example
  21028. @item
  21029. Select only I-frames contained in the 10-20 time interval:
  21030. @example
  21031. select=between(t\,10\,20)*eq(pict_type\,I)
  21032. @end example
  21033. @item
  21034. Select frames with a minimum distance of 10 seconds:
  21035. @example
  21036. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  21037. @end example
  21038. @item
  21039. Use aselect to select only audio frames with samples number > 100:
  21040. @example
  21041. aselect='gt(samples_n\,100)'
  21042. @end example
  21043. @item
  21044. Create a mosaic of the first scenes:
  21045. @example
  21046. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  21047. @end example
  21048. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  21049. choice.
  21050. @item
  21051. Send even and odd frames to separate outputs, and compose them:
  21052. @example
  21053. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  21054. @end example
  21055. @item
  21056. Select useful frames from an ffconcat file which is using inpoints and
  21057. outpoints but where the source files are not intra frame only.
  21058. @example
  21059. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  21060. @end example
  21061. @end itemize
  21062. @section sendcmd, asendcmd
  21063. Send commands to filters in the filtergraph.
  21064. These filters read commands to be sent to other filters in the
  21065. filtergraph.
  21066. @code{sendcmd} must be inserted between two video filters,
  21067. @code{asendcmd} must be inserted between two audio filters, but apart
  21068. from that they act the same way.
  21069. The specification of commands can be provided in the filter arguments
  21070. with the @var{commands} option, or in a file specified by the
  21071. @var{filename} option.
  21072. These filters accept the following options:
  21073. @table @option
  21074. @item commands, c
  21075. Set the commands to be read and sent to the other filters.
  21076. @item filename, f
  21077. Set the filename of the commands to be read and sent to the other
  21078. filters.
  21079. @end table
  21080. @subsection Commands syntax
  21081. A commands description consists of a sequence of interval
  21082. specifications, comprising a list of commands to be executed when a
  21083. particular event related to that interval occurs. The occurring event
  21084. is typically the current frame time entering or leaving a given time
  21085. interval.
  21086. An interval is specified by the following syntax:
  21087. @example
  21088. @var{START}[-@var{END}] @var{COMMANDS};
  21089. @end example
  21090. The time interval is specified by the @var{START} and @var{END} times.
  21091. @var{END} is optional and defaults to the maximum time.
  21092. The current frame time is considered within the specified interval if
  21093. it is included in the interval [@var{START}, @var{END}), that is when
  21094. the time is greater or equal to @var{START} and is lesser than
  21095. @var{END}.
  21096. @var{COMMANDS} consists of a sequence of one or more command
  21097. specifications, separated by ",", relating to that interval. The
  21098. syntax of a command specification is given by:
  21099. @example
  21100. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  21101. @end example
  21102. @var{FLAGS} is optional and specifies the type of events relating to
  21103. the time interval which enable sending the specified command, and must
  21104. be a non-null sequence of identifier flags separated by "+" or "|" and
  21105. enclosed between "[" and "]".
  21106. The following flags are recognized:
  21107. @table @option
  21108. @item enter
  21109. The command is sent when the current frame timestamp enters the
  21110. specified interval. In other words, the command is sent when the
  21111. previous frame timestamp was not in the given interval, and the
  21112. current is.
  21113. @item leave
  21114. The command is sent when the current frame timestamp leaves the
  21115. specified interval. In other words, the command is sent when the
  21116. previous frame timestamp was in the given interval, and the
  21117. current is not.
  21118. @item expr
  21119. The command @var{ARG} is interpreted as expression and result of
  21120. expression is passed as @var{ARG}.
  21121. The expression is evaluated through the eval API and can contain the following
  21122. constants:
  21123. @table @option
  21124. @item POS
  21125. Original position in the file of the frame, or undefined if undefined
  21126. for the current frame.
  21127. @item PTS
  21128. The presentation timestamp in input.
  21129. @item N
  21130. The count of the input frame for video or audio, starting from 0.
  21131. @item T
  21132. The time in seconds of the current frame.
  21133. @item TS
  21134. The start time in seconds of the current command interval.
  21135. @item TE
  21136. The end time in seconds of the current command interval.
  21137. @item TI
  21138. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  21139. @item W
  21140. The video frame width.
  21141. @item H
  21142. The video frame height.
  21143. @end table
  21144. @end table
  21145. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  21146. assumed.
  21147. @var{TARGET} specifies the target of the command, usually the name of
  21148. the filter class or a specific filter instance name.
  21149. @var{COMMAND} specifies the name of the command for the target filter.
  21150. @var{ARG} is optional and specifies the optional list of argument for
  21151. the given @var{COMMAND}.
  21152. Between one interval specification and another, whitespaces, or
  21153. sequences of characters starting with @code{#} until the end of line,
  21154. are ignored and can be used to annotate comments.
  21155. A simplified BNF description of the commands specification syntax
  21156. follows:
  21157. @example
  21158. @var{COMMAND_FLAG} ::= "enter" | "leave"
  21159. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  21160. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  21161. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  21162. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  21163. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  21164. @end example
  21165. @subsection Examples
  21166. @itemize
  21167. @item
  21168. Specify audio tempo change at second 4:
  21169. @example
  21170. asendcmd=c='4.0 atempo tempo 1.5',atempo
  21171. @end example
  21172. @item
  21173. Target a specific filter instance:
  21174. @example
  21175. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  21176. @end example
  21177. @item
  21178. Specify a list of drawtext and hue commands in a file.
  21179. @example
  21180. # show text in the interval 5-10
  21181. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  21182. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  21183. # desaturate the image in the interval 15-20
  21184. 15.0-20.0 [enter] hue s 0,
  21185. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  21186. [leave] hue s 1,
  21187. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  21188. # apply an exponential saturation fade-out effect, starting from time 25
  21189. 25 [enter] hue s exp(25-t)
  21190. @end example
  21191. A filtergraph allowing to read and process the above command list
  21192. stored in a file @file{test.cmd}, can be specified with:
  21193. @example
  21194. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  21195. @end example
  21196. @end itemize
  21197. @anchor{setpts}
  21198. @section setpts, asetpts
  21199. Change the PTS (presentation timestamp) of the input frames.
  21200. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  21201. This filter accepts the following options:
  21202. @table @option
  21203. @item expr
  21204. The expression which is evaluated for each frame to construct its timestamp.
  21205. @end table
  21206. The expression is evaluated through the eval API and can contain the following
  21207. constants:
  21208. @table @option
  21209. @item FRAME_RATE, FR
  21210. frame rate, only defined for constant frame-rate video
  21211. @item PTS
  21212. The presentation timestamp in input
  21213. @item N
  21214. The count of the input frame for video or the number of consumed samples,
  21215. not including the current frame for audio, starting from 0.
  21216. @item NB_CONSUMED_SAMPLES
  21217. The number of consumed samples, not including the current frame (only
  21218. audio)
  21219. @item NB_SAMPLES, S
  21220. The number of samples in the current frame (only audio)
  21221. @item SAMPLE_RATE, SR
  21222. The audio sample rate.
  21223. @item STARTPTS
  21224. The PTS of the first frame.
  21225. @item STARTT
  21226. the time in seconds of the first frame
  21227. @item INTERLACED
  21228. State whether the current frame is interlaced.
  21229. @item T
  21230. the time in seconds of the current frame
  21231. @item POS
  21232. original position in the file of the frame, or undefined if undefined
  21233. for the current frame
  21234. @item PREV_INPTS
  21235. The previous input PTS.
  21236. @item PREV_INT
  21237. previous input time in seconds
  21238. @item PREV_OUTPTS
  21239. The previous output PTS.
  21240. @item PREV_OUTT
  21241. previous output time in seconds
  21242. @item RTCTIME
  21243. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  21244. instead.
  21245. @item RTCSTART
  21246. The wallclock (RTC) time at the start of the movie in microseconds.
  21247. @item TB
  21248. The timebase of the input timestamps.
  21249. @end table
  21250. @subsection Examples
  21251. @itemize
  21252. @item
  21253. Start counting PTS from zero
  21254. @example
  21255. setpts=PTS-STARTPTS
  21256. @end example
  21257. @item
  21258. Apply fast motion effect:
  21259. @example
  21260. setpts=0.5*PTS
  21261. @end example
  21262. @item
  21263. Apply slow motion effect:
  21264. @example
  21265. setpts=2.0*PTS
  21266. @end example
  21267. @item
  21268. Set fixed rate of 25 frames per second:
  21269. @example
  21270. setpts=N/(25*TB)
  21271. @end example
  21272. @item
  21273. Set fixed rate 25 fps with some jitter:
  21274. @example
  21275. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  21276. @end example
  21277. @item
  21278. Apply an offset of 10 seconds to the input PTS:
  21279. @example
  21280. setpts=PTS+10/TB
  21281. @end example
  21282. @item
  21283. Generate timestamps from a "live source" and rebase onto the current timebase:
  21284. @example
  21285. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  21286. @end example
  21287. @item
  21288. Generate timestamps by counting samples:
  21289. @example
  21290. asetpts=N/SR/TB
  21291. @end example
  21292. @end itemize
  21293. @section setrange
  21294. Force color range for the output video frame.
  21295. The @code{setrange} filter marks the color range property for the
  21296. output frames. It does not change the input frame, but only sets the
  21297. corresponding property, which affects how the frame is treated by
  21298. following filters.
  21299. The filter accepts the following options:
  21300. @table @option
  21301. @item range
  21302. Available values are:
  21303. @table @samp
  21304. @item auto
  21305. Keep the same color range property.
  21306. @item unspecified, unknown
  21307. Set the color range as unspecified.
  21308. @item limited, tv, mpeg
  21309. Set the color range as limited.
  21310. @item full, pc, jpeg
  21311. Set the color range as full.
  21312. @end table
  21313. @end table
  21314. @section settb, asettb
  21315. Set the timebase to use for the output frames timestamps.
  21316. It is mainly useful for testing timebase configuration.
  21317. It accepts the following parameters:
  21318. @table @option
  21319. @item expr, tb
  21320. The expression which is evaluated into the output timebase.
  21321. @end table
  21322. The value for @option{tb} is an arithmetic expression representing a
  21323. rational. The expression can contain the constants "AVTB" (the default
  21324. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  21325. audio only). Default value is "intb".
  21326. @subsection Examples
  21327. @itemize
  21328. @item
  21329. Set the timebase to 1/25:
  21330. @example
  21331. settb=expr=1/25
  21332. @end example
  21333. @item
  21334. Set the timebase to 1/10:
  21335. @example
  21336. settb=expr=0.1
  21337. @end example
  21338. @item
  21339. Set the timebase to 1001/1000:
  21340. @example
  21341. settb=1+0.001
  21342. @end example
  21343. @item
  21344. Set the timebase to 2*intb:
  21345. @example
  21346. settb=2*intb
  21347. @end example
  21348. @item
  21349. Set the default timebase value:
  21350. @example
  21351. settb=AVTB
  21352. @end example
  21353. @end itemize
  21354. @section showcqt
  21355. Convert input audio to a video output representing frequency spectrum
  21356. logarithmically using Brown-Puckette constant Q transform algorithm with
  21357. direct frequency domain coefficient calculation (but the transform itself
  21358. is not really constant Q, instead the Q factor is actually variable/clamped),
  21359. with musical tone scale, from E0 to D#10.
  21360. The filter accepts the following options:
  21361. @table @option
  21362. @item size, s
  21363. Specify the video size for the output. It must be even. For the syntax of this option,
  21364. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21365. Default value is @code{1920x1080}.
  21366. @item fps, rate, r
  21367. Set the output frame rate. Default value is @code{25}.
  21368. @item bar_h
  21369. Set the bargraph height. It must be even. Default value is @code{-1} which
  21370. computes the bargraph height automatically.
  21371. @item axis_h
  21372. Set the axis height. It must be even. Default value is @code{-1} which computes
  21373. the axis height automatically.
  21374. @item sono_h
  21375. Set the sonogram height. It must be even. Default value is @code{-1} which
  21376. computes the sonogram height automatically.
  21377. @item fullhd
  21378. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  21379. instead. Default value is @code{1}.
  21380. @item sono_v, volume
  21381. Specify the sonogram volume expression. It can contain variables:
  21382. @table @option
  21383. @item bar_v
  21384. the @var{bar_v} evaluated expression
  21385. @item frequency, freq, f
  21386. the frequency where it is evaluated
  21387. @item timeclamp, tc
  21388. the value of @var{timeclamp} option
  21389. @end table
  21390. and functions:
  21391. @table @option
  21392. @item a_weighting(f)
  21393. A-weighting of equal loudness
  21394. @item b_weighting(f)
  21395. B-weighting of equal loudness
  21396. @item c_weighting(f)
  21397. C-weighting of equal loudness.
  21398. @end table
  21399. Default value is @code{16}.
  21400. @item bar_v, volume2
  21401. Specify the bargraph volume expression. It can contain variables:
  21402. @table @option
  21403. @item sono_v
  21404. the @var{sono_v} evaluated expression
  21405. @item frequency, freq, f
  21406. the frequency where it is evaluated
  21407. @item timeclamp, tc
  21408. the value of @var{timeclamp} option
  21409. @end table
  21410. and functions:
  21411. @table @option
  21412. @item a_weighting(f)
  21413. A-weighting of equal loudness
  21414. @item b_weighting(f)
  21415. B-weighting of equal loudness
  21416. @item c_weighting(f)
  21417. C-weighting of equal loudness.
  21418. @end table
  21419. Default value is @code{sono_v}.
  21420. @item sono_g, gamma
  21421. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  21422. higher gamma makes the spectrum having more range. Default value is @code{3}.
  21423. Acceptable range is @code{[1, 7]}.
  21424. @item bar_g, gamma2
  21425. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  21426. @code{[1, 7]}.
  21427. @item bar_t
  21428. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  21429. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  21430. @item timeclamp, tc
  21431. Specify the transform timeclamp. At low frequency, there is trade-off between
  21432. accuracy in time domain and frequency domain. If timeclamp is lower,
  21433. event in time domain is represented more accurately (such as fast bass drum),
  21434. otherwise event in frequency domain is represented more accurately
  21435. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  21436. @item attack
  21437. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  21438. limits future samples by applying asymmetric windowing in time domain, useful
  21439. when low latency is required. Accepted range is @code{[0, 1]}.
  21440. @item basefreq
  21441. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  21442. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  21443. @item endfreq
  21444. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  21445. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  21446. @item coeffclamp
  21447. This option is deprecated and ignored.
  21448. @item tlength
  21449. Specify the transform length in time domain. Use this option to control accuracy
  21450. trade-off between time domain and frequency domain at every frequency sample.
  21451. It can contain variables:
  21452. @table @option
  21453. @item frequency, freq, f
  21454. the frequency where it is evaluated
  21455. @item timeclamp, tc
  21456. the value of @var{timeclamp} option.
  21457. @end table
  21458. Default value is @code{384*tc/(384+tc*f)}.
  21459. @item count
  21460. Specify the transform count for every video frame. Default value is @code{6}.
  21461. Acceptable range is @code{[1, 30]}.
  21462. @item fcount
  21463. Specify the transform count for every single pixel. Default value is @code{0},
  21464. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  21465. @item fontfile
  21466. Specify font file for use with freetype to draw the axis. If not specified,
  21467. use embedded font. Note that drawing with font file or embedded font is not
  21468. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  21469. option instead.
  21470. @item font
  21471. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  21472. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  21473. escaping.
  21474. @item fontcolor
  21475. Specify font color expression. This is arithmetic expression that should return
  21476. integer value 0xRRGGBB. It can contain variables:
  21477. @table @option
  21478. @item frequency, freq, f
  21479. the frequency where it is evaluated
  21480. @item timeclamp, tc
  21481. the value of @var{timeclamp} option
  21482. @end table
  21483. and functions:
  21484. @table @option
  21485. @item midi(f)
  21486. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  21487. @item r(x), g(x), b(x)
  21488. red, green, and blue value of intensity x.
  21489. @end table
  21490. Default value is @code{st(0, (midi(f)-59.5)/12);
  21491. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  21492. r(1-ld(1)) + b(ld(1))}.
  21493. @item axisfile
  21494. Specify image file to draw the axis. This option override @var{fontfile} and
  21495. @var{fontcolor} option.
  21496. @item axis, text
  21497. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  21498. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  21499. Default value is @code{1}.
  21500. @item csp
  21501. Set colorspace. The accepted values are:
  21502. @table @samp
  21503. @item unspecified
  21504. Unspecified (default)
  21505. @item bt709
  21506. BT.709
  21507. @item fcc
  21508. FCC
  21509. @item bt470bg
  21510. BT.470BG or BT.601-6 625
  21511. @item smpte170m
  21512. SMPTE-170M or BT.601-6 525
  21513. @item smpte240m
  21514. SMPTE-240M
  21515. @item bt2020ncl
  21516. BT.2020 with non-constant luminance
  21517. @end table
  21518. @item cscheme
  21519. Set spectrogram color scheme. This is list of floating point values with format
  21520. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  21521. The default is @code{1|0.5|0|0|0.5|1}.
  21522. @end table
  21523. @subsection Examples
  21524. @itemize
  21525. @item
  21526. Playing audio while showing the spectrum:
  21527. @example
  21528. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  21529. @end example
  21530. @item
  21531. Same as above, but with frame rate 30 fps:
  21532. @example
  21533. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  21534. @end example
  21535. @item
  21536. Playing at 1280x720:
  21537. @example
  21538. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  21539. @end example
  21540. @item
  21541. Disable sonogram display:
  21542. @example
  21543. sono_h=0
  21544. @end example
  21545. @item
  21546. A1 and its harmonics: A1, A2, (near)E3, A3:
  21547. @example
  21548. 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),
  21549. asplit[a][out1]; [a] showcqt [out0]'
  21550. @end example
  21551. @item
  21552. Same as above, but with more accuracy in frequency domain:
  21553. @example
  21554. 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),
  21555. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  21556. @end example
  21557. @item
  21558. Custom volume:
  21559. @example
  21560. bar_v=10:sono_v=bar_v*a_weighting(f)
  21561. @end example
  21562. @item
  21563. Custom gamma, now spectrum is linear to the amplitude.
  21564. @example
  21565. bar_g=2:sono_g=2
  21566. @end example
  21567. @item
  21568. Custom tlength equation:
  21569. @example
  21570. 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)))'
  21571. @end example
  21572. @item
  21573. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  21574. @example
  21575. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  21576. @end example
  21577. @item
  21578. Custom font using fontconfig:
  21579. @example
  21580. font='Courier New,Monospace,mono|bold'
  21581. @end example
  21582. @item
  21583. Custom frequency range with custom axis using image file:
  21584. @example
  21585. axisfile=myaxis.png:basefreq=40:endfreq=10000
  21586. @end example
  21587. @end itemize
  21588. @section showfreqs
  21589. Convert input audio to video output representing the audio power spectrum.
  21590. Audio amplitude is on Y-axis while frequency is on X-axis.
  21591. The filter accepts the following options:
  21592. @table @option
  21593. @item size, s
  21594. Specify size of video. For the syntax of this option, check the
  21595. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21596. Default is @code{1024x512}.
  21597. @item mode
  21598. Set display mode.
  21599. This set how each frequency bin will be represented.
  21600. It accepts the following values:
  21601. @table @samp
  21602. @item line
  21603. @item bar
  21604. @item dot
  21605. @end table
  21606. Default is @code{bar}.
  21607. @item ascale
  21608. Set amplitude scale.
  21609. It accepts the following values:
  21610. @table @samp
  21611. @item lin
  21612. Linear scale.
  21613. @item sqrt
  21614. Square root scale.
  21615. @item cbrt
  21616. Cubic root scale.
  21617. @item log
  21618. Logarithmic scale.
  21619. @end table
  21620. Default is @code{log}.
  21621. @item fscale
  21622. Set frequency scale.
  21623. It accepts the following values:
  21624. @table @samp
  21625. @item lin
  21626. Linear scale.
  21627. @item log
  21628. Logarithmic scale.
  21629. @item rlog
  21630. Reverse logarithmic scale.
  21631. @end table
  21632. Default is @code{lin}.
  21633. @item win_size
  21634. Set window size. Allowed range is from 16 to 65536.
  21635. Default is @code{2048}
  21636. @item win_func
  21637. Set windowing function.
  21638. It accepts the following values:
  21639. @table @samp
  21640. @item rect
  21641. @item bartlett
  21642. @item hanning
  21643. @item hamming
  21644. @item blackman
  21645. @item welch
  21646. @item flattop
  21647. @item bharris
  21648. @item bnuttall
  21649. @item bhann
  21650. @item sine
  21651. @item nuttall
  21652. @item lanczos
  21653. @item gauss
  21654. @item tukey
  21655. @item dolph
  21656. @item cauchy
  21657. @item parzen
  21658. @item poisson
  21659. @item bohman
  21660. @end table
  21661. Default is @code{hanning}.
  21662. @item overlap
  21663. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  21664. which means optimal overlap for selected window function will be picked.
  21665. @item averaging
  21666. Set time averaging. Setting this to 0 will display current maximal peaks.
  21667. Default is @code{1}, which means time averaging is disabled.
  21668. @item colors
  21669. Specify list of colors separated by space or by '|' which will be used to
  21670. draw channel frequencies. Unrecognized or missing colors will be replaced
  21671. by white color.
  21672. @item cmode
  21673. Set channel display mode.
  21674. It accepts the following values:
  21675. @table @samp
  21676. @item combined
  21677. @item separate
  21678. @end table
  21679. Default is @code{combined}.
  21680. @item minamp
  21681. Set minimum amplitude used in @code{log} amplitude scaler.
  21682. @item data
  21683. Set data display mode.
  21684. It accepts the following values:
  21685. @table @samp
  21686. @item magnitude
  21687. @item phase
  21688. @item delay
  21689. @end table
  21690. Default is @code{magnitude}.
  21691. @item channels
  21692. Set channels to use when processing audio. By default all are processed.
  21693. @end table
  21694. @section showspatial
  21695. Convert stereo input audio to a video output, representing the spatial relationship
  21696. between two channels.
  21697. The filter accepts the following options:
  21698. @table @option
  21699. @item size, s
  21700. Specify the video size for the output. For the syntax of this option, check the
  21701. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21702. Default value is @code{512x512}.
  21703. @item win_size
  21704. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  21705. @item win_func
  21706. Set window function.
  21707. It accepts the following values:
  21708. @table @samp
  21709. @item rect
  21710. @item bartlett
  21711. @item hann
  21712. @item hanning
  21713. @item hamming
  21714. @item blackman
  21715. @item welch
  21716. @item flattop
  21717. @item bharris
  21718. @item bnuttall
  21719. @item bhann
  21720. @item sine
  21721. @item nuttall
  21722. @item lanczos
  21723. @item gauss
  21724. @item tukey
  21725. @item dolph
  21726. @item cauchy
  21727. @item parzen
  21728. @item poisson
  21729. @item bohman
  21730. @end table
  21731. Default value is @code{hann}.
  21732. @item overlap
  21733. Set ratio of overlap window. Default value is @code{0.5}.
  21734. When value is @code{1} overlap is set to recommended size for specific
  21735. window function currently used.
  21736. @end table
  21737. @anchor{showspectrum}
  21738. @section showspectrum
  21739. Convert input audio to a video output, representing the audio frequency
  21740. spectrum.
  21741. The filter accepts the following options:
  21742. @table @option
  21743. @item size, s
  21744. Specify the video size for the output. For the syntax of this option, check the
  21745. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21746. Default value is @code{640x512}.
  21747. @item slide
  21748. Specify how the spectrum should slide along the window.
  21749. It accepts the following values:
  21750. @table @samp
  21751. @item replace
  21752. the samples start again on the left when they reach the right
  21753. @item scroll
  21754. the samples scroll from right to left
  21755. @item fullframe
  21756. frames are only produced when the samples reach the right
  21757. @item rscroll
  21758. the samples scroll from left to right
  21759. @item lreplace
  21760. the samples start again on the right when they reach the left
  21761. @end table
  21762. Default value is @code{replace}.
  21763. @item mode
  21764. Specify display mode.
  21765. It accepts the following values:
  21766. @table @samp
  21767. @item combined
  21768. all channels are displayed in the same row
  21769. @item separate
  21770. all channels are displayed in separate rows
  21771. @end table
  21772. Default value is @samp{combined}.
  21773. @item color
  21774. Specify display color mode.
  21775. It accepts the following values:
  21776. @table @samp
  21777. @item channel
  21778. each channel is displayed in a separate color
  21779. @item intensity
  21780. each channel is displayed using the same color scheme
  21781. @item rainbow
  21782. each channel is displayed using the rainbow color scheme
  21783. @item moreland
  21784. each channel is displayed using the moreland color scheme
  21785. @item nebulae
  21786. each channel is displayed using the nebulae color scheme
  21787. @item fire
  21788. each channel is displayed using the fire color scheme
  21789. @item fiery
  21790. each channel is displayed using the fiery color scheme
  21791. @item fruit
  21792. each channel is displayed using the fruit color scheme
  21793. @item cool
  21794. each channel is displayed using the cool color scheme
  21795. @item magma
  21796. each channel is displayed using the magma color scheme
  21797. @item green
  21798. each channel is displayed using the green color scheme
  21799. @item viridis
  21800. each channel is displayed using the viridis color scheme
  21801. @item plasma
  21802. each channel is displayed using the plasma color scheme
  21803. @item cividis
  21804. each channel is displayed using the cividis color scheme
  21805. @item terrain
  21806. each channel is displayed using the terrain color scheme
  21807. @end table
  21808. Default value is @samp{channel}.
  21809. @item scale
  21810. Specify scale used for calculating intensity color values.
  21811. It accepts the following values:
  21812. @table @samp
  21813. @item lin
  21814. linear
  21815. @item sqrt
  21816. square root, default
  21817. @item cbrt
  21818. cubic root
  21819. @item log
  21820. logarithmic
  21821. @item 4thrt
  21822. 4th root
  21823. @item 5thrt
  21824. 5th root
  21825. @end table
  21826. Default value is @samp{sqrt}.
  21827. @item fscale
  21828. Specify frequency scale.
  21829. It accepts the following values:
  21830. @table @samp
  21831. @item lin
  21832. linear
  21833. @item log
  21834. logarithmic
  21835. @end table
  21836. Default value is @samp{lin}.
  21837. @item saturation
  21838. Set saturation modifier for displayed colors. Negative values provide
  21839. alternative color scheme. @code{0} is no saturation at all.
  21840. Saturation must be in [-10.0, 10.0] range.
  21841. Default value is @code{1}.
  21842. @item win_func
  21843. Set window function.
  21844. It accepts the following values:
  21845. @table @samp
  21846. @item rect
  21847. @item bartlett
  21848. @item hann
  21849. @item hanning
  21850. @item hamming
  21851. @item blackman
  21852. @item welch
  21853. @item flattop
  21854. @item bharris
  21855. @item bnuttall
  21856. @item bhann
  21857. @item sine
  21858. @item nuttall
  21859. @item lanczos
  21860. @item gauss
  21861. @item tukey
  21862. @item dolph
  21863. @item cauchy
  21864. @item parzen
  21865. @item poisson
  21866. @item bohman
  21867. @end table
  21868. Default value is @code{hann}.
  21869. @item orientation
  21870. Set orientation of time vs frequency axis. Can be @code{vertical} or
  21871. @code{horizontal}. Default is @code{vertical}.
  21872. @item overlap
  21873. Set ratio of overlap window. Default value is @code{0}.
  21874. When value is @code{1} overlap is set to recommended size for specific
  21875. window function currently used.
  21876. @item gain
  21877. Set scale gain for calculating intensity color values.
  21878. Default value is @code{1}.
  21879. @item data
  21880. Set which data to display. Can be @code{magnitude}, default or @code{phase},
  21881. or unwrapped phase: @code{uphase}.
  21882. @item rotation
  21883. Set color rotation, must be in [-1.0, 1.0] range.
  21884. Default value is @code{0}.
  21885. @item start
  21886. Set start frequency from which to display spectrogram. Default is @code{0}.
  21887. @item stop
  21888. Set stop frequency to which to display spectrogram. Default is @code{0}.
  21889. @item fps
  21890. Set upper frame rate limit. Default is @code{auto}, unlimited.
  21891. @item legend
  21892. Draw time and frequency axes and legends. Default is disabled.
  21893. @item drange
  21894. Set dynamic range used to calculate intensity color values. Default is 120 dBFS.
  21895. Allowed range is from 10 to 200.
  21896. @item limit
  21897. Set upper limit of input audio samples volume in dBFS. Default is 0 dBFS.
  21898. Allowed range is from -100 to 100.
  21899. @item opacity
  21900. Set opacity strength when using pixel format output with alpha component.
  21901. @end table
  21902. The usage is very similar to the showwaves filter; see the examples in that
  21903. section.
  21904. @subsection Examples
  21905. @itemize
  21906. @item
  21907. Large window with logarithmic color scaling:
  21908. @example
  21909. showspectrum=s=1280x480:scale=log
  21910. @end example
  21911. @item
  21912. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  21913. @example
  21914. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  21915. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  21916. @end example
  21917. @end itemize
  21918. @section showspectrumpic
  21919. Convert input audio to a single video frame, representing the audio frequency
  21920. spectrum.
  21921. The filter accepts the following options:
  21922. @table @option
  21923. @item size, s
  21924. Specify the video size for the output. For the syntax of this option, check the
  21925. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21926. Default value is @code{4096x2048}.
  21927. @item mode
  21928. Specify display mode.
  21929. It accepts the following values:
  21930. @table @samp
  21931. @item combined
  21932. all channels are displayed in the same row
  21933. @item separate
  21934. all channels are displayed in separate rows
  21935. @end table
  21936. Default value is @samp{combined}.
  21937. @item color
  21938. Specify display color mode.
  21939. It accepts the following values:
  21940. @table @samp
  21941. @item channel
  21942. each channel is displayed in a separate color
  21943. @item intensity
  21944. each channel is displayed using the same color scheme
  21945. @item rainbow
  21946. each channel is displayed using the rainbow color scheme
  21947. @item moreland
  21948. each channel is displayed using the moreland color scheme
  21949. @item nebulae
  21950. each channel is displayed using the nebulae color scheme
  21951. @item fire
  21952. each channel is displayed using the fire color scheme
  21953. @item fiery
  21954. each channel is displayed using the fiery color scheme
  21955. @item fruit
  21956. each channel is displayed using the fruit color scheme
  21957. @item cool
  21958. each channel is displayed using the cool color scheme
  21959. @item magma
  21960. each channel is displayed using the magma color scheme
  21961. @item green
  21962. each channel is displayed using the green color scheme
  21963. @item viridis
  21964. each channel is displayed using the viridis color scheme
  21965. @item plasma
  21966. each channel is displayed using the plasma color scheme
  21967. @item cividis
  21968. each channel is displayed using the cividis color scheme
  21969. @item terrain
  21970. each channel is displayed using the terrain color scheme
  21971. @end table
  21972. Default value is @samp{intensity}.
  21973. @item scale
  21974. Specify scale used for calculating intensity color values.
  21975. It accepts the following values:
  21976. @table @samp
  21977. @item lin
  21978. linear
  21979. @item sqrt
  21980. square root, default
  21981. @item cbrt
  21982. cubic root
  21983. @item log
  21984. logarithmic
  21985. @item 4thrt
  21986. 4th root
  21987. @item 5thrt
  21988. 5th root
  21989. @end table
  21990. Default value is @samp{log}.
  21991. @item fscale
  21992. Specify frequency scale.
  21993. It accepts the following values:
  21994. @table @samp
  21995. @item lin
  21996. linear
  21997. @item log
  21998. logarithmic
  21999. @end table
  22000. Default value is @samp{lin}.
  22001. @item saturation
  22002. Set saturation modifier for displayed colors. Negative values provide
  22003. alternative color scheme. @code{0} is no saturation at all.
  22004. Saturation must be in [-10.0, 10.0] range.
  22005. Default value is @code{1}.
  22006. @item win_func
  22007. Set window function.
  22008. It accepts the following values:
  22009. @table @samp
  22010. @item rect
  22011. @item bartlett
  22012. @item hann
  22013. @item hanning
  22014. @item hamming
  22015. @item blackman
  22016. @item welch
  22017. @item flattop
  22018. @item bharris
  22019. @item bnuttall
  22020. @item bhann
  22021. @item sine
  22022. @item nuttall
  22023. @item lanczos
  22024. @item gauss
  22025. @item tukey
  22026. @item dolph
  22027. @item cauchy
  22028. @item parzen
  22029. @item poisson
  22030. @item bohman
  22031. @end table
  22032. Default value is @code{hann}.
  22033. @item orientation
  22034. Set orientation of time vs frequency axis. Can be @code{vertical} or
  22035. @code{horizontal}. Default is @code{vertical}.
  22036. @item gain
  22037. Set scale gain for calculating intensity color values.
  22038. Default value is @code{1}.
  22039. @item legend
  22040. Draw time and frequency axes and legends. Default is enabled.
  22041. @item rotation
  22042. Set color rotation, must be in [-1.0, 1.0] range.
  22043. Default value is @code{0}.
  22044. @item start
  22045. Set start frequency from which to display spectrogram. Default is @code{0}.
  22046. @item stop
  22047. Set stop frequency to which to display spectrogram. Default is @code{0}.
  22048. @item drange
  22049. Set dynamic range used to calculate intensity color values. Default is 120 dBFS.
  22050. Allowed range is from 10 to 200.
  22051. @item limit
  22052. Set upper limit of input audio samples volume in dBFS. Default is 0 dBFS.
  22053. Allowed range is from -100 to 100.
  22054. @item opacity
  22055. Set opacity strength when using pixel format output with alpha component.
  22056. @end table
  22057. @subsection Examples
  22058. @itemize
  22059. @item
  22060. Extract an audio spectrogram of a whole audio track
  22061. in a 1024x1024 picture using @command{ffmpeg}:
  22062. @example
  22063. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  22064. @end example
  22065. @end itemize
  22066. @section showvolume
  22067. Convert input audio volume to a video output.
  22068. The filter accepts the following options:
  22069. @table @option
  22070. @item rate, r
  22071. Set video rate.
  22072. @item b
  22073. Set border width, allowed range is [0, 5]. Default is 1.
  22074. @item w
  22075. Set channel width, allowed range is [80, 8192]. Default is 400.
  22076. @item h
  22077. Set channel height, allowed range is [1, 900]. Default is 20.
  22078. @item f
  22079. Set fade, allowed range is [0, 1]. Default is 0.95.
  22080. @item c
  22081. Set volume color expression.
  22082. The expression can use the following variables:
  22083. @table @option
  22084. @item VOLUME
  22085. Current max volume of channel in dB.
  22086. @item PEAK
  22087. Current peak.
  22088. @item CHANNEL
  22089. Current channel number, starting from 0.
  22090. @end table
  22091. @item t
  22092. If set, displays channel names. Default is enabled.
  22093. @item v
  22094. If set, displays volume values. Default is enabled.
  22095. @item o
  22096. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  22097. default is @code{h}.
  22098. @item s
  22099. Set step size, allowed range is [0, 5]. Default is 0, which means
  22100. step is disabled.
  22101. @item p
  22102. Set background opacity, allowed range is [0, 1]. Default is 0.
  22103. @item m
  22104. Set metering mode, can be peak: @code{p} or rms: @code{r},
  22105. default is @code{p}.
  22106. @item ds
  22107. Set display scale, can be linear: @code{lin} or log: @code{log},
  22108. default is @code{lin}.
  22109. @item dm
  22110. In second.
  22111. If set to > 0., display a line for the max level
  22112. in the previous seconds.
  22113. default is disabled: @code{0.}
  22114. @item dmc
  22115. The color of the max line. Use when @code{dm} option is set to > 0.
  22116. default is: @code{orange}
  22117. @end table
  22118. @section showwaves
  22119. Convert input audio to a video output, representing the samples waves.
  22120. The filter accepts the following options:
  22121. @table @option
  22122. @item size, s
  22123. Specify the video size for the output. For the syntax of this option, check the
  22124. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22125. Default value is @code{600x240}.
  22126. @item mode
  22127. Set display mode.
  22128. Available values are:
  22129. @table @samp
  22130. @item point
  22131. Draw a point for each sample.
  22132. @item line
  22133. Draw a vertical line for each sample.
  22134. @item p2p
  22135. Draw a point for each sample and a line between them.
  22136. @item cline
  22137. Draw a centered vertical line for each sample.
  22138. @end table
  22139. Default value is @code{point}.
  22140. @item n
  22141. Set the number of samples which are printed on the same column. A
  22142. larger value will decrease the frame rate. Must be a positive
  22143. integer. This option can be set only if the value for @var{rate}
  22144. is not explicitly specified.
  22145. @item rate, r
  22146. Set the (approximate) output frame rate. This is done by setting the
  22147. option @var{n}. Default value is "25".
  22148. @item split_channels
  22149. Set if channels should be drawn separately or overlap. Default value is 0.
  22150. @item colors
  22151. Set colors separated by '|' which are going to be used for drawing of each channel.
  22152. @item scale
  22153. Set amplitude scale.
  22154. Available values are:
  22155. @table @samp
  22156. @item lin
  22157. Linear.
  22158. @item log
  22159. Logarithmic.
  22160. @item sqrt
  22161. Square root.
  22162. @item cbrt
  22163. Cubic root.
  22164. @end table
  22165. Default is linear.
  22166. @item draw
  22167. Set the draw mode. This is mostly useful to set for high @var{n}.
  22168. Available values are:
  22169. @table @samp
  22170. @item scale
  22171. Scale pixel values for each drawn sample.
  22172. @item full
  22173. Draw every sample directly.
  22174. @end table
  22175. Default value is @code{scale}.
  22176. @end table
  22177. @subsection Examples
  22178. @itemize
  22179. @item
  22180. Output the input file audio and the corresponding video representation
  22181. at the same time:
  22182. @example
  22183. amovie=a.mp3,asplit[out0],showwaves[out1]
  22184. @end example
  22185. @item
  22186. Create a synthetic signal and show it with showwaves, forcing a
  22187. frame rate of 30 frames per second:
  22188. @example
  22189. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  22190. @end example
  22191. @end itemize
  22192. @section showwavespic
  22193. Convert input audio to a single video frame, representing the samples waves.
  22194. The filter accepts the following options:
  22195. @table @option
  22196. @item size, s
  22197. Specify the video size for the output. For the syntax of this option, check the
  22198. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22199. Default value is @code{600x240}.
  22200. @item split_channels
  22201. Set if channels should be drawn separately or overlap. Default value is 0.
  22202. @item colors
  22203. Set colors separated by '|' which are going to be used for drawing of each channel.
  22204. @item scale
  22205. Set amplitude scale.
  22206. Available values are:
  22207. @table @samp
  22208. @item lin
  22209. Linear.
  22210. @item log
  22211. Logarithmic.
  22212. @item sqrt
  22213. Square root.
  22214. @item cbrt
  22215. Cubic root.
  22216. @end table
  22217. Default is linear.
  22218. @item draw
  22219. Set the draw mode.
  22220. Available values are:
  22221. @table @samp
  22222. @item scale
  22223. Scale pixel values for each drawn sample.
  22224. @item full
  22225. Draw every sample directly.
  22226. @end table
  22227. Default value is @code{scale}.
  22228. @item filter
  22229. Set the filter mode.
  22230. Available values are:
  22231. @table @samp
  22232. @item average
  22233. Use average samples values for each drawn sample.
  22234. @item peak
  22235. Use peak samples values for each drawn sample.
  22236. @end table
  22237. Default value is @code{average}.
  22238. @end table
  22239. @subsection Examples
  22240. @itemize
  22241. @item
  22242. Extract a channel split representation of the wave form of a whole audio track
  22243. in a 1024x800 picture using @command{ffmpeg}:
  22244. @example
  22245. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  22246. @end example
  22247. @end itemize
  22248. @section sidedata, asidedata
  22249. Delete frame side data, or select frames based on it.
  22250. This filter accepts the following options:
  22251. @table @option
  22252. @item mode
  22253. Set mode of operation of the filter.
  22254. Can be one of the following:
  22255. @table @samp
  22256. @item select
  22257. Select every frame with side data of @code{type}.
  22258. @item delete
  22259. Delete side data of @code{type}. If @code{type} is not set, delete all side
  22260. data in the frame.
  22261. @end table
  22262. @item type
  22263. Set side data type used with all modes. Must be set for @code{select} mode. For
  22264. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  22265. in @file{libavutil/frame.h}. For example, to choose
  22266. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  22267. @end table
  22268. @section spectrumsynth
  22269. Synthesize audio from 2 input video spectrums, first input stream represents
  22270. magnitude across time and second represents phase across time.
  22271. The filter will transform from frequency domain as displayed in videos back
  22272. to time domain as presented in audio output.
  22273. This filter is primarily created for reversing processed @ref{showspectrum}
  22274. filter outputs, but can synthesize sound from other spectrograms too.
  22275. But in such case results are going to be poor if the phase data is not
  22276. available, because in such cases phase data need to be recreated, usually
  22277. it's just recreated from random noise.
  22278. For best results use gray only output (@code{channel} color mode in
  22279. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  22280. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  22281. @code{data} option. Inputs videos should generally use @code{fullframe}
  22282. slide mode as that saves resources needed for decoding video.
  22283. The filter accepts the following options:
  22284. @table @option
  22285. @item sample_rate
  22286. Specify sample rate of output audio, the sample rate of audio from which
  22287. spectrum was generated may differ.
  22288. @item channels
  22289. Set number of channels represented in input video spectrums.
  22290. @item scale
  22291. Set scale which was used when generating magnitude input spectrum.
  22292. Can be @code{lin} or @code{log}. Default is @code{log}.
  22293. @item slide
  22294. Set slide which was used when generating inputs spectrums.
  22295. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  22296. Default is @code{fullframe}.
  22297. @item win_func
  22298. Set window function used for resynthesis.
  22299. @item overlap
  22300. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  22301. which means optimal overlap for selected window function will be picked.
  22302. @item orientation
  22303. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  22304. Default is @code{vertical}.
  22305. @end table
  22306. @subsection Examples
  22307. @itemize
  22308. @item
  22309. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  22310. then resynthesize videos back to audio with spectrumsynth:
  22311. @example
  22312. 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
  22313. 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
  22314. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  22315. @end example
  22316. @end itemize
  22317. @section split, asplit
  22318. Split input into several identical outputs.
  22319. @code{asplit} works with audio input, @code{split} with video.
  22320. The filter accepts a single parameter which specifies the number of outputs. If
  22321. unspecified, it defaults to 2.
  22322. @subsection Examples
  22323. @itemize
  22324. @item
  22325. Create two separate outputs from the same input:
  22326. @example
  22327. [in] split [out0][out1]
  22328. @end example
  22329. @item
  22330. To create 3 or more outputs, you need to specify the number of
  22331. outputs, like in:
  22332. @example
  22333. [in] asplit=3 [out0][out1][out2]
  22334. @end example
  22335. @item
  22336. Create two separate outputs from the same input, one cropped and
  22337. one padded:
  22338. @example
  22339. [in] split [splitout1][splitout2];
  22340. [splitout1] crop=100:100:0:0 [cropout];
  22341. [splitout2] pad=200:200:100:100 [padout];
  22342. @end example
  22343. @item
  22344. Create 5 copies of the input audio with @command{ffmpeg}:
  22345. @example
  22346. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  22347. @end example
  22348. @end itemize
  22349. @section zmq, azmq
  22350. Receive commands sent through a libzmq client, and forward them to
  22351. filters in the filtergraph.
  22352. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  22353. must be inserted between two video filters, @code{azmq} between two
  22354. audio filters. Both are capable to send messages to any filter type.
  22355. To enable these filters you need to install the libzmq library and
  22356. headers and configure FFmpeg with @code{--enable-libzmq}.
  22357. For more information about libzmq see:
  22358. @url{http://www.zeromq.org/}
  22359. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  22360. receives messages sent through a network interface defined by the
  22361. @option{bind_address} (or the abbreviation "@option{b}") option.
  22362. Default value of this option is @file{tcp://localhost:5555}. You may
  22363. want to alter this value to your needs, but do not forget to escape any
  22364. ':' signs (see @ref{filtergraph escaping}).
  22365. The received message must be in the form:
  22366. @example
  22367. @var{TARGET} @var{COMMAND} [@var{ARG}]
  22368. @end example
  22369. @var{TARGET} specifies the target of the command, usually the name of
  22370. the filter class or a specific filter instance name. The default
  22371. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  22372. but you can override this by using the @samp{filter_name@@id} syntax
  22373. (see @ref{Filtergraph syntax}).
  22374. @var{COMMAND} specifies the name of the command for the target filter.
  22375. @var{ARG} is optional and specifies the optional argument list for the
  22376. given @var{COMMAND}.
  22377. Upon reception, the message is processed and the corresponding command
  22378. is injected into the filtergraph. Depending on the result, the filter
  22379. will send a reply to the client, adopting the format:
  22380. @example
  22381. @var{ERROR_CODE} @var{ERROR_REASON}
  22382. @var{MESSAGE}
  22383. @end example
  22384. @var{MESSAGE} is optional.
  22385. @subsection Examples
  22386. Look at @file{tools/zmqsend} for an example of a zmq client which can
  22387. be used to send commands processed by these filters.
  22388. Consider the following filtergraph generated by @command{ffplay}.
  22389. In this example the last overlay filter has an instance name. All other
  22390. filters will have default instance names.
  22391. @example
  22392. ffplay -dumpgraph 1 -f lavfi "
  22393. color=s=100x100:c=red [l];
  22394. color=s=100x100:c=blue [r];
  22395. nullsrc=s=200x100, zmq [bg];
  22396. [bg][l] overlay [bg+l];
  22397. [bg+l][r] overlay@@my=x=100 "
  22398. @end example
  22399. To change the color of the left side of the video, the following
  22400. command can be used:
  22401. @example
  22402. echo Parsed_color_0 c yellow | tools/zmqsend
  22403. @end example
  22404. To change the right side:
  22405. @example
  22406. echo Parsed_color_1 c pink | tools/zmqsend
  22407. @end example
  22408. To change the position of the right side:
  22409. @example
  22410. echo overlay@@my x 150 | tools/zmqsend
  22411. @end example
  22412. @c man end MULTIMEDIA FILTERS
  22413. @chapter Multimedia Sources
  22414. @c man begin MULTIMEDIA SOURCES
  22415. Below is a description of the currently available multimedia sources.
  22416. @section amovie
  22417. This is the same as @ref{movie} source, except it selects an audio
  22418. stream by default.
  22419. @section avsynctest
  22420. Generate an Audio/Video Sync Test.
  22421. Generated stream periodically shows flash video frame and emits beep in audio.
  22422. Useful to inspect A/V sync issues.
  22423. It accepts the following options:
  22424. @table @option
  22425. @item size, s
  22426. Set output video size. Default value is @code{hd720}.
  22427. @item framerate, fr
  22428. Set output video frame rate. Default value is @code{30}.
  22429. @item samplerate, sr
  22430. Set output audio sample rate. Default value is @code{44100}.
  22431. @item amplitude, a
  22432. Set output audio beep amplitude. Default value is @code{0.7}.
  22433. @item period, p
  22434. Set output audio beep period in seconds. Default value is @code{3}.
  22435. @item delay, dl
  22436. Set output video flash delay in number of frames. Default value is @code{0}.
  22437. @item cycle, c
  22438. Enable cycling of video delays, by default is disabled.
  22439. @item duration, d
  22440. Set stream output duration. By default duration is unlimited.
  22441. @item fg, bg, ag
  22442. Set foreground/background/additional color.
  22443. @end table
  22444. @anchor{movie}
  22445. @section movie
  22446. Read audio and/or video stream(s) from a movie container.
  22447. It accepts the following parameters:
  22448. @table @option
  22449. @item filename
  22450. The name of the resource to read (not necessarily a file; it can also be a
  22451. device or a stream accessed through some protocol).
  22452. @item format_name, f
  22453. Specifies the format assumed for the movie to read, and can be either
  22454. the name of a container or an input device. If not specified, the
  22455. format is guessed from @var{movie_name} or by probing.
  22456. @item seek_point, sp
  22457. Specifies the seek point in seconds. The frames will be output
  22458. starting from this seek point. The parameter is evaluated with
  22459. @code{av_strtod}, so the numerical value may be suffixed by an IS
  22460. postfix. The default value is "0".
  22461. @item streams, s
  22462. Specifies the streams to read. Several streams can be specified,
  22463. separated by "+". The source will then have as many outputs, in the
  22464. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  22465. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  22466. respectively the default (best suited) video and audio stream. Default
  22467. is "dv", or "da" if the filter is called as "amovie".
  22468. @item stream_index, si
  22469. Specifies the index of the video stream to read. If the value is -1,
  22470. the most suitable video stream will be automatically selected. The default
  22471. value is "-1". Deprecated. If the filter is called "amovie", it will select
  22472. audio instead of video.
  22473. @item loop
  22474. Specifies how many times to read the stream in sequence.
  22475. If the value is 0, the stream will be looped infinitely.
  22476. Default value is "1".
  22477. Note that when the movie is looped the source timestamps are not
  22478. changed, so it will generate non monotonically increasing timestamps.
  22479. @item discontinuity
  22480. Specifies the time difference between frames above which the point is
  22481. considered a timestamp discontinuity which is removed by adjusting the later
  22482. timestamps.
  22483. @item dec_threads
  22484. Specifies the number of threads for decoding
  22485. @item format_opts
  22486. Specify format options for the opened file. Format options can be specified
  22487. as a list of @var{key}=@var{value} pairs separated by ':'. The following example
  22488. shows how to add protocol_whitelist and protocol_blacklist options:
  22489. @example
  22490. ffplay -f lavfi
  22491. "movie=filename='1.sdp':format_opts='protocol_whitelist=file,rtp,udp\:protocol_blacklist=http'"
  22492. @end example
  22493. @end table
  22494. It allows overlaying a second video on top of the main input of
  22495. a filtergraph, as shown in this graph:
  22496. @example
  22497. input -----------> deltapts0 --> overlay --> output
  22498. ^
  22499. |
  22500. movie --> scale--> deltapts1 -------+
  22501. @end example
  22502. @subsection Examples
  22503. @itemize
  22504. @item
  22505. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  22506. on top of the input labelled "in":
  22507. @example
  22508. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  22509. [in] setpts=PTS-STARTPTS [main];
  22510. [main][over] overlay=16:16 [out]
  22511. @end example
  22512. @item
  22513. Read from a video4linux2 device, and overlay it on top of the input
  22514. labelled "in":
  22515. @example
  22516. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  22517. [in] setpts=PTS-STARTPTS [main];
  22518. [main][over] overlay=16:16 [out]
  22519. @end example
  22520. @item
  22521. Read the first video stream and the audio stream with id 0x81 from
  22522. dvd.vob; the video is connected to the pad named "video" and the audio is
  22523. connected to the pad named "audio":
  22524. @example
  22525. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  22526. @end example
  22527. @end itemize
  22528. @subsection Commands
  22529. Both movie and amovie support the following commands:
  22530. @table @option
  22531. @item seek
  22532. Perform seek using "av_seek_frame".
  22533. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  22534. @itemize
  22535. @item
  22536. @var{stream_index}: If stream_index is -1, a default
  22537. stream is selected, and @var{timestamp} is automatically converted
  22538. from AV_TIME_BASE units to the stream specific time_base.
  22539. @item
  22540. @var{timestamp}: Timestamp in AVStream.time_base units
  22541. or, if no stream is specified, in AV_TIME_BASE units.
  22542. @item
  22543. @var{flags}: Flags which select direction and seeking mode.
  22544. @end itemize
  22545. @item get_duration
  22546. Get movie duration in AV_TIME_BASE units.
  22547. @end table
  22548. @c man end MULTIMEDIA SOURCES